summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/QtcPlugin.qbs10
-rw-r--r--src/plugins/analyzerbase/analyzerbase.qbs22
-rw-r--r--src/plugins/analyzerbase/analyzermanager.cpp3
-rw-r--r--src/plugins/analyzerbase/analyzerruncontrolfactory.cpp8
-rw-r--r--src/plugins/analyzerbase/analyzerruncontrolfactory.h1
-rw-r--r--src/plugins/analyzerbase/analyzersettings.cpp22
-rw-r--r--src/plugins/analyzerbase/analyzersettings.h6
-rw-r--r--src/plugins/android/android.qbs17
-rw-r--r--src/plugins/android/androidconfigurations.cpp41
-rw-r--r--src/plugins/android/androidconstants.h2
-rw-r--r--src/plugins/android/androiddeployconfiguration.cpp1
-rw-r--r--src/plugins/android/androidpackagecreationwidget.cpp3
-rw-r--r--src/plugins/android/androidrunner.cpp4
-rw-r--r--src/plugins/android/androidsettingswidget.cpp30
-rw-r--r--src/plugins/android/androidtoolchain.cpp40
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs8
-rw-r--r--src/plugins/bazaar/bazaar.qbs39
-rw-r--r--src/plugins/bineditor/bineditor.qbs11
-rw-r--r--src/plugins/bookmarks/bookmark.cpp16
-rw-r--r--src/plugins/bookmarks/bookmark.h4
-rw-r--r--src/plugins/bookmarks/bookmarkmanager.cpp87
-rw-r--r--src/plugins/bookmarks/bookmarkmanager.h11
-rw-r--r--src/plugins/bookmarks/bookmarks.qbs13
-rw-r--r--src/plugins/bookmarks/bookmarks_global.h1
-rw-r--r--src/plugins/bookmarks/bookmarksplugin.cpp21
-rw-r--r--src/plugins/bookmarks/bookmarksplugin.h2
-rw-r--r--src/plugins/classview/classview.qbs37
-rw-r--r--src/plugins/clearcase/clearcase.qbs6
-rw-r--r--src/plugins/clearcase/clearcaseplugin.cpp10
-rw-r--r--src/plugins/clearcase/clearcasesettings.cpp7
-rw-r--r--src/plugins/clearcase/settingspage.cpp11
-rw-r--r--src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp5
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp11
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.cpp2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs10
-rw-r--r--src/plugins/coreplugin/actionmanager/command.cpp7
-rw-r--r--src/plugins/coreplugin/actionmanager/commandmappings.cpp21
-rw-r--r--src/plugins/coreplugin/actionmanager/commandsfile.cpp2
-rw-r--r--src/plugins/coreplugin/basefilewizard.cpp19
-rw-r--r--src/plugins/coreplugin/coreplugin.qbs69
-rw-r--r--src/plugins/coreplugin/designmode.cpp7
-rw-r--r--src/plugins/coreplugin/dialogs/externaltoolconfig.cpp15
-rw-r--r--src/plugins/coreplugin/dialogs/saveitemsdialog.cpp28
-rw-r--r--src/plugins/coreplugin/dialogs/settingsdialog.cpp14
-rw-r--r--src/plugins/coreplugin/dialogs/shortcutsettings.cpp18
-rw-r--r--src/plugins/coreplugin/documentmanager.cpp32
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.cpp10
-rw-r--r--src/plugins/coreplugin/editormanager/openeditorsview.cpp12
-rw-r--r--src/plugins/coreplugin/editormanager/openeditorswindow.cpp11
-rw-r--r--src/plugins/coreplugin/editortoolbar.cpp9
-rw-r--r--src/plugins/coreplugin/fancytabwidget.cpp20
-rw-r--r--src/plugins/coreplugin/fileiconprovider.cpp10
-rw-r--r--src/plugins/coreplugin/inavigationwidgetfactory.h2
-rw-r--r--src/plugins/coreplugin/mimedatabase.cpp2
-rw-r--r--src/plugins/coreplugin/outputpanemanager.cpp7
-rw-r--r--src/plugins/coreplugin/progressmanager/progressmanager.cpp4
-rw-r--r--src/plugins/coreplugin/scriptmanager/scriptmanager.cpp2
-rw-r--r--src/plugins/coreplugin/sidebar.cpp13
-rw-r--r--src/plugins/cpaster/codepasterprotocol.cpp16
-rw-r--r--src/plugins/cpaster/cpaster.qbs12
-rw-r--r--src/plugins/cpaster/frontend/argumentscollector.cpp134
-rw-r--r--src/plugins/cpaster/frontend/argumentscollector.h67
-rw-r--r--src/plugins/cpaster/frontend/frontend.pro30
-rw-r--r--src/plugins/cpaster/frontend/frontend.qbs30
-rw-r--r--src/plugins/cpaster/frontend/main.cpp128
-rw-r--r--src/plugins/cpaster/pastebindotcaprotocol.cpp2
-rw-r--r--src/plugins/cpaster/pastebindotcaprotocol.h4
-rw-r--r--src/plugins/cpaster/pastebindotcomprotocol.cpp4
-rw-r--r--src/plugins/cpaster/pasteselectdialog.cpp6
-rw-r--r--src/plugins/cpaster/settings.cpp8
-rw-r--r--src/plugins/cppeditor/cppeditor.qbs13
-rw-r--r--src/plugins/cppeditor/cppfunctiondecldeflink.cpp2
-rw-r--r--src/plugins/cppeditor/cpphighlighter.cpp38
-rw-r--r--src/plugins/cppeditor/cppplugin.cpp21
-rw-r--r--src/plugins/cpptools/ModelManagerInterface.h6
-rw-r--r--src/plugins/cpptools/cppchecksymbols.cpp28
-rw-r--r--src/plugins/cpptools/cppclassesfilter.h2
-rw-r--r--src/plugins/cpptools/cppcodeformatter.cpp18
-rw-r--r--src/plugins/cpptools/cppcodeformatter.h3
-rw-r--r--src/plugins/cpptools/cppcurrentdocumentfilter.h2
-rw-r--r--src/plugins/cpptools/cppfilesettingspage.cpp7
-rw-r--r--src/plugins/cpptools/cppfunctionsfilter.h4
-rw-r--r--src/plugins/cpptools/cpplocatorfilter.cpp10
-rw-r--r--src/plugins/cpptools/cpplocatorfilter.h2
-rw-r--r--src/plugins/cpptools/cppmodelmanager.cpp98
-rw-r--r--src/plugins/cpptools/cppmodelmanager.h33
-rw-r--r--src/plugins/cpptools/cpptools.qbs43
-rw-r--r--src/plugins/cvs/cvs.qbs37
-rw-r--r--src/plugins/cvs/cvsplugin.cpp2
-rw-r--r--src/plugins/cvs/cvssettings.cpp8
-rw-r--r--src/plugins/debugger/breakhandler.cpp13
-rw-r--r--src/plugins/debugger/cdb/cdbengine.cpp22
-rw-r--r--src/plugins/debugger/cdb/cdbparsehelpers.cpp2
-rw-r--r--src/plugins/debugger/commonoptionspage.cpp48
-rw-r--r--src/plugins/debugger/debugger.pro12
-rw-r--r--src/plugins/debugger/debugger.qbs115
-rw-r--r--src/plugins/debugger/debugger.qrc6
-rw-r--r--src/plugins/debugger/debugger_dependencies.pri1
-rw-r--r--src/plugins/debugger/debuggerconstants.h6
-rw-r--r--src/plugins/debugger/debuggerengine.cpp22
-rw-r--r--src/plugins/debugger/debuggerengine.h6
-rw-r--r--src/plugins/debugger/debuggermainwindow.cpp7
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp34
-rw-r--r--src/plugins/debugger/debuggerrunner.cpp3
-rw-r--r--src/plugins/debugger/gdb/classicgdbengine.cpp4
-rw-r--r--src/plugins/debugger/gdb/gdbengine.cpp15
-rw-r--r--src/plugins/debugger/gdb/localplaingdbadapter.cpp8
-rw-r--r--src/plugins/debugger/gdb/remotegdbserveradapter.cpp9
-rw-r--r--src/plugins/debugger/gdb/termgdbadapter.cpp9
-rw-r--r--src/plugins/debugger/moduleshandler.cpp6
-rw-r--r--src/plugins/debugger/moduleswindow.cpp8
-rw-r--r--src/plugins/debugger/namedemangler/namedemangler.cpp2
-rw-r--r--src/plugins/debugger/qml/qmlcppengine.cpp6
-rw-r--r--src/plugins/debugger/qml/qmlcppengine.h2
-rw-r--r--src/plugins/debugger/qml/qmlengine.cpp176
-rw-r--r--src/plugins/debugger/qml/qmlengine.h4
-rw-r--r--src/plugins/debugger/qml/qmlv8debuggerclient.cpp150
-rw-r--r--src/plugins/debugger/qml/qscriptdebuggerclient.cpp2
-rw-r--r--src/plugins/debugger/qtmessageloghandler.cpp405
-rw-r--r--src/plugins/debugger/qtmessageloghandler.h149
-rw-r--r--src/plugins/debugger/qtmessagelogwindow.cpp253
-rw-r--r--src/plugins/debugger/registerhandler.cpp9
-rw-r--r--src/plugins/debugger/snapshothandler.cpp15
-rw-r--r--src/plugins/debugger/snapshothandler.h2
-rw-r--r--src/plugins/debugger/sourcefileshandler.cpp6
-rw-r--r--src/plugins/debugger/sourcefileshandler.h1
-rw-r--r--src/plugins/debugger/stackhandler.cpp9
-rw-r--r--src/plugins/debugger/stackhandler.h2
-rw-r--r--src/plugins/debugger/threadshandler.cpp9
-rw-r--r--src/plugins/debugger/watchdelegatewidgets.cpp4
-rw-r--r--src/plugins/debugger/watchhandler.cpp28
-rw-r--r--src/plugins/debugger/watchutils.cpp2
-rw-r--r--src/plugins/debugger/watchutils.h11
-rw-r--r--src/plugins/designer/designer.qbs111
-rw-r--r--src/plugins/designer/formwindoweditor.cpp2
-rw-r--r--src/plugins/fakevim/fakevim.pro4
-rw-r--r--src/plugins/fakevim/fakevim.qbs20
-rw-r--r--src/plugins/fakevim/fakevim_test.cpp949
-rw-r--r--src/plugins/fakevim/fakevimactions.cpp7
-rw-r--r--src/plugins/fakevim/fakevimactions.h2
-rw-r--r--src/plugins/fakevim/fakevimhandler.cpp2305
-rw-r--r--src/plugins/fakevim/fakevimhandler.h27
-rw-r--r--src/plugins/fakevim/fakevimoptions.ui11
-rw-r--r--src/plugins/fakevim/fakevimplugin.cpp165
-rw-r--r--src/plugins/fakevim/fakevimplugin.h20
-rw-r--r--src/plugins/find/find.qbs17
-rw-r--r--src/plugins/find/findtoolbar.cpp13
-rw-r--r--src/plugins/find/searchresulttreemodel.cpp3
-rw-r--r--src/plugins/genericprojectmanager/genericprojectmanager.qbs42
-rw-r--r--src/plugins/git/gerrit/gerritoptionspage.h4
-rw-r--r--src/plugins/git/gerrit/gerritparameters.cpp19
-rw-r--r--src/plugins/git/gerrit/gerritplugin.cpp8
-rw-r--r--src/plugins/git/gerrit/gerritplugin.h4
-rw-r--r--src/plugins/git/git.qbs33
-rw-r--r--src/plugins/git/gitclient.cpp27
-rw-r--r--src/plugins/git/gitorious/gitoriousclonewizard.cpp4
-rw-r--r--src/plugins/git/gitplugin.cpp8
-rw-r--r--src/plugins/git/gitsettings.cpp7
-rw-r--r--src/plugins/git/gitutils.cpp2
-rw-r--r--src/plugins/git/remotemodel.cpp6
-rw-r--r--src/plugins/git/settingspage.cpp27
-rw-r--r--src/plugins/glsleditor/glsleditor.qbs41
-rw-r--r--src/plugins/helloworld/helloworld.qbs11
-rw-r--r--src/plugins/help/externalhelpwindow.cpp23
-rw-r--r--src/plugins/help/generalsettingspage.cpp2
-rw-r--r--src/plugins/help/help.qbs82
-rw-r--r--src/plugins/help/helpplugin.cpp27
-rw-r--r--src/plugins/help/helpviewer_qtb.cpp12
-rw-r--r--src/plugins/help/helpviewer_qwv.cpp16
-rw-r--r--src/plugins/help/openpagesswitcher.cpp14
-rw-r--r--src/plugins/help/remotehelpfilter.cpp8
-rw-r--r--src/plugins/help/remotehelpfilter.h1
-rw-r--r--src/plugins/help/searchwidget.cpp12
-rw-r--r--src/plugins/imageviewer/imageviewer.qbs31
-rw-r--r--src/plugins/locator/basefilefilter.cpp4
-rw-r--r--src/plugins/locator/locator.qbs29
-rw-r--r--src/plugins/locator/locatorwidget.cpp29
-rw-r--r--src/plugins/locator/opendocumentsfilter.cpp4
-rw-r--r--src/plugins/macros/macros.qbs18
-rw-r--r--src/plugins/madde/Madde.pluginspec.in1
-rw-r--r--src/plugins/madde/debianmanager.cpp4
-rw-r--r--src/plugins/madde/madde.pro5
-rw-r--r--src/plugins/madde/madde.qbs24
-rw-r--r--src/plugins/madde/madde_dependencies.pri1
-rw-r--r--src/plugins/madde/maemoconstants.h6
-rw-r--r--src/plugins/madde/maemodeploybymountsteps.cpp63
-rw-r--r--src/plugins/madde/maemodeployconfigurationwidget.cpp218
-rw-r--r--src/plugins/madde/maemodeployconfigurationwidget.h78
-rw-r--r--src/plugins/madde/maemodeployconfigurationwidget.ui48
-rw-r--r--src/plugins/madde/maemoglobal.cpp59
-rw-r--r--src/plugins/madde/maemoinstalltosysrootstep.cpp28
-rw-r--r--src/plugins/madde/maemoinstalltosysrootstep.h4
-rw-r--r--src/plugins/madde/maemopackagecreationstep.cpp23
-rw-r--r--src/plugins/madde/maemopackagecreationwidget.cpp2
-rw-r--r--src/plugins/madde/maemopublisherfremantlefree.cpp81
-rw-r--r--src/plugins/madde/maemopublisherfremantlefree.h3
-rw-r--r--src/plugins/madde/maemoqemuruntimeparser.cpp45
-rw-r--r--src/plugins/madde/maemoqtversion.cpp6
-rw-r--r--src/plugins/madde/maemoremotecopyfacility.cpp20
-rw-r--r--src/plugins/madde/maemoremotecopyfacility.h8
-rw-r--r--src/plugins/madde/maemorunconfiguration.h3
-rw-r--r--src/plugins/madde/maemorunfactories.cpp5
-rw-r--r--src/plugins/madde/qt4maemodeployconfiguration.cpp82
-rw-r--r--src/plugins/madde/qt4maemodeployconfiguration.h13
-rw-r--r--src/plugins/mercurial/mercurial.qbs54
-rw-r--r--src/plugins/perforce/perforce.qbs48
-rw-r--r--src/plugins/perforce/perforceplugin.cpp4
-rw-r--r--src/plugins/perforce/perforcesettings.cpp8
-rw-r--r--src/plugins/plugins.pro3
-rw-r--r--src/plugins/projectexplorer/abi.cpp2
-rw-r--r--src/plugins/projectexplorer/applicationlauncher.cpp2
-rw-r--r--src/plugins/projectexplorer/buildconfiguration.cpp13
-rw-r--r--src/plugins/projectexplorer/buildconfiguration.h1
-rw-r--r--src/plugins/projectexplorer/buildmanager.cpp9
-rw-r--r--src/plugins/projectexplorer/buildstepspage.cpp31
-rw-r--r--src/plugins/projectexplorer/buildtargetinfo.h27
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp18
-rw-r--r--src/plugins/projectexplorer/dependenciespanel.cpp3
-rw-r--r--src/plugins/projectexplorer/deployconfiguration.cpp35
-rw-r--r--src/plugins/projectexplorer/deployconfiguration.h12
-rw-r--r--src/plugins/projectexplorer/environmentitemswidget.cpp6
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.cpp78
-rw-r--r--src/plugins/projectexplorer/images/targetchangebutton.pngbin0 -> 1605 bytes
-rw-r--r--src/plugins/projectexplorer/images/targetchangebutton2.pngbin0 -> 1578 bytes
-rw-r--r--src/plugins/projectexplorer/images/targetremovebutton.pngbin566 -> 0 bytes
-rw-r--r--src/plugins/projectexplorer/images/targetremovebuttondark.pngbin1533 -> 0 bytes
-rw-r--r--src/plugins/projectexplorer/processstep.h3
-rw-r--r--src/plugins/projectexplorer/project.cpp4
-rw-r--r--src/plugins/projectexplorer/project.h2
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp82
-rw-r--r--src/plugins/projectexplorer/projectexplorer.qbs260
-rw-r--r--src/plugins/projectexplorer/projectexplorer.qrc4
-rw-r--r--src/plugins/projectexplorer/projectexplorersettingspage.cpp5
-rw-r--r--src/plugins/projectexplorer/projectmodels.cpp3
-rw-r--r--src/plugins/projectexplorer/projectwelcomepage.cpp15
-rw-r--r--src/plugins/projectexplorer/runconfiguration.cpp50
-rw-r--r--src/plugins/projectexplorer/runconfiguration.h8
-rw-r--r--src/plugins/projectexplorer/settingsaccessor.cpp163
-rw-r--r--src/plugins/projectexplorer/target.cpp10
-rw-r--r--src/plugins/projectexplorer/target.h3
-rw-r--r--src/plugins/projectexplorer/targetselector.cpp125
-rw-r--r--src/plugins/projectexplorer/targetselector.h20
-rw-r--r--src/plugins/projectexplorer/targetsettingspanel.cpp283
-rw-r--r--src/plugins/projectexplorer/targetsettingspanel.h18
-rw-r--r--src/plugins/projectexplorer/targetsettingswidget.cpp9
-rw-r--r--src/plugins/projectexplorer/targetsettingswidget.h8
-rw-r--r--src/plugins/qmldesigner/components/componentcore/componentcore.pri5
-rw-r--r--src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu.cpp (renamed from src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp)6
-rw-r--r--src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu.h (renamed from src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h)2
-rw-r--r--src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp4
-rw-r--r--src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp4
-rw-r--r--src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp466
-rw-r--r--src/plugins/qmldesigner/components/integration/designdocumentcontroller.h73
-rw-r--r--src/plugins/qmldesigner/components/integration/integration.pri2
-rw-r--r--src/plugins/qmldesigner/components/integration/integrationcore.cpp94
-rw-r--r--src/plugins/qmldesigner/components/integration/integrationcore.h64
-rw-r--r--src/plugins/qmldesigner/components/integration/xuifiledialog.cpp30
-rw-r--r--src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp281
-rw-r--r--src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.h46
-rw-r--r--src/plugins/qmldesigner/components/navigator/navigator.pri1
-rw-r--r--src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp10
-rw-r--r--src/plugins/qmldesigner/components/navigator/navigatorview.cpp1
-rw-r--r--src/plugins/qmldesigner/components/pluginmanager/pluginmanager.cpp79
-rw-r--r--src/plugins/qmldesigner/components/pluginmanager/pluginmanager.h12
-rw-r--r--src/plugins/qmldesigner/components/pluginmanager/pluginpath.cpp2
-rw-r--r--src/plugins/qmldesigner/components/pluginmanager/pluginpath.h6
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp81
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.h16
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/gradientlineqmladaptor.cpp2
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp5
-rw-r--r--src/plugins/qmldesigner/designercore/designercore.pri6
-rw-r--r--src/plugins/qmldesigner/designercore/include/itemlibraryinfo.h11
-rw-r--r--src/plugins/qmldesigner/designercore/include/model.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/nodeinstanceview.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/nodemetainfo.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/qmlmodelnodefacade.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/qmlmodelview.h4
-rw-r--r--src/plugins/qmldesigner/designercore/include/variantproperty.h2
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp57
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h1
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp23
-rw-r--r--src/plugins/qmldesigner/designercore/metainfo/itemlibraryinfo.cpp48
-rw-r--r--src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp23
-rw-r--r--src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp12
-rw-r--r--src/plugins/qmldesigner/designercore/model/model.cpp12
-rw-r--r--src/plugins/qmldesigner/designercore/model/modelnode.cpp4
-rw-r--r--src/plugins/qmldesigner/designercore/model/propertyparser.cpp6
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp4
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp21
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlstate.cpp12
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp8
-rw-r--r--src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp28
-rw-r--r--src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginmanager.cpp26
-rw-r--r--src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginmanager.h9
-rw-r--r--src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginpath.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginpath.h5
-rw-r--r--src/plugins/qmldesigner/designmodewidget.h2
-rw-r--r--src/plugins/qmldesigner/qmldesigner.qbs852
-rw-r--r--src/plugins/qmldesigner/qmldesignerplugin.cpp36
-rw-r--r--src/plugins/qmldesigner/qmldesignerplugin.h8
-rw-r--r--src/plugins/qmldesigner/qmldesignerplugin.pri16
-rw-r--r--src/plugins/qmldesigner/qmldesignerplugin.pro19
-rw-r--r--src/plugins/qmljseditor/qmljseditor.qbs15
-rw-r--r--src/plugins/qmljseditor/qmljspreviewrunner.cpp3
-rw-r--r--src/plugins/qmljseditor/quicktoolbar.cpp10
-rw-r--r--src/plugins/qmljseditor/quicktoolbar.h4
-rw-r--r--src/plugins/qmljstools/images/collapse.png (renamed from src/plugins/debugger/images/collapse.png)bin986 -> 986 bytes
-rw-r--r--src/plugins/qmljstools/images/error.png (renamed from src/plugins/debugger/images/error.png)bin1344 -> 1344 bytes
-rw-r--r--src/plugins/qmljstools/images/expand.png (renamed from src/plugins/debugger/images/expand.png)bin997 -> 997 bytes
-rw-r--r--src/plugins/qmljstools/images/log.png (renamed from src/plugins/debugger/images/log.png)bin1354 -> 1354 bytes
-rw-r--r--src/plugins/qmljstools/images/prompt.png (renamed from src/plugins/debugger/images/prompt.png)bin1049 -> 1049 bytes
-rw-r--r--src/plugins/qmljstools/images/warning.png (renamed from src/plugins/debugger/images/warning.png)bin1454 -> 1454 bytes
-rw-r--r--src/plugins/qmljstools/qmlconsoleedit.cpp (renamed from src/plugins/debugger/qtmessagelogeditor.cpp)81
-rw-r--r--src/plugins/qmljstools/qmlconsoleedit.h (renamed from src/plugins/debugger/qtmessagelogeditor.h)22
-rw-r--r--src/plugins/qmljstools/qmlconsoleitem.cpp153
-rw-r--r--src/plugins/qmljstools/qmlconsoleitem.h85
-rw-r--r--src/plugins/qmljstools/qmlconsoleitemdelegate.cpp (renamed from src/plugins/debugger/qtmessagelogitemdelegate.cpp)181
-rw-r--r--src/plugins/qmljstools/qmlconsoleitemdelegate.h (renamed from src/plugins/debugger/qtmessagelogitemdelegate.h)88
-rw-r--r--src/plugins/qmljstools/qmlconsoleitemmodel.cpp282
-rw-r--r--src/plugins/qmljstools/qmlconsoleitemmodel.h103
-rw-r--r--src/plugins/qmljstools/qmlconsolemanager.cpp194
-rw-r--r--src/plugins/qmljstools/qmlconsolemanager.h (renamed from src/plugins/debugger/qtmessagelogwindow.h)75
-rw-r--r--src/plugins/qmljstools/qmlconsolepane.cpp245
-rw-r--r--src/plugins/qmljstools/qmlconsolepane.h101
-rw-r--r--src/plugins/qmljstools/qmlconsoleproxymodel.cpp (renamed from src/plugins/debugger/qtmessagelogproxymodel.cpp)40
-rw-r--r--src/plugins/qmljstools/qmlconsoleproxymodel.h (renamed from src/plugins/debugger/qtmessagelogproxymodel.h)20
-rw-r--r--src/plugins/qmljstools/qmlconsoleview.cpp (renamed from src/plugins/debugger/qtmessagelogview.cpp)119
-rw-r--r--src/plugins/qmljstools/qmlconsoleview.h (renamed from src/plugins/debugger/qtmessagelogview.h)16
-rw-r--r--src/plugins/qmljstools/qmljscodestylesettingspage.cpp4
-rw-r--r--src/plugins/qmljstools/qmljsfunctionfilter.h2
-rw-r--r--src/plugins/qmljstools/qmljsinterpreter.cpp88
-rw-r--r--src/plugins/qmljstools/qmljsinterpreter.h70
-rw-r--r--src/plugins/qmljstools/qmljsmodelmanager.cpp15
-rw-r--r--src/plugins/qmljstools/qmljstools-lib.pri45
-rw-r--r--src/plugins/qmljstools/qmljstools.pri2
-rw-r--r--src/plugins/qmljstools/qmljstools.pro67
-rw-r--r--src/plugins/qmljstools/qmljstools.qbs45
-rw-r--r--src/plugins/qmljstools/qmljstools.qrc10
-rw-r--r--src/plugins/qmljstools/qmljstoolsplugin.cpp5
-rw-r--r--src/plugins/qmljstools/qmljstoolsplugin.h2
-rw-r--r--src/plugins/qmljstools/qmljstoolssettings.cpp67
-rw-r--r--src/plugins/qmljstools/qmljstoolssettings.h22
-rw-r--r--src/plugins/qmlprofiler/qmlprofiler.qbs12
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp6
-rw-r--r--src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp2
-rw-r--r--src/plugins/qmlprojectmanager/qmlproject.h3
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectmanager.qbs53
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h4
-rw-r--r--src/plugins/qnx/blackberrydeployconfiguration.cpp1
-rw-r--r--src/plugins/qnx/blackberrydeviceconfigurationwizard.cpp2
-rw-r--r--src/plugins/qnx/blackberryqtversion.cpp18
-rw-r--r--src/plugins/qnx/blackberryruncontrolfactory.cpp6
-rw-r--r--src/plugins/qnx/blackberryruncontrolfactory.h2
-rw-r--r--src/plugins/qnx/qnx.qbs43
-rw-r--r--src/plugins/qnx/qnxdeployconfiguration.cpp1
-rw-r--r--src/plugins/qnx/qnxdeviceconfigurationwizard.cpp2
-rw-r--r--src/plugins/qnx/qnxqtversion.cpp34
-rw-r--r--src/plugins/qnx/qnxrunconfiguration.h3
-rw-r--r--src/plugins/qt4projectmanager/addlibrarywizard.cpp10
-rw-r--r--src/plugins/qt4projectmanager/librarydetailscontroller.cpp45
-rw-r--r--src/plugins/qt4projectmanager/qmakestep.cpp30
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp2
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/desktopqtversionfactory.cpp2
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp27
-rw-r--r--src/plugins/qt4projectmanager/qt4buildconfiguration.cpp167
-rw-r--r--src/plugins/qt4projectmanager/qt4nodes.cpp85
-rw-r--r--src/plugins/qt4projectmanager/qt4nodes.h3
-rw-r--r--src/plugins/qt4projectmanager/qt4project.cpp12
-rw-r--r--src/plugins/qt4projectmanager/qt4project.h6
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanager.qbs58
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp10
-rw-r--r--src/plugins/qt4projectmanager/qt4targetsetupwidget.cpp6
-rw-r--r--src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp6
-rw-r--r--src/plugins/qt4projectmanager/wizards/guiappwizard.cpp2
-rw-r--r--src/plugins/qt4projectmanager/wizards/mobileappwizardpages.cpp2
-rw-r--r--src/plugins/qt4projectmanager/wizards/qtquickapp.cpp200
-rw-r--r--src/plugins/qt4projectmanager/wizards/qtquickapp.h48
-rw-r--r--src/plugins/qtsupport/baseqtversion.cpp258
-rw-r--r--src/plugins/qtsupport/gettingstartedwelcomepage.cpp23
-rw-r--r--src/plugins/qtsupport/profilereader.cpp6
-rw-r--r--src/plugins/qtsupport/profilereader.h2
-rw-r--r--src/plugins/qtsupport/qmldumptool.cpp6
-rw-r--r--src/plugins/qtsupport/qtoptionspage.cpp17
-rw-r--r--src/plugins/qtsupport/qtoutputformatter.h4
-rw-r--r--src/plugins/qtsupport/qtsupport.pri1
-rw-r--r--src/plugins/qtsupport/qtsupport.pro2
-rw-r--r--src/plugins/qtsupport/qtsupport.qbs121
-rw-r--r--src/plugins/qtsupport/qtversionfactory.cpp2
-rw-r--r--src/plugins/remotelinux/RemoteLinux.pluginspec.in2
-rw-r--r--src/plugins/remotelinux/abstractpackagingstep.cpp34
-rw-r--r--src/plugins/remotelinux/abstractpackagingstep.h10
-rw-r--r--src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp9
-rw-r--r--src/plugins/remotelinux/abstractremotelinuxdeployservice.h12
-rw-r--r--src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp4
-rw-r--r--src/plugins/remotelinux/deployablefile.h70
-rw-r--r--src/plugins/remotelinux/deployablefilesperprofile.cpp198
-rw-r--r--src/plugins/remotelinux/deployablefilesperprofile.h85
-rw-r--r--src/plugins/remotelinux/deploymentinfo.cpp204
-rw-r--r--src/plugins/remotelinux/deploymentinfo.h81
-rw-r--r--src/plugins/remotelinux/deploymentsettingsassistant.cpp175
-rw-r--r--src/plugins/remotelinux/deploymentsettingsassistant.h69
-rw-r--r--src/plugins/remotelinux/genericdirectuploadservice.cpp39
-rw-r--r--src/plugins/remotelinux/genericdirectuploadservice.h7
-rw-r--r--src/plugins/remotelinux/genericdirectuploadstep.cpp12
-rw-r--r--src/plugins/remotelinux/profilesupdatedialog.cpp99
-rw-r--r--src/plugins/remotelinux/profilesupdatedialog.ui139
-rw-r--r--src/plugins/remotelinux/remotelinux.pro16
-rw-r--r--src/plugins/remotelinux/remotelinux.qbs72
-rw-r--r--src/plugins/remotelinux/remotelinux_dependencies.pri2
-rw-r--r--src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp35
-rw-r--r--src/plugins/remotelinux/remotelinuxdeployconfiguration.h8
-rw-r--r--src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp4
-rw-r--r--src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp115
-rw-r--r--src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h14
-rw-r--r--src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui45
-rw-r--r--src/plugins/remotelinux/remotelinuxdeploymentdatamodel.cpp81
-rw-r--r--src/plugins/remotelinux/remotelinuxdeploymentdatamodel.h (renamed from src/plugins/remotelinux/profilesupdatedialog.h)37
-rw-r--r--src/plugins/remotelinux/remotelinuxplugin.cpp4
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfiguration.cpp114
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfiguration.h14
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp46
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h10
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp16
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h2
-rw-r--r--src/plugins/remotelinux/tarpackagecreationstep.cpp62
-rw-r--r--src/plugins/remotelinux/tarpackagecreationstep.h5
-rw-r--r--src/plugins/resourceeditor/qrceditor/resourcefile.cpp5
-rw-r--r--src/plugins/resourceeditor/resourceeditor.qbs20
-rw-r--r--src/plugins/subversion/subversion.qbs35
-rw-r--r--src/plugins/subversion/subversionplugin.cpp16
-rw-r--r--src/plugins/subversion/subversionsettings.cpp8
-rw-r--r--src/plugins/tasklist/tasklist.qbs23
-rw-r--r--src/plugins/texteditor/basetextdocumentlayout.cpp85
-rw-r--r--src/plugins/texteditor/basetextdocumentlayout.h4
-rw-r--r--src/plugins/texteditor/basetexteditor.cpp71
-rw-r--r--src/plugins/texteditor/basetexteditor.h1
-rw-r--r--src/plugins/texteditor/basetexteditor_p.h1
-rw-r--r--src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp9
-rw-r--r--src/plugins/texteditor/codeassist/genericproposalwidget.cpp40
-rw-r--r--src/plugins/texteditor/colorschemeedit.cpp3
-rw-r--r--src/plugins/texteditor/fontsettingspage.cpp3
-rw-r--r--src/plugins/texteditor/generichighlighter/highlighter.h4
-rw-r--r--src/plugins/texteditor/generichighlighter/highlightersettingspage.h2
-rw-r--r--src/plugins/texteditor/itexteditor.h1
-rw-r--r--src/plugins/texteditor/snippets/snippetssettingspage.cpp9
-rw-r--r--src/plugins/texteditor/snippets/snippetssettingspage.h2
-rw-r--r--src/plugins/texteditor/texteditor.qbs29
-rw-r--r--src/plugins/todo/todo.qbs9
-rw-r--r--src/plugins/updateinfo/updateinfo.qbs2
-rw-r--r--src/plugins/valgrind/callgrind/callgrindcontroller.cpp10
-rw-r--r--src/plugins/valgrind/callgrind/callgrindrunner.h2
-rw-r--r--src/plugins/valgrind/memcheck/memcheckrunner.cpp6
-rw-r--r--src/plugins/valgrind/memcheck/memcheckrunner.h2
-rw-r--r--src/plugins/valgrind/valgrind.qbs20
-rw-r--r--src/plugins/valgrind/valgrindconfigwidget.cpp13
-rw-r--r--src/plugins/valgrind/valgrindplugin.cpp6
-rw-r--r--src/plugins/valgrind/valgrindrunner.cpp10
-rw-r--r--src/plugins/valgrind/valgrindsettings.cpp14
-rw-r--r--src/plugins/valgrind/valgrindsettings.h2
-rw-r--r--src/plugins/valgrind/xmlprotocol/modelhelpers.cpp2
-rw-r--r--src/plugins/valgrind/xmlprotocol/stackmodel.cpp3
-rw-r--r--src/plugins/valgrind/xmlprotocol/threadedparser.cpp4
-rw-r--r--src/plugins/vcsbase/checkoutjobs.cpp4
-rw-r--r--src/plugins/vcsbase/commonvcssettings.cpp8
-rw-r--r--src/plugins/vcsbase/vcsbase.qbs15
-rw-r--r--src/plugins/vcsbase/vcsbaseclientsettings.cpp3
-rw-r--r--src/plugins/welcome/welcome.qbs12
-rw-r--r--src/plugins/welcome/welcomeplugin.cpp29
469 files changed, 9584 insertions, 8856 deletions
diff --git a/src/plugins/QtcPlugin.qbs b/src/plugins/QtcPlugin.qbs
index 606e798000..b5f2154847 100644
--- a/src/plugins/QtcPlugin.qbs
+++ b/src/plugins/QtcPlugin.qbs
@@ -1,5 +1,6 @@
import qbs.base 1.0
import qbs.fileinfo 1.0 as FileInfo
+import "../../qbs/defaults.js" as Defaults
Product {
type: ["dynamiclibrary", "pluginSpec"]
@@ -21,16 +22,21 @@ Product {
Depends { name: "pluginspec" }
Depends { name: "cpp" }
- cpp.defines: project.additionalCppDefines.concat([name.toUpperCase() + "_LIBRARY"])
+ Depends {
+ condition: Defaults.testsEnabled(qbs)
+ name: "Qt.test"
+ }
+
+ cpp.defines: Defaults.defines(qbs).concat([name.toUpperCase() + "_LIBRARY"])
cpp.rpaths: ["$ORIGIN/../../.."]
cpp.linkerFlags: {
if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
return ["-Wl,-s"]
}
+ cpp.includePaths: [ ".", ".." ]
Group {
files: [ name + ".pluginspec.in" ]
fileTags: ["pluginSpecIn"]
}
}
-
diff --git a/src/plugins/analyzerbase/analyzerbase.qbs b/src/plugins/analyzerbase/analyzerbase.qbs
index 7fada29a11..36a11871ed 100644
--- a/src/plugins/analyzerbase/analyzerbase.qbs
+++ b/src/plugins/analyzerbase/analyzerbase.qbs
@@ -17,23 +17,23 @@ QtcPlugin {
"ANALYZER_LIBRARY",
"QT_NO_CAST_FROM_ASCII"
])
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
files: [
"analyzerbase.qrc",
"analyzerbase_global.h",
"analyzerconstants.h",
+ "analyzermanager.cpp",
+ "analyzermanager.h",
"analyzeroptionspage.cpp",
"analyzeroptionspage.h",
"analyzerplugin.cpp",
"analyzerplugin.h",
"analyzerrunconfigwidget.cpp",
"analyzerrunconfigwidget.h",
+ "analyzerruncontrol.cpp",
"analyzerruncontrol.h",
+ "analyzerruncontrolfactory.cpp",
+ "analyzerruncontrolfactory.h",
"analyzersettings.cpp",
"analyzersettings.h",
"analyzerstartparameters.h",
@@ -42,23 +42,15 @@ QtcPlugin {
"ianalyzerengine.cpp",
"ianalyzerengine.h",
"ianalyzertool.cpp",
+ "ianalyzertool.h",
"startremotedialog.cpp",
"startremotedialog.h",
- "analyzermanager.cpp",
- "analyzermanager.h",
- "analyzerruncontrol.cpp",
- "analyzerruncontrolfactory.cpp",
- "analyzerruncontrolfactory.h",
- "ianalyzertool.h",
"images/analyzer_category.png",
"images/analyzer_mode.png",
- "images/analyzer_start_small.png"
+ "images/analyzer_start_small.png",
]
ProductModule {
- Depends { name: "cpp" }
- cpp.includePaths: ["."]
-
Depends { name: "CPlusPlus" }
}
}
diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp
index 7434846208..583e9e47ad 100644
--- a/src/plugins/analyzerbase/analyzermanager.cpp
+++ b/src/plugins/analyzerbase/analyzermanager.cpp
@@ -88,6 +88,7 @@
#include <QLabel>
#include <QCheckBox>
#include <QDialogButtonBox>
+#include <QPointer>
#include <QPushButton>
using namespace Core;
@@ -211,7 +212,7 @@ public:
MainWindowSettingsMap m_defaultSettings;
// list of dock widgets to prevent memory leak
- typedef QWeakPointer<QDockWidget> DockPtr;
+ typedef QPointer<QDockWidget> DockPtr;
QList<DockPtr> m_dockWidgets;
};
diff --git a/src/plugins/analyzerbase/analyzerruncontrolfactory.cpp b/src/plugins/analyzerbase/analyzerruncontrolfactory.cpp
index f4faaa79a9..4ee4793af2 100644
--- a/src/plugins/analyzerbase/analyzerruncontrolfactory.cpp
+++ b/src/plugins/analyzerbase/analyzerruncontrolfactory.cpp
@@ -89,6 +89,14 @@ IRunConfigurationAspect *AnalyzerRunControlFactory::createRunConfigurationAspect
return new AnalyzerRunConfigurationAspect;
}
+IRunConfigurationAspect *AnalyzerRunControlFactory::cloneRunConfigurationAspect(IRunConfigurationAspect *source)
+{
+ AnalyzerRunConfigurationAspect *s = dynamic_cast<AnalyzerRunConfigurationAspect *>(source);
+ if (!s)
+ return 0;
+ return new AnalyzerRunConfigurationAspect(s);
+}
+
RunConfigWidget *AnalyzerRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
{
AnalyzerRunConfigWidget *ret = new AnalyzerRunConfigWidget;
diff --git a/src/plugins/analyzerbase/analyzerruncontrolfactory.h b/src/plugins/analyzerbase/analyzerruncontrolfactory.h
index 31bcde9bb8..cfc09339b9 100644
--- a/src/plugins/analyzerbase/analyzerruncontrolfactory.h
+++ b/src/plugins/analyzerbase/analyzerruncontrolfactory.h
@@ -51,6 +51,7 @@ public:
ProjectExplorer::RunMode mode,
QString *errorMessage);
ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect();
+ ProjectExplorer::IRunConfigurationAspect *cloneRunConfigurationAspect(ProjectExplorer::IRunConfigurationAspect *source);
ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
};
diff --git a/src/plugins/analyzerbase/analyzersettings.cpp b/src/plugins/analyzerbase/analyzersettings.cpp
index d612a6223e..c33077eeef 100644
--- a/src/plugins/analyzerbase/analyzersettings.cpp
+++ b/src/plugins/analyzerbase/analyzersettings.cpp
@@ -54,6 +54,11 @@ AnalyzerSettings::AnalyzerSettings(QObject *parent)
{
}
+AnalyzerSettings::AnalyzerSettings(AnalyzerSettings *other)
+{
+ Q_UNUSED(other);
+}
+
QVariantMap AnalyzerSettings::defaults() const
{
QVariantMap map;
@@ -148,8 +153,8 @@ void AnalyzerGlobalSettings::registerTool(IAnalyzerTool *tool)
}
-AnalyzerRunConfigurationAspect::AnalyzerRunConfigurationAspect(QObject *parent)
- : AnalyzerSettings(parent), m_useGlobalSettings(true)
+AnalyzerRunConfigurationAspect::AnalyzerRunConfigurationAspect()
+ : AnalyzerSettings((QObject *)0), m_useGlobalSettings(true)
{
QList<IAnalyzerTool*> tools = AnalyzerManager::tools();
// add sub configs
@@ -163,6 +168,19 @@ AnalyzerRunConfigurationAspect::AnalyzerRunConfigurationAspect(QObject *parent)
resetCustomToGlobalSettings();
}
+AnalyzerRunConfigurationAspect::AnalyzerRunConfigurationAspect(AnalyzerRunConfigurationAspect *other)
+ : AnalyzerSettings(other), m_useGlobalSettings(other->m_useGlobalSettings)
+{
+
+ foreach (AbstractAnalyzerSubConfig *config, other->m_customConfigurations)
+ m_customConfigurations.append(config->clone());
+
+ if (m_useGlobalSettings)
+ m_subConfigs = AnalyzerGlobalSettings::instance()->subConfigs();
+ else
+ m_subConfigs = m_customConfigurations;
+}
+
AnalyzerRunConfigurationAspect::~AnalyzerRunConfigurationAspect()
{
qDeleteAll(m_customConfigurations);
diff --git a/src/plugins/analyzerbase/analyzersettings.h b/src/plugins/analyzerbase/analyzersettings.h
index 415c3e9cd2..1b7c3eb3c2 100644
--- a/src/plugins/analyzerbase/analyzersettings.h
+++ b/src/plugins/analyzerbase/analyzersettings.h
@@ -78,6 +78,8 @@ public:
virtual QString displayName() const = 0;
/// create a configuration widget for this configuration
virtual QWidget *createConfigWidget(QWidget *parent) = 0;
+ /// clones s AbstractAnalyzerSubConfig
+ virtual AbstractAnalyzerSubConfig *clone() = 0;
};
/**
@@ -115,6 +117,7 @@ protected:
void fromMap(const QVariantMap &map, QList<AbstractAnalyzerSubConfig *> *subConfigs);
AnalyzerSettings(QObject *parent);
+ AnalyzerSettings(AnalyzerSettings *other);
QList<AbstractAnalyzerSubConfig *> m_subConfigs;
};
@@ -162,7 +165,8 @@ class ANALYZER_EXPORT AnalyzerRunConfigurationAspect
Q_OBJECT
public:
- AnalyzerRunConfigurationAspect(QObject *parent = 0);
+ AnalyzerRunConfigurationAspect();
+ AnalyzerRunConfigurationAspect(AnalyzerRunConfigurationAspect *other);
~AnalyzerRunConfigurationAspect();
QString displayName() const;
diff --git a/src/plugins/android/android.qbs b/src/plugins/android/android.qbs
index d719b78309..bd2a2e83dd 100644
--- a/src/plugins/android/android.qbs
+++ b/src/plugins/android/android.qbs
@@ -15,15 +15,11 @@ QtcPlugin {
property bool enable: false
property var pluginspecreplacements: ({"ANDROID_EXPERIMENTAL_STR": (enable ? "false": "true")})
- cpp.includePaths: [
- "..",
- buildDirectory,
- "../../libs",
- "../../shared"
- ]
+ cpp.includePaths: base.concat("../../shared")
files: [
"addnewavddialog.ui",
+ "android.qrc",
"androidconfigurations.cpp",
"androidconfigurations.h",
"androidconstants.h",
@@ -35,9 +31,9 @@ QtcPlugin {
"androiddeployconfiguration.cpp",
"androiddeployconfiguration.h",
"androiddeploystep.cpp",
+ "androiddeploystep.h",
"androiddeploystepfactory.cpp",
"androiddeploystepfactory.h",
- "androiddeploystep.h",
"androiddeploystepwidget.cpp",
"androiddeploystepwidget.h",
"androiddeploystepwidget.ui",
@@ -46,8 +42,8 @@ QtcPlugin {
"androiddevicefactory.cpp",
"androiddevicefactory.h",
"androidglobal.h",
- "androidmanager.h",
"androidmanager.cpp",
+ "androidmanager.h",
"androidpackagecreationfactory.cpp",
"androidpackagecreationfactory.h",
"androidpackagecreationstep.cpp",
@@ -61,11 +57,10 @@ QtcPlugin {
"androidpackageinstallationstep.h",
"androidplugin.cpp",
"androidplugin.h",
- "android.qrc",
"androidqtversion.cpp",
+ "androidqtversion.h",
"androidqtversionfactory.cpp",
"androidqtversionfactory.h",
- "androidqtversion.h",
"androidrunconfiguration.cpp",
"androidrunconfiguration.h",
"androidruncontrol.cpp",
@@ -82,6 +77,6 @@ QtcPlugin {
"androidtoolchain.cpp",
"androidtoolchain.h",
"javaparser.cpp",
- "javaparser.h"
+ "javaparser.h",
]
}
diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp
index 6792897dbf..356430400c 100644
--- a/src/plugins/android/androidconfigurations.cpp
+++ b/src/plugins/android/androidconfigurations.cpp
@@ -32,6 +32,7 @@
#include "ui_addnewavddialog.h"
#include <coreplugin/icore.h>
+#include <utils/hostosinfo.h>
#include <utils/persistentsettings.h>
#include <QDateTime>
@@ -262,24 +263,24 @@ QStringList AndroidConfigurations::ndkToolchainVersions() const
FileName AndroidConfigurations::adbToolPath() const
{
FileName path = m_config.sdkLocation;
- return path.appendPath(QLatin1String("platform-tools/adb" ANDROID_EXE_SUFFIX));
+ return path.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX));
}
FileName AndroidConfigurations::androidToolPath() const
{
-#ifdef Q_OS_WIN32
- // I want to switch from using android.bat to using an executable. All it really does is call
- // Java and I've made some progress on it. So if android.exe exists, return that instead.
- FileName path = m_config.sdkLocation;
- path.appendPath(QLatin1String("tools/android"ANDROID_EXE_SUFFIX));
- if (path.toFileInfo().exists())
- return path;
- path = m_config.sdkLocation;
- return path.appendPath(QLatin1String("tools/android"ANDROID_BAT_SUFFIX));
-#else
- FileName path = m_config.sdkLocation;
- return path.appendPath(QLatin1String("tools/android"));
-#endif
+ if (HostOsInfo::isWindowsHost()) {
+ // I want to switch from using android.bat to using an executable. All it really does is call
+ // Java and I've made some progress on it. So if android.exe exists, return that instead.
+ FileName path = m_config.sdkLocation;
+ path.appendPath(QLatin1String("tools/android" QTC_HOST_EXE_SUFFIX));
+ if (path.toFileInfo().exists())
+ return path;
+ path = m_config.sdkLocation;
+ return path.appendPath(QLatin1String("tools/android" ANDROID_BAT_SUFFIX));
+ } else {
+ FileName path = m_config.sdkLocation;
+ return path.appendPath(QLatin1String("tools/android"));
+ }
}
FileName AndroidConfigurations::antToolPath() const
@@ -293,7 +294,7 @@ FileName AndroidConfigurations::antToolPath() const
FileName AndroidConfigurations::emulatorToolPath() const
{
FileName path = m_config.sdkLocation;
- return path.appendPath(QLatin1String("tools/emulator" ANDROID_EXE_SUFFIX));
+ return path.appendPath(QLatin1String("tools/emulator" QTC_HOST_EXE_SUFFIX));
}
FileName AndroidConfigurations::toolPath(Abi::Architecture architecture) const
@@ -308,17 +309,17 @@ FileName AndroidConfigurations::toolPath(Abi::Architecture architecture) const
FileName AndroidConfigurations::stripPath(Abi::Architecture architecture) const
{
- return toolPath(architecture).append(QLatin1String("-strip" ANDROID_EXE_SUFFIX));
+ return toolPath(architecture).append(QLatin1String("-strip" QTC_HOST_EXE_SUFFIX));
}
FileName AndroidConfigurations::readelfPath(Abi::Architecture architecture) const
{
- return toolPath(architecture).append(QLatin1String("-readelf" ANDROID_EXE_SUFFIX));
+ return toolPath(architecture).append(QLatin1String("-readelf" QTC_HOST_EXE_SUFFIX));
}
FileName AndroidConfigurations::gccPath(Abi::Architecture architecture) const
{
- return toolPath(architecture).append(QLatin1String("-gcc" ANDROID_EXE_SUFFIX));
+ return toolPath(architecture).append(QLatin1String("-gcc" QTC_HOST_EXE_SUFFIX));
}
FileName AndroidConfigurations::gdbServerPath(Abi::Architecture architecture) const
@@ -360,7 +361,7 @@ FileName AndroidConfigurations::gdbPath(Abi::Architecture architecture) const
}
if (!gdbPath.isEmpty())
return gdbPath;
- return toolPath(architecture).append(QLatin1String("-gdb" ANDROID_EXE_SUFFIX));
+ return toolPath(architecture).append(QLatin1String("-gdb" QTC_HOST_EXE_SUFFIX));
}
FileName AndroidConfigurations::openJDKPath() const
@@ -389,7 +390,7 @@ FileName AndroidConfigurations::jarsignerPath() const
FileName AndroidConfigurations::zipalignPath() const
{
Utils::FileName path = m_config.sdkLocation;
- return path.appendPath(QLatin1String("tools/zipalign" ANDROID_EXE_SUFFIX));
+ return path.appendPath(QLatin1String("tools/zipalign" QTC_HOST_EXE_SUFFIX));
}
QString AndroidConfigurations::getDeployDeviceSerialNumber(int *apiLevel) const
diff --git a/src/plugins/android/androidconstants.h b/src/plugins/android/androidconstants.h
index ab80f48c7d..0d610bf352 100644
--- a/src/plugins/android/androidconstants.h
+++ b/src/plugins/android/androidconstants.h
@@ -44,10 +44,8 @@ enum AndroidQemuStatus {
};
#ifdef Q_OS_WIN32
-#define ANDROID_EXE_SUFFIX ".exe"
#define ANDROID_BAT_SUFFIX ".bat"
#else
-#define ANDROID_EXE_SUFFIX ""
#define ANDROID_BAT_SUFFIX ""
#endif
diff --git a/src/plugins/android/androiddeployconfiguration.cpp b/src/plugins/android/androiddeployconfiguration.cpp
index d93d1976e9..69f741c278 100644
--- a/src/plugins/android/androiddeployconfiguration.cpp
+++ b/src/plugins/android/androiddeployconfiguration.cpp
@@ -56,6 +56,7 @@ AndroidDeployConfiguration::AndroidDeployConfiguration(Target *parent, Core::Id
AndroidDeployConfiguration::AndroidDeployConfiguration(Target *parent, DeployConfiguration *source)
: DeployConfiguration(parent, source)
{
+ cloneSteps(source);
}
AndroidDeployConfigurationFactory::AndroidDeployConfigurationFactory(QObject *parent)
diff --git a/src/plugins/android/androidpackagecreationwidget.cpp b/src/plugins/android/androidpackagecreationwidget.cpp
index badfe63d30..9b5aaf7b9f 100644
--- a/src/plugins/android/androidpackagecreationwidget.cpp
+++ b/src/plugins/android/androidpackagecreationwidget.cpp
@@ -147,8 +147,9 @@ PermissionsModel::PermissionsModel(QObject *parent)
void PermissionsModel::setPermissions(const QStringList &permissions)
{
+ beginResetModel();
m_permissions = permissions;
- reset();
+ endResetModel();
}
const QStringList &PermissionsModel::permissions()
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp
index 57439c857d..6339386d1f 100644
--- a/src/plugins/android/androidrunner.cpp
+++ b/src/plugins/android/androidrunner.cpp
@@ -84,7 +84,7 @@ void AndroidRunner::checkPID()
qint64 pid = -1;
QList<QByteArray> procs = psProc.readAll().split('\n');
foreach (const QByteArray &proc, procs) {
- if (proc.trimmed().endsWith(m_packageName.toAscii())) {
+ if (proc.trimmed().endsWith(m_packageName.toLatin1())) {
QRegExp rx(QLatin1String("(\\d+)"));
if (rx.indexIn(QLatin1String(proc), proc.indexOf(' ')) > 0) {
pid = rx.cap(1).toLongLong();
@@ -258,7 +258,7 @@ void AndroidRunner::logcatReadStandardOutput()
m_logcat += m_adbLogcatProcess.readAllStandardOutput();
bool keepLastLine = m_logcat.endsWith('\n');
QByteArray line;
- QByteArray pid(QString::fromLatin1("%1):").arg(m_processPID).toAscii());
+ QByteArray pid(QString::fromLatin1("%1):").arg(m_processPID).toLatin1());
foreach (line, m_logcat.split('\n')) {
if (!line.contains(pid))
continue;
diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp
index b77f821e96..4590fb894c 100644
--- a/src/plugins/android/androidsettingswidget.cpp
+++ b/src/plugins/android/androidsettingswidget.cpp
@@ -35,6 +35,8 @@
#include "androidconstants.h"
+#include <utils/hostosinfo.h>
+
#include <QFile>
#include <QTextStream>
#include <QProcess>
@@ -48,8 +50,9 @@ namespace Internal {
void AvdModel::setAvdList(const QVector<AndroidDeviceInfo> &list)
{
+ beginResetModel();
m_list = list;
- reset();
+ endResetModel();
}
QString AvdModel::avdName(const QModelIndex &index)
@@ -187,10 +190,10 @@ bool AndroidSettingsWidget::checkSDK(const Utils::FileName &location)
Utils::FileName androidExe = location;
Utils::FileName androidBat = location;
Utils::FileName emulator = location;
- if (!adb.appendPath(QLatin1String("platform-tools/adb" ANDROID_EXE_SUFFIX)).toFileInfo().exists()
- || (!androidExe.appendPath(QLatin1String("/tools/android" ANDROID_EXE_SUFFIX)).toFileInfo().exists()
+ if (!adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()
+ || (!androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()
&& !androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).toFileInfo().exists())
- || !emulator.appendPath(QLatin1String("/tools/emulator" ANDROID_EXE_SUFFIX)).toFileInfo().exists()) {
+ || !emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()) {
QMessageBox::critical(this, tr("Android SDK Folder"), tr("\"%1\" does not seem to be an Android SDK top folder.").arg(location.toUserOutput()));
return false;
}
@@ -335,16 +338,15 @@ void AndroidSettingsWidget::browseNDKLocation()
void AndroidSettingsWidget::browseAntLocation()
{
- QString dir = QDir::homePath();
-#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
- dir = QLatin1String("/usr/bin/ant");
- QLatin1String antApp("ant");
-#elif defined(Q_OS_WIN)
- QLatin1String antApp("ant.bat");
-#elif defined(Q_OS_DARWIN)
- dir = QLatin1String("/opt/local/bin/ant");
- QLatin1String antApp("ant");
-#endif
+ QString dir;
+ QString antApp;
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ dir = QDir::homePath();
+ antApp = QLatin1String("ant.bat");
+ } else {
+ dir = QLatin1String("/usr/bin/ant");
+ antApp = QLatin1String("ant");
+ }
const QString file =
QFileDialog::getOpenFileName(this, tr("Select ant Script"), dir, antApp);
if (!file.length())
diff --git a/src/plugins/android/androidtoolchain.cpp b/src/plugins/android/androidtoolchain.cpp
index 98022b5377..ecc83bb407 100644
--- a/src/plugins/android/androidtoolchain.cpp
+++ b/src/plugins/android/androidtoolchain.cpp
@@ -41,6 +41,7 @@
#include <qtsupport/qtversionmanager.h>
#include <utils/environment.h>
+#include <utils/hostosinfo.h>
#include <QDir>
#include <QFormLayout>
@@ -52,6 +53,7 @@ namespace Internal {
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
+using namespace Utils;
static const char ANDROID_QT_VERSION_KEY[] = "Qt4ProjectManager.Android.QtVersion";
@@ -84,7 +86,7 @@ bool AndroidToolChain::isValid() const
return GccToolChain::isValid() && m_qtVersionId >= 0 && targetAbi().isValid();
}
-void AndroidToolChain::addToEnvironment(Utils::Environment &env) const
+void AndroidToolChain::addToEnvironment(Environment &env) const
{
// TODO this vars should be configurable in projects -> build tab
@@ -95,18 +97,23 @@ void AndroidToolChain::addToEnvironment(Utils::Environment &env) const
|| QtSupport::QtKitInformation::qtVersion(qt4pro->activeTarget()->kit())->type() != QLatin1String(Constants::ANDROIDQT))
return;
- QString ndk_host = QLatin1String(
-#if defined(Q_OS_LINUX)
- "linux-x86"
-#elif defined(Q_OS_WIN)
- "windows"
-#elif defined(Q_OS_MAC)
- "darwin-x86"
-#endif
- );
+ QString ndkHost;
+ switch (HostOsInfo::hostOs()) {
+ case HostOsInfo::HostOsLinux:
+ ndkHost = QLatin1String("linux-x86");
+ break;
+ case HostOsInfo::HostOsWindows:
+ ndkHost = QLatin1String("windows");
+ break;
+ case HostOsInfo::HostOsMac:
+ ndkHost = QLatin1String("darwin-x86");
+ break;
+ default:
+ break;
+ }
// this env vars are used by qmake mkspecs to generate makefiles (check QTDIR/mkspecs/android-g++/qmake.conf for more info)
- env.set(QLatin1String("ANDROID_NDK_HOST"), ndk_host);
+ env.set(QLatin1String("ANDROID_NDK_HOST"), ndkHost);
env.set(QLatin1String("ANDROID_NDK_ROOT"), AndroidConfigurations::instance().config().ndkLocation.toUserOutput());
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_PREFIX"), AndroidConfigurations::toolchainPrefix(targetAbi().architecture()));
env.set(QLatin1String("ANDROID_NDK_TOOLS_PREFIX"), AndroidConfigurations::toolsPrefix(targetAbi().architecture()));
@@ -146,18 +153,15 @@ bool AndroidToolChain::fromMap(const QVariantMap &data)
return isValid();
}
-QList<Utils::FileName> AndroidToolChain::suggestedMkspecList() const
+QList<FileName> AndroidToolChain::suggestedMkspecList() const
{
- return QList<Utils::FileName>()<< Utils::FileName::fromString(QLatin1String("android-g++"));
+ return QList<FileName>()<< FileName::fromString(QLatin1String("android-g++"));
}
QString AndroidToolChain::makeCommand(const Utils::Environment &env) const
{
-#if defined(Q_OS_WIN)
- QString make = QLatin1String("ma-make.exe");
-#else
- QString make = QLatin1String("make");
-#endif
+ QString make = HostOsInfo::isWindowsHost()
+ ? QLatin1String("ma-make.exe") : QLatin1String("make");
QString tmp = env.searchInPath(make);
return tmp.isEmpty() ? make : tmp;
}
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs
index 78d4a6ab53..d5b9e0ebac 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs
+++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs
@@ -13,12 +13,6 @@ QtcPlugin {
Depends { name: "cpp" }
cpp.defines: base.concat(["QT_NO_CAST_FROM_ASCII"])
- cpp.includePaths: [
- ".",
- "..",
- "../../libs",
- buildDirectory
- ]
files: [
"autogenstep.cpp",
@@ -50,6 +44,6 @@ QtcPlugin {
"makefileparserthread.cpp",
"makefileparserthread.h",
"makestep.cpp",
- "makestep.h"
+ "makestep.h",
]
}
diff --git a/src/plugins/bazaar/bazaar.qbs b/src/plugins/bazaar/bazaar.qbs
index 4271a0d0eb..b43ff69dd0 100644
--- a/src/plugins/bazaar/bazaar.qbs
+++ b/src/plugins/bazaar/bazaar.qbs
@@ -13,49 +13,44 @@ QtcPlugin {
Depends { name: "Locator" }
Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
files: [
- "bazaar.qrc",
- "bazaarcommitpanel.ui",
- "cloneoptionspanel.ui",
- "pullorpushdialog.ui",
- "revertdialog.ui",
- "bazaarcommitwidget.cpp",
- "bazaarcommitwidget.h",
- "bazaarsettings.cpp",
- "branchinfo.cpp",
- "branchinfo.h",
- "cloneoptionspanel.cpp",
- "cloneoptionspanel.h",
- "constants.h",
- "optionspage.ui",
- "pullorpushdialog.cpp",
- "pullorpushdialog.h",
"annotationhighlighter.cpp",
"annotationhighlighter.h",
+ "bazaar.qrc",
"bazaarclient.cpp",
"bazaarclient.h",
+ "bazaarcommitpanel.ui",
+ "bazaarcommitwidget.cpp",
+ "bazaarcommitwidget.h",
"bazaarcontrol.cpp",
"bazaarcontrol.h",
"bazaareditor.cpp",
"bazaareditor.h",
"bazaarplugin.cpp",
"bazaarplugin.h",
+ "bazaarsettings.cpp",
"bazaarsettings.h",
+ "branchinfo.cpp",
+ "branchinfo.h",
+ "cloneoptionspanel.cpp",
+ "cloneoptionspanel.h",
+ "cloneoptionspanel.ui",
"clonewizard.cpp",
"clonewizard.h",
"clonewizardpage.cpp",
"clonewizardpage.h",
"commiteditor.cpp",
"commiteditor.h",
+ "constants.h",
"optionspage.cpp",
"optionspage.h",
- "images/bazaar.png"
+ "optionspage.ui",
+ "pullorpushdialog.cpp",
+ "pullorpushdialog.h",
+ "pullorpushdialog.ui",
+ "revertdialog.ui",
+ "images/bazaar.png",
]
}
diff --git a/src/plugins/bineditor/bineditor.qbs b/src/plugins/bineditor/bineditor.qbs
index b2fd675be8..638c13fb1d 100644
--- a/src/plugins/bineditor/bineditor.qbs
+++ b/src/plugins/bineditor/bineditor.qbs
@@ -11,19 +11,14 @@ QtcPlugin {
Depends { name: "Find" }
Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
files: [
- "bineditorplugin.h",
+ "bineditor.cpp",
"bineditor.h",
"bineditorconstants.h",
- "markup.h",
"bineditorplugin.cpp",
- "bineditor.cpp"
+ "bineditorplugin.h",
+ "markup.h",
]
}
diff --git a/src/plugins/bookmarks/bookmark.cpp b/src/plugins/bookmarks/bookmark.cpp
index 1e34776ac5..d8e8b32743 100644
--- a/src/plugins/bookmarks/bookmark.cpp
+++ b/src/plugins/bookmarks/bookmark.cpp
@@ -77,11 +77,27 @@ void Bookmark::updateFileName(const QString &fileName)
BaseTextMark::updateFileName(fileName);
}
+void Bookmark::setNote(const QString &note)
+{
+ m_note = note;
+}
+
+void Bookmark::updateNote(const QString &note)
+{
+ setNote(note);
+ m_manager->updateBookmark(this);
+}
+
QString Bookmark::lineText() const
{
return m_lineText;
}
+QString Bookmark::note() const
+{
+ return m_note;
+}
+
QString Bookmark::filePath() const
{
return m_fileName;
diff --git a/src/plugins/bookmarks/bookmark.h b/src/plugins/bookmarks/bookmark.h
index 23019e700a..265f884530 100644
--- a/src/plugins/bookmarks/bookmark.h
+++ b/src/plugins/bookmarks/bookmark.h
@@ -52,12 +52,15 @@ public:
void updateLineNumber(int lineNumber);
void updateBlock(const QTextBlock &block);
void updateFileName(const QString &fileName);
+ void setNote(const QString &note);
+ void updateNote(const QString &note);
void removedFromEditor();
QString filePath() const;
QString fileName() const;
QString path() const;
QString lineText() const;
+ QString note() const;
private:
BookmarkManager *m_manager;
@@ -65,6 +68,7 @@ private:
QString m_onlyFile;
QString m_path;
QString m_lineText;
+ QString m_note;
};
} // namespace Internal
diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp
index 3bb59e8a6d..7b2e4314cc 100644
--- a/src/plugins/bookmarks/bookmarkmanager.cpp
+++ b/src/plugins/bookmarks/bookmarkmanager.cpp
@@ -40,6 +40,8 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
#include <texteditor/basetexteditor.h>
+#include <texteditor/tooltip/tooltip.h>
+#include <texteditor/tooltip/tipcontents.h>
#include <utils/qtcassert.h>
#include <QDebug>
@@ -50,6 +52,7 @@
#include <QContextMenuEvent>
#include <QMenu>
#include <QPainter>
+#include <QInputDialog>
Q_DECLARE_METATYPE(Bookmarks::Internal::Bookmark*)
@@ -194,7 +197,10 @@ void BookmarkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
//
// painter->drawText(3, opt.rect.top() + fm.ascent() + fm.height() + 6, directory);
- QString lineText = index.data(BookmarkManager::LineText).toString().trimmed();
+ QString lineText = index.data(BookmarkManager::Note).toString().trimmed();
+ if (lineText.isEmpty())
+ lineText = index.data(BookmarkManager::LineText).toString().trimmed();
+
painter->drawText(6, opt.rect.top() + fm.ascent() + fm.height() + 6, lineText);
// Separator lines
@@ -233,6 +239,8 @@ void BookmarkView::contextMenuEvent(QContextMenuEvent *event)
QAction *moveDown = menu.addAction(tr("Move Down"));
QAction *remove = menu.addAction(tr("&Remove"));
QAction *removeAll = menu.addAction(tr("Remove All"));
+ QAction *editNote = menu.addAction(tr("Edit note"));
+
m_contextMenuIndex = indexAt(event->pos());
if (!m_contextMenuIndex.isValid()) {
moveUp->setEnabled(false);
@@ -251,6 +259,8 @@ void BookmarkView::contextMenuEvent(QContextMenuEvent *event)
this, SLOT(removeFromContextMenu()));
connect(removeAll, SIGNAL(triggered()),
this, SLOT(removeAll()));
+ connect(editNote, SIGNAL(triggered()),
+ m_manager, SLOT(editNote()));
menu.exec(mapToGlobal(event->pos()));
}
@@ -338,6 +348,12 @@ QItemSelectionModel *BookmarkManager::selectionModel() const
return m_selectionModel;
}
+bool BookmarkManager::hasBookmarkInPosition(const QString &fileName, int lineNumber)
+{
+ QFileInfo fi(fileName);
+ return findBookmark(fi.path(), fi.fileName(), lineNumber);
+}
+
QModelIndex BookmarkManager::index(int row, int column, const QModelIndex &parent) const
{
if (parent.isValid())
@@ -379,6 +395,8 @@ QVariant BookmarkManager::data(const QModelIndex &index, int role) const
return m_bookmarksList.at(index.row())->path();
else if (role == BookmarkManager::LineText)
return m_bookmarksList.at(index.row())->lineText();
+ else if (role == BookmarkManager::Note)
+ return m_bookmarksList.at(index.row())->note();
else if (role == Qt::ToolTipRole)
return QDir::toNativeSeparators(m_bookmarksList.at(index.row())->filePath());
@@ -664,6 +682,32 @@ void BookmarkManager::moveDown()
selectionModel()->setCurrentIndex(current.sibling(row, 0), QItemSelectionModel::Select | QItemSelectionModel::Clear);
}
+void BookmarkManager::editNote(const QString &fileName, int lineNumber)
+{
+ QFileInfo fi(fileName);
+ Bookmark *b = findBookmark(fi.path(), fi.fileName(), lineNumber);
+ QModelIndex current = selectionModel()->currentIndex();
+ selectionModel()->setCurrentIndex(current.sibling(m_bookmarksList.indexOf(b), 0),
+ QItemSelectionModel::Select | QItemSelectionModel::Clear);
+
+ editNote();
+}
+
+void BookmarkManager::editNote()
+{
+ QModelIndex current = selectionModel()->currentIndex();
+ Bookmark *b = m_bookmarksList.at(current.row());
+
+ bool inputOk = false;
+ QString noteText = QInputDialog::getText(0, tr("Edit note"),
+ tr("Note text:"), QLineEdit::Normal,
+ b->note(), &inputOk);
+ if (inputOk) {
+ b->updateNote(noteText.replace(QLatin1Char('\t'), QLatin1Char(' ')));
+ emit dataChanged(current, current);
+ }
+}
+
/* Returns the bookmark at the given file and line number, or 0 if no such bookmark exists. */
Bookmark *BookmarkManager::findBookmark(const QString &path, const QString &fileName, int lineNumber)
{
@@ -703,15 +747,22 @@ void BookmarkManager::addBookmark(Bookmark *bookmark, bool userset)
/* Adds a new bookmark based on information parsed from the string. */
void BookmarkManager::addBookmark(const QString &s)
{
- int index2 = s.lastIndexOf(':');
+ // index3 is a frontier beetween note text and other bookmarks data
+ int index3 = s.lastIndexOf('\t');
+ if (index3 < 0)
+ index3 = s.size();
+ int index2 = s.lastIndexOf(':', index3 - 1);
int index1 = s.indexOf(':');
- if (index2 != -1 || index1 != -1) {
+
+ if (index3 != -1 || index2 != -1 || index1 != -1) {
const QString &filePath = s.mid(index1+1, index2-index1-1);
- const int lineNumber = s.mid(index2 + 1).toInt();
+ const QString &note = s.mid(index3 + 1);
+ const int lineNumber = s.mid(index2 + 1, index3 - index2 - 1).toInt();
const QFileInfo fi(filePath);
if (!filePath.isEmpty() && !findBookmark(fi.path(), fi.fileName(), lineNumber)) {
Bookmark *b = new Bookmark(filePath, lineNumber, this);
+ b->setNote(note);
b->init();
addBookmark(b, false);
}
@@ -724,8 +775,12 @@ void BookmarkManager::addBookmark(const QString &s)
QString BookmarkManager::bookmarkToString(const Bookmark *b)
{
const QLatin1Char colon(':');
+ // Using \t as delimiter because any another symbol can be a part of note.
+ const QLatin1Char noteDelimiter('\t');
// Empty string was the name of the bookmark, which now is always ""
- return QLatin1String("") + colon + b->filePath() + colon + QString::number(b->lineNumber());
+ return QLatin1String("") + colon + b->filePath() +
+ colon + QString::number(b->lineNumber()) +
+ noteDelimiter + b->note();
}
/* Saves the bookmarks to the session settings. */
@@ -739,6 +794,18 @@ void BookmarkManager::saveBookmarks()
sessionManager()->setValue("Bookmarks", list);
}
+void BookmarkManager::operateTooltip(TextEditor::ITextEditor *textEditor, const QPoint &pos, Bookmark *mark)
+{
+ if (!mark)
+ return;
+
+ if (mark->note().isEmpty()) {
+ TextEditor::ToolTip::instance()->hide();
+ } else {
+ TextEditor::ToolTip::instance()->show(pos, TextEditor::TextContent(mark->note()), textEditor->widget());
+ }
+}
+
/* Loads the bookmarks from the session settings. */
void BookmarkManager::loadBookmarks()
{
@@ -758,6 +825,16 @@ void BookmarkManager::handleBookmarkRequest(TextEditor::ITextEditor *textEditor,
toggleBookmark(textEditor->document()->fileName(), line);
}
+void BookmarkManager::handleBookmarkTooltipRequest(TextEditor::ITextEditor *textEditor, const QPoint &pos,
+ int line)
+{
+ if (textEditor->document()) {
+ const QFileInfo fi(textEditor->document()->fileName());
+ Bookmark *mark = findBookmark(fi.path(), fi.fileName(), line);
+ operateTooltip(textEditor, pos, mark);
+ }
+}
+
// BookmarkViewFactory
BookmarkViewFactory::BookmarkViewFactory(BookmarkManager *bm)
diff --git a/src/plugins/bookmarks/bookmarkmanager.h b/src/plugins/bookmarks/bookmarkmanager.h
index 2f5b21be65..d7b4112672 100644
--- a/src/plugins/bookmarks/bookmarkmanager.h
+++ b/src/plugins/bookmarks/bookmarkmanager.h
@@ -85,11 +85,14 @@ public:
// this QItemSelectionModel is shared by all views
QItemSelectionModel *selectionModel() const;
+ bool hasBookmarkInPosition(const QString &fileName, int lineNumber);
+
enum Roles {
Filename = Qt::UserRole,
LineNumber = Qt::UserRole + 1,
Directory = Qt::UserRole + 2,
- LineText = Qt::UserRole + 3
+ LineText = Qt::UserRole + 3,
+ Note = Qt::UserRole + 4
};
public slots:
@@ -101,6 +104,8 @@ public slots:
void prev();
void moveUp();
void moveDown();
+ void editNote();
+ void editNote(const QString &fileName, int lineNumber);
bool gotoBookmark(Bookmark *bookmark);
signals:
@@ -113,6 +118,9 @@ private slots:
void handleBookmarkRequest(TextEditor::ITextEditor * textEditor,
int line,
TextEditor::ITextEditor::MarkRequestKind kind);
+ void handleBookmarkTooltipRequest(TextEditor::ITextEditor *textEditor,
+ const QPoint &pos,
+ int line);
private:
TextEditor::ITextEditor *currentTextEditor() const;
@@ -125,6 +133,7 @@ private:
void addBookmark(const QString &s);
static QString bookmarkToString(const Bookmark *b);
void saveBookmarks();
+ void operateTooltip(TextEditor::ITextEditor *textEditor, const QPoint &pos, Bookmark *mark);
typedef QMultiMap<QString, Bookmark *> FileNameBookmarksMap;
typedef QMap<QString, FileNameBookmarksMap *> DirectoryFileBookmarksMap;
diff --git a/src/plugins/bookmarks/bookmarks.qbs b/src/plugins/bookmarks/bookmarks.qbs
index 0fa44b7194..c7d02f9e7d 100644
--- a/src/plugins/bookmarks/bookmarks.qbs
+++ b/src/plugins/bookmarks/bookmarks.qbs
@@ -13,21 +13,16 @@ QtcPlugin {
Depends { name: "Locator" }
Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
files: [
- "bookmarksplugin.h",
+ "bookmark.cpp",
"bookmark.h",
+ "bookmarkmanager.cpp",
"bookmarkmanager.h",
+ "bookmarks.qrc",
"bookmarks_global.h",
"bookmarksplugin.cpp",
- "bookmark.cpp",
- "bookmarkmanager.cpp",
- "bookmarks.qrc",
+ "bookmarksplugin.h",
]
}
diff --git a/src/plugins/bookmarks/bookmarks_global.h b/src/plugins/bookmarks/bookmarks_global.h
index 6ca53577a2..3e20208b8e 100644
--- a/src/plugins/bookmarks/bookmarks_global.h
+++ b/src/plugins/bookmarks/bookmarks_global.h
@@ -36,6 +36,7 @@ namespace Constants {
const char BOOKMARKS_TOGGLE_ACTION[] = "Bookmarks.Toggle";
const char BOOKMARKS_MOVEUP_ACTION[] = "Bookmarks.MoveUp";
const char BOOKMARKS_MOVEDOWN_ACTION[] = "Bookmarks.MoveDown";
+const char BOOKMARKS_EDITNOTE_ACTION[] = "Bookmarks.EditNote";
const char BOOKMARKS_PREV_ACTION[] = "Bookmarks.Previous";
const char BOOKMARKS_NEXT_ACTION[] = "Bookmarks.Next";
const char BOOKMARKS_PREVDIR_ACTION[] = "Bookmarks.PreviousDirectory";
diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp
index d836024736..6bbcbd7669 100644
--- a/src/plugins/bookmarks/bookmarksplugin.cpp
+++ b/src/plugins/bookmarks/bookmarksplugin.cpp
@@ -108,6 +108,8 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
cmd = Core::ActionManager::registerAction(m_docNextAction, BOOKMARKS_NEXTDOC_ACTION, globalcontext);
mbm->addAction(cmd);
+ m_editNoteAction = new QAction(tr("Edit Bookmark Note"), this);
+
m_bookmarkManager = new BookmarkManager;
connect(m_toggleAction, SIGNAL(triggered()), m_bookmarkManager, SLOT(toggleBookmark()));
@@ -115,6 +117,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
connect(m_nextAction, SIGNAL(triggered()), m_bookmarkManager, SLOT(next()));
connect(m_docPrevAction, SIGNAL(triggered()), m_bookmarkManager, SLOT(prevInDocument()));
connect(m_docNextAction, SIGNAL(triggered()), m_bookmarkManager, SLOT(nextInDocument()));
+ connect(m_editNoteAction, SIGNAL(triggered()), this, SLOT(bookmarkEditNoteActionTriggered()));
connect(m_bookmarkManager, SIGNAL(updateActions(int)), this, SLOT(updateActions(int)));
updateActions(m_bookmarkManager->state());
addAutoReleasedObject(new BookmarkViewFactory(m_bookmarkManager));
@@ -163,6 +166,10 @@ void BookmarksPlugin::editorOpened(Core::IEditor *editor)
m_bookmarkManager,
SLOT(handleBookmarkRequest(TextEditor::ITextEditor*,int,
TextEditor::ITextEditor::MarkRequestKind)));
+ connect(editor,
+ SIGNAL(markTooltipRequested(TextEditor::ITextEditor*,QPoint,int)),
+ m_bookmarkManager,
+ SLOT(handleBookmarkTooltipRequest(TextEditor::ITextEditor*,QPoint,int)));
}
}
@@ -179,15 +186,21 @@ void BookmarksPlugin::requestContextMenu(TextEditor::ITextEditor *editor,
{
m_bookmarkMarginActionLineNumber = lineNumber;
m_bookmarkMarginActionFileName = editor->document()->fileName();
+
menu->addAction(m_bookmarkMarginAction);
+ if (m_bookmarkManager->hasBookmarkInPosition(m_bookmarkMarginActionFileName, m_bookmarkMarginActionLineNumber))
+ menu->addAction(m_editNoteAction);
}
void BookmarksPlugin::bookmarkMarginActionTriggered()
{
- m_bookmarkManager->toggleBookmark(
- m_bookmarkMarginActionFileName,
- m_bookmarkMarginActionLineNumber
- );
+ m_bookmarkManager->toggleBookmark(m_bookmarkMarginActionFileName,
+ m_bookmarkMarginActionLineNumber);
+}
+
+void BookmarksPlugin::bookmarkEditNoteActionTriggered()
+{
+ m_bookmarkManager->editNote(m_bookmarkMarginActionFileName, m_bookmarkMarginActionLineNumber);
}
Q_EXPORT_PLUGIN(BookmarksPlugin)
diff --git a/src/plugins/bookmarks/bookmarksplugin.h b/src/plugins/bookmarks/bookmarksplugin.h
index b8280c3e35..df70a423cf 100644
--- a/src/plugins/bookmarks/bookmarksplugin.h
+++ b/src/plugins/bookmarks/bookmarksplugin.h
@@ -76,6 +76,7 @@ private slots:
void requestContextMenu(TextEditor::ITextEditor *editor,
int lineNumber, QMenu *menu);
void bookmarkMarginActionTriggered();
+ void bookmarkEditNoteActionTriggered();
private:
static BookmarksPlugin *m_instance;
@@ -86,6 +87,7 @@ private:
QAction *m_nextAction;
QAction *m_docPrevAction;
QAction *m_docNextAction;
+ QAction *m_editNoteAction;
QAction *m_bookmarkMarginAction;
int m_bookmarkMarginActionLineNumber;
diff --git a/src/plugins/classview/classview.qbs b/src/plugins/classview/classview.qbs
index a7ad4a23c2..338cec83eb 100644
--- a/src/plugins/classview/classview.qbs
+++ b/src/plugins/classview/classview.qbs
@@ -13,36 +13,31 @@ QtcPlugin {
Depends { name: "TextEditor" }
Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
files: [
- "classviewplugin.h",
- "classviewnavigationwidgetfactory.h",
+ "classview.qrc",
"classviewconstants.h",
+ "classviewmanager.cpp",
+ "classviewmanager.h",
+ "classviewnavigationwidget.cpp",
"classviewnavigationwidget.h",
+ "classviewnavigationwidget.ui",
+ "classviewnavigationwidgetfactory.cpp",
+ "classviewnavigationwidgetfactory.h",
+ "classviewparser.cpp",
"classviewparser.h",
- "classviewmanager.h",
- "classviewsymbollocation.h",
- "classviewsymbolinformation.h",
+ "classviewparsertreeitem.cpp",
"classviewparsertreeitem.h",
- "classviewutils.h",
- "classviewtreeitemmodel.h",
"classviewplugin.cpp",
- "classviewnavigationwidgetfactory.cpp",
- "classviewnavigationwidget.cpp",
- "classviewparser.cpp",
- "classviewmanager.cpp",
- "classviewsymbollocation.cpp",
+ "classviewplugin.h",
"classviewsymbolinformation.cpp",
- "classviewparsertreeitem.cpp",
- "classviewutils.cpp",
+ "classviewsymbolinformation.h",
+ "classviewsymbollocation.cpp",
+ "classviewsymbollocation.h",
"classviewtreeitemmodel.cpp",
- "classviewnavigationwidget.ui",
- "classview.qrc",
+ "classviewtreeitemmodel.h",
+ "classviewutils.cpp",
+ "classviewutils.h",
]
}
diff --git a/src/plugins/clearcase/clearcase.qbs b/src/plugins/clearcase/clearcase.qbs
index 2a3776d6d1..18a15de51a 100644
--- a/src/plugins/clearcase/clearcase.qbs
+++ b/src/plugins/clearcase/clearcase.qbs
@@ -18,12 +18,6 @@ QtcPlugin {
Depends { name: "cpp" }
cpp.defines: base.concat(["QT_NO_CAST_FROM_ASCII"])
- cpp.includePaths: [
- ".",
- "..",
- "../../libs",
- buildDirectory
- ]
files: [
"activityselector.cpp",
diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp
index 963bb1a3d5..e020e051a8 100644
--- a/src/plugins/clearcase/clearcaseplugin.cpp
+++ b/src/plugins/clearcase/clearcaseplugin.cpp
@@ -58,6 +58,7 @@
#include <utils/synchronousprocess.h>
#include <utils/parameteraction.h>
#include <utils/fileutils.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/runextensions.h>
#include <vcsbase/basevcseditorfactory.h>
@@ -152,7 +153,7 @@ static inline const VcsBase::VcsBaseEditorParameters *findType(int ie)
static inline QString debugCodec(const QTextCodec *c)
{
- return c ? QString::fromAscii(c->name()) : QString::fromAscii("Null codec");
+ return c ? QString::fromLatin1(c->name()) : QString::fromLatin1("Null codec");
}
// ------------- ClearCasePlugin
@@ -714,11 +715,10 @@ bool ClearCasePlugin::vcsUndoHijack(const QString &workingDir, const QString &fi
QStringList args(QLatin1String("update"));
args << QLatin1String(keep ? "-rename" : "-overwrite");
args << QLatin1String("-log");
-#ifdef Q_OS_WIN32
- args << QLatin1String("NUL");
-#else
+ if (Utils::HostOsInfo::isWindowsHost())
+ args << QLatin1String("NUL");
+ else
args << QLatin1String("/dev/null");
-#endif
args << QDir::toNativeSeparators(fileName);
const ClearCaseResponse response =
diff --git a/src/plugins/clearcase/clearcasesettings.cpp b/src/plugins/clearcase/clearcasesettings.cpp
index 5cfb11ba11..11cae8f804 100644
--- a/src/plugins/clearcase/clearcasesettings.cpp
+++ b/src/plugins/clearcase/clearcasesettings.cpp
@@ -31,6 +31,7 @@
#include "clearcasesettings.h"
#include <utils/environment.h>
+#include <utils/hostosinfo.h>
#include <QSettings>
@@ -55,11 +56,7 @@ enum { defaultTimeOutS = 30, defaultHistoryCount = 50 };
static QString defaultCommand()
{
- QString rc(QLatin1String("cleartool"));
-#if defined(Q_OS_WIN32)
- rc.append(QLatin1String(".exe"));
-#endif
- return rc;
+ return QLatin1String("cleartool" QTC_HOST_EXE_SUFFIX);
}
using namespace ClearCase::Internal;
diff --git a/src/plugins/clearcase/settingspage.cpp b/src/plugins/clearcase/settingspage.cpp
index e8d4252eb5..3dd15b2113 100644
--- a/src/plugins/clearcase/settingspage.cpp
+++ b/src/plugins/clearcase/settingspage.cpp
@@ -36,6 +36,7 @@
#include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/environment.h>
+#include <utils/hostosinfo.h>
#include <utils/pathchooser.h>
#include <QCoreApplication>
@@ -84,11 +85,11 @@ void SettingsPageWidget::setSettings(const ClearCaseSettings &s)
m_ui.diffWarningLabel->setVisible(false);
} else {
QString diffWarning = tr("In order to use External diff, 'diff' command needs to be accessible.");
-#ifdef Q_OS_WIN
- diffWarning.append(tr(" DiffUtils is available for free download "
- "<a href=\"http://gnuwin32.sourceforge.net/packages/diffutils.htm\">here</a>. "
- "Please extract it to a directory in your PATH."));
-#endif
+ if (HostOsInfo::isWindowsHost()) {
+ diffWarning.append(tr(" DiffUtils is available for free download "
+ "<a href=\"http://gnuwin32.sourceforge.net/packages/diffutils.htm\">here</a>. "
+ "Please extract it to a directory in your PATH."));
+ }
m_ui.diffWarningLabel->setText(diffWarning);
m_ui.externalDiffRadioButton->setEnabled(false);
}
diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp
index c683053457..16354946e4 100644
--- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp
@@ -36,10 +36,12 @@
#include <projectexplorer/target.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/buildsteplist.h>
+#include <utils/fileutils.h>
using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal;
+using namespace Utils;
CMakeLocatorFilter::CMakeLocatorFilter()
{
@@ -73,7 +75,8 @@ QList<Locator::FilterEntry> CMakeLocatorFilter::matchesFor(QFutureInterface<Loca
foreach (CMakeBuildTarget ct, cmakeProject->buildTargets()) {
if (ct.title.contains(entry)) {
Locator::FilterEntry entry(this, ct.title, cmakeProject->document()->fileName());
- entry.extraInfo = cmakeProject->document()->fileName();
+ entry.extraInfo = FileUtils::shortNativePath(
+ FileName::fromString(cmakeProject->document()->fileName()));
result.append(entry);
}
}
diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
index 48489f5c8e..9e0330a5d8 100644
--- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
@@ -32,6 +32,7 @@
#include "cmakebuildconfiguration.h"
#include <coreplugin/icore.h>
+#include <utils/hostosinfo.h>
#include <utils/pathchooser.h>
#include <utils/fancylineedit.h>
#include <projectexplorer/kitinformation.h>
@@ -125,11 +126,10 @@ QString GeneratorInfo::generator() const
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2012Flavor) {
return QLatin1String("NMake Makefiles");
} else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) {
-#ifdef Q_OS_WIN
+ if (Utils::HostOsInfo::isWindowsHost())
return QLatin1String("MinGW Makefiles");
-#else
+ else
return QLatin1String("Unix Makefiles");
-#endif
}
}
return QLatin1String("Unix Makefiles");
@@ -158,11 +158,10 @@ QString GeneratorInfo::displayName() const
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2012Flavor) {
return QApplication::tr("NMake Generator (%1)").arg(m_kit->displayName());
} else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) {
-#ifdef Q_OS_WIN
+ if (Utils::HostOsInfo::isWindowsHost())
return QApplication::tr("MinGW Generator (%1)").arg(m_kit->displayName());
-#else
+ else
return QApplication::tr("Unix Generator (%1)").arg(m_kit->displayName());
-#endif
}
} else {
// Non windows
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index e141fcbb22..3c3325b9a4 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -1180,7 +1180,7 @@ void CMakeCbpParser::parseAdd()
compilerOption[assignIndex] = ' ';
}
m_defines.append("#define ");
- m_defines.append(compilerOption.mid(macroNameIndex).toAscii());
+ m_defines.append(compilerOption.mid(macroNameIndex).toLatin1());
m_defines.append('\n');
}
}
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs
index 541176d66a..3ce75fbbcb 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs
@@ -14,14 +14,6 @@ QtcPlugin {
Depends { name: "Locator" }
Depends { name: "QtSupport" }
- Depends { name: "cpp" }
- cpp.includePaths: [
- ".",
- "..",
- "../../libs",
- buildDirectory
- ]
-
files: [
"CMakeProject.mimetypes.xml",
"cmakebuildconfiguration.cpp",
@@ -51,7 +43,7 @@ QtcPlugin {
"cmakeuicodemodelsupport.cpp",
"cmakeuicodemodelsupport.h",
"makestep.cpp",
- "makestep.h"
+ "makestep.h",
]
}
diff --git a/src/plugins/coreplugin/actionmanager/command.cpp b/src/plugins/coreplugin/actionmanager/command.cpp
index c4472d1eed..07a2f0d67a 100644
--- a/src/plugins/coreplugin/actionmanager/command.cpp
+++ b/src/plugins/coreplugin/actionmanager/command.cpp
@@ -33,6 +33,8 @@
#include "icontext.h"
#include "id.h"
+#include <utils/hostosinfo.h>
+
#include <QDebug>
#include <QTextStream>
@@ -437,9 +439,8 @@ static QString msgActionWarning(QAction *newAction, int k, QAction *oldAction)
void Action::addOverrideAction(QAction *action, const Core::Context &context, bool scriptable)
{
-#ifdef Q_OS_MAC
- action->setIconVisibleInMenu(false);
-#endif
+ if (Utils::HostOsInfo::isMacHost())
+ action->setIconVisibleInMenu(false);
if (isEmpty())
m_action->initialize(action);
if (context.isEmpty()) {
diff --git a/src/plugins/coreplugin/actionmanager/commandmappings.cpp b/src/plugins/coreplugin/actionmanager/commandmappings.cpp
index ab8c24707e..b287cf7fe2 100644
--- a/src/plugins/coreplugin/actionmanager/commandmappings.cpp
+++ b/src/plugins/coreplugin/actionmanager/commandmappings.cpp
@@ -36,6 +36,7 @@
#include "icore.h"
#include "id.h"
+#include <utils/hostosinfo.h>
#include <utils/treewidgetcolumnstretcher.h>
#include <QKeyEvent>
@@ -165,18 +166,18 @@ bool CommandMappings::filter(const QString &filterString, QTreeWidgetItem *item)
int columnCount = item->columnCount();
for (int i = 0; !visible && i < columnCount; ++i) {
QString text = item->text(i);
-#ifdef Q_OS_MAC
- // accept e.g. Cmd+E in the filter. the text shows special fancy characters for Cmd
- if (i == columnCount - 1) {
- QKeySequence key = QKeySequence::fromString(text, QKeySequence::NativeText);
- if (!key.isEmpty()) {
- text = key.toString(QKeySequence::PortableText);
- text.replace(QLatin1String("Ctrl"), QLatin1String("Cmd"));
- text.replace(QLatin1String("Meta"), QLatin1String("Ctrl"));
- text.replace(QLatin1String("Alt"), QLatin1String("Opt"));
+ if (Utils::HostOsInfo::isMacHost()) {
+ // accept e.g. Cmd+E in the filter. the text shows special fancy characters for Cmd
+ if (i == columnCount - 1) {
+ QKeySequence key = QKeySequence::fromString(text, QKeySequence::NativeText);
+ if (!key.isEmpty()) {
+ text = key.toString(QKeySequence::PortableText);
+ text.replace(QLatin1String("Ctrl"), QLatin1String("Cmd"));
+ text.replace(QLatin1String("Meta"), QLatin1String("Ctrl"));
+ text.replace(QLatin1String("Alt"), QLatin1String("Opt"));
+ }
}
}
-#endif
visible |= (bool)text.contains(filterString, Qt::CaseInsensitive);
}
diff --git a/src/plugins/coreplugin/actionmanager/commandsfile.cpp b/src/plugins/coreplugin/actionmanager/commandsfile.cpp
index 23be856e58..c8ed630c1d 100644
--- a/src/plugins/coreplugin/actionmanager/commandsfile.cpp
+++ b/src/plugins/coreplugin/actionmanager/commandsfile.cpp
@@ -140,7 +140,7 @@ bool CommandsFile::exportCommands(const QList<ShortcutItem *> &items)
w.setAutoFormattingIndent(1); // Historical, used to be QDom.
w.writeStartDocument();
w.writeDTD(QLatin1String("<!DOCTYPE KeyboardMappingScheme>"));
- w.writeComment(QString::fromAscii(" Written by Qt Creator %1, %2. ").
+ w.writeComment(QString::fromLatin1(" Written by Qt Creator %1, %2. ").
arg(QLatin1String(Core::Constants::IDE_VERSION_LONG),
QDateTime::currentDateTime().toString(Qt::ISODate)));
w.writeStartElement(ctx.mappingElement);
diff --git a/src/plugins/coreplugin/basefilewizard.cpp b/src/plugins/coreplugin/basefilewizard.cpp
index 9591f5838a..82622ac5eb 100644
--- a/src/plugins/coreplugin/basefilewizard.cpp
+++ b/src/plugins/coreplugin/basefilewizard.cpp
@@ -40,6 +40,7 @@
#include <utils/qtcassert.h>
#include <utils/stringutils.h>
#include <utils/fileutils.h>
+#include <utils/hostosinfo.h>
#include <QDir>
#include <QFile>
@@ -603,15 +604,15 @@ void BaseFileWizard::setupWizard(QWizard *w)
w->setOption(QWizard::NoBackButtonOnStartPage, true);
w->setWindowFlags(w->windowFlags() & ~Qt::WindowContextHelpButtonHint);
-#ifdef Q_OS_MAC
- w->setButtonLayout(QList<QWizard::WizardButton>()
- << QWizard::CancelButton
- << QWizard::Stretch
- << QWizard::BackButton
- << QWizard::NextButton
- << QWizard::CommitButton
- << QWizard::FinishButton);
-#endif
+ if (Utils::HostOsInfo::isMacHost()) {
+ w->setButtonLayout(QList<QWizard::WizardButton>()
+ << QWizard::CancelButton
+ << QWizard::Stretch
+ << QWizard::BackButton
+ << QWizard::NextButton
+ << QWizard::CommitButton
+ << QWizard::FinishButton);
+ }
}
/*!
diff --git a/src/plugins/coreplugin/coreplugin.qbs b/src/plugins/coreplugin/coreplugin.qbs
index cf50a57299..83e3328054 100644
--- a/src/plugins/coreplugin/coreplugin.qbs
+++ b/src/plugins/coreplugin/coreplugin.qbs
@@ -13,20 +13,17 @@ QtcPlugin {
Depends { name: "Utils" }
Depends { name: "ExtensionSystem" }
Depends { name: "Aggregation" }
+ Depends { name: "app_version_header" }
- cpp.includePaths: [
- ".",
- "..",
+ cpp.includePaths: base.concat([
"../..",
- "../../libs",
- "../../../src/shared/scriptwrapper/",
+ "../../shared/scriptwrapper",
"dialogs",
"editormanager",
"progressmanager",
"scriptmanager",
- "actionmanager",
- buildDirectory
- ]
+ "actionmanager"
+ ])
cpp.dynamicLibraries: {
if (qbs.targetOS == "windows") return [
@@ -36,8 +33,6 @@ QtcPlugin {
}
files: [
- "fancyactionbar.qrc",
- "generalsettings.ui",
"basefilewizard.cpp",
"basefilewizard.h",
"core.qrc",
@@ -47,6 +42,8 @@ QtcPlugin {
"coreplugin.h",
"designmode.cpp",
"designmode.h",
+ "documentmanager.cpp",
+ "documentmanager.h",
"editmode.cpp",
"editmode.h",
"editortoolbar.cpp",
@@ -56,10 +53,11 @@ QtcPlugin {
"externaltoolmanager.h",
"fancyactionbar.cpp",
"fancyactionbar.h",
+ "fancyactionbar.qrc",
"fancytabwidget.cpp",
"fancytabwidget.h",
- "featureprovider.h",
"featureprovider.cpp",
+ "featureprovider.h",
"fileiconprovider.cpp",
"fileiconprovider.h",
"fileutils.cpp",
@@ -68,6 +66,7 @@ QtcPlugin {
"findplaceholder.h",
"generalsettings.cpp",
"generalsettings.h",
+ "generalsettings.ui",
"generatedfile.cpp",
"generatedfile.h",
"helpmanager.cpp",
@@ -77,20 +76,21 @@ QtcPlugin {
"icore.cpp",
"icore.h",
"icorelistener.h",
+ "id.cpp",
"id.h",
- "ifilewizardextension.h",
- "imode.cpp",
- "imode.h",
- "documentmanager.cpp",
- "documentmanager.h",
"idocument.cpp",
"idocument.h",
"idocumentfactory.h",
+ "ifilewizardextension.h",
+ "imode.cpp",
+ "imode.h",
"inavigationwidgetfactory.cpp",
"inavigationwidgetfactory.h",
"infobar.cpp",
"infobar.h",
"ioutputpane.h",
+ "iversioncontrol.cpp",
+ "iversioncontrol.h",
"mainwindow.cpp",
"mainwindow.h",
"manhattanstyle.cpp",
@@ -146,18 +146,15 @@ QtcPlugin {
"textdocument.h",
"toolsettings.cpp",
"toolsettings.h",
+ "variablechooser.cpp",
"variablechooser.h",
"variablechooser.ui",
- "vcsmanager.h",
- "versiondialog.cpp",
- "versiondialog.h",
- "id.cpp",
- "iversioncontrol.cpp",
- "iversioncontrol.h",
- "variablechooser.cpp",
"variablemanager.cpp",
"variablemanager.h",
"vcsmanager.cpp",
+ "vcsmanager.h",
+ "versiondialog.cpp",
+ "versiondialog.h",
"actionmanager/actioncontainer.cpp",
"actionmanager/actioncontainer.h",
"actionmanager/actioncontainer_p.h",
@@ -167,23 +164,23 @@ QtcPlugin {
"actionmanager/command.cpp",
"actionmanager/command.h",
"actionmanager/command_p.h",
- "actionmanager/commandbutton.h",
"actionmanager/commandbutton.cpp",
+ "actionmanager/commandbutton.h",
"actionmanager/commandmappings.cpp",
"actionmanager/commandmappings.h",
"actionmanager/commandmappings.ui",
"actionmanager/commandsfile.cpp",
"actionmanager/commandsfile.h",
- "dialogs/externaltoolconfig.ui",
- "dialogs/newdialog.ui",
"dialogs/externaltoolconfig.cpp",
"dialogs/externaltoolconfig.h",
+ "dialogs/externaltoolconfig.ui",
"dialogs/ioptionspage.cpp",
"dialogs/ioptionspage.h",
"dialogs/iwizard.cpp",
"dialogs/iwizard.h",
"dialogs/newdialog.cpp",
"dialogs/newdialog.h",
+ "dialogs/newdialog.ui",
"dialogs/openwithdialog.cpp",
"dialogs/openwithdialog.h",
"dialogs/openwithdialog.ui",
@@ -197,12 +194,14 @@ QtcPlugin {
"dialogs/shortcutsettings.cpp",
"dialogs/shortcutsettings.h",
"editormanager/BinFiles.mimetypes.xml",
+ "editormanager/editormanager.cpp",
+ "editormanager/editormanager.h",
"editormanager/editorview.cpp",
"editormanager/editorview.h",
"editormanager/ieditor.cpp",
"editormanager/ieditor.h",
- "editormanager/ieditorfactory.h",
"editormanager/ieditorfactory.cpp",
+ "editormanager/ieditorfactory.h",
"editormanager/iexternaleditor.cpp",
"editormanager/iexternaleditor.h",
"editormanager/openeditorsmodel.cpp",
@@ -214,8 +213,6 @@ QtcPlugin {
"editormanager/openeditorswindow.h",
"editormanager/systemeditor.cpp",
"editormanager/systemeditor.h",
- "editormanager/editormanager.cpp",
- "editormanager/editormanager.h",
"progressmanager/futureprogress.cpp",
"progressmanager/futureprogress.h",
"progressmanager/progressbar.cpp",
@@ -228,27 +225,27 @@ QtcPlugin {
"scriptmanager/metatypedeclarations.h",
"scriptmanager/scriptmanager.cpp",
"scriptmanager/scriptmanager.h",
- "scriptmanager/scriptmanager_p.h"
+ "scriptmanager/scriptmanager_p.h",
]
Group {
condition: qbs.targetOS == "windows"
files: [
- "progressmanager/progressmanager_win.cpp"
+ "progressmanager/progressmanager_win.cpp",
]
}
Group {
condition: qbs.targetOS == "macx"
files: [
- "progressmanager/progressmanager_mac.mm"
+ "progressmanager/progressmanager_mac.mm",
]
}
Group {
condition: qbs.targetOS == "linux"
files: [
- "progressmanager/progressmanager_x11.cpp"
+ "progressmanager/progressmanager_x11.cpp",
]
}
@@ -257,11 +254,5 @@ QtcPlugin {
Depends { name: "Aggregation" }
Depends { name: "ExtensionSystem" }
Depends { name: "Utils" }
- cpp.includePaths: [
- "../..",
- "../../libs",
- product.buildDirectory + "/.obj/Core/actionmanager"
- ]
}
}
-
diff --git a/src/plugins/coreplugin/designmode.cpp b/src/plugins/coreplugin/designmode.cpp
index 3e8dd7fc73..318805bec2 100644
--- a/src/plugins/coreplugin/designmode.cpp
+++ b/src/plugins/coreplugin/designmode.cpp
@@ -44,6 +44,7 @@
#include <QPair>
#include <QFileInfo>
+#include <QPointer>
#include <QStringList>
#include <QDebug>
@@ -100,7 +101,7 @@ public:
public:
Internal::DesignModeCoreListener *m_coreListener;
- QWeakPointer<Core::IEditor> m_currentEditor;
+ QPointer<Core::IEditor> m_currentEditor;
bool m_isActive;
bool m_isRequired;
QList<DesignEditorInfo*> m_editors;
@@ -236,10 +237,10 @@ void DesignMode::currentEditorChanged(Core::IEditor *editor)
if (ModeManager::currentMode() == this)
ModeManager::activateMode(Core::Constants::MODE_EDIT);
setEnabled(false);
- d->m_currentEditor = QWeakPointer<Core::IEditor>();
+ d->m_currentEditor = 0;
emit actionsUpdated(d->m_currentEditor.data());
} else {
- d->m_currentEditor = QWeakPointer<Core::IEditor>(editor);
+ d->m_currentEditor = editor;
if (d->m_currentEditor)
connect(d->m_currentEditor.data(), SIGNAL(changed()), this, SLOT(updateActions()));
diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp
index 44ee4c7b05..bf5d8db822 100644
--- a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp
+++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp
@@ -30,6 +30,7 @@
#include "externaltoolconfig.h"
#include "ui_externaltoolconfig.h"
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <coreplugin/coreconstants.h>
@@ -350,13 +351,13 @@ QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex)
tool->setDescription(tr("This tool prints a line of useful text"));
//: Sample external tool text
const QString text = tr("Useful text");
-#ifdef Q_OS_WIN
- tool->setExecutables(QStringList(QLatin1String("cmd")));
- tool->setArguments(QLatin1String("/c echo ") + text);
-#else
- tool->setExecutables(QStringList(QLatin1String("echo")));
- tool->setArguments(text);
-#endif
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ tool->setExecutables(QStringList(QLatin1String("cmd")));
+ tool->setArguments(QLatin1String("/c echo ") + text);
+ } else {
+ tool->setExecutables(QStringList(QLatin1String("echo")));
+ tool->setArguments(text);
+ }
int pos;
QModelIndex parent;
diff --git a/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp b/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp
index 5b0c24c285..5363812de7 100644
--- a/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp
@@ -33,6 +33,7 @@
#include <coreplugin/fileiconprovider.h>
#include <coreplugin/idocument.h>
+#include <utils/hostosinfo.h>
#include <QDir>
#include <QFileInfo>
@@ -53,12 +54,10 @@ SaveItemsDialog::SaveItemsDialog(QWidget *parent,
{
m_ui.setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-#ifdef Q_OS_MAC
+
// QDialogButtonBox's behavior for "destructive" is wrong, the "do not save" should be left-aligned
- QDialogButtonBox::ButtonRole discardButtonRole = QDialogButtonBox::ResetRole;
-#else
- QDialogButtonBox::ButtonRole discardButtonRole = QDialogButtonBox::DestructiveRole;
-#endif
+ const QDialogButtonBox::ButtonRole discardButtonRole = Utils::HostOsInfo::isMacHost()
+ ? QDialogButtonBox::ResetRole : QDialogButtonBox::DestructiveRole;
QPushButton *discardButton = m_ui.buttonBox->addButton(tr("Do not Save"), discardButtonRole);
m_ui.buttonBox->button(QDialogButtonBox::Save)->setDefault(true);
m_ui.treeWidget->setFocus();
@@ -85,9 +84,8 @@ SaveItemsDialog::SaveItemsDialog(QWidget *parent,
m_ui.treeWidget->resizeColumnToContents(0);
m_ui.treeWidget->selectAll();
-#ifdef Q_OS_MAC
- m_ui.treeWidget->setAlternatingRowColors(true);
-#endif
+ if (Utils::HostOsInfo::isMacHost())
+ m_ui.treeWidget->setAlternatingRowColors(true);
adjustButtonWidths();
updateSaveButton();
@@ -134,13 +132,13 @@ void SaveItemsDialog::adjustButtonWidths()
if (hint > maxTextWidth)
maxTextWidth = hint;
}
-#ifdef Q_OS_MAC
- QPushButton *cancelButton = m_ui.buttonBox->button(QDialogButtonBox::Cancel);
- int cancelButtonWidth = cancelButton->sizeHint().width();
- if (cancelButtonWidth > maxTextWidth)
- maxTextWidth = cancelButtonWidth;
- cancelButton->setMinimumWidth(maxTextWidth);
-#endif
+ if (Utils::HostOsInfo::isMacHost()) {
+ QPushButton *cancelButton = m_ui.buttonBox->button(QDialogButtonBox::Cancel);
+ int cancelButtonWidth = cancelButton->sizeHint().width();
+ if (cancelButtonWidth > maxTextWidth)
+ maxTextWidth = cancelButtonWidth;
+ cancelButton->setMinimumWidth(maxTextWidth);
+ }
saveButton->setMinimumWidth(maxTextWidth);
}
diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
index 6827880e0a..d87488ac3f 100644
--- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
@@ -32,6 +32,7 @@
#include <extensionsystem/pluginmanager.h>
#include "icore.h"
+#include <utils/hostosinfo.h>
#include <utils/filterlineedit.h>
#include <QSettings>
@@ -135,6 +136,8 @@ QVariant CategoryModel::data(const QModelIndex &index, int role) const
void CategoryModel::setPages(const QList<IOptionsPage*> &pages,
const QList<IOptionsPageProvider *> &providers)
{
+ beginResetModel();
+
// Clear any previous categories
qDeleteAll(m_categories);
m_categories.clear();
@@ -174,7 +177,7 @@ void CategoryModel::setPages(const QList<IOptionsPage*> &pages,
category->providers.append(provider);
}
- reset();
+ endResetModel();
}
Category *CategoryModel::findCategoryById(const QString &id)
@@ -294,11 +297,10 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
createGui();
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-#ifdef Q_OS_MAC
- setWindowTitle(tr("Preferences"));
-#else
- setWindowTitle(tr("Options"));
-#endif
+ if (Utils::HostOsInfo::isMacHost())
+ setWindowTitle(tr("Preferences"));
+ else
+ setWindowTitle(tr("Options"));
m_model->setPages(m_pages,
ExtensionSystem::PluginManager::getObjects<IOptionsPageProvider>());
diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp
index d9c00677c4..5c0d97f325 100644
--- a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp
+++ b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp
@@ -141,7 +141,7 @@ void ShortcutSettings::commandChanged(QTreeWidgetItem *current)
CommandMappings::commandChanged(current);
if (!current || !current->data(0, Qt::UserRole).isValid())
return;
- ShortcutItem *scitem = qVariantValue<ShortcutItem *>(current->data(0, Qt::UserRole));
+ ShortcutItem *scitem = qvariant_cast<ShortcutItem *>(current->data(0, Qt::UserRole));
setKeySequence(scitem->m_key);
}
@@ -149,13 +149,13 @@ void ShortcutSettings::targetIdentifierChanged()
{
QTreeWidgetItem *current = commandList()->currentItem();
if (current && current->data(0, Qt::UserRole).isValid()) {
- ShortcutItem *scitem = qVariantValue<ShortcutItem *>(current->data(0, Qt::UserRole));
+ ShortcutItem *scitem = qvariant_cast<ShortcutItem *>(current->data(0, Qt::UserRole));
scitem->m_key = QKeySequence(m_key[0], m_key[1], m_key[2], m_key[3]);
if (scitem->m_cmd->defaultKeySequence() != scitem->m_key)
setModified(current, true);
else
setModified(current, false);
- current->setText(2, scitem->m_key);
+ current->setText(2, scitem->m_key.toString(QKeySequence::NativeText));
resetCollisionMarker(scitem);
markPossibleCollisions(scitem);
}
@@ -168,14 +168,14 @@ void ShortcutSettings::setKeySequence(const QKeySequence &key)
for (int i = 0; i < m_keyNum; ++i) {
m_key[i] = key[i];
}
- targetEdit()->setText(key);
+ targetEdit()->setText(key.toString(QKeySequence::NativeText));
}
void ShortcutSettings::resetTargetIdentifier()
{
QTreeWidgetItem *current = commandList()->currentItem();
if (current && current->data(0, Qt::UserRole).isValid()) {
- ShortcutItem *scitem = qVariantValue<ShortcutItem *>(current->data(0, Qt::UserRole));
+ ShortcutItem *scitem = qvariant_cast<ShortcutItem *>(current->data(0, Qt::UserRole));
setKeySequence(scitem->m_cmd->defaultKeySequence());
}
}
@@ -200,7 +200,7 @@ void ShortcutSettings::importAction()
QString sid = item->m_cmd->id().toString();
if (mapping.contains(sid)) {
item->m_key = mapping.value(sid);
- item->m_item->setText(2, item->m_key);
+ item->m_item->setText(2, item->m_key.toString(QKeySequence::NativeText));
if (item->m_item == commandList()->currentItem())
commandChanged(item->m_item);
@@ -222,7 +222,7 @@ void ShortcutSettings::defaultAction()
{
foreach (ShortcutItem *item, m_scitems) {
item->m_key = item->m_cmd->defaultKeySequence();
- item->m_item->setText(2, item->m_key);
+ item->m_item->setText(2, item->m_key.toString(QKeySequence::NativeText));
setModified(item->m_item, false);
if (item->m_item == commandList()->currentItem())
commandChanged(item->m_item);
@@ -293,7 +293,7 @@ void ShortcutSettings::initialize()
s->m_key = c->keySequence();
item->setText(0, subId);
item->setText(1, c->description());
- item->setText(2, s->m_key);
+ item->setText(2, s->m_key.toString(QKeySequence::NativeText));
if (s->m_cmd->defaultKeySequence() != s->m_key)
setModified(item, true);
@@ -333,7 +333,7 @@ void ShortcutSettings::handleKeyEvent(QKeyEvent *e)
}
m_keyNum++;
QKeySequence ks(m_key[0], m_key[1], m_key[2], m_key[3]);
- targetEdit()->setText(ks);
+ targetEdit()->setText(ks.toString(QKeySequence::NativeText));
e->accept();
}
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp
index 837759c7c9..88f55cdd2b 100644
--- a/src/plugins/coreplugin/documentmanager.cpp
+++ b/src/plugins/coreplugin/documentmanager.cpp
@@ -41,6 +41,7 @@
#include "vcsmanager.h"
#include "coreconstants.h"
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/pathchooser.h>
#include <utils/reloadpromptutils.h>
@@ -177,17 +178,17 @@ QFileSystemWatcher *DocumentManagerPrivate::fileWatcher()
QFileSystemWatcher *DocumentManagerPrivate::linkWatcher()
{
-#ifdef Q_OS_UNIX
- if (!m_linkWatcher) {
- m_linkWatcher = new QFileSystemWatcher(m_instance);
- m_linkWatcher->setObjectName(QLatin1String("_qt_autotest_force_engine_poller"));
- QObject::connect(m_linkWatcher, SIGNAL(fileChanged(QString)),
- m_instance, SLOT(changedFile(QString)));
+ if (Utils::HostOsInfo::isAnyUnixHost()) {
+ if (!m_linkWatcher) {
+ m_linkWatcher = new QFileSystemWatcher(m_instance);
+ m_linkWatcher->setObjectName(QLatin1String("_qt_autotest_force_engine_poller"));
+ QObject::connect(m_linkWatcher, SIGNAL(fileChanged(QString)),
+ m_instance, SLOT(changedFile(QString)));
+ }
+ return m_linkWatcher;
}
- return m_linkWatcher;
-#else
+
return fileWatcher();
-#endif
}
DocumentManagerPrivate::DocumentManagerPrivate(QMainWindow *mw) :
@@ -196,11 +197,7 @@ DocumentManagerPrivate::DocumentManagerPrivate(QMainWindow *mw) :
m_linkWatcher(0),
m_blockActivated(false),
m_lastVisitedDirectory(QDir::currentPath()),
-#ifdef Q_OS_MAC // Creator is in bizarre places when launched via finder.
- m_useProjectsDirectory(true),
-#else
- m_useProjectsDirectory(false),
-#endif
+ m_useProjectsDirectory(Utils::HostOsInfo::isMacHost()), // Creator is in bizarre places when launched via finder.
m_blockedIDocument(0)
{
}
@@ -488,9 +485,8 @@ QString DocumentManager::fixFileName(const QString &fileName, FixMode fixmode)
s = QDir::cleanPath(s);
}
s = QDir::toNativeSeparators(s);
-#ifdef Q_OS_WIN
- s = s.toLower();
-#endif
+ if (Utils::HostOsInfo::isWindowsHost())
+ s = s.toLower();
return s;
}
@@ -1369,7 +1365,7 @@ void DocumentManager::executeOpenWithMenuAction(QAction *action)
{
QTC_ASSERT(action, return);
const QVariant data = action->data();
- OpenWithEntry entry = qVariantValue<OpenWithEntry>(data);
+ OpenWithEntry entry = qvariant_cast<OpenWithEntry>(data);
if (entry.editorFactory) {
// close any open editors that have this file open, but have a different type.
EditorManager *em = EditorManager::instance();
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index c972ffd996..f84b38f715 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -60,6 +60,7 @@
#include <extensionsystem/pluginmanager.h>
#include <utils/consoleprocess.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QDateTime>
@@ -1700,9 +1701,8 @@ void EditorManager::updateActions()
fName = curEditor->displayName();
}
-#ifdef Q_OS_MAC
- window()->setWindowModified(curEditor->document()->isModified());
-#endif
+ if (HostOsInfo::isMacHost())
+ window()->setWindowModified(curEditor->document()->isModified());
bool ww = curEditor->document()->isModified() && curEditor->document()->isFileReadOnly();
if (ww != curEditor->document()->hasWriteWarning()) {
curEditor->document()->setWriteWarning(ww);
@@ -1739,10 +1739,8 @@ void EditorManager::updateActions()
curEditor->document()->infoBar()->removeInfo(QLatin1String("Core.EditorManager.MakeWritable"));
}
}
-#ifdef Q_OS_MAC
- } else { // curEditor
+ } else /* curEditor */ if (HostOsInfo::isMacHost()) {
window()->setWindowModified(false);
-#endif
}
setCloseSplitEnabled(d->m_splitter, d->m_splitter->isSplitter());
diff --git a/src/plugins/coreplugin/editormanager/openeditorsview.cpp b/src/plugins/coreplugin/editormanager/openeditorsview.cpp
index 096a3b163f..da82fd776f 100644
--- a/src/plugins/coreplugin/editormanager/openeditorsview.cpp
+++ b/src/plugins/coreplugin/editormanager/openeditorsview.cpp
@@ -117,6 +117,7 @@ OpenEditorsWidget::OpenEditorsWidget()
m_ui.editorList->header()->resizeSection(1, 16);
m_ui.editorList->setContextMenuPolicy(Qt::CustomContextMenu);
m_ui.editorList->installEventFilter(this);
+ m_ui.editorList->viewport()->installEventFilter(this);
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(updateCurrentItem(Core::IEditor*)));
@@ -161,6 +162,17 @@ bool OpenEditorsWidget::eventFilter(QObject *obj, QEvent *event)
&& ke->modifiers() == 0) {
closeEditor(m_ui.editorList->currentIndex());
}
+ } else if (obj == m_ui.editorList->viewport()
+ && event->type() == QEvent::MouseButtonRelease) {
+ QMouseEvent * me = static_cast<QMouseEvent*>(event);
+ if (me->button() == Qt::MiddleButton
+ && me->modifiers() == Qt::NoModifier) {
+ QModelIndex index = m_ui.editorList->indexAt(me->pos());
+ if (index.isValid()) {
+ closeEditor(index);
+ return true;
+ }
+ }
}
return false;
}
diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp
index bc5623953e..c583f974e4 100644
--- a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp
+++ b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp
@@ -33,6 +33,7 @@
#include "editorview.h"
#include "idocument.h"
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QFocusEvent>
@@ -60,16 +61,14 @@ OpenEditorsWindow::OpenEditorsWindow(QWidget *parent) :
m_editorList->setIndentation(0);
m_editorList->setSelectionMode(QAbstractItemView::SingleSelection);
m_editorList->setTextElideMode(Qt::ElideMiddle);
-#ifdef Q_OS_MAC
- m_editorList->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
-#endif
+ if (Utils::HostOsInfo::isMacHost())
+ m_editorList->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
m_editorList->installEventFilter(this);
// We disable the frame on this list view and use a QFrame around it instead.
// This improves the look with QGTKStyle.
-#ifndef Q_OS_MAC
- setFrameStyle(m_editorList->frameStyle());
-#endif
+ if (!Utils::HostOsInfo::isMacHost())
+ setFrameStyle(m_editorList->frameStyle());
m_editorList->setFrameStyle(QFrame::NoFrame);
QVBoxLayout *layout = new QVBoxLayout(this);
diff --git a/src/plugins/coreplugin/editortoolbar.cpp b/src/plugins/coreplugin/editortoolbar.cpp
index a159771ab3..6b05293e36 100644
--- a/src/plugins/coreplugin/editortoolbar.cpp
+++ b/src/plugins/coreplugin/editortoolbar.cpp
@@ -43,6 +43,7 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
+#include <utils/hostosinfo.h>
#include <utils/parameteraction.h>
#include <utils/qtcassert.h>
#include <utils/styledbar.h>
@@ -151,10 +152,10 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
d->m_forwardButton= new QToolButton(this);
d->m_forwardButton->setDefaultAction(d->m_goForwardAction);
-#ifdef Q_OS_MAC
- d->m_horizontalSplitAction->setIconVisibleInMenu(false);
- d->m_verticalSplitAction->setIconVisibleInMenu(false);
-#endif
+ if (Utils::HostOsInfo::isMacHost()) {
+ d->m_horizontalSplitAction->setIconVisibleInMenu(false);
+ d->m_verticalSplitAction->setIconVisibleInMenu(false);
+ }
d->m_splitButton->setIcon(QIcon(QLatin1String(Constants::ICON_SPLIT_HORIZONTAL)));
d->m_splitButton->setToolTip(tr("Split"));
diff --git a/src/plugins/coreplugin/fancytabwidget.cpp b/src/plugins/coreplugin/fancytabwidget.cpp
index aa92b93bbc..4ca58779ed 100644
--- a/src/plugins/coreplugin/fancytabwidget.cpp
+++ b/src/plugins/coreplugin/fancytabwidget.cpp
@@ -28,6 +28,7 @@
****************************************************************************/
#include "fancytabwidget.h"
+#include <utils/hostosinfo.h>
#include <utils/stylehelper.h>
#include <utils/styledbar.h>
@@ -273,23 +274,23 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
}
QString tabText(this->tabText(tabIndex));
- QRect tabTextRect(tabRect(tabIndex));
+ QRect tabTextRect(rect);
+ const bool drawIcon = rect.height() > 36;
QRect tabIconRect(tabTextRect);
- tabTextRect.translate(0, -2);
+ tabTextRect.translate(0, drawIcon ? -2 : 1);
QFont boldFont(painter->font());
boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize());
boldFont.setBold(true);
painter->setFont(boldFont);
painter->setPen(selected ? QColor(255, 255, 255, 160) : QColor(0, 0, 0, 110));
- int textFlags = Qt::AlignCenter | Qt::AlignBottom | Qt::TextWordWrap;
+ const int textFlags = Qt::AlignCenter | (drawIcon ? Qt::AlignBottom : Qt::AlignVCenter) | Qt::TextWordWrap;
if (enabled) {
painter->drawText(tabTextRect, textFlags, tabText);
painter->setPen(selected ? QColor(60, 60, 60) : Utils::StyleHelper::panelTextColor());
} else {
painter->setPen(selected ? Utils::StyleHelper::panelTextColor() : QColor(255, 255, 255, 120));
}
-#ifndef Q_OS_MAC
- if (!selected && enabled) {
+ if (!Utils::HostOsInfo::isMacHost() && !selected && enabled) {
painter->save();
int fader = int(m_tabs[tabIndex]->fader());
QLinearGradient grad(rect.topLeft(), rect.topRight());
@@ -302,14 +303,15 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
painter->drawLine(rect.bottomLeft(), rect.bottomRight());
painter->restore();
}
-#endif
if (!enabled)
painter->setOpacity(0.7);
- int textHeight = painter->fontMetrics().boundingRect(QRect(0, 0, width(), height()), Qt::TextWordWrap, tabText).height();
- tabIconRect.adjust(0, 4, 0, -textHeight);
- Utils::StyleHelper::drawIconWithShadow(tabIcon(tabIndex), tabIconRect, painter, enabled ? QIcon::Normal : QIcon::Disabled);
+ if (drawIcon) {
+ int textHeight = painter->fontMetrics().boundingRect(QRect(0, 0, width(), height()), Qt::TextWordWrap, tabText).height();
+ tabIconRect.adjust(0, 4, 0, -textHeight);
+ Utils::StyleHelper::drawIconWithShadow(tabIcon(tabIndex), tabIconRect, painter, enabled ? QIcon::Normal : QIcon::Disabled);
+ }
painter->translate(0, -1);
painter->drawText(tabTextRect, textFlags, tabText);
diff --git a/src/plugins/coreplugin/fileiconprovider.cpp b/src/plugins/coreplugin/fileiconprovider.cpp
index d42a321db1..e77b32c63a 100644
--- a/src/plugins/coreplugin/fileiconprovider.cpp
+++ b/src/plugins/coreplugin/fileiconprovider.cpp
@@ -30,6 +30,7 @@
#include "fileiconprovider.h"
#include "mimedatabase.h"
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QApplication>
@@ -43,6 +44,8 @@
#include <QIcon>
#include <QStyle>
+using namespace Utils;
+
/*!
\class Core::FileIconProvider
@@ -138,14 +141,13 @@ QIcon FileIconProvider::icon(const QFileInfo &fileInfo) const
}
}
// Get icon from OS.
-#if defined(Q_WS_WIN) || defined(Q_OS_MAC)
- return QFileIconProvider::icon(fileInfo);
-#else
+ if (HostOsInfo::isWindowsHost() || HostOsInfo::isMacHost())
+ return QFileIconProvider::icon(fileInfo);
+
// File icons are unknown on linux systems.
return (fileInfo.isDir()) ?
QFileIconProvider::icon(fileInfo) :
d->m_unknownFileIcon;
-#endif
}
/*!
diff --git a/src/plugins/coreplugin/inavigationwidgetfactory.h b/src/plugins/coreplugin/inavigationwidgetfactory.h
index 95b9b5880c..1a3d1aa163 100644
--- a/src/plugins/coreplugin/inavigationwidgetfactory.h
+++ b/src/plugins/coreplugin/inavigationwidgetfactory.h
@@ -30,7 +30,7 @@
#ifndef INAVIGATIONWIDGET_H
#define INAVIGATIONWIDGET_H
-#include <coreplugin/id.h>
+#include "id.h"
#include <QObject>
#include <QList>
diff --git a/src/plugins/coreplugin/mimedatabase.cpp b/src/plugins/coreplugin/mimedatabase.cpp
index 5a99c3fbae..28d6c31933 100644
--- a/src/plugins/coreplugin/mimedatabase.cpp
+++ b/src/plugins/coreplugin/mimedatabase.cpp
@@ -1093,7 +1093,7 @@ bool BaseMimeTypeParser::parse(QIODevice *dev, const QString &fileName, QString
case ParseComment: {
// comments have locale attributes. We want the default, English one
QString locale = atts.value(QLatin1String(localeAttributeC)).toString();
- const QString comment = QCoreApplication::translate("MimeType", reader.readElementText().toAscii());
+ const QString comment = QCoreApplication::translate("MimeType", reader.readElementText().toLatin1());
if (locale.isEmpty()) {
data.comment = comment;
} else {
diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp
index 393b2b3b61..5d82e2c54b 100644
--- a/src/plugins/coreplugin/outputpanemanager.cpp
+++ b/src/plugins/coreplugin/outputpanemanager.cpp
@@ -47,6 +47,7 @@
#include <extensionsystem/pluginmanager.h>
+#include <utils/hostosinfo.h>
#include <utils/styledbar.h>
#include <utils/qtcassert.h>
@@ -197,11 +198,7 @@ QWidget *OutputPaneManager::buttonsWidget()
// Return shortcut as Ctrl+<number>
static inline int paneShortCut(int number)
{
-#ifdef Q_OS_MAC
- int modifier = Qt::CTRL;
-#else
- int modifier = Qt::ALT;
-#endif
+ const int modifier = Utils::HostOsInfo::isMacHost() ? Qt::CTRL : Qt::ALT;
return modifier | (Qt::Key_0 + number);
}
diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp
index 33a340cef9..5ba52283fd 100644
--- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp
+++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp
@@ -29,8 +29,8 @@
#include "progressmanager_p.h"
#include "progressview.h"
-#include "coreconstants.h"
-#include "icore.h"
+#include "../coreconstants.h"
+#include "../icore.h"
#include <utils/qtcassert.h>
diff --git a/src/plugins/coreplugin/scriptmanager/scriptmanager.cpp b/src/plugins/coreplugin/scriptmanager/scriptmanager.cpp
index 553d105628..635dd3ebd7 100644
--- a/src/plugins/coreplugin/scriptmanager/scriptmanager.cpp
+++ b/src/plugins/coreplugin/scriptmanager/scriptmanager.cpp
@@ -95,7 +95,7 @@ static QScriptValue inputDialogGetInteger(QScriptContext *context, QScriptEngine
const int maxValue = argumentCount > 5 ? context->argument(5).toInt32() : INT_MAX;
bool ok;
- const int rc = QInputDialog::getInteger(parent, title, label, defaultValue, minValue, maxValue, 1, &ok);
+ const int rc = QInputDialog::getInt(parent, title, label, defaultValue, minValue, maxValue, 1, &ok);
if (!ok)
return QScriptValue(engine, QScriptValue::NullValue);
return QScriptValue(engine, rc);
diff --git a/src/plugins/coreplugin/sidebar.cpp b/src/plugins/coreplugin/sidebar.cpp
index ae61528dac..8b6d7c0689 100644
--- a/src/plugins/coreplugin/sidebar.cpp
+++ b/src/plugins/coreplugin/sidebar.cpp
@@ -41,6 +41,7 @@
#include <QLayout>
#include <QToolBar>
#include <QAction>
+#include <QPointer>
#include <QToolButton>
namespace Core {
@@ -79,7 +80,7 @@ struct SideBarPrivate {
SideBarPrivate() :m_closeWhenEmpty(false) {}
QList<Internal::SideBarWidget*> m_widgets;
- QMap<QString, QWeakPointer<SideBarItem> > m_itemMap;
+ QMap<QString, QPointer<SideBarItem> > m_itemMap;
QStringList m_availableItemIds;
QStringList m_availableItemTitles;
QStringList m_unavailableItemIds;
@@ -108,7 +109,7 @@ SideBar::SideBar(QList<SideBarItem*> itemList,
SideBar::~SideBar()
{
- foreach (const QWeakPointer<SideBarItem> &i, d->m_itemMap)
+ foreach (const QPointer<SideBarItem> &i, d->m_itemMap)
if (!i.isNull())
delete i.data();
delete d;
@@ -116,7 +117,7 @@ SideBar::~SideBar()
QString SideBar::idForTitle(const QString &title) const
{
- QMapIterator<QString, QWeakPointer<SideBarItem> > iter(d->m_itemMap);
+ QMapIterator<QString, QPointer<SideBarItem> > iter(d->m_itemMap);
while(iter.hasNext()) {
iter.next();
if (iter.value().data()->title() == title)
@@ -151,7 +152,7 @@ void SideBar::setCloseWhenEmpty(bool value)
void SideBar::makeItemAvailable(SideBarItem *item)
{
- typedef QMap<QString, QWeakPointer<SideBarItem> >::const_iterator Iterator;
+ typedef QMap<QString, QPointer<SideBarItem> >::const_iterator Iterator;
const Iterator cend = d->m_itemMap.constEnd();
for (Iterator it = d->m_itemMap.constBegin(); it != cend ; ++it) {
@@ -265,7 +266,7 @@ void SideBar::saveSettings(QSettings *settings, const QString &name)
views.append(currentItemId);
}
if (views.isEmpty() && d->m_itemMap.size()) {
- QMapIterator<QString, QWeakPointer<SideBarItem> > iter(d->m_itemMap);
+ QMapIterator<QString, QPointer<SideBarItem> > iter(d->m_itemMap);
iter.next();
views.append(iter.key());
}
@@ -321,7 +322,7 @@ void SideBar::readSettings(QSettings *settings, const QString &name)
void SideBar::activateItem(SideBarItem *item)
{
- typedef QMap<QString, QWeakPointer<SideBarItem> >::const_iterator Iterator;
+ typedef QMap<QString, QPointer<SideBarItem> >::const_iterator Iterator;
QString id;
const Iterator cend = d->m_itemMap.constEnd();
diff --git a/src/plugins/cpaster/codepasterprotocol.cpp b/src/plugins/cpaster/codepasterprotocol.cpp
index 7be3a769ae..7d0048cc77 100644
--- a/src/plugins/cpaster/codepasterprotocol.cpp
+++ b/src/plugins/cpaster/codepasterprotocol.cpp
@@ -37,6 +37,7 @@
#include <coreplugin/messagemanager.h>
#include <coreplugin/messageoutputwindow.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QListWidget>
@@ -76,12 +77,9 @@ bool CodePasterProtocol::checkConfiguration(QString *errorMessage)
const QString hostName = m_page->hostName();
if (hostName.isEmpty()) {
if (errorMessage) {
- *errorMessage =
-#ifdef Q_OS_MAC
- tr("No Server defined in the CodePaster preferences.");
-#else
- tr("No Server defined in the CodePaster options.");
-#endif
+ *errorMessage = Utils::HostOsInfo::isMacHost()
+ ? tr("No Server defined in the CodePaster preferences.")
+ : tr("No Server defined in the CodePaster options.");
}
return false;
}
@@ -159,7 +157,7 @@ void CodePasterProtocol::pasteFinished()
qWarning("Error pasting: %s", qPrintable(m_pasteReply->errorString()));
} else {
// Cut out the href-attribute
- QString contents = QString::fromAscii(m_pasteReply->readAll());
+ QString contents = QString::fromLatin1(m_pasteReply->readAll());
int hrefPos = contents.indexOf(QLatin1String("href=\""));
if (hrefPos != -1) {
hrefPos += 6;
@@ -190,7 +188,7 @@ void CodePasterProtocol::fetchFinished()
if (error) {
content = m_fetchReply->errorString();
} else {
- content = QString::fromAscii(m_fetchReply->readAll()); // Codepaster does not support special characters.
+ content = QString::fromLatin1(m_fetchReply->readAll()); // Codepaster does not support special characters.
if (debug)
qDebug() << content;
if (content.contains(QLatin1String("<B>No such paste!</B>"))) {
@@ -210,7 +208,7 @@ void CodePasterProtocol::listFinished()
Core::ICore::messageManager()->printToOutputPane(m_listReply->errorString(), true);
} else {
const QByteArray data = m_listReply->readAll();
- const QStringList lines = QString::fromAscii(data).split(QLatin1Char('\n'));
+ const QStringList lines = QString::fromLatin1(data).split(QLatin1Char('\n'));
emit listDone(name(), lines);
}
m_listReply->deleteLater();
diff --git a/src/plugins/cpaster/cpaster.qbs b/src/plugins/cpaster/cpaster.qbs
index 30208fe477..14cf63b416 100644
--- a/src/plugins/cpaster/cpaster.qbs
+++ b/src/plugins/cpaster/cpaster.qbs
@@ -10,13 +10,7 @@ QtcPlugin {
Depends { name: "TextEditor" }
Depends { name: "cpp" }
- cpp.includePaths: [
- ".",
- "../../shared/cpaster",
- "..",
- "../../libs",
- buildDirectory
- ]
+ cpp.includePaths: base.concat("../../shared/cpaster")
files: [
"codepasterprotocol.cpp",
@@ -54,7 +48,7 @@ QtcPlugin {
"settingspage.h",
"settingspage.ui",
"urlopenprotocol.cpp",
- "urlopenprotocol.h"
+ "urlopenprotocol.h",
]
Group {
@@ -63,7 +57,7 @@ QtcPlugin {
"cgi.cpp",
"cgi.h",
"splitter.cpp",
- "splitter.h"
+ "splitter.h",
]
}
}
diff --git a/src/plugins/cpaster/frontend/argumentscollector.cpp b/src/plugins/cpaster/frontend/argumentscollector.cpp
new file mode 100644
index 0000000000..9b433cf275
--- /dev/null
+++ b/src/plugins/cpaster/frontend/argumentscollector.cpp
@@ -0,0 +1,134 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: http://www.qt-project.org/
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+#include "argumentscollector.h"
+
+#include <QFileInfo>
+
+static QString pasteRequestString() { return QLatin1String("paste"); }
+static QString listProtocolsRequestString() { return QLatin1String("list-protocols"); }
+static QString helpRequestString() { return QLatin1String("help"); }
+static QString pasteFileOptionString() { return QLatin1String("-file"); }
+static QString pasteProtocolOptionString() { return QLatin1String("-protocol"); }
+
+namespace {
+struct ArgumentErrorException
+{
+ ArgumentErrorException(const QString &error) : error(error) {}
+ const QString error;
+};
+}
+
+ArgumentsCollector::ArgumentsCollector(const QStringList &availableProtocols)
+ : m_availableProtocols(availableProtocols)
+{
+}
+
+bool ArgumentsCollector::collect(const QStringList &args)
+{
+ m_arguments = args;
+ m_errorString.clear();
+ m_inputFilePath.clear();
+ m_protocol.clear();
+ try {
+ setRequest();
+ if (m_requestType == RequestTypePaste)
+ setPasteOptions();
+ return true;
+ } catch (const ArgumentErrorException &ex) {
+ m_errorString = ex.error;
+ return false;
+ }
+}
+
+QString ArgumentsCollector::usageString() const
+{
+ QString usage = tr("Usage:");
+ usage += QLatin1String("\n\t");
+ usage += tr("%1 <request> [ <request options>]")
+ .arg(QFileInfo(QCoreApplication::applicationFilePath()).fileName());
+ usage += QLatin1String("\n\t");
+ usage += tr("Possible requests: \"%1\", \"%2\", \"%3\"")
+ .arg(pasteRequestString(), listProtocolsRequestString(), helpRequestString());
+ usage += QLatin1String("\n\t");
+ usage += tr("Possible options for request \"%1\": \"%2 <file>\" (default: stdin), "
+ "\"%3 <protocol>\"")
+ .arg(pasteRequestString(), pasteFileOptionString(), pasteProtocolOptionString());
+ usage += QLatin1Char('\n');
+ return usage;
+}
+
+void ArgumentsCollector::setRequest()
+{
+ if (m_arguments.isEmpty())
+ throw ArgumentErrorException(tr("No request given"));
+ const QString requestString = m_arguments.takeFirst();
+ if (requestString == pasteRequestString())
+ m_requestType = RequestTypePaste;
+ else if (requestString == listProtocolsRequestString())
+ m_requestType = RequestTypeListProtocols;
+ else if (requestString == helpRequestString())
+ m_requestType = RequestTypeHelp;
+ else
+ throw ArgumentErrorException(tr("Unknown request \"%1\"").arg(requestString));
+}
+
+void ArgumentsCollector::setPasteOptions()
+{
+ while (!m_arguments.isEmpty()) {
+ if (checkAndSetOption(pasteFileOptionString(), m_inputFilePath))
+ continue;
+ if (checkAndSetOption(pasteProtocolOptionString(), m_protocol)) {
+ if (!m_availableProtocols.contains(m_protocol))
+ throw ArgumentErrorException(tr("Unknown protocol \"%1\"").arg(m_protocol));
+ continue;
+ }
+ throw ArgumentErrorException(tr("Invalid option \"%1\" for request \"%2\"")
+ .arg(m_arguments.first(), pasteRequestString()));
+ }
+
+ if (m_protocol.isEmpty())
+ throw ArgumentErrorException(tr("No protocol given"));
+}
+
+bool ArgumentsCollector::checkAndSetOption(const QString &optionString, QString &optionValue)
+{
+ if (m_arguments.first() != optionString)
+ return false;
+
+ if (!optionValue.isEmpty())
+ throw ArgumentErrorException(tr("option \"%1\" was given twice").arg(optionString));
+ m_arguments.removeFirst();
+ if (m_arguments.isEmpty()) {
+ throw ArgumentErrorException(tr("Option \"%1\" requires an argument")
+ .arg(optionString));
+ }
+ optionValue = m_arguments.takeFirst();
+ return true;
+}
diff --git a/src/plugins/cpaster/frontend/argumentscollector.h b/src/plugins/cpaster/frontend/argumentscollector.h
new file mode 100644
index 0000000000..c299b718f3
--- /dev/null
+++ b/src/plugins/cpaster/frontend/argumentscollector.h
@@ -0,0 +1,67 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: http://www.qt-project.org/
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+
+#ifndef ARGUMENTSCOLLECTOR_H
+#define ARGUMENTSCOLLECTOR_H
+
+#include <QCoreApplication>
+#include <QStringList>
+
+class ArgumentsCollector
+{
+ Q_DECLARE_TR_FUNCTIONS(ArgumentsCollector)
+public:
+ ArgumentsCollector(const QStringList &availableProtocols);
+ bool collect(const QStringList &args); // Application is already removed.
+
+ enum RequestType { RequestTypeHelp, RequestTypeListProtocols, RequestTypePaste };
+ RequestType requestType() const { return m_requestType; }
+
+ QString errorString() const { return m_errorString; }
+ QString usageString() const;
+
+ // These are valid <=> requestType() == RequestTypePaste
+ QString inputFilePath() const { return m_inputFilePath; }
+ QString protocol() const { return m_protocol; }
+
+private:
+ void setRequest();
+ void setPasteOptions();
+ bool checkAndSetOption(const QString &optionString, QString &optionValue);
+
+ const QStringList m_availableProtocols;
+ QStringList m_arguments;
+ RequestType m_requestType;
+ QString m_inputFilePath;
+ QString m_protocol;
+ QString m_errorString;
+};
+
+#endif // ARGUMENTSCOLLECTOR_H
diff --git a/src/plugins/cpaster/frontend/frontend.pro b/src/plugins/cpaster/frontend/frontend.pro
new file mode 100644
index 0000000000..a5cdea93e4
--- /dev/null
+++ b/src/plugins/cpaster/frontend/frontend.pro
@@ -0,0 +1,30 @@
+TEMPLATE = app
+TARGET=cpaster
+
+include(../../../../qtcreator.pri)
+include(../../../rpath.pri)
+include(../../../plugins/coreplugin/coreplugin.pri)
+
+CONFIG += console
+QT += network
+
+LIBS *= -L$$IDE_PLUGIN_PATH/Nokia
+QMAKE_RPATHDIR *= $$IDE_PLUGIN_PATH/Nokia
+
+DESTDIR=$$IDE_APP_PATH
+
+HEADERS = ../protocol.h \
+ ../cpasterconstants.h \
+ ../pastebindotcomprotocol.h \
+ ../pastebindotcaprotocol.h \
+ ../kdepasteprotocol.h \
+ ../urlopenprotocol.h \
+ argumentscollector.h
+
+SOURCES += ../protocol.cpp \
+ ../pastebindotcomprotocol.cpp \
+ ../pastebindotcaprotocol.cpp \
+ ../kdepasteprotocol.cpp \
+ ../urlopenprotocol.cpp \
+ argumentscollector.cpp \
+ main.cpp
diff --git a/src/plugins/cpaster/frontend/frontend.qbs b/src/plugins/cpaster/frontend/frontend.qbs
new file mode 100644
index 0000000000..4c7b25f3ab
--- /dev/null
+++ b/src/plugins/cpaster/frontend/frontend.qbs
@@ -0,0 +1,30 @@
+import qbs.base 1.0
+import "../../../tools/QtcTool.qbs" as QtcTool
+
+QtcTool {
+ name: "cpaster"
+
+ Depends { name: "cpp" }
+ Depends {
+ name: "Qt"
+ submodules: "core", "gui", "network"
+ }
+ Depends { name: "Core" }
+
+ cpp.includePaths: ["../../"]
+ cpp.rpaths: [
+ "$ORIGIN/../lib/qtcreator",
+ "$ORIGIN/../lib/qtcreator/plugins",
+ "$ORIGIN/../lib/qtcreator/plugins/Nokia"
+ ]
+
+ files: [ "main.cpp",
+ "argumentscollector.h", "argumentscollector.cpp",
+ "../cpasterconstants.h",
+ "../kdepasteprotocol.h", "../kdepasteprotocol.cpp",
+ "../pastebindotcaprotocol.h", "../pastebindotcaprotocol.cpp",
+ "../pastebindotcomprotocol.h", "../pastebindotcomprotocol.cpp",
+ "../protocol.h", "../protocol.cpp",
+ "../urlopenprotocol.h", "../urlopenprotocol.cpp",
+ ]
+}
diff --git a/src/plugins/cpaster/frontend/main.cpp b/src/plugins/cpaster/frontend/main.cpp
new file mode 100644
index 0000000000..ca3b995142
--- /dev/null
+++ b/src/plugins/cpaster/frontend/main.cpp
@@ -0,0 +1,128 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: http://www.qt-project.org/
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+
+#include "argumentscollector.h"
+#include "../kdepasteprotocol.h"
+#include "../pastebindotcaprotocol.h"
+#include "../pastebindotcomprotocol.h"
+
+#include <QFile>
+#include <QObject>
+#include <QTimer>
+
+#include <cstdio>
+#include <cstdlib>
+#include <iostream>
+
+using namespace CodePaster;
+
+class PasteReceiver : public QObject
+{
+ Q_OBJECT
+public:
+ PasteReceiver(const QString &protocol, const QString &filePath) : m_filePath(filePath)
+ {
+ const QSharedPointer<NetworkAccessManagerProxy> accessMgr(new NetworkAccessManagerProxy);
+ if (protocol == KdePasteProtocol::protocolName().toLower())
+ m_protocol.reset(new KdePasteProtocol(accessMgr));
+ else if (protocol == PasteBinDotCaProtocol::protocolName().toLower())
+ m_protocol.reset(new PasteBinDotCaProtocol(accessMgr));
+ else if (protocol == PasteBinDotComProtocol::protocolName().toLower())
+ m_protocol.reset(new PasteBinDotComProtocol(accessMgr));
+ else
+ qFatal("Internal error: Invalid protocol.");
+ }
+
+public slots:
+ void paste()
+ {
+ QFile file(m_filePath);
+ const bool success = m_filePath.isEmpty()
+ ? file.open(stdin, QIODevice::ReadOnly) : file.open(QIODevice::ReadOnly);
+ if (!success) {
+ std::cerr << "Error: Failed to open file to paste from." << std::endl;
+ qApp->exit(EXIT_FAILURE);
+ return;
+ }
+ const QString content = QString::fromLocal8Bit(file.readAll());
+ if (content.isEmpty()) {
+ std::cerr << "Empty input, aborting." << std::endl;
+ qApp->exit(EXIT_FAILURE);
+ return;
+ }
+ connect(m_protocol.data(), SIGNAL(pasteDone(QString)), SLOT(handlePasteDone(QString)));
+ m_protocol->paste(content);
+ }
+
+private slots:
+ void handlePasteDone(const QString &link)
+ {
+ std::cout << qPrintable(link) << std::endl;
+ qApp->quit();
+ }
+
+private:
+ const QString m_filePath;
+ QScopedPointer<Protocol> m_protocol;
+};
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication app(argc, argv);
+
+ const QStringList protocols = QStringList() << KdePasteProtocol::protocolName().toLower()
+ << PasteBinDotCaProtocol::protocolName().toLower()
+ << PasteBinDotComProtocol::protocolName().toLower();
+ ArgumentsCollector argsCollector(protocols);
+ QStringList arguments = QCoreApplication::arguments();
+ arguments.removeFirst();
+ if (!argsCollector.collect(arguments)) {
+ std::cerr << "Error: " << qPrintable(argsCollector.errorString()) << '.' << std::endl
+ << qPrintable(argsCollector.usageString()) << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ switch (argsCollector.requestType()) {
+ case ArgumentsCollector::RequestTypeHelp:
+ std::cout << qPrintable(argsCollector.usageString()) << std::endl;
+ return EXIT_SUCCESS;
+ case ArgumentsCollector::RequestTypeListProtocols:
+ foreach (const QString &protocol, protocols)
+ std::cout << qPrintable(protocol) << std::endl;
+ return EXIT_SUCCESS;
+ case ArgumentsCollector::RequestTypePaste: {
+ PasteReceiver pr(argsCollector.protocol(), argsCollector.inputFilePath());
+ QTimer::singleShot(0, &pr, SLOT(paste()));
+ return app.exec();
+ }
+ }
+}
+
+#include "main.moc"
diff --git a/src/plugins/cpaster/pastebindotcaprotocol.cpp b/src/plugins/cpaster/pastebindotcaprotocol.cpp
index b01c5135d0..e036c0b39a 100644
--- a/src/plugins/cpaster/pastebindotcaprotocol.cpp
+++ b/src/plugins/cpaster/pastebindotcaprotocol.cpp
@@ -118,7 +118,7 @@ void PasteBinDotCaProtocol::pasteFinished()
} else {
/// returns ""SUCCESS:[id]""
const QByteArray data = m_pasteReply->readAll();
- const QString link = QString::fromLatin1(urlC) + QString::fromAscii(data).remove(QLatin1String("SUCCESS:"));
+ const QString link = QString::fromLatin1(urlC) + QString::fromLatin1(data).remove(QLatin1String("SUCCESS:"));
emit pasteDone(link);
}
m_pasteReply->deleteLater();
diff --git a/src/plugins/cpaster/pastebindotcaprotocol.h b/src/plugins/cpaster/pastebindotcaprotocol.h
index 8ace2de13c..7a2642f621 100644
--- a/src/plugins/cpaster/pastebindotcaprotocol.h
+++ b/src/plugins/cpaster/pastebindotcaprotocol.h
@@ -38,7 +38,9 @@ class PasteBinDotCaProtocol : public NetworkProtocol
Q_OBJECT
public:
explicit PasteBinDotCaProtocol(const NetworkAccessManagerProxyPtr &nw);
- QString name() const { return QLatin1String("Pastebin.Ca"); }
+
+ static QString protocolName() { return QLatin1String("Pastebin.Ca"); }
+ QString name() const { return protocolName(); }
virtual bool hasSettings() const { return false; }
virtual unsigned capabilities() const;
diff --git a/src/plugins/cpaster/pastebindotcomprotocol.cpp b/src/plugins/cpaster/pastebindotcomprotocol.cpp
index 4cbba323b7..dade4e201b 100644
--- a/src/plugins/cpaster/pastebindotcomprotocol.cpp
+++ b/src/plugins/cpaster/pastebindotcomprotocol.cpp
@@ -133,7 +133,7 @@ void PasteBinDotComProtocol::pasteFinished()
if (m_pasteReply->error()) {
qWarning("Pastebin.com protocol error: %s", qPrintable(m_pasteReply->errorString()));
} else {
- emit pasteDone(QString::fromAscii(m_pasteReply->readAll()));
+ emit pasteDone(QString::fromLatin1(m_pasteReply->readAll()));
}
m_pasteReply->deleteLater();
@@ -170,7 +170,7 @@ void PasteBinDotComProtocol::fetchFinished()
qDebug() << "fetchFinished: error" << m_fetchId << content;
} else {
title = QString::fromLatin1("Pastebin.com: %1").arg(m_fetchId);
- content = QString::fromAscii(m_fetchReply->readAll());
+ content = QString::fromLatin1(m_fetchReply->readAll());
// Cut out from '<pre>' formatting
const int preEnd = content.lastIndexOf(QLatin1String("</pre>"));
if (preEnd != -1)
diff --git a/src/plugins/cpaster/pasteselectdialog.cpp b/src/plugins/cpaster/pasteselectdialog.cpp
index 13c9488c6a..d6774d71b3 100644
--- a/src/plugins/cpaster/pasteselectdialog.cpp
+++ b/src/plugins/cpaster/pasteselectdialog.cpp
@@ -30,6 +30,7 @@
#include "pasteselectdialog.h"
#include "protocol.h"
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QDebug>
@@ -55,9 +56,8 @@ PasteSelectDialog::PasteSelectDialog(const QList<Protocol*> &protocols,
connect(m_refreshButton, SIGNAL(clicked()), this, SLOT(list()));
m_ui.listWidget->setSelectionMode(QAbstractItemView::SingleSelection);
-#ifndef Q_OS_MACX
- m_ui.listWidget->setFrameStyle(QFrame::NoFrame);
-#endif // Q_OS_MACX
+ if (!Utils::HostOsInfo::isMacHost())
+ m_ui.listWidget->setFrameStyle(QFrame::NoFrame);
// Proportional formatting of columns for CodePaster
QFont listFont = m_ui.listWidget->font();
listFont.setFamily(QLatin1String("Courier"));
diff --git a/src/plugins/cpaster/settings.cpp b/src/plugins/cpaster/settings.cpp
index 19f5ec8006..8279a08247 100644
--- a/src/plugins/cpaster/settings.cpp
+++ b/src/plugins/cpaster/settings.cpp
@@ -30,6 +30,8 @@
#include "settings.h"
#include "pastebindotcomprotocol.h"
+#include <utils/environment.h>
+
#include <QVariant>
#include <QSettings>
@@ -64,11 +66,7 @@ void Settings::toSettings(QSettings *settings) const
void Settings::fromSettings(const QSettings *settings)
{
const QString rootKey = QLatin1String(groupC) + QLatin1Char('/');
-#ifdef Q_OS_WIN
- const QString defaultUser = QString::fromLocal8Bit(qgetenv("USERNAME"));
-#else
- const QString defaultUser = QString::fromLocal8Bit(qgetenv("USER"));
-#endif
+ const QString defaultUser = Utils::Environment::systemEnvironment().userName();
username = settings->value(rootKey + QLatin1String(userNameKeyC), defaultUser).toString();
protocol = settings->value(rootKey + QLatin1String(defaultProtocolKeyC), PasteBinDotComProtocol::protocolName()).toString();
copyToClipboard = settings->value(rootKey + QLatin1String(copyToClipboardKeyC), true).toBool();
diff --git a/src/plugins/cppeditor/cppeditor.qbs b/src/plugins/cppeditor/cppeditor.qbs
index 8b9295c940..8cd892a574 100644
--- a/src/plugins/cppeditor/cppeditor.qbs
+++ b/src/plugins/cppeditor/cppeditor.qbs
@@ -12,16 +12,11 @@ QtcPlugin {
Depends { name: "TextEditor" }
Depends { name: "ProjectExplorer" }
Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- "../../libs/3rdparty",
- buildDirectory
- ]
+
+ cpp.includePaths: base.concat("../../libs/3rdparty")
files: [
"CppEditor.mimetypes.xml",
- "cppeditor.qrc",
"cppautocompleter.cpp",
"cppautocompleter.h",
"cppclasswizard.cpp",
@@ -30,6 +25,7 @@ QtcPlugin {
"cppcompleteswitch.h",
"cppeditor.cpp",
"cppeditor.h",
+ "cppeditor.qrc",
"cppeditor_global.h",
"cppeditorconstants.h",
"cppeditorenums.h",
@@ -59,7 +55,6 @@ QtcPlugin {
"cppsnippetprovider.cpp",
"cppsnippetprovider.h",
"cpptypehierarchy.cpp",
- "cpptypehierarchy.h"
+ "cpptypehierarchy.h",
]
}
-
diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
index 326cb9b812..979706d6f5 100644
--- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
+++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp
@@ -573,7 +573,7 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
QString newDeclText = linkSelection.selectedText();
for (int i = 0; i < newDeclText.size(); ++i) {
- if (newDeclText.at(i).toAscii() == 0)
+ if (newDeclText.at(i).toLatin1() == 0)
newDeclText[i] = QLatin1Char('\n');
}
newDeclText.append(QLatin1String("{}"));
diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp
index 520c398550..1baa798981 100644
--- a/src/plugins/cppeditor/cpphighlighter.cpp
+++ b/src/plugins/cppeditor/cpphighlighter.cpp
@@ -28,10 +28,11 @@
****************************************************************************/
#include "cpphighlighter.h"
-#include <cpptools/cppdoxygen.h>
#include <Token.h>
#include <cplusplus/SimpleLexer.h>
+#include <cplusplus/Lexer.h>
+#include <cpptools/cppdoxygen.h>
#include <cpptools/cpptoolsreuse.h>
#include <texteditor/basetextdocumentlayout.h>
@@ -78,10 +79,12 @@ void CppHighlighter::highlightBlock(const QString &text)
setCurrentBlockState(previousState);
BaseTextDocumentLayout::clearParentheses(currentBlock());
if (text.length()) {// the empty line can still contain whitespace
- if (!initialState)
- setFormat(0, text.length(), m_formats[CppVisualWhitespace]);
+ if (initialState == Lexer::State_MultiLineComment)
+ highlightLine(text, 0, text.length(), m_formats[CppCommentFormat]);
+ else if (initialState == Lexer::State_MultiLineDoxyComment)
+ highlightLine(text, 0, text.length(), m_formats[CppDoxygenCommentFormat]);
else
- setFormat(0, text.length(), m_formats[CppCommentFormat]);
+ setFormat(0, text.length(), m_formats[CppVisualWhitespace]);
}
BaseTextDocumentLayout::setFoldingIndent(currentBlock(), foldingIndent);
return;
@@ -105,12 +108,8 @@ void CppHighlighter::highlightBlock(const QString &text)
tokens.at(i - 1).length();
}
- if (previousTokenEnd != tk.begin()) {
- if (initialState && tk.isComment())
- setFormat(previousTokenEnd, tk.begin() - previousTokenEnd, m_formats[CppCommentFormat]);
- else
- setFormat(previousTokenEnd, tk.begin() - previousTokenEnd, m_formats[CppVisualWhitespace]);
- }
+ if (previousTokenEnd != tk.begin())
+ setFormat(previousTokenEnd, tk.begin() - previousTokenEnd, m_formats[CppVisualWhitespace]);
if (tk.is(T_LPAREN) || tk.is(T_LBRACE) || tk.is(T_LBRACKET)) {
const QChar c = text.at(tk.begin());
@@ -165,14 +164,15 @@ void CppHighlighter::highlightBlock(const QString &text)
setFormat(tk.begin(), tk.length(), m_formats[CppNumberFormat]);
else if (tk.isStringLiteral() || tk.isCharLiteral())
- setFormat(tk.begin(), tk.length(), m_formats[CppStringFormat]);
+ highlightLine(text, tk.begin(), tk.length(), m_formats[CppStringFormat]);
else if (tk.isComment()) {
+ const int startPosition = initialState ? previousTokenEnd : tk.begin();
if (tk.is(T_COMMENT) || tk.is(T_CPP_COMMENT))
- setFormat(tk.begin(), tk.length(), m_formats[CppCommentFormat]);
+ highlightLine(text, startPosition, tk.end() - startPosition, m_formats[CppCommentFormat]);
else // a doxygen comment
- highlightDoxygenComment(text, tk.begin(), tk.length());
+ highlightDoxygenComment(text, startPosition, tk.end() - startPosition);
// we need to insert a close comment parenthesis, if
// - the line starts in a C Comment (initalState != 0)
@@ -207,12 +207,9 @@ void CppHighlighter::highlightBlock(const QString &text)
}
// mark the trailing white spaces
- {
- const Token tk = tokens.last();
- const int lastTokenEnd = tk.begin() + tk.length();
- if (text.length() > lastTokenEnd)
- highlightLine(text, lastTokenEnd, text.length() - lastTokenEnd, QTextCharFormat());
- }
+ const int lastTokenEnd = tokens.last().end();
+ if (text.length() > lastTokenEnd)
+ highlightLine(text, lastTokenEnd, text.length() - lastTokenEnd, m_formats[CppVisualWhitespace]);
if (! initialState && state && ! tokens.isEmpty()) {
parentheses.append(Parenthesis(Parenthesis::Opened, QLatin1Char('+'),
@@ -334,7 +331,8 @@ bool CppHighlighter::isPPKeyword(const QStringRef &text) const
void CppHighlighter::highlightLine(const QString &text, int position, int length,
const QTextCharFormat &format)
{
- const QTextCharFormat visualSpaceFormat = m_formats[CppVisualWhitespace];
+ QTextCharFormat visualSpaceFormat = m_formats[CppVisualWhitespace];
+ visualSpaceFormat.setBackground(format.background());
const int end = position + length;
int index = position;
diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp
index 268e8980e7..8ad818b21d 100644
--- a/src/plugins/cppeditor/cppplugin.cpp
+++ b/src/plugins/cppeditor/cppplugin.cpp
@@ -54,6 +54,7 @@
#include <texteditor/texteditorplugin.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/texteditorconstants.h>
+#include <utils/hostosinfo.h>
#include <cpptools/ModelManagerInterface.h>
#include <cpptools/cpptoolsconstants.h>
#include <cpptools/cpptoolssettings.h>
@@ -83,16 +84,16 @@ CppEditorFactory::CppEditorFactory(CppPlugin *owner) :
<< QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE)
<< QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE);
-#if !defined(Q_OS_MAC) && !defined(Q_WS_WIN)
- Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
- Core::MimeDatabase *mimeDatabase = Core::ICore::mimeDatabase();
- iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_cpp.png")),
- mimeDatabase->findByType(QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE)));
- iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_c.png")),
- mimeDatabase->findByType(QLatin1String(CppEditor::Constants::C_SOURCE_MIMETYPE)));
- iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_h.png")),
- mimeDatabase->findByType(QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE)));
-#endif
+ if (!Utils::HostOsInfo::isMacHost() && !Utils::HostOsInfo::isWindowsHost()) {
+ Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
+ Core::MimeDatabase *mimeDatabase = Core::ICore::mimeDatabase();
+ iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_cpp.png")),
+ mimeDatabase->findByType(QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE)));
+ iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_c.png")),
+ mimeDatabase->findByType(QLatin1String(CppEditor::Constants::C_SOURCE_MIMETYPE)));
+ iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_h.png")),
+ mimeDatabase->findByType(QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE)));
+ }
}
Core::Id CppEditorFactory::id() const
diff --git a/src/plugins/cpptools/ModelManagerInterface.h b/src/plugins/cpptools/ModelManagerInterface.h
index d3761a0276..cbbf5ca833 100644
--- a/src/plugins/cpptools/ModelManagerInterface.h
+++ b/src/plugins/cpptools/ModelManagerInterface.h
@@ -106,7 +106,7 @@ public:
ProjectInfo()
{ }
- ProjectInfo(QWeakPointer<ProjectExplorer::Project> project)
+ ProjectInfo(QPointer<ProjectExplorer::Project> project)
: m_project(project)
{ }
@@ -119,7 +119,7 @@ public:
bool isNull() const
{ return m_project.isNull(); }
- QWeakPointer<ProjectExplorer::Project> project() const
+ QPointer<ProjectExplorer::Project> project() const
{ return m_project; }
const QList<ProjectPart::Ptr> projectParts() const
@@ -141,7 +141,7 @@ public:
{ return m_defines; }
private: // attributes
- QWeakPointer<ProjectExplorer::Project> m_project;
+ QPointer<ProjectExplorer::Project> m_project;
QList<ProjectPart::Ptr> m_projectParts;
// the attributes below are calculated from the project parts.
QStringList m_includePaths;
diff --git a/src/plugins/cpptools/cppchecksymbols.cpp b/src/plugins/cpptools/cppchecksymbols.cpp
index dcd1358b94..e9679394ce 100644
--- a/src/plugins/cpptools/cppchecksymbols.cpp
+++ b/src/plugins/cpptools/cppchecksymbols.cpp
@@ -662,13 +662,14 @@ bool CheckSymbols::visit(NewExpressionAST *ast)
if (binding && nameAST) {
int arguments = 0;
if (ast->new_initializer) {
- if (ExpressionAST *expr = ast->new_initializer->expression) {
- while (BinaryExpressionAST *binExpr = expr->asBinaryExpression()) {
- expr = binExpr->right_expression;
- ++arguments;
- }
+ ExpressionListAST *list = 0;
+ if (ExpressionListParenAST *exprListParen = ast->new_initializer->asExpressionListParen()) {
+ list = exprListParen->expression_list;
+ } else if (BracedInitializerAST *braceInit = ast->new_initializer->asBracedInitializer()) {
+ list = braceInit->expression_list;
}
-
+ for (ExpressionListAST *it = list; it; it = it->next)
+ ++arguments;
}
Scope *scope = enclosingScope();
@@ -923,10 +924,17 @@ bool CheckSymbols::visit(MemInitializerAST *ast)
} else if (maybeField(nameAST->name)) {
maybeAddField(_context.lookup(nameAST->name, klass), nameAST);
} else {
- // It's a constructor
+ // It's a constructor, count the number of arguments
unsigned arguments = 0;
- for (ExpressionListAST *it = ast->expression_list; it; it = it->next)
- ++arguments;
+ if (ast->expression) {
+ ExpressionListAST *expr_list = 0;
+ if (ExpressionListParenAST *parenExprList = ast->expression->asExpressionListParen())
+ expr_list = parenExprList->expression_list;
+ else if (BracedInitializerAST *bracedInitList = ast->expression->asBracedInitializer())
+ expr_list = bracedInitList->expression_list;
+ for (ExpressionListAST *it = expr_list; it; it = it->next)
+ ++arguments;
+ }
maybeAddFunction(_context.lookup(nameAST->name, klass), nameAST, arguments);
}
@@ -936,7 +944,7 @@ bool CheckSymbols::visit(MemInitializerAST *ast)
}
}
- accept(ast->expression_list);
+ accept(ast->expression);
}
return false;
diff --git a/src/plugins/cpptools/cppclassesfilter.h b/src/plugins/cpptools/cppclassesfilter.h
index c01ce15734..95b66be69f 100644
--- a/src/plugins/cpptools/cppclassesfilter.h
+++ b/src/plugins/cpptools/cppclassesfilter.h
@@ -43,7 +43,7 @@ public:
CppClassesFilter(Internal::CppModelManager *manager);
~CppClassesFilter();
- QString displayName() const { return tr("Classes"); }
+ QString displayName() const { return tr("C++ Classes"); }
QString id() const { return QLatin1String("Classes"); }
Priority priority() const { return Medium; }
};
diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp
index 2701d9b806..ecd6aa3ab3 100644
--- a/src/plugins/cpptools/cppcodeformatter.cpp
+++ b/src/plugins/cpptools/cppcodeformatter.cpp
@@ -299,6 +299,13 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
default: tryExpression(); break;
} break;
+ case braceinit_open:
+ switch (kind) {
+ case T_RBRACE: leave(); break;
+ case T_RPAREN: leave(); continue; // recover?
+ default: tryExpression(); break;
+ } break;
+
case ternary_op:
switch (kind) {
case T_RPAREN:
@@ -339,14 +346,16 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
case member_init:
switch (kind) {
- case T_LPAREN: enter(member_init_paren_open); break;
- case T_RPAREN: leave(); break;
case T_LBRACE:
+ case T_LPAREN: enter(member_init_nest_open); break;
+ case T_RBRACE:
+ case T_RPAREN: leave(); break;
case T_SEMICOLON: leave(); continue; // try to recover
} break;
- case member_init_paren_open:
+ case member_init_nest_open:
switch (kind) {
+ case T_RBRACE:
case T_RPAREN: leave(); continue;
case T_SEMICOLON: leave(); continue; // try to recover
default: tryExpression(); break;
@@ -764,6 +773,7 @@ bool CodeFormatter::tryExpression(bool alsoExpression)
switch (kind) {
case T_LPAREN: newState = arglist_open; break;
case T_QUESTION: newState = ternary_op; break;
+ case T_LBRACE: newState = braceinit_open; break;
case T_EQUAL:
case T_AMPER_EQUAL:
@@ -1234,7 +1244,7 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd
case arglist_open:
case condition_paren_open:
- case member_init_paren_open:
+ case member_init_nest_open:
if (!lastToken)
*paddingDepth = nextTokenPosition-*indentDepth;
else
diff --git a/src/plugins/cpptools/cppcodeformatter.h b/src/plugins/cpptools/cppcodeformatter.h
index 52e148420f..4e9e40e563 100644
--- a/src/plugins/cpptools/cppcodeformatter.h
+++ b/src/plugins/cpptools/cppcodeformatter.h
@@ -123,7 +123,7 @@ public: // must be public to make Q_GADGET introspection work
member_init_open, // After ':' that starts a member initialization list.
member_init_expected, // At the start and after every ',' in member_init_open
member_init, // After an identifier in member_init_expected
- member_init_paren_open, // After '(' in member_init.
+ member_init_nest_open, // After '(' or '{' in member_init.
enum_start, // After 'enum'
enum_open, // Brace that opens a enum declaration.
@@ -167,6 +167,7 @@ public: // must be public to make Q_GADGET introspection work
stream_op, // After a '<<' or '>>' in a context where it's likely a stream operator.
stream_op_cont, // When finding another stream operator in stream_op
ternary_op, // The ? : operator
+ braceinit_open, // after '{' in an expression context
condition_open, // Start of a condition in 'if', 'while', entered after opening paren
condition_paren_open, // After an lparen in a condition
diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.h b/src/plugins/cpptools/cppcurrentdocumentfilter.h
index d59b298074..6e87ac265a 100644
--- a/src/plugins/cpptools/cppcurrentdocumentfilter.h
+++ b/src/plugins/cpptools/cppcurrentdocumentfilter.h
@@ -50,7 +50,7 @@ public:
CppCurrentDocumentFilter(CppModelManager *manager, Core::EditorManager *editorManager);
~CppCurrentDocumentFilter() {}
- QString displayName() const { return tr("Methods in Current Document"); }
+ QString displayName() const { return tr("C++ Methods in Current Document"); }
QString id() const { return QLatin1String("Methods in current Document"); }
Priority priority() const { return Medium; }
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
diff --git a/src/plugins/cpptools/cppfilesettingspage.cpp b/src/plugins/cpptools/cppfilesettingspage.cpp
index da434d2d17..66213189ca 100644
--- a/src/plugins/cpptools/cppfilesettingspage.cpp
+++ b/src/plugins/cpptools/cppfilesettingspage.cpp
@@ -38,6 +38,7 @@
#include <extensionsystem/pluginmanager.h>
+#include <utils/environment.h>
#include <utils/fileutils.h>
#include <QSettings>
@@ -149,11 +150,7 @@ static bool keyWordReplacement(const QString &keyWord,
return true;
}
if (keyWord == QLatin1String("%USER%")) {
-#ifdef Q_OS_WIN
- *value = QString::fromLocal8Bit(qgetenv("USERNAME"));
-#else
- *value = QString::fromLocal8Bit(qgetenv("USER"));
-#endif
+ *value = Utils::Environment::systemEnvironment().userName();
return true;
}
// Environment variables (for example '%$EMAIL%').
diff --git a/src/plugins/cpptools/cppfunctionsfilter.h b/src/plugins/cpptools/cppfunctionsfilter.h
index 8f91d2b364..4d04edcf22 100644
--- a/src/plugins/cpptools/cppfunctionsfilter.h
+++ b/src/plugins/cpptools/cppfunctionsfilter.h
@@ -30,7 +30,7 @@
#ifndef CPPFUNCTIONSFILTER_H
#define CPPFUNCTIONSFILTER_H
-#include <cpplocatorfilter.h>
+#include "cpplocatorfilter.h"
namespace CppTools {
namespace Internal {
@@ -43,7 +43,7 @@ public:
CppFunctionsFilter(CppModelManager *manager);
~CppFunctionsFilter();
- QString displayName() const { return tr("Methods and Functions"); }
+ QString displayName() const { return tr("C++ Methods and Functions"); }
QString id() const { return QLatin1String("Methods"); }
Priority priority() const { return Medium; }
};
diff --git a/src/plugins/cpptools/cpplocatorfilter.cpp b/src/plugins/cpptools/cpplocatorfilter.cpp
index 8d8b7e92ac..f86ceaa684 100644
--- a/src/plugins/cpptools/cpplocatorfilter.cpp
+++ b/src/plugins/cpptools/cpplocatorfilter.cpp
@@ -32,10 +32,12 @@
#include <texteditor/itexteditor.h>
#include <texteditor/basetexteditor.h>
+#include <utils/fileutils.h>
#include <QStringMatcher>
using namespace CppTools::Internal;
+using namespace Utils;
CppLocatorFilter::CppLocatorFilter(CppModelManager *manager)
: m_manager(manager),
@@ -102,10 +104,12 @@ QList<Locator::FilterEntry> CppLocatorFilter::matchesFor(QFutureInterface<Locato
QVariant id = qVariantFromValue(info);
Locator::FilterEntry filterEntry(this, info.symbolName, id, info.icon);
- if (! info.symbolType.isEmpty())
+ if (! info.symbolType.isEmpty()) {
filterEntry.extraInfo = info.symbolType;
- else
- filterEntry.extraInfo = info.fileName;
+ } else {
+ filterEntry.extraInfo = FileUtils::shortNativePath(
+ FileName::fromString(info.fileName));
+ }
if (info.symbolName.startsWith(entry))
betterEntries.append(filterEntry);
diff --git a/src/plugins/cpptools/cpplocatorfilter.h b/src/plugins/cpptools/cpplocatorfilter.h
index f6e83e2488..ff7a8ae8c3 100644
--- a/src/plugins/cpptools/cpplocatorfilter.h
+++ b/src/plugins/cpptools/cpplocatorfilter.h
@@ -45,7 +45,7 @@ public:
CppLocatorFilter(CppModelManager *manager);
~CppLocatorFilter();
- QString displayName() const { return tr("Classes and Methods"); }
+ QString displayName() const { return tr("C++ Classes and Methods"); }
QString id() const { return QLatin1String("Classes and Methods"); }
Priority priority() const { return Medium; }
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index d8b5eb762d..f6d7cde4a2 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -35,32 +35,27 @@
#include "cpphighlightingsupport.h"
#include "cpphighlightingsupportinternal.h"
#include "abstracteditorsupport.h"
-#ifndef ICHECK_BUILD
-# include "cpptoolsconstants.h"
-# include "cpptoolseditorsupport.h"
-# include "cppfindreferences.h"
-#endif
+#include "cpptoolsconstants.h"
+#include "cpptoolseditorsupport.h"
+#include "cppfindreferences.h"
#include <functional>
#include <QtConcurrentRun>
-#ifndef ICHECK_BUILD
-# include <QFutureSynchronizer>
-# include <utils/runextensions.h>
-# include <texteditor/itexteditor.h>
-# include <texteditor/basetexteditor.h>
-# include <projectexplorer/project.h>
-# include <projectexplorer/projectexplorer.h>
-# include <projectexplorer/projectexplorerconstants.h>
-# include <projectexplorer/session.h>
-# include <coreplugin/icore.h>
-# include <coreplugin/mimedatabase.h>
-# include <coreplugin/editormanager/editormanager.h>
-# include <coreplugin/progressmanager/progressmanager.h>
-# include <extensionsystem/pluginmanager.h>
-#else
-# include <QDir>
-#endif
-
+#include <QFutureSynchronizer>
+#include <utils/runextensions.h>
+#include <texteditor/itexteditor.h>
+#include <texteditor/basetexteditor.h>
+#include <projectexplorer/project.h>
+#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/session.h>
+#include <coreplugin/icore.h>
+#include <coreplugin/mimedatabase.h>
+#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/progressmanager/progressmanager.h>
+#include <extensionsystem/pluginmanager.h>
+
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <TranslationUnit.h>
@@ -197,7 +192,6 @@ static const char pp_configuration[] =
"#define __inline inline\n"
"#define __forceinline inline\n";
-#ifndef ICHECK_BUILD
CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager, bool dumpFileNameWhileParsing)
: snapshot(modelManager->snapshot()),
m_modelManager(modelManager),
@@ -208,16 +202,6 @@ CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager, bool du
preprocess.setKeepComments(true);
}
-#else
-
-CppPreprocessor::CppPreprocessor(QPointer<CPlusPlus::ParseManager> modelManager)
- : preprocess(this, &env),
- m_dumpFileNameWhileParsing(false),
- m_revision(0)
-{
-}
-#endif
-
CppPreprocessor::~CppPreprocessor()
{ }
@@ -234,23 +218,23 @@ void CppPreprocessor::setIncludePaths(const QStringList &includePaths)
for (int i = 0; i < includePaths.size(); ++i) {
const QString &path = includePaths.at(i);
-#ifdef Q_OS_DARWIN
- if (i + 1 < includePaths.size() && path.endsWith(QLatin1String(".framework/Headers"))) {
- const QFileInfo pathInfo(path);
- const QFileInfo frameworkFileInfo(pathInfo.path());
- const QString frameworkName = frameworkFileInfo.baseName();
-
- const QFileInfo nextIncludePath = includePaths.at(i + 1);
- if (nextIncludePath.fileName() == frameworkName) {
- // We got a QtXXX.framework/Headers followed by $QTDIR/include/QtXXX.
- // In this case we prefer to include files from $QTDIR/include/QtXXX.
- continue;
+ if (Utils::HostOsInfo::isMacHost()) {
+ if (i + 1 < includePaths.size() && path.endsWith(QLatin1String(".framework/Headers"))) {
+ const QFileInfo pathInfo(path);
+ const QFileInfo frameworkFileInfo(pathInfo.path());
+ const QString frameworkName = frameworkFileInfo.baseName();
+
+ const QFileInfo nextIncludePath = includePaths.at(i + 1);
+ if (nextIncludePath.fileName() == frameworkName) {
+ // We got a QtXXX.framework/Headers followed by $QTDIR/include/QtXXX.
+ // In this case we prefer to include files from $QTDIR/include/QtXXX.
+ continue;
+ }
}
+ m_includePaths.append(path);
+ } else {
+ m_includePaths.append(path);
}
- m_includePaths.append(path);
-#else
- m_includePaths.append(path);
-#endif
}
}
@@ -297,7 +281,6 @@ void CppPreprocessor::setProjectFiles(const QStringList &files)
void CppPreprocessor::setTodo(const QStringList &files)
{ m_todo = QSet<QString>::fromList(files); }
-#ifndef ICHECK_BUILD
namespace {
class Process: public std::unary_function<Document::Ptr, void>
{
@@ -332,7 +315,6 @@ public:
}
};
} // end of anonymous namespace
-#endif
void CppPreprocessor::run(const QString &fileName)
{
@@ -637,21 +619,11 @@ void CppPreprocessor::sourceNeeded(unsigned line, QString &fileName, IncludeType
snapshot.insert(doc);
m_todo.remove(fileName);
-#ifndef ICHECK_BUILD
Process process(m_modelManager, doc, snapshot, m_workingCopy);
process();
(void) switchDocument(previousDoc);
-#else
- doc->releaseSource();
- Document::CheckMode mode = Document::FastCheck;
- mode = Document::FullCheck;
- doc->parse();
- doc->check(mode);
-
- (void) switchDocument(previousDoc);
-#endif
}
Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc)
@@ -661,7 +633,6 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc)
return previousDoc;
}
-#ifndef ICHECK_BUILD
void CppModelManager::updateModifiedSourceFiles()
{
const Snapshot snapshot = this->snapshot();
@@ -1435,6 +1406,3 @@ QList<Document::DiagnosticMessage> CppModelManager::extraDiagnostics(const QStri
}
return m_extraDiagnostics.value(fileName).value(kind);
}
-
-#endif
-
diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h
index 85ecbe3220..3a66aabdab 100644
--- a/src/plugins/cpptools/cppmodelmanager.h
+++ b/src/plugins/cpptools/cppmodelmanager.h
@@ -33,26 +33,19 @@
#include "cpptools_global.h"
#include "cpptoolsconstants.h"
#include "ModelManagerInterface.h"
-#ifndef ICHECK_BUILD
-# include <projectexplorer/project.h>
-#endif
+#include <projectexplorer/project.h>
#include <cplusplus/CppDocument.h>
#include <cplusplus/PreprocessorClient.h>
-#ifndef ICHECK_BUILD
-# include <texteditor/basetexteditor.h>
-#endif
+#include <texteditor/basetexteditor.h>
#include <cplusplus/PreprocessorEnvironment.h>
#include <cplusplus/pp-engine.h>
-#ifdef ICHECK_BUILD
-# include "parsemanager.h"
-#else
-# include <QHash>
-# include <QFutureInterface>
-# include <QFutureSynchronizer>
-# include <QMutex>
-# include <QTimer>
-# include <QTextEdit> // for QTextEdit::ExtraSelection
-#endif
+
+#include <QHash>
+#include <QFutureInterface>
+#include <QFutureSynchronizer>
+#include <QMutex>
+#include <QTimer>
+#include <QTextEdit> // for QTextEdit::ExtraSelection
namespace Core {
class IEditor;
@@ -82,7 +75,6 @@ class CppEditorSupport;
class CppPreprocessor;
class CppFindReferences;
-#ifndef ICHECK_BUILD
class CPPTOOLS_EXPORT CppModelManager : public CPlusPlus::CppModelManagerInterface
{
Q_OBJECT
@@ -254,16 +246,11 @@ private:
CppHighlightingSupportFactory *m_highlightingFactory;
CppHighlightingSupportFactory *m_highlightingFallback;
};
-#endif
class CPPTOOLS_EXPORT CppPreprocessor: public CPlusPlus::Client
{
public:
-#ifndef ICHECK_BUILD
CppPreprocessor(QPointer<CppModelManager> modelManager, bool dumpFileNameWhileParsing = false);
-#else
- CppPreprocessor(QPointer<CPlusPlus::ParseManager> modelManager);
-#endif
virtual ~CppPreprocessor();
void setRevision(unsigned revision);
@@ -312,9 +299,7 @@ protected:
virtual void sourceNeeded(unsigned line, QString &fileName, IncludeType type);
private:
-#ifndef ICHECK_BUILD
QPointer<CppModelManager> m_modelManager;
-#endif
bool m_dumpFileNameWhileParsing;
CPlusPlus::Environment env;
CPlusPlus::Preprocessor preprocess;
diff --git a/src/plugins/cpptools/cpptools.qbs b/src/plugins/cpptools/cpptools.qbs
index 709f1edecb..3a2ba29005 100644
--- a/src/plugins/cpptools/cpptools.qbs
+++ b/src/plugins/cpptools/cpptools.qbs
@@ -1,6 +1,7 @@
import qbs.base 1.0
import "../QtcPlugin.qbs" as QtcPlugin
+import "../../../qbs/defaults.js" as Defaults
QtcPlugin {
name: "CppTools"
@@ -16,14 +17,12 @@ QtcPlugin {
Depends { name: "cpp" }
cpp.defines: base.concat(["QT_NO_CAST_TO_ASCII"])
- cpp.includePaths: [
- ".",
- "..",
- "../../libs",
- buildDirectory
- ]
files: [
+ "ModelManagerInterface.cpp",
+ "ModelManagerInterface.h",
+ "TypeHierarchyBuilder.cpp",
+ "TypeHierarchyBuilder.h",
"abstracteditorsupport.cpp",
"abstracteditorsupport.h",
"commentssettings.cpp",
@@ -31,6 +30,8 @@ QtcPlugin {
"completionsettingspage.cpp",
"completionsettingspage.h",
"completionsettingspage.ui",
+ "cppchecksymbols.cpp",
+ "cppchecksymbols.h",
"cppclassesfilter.cpp",
"cppclassesfilter.h",
"cppcodeformatter.cpp",
@@ -38,6 +39,7 @@ QtcPlugin {
"cppcodestylepreferences.cpp",
"cppcodestylepreferences.h",
"cppcodestylepreferencesfactory.cpp",
+ "cppcodestylepreferencesfactory.h",
"cppcodestylesettings.cpp",
"cppcodestylesettings.h",
"cppcodestylesettingspage.cpp",
@@ -45,12 +47,14 @@ QtcPlugin {
"cppcodestylesettingspage.ui",
"cppcompletionassist.cpp",
"cppcompletionassist.h",
+ "cppcompletionassistprovider.cpp",
+ "cppcompletionassistprovider.h",
+ "cppcompletionsupport.cpp",
+ "cppcompletionsupport.h",
"cppcurrentdocumentfilter.cpp",
"cppcurrentdocumentfilter.h",
"cppdoxygen.cpp",
"cppdoxygen.h",
- "cppcompletionsupport.cpp",
- "cppcompletionsupport.h",
"cppfilesettingspage.cpp",
"cppfilesettingspage.h",
"cppfilesettingspage.ui",
@@ -58,10 +62,12 @@ QtcPlugin {
"cppfindreferences.h",
"cppfunctionsfilter.cpp",
"cppfunctionsfilter.h",
- "cpphighlightingsupportinternal.cpp",
- "cpphighlightingsupportinternal.h",
"cpphighlightingsupport.cpp",
"cpphighlightingsupport.h",
+ "cpphighlightingsupportinternal.cpp",
+ "cpphighlightingsupportinternal.h",
+ "cpplocalsymbols.cpp",
+ "cpplocalsymbols.h",
"cpplocatorfilter.cpp",
"cpplocatorfilter.h",
"cppmodelmanager.cpp",
@@ -72,10 +78,6 @@ QtcPlugin {
"cpprefactoringchanges.h",
"cppsemanticinfo.cpp",
"cppsemanticinfo.h",
- "cppchecksymbols.cpp",
- "cppchecksymbols.h",
- "cpplocalsymbols.cpp",
- "cpplocalsymbols.h",
"cpptools_global.h",
"cpptoolsconstants.h",
"cpptoolseditorsupport.cpp",
@@ -98,17 +100,14 @@ QtcPlugin {
"symbolsfindfilter.h",
"uicodecompletionsupport.cpp",
"uicodecompletionsupport.h",
- "cppcompletionassistprovider.cpp",
- "cppcompletionassistprovider.h",
- "cppcodestylepreferencesfactory.h",
- "ModelManagerInterface.cpp",
- "ModelManagerInterface.h",
- "TypeHierarchyBuilder.cpp",
- "TypeHierarchyBuilder.h"
]
+ Group {
+ condition: Defaults.testsEnabled(qbs)
+ files: ["cppcodegen_test.cpp", "cppcompletion_test.cpp"]
+ }
+
ProductModule {
Depends { name: "CPlusPlus" }
}
}
-
diff --git a/src/plugins/cvs/cvs.qbs b/src/plugins/cvs/cvs.qbs
index f45ca0a576..d89725f59d 100644
--- a/src/plugins/cvs/cvs.qbs
+++ b/src/plugins/cvs/cvs.qbs
@@ -12,36 +12,29 @@ QtcPlugin {
Depends { name: "VcsBase" }
Depends { name: "Locator" }
- Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
-
files: [
+ "annotationhighlighter.cpp",
"annotationhighlighter.h",
- "cvsplugin.h",
- "cvscontrol.h",
- "settingspage.h",
- "cvseditor.h",
- "cvssubmiteditor.h",
- "cvssettings.h",
- "cvsutils.h",
- "cvsconstants.h",
+ "checkoutwizard.cpp",
"checkoutwizard.h",
+ "checkoutwizardpage.cpp",
"checkoutwizardpage.h",
- "annotationhighlighter.cpp",
- "cvsplugin.cpp",
+ "cvs.qrc",
+ "cvsconstants.h",
"cvscontrol.cpp",
- "settingspage.cpp",
+ "cvscontrol.h",
"cvseditor.cpp",
- "cvssubmiteditor.cpp",
+ "cvseditor.h",
+ "cvsplugin.cpp",
+ "cvsplugin.h",
"cvssettings.cpp",
+ "cvssettings.h",
+ "cvssubmiteditor.cpp",
+ "cvssubmiteditor.h",
"cvsutils.cpp",
- "checkoutwizard.cpp",
- "checkoutwizardpage.cpp",
+ "cvsutils.h",
+ "settingspage.cpp",
+ "settingspage.h",
"settingspage.ui",
- "cvs.qrc"
]
}
diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp
index 3edb843d0d..059f51e3a6 100644
--- a/src/plugins/cvs/cvsplugin.cpp
+++ b/src/plugins/cvs/cvsplugin.cpp
@@ -147,7 +147,7 @@ static inline const VcsBaseEditorParameters *findType(int ie)
static inline QString debugCodec(const QTextCodec *c)
{
- return c ? QString::fromAscii(c->name()) : QString::fromAscii("Null codec");
+ return c ? QString::fromLatin1(c->name()) : QString::fromLatin1("Null codec");
}
static inline bool messageBoxQuestion(const QString &title, const QString &question, QWidget *parent = 0)
diff --git a/src/plugins/cvs/cvssettings.cpp b/src/plugins/cvs/cvssettings.cpp
index f247969120..2b7b7a72e3 100644
--- a/src/plugins/cvs/cvssettings.cpp
+++ b/src/plugins/cvs/cvssettings.cpp
@@ -30,6 +30,7 @@
#include "cvssettings.h"
#include <utils/environment.h>
+#include <utils/hostosinfo.h>
#include <QSettings>
#include <QTextStream>
@@ -47,12 +48,7 @@ enum { defaultTimeOutS = 30 };
static QString defaultCommand()
{
- QString rc;
- rc = QLatin1String("cvs");
-#if defined(Q_OS_WIN32)
- rc.append(QLatin1String(".exe"));
-#endif
- return rc;
+ return QLatin1String("cvs" QTC_HOST_EXE_SUFFIX);
}
namespace Cvs {
diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index fb2af54748..2c1327d02f 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -37,6 +37,7 @@
#include "debuggerstringutils.h"
#include "stackframe.h"
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#if USE_BREAK_MODEL_TEST
@@ -180,11 +181,9 @@ QIcon BreakHandler::emptyIcon()
static inline bool fileNameMatch(const QString &f1, const QString &f2)
{
-#ifdef Q_OS_WIN
- return f1.compare(f2, Qt::CaseInsensitive) == 0;
-#else
+ if (Utils::HostOsInfo::isWindowsHost())
+ return f1.compare(f2, Qt::CaseInsensitive) == 0;
return f1 == f2;
-#endif
}
static bool isSimilarTo(const BreakpointParameters &data, const BreakpointResponse &needle)
@@ -1163,18 +1162,20 @@ void BreakHandler::saveSessionData()
void BreakHandler::loadSessionData()
{
+ beginResetModel();
m_storage.clear();
- reset();
+ endResetModel();
loadBreakpoints();
}
void BreakHandler::removeSessionData()
{
+ beginResetModel();
Iterator it = m_storage.begin(), et = m_storage.end();
for ( ; it != et; ++it)
it->destroyMarker();
m_storage.clear();
- reset();
+ endResetModel();
}
void BreakHandler::breakByFunction(const QString &functionName)
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp
index 64d3d0f6ad..55d0bec101 100644
--- a/src/plugins/debugger/cdb/cdbengine.cpp
+++ b/src/plugins/debugger/cdb/cdbengine.cpp
@@ -799,7 +799,7 @@ void CdbEngine::runEngine()
if (debug)
qDebug("runEngine");
foreach (const QString &breakEvent, m_options->breakEvents)
- postCommand(QByteArray("sxe ") + breakEvent.toAscii(), 0);
+ postCommand(QByteArray("sxe ") + breakEvent.toLatin1(), 0);
// Break functions: each function must be fully qualified,
// else the debugger will slow down considerably.
foreach (const QString &breakFunctionS, m_options->breakFunctions) {
@@ -1249,7 +1249,7 @@ void CdbEngine::handleJumpToLineAddressResolution(const CdbBuiltinCommandPtr &cm
bool ok;
const quint64 address = answer.toLongLong(&ok, 16);
if (ok && address) {
- QTC_ASSERT(qVariantCanConvert<ContextData>(cmd->cookie), return);
+ QTC_ASSERT(cmd->cookie.canConvert<ContextData>(), return);
const ContextData cookie = qvariant_cast<ContextData>(cmd->cookie);
jumpToAddress(address);
gotoLocation(Location(cookie.fileName, cookie.lineNumber));
@@ -1259,7 +1259,7 @@ void CdbEngine::handleJumpToLineAddressResolution(const CdbBuiltinCommandPtr &cm
static inline bool isAsciiWord(const QString &s)
{
foreach (const QChar &c, s) {
- if (!c.isLetterOrNumber() || c.toAscii() == 0)
+ if (!c.isLetterOrNumber() || c.toLatin1() == 0)
return false;
}
return true;
@@ -1682,7 +1682,7 @@ void CdbEngine::handleResolveSymbol(const QList<quint64> &addresses, const QVari
{
// Disassembly mode: Determine suitable range containing the
// agent's address within the function to display.
- if (qVariantCanConvert<DisassemblerAgent*>(cookie)) {
+ if (cookie.canConvert<DisassemblerAgent*>()) {
DisassemblerAgent *agent = cookie.value<DisassemblerAgent *>();
const quint64 agentAddress = agent->address();
quint64 functionAddress = 0;
@@ -1721,7 +1721,7 @@ void CdbEngine::handleResolveSymbol(const QList<quint64> &addresses, const QVari
// Parse: "00000000`77606060 cc int 3"
void CdbEngine::handleDisassembler(const CdbBuiltinCommandPtr &command)
{
- QTC_ASSERT(qVariantCanConvert<DisassemblerAgent*>(command->cookie), return);
+ QTC_ASSERT(command->cookie.canConvert<DisassemblerAgent*>(), return);
DisassemblerAgent *agent = qvariant_cast<DisassemblerAgent*>(command->cookie);
agent->setContents(parseCdbDisassembler(command->reply));
}
@@ -1760,7 +1760,7 @@ void CdbEngine::changeMemory(Internal::MemoryAgent *, QObject *, quint64 addr, c
void CdbEngine::handleMemory(const CdbExtensionCommandPtr &command)
{
- QTC_ASSERT(qVariantCanConvert<MemoryViewCookie>(command->cookie), return);
+ QTC_ASSERT(command->cookie.canConvert<MemoryViewCookie>(), return);
const MemoryViewCookie memViewCookie = qvariant_cast<MemoryViewCookie>(command->cookie);
if (command->success) {
const QByteArray data = QByteArray::fromBase64(command->reply);
@@ -2892,7 +2892,7 @@ void CdbEngine::handleExpression(const CdbExtensionCommandPtr &command)
showMessage(QString::fromLocal8Bit(command->errorMessage), LogError);
}
// Is this a conditional breakpoint?
- if (command->cookie.isValid() && qVariantCanConvert<ConditionalBreakPointCookie>(command->cookie)) {
+ if (command->cookie.isValid() && command->cookie.canConvert<ConditionalBreakPointCookie>()) {
const ConditionalBreakPointCookie cookie = qvariant_cast<ConditionalBreakPointCookie>(command->cookie);
const QString message = value ?
tr("Value %1 obtained from evaluating the condition of breakpoint %2, stopping.").
@@ -3101,13 +3101,13 @@ void CdbEngine::postWidgetAtCommand()
void CdbEngine::handleCustomSpecialStop(const QVariant &v)
{
- if (qVariantCanConvert<MemoryChangeCookie>(v)) {
- const MemoryChangeCookie changeData = qVariantValue<MemoryChangeCookie>(v);
+ if (v.canConvert<MemoryChangeCookie>()) {
+ const MemoryChangeCookie changeData = qvariant_cast<MemoryChangeCookie>(v);
postCommand(cdbWriteMemoryCommand(changeData.address, changeData.data), 0);
return;
}
- if (qVariantCanConvert<MemoryViewCookie>(v)) {
- postFetchMemory(qVariantValue<MemoryViewCookie>(v));
+ if (v.canConvert<MemoryViewCookie>()) {
+ postFetchMemory(qvariant_cast<MemoryViewCookie>(v));
return;
}
}
diff --git a/src/plugins/debugger/cdb/cdbparsehelpers.cpp b/src/plugins/debugger/cdb/cdbparsehelpers.cpp
index c1d6f40c8d..8842d5ce4a 100644
--- a/src/plugins/debugger/cdb/cdbparsehelpers.cpp
+++ b/src/plugins/debugger/cdb/cdbparsehelpers.cpp
@@ -555,7 +555,7 @@ bool parseCdbDisassemblerLine(const QString &line, DisassemblerLine *dLine, uint
dLine->address = addressS.toULongLong(&ok, 16);
if (!ok)
return false;
- dLine->rawData = QByteArray::fromHex(line.mid(rawDataPos, rawDataEnd - rawDataPos).toAscii());
+ dLine->rawData = QByteArray::fromHex(line.mid(rawDataPos, rawDataEnd - rawDataPos).toLatin1());
dLine->data = line.right(line.size() - instructionPos).trimmed();
return true;
}
diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp
index b93ff04f7b..ae7484c638 100644
--- a/src/plugins/debugger/commonoptionspage.cpp
+++ b/src/plugins/debugger/commonoptionspage.cpp
@@ -36,6 +36,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/manhattanstyle.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <projectexplorer/projectexplorer.h>
@@ -97,36 +98,35 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
m_group->insert(dc->action(VerboseLog), 0);
m_group->insert(dc->action(BreakOnThrow), 0);
m_group->insert(dc->action(BreakOnCatch), 0);
-#ifdef Q_OS_WIN
- Utils::SavedAction *registerAction = dc->action(RegisterForPostMortem);
- m_group->insert(registerAction,
- m_ui.checkBoxRegisterForPostMortem);
- connect(registerAction, SIGNAL(toggled(bool)),
- m_ui.checkBoxRegisterForPostMortem, SLOT(setChecked(bool)));
-#else
- m_ui.checkBoxRegisterForPostMortem->setVisible(false);
-#endif
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ Utils::SavedAction *registerAction = dc->action(RegisterForPostMortem);
+ m_group->insert(registerAction,
+ m_ui.checkBoxRegisterForPostMortem);
+ connect(registerAction, SIGNAL(toggled(bool)),
+ m_ui.checkBoxRegisterForPostMortem, SLOT(setChecked(bool)));
+ } else {
+ m_ui.checkBoxRegisterForPostMortem->setVisible(false);
+ }
}
QString CommonOptionsPageWidget::searchKeyWords() const
{
QString rc;
const QLatin1Char sep(' ');
- QTextStream(&rc)
- << sep << m_ui.checkBoxUseAlternatingRowColors->text()
- << sep << m_ui.checkBoxFontSizeFollowsEditor->text()
- << sep << m_ui.checkBoxUseToolTipsInMainEditor->text()
- << sep << m_ui.checkBoxListSourceFiles->text()
- << sep << m_ui.checkBoxBreakpointsFullPath->text()
-#ifdef Q_OS_WIN
- << sep << m_ui.checkBoxRegisterForPostMortem->text()
-#endif
- << sep << m_ui.checkBoxCloseBuffersOnExit->text()
- << sep << m_ui.checkBoxSwitchModeOnExit->text()
- << sep << m_ui.labelMaximalStackDepth->text()
- << sep << m_ui.checkBoxBringToForegroundOnInterrrupt->text()
- << sep << m_ui.checkBoxShowQmlObjectTree->text()
- ;
+ QTextStream stream(&rc);
+ stream << sep << m_ui.checkBoxUseAlternatingRowColors->text()
+ << sep << m_ui.checkBoxFontSizeFollowsEditor->text()
+ << sep << m_ui.checkBoxUseToolTipsInMainEditor->text()
+ << sep << m_ui.checkBoxListSourceFiles->text()
+ << sep << m_ui.checkBoxBreakpointsFullPath->text()
+ << sep << m_ui.checkBoxCloseBuffersOnExit->text()
+ << sep << m_ui.checkBoxSwitchModeOnExit->text()
+ << sep << m_ui.labelMaximalStackDepth->text()
+ << sep << m_ui.checkBoxBringToForegroundOnInterrrupt->text()
+ << sep << m_ui.checkBoxShowQmlObjectTree->text();
+ if (Utils::HostOsInfo::isWindowsHost())
+ stream << sep << m_ui.checkBoxRegisterForPostMortem->text();
+
rc.remove(QLatin1Char('&'));
return rc;
}
diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro
index fa66556673..5dc236c39d 100644
--- a/src/plugins/debugger/debugger.pro
+++ b/src/plugins/debugger/debugger.pro
@@ -70,12 +70,6 @@ HEADERS += \
debuggertooltipmanager.h \
debuggersourcepathmappingwidget.h \
memoryview.h \
- qtmessagelogwindow.h \
- qtmessagelogeditor.h \
- qtmessagelogview.h \
- qtmessagelogproxymodel.h \
- qtmessagelogitemdelegate.h \
- qtmessageloghandler.h \
localsandexpressionswindow.h
SOURCES += \
@@ -123,12 +117,6 @@ SOURCES += \
debuggertooltipmanager.cpp \
debuggersourcepathmappingwidget.cpp \
memoryview.cpp \
- qtmessagelogwindow.cpp \
- qtmessagelogproxymodel.cpp \
- qtmessagelogview.cpp \
- qtmessagelogitemdelegate.cpp \
- qtmessageloghandler.cpp \
- qtmessagelogeditor.cpp \
localsandexpressionswindow.cpp
FORMS += \
diff --git a/src/plugins/debugger/debugger.qbs b/src/plugins/debugger/debugger.qbs
index eede402cfc..357a1df32d 100644
--- a/src/plugins/debugger/debugger.qbs
+++ b/src/plugins/debugger/debugger.qbs
@@ -1,6 +1,7 @@
import qbs.base 1.0
import "../QtcPlugin.qbs" as QtcPlugin
+import "../../../qbs/defaults.js" as Defaults
QtcPlugin {
name: "Debugger"
@@ -19,32 +20,23 @@ QtcPlugin {
Depends { name: "QtcSsh" }
Depends { name: "cpp" }
- cpp.includePaths: [
- ".",
+ cpp.includePaths: base.concat([
"shared",
"lldb",
- "..",
- "../../libs",
"../../shared/json",
- buildDirectory,
- "../../libs/utils",
- "../../shared/registryaccess/"
- ]
+ "../../shared/registryaccess"
+ ])
Group {
- condition: qbs.buildVariant === "debug"
+ condition: Defaults.testsEnabled(qbs)
qbs.installDir: "tests/manual/debugger/simple/"
fileTags: ["install"]
files: ["../../../tests/manual/debugger/simple/simple.pro"]
}
files: [
- "debugger.qrc",
- "debuggerkitconfigwidget.cpp",
- "debuggerkitconfigwidget.h",
- "debuggerkitinformation.cpp",
- "debuggerkitinformation.h",
"basewindow.cpp",
+ "basewindow.h",
"breakhandler.cpp",
"breakhandler.h",
"breakpoint.cpp",
@@ -56,16 +48,27 @@ QtcPlugin {
"commonoptionspage.cpp",
"commonoptionspage.h",
"commonoptionspage.ui",
+ "debugger.qrc",
"debugger_global.h",
+ "debuggeractions.cpp",
+ "debuggeractions.h",
+ "debuggerconstants.h",
"debuggercore.h",
"debuggerdialogs.cpp",
"debuggerdialogs.h",
"debuggerengine.cpp",
"debuggerengine.h",
"debuggerinternalconstants.h",
+ "debuggerkitconfigwidget.cpp",
+ "debuggerkitconfigwidget.h",
+ "debuggerkitinformation.cpp",
+ "debuggerkitinformation.h",
"debuggermainwindow.cpp",
"debuggermainwindow.h",
+ "debuggerplugin.cpp",
"debuggerplugin.h",
+ "debuggerruncontrolfactory.h",
+ "debuggerrunner.cpp",
"debuggerrunner.h",
"debuggersourcepathmappingwidget.cpp",
"debuggersourcepathmappingwidget.h",
@@ -98,18 +101,6 @@ QtcPlugin {
"outputcollector.h",
"procinterrupt.cpp",
"procinterrupt.h",
- "qtmessagelogwindow.h",
- "qtmessagelogeditor.h",
- "qtmessagelogview.h",
- "qtmessagelogproxymodel.h",
- "qtmessagelogitemdelegate.h",
- "qtmessageloghandler.h",
- "qtmessagelogwindow.cpp",
- "qtmessagelogproxymodel.cpp",
- "qtmessagelogview.cpp",
- "qtmessagelogitemdelegate.cpp",
- "qtmessageloghandler.cpp",
- "qtmessagelogeditor.cpp",
"registerhandler.cpp",
"registerhandler.h",
"registerwindow.cpp",
@@ -145,13 +136,6 @@ QtcPlugin {
"watchutils.h",
"watchwindow.cpp",
"watchwindow.h",
- "basewindow.h",
- "debuggeractions.cpp",
- "debuggeractions.h",
- "debuggerconstants.h",
- "debuggerplugin.cpp",
- "debuggerruncontrolfactory.h",
- "debuggerrunner.cpp",
"cdb/bytearrayinputstream.cpp",
"cdb/bytearrayinputstream.h",
"cdb/cdbengine.cpp",
@@ -163,17 +147,21 @@ QtcPlugin {
"cdb/cdboptionspagewidget.ui",
"cdb/cdbparsehelpers.cpp",
"cdb/cdbparsehelpers.h",
- "gdb/gdb.qrc",
"gdb/abstractgdbprocess.cpp",
"gdb/abstractgdbprocess.h",
"gdb/abstractplaingdbadapter.cpp",
"gdb/abstractplaingdbadapter.h",
+ "gdb/attachgdbadapter.cpp",
"gdb/attachgdbadapter.h",
+ "gdb/classicgdbengine.cpp",
"gdb/coregdbadapter.cpp",
"gdb/coregdbadapter.h",
+ "gdb/gdb.qrc",
"gdb/gdbengine.cpp",
+ "gdb/gdbengine.h",
"gdb/gdbmi.cpp",
"gdb/gdbmi.h",
+ "gdb/gdboptionspage.cpp",
"gdb/gdboptionspage.h",
"gdb/localgdbprocess.cpp",
"gdb/localgdbprocess.h",
@@ -186,14 +174,10 @@ QtcPlugin {
"gdb/remotegdbserveradapter.h",
"gdb/remoteplaingdbadapter.cpp",
"gdb/remoteplaingdbadapter.h",
- "gdb/termgdbadapter.h",
- "gdb/attachgdbadapter.cpp",
- "gdb/classicgdbengine.cpp",
- "gdb/gdbengine.h",
- "gdb/gdboptionspage.cpp",
- "gdb/termgdbadapter.cpp",
"gdb/startgdbserverdialog.cpp",
"gdb/startgdbserverdialog.h",
+ "gdb/termgdbadapter.cpp",
+ "gdb/termgdbadapter.h",
"images/breakpoint_16.png",
"images/breakpoint_24.png",
"images/breakpoint_disabled_16.png",
@@ -226,29 +210,40 @@ QtcPlugin {
"images/location_24.png",
"images/tracepoint.png",
"images/watchpoint.png",
+ "lldb/ipcenginehost.cpp",
+ "lldb/ipcenginehost.h",
+ "lldb/lldbenginehost.cpp",
+ "lldb/lldbenginehost.h",
+ "namedemangler/demanglerexceptions.h",
+ "namedemangler/globalparsestate.cpp",
+ "namedemangler/globalparsestate.h",
+ "namedemangler/namedemangler.cpp",
+ "namedemangler/namedemangler.h",
+ "namedemangler/parsetreenodes.cpp",
+ "namedemangler/parsetreenodes.h",
"pdb/pdbengine.cpp",
"pdb/pdbengine.h",
- "qml/qmlengine.h",
- "qml/qmladapter.h",
+ "qml/baseqmldebuggerclient.cpp",
"qml/baseqmldebuggerclient.h",
- "qml/qmlcppengine.h",
- "qml/qscriptdebuggerclient.h",
- "qml/qmlv8debuggerclient.h",
+ "qml/interactiveinterpreter.cpp",
"qml/interactiveinterpreter.h",
- "qml/qmlv8debuggerclientconstants.h",
- "qml/qmlengine.cpp",
"qml/qmladapter.cpp",
- "qml/baseqmldebuggerclient.cpp",
+ "qml/qmladapter.h",
"qml/qmlcppengine.cpp",
- "qml/qscriptdebuggerclient.cpp",
- "qml/qmlv8debuggerclient.cpp",
- "qml/interactiveinterpreter.cpp",
+ "qml/qmlcppengine.h",
+ "qml/qmlengine.cpp",
+ "qml/qmlengine.h",
"qml/qmlinspectoradapter.cpp",
"qml/qmlinspectoradapter.h",
"qml/qmlinspectoragent.cpp",
"qml/qmlinspectoragent.h",
"qml/qmllivetextpreview.cpp",
"qml/qmllivetextpreview.h",
+ "qml/qmlv8debuggerclient.cpp",
+ "qml/qmlv8debuggerclient.h",
+ "qml/qmlv8debuggerclientconstants.h",
+ "qml/qscriptdebuggerclient.cpp",
+ "qml/qscriptdebuggerclient.h",
"script/scriptengine.cpp",
"script/scriptengine.h",
"shared/backtrace.cpp",
@@ -257,17 +252,6 @@ QtcPlugin {
"shared/cdbsymbolpathlisteditor.h",
"shared/hostutils.cpp",
"shared/hostutils.h",
- "lldb/ipcenginehost.cpp",
- "lldb/ipcenginehost.h",
- "lldb/lldbenginehost.cpp",
- "lldb/lldbenginehost.h",
- "namedemangler/namedemangler.cpp",
- "namedemangler/namedemangler.h",
- "namedemangler/parsetreenodes.cpp",
- "namedemangler/parsetreenodes.h",
- "namedemangler/demanglerexceptions.h",
- "namedemangler/globalparsestate.h",
- "namedemangler/globalparsestate.cpp"
]
Group {
@@ -275,7 +259,7 @@ QtcPlugin {
prefix: "../../shared/registryaccess/"
files: [
"registryaccess.cpp",
- "registryaccess.h"
+ "registryaccess.h",
]
}
@@ -285,7 +269,7 @@ QtcPlugin {
"registerpostmortemaction.cpp",
"registerpostmortemaction.h",
"shared/peutils.cpp",
- "shared/peutils.h"
+ "shared/peutils.h",
]
}
@@ -294,7 +278,7 @@ QtcPlugin {
files: [
"lldb/lldboptionspage.cpp",
"lldb/lldboptionspage.h",
- "lldb/lldboptionspagewidget.ui"
+ "lldb/lldboptionspagewidget.ui",
]
}
@@ -313,4 +297,3 @@ QtcPlugin {
cpp.includePaths: ["."]
}
}
-
diff --git a/src/plugins/debugger/debugger.qrc b/src/plugins/debugger/debugger.qrc
index a75fb1625e..b1e7d73495 100644
--- a/src/plugins/debugger/debugger.qrc
+++ b/src/plugins/debugger/debugger.qrc
@@ -30,12 +30,6 @@
<file>images/location_16.png</file>
<file>images/location_24.png</file>
<file>images/pin.xpm</file>
- <file>images/collapse.png</file>
- <file>images/error.png</file>
- <file>images/expand.png</file>
- <file>images/log.png</file>
- <file>images/prompt.png</file>
- <file>images/warning.png</file>
<file>images/qml/zoom.png</file>
<file>images/qml/select.png</file>
<file>images/qml/app-on-top.png</file>
diff --git a/src/plugins/debugger/debugger_dependencies.pri b/src/plugins/debugger/debugger_dependencies.pri
index 732954b727..d9138c7329 100644
--- a/src/plugins/debugger/debugger_dependencies.pri
+++ b/src/plugins/debugger/debugger_dependencies.pri
@@ -3,6 +3,7 @@ include(../../plugins/cpptools/cpptools.pri)
include(../../plugins/find/find.pri)
include(../../plugins/projectexplorer/projectexplorer.pri)
include(../../plugins/texteditor/texteditor.pri)
+include(../../plugins/qmljstools/qmljstools.pri)
include(../../libs/cplusplus/cplusplus.pri)
include(../../libs/utils/utils.pri)
include(../../libs/qmljs/qmljs.pri)
diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h
index d8815540f0..26fa3a88c0 100644
--- a/src/plugins/debugger/debuggerconstants.h
+++ b/src/plugins/debugger/debuggerconstants.h
@@ -74,7 +74,6 @@ const char DOCKWIDGET_THREADS[] = "Debugger.Docks.Threads";
const char DOCKWIDGET_WATCHERS[] = "Debugger.Docks.LocalsAndWatchers";
const char DOCKWIDGET_QML_INSPECTOR[] = "Debugger.Docks.QmlInspector";
-const char DOCKWIDGET_QML_SCRIPTCONSOLE[] = "Debugger.Docks.ScriptConsole";
const char DOCKWIDGET_DEFAULT_AREA[] = "Debugger.Docks.DefaultArea";
} // namespace Constants
@@ -181,9 +180,8 @@ enum LogChannel
AppOutput, // stdout
AppError, // stderr
AppStuff, // (possibly) windows debug channel
- StatusBar, // LogStatus and also put to the status bar
- QtMessageLogOutput,
- QtMessageLogStatus
+ StatusBar, // LogStatus and also put to the status bar
+ ConsoleOutput // Used to output to console
};
enum DebuggerEngineType
diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index 34df0d02a8..b69c714228 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -47,7 +47,6 @@
#include "stackhandler.h"
#include "threadshandler.h"
#include "watchhandler.h"
-#include "qtmessageloghandler.h"
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
@@ -65,6 +64,8 @@
#include <utils/qtcassert.h>
#include <utils/fileinprojectfinder.h>
+#include <qmljstools/qmlconsolemanager.h>
+
#include <QDebug>
#include <QTimer>
#include <QFile>
@@ -296,7 +297,6 @@ public:
StackHandler m_stackHandler;
ThreadsHandler m_threadsHandler;
WatchHandler m_watchHandler;
- QtMessageLogHandler m_qtMessageHandler;
QFutureInterface<void> m_progress;
DisassemblerAgent m_disassemblerAgent;
@@ -427,11 +427,6 @@ WatchHandler *DebuggerEngine::watchHandler() const
: &d->m_watchHandler;
}
-QtMessageLogHandler *DebuggerEngine::qtMessageLogHandler() const
-{
- return &d->m_qtMessageHandler;
-}
-
SourceFilesHandler *DebuggerEngine::sourceFilesHandler() const
{
return d->m_masterEngine
@@ -509,14 +504,6 @@ QAbstractItemModel *DebuggerEngine::sourceFilesModel() const
return model;
}
-QAbstractItemModel *DebuggerEngine::qtMessageLogModel() const
-{
- QAbstractItemModel *model = qtMessageLogHandler()->model();
- if (model->objectName().isEmpty()) // Make debugging easier.
- model->setObjectName(objectName() + QLatin1String("QtMessageLogModel"));
- return model;
-}
-
void DebuggerEngine::fetchMemory(MemoryAgent *, QObject *,
quint64 addr, quint64 length)
{
@@ -545,8 +532,9 @@ void DebuggerEngine::showMessage(const QString &msg, int channel, int timeout) c
}
//if (msg.size() && msg.at(0).isUpper() && msg.at(1).isUpper())
// qDebug() << qPrintable(msg) << "IN STATE" << state();
- if (channel == QtMessageLogOutput)
- qtMessageLogHandler()->appendMessage(QtMessageLogHandler::UndefinedType, msg);
+ QmlJSTools::QmlConsoleManager *consoleManager = QmlJSTools::QmlConsoleManager::instance();
+ if (channel == ConsoleOutput && consoleManager)
+ consoleManager->printToConsolePane(QmlJSTools::QmlConsoleItem::UndefinedType, msg);
debuggerCore()->showMessage(msg, channel, timeout);
if (d->m_runControl) {
diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index 070b812caf..88fd078241 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -76,7 +76,6 @@ class QmlAdapter;
class QmlCppEngine;
class DebuggerToolTipContext;
class MemoryMarkup;
-class QtMessageLogHandler;
struct WatchUpdateFlags
{
@@ -215,7 +214,6 @@ public:
virtual Internal::WatchHandler *watchHandler() const;
virtual Internal::SourceFilesHandler *sourceFilesHandler() const;
virtual Internal::BreakHandler *breakHandler() const;
- virtual Internal::QtMessageLogHandler *qtMessageLogHandler() const;
virtual QAbstractItemModel *modulesModel() const;
virtual QAbstractItemModel *registerModel() const;
@@ -228,7 +226,6 @@ public:
virtual QAbstractItemModel *toolTipsModel() const; // Deprecated, FIXME: use watchModel
virtual QAbstractItemModel *watchModel() const;
virtual QAbstractItemModel *sourceFilesModel() const;
- virtual QAbstractItemModel *qtMessageLogModel() const;
void progressPing();
void handleFinished();
@@ -272,6 +269,8 @@ public:
QString toFileInProject(const QUrl &fileUrl);
+ virtual bool evaluateScriptExpression(const QString &expression);
+
signals:
void stateChanged(Debugger::DebuggerState state);
// A new stack frame is on display including locals.
@@ -353,7 +352,6 @@ protected:
virtual void executeRunToFunction(const QString &functionName);
virtual void executeJumpToLine(const Internal::ContextData &data);
virtual void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
- virtual bool evaluateScriptExpression(const QString &expression);
virtual void frameUp();
virtual void frameDown();
diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp
index 605b9941a6..71ba306557 100644
--- a/src/plugins/debugger/debuggermainwindow.cpp
+++ b/src/plugins/debugger/debuggermainwindow.cpp
@@ -689,7 +689,6 @@ void DebuggerMainWindowPrivate::setSimpleDockWidgetArrangement()
QDockWidget *threadsDock = q->dockWidget(QLatin1String(DOCKWIDGET_THREADS));
QDockWidget *outputDock = q->dockWidget(QLatin1String(DOCKWIDGET_OUTPUT));
QDockWidget *qmlInspectorDock = q->dockWidget(QLatin1String(DOCKWIDGET_QML_INSPECTOR));
- QDockWidget *consoleDock = q->dockWidget(QLatin1String(DOCKWIDGET_QML_SCRIPTCONSOLE));
QDockWidget *modulesDock = q->dockWidget(QLatin1String(DOCKWIDGET_MODULES));
QDockWidget *registerDock = q->dockWidget(QLatin1String(DOCKWIDGET_REGISTER));
QDockWidget *sourceFilesDock = q->dockWidget(QLatin1String(DOCKWIDGET_SOURCE_FILES));
@@ -700,7 +699,6 @@ void DebuggerMainWindowPrivate::setSimpleDockWidgetArrangement()
QTC_ASSERT(snapshotsDock, return);
QTC_ASSERT(threadsDock, return);
QTC_ASSERT(outputDock, return);
- QTC_ASSERT(consoleDock, return);
QTC_ASSERT(modulesDock, return);
QTC_ASSERT(registerDock, return);
QTC_ASSERT(sourceFilesDock, return);
@@ -713,7 +711,7 @@ void DebuggerMainWindowPrivate::setSimpleDockWidgetArrangement()
// toolBar
// --------------------------------------------------------------------------------
- // stack,qmlinspector | breakpoints,modules,register,threads,sourceFiles,snapshots,scriptconsole
+ // stack,qmlinspector | breakpoints,modules,register,threads,sourceFiles,snapshots
//
q->splitDockWidget(toolBarDock, stackDock, Qt::Vertical);
q->splitDockWidget(stackDock, breakDock, Qt::Horizontal);
@@ -726,13 +724,10 @@ void DebuggerMainWindowPrivate::setSimpleDockWidgetArrangement()
q->tabifyDockWidget(breakDock, threadsDock);
q->tabifyDockWidget(breakDock, sourceFilesDock);
q->tabifyDockWidget(breakDock, snapshotsDock);
- q->tabifyDockWidget(breakDock, consoleDock);
if (m_activeDebugLanguages.testFlag(Debugger::QmlLanguage)) {
if (qmlInspectorDock)
qmlInspectorDock->show();
- if (consoleDock)
- consoleDock->show();
} else {
// CPP only
threadsDock->show();
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 30655a51ee..d8499f81d5 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -45,7 +45,6 @@
#include "breakpoint.h"
#include "breakhandler.h"
#include "breakwindow.h"
-#include "qtmessagelogwindow.h"
#include "disassemblerlines.h"
#include "logwindow.h"
#include "moduleswindow.h"
@@ -114,6 +113,7 @@
#include <texteditor/fontsettings.h>
#include <texteditor/texteditorsettings.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <utils/styledbar.h>
@@ -124,6 +124,8 @@
# include <utils/winutils.h>
#endif
+#include <qmljstools/qmlconsolemanager.h>
+
#include <QComboBox>
#include <QDockWidget>
#include <QFileDialog>
@@ -1281,7 +1283,6 @@ public:
BaseWindow *m_breakWindow;
BreakHandler *m_breakHandler;
- QtMessageLogWindow *m_qtMessageLogWindow;
WatchWindow *m_returnWindow;
WatchWindow *m_localsWindow;
WatchWindow *m_watchersWindow;
@@ -1347,7 +1348,6 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) :
m_threadsWindow = 0;
m_logWindow = 0;
m_localsAndExpressionsWindow = 0;
- m_qtMessageLogWindow = 0;
m_mainWindow = 0;
m_snapshotHandler = 0;
@@ -1795,7 +1795,7 @@ void DebuggerPluginPrivate::startRemoteEngine()
sp.connParams.timeout = 5;
sp.connParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationByPassword;
sp.connParams.port = 22;
- sp.connParams.proxyType = QSsh::SshConnectionParameters::NoProxy;
+ sp.connParams.options = QSsh::SshIgnoreDefaultProxy;
sp.executable = dlg.inferiorPath();
sp.serverStartScript = dlg.enginePath();
@@ -2064,12 +2064,18 @@ void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine)
m_threadsWindow->setModel(engine->threadsModel());
m_watchersWindow->setModel(engine->watchersModel());
m_inspectorWindow->setModel(engine->inspectorModel());
- m_qtMessageLogWindow->setModel(engine->qtMessageLogModel());
engine->watchHandler()->rebuildModel();
mainWindow()->setEngineDebugLanguages(engine->startParameters().languages);
mainWindow()->setCurrentEngine(engine);
+ QmlJSTools::QmlConsoleManager *consoleManager = QmlJSTools::QmlConsoleManager::instance();
+ if (consoleManager) {
+ if (engine->startParameters().languages & QmlLanguage)
+ consoleManager->setDebuggerEngine(engine);
+ else
+ consoleManager->setDebuggerEngine(0);
+ }
}
static void changeFontSize(QWidget *widget, qreal size)
@@ -2192,7 +2198,6 @@ void DebuggerPluginPrivate::setInitialState()
action(AutoDerefPointers)->setEnabled(true);
action(ExpandStack)->setEnabled(false);
- m_qtMessageLogWindow->setEnabled(true);
}
void DebuggerPluginPrivate::updateWatchersWindow(bool showWatch, bool showReturn)
@@ -2557,10 +2562,6 @@ void DebuggerPluginPrivate::showMessage(const QString &msg, int channel, int tim
m_logWindow->showInput(LogError, QLatin1String("ERROR: ") + msg);
m_logWindow->showOutput(LogError, QLatin1String("ERROR: ") + msg);
break;
- case QtMessageLogStatus:
- QTC_ASSERT(m_qtMessageLogWindow, return);
- m_qtMessageLogWindow->showStatus(msg, timeout);
- break;
default:
m_logWindow->showOutput(channel, msg);
break;
@@ -2737,8 +2738,6 @@ void DebuggerPluginPrivate::extensionsInitialized()
m_breakWindow->setObjectName(QLatin1String(DOCKWIDGET_BREAK));
m_breakWindow->setModel(m_breakHandler->model());
- m_qtMessageLogWindow = new QtMessageLogWindow();
- m_qtMessageLogWindow->setObjectName(QLatin1String(DOCKWIDGET_QML_SCRIPTCONSOLE));
m_modulesWindow = new ModulesWindow;
m_modulesWindow->setObjectName(QLatin1String(DOCKWIDGET_MODULES));
m_logWindow = new LogWindow;
@@ -2883,7 +2882,6 @@ void DebuggerPluginPrivate::extensionsInitialized()
dock->setProperty(DOCKWIDGET_DEFAULT_AREA, Qt::TopDockWidgetArea);
m_mainWindow->createDockWidget(CppLanguage, m_breakWindow);
- m_mainWindow->createDockWidget(QmlLanguage, m_qtMessageLogWindow);
m_mainWindow->createDockWidget(CppLanguage, m_snapshotWindow);
m_mainWindow->createDockWidget(CppLanguage, m_stackWindow);
m_mainWindow->createDockWidget(CppLanguage, m_threadsWindow);
@@ -2947,11 +2945,11 @@ void DebuggerPluginPrivate::extensionsInitialized()
act->setText(tr("Attach to QML Port..."));
connect(act, SIGNAL(triggered()), SLOT(attachToQmlPort()));
-#ifdef Q_OS_WIN
- m_startRemoteCdbAction = new QAction(tr("Attach to Remote CDB Session..."), this);
- connect(m_startRemoteCdbAction, SIGNAL(triggered()),
- SLOT(startRemoteCdbSession()));
-#endif
+ if (HostOsInfo::isWindowsHost()) {
+ m_startRemoteCdbAction = new QAction(tr("Attach to Remote CDB Session..."), this);
+ connect(m_startRemoteCdbAction, SIGNAL(triggered()),
+ SLOT(startRemoteCdbSession()));
+ }
act = m_detachAction = new QAction(this);
act->setText(tr("Detach Debugger"));
diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp
index 418affe8f8..2336740c86 100644
--- a/src/plugins/debugger/debuggerrunner.cpp
+++ b/src/plugins/debugger/debuggerrunner.cpp
@@ -70,6 +70,7 @@
#include <QErrorMessage>
#include <QFormLayout>
#include <QLabel>
+#include <QPointer>
using namespace Debugger::Internal;
using namespace ProjectExplorer;
@@ -261,7 +262,7 @@ public:
public:
DebuggerRunControl *q;
DebuggerEngine *m_engine;
- const QWeakPointer<RunConfiguration> m_myRunConfiguration;
+ const QPointer<RunConfiguration> m_myRunConfiguration;
bool m_running;
};
diff --git a/src/plugins/debugger/gdb/classicgdbengine.cpp b/src/plugins/debugger/gdb/classicgdbengine.cpp
index 669374e10b..daecb17c3d 100644
--- a/src/plugins/debugger/gdb/classicgdbengine.cpp
+++ b/src/plugins/debugger/gdb/classicgdbengine.cpp
@@ -1230,8 +1230,8 @@ void GdbEngine::handleStackListLocalsClassic(const GdbResponse &response)
QStringList uninitializedVariables;
if (debuggerCore()->action(UseCodeModel)->isChecked()) {
const StackFrame frame =
- qVariantCanConvert<Debugger::Internal::StackFrame>(response.cookie)
- ? qVariantValue<Debugger::Internal::StackFrame>(response.cookie)
+ response.cookie.canConvert<Debugger::Internal::StackFrame>()
+ ? qvariant_cast<Debugger::Internal::StackFrame>(response.cookie)
: stackHandler()->currentFrame();
if (frame.isUsable())
getUninitializedVariables(debuggerCore()->cppCodeModelSnapshot(),
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 72d1fb8d22..1d28f1cd94 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -75,6 +75,7 @@
#include <projectexplorer/itaskhandler.h>
#include <texteditor/itexteditor.h>
#include <utils/elfreader.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/savedaction.h>
@@ -4981,19 +4982,17 @@ void GdbEngine::finishInferiorSetup()
void GdbEngine::handleDebugInfoLocation(const GdbResponse &response)
{
-#ifdef Q_OS_WIN
- const char pathSep = ';';
-#else
- const char pathSep = ':';
-#endif
if (response.resultClass == GdbResultDone) {
const QByteArray debugInfoLocation = startParameters().debugInfoLocation.toLocal8Bit();
if (QFile::exists(QString::fromLocal8Bit(debugInfoLocation))) {
const QByteArray curDebugInfoLocations = response.consoleStreamOutput.split('"').value(1);
- if (curDebugInfoLocations.isEmpty())
+ if (curDebugInfoLocations.isEmpty()) {
postCommand("set debug-file-directory " + debugInfoLocation);
- else
- postCommand("set debug-file-directory " + debugInfoLocation + pathSep + curDebugInfoLocations);
+ } else {
+ postCommand("set debug-file-directory " + debugInfoLocation
+ + HostOsInfo::pathListSeparator().toLatin1()
+ + curDebugInfoLocations);
+ }
}
}
}
diff --git a/src/plugins/debugger/gdb/localplaingdbadapter.cpp b/src/plugins/debugger/gdb/localplaingdbadapter.cpp
index abd6c310e6..a1db55c2de 100644
--- a/src/plugins/debugger/gdb/localplaingdbadapter.cpp
+++ b/src/plugins/debugger/gdb/localplaingdbadapter.cpp
@@ -37,6 +37,7 @@
#include <projectexplorer/abi.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QFileInfo>
@@ -61,11 +62,8 @@ GdbLocalPlainEngine::GdbLocalPlainEngine(const DebuggerStartParameters &startPar
GdbEngine::DumperHandling GdbLocalPlainEngine::dumperHandling() const
{
// LD_PRELOAD fails for System-Qt on Mac.
-#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
- return DumperLoadedByGdb;
-#else
- return DumperLoadedByGdbPreload;
-#endif
+ return Utils::HostOsInfo::isWindowsHost() || Utils::HostOsInfo::isMacHost()
+ ? DumperLoadedByGdb : DumperLoadedByGdbPreload;
}
void GdbLocalPlainEngine::setupEngine()
diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
index 9972585c4f..00d2e2384b 100644
--- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
+++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
@@ -36,6 +36,7 @@
#include "gdbengine.h"
#include "gdbmi.h"
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/fancymainwindow.h>
#include <projectexplorer/abi.h>
@@ -156,11 +157,6 @@ void GdbRemoteServerEngine::setupInferior()
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
const DebuggerStartParameters &sp = startParameters();
-#ifdef Q_OS_WIN
- #define PATHSEP ";"
-#else
- #define PATHSEP ":"
-#endif
QString executableFileName;
if (!sp.executable.isEmpty()) {
QFileInfo fi(sp.executable);
@@ -178,7 +174,8 @@ void GdbRemoteServerEngine::setupInferior()
// if (!remoteArch.isEmpty())
// postCommand("set architecture " + remoteArch);
- const QString solibSearchPath = sp.solibSearchPath.join(QLatin1String(PATHSEP));
+ const QString solibSearchPath
+ = sp.solibSearchPath.join(QString(Utils::HostOsInfo::pathListSeparator()));
if (!solibSearchPath.isEmpty())
postCommand("set solib-search-path " + solibSearchPath.toLocal8Bit());
diff --git a/src/plugins/debugger/gdb/termgdbadapter.cpp b/src/plugins/debugger/gdb/termgdbadapter.cpp
index 26e3369b54..a8eb65abfb 100644
--- a/src/plugins/debugger/gdb/termgdbadapter.cpp
+++ b/src/plugins/debugger/gdb/termgdbadapter.cpp
@@ -37,6 +37,7 @@
#include "debuggercore.h"
#include "shared/hostutils.h"
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <coreplugin/icore.h>
@@ -79,11 +80,9 @@ GdbTermEngine::~GdbTermEngine()
GdbEngine::DumperHandling GdbTermEngine::dumperHandling() const
{
// LD_PRELOAD fails for System-Qt on Mac.
-#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
- return DumperLoadedByGdb;
-#else
- return DumperLoadedByAdapter; // Handles loading itself via LD_PRELOAD
-#endif
+ return Utils::HostOsInfo::isWindowsHost() || Utils::HostOsInfo::isMacHost()
+ ? DumperLoadedByGdb
+ : DumperLoadedByAdapter; // Handles loading itself via LD_PRELOAD
}
void GdbTermEngine::setupEngine()
diff --git a/src/plugins/debugger/moduleshandler.cpp b/src/plugins/debugger/moduleshandler.cpp
index 507d644914..f2245eab01 100644
--- a/src/plugins/debugger/moduleshandler.cpp
+++ b/src/plugins/debugger/moduleshandler.cpp
@@ -194,15 +194,17 @@ QVariant ModulesModel::data(const QModelIndex &index, int role) const
void ModulesModel::setModules(const Modules &m)
{
+ beginResetModel();
m_modules = m;
- reset();
+ endResetModel();
}
void ModulesModel::clearModel()
{
if (!m_modules.isEmpty()) {
+ beginResetModel();
m_modules.clear();
- reset();
+ endResetModel();
}
}
diff --git a/src/plugins/debugger/moduleswindow.cpp b/src/plugins/debugger/moduleswindow.cpp
index 09a3ad8684..3c856c3967 100644
--- a/src/plugins/debugger/moduleswindow.cpp
+++ b/src/plugins/debugger/moduleswindow.cpp
@@ -34,6 +34,7 @@
#include "debuggercore.h"
#include "debuggerengine.h"
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/savedaction.h>
@@ -132,10 +133,9 @@ void ModulesTreeView::contextMenuEvent(QContextMenuEvent *ev)
actShowModuleSymbols->setEnabled(engine->hasCapability(ShowModuleSymbolsCapability));
actShowDependencies = new QAction(tr("Show Dependencies of \"%1\"").arg(name), &menu);
actShowDependencies->setEnabled(!fileName.isEmpty());
-#ifndef Q_OS_WIN
- // FIXME: Dependencies only available on Windows, when "depends" is installed.
- actShowDependencies->setEnabled(false);
-#endif
+ if (!Utils::HostOsInfo::isWindowsHost())
+ // FIXME: Dependencies only available on Windows, when "depends" is installed.
+ actShowDependencies->setEnabled(false);
}
menu.addAction(actUpdateModuleList);
diff --git a/src/plugins/debugger/namedemangler/namedemangler.cpp b/src/plugins/debugger/namedemangler/namedemangler.cpp
index 88e35ebbb1..840b1bd483 100644
--- a/src/plugins/debugger/namedemangler/namedemangler.cpp
+++ b/src/plugins/debugger/namedemangler/namedemangler.cpp
@@ -55,7 +55,7 @@ bool NameDemanglerPrivate::demangle(const QString &mangledName)
{
bool success;
try {
- m_parseState.m_mangledName = mangledName.toAscii();
+ m_parseState.m_mangledName = mangledName.toLatin1();
m_parseState.m_pos = 0;
m_demangledName.clear();
diff --git a/src/plugins/debugger/qml/qmlcppengine.cpp b/src/plugins/debugger/qml/qmlcppengine.cpp
index ca9f835cb4..4cfb04ae33 100644
--- a/src/plugins/debugger/qml/qmlcppengine.cpp
+++ b/src/plugins/debugger/qml/qmlcppengine.cpp
@@ -33,7 +33,6 @@
#include "debuggerstartparameters.h"
#include "stackhandler.h"
#include "qmlengine.h"
-#include "qtmessageloghandler.h"
#include "watchdata.h"
#include <coreplugin/icore.h>
@@ -793,11 +792,6 @@ void QmlCppEngine::resetLocation()
DebuggerEngine::resetLocation();
}
-Internal::QtMessageLogHandler *QmlCppEngine::qtMessageLogHandler() const
-{
- return d->m_qmlEngine->qtMessageLogHandler();
-}
-
DebuggerEngine *QmlCppEngine::cppEngine() const
{
return d->m_cppEngine;
diff --git a/src/plugins/debugger/qml/qmlcppengine.h b/src/plugins/debugger/qml/qmlcppengine.h
index e2596875a2..034b6051cb 100644
--- a/src/plugins/debugger/qml/qmlcppengine.h
+++ b/src/plugins/debugger/qml/qmlcppengine.h
@@ -92,8 +92,6 @@ public:
int timeout = -1) const;
void resetLocation();
- Internal::QtMessageLogHandler *qtMessageLogHandler() const;
-
void notifyInferiorIll();
protected:
diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp
index e052769340..2791b4c201 100644
--- a/src/plugins/debugger/qml/qmlengine.cpp
+++ b/src/plugins/debugger/qml/qmlengine.cpp
@@ -49,7 +49,6 @@
#include "watchhandler.h"
#include "sourcefileshandler.h"
#include "watchutils.h"
-#include "qtmessageloghandler.h"
#include <extensionsystem/pluginmanager.h>
#include <qmldebug/baseenginedebugclient.h>
@@ -67,6 +66,9 @@
#include <texteditor/itexteditor.h>
+#include <qmljstools/qmlconsolemanager.h>
+#include <qmljstools/qmlconsoleitem.h>
+
#include <QDateTime>
#include <QDebug>
#include <QDir>
@@ -329,8 +331,6 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters)
m_noDebugOutputTimer.setInterval(8000);
connect(&m_noDebugOutputTimer, SIGNAL(timeout()), this, SLOT(tryToConnect()));
- qtMessageLogHandler()->setHasEditableRow(true);
-
connect(ModelManagerInterface::instance(),
SIGNAL(documentUpdated(QmlJS::Document::Ptr)),
this,
@@ -1030,14 +1030,61 @@ void QmlEngine::synchronizeWatchers()
}
}
+QmlJSTools::QmlConsoleItem *constructLogItemTree(QmlJSTools::QmlConsoleItem *parent,
+ const QVariant &result,
+ const QString &key = QString())
+{
+ using namespace QmlJSTools;
+ bool sorted = debuggerCore()->boolSetting(SortStructMembers);
+ if (!result.isValid())
+ return 0;
+
+ QmlConsoleItem *item = new QmlConsoleItem(parent);
+ if (result.type() == QVariant::Map) {
+ if (key.isEmpty())
+ item->setText(_("Object"));
+ else
+ item->setText(key + _(" : Object"));
+
+ QMapIterator<QString, QVariant> i(result.toMap());
+ while (i.hasNext()) {
+ i.next();
+ QmlConsoleItem *child = constructLogItemTree(item, i.value(), i.key());
+ if (child)
+ item->insertChild(child, sorted);
+ }
+ } else if (result.type() == QVariant::List) {
+ if (key.isEmpty())
+ item->setText(_("List"));
+ else
+ item->setText(QString(_("[%1] : List")).arg(key));
+ QVariantList resultList = result.toList();
+ for (int i = 0; i < resultList.count(); i++) {
+ QmlConsoleItem *child = constructLogItemTree(item, resultList.at(i),
+ QString::number(i));
+ if (child)
+ item->insertChild(child, sorted);
+ }
+ } else if (result.canConvert(QVariant::String)) {
+ item->setText(result.toString());
+ } else {
+ item->setText(_("Unknown Value"));
+ }
+
+ return item;
+}
+
void QmlEngine::expressionEvaluated(quint32 queryId, const QVariant &result)
{
if (queryIds.contains(queryId)) {
queryIds.removeOne(queryId);
- QtMessageLogItem *item = constructLogItemTree(qtMessageLogHandler()->root(),
- result);
- if (item)
- qtMessageLogHandler()->appendItem(item);
+ using namespace QmlJSTools;
+ QmlConsoleManager *consoleManager = QmlConsoleManager::instance();
+ if (consoleManager) {
+ QmlConsoleItem *item = constructLogItemTree(consoleManager->rootItem(), result);
+ if (item)
+ consoleManager->printToConsolePane(item);
+ }
}
}
@@ -1091,35 +1138,40 @@ void QmlEngine::documentUpdated(QmlJS::Document::Ptr doc)
void QmlEngine::updateCurrentContext()
{
const QString context = state() == InferiorStopOk ?
- stackHandler()->currentFrame().function :
- m_inspectorAdapter.currentSelectedDisplayName();
- showMessage(tr("Context: ").append(context), QtMessageLogStatus);
+ stackHandler()->currentFrame().function
+ : m_inspectorAdapter.currentSelectedDisplayName();
+ QmlJSTools::QmlConsoleManager *consoleManager = QmlJSTools::QmlConsoleManager::instance();
+ if (consoleManager)
+ consoleManager->setContext(tr("Context: ").append(context));
}
void QmlEngine::appendDebugOutput(QtMsgType type, const QString &message,
const QmlDebug::QDebugContextInfo &info)
{
- QtMessageLogHandler::ItemType itemType;
+ using namespace QmlJSTools;
+ QmlConsoleItem::ItemType itemType;
switch (type) {
case QtDebugMsg:
- itemType = QtMessageLogHandler::DebugType;
+ itemType = QmlConsoleItem::DebugType;
break;
case QtWarningMsg:
- itemType = QtMessageLogHandler::WarningType;
+ itemType = QmlConsoleItem::WarningType;
break;
case QtCriticalMsg:
case QtFatalMsg:
- itemType = QtMessageLogHandler::ErrorType;
+ itemType = QmlConsoleItem::ErrorType;
break;
default:
//This case is not possible
return;
}
- QtMessageLogItem *item = new QtMessageLogItem(qtMessageLogHandler()->root(),
- itemType, message);
- item->file = info.file;
- item->line = info.line;
- qtMessageLogHandler()->appendItem(item);
+ QmlConsoleManager *consoleManager = QmlConsoleManager::instance();
+ if (consoleManager) {
+ QmlConsoleItem *item = new QmlConsoleItem(consoleManager->rootItem(), itemType, message);
+ item->file = info.file;
+ item->line = info.line;
+ consoleManager->printToConsolePane(item);
+ }
}
void QmlEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
@@ -1132,37 +1184,25 @@ void QmlEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages
bool QmlEngine::evaluateScriptExpression(const QString &expression)
{
bool didEvaluate = true;
- //Check if string is only white spaces
- if (!expression.trimmed().isEmpty()) {
- //check if it can be evaluated
- if (canEvaluateScript(expression)) {
- //Evaluate expression based on engine state
- //When engine->state() == InferiorStopOk, the expression
- //is sent to V8DebugService. In all other cases, the
- //expression is evaluated by QDeclarativeEngine.
- if (state() != InferiorStopOk) {
- QmlInspectorAgent *agent = m_inspectorAdapter.agent();
- quint32 queryId
- = agent->queryExpressionResult(
- m_inspectorAdapter.currentSelectedDebugId(),
- expression);
- if (queryId) {
- queryIds << queryId;
- } else {
- didEvaluate = false;
- qtMessageLogHandler()->
- appendItem(
- new QtMessageLogItem(
- qtMessageLogHandler()->root(),
- QtMessageLogHandler::ErrorType,
- _("Error evaluating expression.")));
- }
- } else {
- executeDebuggerCommand(expression, QmlLanguage);
- }
+ // Evaluate expression based on engine state
+ // When engine->state() == InferiorStopOk, the expression is sent to debuggerClient.
+ if (state() != InferiorStopOk) {
+ QmlInspectorAgent *agent = m_inspectorAdapter.agent();
+ quint32 queryId = agent->queryExpressionResult(m_inspectorAdapter.currentSelectedDebugId(),
+ expression);
+ if (queryId) {
+ queryIds << queryId;
} else {
didEvaluate = false;
+ using namespace QmlJSTools;
+ QmlConsoleManager *consoleManager = QmlConsoleManager::instance();
+ if (consoleManager) {
+ consoleManager->printToConsolePane(QmlConsoleItem::ErrorType,
+ _("Error evaluating expression."));
+ }
}
+ } else {
+ executeDebuggerCommand(expression, QmlLanguage);
}
return didEvaluate;
}
@@ -1269,48 +1309,6 @@ bool QmlEngine::canEvaluateScript(const QString &script)
return m_interpreter.canEvaluate();
}
-QtMessageLogItem *QmlEngine::constructLogItemTree(
- QtMessageLogItem *parent, const QVariant &result, const QString &key)
-{
- if (!result.isValid())
- return 0;
-
- QtMessageLogItem *item = new QtMessageLogItem(parent);
- if (result.type() == QVariant::Map) {
- if (key.isEmpty())
- item->setText(_("Object"));
- else
- item->setText(key + _(" : Object"));
-
- QMapIterator<QString, QVariant> i(result.toMap());
- while (i.hasNext()) {
- i.next();
- QtMessageLogItem *child = constructLogItemTree(item,
- i.value(), i.key());
- if (child)
- item->insertChild(child);
- }
- } else if (result.type() == QVariant::List) {
- if (key.isEmpty())
- item->setText(_("List"));
- else
- item->setText(QString(_("[%1] : List")).arg(key));
- QVariantList resultList = result.toList();
- for (int i = 0; i < resultList.count(); i++) {
- QtMessageLogItem *child = constructLogItemTree(item, resultList.at(i),
- QString::number(i));
- if (child)
- item->insertChild(child);
- }
- } else if (result.canConvert(QVariant::String)) {
- item->setText(result.toString());
- } else {
- item->setText(_("Unknown Value"));
- }
-
- return item;
-}
-
bool QmlEngine::adjustBreakpointLineAndColumn(
const QString &filePath, quint32 *line, quint32 *column, bool *valid)
{
diff --git a/src/plugins/debugger/qml/qmlengine.h b/src/plugins/debugger/qml/qmlengine.h
index 8cef4dc3ed..79b9d8c491 100644
--- a/src/plugins/debugger/qml/qmlengine.h
+++ b/src/plugins/debugger/qml/qmlengine.h
@@ -52,7 +52,6 @@ namespace Debugger {
namespace Internal {
class QmlAdapter;
-class QtMessageLogItem;
class QmlEngine : public DebuggerEngine
{
@@ -180,9 +179,6 @@ private:
void updateEditor(Core::IEditor *editor, const QTextDocument *document);
bool canEvaluateScript(const QString &script);
- QtMessageLogItem *constructLogItemTree(QtMessageLogItem *parent,
- const QVariant &result,
- const QString &key = QString());
bool adjustBreakpointLineAndColumn(const QString &filePath, quint32 *line,
quint32 *column, bool *valid);
diff --git a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp
index ea47c72c35..bafc4778ba 100644
--- a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp
+++ b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp
@@ -36,12 +36,16 @@
#include "breakhandler.h"
#include "qmlengine.h"
#include "stackhandler.h"
-#include "qtmessageloghandler.h"
+#include "debuggercore.h"
+#include "debuggeractions.h"
#include <utils/qtcassert.h>
#include <coreplugin/editormanager/editormanager.h>
#include <texteditor/basetexteditor.h>
+#include <qmljstools/qmlconsoleitem.h>
+#include <qmljstools/qmlconsolemanager.h>
+
#include <QTextBlock>
#include <QVariant>
#include <QStack>
@@ -116,19 +120,14 @@ public:
void version();
//void profile(ProfileCommand command); //NOT SUPPORTED
void gc();
-
- QmlV8ObjectData extractData(const QVariant &data, const QVariant &refsVal);
void clearCache();
void logSendMessage(const QString &msg) const;
void logReceiveMessage(const QString &msg) const;
- QtMessageLogItem *constructLogItemTree(QtMessageLogItem *parent,
- const QmlV8ObjectData &objectData, const QVariant &refsVal);
private:
QByteArray packMessage(const QByteArray &type, const QByteArray &message = QByteArray());
QScriptValue initObject();
- QVariant valueFromRef(int handle, const QVariant &refsVal, bool *success);
public:
QmlV8DebuggerClient *q;
@@ -761,8 +760,23 @@ void QmlV8DebuggerClientPrivate::gc()
q->sendMessage(packMessage(V8REQUEST, jsonMessage.toString().toUtf8()));
}
-QmlV8ObjectData QmlV8DebuggerClientPrivate::extractData(const QVariant &data,
- const QVariant &refsVal)
+QVariant valueFromRef(int handle, const QVariant &refsVal, bool *success)
+{
+ *success = false;
+ QVariant variant;
+ const QVariantList refs = refsVal.toList();
+ foreach (const QVariant &ref, refs) {
+ const QVariantMap refData = ref.toMap();
+ if (refData.value(_(HANDLE)).toInt() == handle) {
+ variant = refData;
+ *success = true;
+ break;
+ }
+ }
+ return variant;
+}
+
+QmlV8ObjectData extractData(const QVariant &data, const QVariant &refsVal)
{
// { "handle" : <handle>,
// "type" : <"undefined", "null", "boolean", "number", "string", "object", "function" or "frame">
@@ -900,24 +914,6 @@ QScriptValue QmlV8DebuggerClientPrivate::initObject()
return jsonVal;
}
-QVariant QmlV8DebuggerClientPrivate::valueFromRef(int handle,
- const QVariant &refsVal,
- bool *success)
-{
- *success = false;
- QVariant variant;
- const QVariantList refs = refsVal.toList();
- foreach (const QVariant &ref, refs) {
- const QVariantMap refData = ref.toMap();
- if (refData.value(_(HANDLE)).toInt() == handle) {
- variant = refData;
- *success = true;
- break;
- }
- }
- return variant;
-}
-
void QmlV8DebuggerClientPrivate::logSendMessage(const QString &msg) const
{
if (engine)
@@ -930,34 +926,6 @@ void QmlV8DebuggerClientPrivate::logReceiveMessage(const QString &msg) const
engine->logMessage(QLatin1String("V8DebuggerClient"), QmlEngine::LogReceive, msg);
}
-QtMessageLogItem *QmlV8DebuggerClientPrivate::constructLogItemTree(
- QtMessageLogItem *parent,
- const QmlV8ObjectData &objectData,
- const QVariant &refsVal)
-{
- if (!objectData.value.isValid())
- return 0;
-
- QString text;
- if (objectData.name.isEmpty())
- text = objectData.value.toString();
- else
- text = QString(_("%1: %2")).arg(QString::fromAscii(objectData.name))
- .arg(objectData.value.toString());
-
- QtMessageLogItem *item = new QtMessageLogItem(parent,
- QtMessageLogHandler::UndefinedType, text);
-
- foreach (const QVariant &property, objectData.properties) {
- QtMessageLogItem *child = constructLogItemTree(
- item, extractData(property, refsVal), refsVal);
- if (child)
- item->insertChild(child);
- }
-
- return item;
-}
-
///////////////////////////////////////////////////////////////////////
//
// QmlV8DebuggerClient
@@ -1125,9 +1093,8 @@ void QmlV8DebuggerClient::assignValueInDebugger(const WatchData * /*data*/,
d->evaluate(expression, false, false, stackHandler->currentIndex());
d->updateLocalsAndWatchers.append(d->sequence);
} else {
- d->engine->showMessage(QString(_("Cannot evaluate"
- "%1 in current stack frame")).
- arg(expression), QtMessageLogOutput);
+ d->engine->showMessage(QString(_("Cannot evaluate %1 in current stack frame")).arg(
+ expression), ConsoleOutput);
}
}
@@ -1144,9 +1111,8 @@ void QmlV8DebuggerClient::executeDebuggerCommand(const QString &command)
d->debuggerCommands.append(d->sequence);
} else {
//Currently cannot evaluate if not in a javascript break
- d->engine->showMessage(QString(_("Cannot evaluate %1"
- "in current stack frame")).
- arg(command), QtMessageLogOutput);
+ d->engine->showMessage(QString(_("Cannot evaluate %1 in current stack frame")).arg(
+ command), ConsoleOutput);
}
}
@@ -1629,17 +1595,17 @@ StackFrame QmlV8DebuggerClient::extractStackFrame(const QVariant &bodyVal, const
return stackFrame;
}
- QmlV8ObjectData objectData = d->extractData(body.value(_("func")), refsVal);
+ QmlV8ObjectData objectData = extractData(body.value(_("func")), refsVal);
QString functionName = objectData.value.toString();
if (functionName.isEmpty())
functionName = tr("Anonymous Function");
stackFrame.function = functionName;
- objectData = d->extractData(body.value(_("script")), refsVal);
+ objectData = extractData(body.value(_("script")), refsVal);
stackFrame.file = d->engine->toFileInProject(objectData.value.toString());
stackFrame.usable = QFileInfo(stackFrame.file).isReadable();
- objectData = d->extractData(body.value(_("receiver")), refsVal);
+ objectData = extractData(body.value(_("receiver")), refsVal);
stackFrame.to = objectData.value.toString();
stackFrame.line = body.value(_("line")).toInt() + 1;
@@ -1690,8 +1656,7 @@ void QmlV8DebuggerClient::setCurrentFrameDetails(const QVariant &bodyVal, const
data.exp = QByteArray("this");
data.name = QLatin1String(data.exp);
data.iname = QByteArray("local.") + data.exp;
- QmlV8ObjectData objectData = d->extractData(
- currentFrame.value(_("receiver")), refsVal);
+ QmlV8ObjectData objectData = extractData(currentFrame.value(_("receiver")), refsVal);
data.id = objectData.handle;
data.type = objectData.type;
data.value = objectData.value.toString();
@@ -1748,12 +1713,12 @@ void QmlV8DebuggerClient::updateScope(const QVariant &bodyVal, const QVariant &r
if (bodyMap.value(_("frameIndex")).toInt() != stackHandler->currentIndex())
return;
- QmlV8ObjectData objectData = d->extractData(bodyMap.value(_("object")), refsVal);
+ QmlV8ObjectData objectData = extractData(bodyMap.value(_("object")), refsVal);
QList<int> handlesToLookup;
QList<WatchData> locals;
foreach (const QVariant &property, objectData.properties) {
- QmlV8ObjectData localData = d->extractData(property, refsVal);
+ QmlV8ObjectData localData = extractData(property, refsVal);
WatchData data;
data.exp = localData.name;
//Check for v8 specific local data
@@ -1783,9 +1748,37 @@ void QmlV8DebuggerClient::updateScope(const QVariant &bodyVal, const QVariant &r
d->engine->watchHandler()->insertData(locals);
}
-void QmlV8DebuggerClient::updateEvaluationResult(int sequence, bool success, const QVariant &bodyVal,
+QmlJSTools::QmlConsoleItem *constructLogItemTree(QmlJSTools::QmlConsoleItem *parent,
+ const QmlV8ObjectData &objectData,
const QVariant &refsVal)
{
+ using namespace QmlJSTools;
+ bool sorted = debuggerCore()->boolSetting(SortStructMembers);
+ if (!objectData.value.isValid())
+ return 0;
+
+ QString text;
+ if (objectData.name.isEmpty())
+ text = objectData.value.toString();
+ else
+ text = QString(_("%1: %2")).arg(QString::fromAscii(objectData.name))
+ .arg(objectData.value.toString());
+
+ QmlConsoleItem *item = new QmlConsoleItem(parent, QmlConsoleItem::UndefinedType, text);
+
+ foreach (const QVariant &property, objectData.properties) {
+ QmlConsoleItem *child = constructLogItemTree(item, extractData(property, refsVal),
+ refsVal);
+ if (child)
+ item->insertChild(child, sorted);
+ }
+
+ return item;
+}
+
+void QmlV8DebuggerClient::updateEvaluationResult(int sequence, bool success,
+ const QVariant &bodyVal, const QVariant &refsVal)
+{
// { "seq" : <number>,
// "type" : "response",
// "request_seq" : <number>,
@@ -1808,17 +1801,20 @@ void QmlV8DebuggerClient::updateEvaluationResult(int sequence, bool success, con
} else if (d->debuggerCommands.contains(sequence)) {
d->updateLocalsAndWatchers.removeOne(sequence);
- QmlV8ObjectData body = d->extractData(bodyVal, refsVal);
- QtMessageLogItem *item = d->constructLogItemTree(d->engine->qtMessageLogHandler()->root(),
- body, refsVal);
- if (item)
- d->engine->qtMessageLogHandler()->appendItem(item);
+ QmlV8ObjectData body = extractData(bodyVal, refsVal);
+ using namespace QmlJSTools;
+ QmlConsoleManager *consoleManager = QmlConsoleManager::instance();
+ if (consoleManager) {
+ QmlConsoleItem *item = constructLogItemTree(consoleManager->rootItem(), body, refsVal);
+ if (item)
+ consoleManager->printToConsolePane(item);
+ }
//Update the locals
foreach (int index, d->currentFrameScopes)
d->scope(index);
} else {
- QmlV8ObjectData body = d->extractData(bodyVal, refsVal);
+ QmlV8ObjectData body = extractData(bodyVal, refsVal);
if (d->evaluatingExpression.contains(sequence)) {
QString exp = d->evaluatingExpression.take(sequence);
QList<WatchData> watchDataList;
@@ -1917,7 +1913,7 @@ void QmlV8DebuggerClient::expandLocalsAndWatchers(const QVariant &bodyVal, const
QStringList handlesList = body.keys();
WatchHandler *watchHandler = d->engine->watchHandler();
foreach (const QString &handle, handlesList) {
- QmlV8ObjectData bodyObjectData = d->extractData(
+ QmlV8ObjectData bodyObjectData = extractData(
body.value(handle), refsVal);
QByteArray prepend = d->localsAndWatchers.take(handle.toInt());
@@ -1954,7 +1950,7 @@ QList<WatchData> QmlV8DebuggerClient::createWatchDataList(const WatchData *paren
if (properties.count()) {
QTC_ASSERT(parent, return watchDataList);
foreach (const QVariant &property, properties) {
- QmlV8ObjectData propertyData = d->extractData(property, refsVal);
+ QmlV8ObjectData propertyData = extractData(property, refsVal);
WatchData data;
data.name = QString::fromUtf8(propertyData.name);
@@ -2020,7 +2016,7 @@ void QmlV8DebuggerClient::highlightExceptionCode(int lineNumber,
QString message = QString(_("%1: %2: %3")).arg(filePath).arg(lineNumber)
.arg(errorMessage);
- d->engine->showMessage(message, QtMessageLogOutput);
+ d->engine->showMessage(message, ConsoleOutput);
}
}
}
diff --git a/src/plugins/debugger/qml/qscriptdebuggerclient.cpp b/src/plugins/debugger/qml/qscriptdebuggerclient.cpp
index cf1e8d9490..12d948502c 100644
--- a/src/plugins/debugger/qml/qscriptdebuggerclient.cpp
+++ b/src/plugins/debugger/qml/qscriptdebuggerclient.cpp
@@ -513,7 +513,7 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
if (iname.startsWith("watch.")) {
watchHandler->insertIncompleteData(data);
} else if (iname == "console") {
- d->engine->showMessage(data.value, QtMessageLogOutput);
+ d->engine->showMessage(data.value, ConsoleOutput);
} else if (iname.startsWith("local.")) {
data.name = data.name.left(data.name.indexOf(QLatin1Char(' ')));
watchHandler->insertIncompleteData(data);
diff --git a/src/plugins/debugger/qtmessageloghandler.cpp b/src/plugins/debugger/qtmessageloghandler.cpp
deleted file mode 100644
index 2247200a61..0000000000
--- a/src/plugins/debugger/qtmessageloghandler.cpp
+++ /dev/null
@@ -1,405 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 "qtmessageloghandler.h"
-#include "debuggercore.h"
-#include "debuggeractions.h"
-
-#include <utils/qtcassert.h>
-
-#include <QFontMetrics>
-
-namespace Debugger {
-namespace Internal {
-
-///////////////////////////////////////////////////////////////////////
-//
-// QtMessageLogItem
-//
-///////////////////////////////////////////////////////////////////////
-
-QtMessageLogItem::QtMessageLogItem(QtMessageLogItem *parent,
- QtMessageLogHandler::ItemType itemType, const QString &text)
- : m_parentItem(parent),
- itemType(itemType),
- line(-1)
-
-{
- setText(text);
-}
-
-QtMessageLogItem::~QtMessageLogItem()
-{
- qDeleteAll(m_childItems);
-}
-
-QtMessageLogItem *QtMessageLogItem::child(int number)
-{
- return m_childItems.value(number);
-}
-
-int QtMessageLogItem::childCount() const
-{
- return m_childItems.size();
-}
-
-int QtMessageLogItem::childNumber() const
-{
- if (m_parentItem)
- return m_parentItem->m_childItems.indexOf(
- const_cast<QtMessageLogItem *>(this));
-
- return 0;
-}
-
-bool QtMessageLogItem::insertChildren(int position, int count)
-{
- if (position < 0 || position > m_childItems.size())
- return false;
-
- for (int row = 0; row < count; ++row) {
- QtMessageLogItem *item = new
- QtMessageLogItem(this , QtMessageLogHandler::UndefinedType,
- QString());
- m_childItems.insert(position, item);
- }
-
- return true;
-}
-
-void QtMessageLogItem::insertChild(QtMessageLogItem *item)
-{
- if (!debuggerCore()->boolSetting(SortStructMembers)) {
- m_childItems.insert(m_childItems.count(), item);
- return;
- }
-
- int i = 0;
- for (; i < m_childItems.count(); i++) {
- if (item->m_text < m_childItems[i]->m_text) {
- break;
- }
- }
- m_childItems.insert(i, item);
-}
-
-bool QtMessageLogItem::insertChild(int position, QtMessageLogItem *item)
-{
- if (position < 0 || position > m_childItems.size())
- return false;
-
- m_childItems.insert(position, item);
-
- return true;
-}
-
-QtMessageLogItem *QtMessageLogItem::parent()
-{
- return m_parentItem;
-}
-
-bool QtMessageLogItem::removeChildren(int position, int count)
-{
- if (position < 0 || position + count > m_childItems.size())
- return false;
-
- for (int row = 0; row < count; ++row)
- delete m_childItems.takeAt(position);
-
- return true;
-}
-
-bool QtMessageLogItem::detachChild(int position)
-{
- if (position < 0 || position > m_childItems.size())
- return false;
-
- m_childItems.removeAt(position);
-
- return true;
-}
-
-void QtMessageLogItem::setText(const QString &text)
-{
- m_text = text;
- for (int i = 0; i < m_text.length(); ++i) {
- if (m_text.at(i).isPunct())
- m_text.insert(++i, QChar(0x200b)); // ZERO WIDTH SPACE
- }
-}
-
-const QString &QtMessageLogItem::text() const
-{
- return m_text;
-}
-
-///////////////////////////////////////////////////////////////////////
-//
-// QtMessageLogHandler
-//
-///////////////////////////////////////////////////////////////////////
-
-QtMessageLogHandler::QtMessageLogHandler(QObject *parent) :
- QAbstractItemModel(parent),
- m_hasEditableRow(false),
- m_rootItem(new QtMessageLogItem(0)),
- m_maxSizeOfFileName(0)
-{
-}
-
-QtMessageLogHandler::~QtMessageLogHandler()
-{
- delete m_rootItem;
-}
-
-void QtMessageLogHandler::clear()
-{
- beginResetModel();
- reset();
- delete m_rootItem;
- m_rootItem = new QtMessageLogItem(0);
- endResetModel();
-
- if (m_hasEditableRow)
- appendEditableRow();
-}
-
-bool QtMessageLogHandler::appendItem(QtMessageLogItem *item, int position)
-{
- if (position < 0)
- position = m_rootItem->childCount() - 1;
-
- beginInsertRows(QModelIndex(), position, position);
- bool success = m_rootItem->insertChild(position, item);
- endInsertRows();
-
- return success;
-}
-
-bool QtMessageLogHandler::appendMessage(QtMessageLogHandler::ItemType itemType,
- const QString &message, int position)
-{
- return appendItem(new QtMessageLogItem(m_rootItem, itemType, message), position);
-}
-
-void QtMessageLogHandler::setHasEditableRow(bool hasEditableRow)
-{
- if (m_hasEditableRow && !hasEditableRow)
- removeEditableRow();
-
- if (!m_hasEditableRow && hasEditableRow)
- appendEditableRow();
-
- m_hasEditableRow = hasEditableRow;
-}
-
-bool QtMessageLogHandler::hasEditableRow() const
-{
- return m_hasEditableRow;
-}
-
-void QtMessageLogHandler::appendEditableRow()
-{
- int position = m_rootItem->childCount();
- if (appendItem(new QtMessageLogItem(m_rootItem, QtMessageLogHandler::InputType), position))
- emit selectEditableRow(index(position, 0),
- QItemSelectionModel::ClearAndSelect);
-}
-
-void QtMessageLogHandler::removeEditableRow()
-{
- if (m_rootItem->child(m_rootItem->childCount() - 1)->itemType ==
- QtMessageLogHandler::InputType)
- removeRow(m_rootItem->childCount() - 1);
-}
-
-int QtMessageLogHandler::sizeOfFile(const QFont &font)
-{
- int lastReadOnlyRow = m_rootItem->childCount();
- if (m_hasEditableRow)
- lastReadOnlyRow -= 2;
- else
- lastReadOnlyRow -= 1;
- if (lastReadOnlyRow < 0)
- return 0;
- QString filename = m_rootItem->child(lastReadOnlyRow)->file;
- const int pos = filename.lastIndexOf(QLatin1Char('/'));
- if (pos != -1)
- filename = filename.mid(pos + 1);
-
- QFontMetrics fm(font);
- m_maxSizeOfFileName = qMax(m_maxSizeOfFileName, fm.width(filename));
-
- return m_maxSizeOfFileName;
-}
-
-int QtMessageLogHandler::sizeOfLineNumber(const QFont &font)
-{
- QFontMetrics fm(font);
- return fm.width(QLatin1String("88888"));
-}
-
-QVariant QtMessageLogHandler::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid())
- return QVariant();
-
- QtMessageLogItem *item = getItem(index);
-
- if (role == Qt::DisplayRole )
- return item->text();
- else if (role == QtMessageLogHandler::TypeRole)
- return int(item->itemType);
- else if (role == QtMessageLogHandler::FileRole)
- return item->file;
- else if (role == QtMessageLogHandler::LineRole)
- return item->line;
- else
- return QVariant();
-}
-
-QModelIndex QtMessageLogHandler::index(int row, int column,
- const QModelIndex &parent) const
-{
- if (parent.isValid() && parent.column() != 0)
- return QModelIndex();
-
- if (column > 0)
- return QModelIndex();
-
- QtMessageLogItem *parentItem = getItem(parent);
-
- QtMessageLogItem *childItem = parentItem->child(row);
- if (childItem)
- return createIndex(row, column, childItem);
- else
- return QModelIndex();
-}
-
-QModelIndex QtMessageLogHandler::parent(const QModelIndex &index) const
-{
- if (!index.isValid())
- return QModelIndex();
-
- QtMessageLogItem *childItem = getItem(index);
- QtMessageLogItem *parentItem = childItem->parent();
-
- if (parentItem == m_rootItem)
- return QModelIndex();
-
- //can parentItem be 0?
- if (!parentItem)
- return QModelIndex();
- return createIndex(parentItem->childNumber(), 0, parentItem);
-}
-
-int QtMessageLogHandler::rowCount(const QModelIndex &parent) const
-{
- QtMessageLogItem *parentItem = getItem(parent);
-
- return parentItem->childCount();
-}
-
-int QtMessageLogHandler::columnCount(const QModelIndex & /* parent */) const
-{
- return 1;
-}
-
-Qt::ItemFlags QtMessageLogHandler::flags(const QModelIndex &index) const
-{
- if (!index.isValid())
- return 0;
-
- QtMessageLogItem *item = getItem(index);
- if (m_hasEditableRow && item->parent() == m_rootItem
- && index.row() == m_rootItem->childCount() - 1)
- return Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
- return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
-}
-
-bool QtMessageLogHandler::setData(const QModelIndex &index, const QVariant &value,
- int role)
-{
- QtMessageLogItem *item = getItem(index);
- bool result = false;
- if (role == Qt::DisplayRole) {
- item->setText(value.toString());
- result = true;
- } else if (role == QtMessageLogHandler::TypeRole) {
- item->itemType = (QtMessageLogHandler::ItemType)value.toInt();
- result = true;
- } else if (role == QtMessageLogHandler::FileRole) {
- item->file = value.toString();
- result = true;
- } else if (role == QtMessageLogHandler::LineRole) {
- item->line = value.toInt();
- result = true;
- }
-
- if (result)
- emit dataChanged(index, index);
-
- return result;
-}
-
-bool QtMessageLogHandler::insertRows(int position, int rows, const QModelIndex &parent)
-{
- QtMessageLogItem *parentItem = getItem(parent);
- bool success;
-
- beginInsertRows(parent, position, position + rows - 1);
- success = parentItem->insertChildren(position, rows);
- endInsertRows();
-
- return success;
-}
-
-bool QtMessageLogHandler::removeRows(int position, int rows, const QModelIndex &parent)
-{
- QtMessageLogItem *parentItem = getItem(parent);
- bool success = true;
-
- beginRemoveRows(parent, position, position + rows - 1);
- success = parentItem->removeChildren(position, rows);
- endRemoveRows();
-
- return success;
-}
-
-QtMessageLogItem *QtMessageLogHandler::getItem(const QModelIndex &index) const
-{
- if (index.isValid()) {
- QtMessageLogItem *item = static_cast<QtMessageLogItem*>(index.internalPointer());
- if (item) return item;
- }
- return m_rootItem;
-}
-
-} //Internal
-} //Debugger
diff --git a/src/plugins/debugger/qtmessageloghandler.h b/src/plugins/debugger/qtmessageloghandler.h
deleted file mode 100644
index 4452823b0a..0000000000
--- a/src/plugins/debugger/qtmessageloghandler.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 QTMESSAGELOGHANDLER_H
-#define QTMESSAGELOGHANDLER_H
-
-#include <QAbstractItemModel>
-#include <QItemSelectionModel>
-#include <QFont>
-
-namespace Debugger {
-namespace Internal {
-
-class QtMessageLogItem;
-class QtMessageLogHandler : public QAbstractItemModel
-{
- Q_OBJECT
-
-public:
- enum ItemType
- {
- InputType = 0x01,
- DebugType = 0x02,
- WarningType = 0x04,
- ErrorType = 0x08,
- UndefinedType = 0x10, //Can be used for unknown and for Return values
- DefaultTypes = InputType | UndefinedType
- };
- Q_DECLARE_FLAGS(ItemTypes, ItemType)
-
- enum Roles { TypeRole = Qt::UserRole, FileRole, LineRole };
-
- explicit QtMessageLogHandler(QObject *parent = 0);
- ~QtMessageLogHandler();
-
- void setHasEditableRow(bool hasEditableRow);
- bool hasEditableRow() const;
- void appendEditableRow();
- void removeEditableRow();
-
- bool appendItem(QtMessageLogItem *item, int position = -1);
- bool appendMessage(QtMessageLogHandler::ItemType itemType,
- const QString &message, int position = -1);
-
- QAbstractItemModel *model() { return this; }
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
- int sizeOfFile(const QFont &font);
- int sizeOfLineNumber(const QFont &font);
-
- QtMessageLogItem *root() const { return m_rootItem; }
-
-public slots:
- void clear();
-
-signals:
- void selectEditableRow(const QModelIndex &index,
- QItemSelectionModel::SelectionFlags flags);
- void rowInserted(const QModelIndex &index);
-
-protected:
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
- QModelIndex index(int row, int column,
- const QModelIndex &parent = QModelIndex()) const;
- QModelIndex parent(const QModelIndex &index) const;
-
-
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
-
- Qt::ItemFlags flags(const QModelIndex &index) const;
- bool setData(const QModelIndex &index, const QVariant &value,
- int role = Qt::EditRole);
-
- bool insertRows(int position, int rows,
- const QModelIndex &parent = QModelIndex());
- bool removeRows(int position, int rows,
- const QModelIndex &parent = QModelIndex());
-
- QtMessageLogItem *getItem(const QModelIndex &index) const;
-
-private:
- bool m_hasEditableRow;
- QtMessageLogItem *m_rootItem;
- int m_maxSizeOfFileName;
-};
-
-class QtMessageLogItem
-{
-public:
- QtMessageLogItem(QtMessageLogItem *parent,
- QtMessageLogHandler::ItemType type = QtMessageLogHandler::UndefinedType,
- const QString &data = QString());
- ~QtMessageLogItem();
-
- QtMessageLogItem *child(int number);
- int childCount() const;
- bool insertChildren(int position, int count);
- void insertChild(QtMessageLogItem *item);
- bool insertChild(int position, QtMessageLogItem *item);
- QtMessageLogItem *parent();
- bool removeChildren(int position, int count);
- bool detachChild(int position);
- int childNumber() const;
- void setText(const QString &text);
- const QString &text() const;
-
-private:
- QtMessageLogItem *m_parentItem;
- QList<QtMessageLogItem *> m_childItems;
- QString m_text;
-
-public:
- QtMessageLogHandler::ItemType itemType;
- QString file;
- int line;
-};
-
-} //Internal
-} //Debugger
-
-#endif // QTMESSAGELOGHANDLER_H
diff --git a/src/plugins/debugger/qtmessagelogwindow.cpp b/src/plugins/debugger/qtmessagelogwindow.cpp
deleted file mode 100644
index a617cf080a..0000000000
--- a/src/plugins/debugger/qtmessagelogwindow.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 "qtmessagelogwindow.h"
-#include "qtmessagelogview.h"
-#include "qtmessageloghandler.h"
-#include "qtmessagelogitemdelegate.h"
-#include "debuggerstringutils.h"
-#include "qtmessagelogproxymodel.h"
-
-#include <utils/statuslabel.h>
-#include <utils/styledbar.h>
-#include <utils/savedaction.h>
-
-#include <coreplugin/icore.h>
-#include <coreplugin/coreconstants.h>
-#include <coreplugin/findplaceholder.h>
-
-#include <aggregation/aggregate.h>
-#include <find/treeviewfind.h>
-
-#include <QSettings>
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QToolButton>
-
-static const char CONSOLE[] = "Console";
-static const char SHOW_LOG[] = "showLog";
-static const char SHOW_WARNING[] = "showWarning";
-static const char SHOW_ERROR[] = "showError";
-
-namespace Debugger {
-namespace Internal {
-
-/////////////////////////////////////////////////////////////////////
-//
-// QtMessageLogWindow
-//
-/////////////////////////////////////////////////////////////////////
-
-QtMessageLogWindow::QtMessageLogWindow(QWidget *parent)
- : QWidget(parent)
-{
- setWindowTitle(tr(CONSOLE));
- setObjectName(_(CONSOLE));
-
- const int statusBarHeight = 25;
-
- QVBoxLayout *vbox = new QVBoxLayout(this);
- vbox->setMargin(0);
- vbox->setSpacing(0);
-
- QWidget *statusbarContainer = new Utils::StyledBar();
- statusbarContainer->setStyleSheet(QLatin1String("background: #9B9B9B"));
- statusbarContainer->setFixedHeight(statusBarHeight);
- QHBoxLayout *hbox = new QHBoxLayout(statusbarContainer);
- hbox->setMargin(0);
- hbox->setSpacing(0);
-
- hbox->addSpacing(5);
-
- //Status Label
- m_statusLabel = new Utils::StatusLabel;
- hbox->addWidget(m_statusLabel);
- hbox->addWidget(new Utils::StyledSeparator);
-
- const int buttonWidth = 25;
- //Filters
- QToolButton *button = new QToolButton(this);
- button->setAutoRaise(true);
- button->setFixedWidth(buttonWidth);
- m_showLogAction = new Utils::SavedAction(this);
- m_showLogAction->setDefaultValue(true);
- m_showLogAction->setSettingsKey(_(CONSOLE), _(SHOW_LOG));
- m_showLogAction->setText(tr("Log"));
- m_showLogAction->setToolTip(tr("Show debug, log, and info messages."));
- m_showLogAction->setCheckable(true);
- m_showLogAction->setIcon(QIcon(_(":/debugger/images/log.png")));
- button->setDefaultAction(m_showLogAction);
- hbox->addWidget(button);
-
- button = new QToolButton(this);
- button->setAutoRaise(true);
- button->setFixedWidth(buttonWidth);
- m_showWarningAction = new Utils::SavedAction(this);
- m_showWarningAction->setDefaultValue(true);
- m_showWarningAction->setSettingsKey(_(CONSOLE), _(SHOW_WARNING));
- m_showWarningAction->setText(tr("Warning"));
- m_showWarningAction->setToolTip(tr("Show warning messages."));
- m_showWarningAction->setCheckable(true);
- m_showWarningAction->setIcon(QIcon(_(":/debugger/images/warning.png")));
- button->setDefaultAction(m_showWarningAction);
- hbox->addWidget(button);
-
- button = new QToolButton(this);
- button->setAutoRaise(true);
- button->setFixedWidth(buttonWidth);
- m_showErrorAction = new Utils::SavedAction(this);
- m_showErrorAction->setDefaultValue(true);
- m_showErrorAction->setSettingsKey(_(CONSOLE), _(SHOW_ERROR));
- m_showErrorAction->setText(tr("Error"));
- m_showErrorAction->setToolTip(tr("Show error and fatal messages."));
- m_showErrorAction->setCheckable(true);
- m_showErrorAction->setIcon(QIcon(_(":/debugger/images/error.png")));
- button->setDefaultAction(m_showErrorAction);
- hbox->addWidget(button);
- hbox->addWidget(new Utils::StyledSeparator);
-
- //Clear Button
- button = new QToolButton;
- button->setAutoRaise(true);
- button->setFixedWidth(buttonWidth);
- m_clearAction = new QAction(tr("Clear Console"), this);
- m_clearAction->setIcon(QIcon(_(Core::Constants::ICON_CLEAN_PANE)));
- button->setDefaultAction(m_clearAction);
- hbox->addWidget(button);
- hbox->addWidget(new Utils::StyledSeparator);
-
- m_treeView = new QtMessageLogView(this);
- m_treeView->setSizePolicy(QSizePolicy::MinimumExpanding,
- QSizePolicy::MinimumExpanding);
-
- m_proxyModel = new QtMessageLogProxyModel(this);
- connect(m_showLogAction, SIGNAL(toggled(bool)),
- m_proxyModel, SLOT(setShowLogs(bool)));
- connect(m_showWarningAction, SIGNAL(toggled(bool)),
- m_proxyModel, SLOT(setShowWarnings(bool)));
- connect(m_showErrorAction, SIGNAL(toggled(bool)),
- m_proxyModel, SLOT(setShowErrors(bool)));
-
- m_treeView->setModel(m_proxyModel);
- connect(m_proxyModel,
- SIGNAL(setCurrentIndex(QModelIndex,QItemSelectionModel::SelectionFlags)),
- m_treeView->selectionModel(),
- SLOT(setCurrentIndex(QModelIndex,QItemSelectionModel::SelectionFlags)));
- connect(m_proxyModel,
- SIGNAL(scrollToBottom()),
- m_treeView,
- SLOT(onScrollToBottom()));
-
- m_itemDelegate = new QtMessageLogItemDelegate(this);
- connect(m_treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
- m_itemDelegate, SLOT(currentChanged(QModelIndex,QModelIndex)));
- m_treeView->setItemDelegate(m_itemDelegate);
-
- vbox->addWidget(statusbarContainer);
- vbox->addWidget(m_treeView);
- vbox->addWidget(new Core::FindToolBarPlaceHolder(this));
-
- readSettings();
- connect(Core::ICore::instance(),
- SIGNAL(saveSettingsRequested()), SLOT(writeSettings()));
-
- Aggregation::Aggregate *aggregate = new Aggregation::Aggregate();
- aggregate->add(m_treeView);
- aggregate->add(new Find::TreeViewFind(m_treeView));
-}
-
-QtMessageLogWindow::~QtMessageLogWindow()
-{
- writeSettings();
-}
-
-void QtMessageLogWindow::readSettings()
-{
- QSettings *settings = Core::ICore::settings();
- m_showLogAction->readSettings(settings);
- m_showWarningAction->readSettings(settings);
- m_showErrorAction->readSettings(settings);
-}
-
-void QtMessageLogWindow::showStatus(const QString &context, int timeout)
-{
- m_statusLabel->showStatusMessage(context, timeout);
-}
-
-void QtMessageLogWindow::writeSettings() const
-{
- QSettings *settings = Core::ICore::settings();
- m_showLogAction->writeSettings(settings);
- m_showWarningAction->writeSettings(settings);
- m_showErrorAction->writeSettings(settings);
-}
-
-void QtMessageLogWindow::setModel(QAbstractItemModel *model)
-{
- QtMessageLogHandler *oldHandler = qobject_cast<QtMessageLogHandler *>(
- m_proxyModel->sourceModel());
- if (oldHandler) {
- disconnect(m_clearAction, SIGNAL(triggered()), oldHandler, SLOT(clear()));
- disconnect(oldHandler,
- SIGNAL(selectEditableRow(
- QModelIndex,QItemSelectionModel::SelectionFlags)),
- m_proxyModel,
- SLOT(selectEditableRow(
- QModelIndex,QItemSelectionModel::SelectionFlags)));
- disconnect(oldHandler,
- SIGNAL(rowsInserted(QModelIndex,int,int)),
- m_proxyModel,
- SLOT(onRowsInserted(QModelIndex,int,int)));
- }
-
- QtMessageLogHandler *newHandler = qobject_cast<QtMessageLogHandler *>(model);
- m_proxyModel->setSourceModel(newHandler);
- m_itemDelegate->setItemModel(newHandler);
-
- if (newHandler) {
- connect(m_clearAction, SIGNAL(triggered()), newHandler, SLOT(clear()));
- connect(newHandler,
- SIGNAL(selectEditableRow(
- QModelIndex,QItemSelectionModel::SelectionFlags)),
- m_proxyModel,
- SLOT(selectEditableRow(
- QModelIndex,QItemSelectionModel::SelectionFlags)));
-
- //Scroll to bottom when rows matching current filter settings are inserted
- //Not connecting rowsRemoved as the only way to remove rows is to clear the
- //model which will automatically reset the view.
- connect(newHandler,
- SIGNAL(rowsInserted(QModelIndex,int,int)),
- m_proxyModel,
- SLOT(onRowsInserted(QModelIndex,int,int)));
- }
-}
-
-} // namespace Internal
-} // namespace Debugger
diff --git a/src/plugins/debugger/registerhandler.cpp b/src/plugins/debugger/registerhandler.cpp
index 315830c910..c2dbe42701 100644
--- a/src/plugins/debugger/registerhandler.cpp
+++ b/src/plugins/debugger/registerhandler.cpp
@@ -485,8 +485,9 @@ Qt::ItemFlags RegisterHandler::flags(const QModelIndex &idx) const
void RegisterHandler::removeAll()
{
+ beginResetModel();
m_registers.clear();
- reset();
+ endResetModel();
}
bool RegisterHandler::isEmpty() const
@@ -508,12 +509,13 @@ static inline bool compareRegisterSet(const Registers &r1, const Registers &r2)
void RegisterHandler::setRegisters(const Registers &registers)
{
+ beginResetModel();
m_registers = registers;
const int size = m_registers.size();
for (int r = 0; r < size; r++)
m_registers[r].changed = false;
calculateWidth();
- reset();
+ endResetModel();
}
void RegisterHandler::setAndMarkRegisters(const Registers &registers)
@@ -549,9 +551,10 @@ void RegisterHandler::calculateWidth()
void RegisterHandler::setNumberBase(int base)
{
if (m_base != base) {
+ beginResetModel();
m_base = base;
calculateWidth();
- emit reset();
+ endResetModel();
}
}
diff --git a/src/plugins/debugger/snapshothandler.cpp b/src/plugins/debugger/snapshothandler.cpp
index 4f0b439449..303d85779d 100644
--- a/src/plugins/debugger/snapshothandler.cpp
+++ b/src/plugins/debugger/snapshothandler.cpp
@@ -213,10 +213,11 @@ Qt::ItemFlags SnapshotHandler::flags(const QModelIndex &index) const
void SnapshotHandler::activateSnapshot(int index)
{
+ beginResetModel();
m_currentIndex = index;
//qDebug() << "ACTIVATING INDEX: " << m_currentIndex << " OF " << size();
debuggerCore()->displayDebugger(at(index), true);
- reset();
+ endResetModel();
}
void SnapshotHandler::createSnapshot(int index)
@@ -239,28 +240,31 @@ void SnapshotHandler::removeSnapshot(int index)
//QString fileName = engine->startParameters().coreFile;
//if (!fileName.isEmpty())
// QFile::remove(fileName);
+ beginResetModel();
m_snapshots.removeAt(index);
if (index == m_currentIndex)
m_currentIndex = -1;
else if (index < m_currentIndex)
--m_currentIndex;
//engine->quitDebugger();
- reset();
+ endResetModel();
}
void SnapshotHandler::removeAll()
{
+ beginResetModel();
m_snapshots.clear();
m_currentIndex = -1;
- reset();
+ endResetModel();
}
void SnapshotHandler::appendSnapshot(DebuggerEngine *engine)
{
+ beginResetModel();
m_snapshots.append(engine);
m_currentIndex = size() - 1;
- reset();
+ endResetModel();
}
void SnapshotHandler::removeSnapshot(DebuggerEngine *engine)
@@ -273,8 +277,9 @@ void SnapshotHandler::removeSnapshot(DebuggerEngine *engine)
void SnapshotHandler::setCurrentIndex(int index)
{
+ beginResetModel();
m_currentIndex = index;
- reset();
+ endResetModel();
}
DebuggerEngine *SnapshotHandler::at(int i) const
diff --git a/src/plugins/debugger/snapshothandler.h b/src/plugins/debugger/snapshothandler.h
index aad1e1bfa1..9df2636c76 100644
--- a/src/plugins/debugger/snapshothandler.h
+++ b/src/plugins/debugger/snapshothandler.h
@@ -75,7 +75,7 @@ private:
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
- Q_SLOT void resetModel() { reset(); }
+ Q_SLOT void resetModel() { beginResetModel(); endResetModel(); }
int m_currentIndex;
QList< QPointer<DebuggerEngine> > m_snapshots;
diff --git a/src/plugins/debugger/sourcefileshandler.cpp b/src/plugins/debugger/sourcefileshandler.cpp
index b933a6ab9c..5a1ede17d8 100644
--- a/src/plugins/debugger/sourcefileshandler.cpp
+++ b/src/plugins/debugger/sourcefileshandler.cpp
@@ -48,9 +48,10 @@ void SourceFilesHandler::clearModel()
{
if (m_shortNames.isEmpty())
return;
+ beginResetModel();
m_shortNames.clear();
m_fullNames.clear();
- reset();
+ endResetModel();
}
QVariant SourceFilesHandler::headerData(int section,
@@ -100,6 +101,7 @@ QVariant SourceFilesHandler::data(const QModelIndex &index, int role) const
void SourceFilesHandler::setSourceFiles(const QMap<QString, QString> &sourceFiles)
{
+ beginResetModel();
m_shortNames.clear();
m_fullNames.clear();
QMap<QString, QString>::ConstIterator it = sourceFiles.begin();
@@ -108,7 +110,7 @@ void SourceFilesHandler::setSourceFiles(const QMap<QString, QString> &sourceFile
m_shortNames.append(it.key());
m_fullNames.append(it.value());
}
- reset();
+ endResetModel();
}
void SourceFilesHandler::removeAll()
diff --git a/src/plugins/debugger/sourcefileshandler.h b/src/plugins/debugger/sourcefileshandler.h
index 75a81047c3..67f4a27292 100644
--- a/src/plugins/debugger/sourcefileshandler.h
+++ b/src/plugins/debugger/sourcefileshandler.h
@@ -55,7 +55,6 @@ public:
Qt::ItemFlags flags(const QModelIndex &index) const;
void clearModel();
- void update() { reset(); }
void setSourceFiles(const QMap<QString, QString> &sourceFiles);
void removeAll();
diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp
index cd024b9a01..2ee866fc98 100644
--- a/src/plugins/debugger/stackhandler.cpp
+++ b/src/plugins/debugger/stackhandler.cpp
@@ -183,13 +183,15 @@ void StackHandler::setCurrentIndex(int level)
void StackHandler::removeAll()
{
+ beginResetModel();
m_stackFrames.clear();
setCurrentIndex(-1);
- reset();
+ endResetModel();
}
void StackHandler::setFrames(const StackFrames &frames, bool canExpand)
{
+ beginResetModel();
m_resetLocationScheduled = false;
m_contentsValid = true;
m_canExpand = canExpand;
@@ -198,7 +200,7 @@ void StackHandler::setFrames(const StackFrames &frames, bool canExpand)
setCurrentIndex(0);
else
m_currentIndex = -1;
- reset();
+ endResetModel();
emit stackChanged();
}
@@ -216,8 +218,9 @@ void StackHandler::scheduleResetLocation()
void StackHandler::resetLocation()
{
if (m_resetLocationScheduled) {
+ beginResetModel();
m_resetLocationScheduled = false;
- reset();
+ endResetModel();
}
}
diff --git a/src/plugins/debugger/stackhandler.h b/src/plugins/debugger/stackhandler.h
index fc9969ce5c..d130da7275 100644
--- a/src/plugins/debugger/stackhandler.h
+++ b/src/plugins/debugger/stackhandler.h
@@ -93,7 +93,7 @@ private:
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
- Q_SLOT void resetModel() { reset(); }
+ Q_SLOT void resetModel() { beginResetModel(); endResetModel(); }
StackFrames m_stackFrames;
int m_currentIndex;
diff --git a/src/plugins/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp
index d0761ae5bc..0b58a7d803 100644
--- a/src/plugins/debugger/threadshandler.cpp
+++ b/src/plugins/debugger/threadshandler.cpp
@@ -248,12 +248,13 @@ int ThreadsHandler::indexOf(quint64 threadId) const
void ThreadsHandler::setThreads(const Threads &threads)
{
+ beginResetModel();
m_threads = threads;
if (m_currentIndex >= m_threads.size())
m_currentIndex = -1;
m_resetLocationScheduled = false;
m_contentsValid = true;
- reset();
+ endResetModel();
updateThreadBox();
}
@@ -272,9 +273,10 @@ Threads ThreadsHandler::threads() const
void ThreadsHandler::removeAll()
{
+ beginResetModel();
m_threads.clear();
m_currentIndex = 0;
- reset();
+ endResetModel();
}
void ThreadsHandler::notifyRunning()
@@ -333,8 +335,9 @@ void ThreadsHandler::scheduleResetLocation()
void ThreadsHandler::resetLocation()
{
if (m_resetLocationScheduled) {
+ beginResetModel();
m_resetLocationScheduled = false;
- reset();
+ endResetModel();
}
}
diff --git a/src/plugins/debugger/watchdelegatewidgets.cpp b/src/plugins/debugger/watchdelegatewidgets.cpp
index e970c60b02..487a6e0dfa 100644
--- a/src/plugins/debugger/watchdelegatewidgets.cpp
+++ b/src/plugins/debugger/watchdelegatewidgets.cpp
@@ -90,10 +90,10 @@ IntegerValidator::IntegerValidator(QObject *parent) :
bool IntegerValidator::isCharAcceptable(const QChar &c, int base)
{
if (c.isLetter())
- return base == 16 && c.toLower().toAscii() <= 'f';
+ return base == 16 && c.toLower().toLatin1() <= 'f';
if (!c.isDigit())
return false;
- const int digit = c.toAscii() - '0';
+ const int digit = c.toLatin1() - '0';
if (base == 8 && digit > 7)
return false;
if (base == 2 && digit > 1)
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index afd3a7c671..8b9bee75e4 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -1604,7 +1604,8 @@ void WatchHandler::showEditValue(const WatchData &data)
if (data.editformat == 0x0) {
m_model->m_editHandlers.remove(data.iname);
delete w;
- } else if (data.editformat == 1 || data.editformat == 3) {
+ } else if (data.editformat == DisplayImageData
+ || data.editformat == DisplayImageFile) {
// QImage
QLabel *l = qobject_cast<QLabel *>(w);
if (!l) {
@@ -1620,7 +1621,7 @@ void WatchHandler::showEditValue(const WatchData &data)
int width, height, format;
QByteArray ba;
uchar *bits;
- if (data.editformat == 1) {
+ if (data.editformat == DisplayImageData) {
ba = QByteArray::fromHex(data.editvalue);
const int *header = (int *)(ba.data());
swapEndian(ba.data(), ba.size());
@@ -1628,7 +1629,7 @@ void WatchHandler::showEditValue(const WatchData &data)
width = header[0];
height = header[1];
format = header[2];
- } else { // data.editformat == 3
+ } else if (data.editformat == DisplayImageFile) {
QTextStream ts(data.editvalue);
QString fileName;
ts >> width >> height >> format >> fileName;
@@ -1638,18 +1639,13 @@ void WatchHandler::showEditValue(const WatchData &data)
bits = (uchar*)ba.data();
}
QImage im(bits, width, height, QImage::Format(format));
-
-#if 1
- // Qt bug. Enforce copy of image data.
- QImage im2(im);
- im.detach();
-#endif
-
l->setPixmap(QPixmap::fromImage(im));
l->resize(width, height);
l->show();
- } else if (data.editformat == 2) {
- // Display QString in a separate widget.
+ } else if (data.editformat == DisplayUtf16String
+ || data.editformat == DisplayLatin1String
+ || data.editformat == DisplayUtf16String) {
+ // String data.
QTextEdit *t = qobject_cast<QTextEdit *>(w);
if (!t) {
delete w;
@@ -1657,7 +1653,13 @@ void WatchHandler::showEditValue(const WatchData &data)
m_model->m_editHandlers[key] = t;
}
QByteArray ba = QByteArray::fromHex(data.editvalue);
- QString str = QString::fromUtf16((ushort *)ba.constData(), ba.size()/2);
+ QString str;
+ if (data.editformat == DisplayUtf16String)
+ str = QString::fromUtf16((ushort *)ba.constData(), ba.size()/2);
+ else if (data.editformat == DisplayLatin1String)
+ str = QString::fromLatin1(ba.constData(), ba.size());
+ else if (data.editformat == DisplayUtf8String)
+ str = QString::fromUtf8(ba.constData(), ba.size());
t->setText(str);
t->resize(400, 200);
t->show();
diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp
index d810bc56a8..f8e14bd16a 100644
--- a/src/plugins/debugger/watchutils.cpp
+++ b/src/plugins/debugger/watchutils.cpp
@@ -281,7 +281,7 @@ bool isKeyWord(const QString &exp)
{
// FIXME: incomplete
QTC_ASSERT(!exp.isEmpty(), return false);
- switch (exp.at(0).toAscii()) {
+ switch (exp.at(0).toLatin1()) {
case 'a':
return exp == QLatin1String("auto");
case 'b':
diff --git a/src/plugins/debugger/watchutils.h b/src/plugins/debugger/watchutils.h
index 7a132cd7f4..29d93fef07 100644
--- a/src/plugins/debugger/watchutils.h
+++ b/src/plugins/debugger/watchutils.h
@@ -83,6 +83,17 @@ enum DebuggerEncoding
Hex2EncodedFloat8 = 26
};
+// Keep in sync with dumper.py
+enum DebuggerDisplay {
+ StopDisplay = 0,
+ DisplayImageData = 1,
+ DisplayUtf16String = 2,
+ DisplayImageFile = 3,
+ DisplayProcess = 4,
+ DisplayLatin1String = 5,
+ DisplayUtf8String = 6
+};
+
bool isEditorDebuggable(Core::IEditor *editor);
QByteArray dotEscape(QByteArray str);
QString currentTime();
diff --git a/src/plugins/designer/designer.qbs b/src/plugins/designer/designer.qbs
index 19769a0ad7..f30940b731 100644
--- a/src/plugins/designer/designer.qbs
+++ b/src/plugins/designer/designer.qbs
@@ -14,78 +14,73 @@ QtcPlugin {
Depends { name: "cpp" }
cpp.defines: base.concat(["CPP_ENABLED"])
- cpp.includePaths: [
+ cpp.includePaths: base.concat([
"../../libs/3rdparty",
"cpp",
- "../../shared/designerintegrationv2",
- ".",
- "..",
- "../../libs",
- buildDirectory
- ]
+ "../../shared/designerintegrationv2"
+ ])
files: [
- "../../shared/designerintegrationv2/widgethost.h",
- "../../shared/designerintegrationv2/sizehandlerect.h",
- "../../shared/designerintegrationv2/formresizer.h",
- "../../shared/designerintegrationv2/widgethostconstants.h",
- "cpp/formclasswizardpage.h",
- "cpp/formclasswizarddialog.h",
- "cpp/formclasswizard.h",
- "cpp/formclasswizardparameters.h",
- "cpp/cppsettingspage.h",
- "formeditorplugin.h",
- "formeditorfactory.h",
- "formwindoweditor.h",
- "formwindowfile.h",
- "formwizard.h",
- "qtcreatorintegration.h",
- "designerconstants.h",
- "settingspage.h",
- "editorwidget.h",
- "formeditorw.h",
- "settingsmanager.h",
- "formtemplatewizardpage.h",
- "formwizarddialog.h",
+ "Designer.mimetypes.xml",
+ "README.txt",
+ "codemodelhelpers.cpp",
"codemodelhelpers.h",
+ "designer.qrc",
"designer_export.h",
- "designerxmleditor.h",
+ "designerconstants.h",
+ "designercontext.cpp",
"designercontext.h",
- "formeditorstack.h",
+ "designerxmleditor.cpp",
+ "designerxmleditor.h",
"editordata.h",
- "resourcehandler.h",
- "qtdesignerformclasscodegenerator.h",
- "../../shared/designerintegrationv2/widgethost.cpp",
- "../../shared/designerintegrationv2/sizehandlerect.cpp",
- "../../shared/designerintegrationv2/formresizer.cpp",
- "cpp/formclasswizardpage.cpp",
- "cpp/formclasswizarddialog.cpp",
- "cpp/formclasswizard.cpp",
- "cpp/formclasswizardparameters.cpp",
- "cpp/cppsettingspage.cpp",
- "formeditorplugin.cpp",
+ "editorwidget.cpp",
+ "editorwidget.h",
"formeditorfactory.cpp",
+ "formeditorfactory.h",
+ "formeditorplugin.cpp",
+ "formeditorplugin.h",
+ "formeditorstack.cpp",
+ "formeditorstack.h",
+ "formeditorw.cpp",
+ "formeditorw.h",
+ "formtemplatewizardpage.cpp",
+ "formtemplatewizardpage.h",
"formwindoweditor.cpp",
+ "formwindoweditor.h",
"formwindowfile.cpp",
+ "formwindowfile.h",
"formwizard.cpp",
- "qtcreatorintegration.cpp",
- "settingspage.cpp",
- "editorwidget.cpp",
- "formeditorw.cpp",
- "settingsmanager.cpp",
- "formtemplatewizardpage.cpp",
+ "formwizard.h",
"formwizarddialog.cpp",
- "codemodelhelpers.cpp",
- "designerxmleditor.cpp",
- "designercontext.cpp",
- "formeditorstack.cpp",
- "resourcehandler.cpp",
+ "formwizarddialog.h",
+ "qtcreatorintegration.cpp",
+ "qtcreatorintegration.h",
"qtdesignerformclasscodegenerator.cpp",
- "cpp/formclasswizardpage.ui",
+ "qtdesignerformclasscodegenerator.h",
+ "resourcehandler.cpp",
+ "resourcehandler.h",
+ "settingsmanager.cpp",
+ "settingsmanager.h",
+ "settingspage.cpp",
+ "settingspage.h",
+ "../../shared/designerintegrationv2/formresizer.cpp",
+ "../../shared/designerintegrationv2/formresizer.h",
+ "../../shared/designerintegrationv2/sizehandlerect.cpp",
+ "../../shared/designerintegrationv2/sizehandlerect.h",
+ "../../shared/designerintegrationv2/widgethost.cpp",
+ "../../shared/designerintegrationv2/widgethost.h",
+ "../../shared/designerintegrationv2/widgethostconstants.h",
+ "cpp/cppsettingspage.cpp",
+ "cpp/cppsettingspage.h",
"cpp/cppsettingspagewidget.ui",
- "designer.qrc",
- "Designer.mimetypes.xml",
- "README.txt"
+ "cpp/formclasswizard.cpp",
+ "cpp/formclasswizard.h",
+ "cpp/formclasswizarddialog.cpp",
+ "cpp/formclasswizarddialog.h",
+ "cpp/formclasswizardpage.cpp",
+ "cpp/formclasswizardpage.h",
+ "cpp/formclasswizardpage.ui",
+ "cpp/formclasswizardparameters.cpp",
+ "cpp/formclasswizardparameters.h",
]
}
-
diff --git a/src/plugins/designer/formwindoweditor.cpp b/src/plugins/designer/formwindoweditor.cpp
index dc6251234e..f1d1c16374 100644
--- a/src/plugins/designer/formwindoweditor.cpp
+++ b/src/plugins/designer/formwindoweditor.cpp
@@ -178,7 +178,7 @@ bool FormWindowEditor::open(QString *errorString, const QString &fileName, const
d->m_file.setFileName(absfileName);
d->m_file.setShouldAutoSave(false);
- if (Internal::ResourceHandler *rh = qFindChild<Designer::Internal::ResourceHandler*>(form))
+ if (Internal::ResourceHandler *rh = form->findChild<Designer::Internal::ResourceHandler*>())
rh->updateResources();
emit changed();
diff --git a/src/plugins/fakevim/fakevim.pro b/src/plugins/fakevim/fakevim.pro
index 442e7a7206..44e3c48c20 100644
--- a/src/plugins/fakevim/fakevim.pro
+++ b/src/plugins/fakevim/fakevim.pro
@@ -16,3 +16,7 @@ HEADERS += fakevimactions.h \
fakevimhandler.h \
fakevimplugin.h
FORMS += fakevimoptions.ui
+
+equals(TEST, 1) {
+ SOURCES += fakevim_test.cpp
+}
diff --git a/src/plugins/fakevim/fakevim.qbs b/src/plugins/fakevim/fakevim.qbs
index 600bd96ff0..218897eb2e 100644
--- a/src/plugins/fakevim/fakevim.qbs
+++ b/src/plugins/fakevim/fakevim.qbs
@@ -1,6 +1,7 @@
import qbs.base 1.0
import "../QtcPlugin.qbs" as QtcPlugin
+import "../../../qbs/defaults.js" as Defaults
QtcPlugin {
name: "FakeVim"
@@ -8,23 +9,20 @@ QtcPlugin {
Depends { name: "Core" }
Depends { name: "TextEditor" }
Depends { name: "Find" }
- Depends { name: "cpp" }
Depends { name: "Qt.widgets" }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
-
files: [
"fakevimactions.cpp",
- "fakevimhandler.cpp",
- "fakevimplugin.cpp",
"fakevimactions.h",
+ "fakevimhandler.cpp",
"fakevimhandler.h",
+ "fakevimoptions.ui",
+ "fakevimplugin.cpp",
"fakevimplugin.h",
- "fakevimoptions.ui"
]
-}
+ Group {
+ condition: Defaults.testsEnabled(qbs)
+ files: ["fakevim_test.cpp"]
+ }
+}
diff --git a/src/plugins/fakevim/fakevim_test.cpp b/src/plugins/fakevim/fakevim_test.cpp
new file mode 100644
index 0000000000..e86f0168bd
--- /dev/null
+++ b/src/plugins/fakevim/fakevim_test.cpp
@@ -0,0 +1,949 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Lukas Holecek <hluk@email.cz>
+**
+** Contact: http://www.qt-project.org/
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+
+/*!
+ * Tests for FakeVim plugin.
+ * All test are based on Vim behaviour.
+ */
+
+#include "fakevimplugin.h"
+#include "fakevimhandler.h"
+
+#include <QtTest>
+#include <QTextEdit>
+#include <QTextDocument>
+
+/*!
+ * Tests after this macro will be skipped and warning printed.
+ * Uncomment it to test a feature -- if tests succeeds it should be removed from the test.
+ */
+#define NOT_IMPLEMENTED return;
+
+// QTest::qSkip("Not fully implemented!", QTest::SkipSingle, __FILE__, __LINE__);
+// return;
+
+// text cursor representation in comparisons (set empty to disable cursor position checking)
+#define X "|"
+static const QString cursorString(X);
+
+// a more distinct line separator in code
+#define N "\n"
+
+// document line start and end string in error text
+#define LINE_START "\t\t<"
+#define LINE_END ">\n"
+
+// Compare document contents with a expectedText.
+// Also check cursor position if the expectedText contains cursorString.
+#define COMPARE(beforeText, beforePosition, afterText, afterPosition, expectedText, cmd) \
+ do { \
+ QString before(beforeText); \
+ QString actual(afterText); \
+ QString expected(expectedText); \
+ if (!cursorString.isEmpty() && expected.contains(cursorString)) {\
+ before.insert(beforePosition, cursorString); \
+ actual.insert(afterPosition, cursorString); \
+ } \
+ QString help = "\n\tBefore command [" + QString(cmd) + "]:\n" LINE_START \
+ + (before.replace('\n', LINE_END LINE_START)) \
+ + LINE_END "\n\tAfter the command:\n" LINE_START \
+ + actual.replace('\n', LINE_END LINE_START) \
+ + LINE_END "\n\tShould be:\n" LINE_START \
+ + expected.replace('\n', LINE_END LINE_START) + LINE_END; \
+ QVERIFY2(actual == expected, help.toLatin1().constData()); \
+ } while (false)
+
+// Send keys and check if the expected result is same as document contents.
+// Escape is always prepended to keys so that previous command is cancled.
+#define KEYS(keys, expected) \
+ do { \
+ QString beforeText(data.text()); \
+ int beforePosition = data.position(); \
+ data.doKeys("<ESC>" keys); \
+ COMPARE(beforeText, beforePosition, data.text(), data.position(), (expected), (keys)); \
+ } while (false);
+
+// Run Ex command and check if the expected result is same as document contents.
+#define COMMAND(cmd, expected) \
+ do { \
+ QString beforeText(data.text()); \
+ int beforePosition = data.position(); \
+ data.doCommand(cmd); \
+ COMPARE(beforeText, beforePosition, data.text(), data.position(), (expected), (":" cmd)); \
+ } while (false);
+
+using namespace FakeVim::Internal;
+
+namespace {
+
+struct TestData
+{
+ FakeVimHandler *handler;
+ QTextEdit *edit;
+ QWidget parent;
+
+ QTextCursor cursor() const { return edit->textCursor(); }
+
+ int position() const
+ {
+ int pos = cursor().position();
+ // text cursor position is never behind last character in document
+ return qMax(0, qMin(pos, edit->document()->characterCount() - 2));
+ }
+
+ QString text() const { return edit->toPlainText(); }
+
+ void setText(const QString &text)
+ {
+ QString str = text;
+ int i = str.indexOf(cursorString);
+ if (!cursorString.isEmpty() && i != -1)
+ str.remove(i, 1);
+ edit->document()->setPlainText(str);
+ handler->setTextCursorPosition(i);
+ }
+
+ void doCommand(const QString &cmd) { handler->handleCommand(cmd); }
+ void doKeys(const QString &keys) { handler->handleInput(keys); }
+};
+
+static void setup(TestData *data)
+{
+ data->edit = new QTextEdit(&data->parent);
+ data->handler = new FakeVimHandler(data->edit, &data->parent);
+ data->handler->handleCommand("set startofline");
+}
+
+} // namespace
+
+void FakeVimPlugin::test_vim_movement()
+{
+ TestData data;
+ setup(&data);
+
+ // vertical movement
+ data.setText("123" N "456" N "789" N "abc");
+ KEYS("", X "123" N "456" N "789" N "abc");
+ KEYS("j", "123" N X "456" N "789" N "abc");
+ KEYS("G", "123" N "456" N "789" N X "abc");
+ KEYS("k", "123" N "456" N X "789" N "abc");
+ KEYS("2k", X "123" N "456" N "789" N "abc");
+ KEYS("k", X "123" N "456" N "789" N "abc");
+ KEYS("jj", "123" N "456" N X "789" N "abc");
+ KEYS("gg", X "123" N "456" N "789" N "abc");
+
+ // horizontal movement
+ data.setText(" " X "x" "x" "x" "x");
+ KEYS("", " " X "x" "x" "x" "x");
+ KEYS("h", X " " "x" "x" "x" "x");
+ KEYS("l", " " X "x" "x" "x" "x");
+ KEYS("3l", " " "x" "x" "x" X "x");
+ KEYS("2h", " " "x" X "x" "x" "x");
+ KEYS("$", " " "x" "x" "x" X "x");
+ KEYS("^", " " X "x" "x" "x" "x");
+ KEYS("0", X " " "x" "x" "x" "x");
+
+ // skip words
+ data.setText("123 " "456" "." "789 " "abc");
+ KEYS("b", X "123 " "456" "." "789 " "abc");
+ KEYS("w", "123 " X "456" "." "789 " "abc");
+ KEYS("2w", "123 " "456" "." X "789 " "abc");
+ KEYS("3w", "123 " "456" "." "789 " "ab" X "c");
+ KEYS("3b", "123 " "456" X "." "789 " "abc");
+
+ data.setText("123 " "456.789 " "abc " "def");
+ KEYS("B", X "123 " "456.789 " "abc " "def");
+ KEYS("W", "123 " X "456.789 " "abc " "def");
+ KEYS("2W", "123 " "456.789 " "abc " X "def");
+ KEYS("B", "123 " "456.789 " X "abc " "def");
+ KEYS("2B", X "123 " "456.789 " "abc " "def");
+ KEYS("4W", "123 " "456.789 " "abc " "de" X "f");
+
+ data.setText("123" N "45." "6" N "" N " " N "789");
+ KEYS("3w", "123" N "45." X "6" N "" N " " N "789");
+ // From Vim help (motion.txt): An empty line is also considered to be a word.
+ KEYS("w", "123" N "45." "6" N X "" N " " N "789");
+ KEYS("w", "123" N "45." "6" N "" N " " N X "789");
+
+ KEYS("b", "123" N "45." "6" N X "" N " " N "789");
+ KEYS("4b", X "123" N "45." "6" N "" N " " N "789");
+
+ KEYS("3e", "123" N "45" X "." "6" N "" N " " N "789");
+ KEYS("e", "123" N "45" "." X "6" N "" N " " N "789");
+ // Command "e" does not stop on empty lines ("ge" does).
+ KEYS("e", "123" N "45" "." "6" N "" N " " N "78" X "9");
+ KEYS("ge", "123" N "45" "." "6" N X "" N " " N "789");
+ KEYS("2ge", "123" N "45" X "." "6" N "" N " " N "789");
+}
+
+void FakeVimPlugin::test_vim_fFtT()
+{
+ TestData data;
+ setup(&data);
+
+ data.setText("123()456" N "a(b(c)d)e");
+ KEYS("t(", "12" X "3()456" N "a(b(c)d)e");
+ KEYS("lt(", "123" X "()456" N "a(b(c)d)e");
+ KEYS("0j2t(", "123()456" N "a(" X "b(c)d)e");
+ KEYS("l2T(", "123()456" N "a(b" X "(c)d)e");
+ KEYS("l2T(", "123()456" N "a(" X "b(c)d)e");
+ KEYS("T(", "123()456" N "a(" X "b(c)d)e");
+
+ KEYS("ggf(", "123" X "()456" N "a(b(c)d)e");
+ KEYS("lf(", "123(" X ")456" N "a(b(c)d)e");
+ KEYS("0j2f(", "123()456" N "a(b" X "(c)d)e");
+ KEYS("2F(", "123()456" N "a(b" X "(c)d)e");
+ KEYS("l2F(", "123()456" N "a" X "(b(c)d)e");
+ KEYS("F(", "123()456" N "a" X "(b(c)d)e");
+}
+
+void FakeVimPlugin::test_vim_transform_numbers()
+{
+ TestData data;
+ setup(&data);
+
+ data.setText("8");
+ KEYS("<c-a>", X "9");
+ KEYS("<c-x>", X "8");
+ KEYS("<c-a>", X "9");
+ KEYS("<c-a>", "1" X "0");
+ KEYS("<c-a>", "1" X "1");
+ KEYS("5<c-a>", "1" X "6");
+ KEYS("10<c-a>", "2" X "6");
+ KEYS("h100<c-a>", "12" X "6");
+ KEYS("100<c-x>", "2" X "6");
+ KEYS("10<c-x>", "1" X "6");
+ KEYS("5<c-x>", "1" X "1");
+ KEYS("5<c-x>", X "6");
+ KEYS("6<c-x>", X "0");
+ KEYS("<c-x>", "-" X "1");
+ KEYS("h10<c-x>", "-1" X "1");
+ KEYS("h100<c-x>", "-11" X "1");
+ KEYS("h889<c-x>", "-100" X "0");
+
+ // increase nearest number
+ data.setText("x-x+x: 1 2 3 -4 5");
+ KEYS("8<c-a>", "x-x+x: " X "9 2 3 -4 5");
+ KEYS("l8<c-a>", "x-x+x: 9 1" X "0 3 -4 5");
+ KEYS("l8<c-a>", "x-x+x: 9 10 1" X "1 -4 5");
+ KEYS("l16<c-a>", "x-x+x: 9 10 11 1" X "2 5");
+ KEYS("w18<c-x>", "x-x+x: 9 10 11 12 -1" X "3");
+ KEYS("hh13<c-a>", "x-x+x: 9 10 11 12 " X "0");
+ KEYS("B12<c-x>", "x-x+x: 9 10 11 " X "0 0");
+ KEYS("B11<c-x>", "x-x+x: 9 10 " X "0 0 0");
+ KEYS("B10<c-x>", "x-x+x: 9 " X "0 0 0 0");
+ KEYS("B9<c-x>", "x-x+x: " X "0 0 0 0 0");
+ KEYS("B9<c-x>", "x-x+x: -" X "9 0 0 0 0");
+
+ data.setText("-- 1 --");
+ KEYS("<c-x>", "-- " X "0 --");
+ KEYS("<c-x><c-x>", "-- -" X "2 --");
+ KEYS("2<c-a><c-a>", "-- " X "1 --");
+ KEYS("<c-a>2<c-a>", "-- " X "4 --");
+ KEYS(".", "-- " X "6 --");
+}
+
+void FakeVimPlugin::test_vim_delete()
+{
+ TestData data;
+ setup(&data);
+
+ data.setText("123" N "456");
+ KEYS("x", "23" N "456");
+ KEYS("dd", "456");
+ KEYS("2x", "6");
+ KEYS("dd", "");
+
+ data.setText("void main()");
+ KEYS("dt(", "()");
+
+ data.setText("void main()");
+ KEYS("df(", ")");
+
+ data.setText("void main()");
+ KEYS("wD", "void ");
+ KEYS("ggd$", "");
+
+ data.setText("abc def ghi");
+ KEYS("2dw", X "ghi");
+ data.setText("abc def ghi");
+ KEYS("d2w", X "ghi");
+
+ data.setText("abc " N " def" N " ghi" N "jkl");
+ KEYS("3dw", X "jkl");
+ data.setText("abc " N " def" N " ghi" N "jkl");
+ KEYS("d3w", X "jkl");
+}
+
+void FakeVimPlugin::test_vim_delete_inner_word()
+{
+ TestData data;
+ setup(&data);
+
+ data.setText("abc def ghi");
+ KEYS("wlldiw", "abc " X " ghi");
+
+ data.setText("abc def ghi jkl");
+ KEYS("3diw", X " ghi jkl");
+
+ data.setText("abc " X " def");
+ KEYS("diw", "abc" X "def");
+ KEYS("diw", "");
+
+ data.setText("abc " N " def");
+ KEYS("3diw", X "def");
+
+ data.setText("abc " N " def" N " ghi");
+ KEYS("4diw", " " X "ghi");
+ data.setText("ab" X "c " N " def" N " ghi");
+ KEYS("4diw", " " X "ghi");
+ data.setText("a b" X "c " N " def" N " ghi");
+ KEYS("4diw", "a" X " " N " ghi");
+
+ data.setText("abc def" N "ghi");
+ KEYS("2diw", X "def" N "ghi");
+ data.setText("abc def" N "ghi");
+ KEYS("3diw", X "" N "ghi");
+
+ data.setText("x" N X "" N "" N " ");
+ KEYS("diw", "x" N X "" N "" N " ");
+ data.setText("x" N X "" N "" N " ");
+ KEYS("2diw", "x" N " " X " ");
+ data.setText("x" N X "" N "" N "" N "" N " ");
+ KEYS("3diw", "x" N " " X " ");
+ data.setText("x" N X "" N "" N "" N "" N "" N " ");
+ KEYS("3diw", "x" N X "" N " ");
+ data.setText("x" N X "" N "" N "" N "" N "" N "" N " ");
+ KEYS("4diw", "x" N X "" N " ");
+}
+
+void FakeVimPlugin::test_vim_delete_a_word()
+{
+ TestData data;
+ setup(&data);
+
+ data.setText("abc def ghi");
+ KEYS("wlldaw", "abc " X "ghi");
+
+ data.setText("abc def ghi jkl");
+ KEYS("wll2daw", "abc " X "jkl");
+
+ data.setText("abc" X " def ghi");
+ KEYS("daw", "abc" X " ghi");
+ KEYS("daw", "ab" X "c");
+ KEYS("daw", "");
+
+ data.setText(X " ghi jkl");
+ KEYS("daw", X " jkl");
+ KEYS("ldaw", X " ");
+
+ data.setText("abc def ghi jkl");
+ KEYS("3daw", X "jkl");
+
+ // remove trailing spaces
+ data.setText("abc " N " def" N " ghi" N "jkl");
+ KEYS("3daw", X "jkl");
+
+ data.setText("abc " N " def" N " ghi" N "jkl");
+ KEYS("3daw", X "jkl");
+
+ data.setText("abc def" N "ghi");
+ KEYS("2daw", X "" N "ghi");
+
+ data.setText("x" N X "" N "" N " ");
+ KEYS("daw", "x" N " " X " ");
+ data.setText("x" N X "" N "" N "" N "" N " ");
+ KEYS("2daw", "x" N " " X " ");
+ data.setText("x" N X "" N "" N "" N "" N "" N " ");
+ KEYS("2daw", "x" N X "" N " ");
+ data.setText("x" N X "" N "" N "" N "" N "" N "" N " ");
+ KEYS("3daw", "x" N " " X " ");
+}
+
+void FakeVimPlugin::test_vim_change_a_word()
+{
+ TestData data;
+ setup(&data);
+
+ data.setText("abc " X "def ghi");
+ KEYS("caw#", "abc #" X "ghi");
+ data.setText("abc d" X "ef ghi");
+ KEYS("caw#", "abc #" X "ghi");
+ data.setText("abc de" X "f ghi");
+ KEYS("caw#", "abc #" X "ghi");
+
+ data.setText("abc de" X "f ghi jkl");
+ KEYS("2caw#", "abc #" X "jkl");
+
+ data.setText("abc" X " def ghi jkl");
+ KEYS("2caw#", "abc#" X " jkl");
+
+ data.setText("abc " X " def ghi jkl");
+ KEYS("2caw#", "abc#" X " jkl");
+
+ data.setText(" abc " N " def" N " ghi" N " jkl");
+ KEYS("3caw#", "#" X N " jkl");
+}
+
+void FakeVimPlugin::test_vim_block_selection()
+{
+ TestData data;
+ setup(&data);
+
+ data.setText("int main(int /* (unused) */, char *argv[]);");
+ KEYS("f(", "int main" X "(int /* (unused) */, char *argv[]);");
+ KEYS("da(", "int main" X ";")
+
+ data.setText("int main(int /* (unused) */, char *argv[]);");
+ KEYS("f(", "int main" X "(int /* (unused) */, char *argv[]);");
+ KEYS("di(", "int main(" X ");")
+
+ data.setText("int main(int /* (unused) */, char *argv[]);");
+ KEYS("2f)", "int main(int /* (unused) */, char *argv[]" X ");");
+ KEYS("da(", "int main" X ";")
+
+ data.setText("int main(int /* (unused) */, char *argv[]);");
+ KEYS("2f)", "int main(int /* (unused) */, char *argv[]" X ");");
+ KEYS("di(", "int main(" X ");")
+
+ data.setText("{ { { } } }");
+ KEYS("2f{l", "{ { {" X " } } }")
+ KEYS("da{", "{ { " X " } }")
+ KEYS("da{", "{ " X " }")
+
+ data.setText("{ { { } } }");
+ KEYS("2f{l", "{ { {" X " } } }")
+ KEYS("2da{", "{ " X " }")
+
+ data.setText("{" N " { " N " } " N "}");
+ KEYS("di{", "{" N "}")
+}
+
+void FakeVimPlugin::test_vim_repeat()
+{
+ TestData data;
+ setup(&data);
+
+ // delete line
+ data.setText("abc" N "def" N "ghi");
+ KEYS("dd", X "def" N "ghi");
+ KEYS(".", X "ghi");
+
+ // delete to next word
+ data.setText("abc def ghi jkl");
+ KEYS("dw", X "def ghi jkl");
+ KEYS("w.", "def " X "jkl");
+ KEYS("gg.", X "jkl");
+
+ // change in word
+ data.setText("WORD text");
+ KEYS("ciwWORD<esc>", "WOR" X "D text");
+ KEYS("w.", "WORD WOR" X "D");
+
+ /* QTCREATORBUG-7248 */
+ data.setText("test tex" X "t");
+ KEYS("vbcWORD<esc>", "test " "WOR" X "D");
+ KEYS("bb.", "WOR" X "D WORD");
+
+ // delete selected range
+ data.setText("abc def ghi jkl");
+ KEYS("viwd", X " def ghi jkl");
+ KEYS(".", X "f ghi jkl");
+ KEYS(".", X "hi jkl");
+
+ // delete two lines
+ data.setText("abc" N "def" N "ghi" N "jkl" N "mno");
+ KEYS("Vjx", X "ghi" N "jkl" N "mno");
+ KEYS(".", X "mno");
+
+ // delete three lines
+ data.setText("abc" N "def" N "ghi" N "jkl" N "mno" N "pqr" N "stu");
+ KEYS("d2j", X "jkl" N "mno" N "pqr" N "stu");
+ KEYS(".", X "stu");
+
+ // replace block selection
+ data.setText("abcd" N "d" X "efg" N "ghij" N "jklm");
+ KEYS("<c-v>jlrX", "abcd" N "d" X "XXg" N "gXXj" N "jklm");
+ KEYS("gg.", "XXcd" N "XXXg" N "gXXj" N "jklm");
+}
+
+void FakeVimPlugin::test_vim_search()
+{
+ TestData data;
+ setup(&data);
+
+ data.setText("abc" N "def" N "ghi");
+ KEYS("/ghi<CR>", "abc" N "def" N X "ghi");
+ KEYS("gg/\\w\\{3}<CR>", "abc" N X "def" N "ghi");
+ KEYS("n", "abc" N "def" N X "ghi");
+ KEYS("N", "abc" N X "def" N "ghi");
+ KEYS("N", X "abc" N "def" N "ghi");
+
+ // return to search-start position on escape or not found
+ KEYS("/def<ESC>", X "abc" N "def" N "ghi");
+ KEYS("/x", X "abc" N "def" N "ghi");
+ KEYS("/x<CR>", X "abc" N "def" N "ghi");
+ KEYS("/x<ESC>", X "abc" N "def" N "ghi");
+ KEYS("/ghX", X "abc" N "def" N "ghi");
+
+ KEYS("?def<ESC>", X "abc" N "def" N "ghi");
+ KEYS("?x", X "abc" N "def" N "ghi");
+ KEYS("?x<CR>", X "abc" N "def" N "ghi");
+ KEYS("?x<ESC>", X "abc" N "def" N "ghi");
+
+ // search [count] times
+ data.setText("abc" N "def" N "ghi");
+ KEYS("/\\w\\{3}<CR>", "abc" N X "def" N "ghi");
+ KEYS("2n", X "abc" N "def" N "ghi");
+ KEYS("2N", "abc" N X "def" N "ghi");
+ KEYS("2/\\w\\{3}<CR>", X "abc" N "def" N "ghi");
+
+ // set wrapscan (search wraps at end of file)
+ data.doCommand("set ws");
+ data.setText("abc" N "def" N "abc" N "ghi abc jkl");
+ KEYS("*", "abc" N "def" N X "abc" N "ghi abc jkl");
+ KEYS("*", "abc" N "def" N "abc" N "ghi " X "abc jkl");
+ KEYS("2*", "abc" N "def" N X "abc" N "ghi abc jkl");
+ KEYS("#", X "abc" N "def" N "abc" N "ghi abc jkl");
+ KEYS("#", "abc" N "def" N "abc" N "ghi " X "abc jkl");
+ KEYS("#", "abc" N "def" N X "abc" N "ghi abc jkl");
+ KEYS("2#", "abc" N "def" N "abc" N "ghi " X "abc jkl");
+
+ data.doCommand("set nows");
+ data.setText("abc" N "def" N "abc" N "ghi abc jkl");
+ KEYS("*", "abc" N "def" N X "abc" N "ghi abc jkl");
+ KEYS("*", "abc" N "def" N "abc" N "ghi " X "abc jkl");
+ KEYS("*", "abc" N "def" N "abc" N "ghi " X "abc jkl");
+ KEYS("#", "abc" N "def" N X "abc" N "ghi abc jkl");
+ KEYS("#", X "abc" N "def" N "abc" N "ghi abc jkl");
+ KEYS("#", X "abc" N "def" N "abc" N "ghi abc jkl");
+
+ data.setText("abc" N "def" N "ab" X "c" N "ghi abc jkl");
+ KEYS("#", X "abc" N "def" N "abc" N "ghi abc jkl");
+
+ // search with g* and g#
+ data.doCommand("set nows");
+ data.setText("bc" N "abc" N "abcd" N "bc" N "b");
+ KEYS("g*", "bc" N "a" X "bc" N "abcd" N "bc" N "b");
+ KEYS("n", "bc" N "abc" N "a" X "bcd" N "bc" N "b");
+ KEYS("n", "bc" N "abc" N "abcd" N X "bc" N "b");
+ KEYS("n", "bc" N "abc" N "abcd" N X "bc" N "b");
+ KEYS("g#", "bc" N "abc" N "a" X "bcd" N "bc" N "b");
+ KEYS("n", "bc" N "a" X "bc" N "abcd" N "bc" N "b");
+ KEYS("N", "bc" N "abc" N "a" X "bcd" N "bc" N "b");
+ KEYS("3n", "bc" N "abc" N "a" X "bcd" N "bc" N "b");
+ KEYS("2n", X "bc" N "abc" N "abcd" N "bc" N "b");
+
+ /* QTCREATORBUG-7251 */
+ data.setText("abc abc abc abc");
+ KEYS("$?abc<CR>", "abc abc abc " X "abc");
+ KEYS("2?abc<CR>", "abc " X "abc abc abc");
+ KEYS("n", X "abc abc abc abc");
+ KEYS("N", "abc " X "abc abc abc");
+
+ NOT_IMPLEMENTED
+ // find same stuff forward and backward,
+ // i.e. '<ab>c' forward but not 'a<bc>' backward
+ data.setText("abc" N "def" N "ghi");
+ KEYS("/\\w\\{2}<CR>", X "abc" N "def" N "ghi");
+ KEYS("2n", "abc" N "def" N X "ghi");
+ KEYS("N", "abc" N X "def" N "ghi");
+ KEYS("N", X "abc" N "def" N "ghi");
+ KEYS("2n2N", X "abc" N "def" N "ghi");
+}
+
+void FakeVimPlugin::test_vim_indent()
+{
+ TestData data;
+ setup(&data);
+
+ data.doCommand("set expandtab");
+ data.doCommand("set shiftwidth=4");
+
+ data.setText(
+ "abc" N
+ "def" N
+ "ghi" N
+ "jkl" N
+ "mno");
+ KEYS("j3>>",
+ "abc" N
+ " " X "def" N
+ " ghi" N
+ " jkl" N
+ "mno");
+ KEYS("j2>>",
+ "abc" N
+ " def" N
+ " " X "ghi" N
+ " jkl" N
+ "mno");
+
+ KEYS("2<<",
+ "abc" N
+ " def" N
+ " " X "ghi" N
+ " jkl" N
+ "mno");
+ KEYS("k3<<",
+ "abc" N
+ X "def" N
+ "ghi" N
+ "jkl" N
+ "mno");
+
+ data.setText(
+ "abc" N
+ "def" N
+ "ghi" N
+ "jkl" N
+ "mno");
+ KEYS("jj>j",
+ "abc" N
+ "def" N
+ " " X "ghi" N
+ " jkl" N
+ "mno");
+
+ data.setText("abc");
+ KEYS(">>", " " X "abc");
+
+ data.setText("abc");
+ data.doCommand("set shiftwidth=2");
+ KEYS(">>", " " X "abc");
+
+ data.setText("abc");
+ data.doCommand("set noexpandtab");
+ data.doCommand("set tabstop=2");
+ data.doCommand("set shiftwidth=7");
+ // shiftwidth = TABS * tabstop + SPACES
+ // 7 = 3 * 2 + 1
+ KEYS(">>", "\t\t\t abc");
+
+ data.doCommand("set tabstop=3");
+ data.doCommand("set shiftwidth=7");
+ data.setText("abc");
+ KEYS(">>", "\t\t abc");
+}
+
+void FakeVimPlugin::test_vim_marks()
+{
+ TestData data;
+ setup(&data);
+
+ data.setText(" abc" N " def" N " ghi");
+ data.doKeys("ma");
+ data.doKeys("ma");
+ data.doKeys("jmb");
+ data.doKeys("j^mc");
+ KEYS("'a", " " X "abc" N " " "def" N " " "ghi");
+ KEYS("`a", X " " "abc" N " " "def" N " " "ghi");
+ KEYS("`b", " " "abc" N X " " "def" N " " "ghi");
+ KEYS("'b", " " "abc" N " " X "def" N " " "ghi");
+ KEYS("`c", " " "abc" N " " "def" N " " X "ghi");
+ KEYS("'c", " " "abc" N " " "def" N " " X "ghi");
+
+ KEYS("`b", " " "abc" N X " " "def" N " " "ghi");
+ KEYS("'c", " " "abc" N " " "def" N " " X "ghi");
+
+ KEYS("`'", " " "abc" N X " " "def" N " " "ghi");
+ KEYS("`a", X " " "abc" N " " "def" N " " "ghi");
+ KEYS("''", " " "abc" N " " X "def" N " " "ghi");
+ KEYS("`'", X " " "abc" N " " "def" N " " "ghi");
+ KEYS("`'", " " "abc" N " " X "def" N " " "ghi");
+}
+
+void FakeVimPlugin::test_vim_copy_paste()
+{
+ TestData data;
+ setup(&data);
+
+ data.setText("123" N "456");
+ KEYS("llyy2P", X "123" N "123" N "123" N "456");
+
+ data.setText("123" N "456");
+ KEYS("yyp", "123" N X "123" N "456");
+ KEYS("2p", "123" N "123" N X "123" N "123" N "456");
+
+ data.setText("123 456");
+ KEYS("yw2P", "123 123" X " 123 456");
+ KEYS("2p", "123 123 123 123" X " 123 456");
+
+ data.setText("123" N "456");
+ KEYS("2yyp", "123" N X "123" N "456" N "456");
+
+ data.setText("123" N "456");
+ KEYS("2yyP", X "123" N "456" N "123" N "456");
+
+ data.setText("123" N "456" N "789");
+ KEYS("ddp", "456" N X "123" N "789");
+
+ // block-select middle column, copy and paste twice
+ data.setText("123" N "456");
+ KEYS("l<C-v>j\"xy2\"xp", "12" X "223" N "45556");
+}
+
+void FakeVimPlugin::test_vim_undo_redo()
+{
+ TestData data;
+ setup(&data);
+
+ data.setText("abc def" N "xyz" N "123");
+ KEYS("ddu", X "abc def" N "xyz" N "123");
+ COMMAND("redo", X "xyz" N "123");
+ COMMAND("undo", X "abc def" N "xyz" N "123");
+ COMMAND("redo", X "xyz" N "123");
+ KEYS("dd", X "123");
+ KEYS("3x", X "");
+ KEYS("uuu", X "abc def" N "xyz" N "123");
+ KEYS("<C-r>", X "xyz" N "123");
+ KEYS("2<C-r>", X "");
+ KEYS("3u", X "abc def" N "xyz" N "123");
+
+ KEYS("wved", "abc" X " " N "xyz" N "123");
+ KEYS("2w", "abc " N "xyz" N X "123");
+ KEYS("u", "abc " X "def" N "xyz" N "123");
+ KEYS("<C-r>", "abc" X " " N "xyz" N "123");
+ KEYS("10ugg", X "abc def" N "xyz" N "123");
+
+ KEYS("A xxx<ESC>", "abc def xx" X "x" N "xyz" N "123");
+ KEYS("A yyy<ESC>", "abc def xxx yy" X "y" N "xyz" N "123");
+ KEYS("u", "abc def xx" X "x" N "xyz" N "123");
+ KEYS("u", "abc de" X "f" N "xyz" N "123");
+ KEYS("<C-r>", "abc def" X " xxx" N "xyz" N "123");
+ KEYS("<C-r>", "abc def xxx" X " yyy" N "xyz" N "123");
+
+ KEYS("izzz<ESC>", "abc def xxxzz" X "z yyy" N "xyz" N "123");
+ KEYS("<C-r>", "abc def xxxzz" X "z yyy" N "xyz" N "123");
+ KEYS("u", "abc def xxx" X " yyy" N "xyz" N "123");
+
+ data.setText("abc" N X "def");
+ KEYS("oxyz<ESC>", "abc" N "def" N "xy" X "z");
+ KEYS("u", "abc" N X "def");
+
+ // undo paste lines
+ data.setText("abc" N);
+ KEYS("yy2p", "abc" N X "abc" N "abc" N);
+ KEYS("yy3p", "abc" N "abc" N X "abc" N "abc" N "abc" N "abc" N);
+ KEYS("u", "abc" N X "abc" N "abc" N);
+ KEYS("u", X "abc" N);
+ KEYS("<C-r>", X "abc" N "abc" N "abc" N);
+ KEYS("<C-r>", "abc" N X "abc" N "abc" N "abc" N "abc" N "abc" N);
+ KEYS("u", "abc" N X "abc" N "abc" N);
+ KEYS("u", X "abc" N);
+
+ // undo paste block
+ data.setText("abc" N "def" N "ghi");
+ KEYS("<C-v>jyp", "a" X "abc" N "ddef" N "ghi");
+ KEYS("2p", "aa" X "aabc" N "ddddef" N "ghi");
+ KEYS("3p", "aaa" X "aaaabc" N "dddddddef" N "ghi");
+ KEYS("u", "aa" X "aabc" N "ddddef" N "ghi");
+ KEYS("u", "a" X "abc" N "ddef" N "ghi");
+
+ // undo indent
+ data.doCommand("set expandtab");
+ data.doCommand("set shiftwidth=4");
+ data.setText("abc" N "def");
+ KEYS(">>", " " X "abc" N "def");
+ KEYS(">>", " " X "abc" N "def");
+ KEYS("<<", " " X "abc" N "def");
+ KEYS("<<", X "abc" N "def");
+ KEYS("u", " " X "abc" N "def");
+ KEYS("u", " " X "abc" N "def");
+ KEYS("u", " " X "abc" N "def");
+ KEYS("u", X "abc" N "def");
+ KEYS("<C-r>", X " abc" N "def");
+ KEYS("<C-r>", " " X " abc" N "def");
+ KEYS("<C-r>", " ab" X "c" N "def");
+ KEYS("<C-r>", "ab" X "c" N "def");
+ KEYS("<C-r>", "ab" X "c" N "def");
+
+ data.setText("abc" N "def");
+ KEYS("2>>", " " X "abc" N " def");
+ KEYS("u", X "abc" N "def");
+ KEYS("<c-r>", X " abc" N " def");
+ KEYS("u", X "abc" N "def");
+ KEYS(">j", " " X "abc" N " def");
+ KEYS("u", X "abc" N "def");
+ KEYS("<c-r>", X " abc" N " def");
+
+ // undo replace line
+ data.setText("abc" N " def" N "ghi");
+ KEYS("jlllSxyz<ESC>", "abc" N "xyz" N "ghi");
+ KEYS("u", "abc" N " " X "def" N "ghi");
+}
+
+void FakeVimPlugin::test_advanced_commands()
+{
+ TestData data;
+ setup(&data);
+
+ // subcommands
+ data.setText("abc" N " xxx" N " xxx" N "def");
+ COMMAND("%s/xxx/ZZZ/g|%s/ZZZ/OOO/g", "abc" N " OOO" N " " X "OOO" N "def");
+
+ // undo/redo all subcommands
+ COMMAND(":undo", "abc" N X " xxx" N " xxx" N "def");
+ COMMAND(":redo", "abc" N X " OOO" N " OOO" N "def");
+
+ // redundant characters
+ COMMAND("::: %s/\\S\\S\\S/ZZZ/g | :::: %s/ZZZ/XXX/g ", "XXX" N " XXX" N " XXX" N X "XXX");
+}
+
+void FakeVimPlugin::test_map()
+{
+ TestData data;
+ setup(&data);
+
+ data.setText("abc def");
+ data.doCommand("map C i<space>x<space><esc>");
+ data.doCommand("map c iXXX");
+ data.doCommand("imap c YYY<space>");
+ KEYS("C", " x" X " abc def");
+ data.doCommand("map C <nop>");
+ KEYS("C", " x" X " abc def");
+ data.doCommand("map C i<bs><esc><right>");
+ KEYS("C", " " X " abc def");
+ KEYS("ccc<esc>", " XXXYYY YYY" X " abc def");
+ // unmap
+ KEYS(":unmap c<cr>ccc<esc>", "YYY" X " ");
+ KEYS(":iunmap c<cr>ccc<esc>", X "c");
+ data.doCommand("unmap C");
+
+ data.setText("abc def");
+ data.doCommand("imap x (((<space><right><right>)))<esc>");
+ KEYS("x", X "bc def");
+ KEYS("ix", "((( bc))" X ") def");
+ data.doCommand("iunmap x");
+
+ data.setText("abc def");
+ data.doCommand("map <c-right> 3l");
+ KEYS("<C-Right>", "abc" X " def");
+ KEYS("<C-Right>", "abc de" X "f");
+
+ // map vs. noremap
+ data.setText("abc def");
+ data.doCommand("map x 3l");
+ data.doCommand("map X x");
+ KEYS("X", "abc" X " def");
+ data.doCommand("noremap X x");
+ KEYS("X", "abc" X "def");
+ data.doCommand("unmap X");
+ data.doCommand("unmap x");
+
+ // limit number of recursions in mappings
+ data.doCommand("map X Y");
+ data.doCommand("map Y Z");
+ data.doCommand("map Z X");
+ KEYS("X", "abc" X "def");
+ data.doCommand("map Z i<space><esc>");
+ KEYS("X", "abc" X " def");
+ data.doCommand("unmap X");
+ data.doCommand("unmap Y");
+ data.doCommand("unmap Z");
+
+ // imcomplete mapping
+ data.setText("abc");
+ data.doCommand("map Xa ia<esc>");
+ data.doCommand("map Xb ib<esc>");
+ data.doCommand("map X ic<esc>");
+ KEYS("Xa", X "aabc");
+ KEYS("Xb", X "baabc");
+ KEYS("Xic<esc>", X "ccbaabc");
+
+ // unmap
+ data.doCommand("unmap Xa");
+ KEYS("Xa<esc>", X "cccbaabc");
+ data.doCommand("unmap Xb");
+ KEYS("Xb", X "ccccbaabc");
+ data.doCommand("unmap X");
+ KEYS("Xb", X "ccccbaabc");
+ KEYS("X<esc>", X "ccccbaabc");
+
+ // recursive mapping
+ data.setText("abc");
+ data.doCommand("map X Y");
+ data.doCommand("map XXX i1<esc>");
+ data.doCommand("map Y i2<esc>");
+ data.doCommand("map YZ i3<esc>");
+ data.doCommand("map _ i <esc>");
+ KEYS("_XXX_", X " 1 abc");
+ KEYS("XX_0", X " 22 1 abc");
+ KEYS("XXXXZ_0", X " 31 22 1 abc");
+ KEYS("XXXXX_0", X " 221 31 22 1 abc");
+ KEYS("XXZ", X "32 221 31 22 1 abc");
+ data.doCommand("unmap X");
+ data.doCommand("unmap XXX");
+ data.doCommand("unmap Y");
+ data.doCommand("unmap YZ");
+ data.doCommand("unmap _");
+
+ // shift modifier
+ data.setText("abc");
+ data.doCommand("map x i1<esc>");
+ data.doCommand("map X i2<esc>");
+ KEYS("x", X "1abc");
+ KEYS("X", X "21abc");
+ data.doCommand("map <S-X> i3<esc>");
+ KEYS("X", X "321abc");
+ data.doCommand("map X i4<esc>");
+ KEYS("X", X "4321abc");
+ KEYS("x", X "14321abc");
+ data.doCommand("unmap x");
+ data.doCommand("unmap X");
+
+ // undo/redo mapped input
+ data.setText("abc def ghi");
+ data.doCommand("map X dwea xyz<esc>3l");
+ KEYS("X", "def xyz g" X "hi");
+ KEYS("u", X "abc def ghi");
+ KEYS("<C-r>", X "def xyz ghi");
+ data.doCommand("unmap X");
+
+ data.setText("abc" N " def" N " ghi");
+ data.doCommand("map X jdd");
+ KEYS("X", "abc" N " " X "ghi");
+ KEYS("u", "abc" N X " def" N " ghi");
+ KEYS("<c-r>", "abc" N X " ghi");
+ data.doCommand("unmap X");
+
+ data.setText("abc" N "def" N "ghi");
+ data.doCommand("map X jAxxx<cr>yyy<esc>");
+ KEYS("X", "abc" N "defxxx" N "yy" X "y" N "ghi");
+ KEYS("u", "abc" N "de" X "f" N "ghi");
+ KEYS("<c-r>", "abc" N "def" X "xxx" N "yyy" N "ghi");
+ data.doCommand("unmap X");
+
+ NOT_IMPLEMENTED
+ // <C-o>
+ data.setText("abc def");
+ data.doCommand("imap X <c-o>:%s/def/xxx/<cr>");
+ KEYS("iX", "abc xxx");
+}
diff --git a/src/plugins/fakevim/fakevimactions.cpp b/src/plugins/fakevim/fakevimactions.cpp
index 88096894b5..b3f9322e11 100644
--- a/src/plugins/fakevim/fakevimactions.cpp
+++ b/src/plugins/fakevim/fakevimactions.cpp
@@ -218,6 +218,13 @@ FakeVimSettings *theFakeVimSettings()
instance->insertItem(ConfigSmartCase, item, _("smartcase"), _("scs"));
item = new SavedAction(instance);
+ item->setDefaultValue(true);
+ item->setValue(true);
+ item->setSettingsKey(group, _("WrapScan")); item->setCheckable(true);
+ item->setCheckable(true);
+ instance->insertItem(ConfigWrapScan, item, _("wrapscan"), _("ws"));
+
+ item = new SavedAction(instance);
item->setDefaultValue(_("indent,eol,start"));
item->setSettingsKey(group, _("Backspace"));
instance->insertItem(ConfigBackspace, item, _("backspace"), _("bs"));
diff --git a/src/plugins/fakevim/fakevimactions.h b/src/plugins/fakevim/fakevimactions.h
index ae0bc65df9..d399ca7e1d 100644
--- a/src/plugins/fakevim/fakevimactions.h
+++ b/src/plugins/fakevim/fakevimactions.h
@@ -52,9 +52,11 @@ enum FakeVimSettingsCode
ConfigExpandTab,
ConfigAutoIndent,
ConfigSmartIndent,
+
ConfigIncSearch,
ConfigUseCoreSearch,
ConfigSmartCase,
+ ConfigWrapScan,
// indent allow backspacing over autoindent
// eol allow backspacing over line breaks (join lines)
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index d24d14528f..37f808f231 100644
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -59,6 +59,7 @@
#include "fakevimhandler.h"
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QDebug>
@@ -98,7 +99,7 @@
//#define DEBUG_UNDO 1
#if DEBUG_UNDO
-# define UNDO_DEBUG(s) qDebug() << << document()->availableUndoSteps() << s
+# define UNDO_DEBUG(s) qDebug() << << revision() << s
#else
# define UNDO_DEBUG(s)
#endif
@@ -125,20 +126,13 @@ namespace Internal {
#define EndOfDocument QTextCursor::End
#define StartOfDocument QTextCursor::Start
+#define ParagraphSeparator QChar::ParagraphSeparator
+
#define EDITOR(s) (m_textedit ? m_textedit->s : m_plaintextedit->s)
-enum {
-#ifdef Q_OS_MAC
- RealControlModifier = Qt::MetaModifier
-#else
- RealControlModifier = Qt::ControlModifier
-#endif
-};
-// Enforce use of RealControlModifier by breaking the compilation.
-#define MetaModifier // Use RealControlModifier instead
-#define ControlModifier // Use RealControlModifier instead
+#define MetaModifier // Use HostOsInfo::controlModifier() instead
+#define ControlModifier // Use HostOsInfo::controlModifier() instead
-const int ParagraphSeparator = 0x00002029;
typedef QLatin1String _;
/* Clipboard MIME types used by Vim. */
@@ -242,6 +236,18 @@ enum EventResult
EventPassedToCore
};
+typedef QHash<int, QTextCursor> Marks;
+struct State
+{
+ State() : revision(-1), position(-1), line(-1), marks() {}
+ State(int revision, int position, int line, const Marks &marks)
+ : revision(revision), position(position), line(line), marks(marks) {}
+ int revision;
+ int position;
+ int line;
+ Marks marks;
+};
+
struct Column
{
Column(int p, int l) : physical(p), logical(l) {}
@@ -282,21 +288,26 @@ struct SearchData
SearchData()
{
forward = true;
- mustMove = true;
highlightMatches = true;
- highlightCursor = true;
}
QString needle;
bool forward;
- bool mustMove;
bool highlightMatches;
- bool highlightCursor;
};
+// If string begins with given prefix remove it with trailing spaces and return true.
+static bool eatString(const QString &prefix, QString *str)
+{
+ if (!str->startsWith(prefix))
+ return false;
+ *str = str->mid(prefix.size()).trimmed();
+ return true;
+}
+
static QRegExp vimPatternToQtPattern(QString needle, bool smartcase)
{
- /* Trasformations (Vim regexp -> QRegExp):
+ /* Transformations (Vim regexp -> QRegExp):
* \a -> [A-Za-z]
* \A -> [^A-Za-z]
* \h -> [A-Za-z_]
@@ -465,13 +476,32 @@ bool ExCommand::matches(const QString &min, const QString &full) const
void ExCommand::setContentsFromLine(const QString &line)
{
- cmd = line.section(' ', 0, 0);
- args = line.mid(cmd.size() + 1).trimmed();
- while (cmd.startsWith(QLatin1Char(':')))
- cmd.remove(0, 1);
- hasBang = cmd.endsWith('!');
- if (hasBang)
- cmd.chop(1);
+ // split command to subcommands
+ subCommands = line.split('|');
+}
+
+bool ExCommand::nextSubcommand()
+{
+ cmd.clear();
+ while (cmd.isEmpty() && !subCommands.isEmpty()) {
+ cmd = subCommands.takeFirst().trimmed();
+ cmd.remove(QRegExp("^:+\\s*")); // remove leading colons
+ hasBang = cmd.endsWith('!');
+ if (hasBang)
+ cmd.chop(1);
+
+ // command arguments
+ args = cmd.section(QRegExp("\\s+"), 1);
+ if (!args.isEmpty())
+ cmd = cmd.left(cmd.size() - args.size()).trimmed();
+ }
+
+ return !cmd.isEmpty();
+}
+
+QString ExCommand::printCommand() const
+{
+ return subCommands.isEmpty() ? cmd : cmd + "|" + subCommands.join("|");
}
QDebug operator<<(QDebug ts, const ExCommand &cmd)
@@ -528,7 +558,13 @@ public:
: m_key(0), m_xkey(0), m_modifiers(0) {}
explicit Input(QChar x)
- : m_key(x.unicode()), m_xkey(x.unicode()), m_modifiers(0), m_text(x) {}
+ : m_key(x.unicode()), m_xkey(x.unicode()), m_modifiers(0), m_text(x)
+ {
+ if (x.isUpper())
+ m_modifiers = Qt::ShiftModifier;
+ else if (x.isLower())
+ m_key = x.toUpper().unicode();
+ }
Input(int k, int m, const QString &t)
: m_key(k), m_modifiers(cleanModifier(m)), m_text(t)
@@ -543,6 +579,11 @@ public:
m_xkey = (m_text.size() == 1 ? m_text.at(0).unicode() : m_key);
}
+ bool isValid() const
+ {
+ return m_key != 0 || !m_text.isNull();
+ }
+
bool isDigit() const
{
return m_xkey >= '0' && m_xkey <= '9';
@@ -571,12 +612,12 @@ public:
bool is(int c) const
{
- return m_xkey == c && m_modifiers != RealControlModifier;
+ return m_xkey == c && m_modifiers != int(HostOsInfo::controlModifier());
}
bool isControl(int c) const
{
- return m_modifiers == RealControlModifier
+ return m_modifiers == int(HostOsInfo::controlModifier())
&& (m_xkey == c || m_xkey + 32 == c || m_xkey + 64 == c || m_xkey + 96 == c);
}
@@ -587,18 +628,16 @@ public:
bool operator==(const Input &a) const
{
- return a.m_key == m_key && a.m_modifiers == m_modifiers
- && m_text == a.m_text;
+ return m_key == a.m_key && m_modifiers == a.m_modifiers && m_text == a.m_text;
}
- // Ignore e.g. ShiftModifier, which is not available in sourced data.
- bool matchesForMap(const Input &a) const
+ bool operator!=(const Input &a) const { return !operator==(a); }
+
+ bool operator<(const Input &a) const
{
- return (a.m_key == m_key || a.m_xkey == m_xkey) && m_text == a.m_text;
+ return m_key < a.m_key || m_modifiers < a.m_modifiers || m_text < a.m_text;
}
- bool operator!=(const Input &a) const { return !operator==(a); }
-
QString text() const { return m_text; }
QChar asChar() const
@@ -629,87 +668,278 @@ private:
QString m_text;
};
+// mapping to <Nop> (do nothing)
+static const Input Nop(-1, -1, QString());
+
QDebug operator<<(QDebug ts, const Input &input) { return input.dump(ts); }
class Inputs : public QVector<Input>
{
public:
- Inputs() {}
- explicit Inputs(const QString &str) { parseFrom(str); }
+ Inputs() : m_noremap(true), m_silent(false) {}
+
+ explicit Inputs(const QString &str, bool noremap = true, bool silent = false)
+ : m_noremap(noremap), m_silent(silent)
+ {
+ parseFrom(str);
+ }
+
+ bool noremap() const { return m_noremap; }
+
+ bool silent() const { return m_silent; }
+
+private:
void parseFrom(const QString &str);
+
+ bool m_noremap;
+ bool m_silent;
};
-static bool iss(char a, char b)
-{
- if (a >= 'a')
- a -= 'a' - 'A';
- if (b >= 'a')
- b -= 'a' - 'A';
- return a == b;
+static QMap<QString, int> vimKeyNames()
+{
+ QMap<QString, int> k;
+
+ // FIXME: Should be value of mapleader.
+ k.insert("LEADER", Key_Backslash);
+
+ k.insert("SPACE", Key_Space);
+ k.insert("TAB", Key_Tab);
+ k.insert("NL", Key_Return);
+ k.insert("NEWLINE", Key_Return);
+ k.insert("LINEFEED", Key_Return);
+ k.insert("LF", Key_Return);
+ k.insert("CR", Key_Return);
+ k.insert("RETURN", Key_Return);
+ k.insert("ENTER", Key_Return);
+ k.insert("BS", Key_Backspace);
+ k.insert("BACKSPACE", Key_Backspace);
+ k.insert("ESC", Key_Escape);
+ k.insert("BAR", Key_Bar);
+ k.insert("BSLASH", Key_Backslash);
+ k.insert("DEL", Key_Delete);
+ k.insert("DELETE", Key_Delete);
+ k.insert("KDEL", Key_Delete);
+ k.insert("UP", Key_Up);
+ k.insert("DOWN", Key_Down);
+ k.insert("LEFT", Key_Left);
+ k.insert("RIGHT", Key_Right);
+
+ k.insert("F1", Key_F1);
+ k.insert("F2", Key_F2);
+ k.insert("F3", Key_F3);
+ k.insert("F4", Key_F4);
+ k.insert("F5", Key_F5);
+ k.insert("F6", Key_F6);
+ k.insert("F7", Key_F7);
+ k.insert("F8", Key_F8);
+ k.insert("F9", Key_F9);
+ k.insert("F10", Key_F10);
+
+ k.insert("F11", Key_F11);
+ k.insert("F12", Key_F12);
+ k.insert("F13", Key_F13);
+ k.insert("F14", Key_F14);
+ k.insert("F15", Key_F15);
+ k.insert("F16", Key_F16);
+ k.insert("F17", Key_F17);
+ k.insert("F18", Key_F18);
+ k.insert("F19", Key_F19);
+ k.insert("F20", Key_F20);
+
+ k.insert("F21", Key_F21);
+ k.insert("F22", Key_F22);
+ k.insert("F23", Key_F23);
+ k.insert("F24", Key_F24);
+ k.insert("F25", Key_F25);
+ k.insert("F26", Key_F26);
+ k.insert("F27", Key_F27);
+ k.insert("F28", Key_F28);
+ k.insert("F29", Key_F29);
+ k.insert("F30", Key_F30);
+
+ k.insert("F31", Key_F31);
+ k.insert("F32", Key_F32);
+ k.insert("F33", Key_F33);
+ k.insert("F34", Key_F34);
+ k.insert("F35", Key_F35);
+
+ k.insert("INSERT", Key_Insert);
+ k.insert("INS", Key_Insert);
+ k.insert("KINSERT", Key_Insert);
+ k.insert("HOME", Key_Home);
+ k.insert("END", Key_End);
+ k.insert("PAGEUP", Key_PageUp);
+ k.insert("PAGEDOWN", Key_PageDown);
+
+ k.insert("KPLUS", Key_Plus);
+ k.insert("KMINUS", Key_Minus);
+ k.insert("KDIVIDE", Key_Slash);
+ k.insert("KMULTIPLY", Key_Asterisk);
+ k.insert("KENTER", Key_Enter);
+ k.insert("KPOINT", Key_Period);
+
+ return k;
+}
+
+static Input parseVimKeyName(const QString &keyName)
+{
+ if (keyName.length() == 1)
+ return Input(keyName.at(0));
+
+ const QStringList keys = keyName.split('-');
+ const int len = keys.length();
+
+ if (len == 1 && keys.at(0) == _("nop"))
+ return Nop;
+
+ int mods = NoModifier;
+ for (int i = 0; i < len - 1; ++i) {
+ const QString &key = keys[i].toUpper();
+ if (key == "S")
+ mods |= Qt::ShiftModifier;
+ else if (key == "C")
+ mods |= HostOsInfo::controlModifier();
+ else
+ return Input();
+ }
+
+ if (!keys.isEmpty()) {
+ const QString key = keys.last();
+ if (key.length() == 1) {
+ // simple character
+ QChar c = key.at(0).toUpper();
+ return Input(c.unicode(), mods, QString(c));
+ }
+
+ // find key name
+ static const QMap<QString, int> k = vimKeyNames();
+ QMap<QString, int>::ConstIterator it = k.constFind(key.toUpper());
+ if (it != k.end())
+ return Input(*it, mods, *it <= 0x7f ? QString(QChar::fromLatin1(*it)) : QString(""));
+ }
+
+ return Input();
}
void Inputs::parseFrom(const QString &str)
{
const int n = str.size();
for (int i = 0; i < n; ++i) {
- uint c0 = str.at(i).unicode(), c1 = 0, c2 = 0, c3 = 0, c4 = 0;
- if (i + 1 < n)
- c1 = str.at(i + 1).unicode();
- if (i + 2 < n)
- c2 = str.at(i + 2).unicode();
- if (i + 3 < n)
- c3 = str.at(i + 3).unicode();
- if (i + 4 < n)
- c4 = str.at(i + 4).unicode();
- if (c0 == '<') {
- if (iss(c1, 'C') && c2 == '-' && c4 == '>') {
- uint c = (c3 < 90 ? c3 : c3 - 32);
- append(Input(c, RealControlModifier, QString(QChar(c - 64))));
- i += 4;
- } else if (iss(c1, 'C') && iss(c2, 'R') && c3 == '>') {
- append(Input(Key_Return, Qt::NoModifier, QString(QChar(13))));
- i += 3;
- } else if (iss(c1, 'E') && iss(c2, 'S') && iss(c3, 'C') && c4 == '>') {
- append(Input(Key_Escape, Qt::NoModifier, QString(QChar(27))));
- i += 4;
+ uint c = str.at(i).unicode();
+ if (c == '<') {
+ int j = str.indexOf('>', i);
+ Input input;
+ if (j != -1)
+ input = parseVimKeyName(str.mid(i+1, j - i - 1));
+ if (input.isValid()) {
+ append(input);
+ i = j;
} else {
- append(Input(QLatin1Char(c0)));
+ append(Input(QLatin1Char(c)));
}
} else {
- append(Input(QLatin1Char(c0)));
+ append(Input(QLatin1Char(c)));
}
}
}
-// This wraps a string and a "cursor position".
+class History
+{
+public:
+ History() : m_items(QString()), m_index(0) {}
+ void append(const QString &item);
+ const QString &move(const QStringRef &prefix, int skip);
+ const QString &current() const { return m_items[m_index]; }
+ const QStringList &items() const { return m_items; }
+ void restart() { m_index = m_items.size() - 1; }
+
+private:
+ // Last item is always empty or current search prefix.
+ QStringList m_items;
+ int m_index;
+};
+
+void History::append(const QString &item)
+{
+ if (item.isEmpty())
+ return;
+ m_items.pop_back();
+ m_items.removeAll(item);
+ m_items << item << QString();
+ restart();
+}
+
+const QString &History::move(const QStringRef &prefix, int skip)
+{
+ if (!current().startsWith(prefix))
+ restart();
+
+ if (m_items.last() != prefix)
+ m_items[m_items.size() - 1] = prefix.toString();
+
+ int i = m_index + skip;
+ if (!prefix.isEmpty())
+ for (; i >= 0 && i < m_items.size() && !m_items[i].startsWith(prefix); i += skip);
+ if (i >= 0 && i < m_items.size())
+ m_index = i;
+
+ return current();
+}
+
+// Command line buffer with prompt (i.e. :, / or ? characters), text contents and cursor position.
class CommandBuffer
{
public:
- CommandBuffer() : m_pos(0) {}
+ CommandBuffer() : m_pos(0), m_userPos(0), m_historyAutoSave(true) {}
- void clear() { m_buffer.clear(); m_pos = 0; }
+ void setPrompt(const QChar &prompt) { m_prompt = prompt; }
void setContents(const QString &s) { m_buffer = s; m_pos = s.size(); }
- QString contents() const { return m_buffer; }
+
+ void setContents(const QString &s, int pos) { m_buffer = s; m_pos = m_userPos = pos; }
+
+ QStringRef userContents() const { return m_buffer.leftRef(m_userPos); }
+ const QChar &prompt() const { return m_prompt; }
+ const QString &contents() const { return m_buffer; }
bool isEmpty() const { return m_buffer.isEmpty(); }
int cursorPos() const { return m_pos; }
- void insertChar(QChar c) { m_buffer.insert(m_pos++, c); }
- void insertText(const QString &s) { m_buffer.insert(m_pos, s); m_pos += s.size(); }
- void deleteChar() { if (m_pos) m_buffer.remove(--m_pos, 1); }
+ void insertChar(QChar c) { m_buffer.insert(m_pos++, c); m_userPos = m_pos; }
+ void insertText(const QString &s)
+ {
+ m_buffer.insert(m_pos, s); m_userPos = m_pos = m_pos + s.size();
+ }
+ void deleteChar() { if (m_pos) m_buffer.remove(--m_pos, 1); m_userPos = m_pos; }
+
+ void moveLeft() { if (m_pos) m_userPos = --m_pos; }
+ void moveRight() { if (m_pos < m_buffer.size()) m_userPos = ++m_pos; }
+ void moveStart() { m_userPos = m_pos = 0; }
+ void moveEnd() { m_userPos = m_pos = m_buffer.size(); }
+
+ void setHistoryAutoSave(bool autoSave) { m_historyAutoSave = autoSave; }
+ void historyDown() { setContents(m_history.move(userContents(), 1)); }
+ void historyUp() { setContents(m_history.move(userContents(), -1)); }
+ const QStringList &historyItems() const { return m_history.items(); }
+ void historyPush(const QString &item = QString())
+ {
+ m_history.append(item.isNull() ? contents() : item);
+ }
- void moveLeft() { if (m_pos) --m_pos; }
- void moveRight() { if (m_pos < m_buffer.size()) ++m_pos; }
- void moveStart() { m_pos = 0; }
- void moveEnd() { m_pos = m_buffer.size(); }
+ void clear()
+ {
+ if (m_historyAutoSave)
+ historyPush();
+ m_buffer.clear();
+ m_userPos = m_pos = 0;
+ }
QString display() const
{
- QString msg;
+ QString msg(m_prompt);
for (int i = 0; i != m_buffer.size(); ++i) {
const QChar c = m_buffer.at(i);
if (c.unicode() < 32) {
msg += '^';
- msg += QChar(c.unicode() + 64);
+ msg += QLatin1Char(c.unicode() + 64);
} else {
msg += c;
}
@@ -730,6 +960,8 @@ public:
} else if (input.isKey(Key_Delete)) {
if (m_pos < m_buffer.size())
m_buffer.remove(m_pos, 1);
+ else
+ deleteChar();
} else if (!input.text().isEmpty()) {
insertText(input.text());
} else {
@@ -740,100 +972,155 @@ public:
private:
QString m_buffer;
+ QChar m_prompt;
+ History m_history;
int m_pos;
+ int m_userPos; // last position of inserted text (for retrieving history items)
+ bool m_historyAutoSave; // store items to history on clear()?
};
-
-class History
+// Mappings for a specific mode (trie structure)
+class ModeMapping : public QMap<Input, ModeMapping>
{
public:
- History() : m_index(0) {}
- void append(const QString &item);
- void down() { m_index = qMin(m_index + 1, m_items.size()); }
- void up() { m_index = qMax(m_index - 1, 0); }
- void restart() { m_index = m_items.size(); }
- QString current() const { return m_items.value(m_index, QString()); }
- QStringList items() const { return m_items; }
-
+ const Inputs &value() const { return m_value; }
+ void setValue(const Inputs &value) { m_value = value; }
private:
- QStringList m_items;
- int m_index;
+ Inputs m_value;
};
-void History::append(const QString &item)
-{
- if (item.isEmpty())
- return;
- m_items.removeAll(item);
- m_items.append(item); m_index = m_items.size() - 1;
-}
+// Mappings for all modes
+typedef QHash<char, ModeMapping> Mappings;
-// Mappings for a specific mode.
-class ModeMapping : public QList<QPair<Inputs, Inputs> >
+// Iterator for mappings
+class MappingsIterator : public QVector<ModeMapping::Iterator>
{
public:
- ModeMapping() { test(); }
-
- void test()
+ MappingsIterator(Mappings *mappings, char mode = -1, const Inputs &inputs = Inputs())
+ : m_parent(mappings)
{
- //insert(Inputs() << Input('A') << Input('A'),
- // Inputs() << Input('x') << Input('x'));
+ reset(mode);
+ walk(inputs);
}
- void insert(const Inputs &from, const Inputs &to)
+ // Reset iterator state. Keep previous mode if 0.
+ void reset(char mode = 0)
{
- for (int i = 0; i != size(); ++i)
- if (at(i).first == from) {
- (*this)[i].second = to;
- return;
- }
- append(QPair<Inputs, Inputs>(from, to));
+ clear();
+ m_lastValid = -1;
+ m_invalidInputCount = 0;
+ if (mode != 0) {
+ m_mode = mode;
+ if (mode != -1)
+ m_modeMapping = m_parent->find(mode);
+ }
}
- void remove(const Inputs &from)
- {
- for (int i = 0; i != size(); ++i)
- if (at(i).first == from) {
- removeAt(i);
- return;
- }
- }
+ bool isValid() const { return !empty(); }
+
+ // Return true if mapping can be extended.
+ bool canExtend() const { return isValid() && !last()->empty(); }
+
+ // Return true if this mapping can be used.
+ bool isComplete() const { return m_lastValid != -1; }
+
+ // Return size of current map.
+ int mapLength() const { return m_lastValid + 1; }
- // Returns 'false' if more input is needed to decide whether a mapping
- // needs to be applied. If a decision can be made, return 'true',
- // and replace *input with the mapped data.
- bool mappingDone(Inputs *inputs) const
+ int invalidInputCount() const { return m_invalidInputCount; }
+
+ bool walk(const Input &input)
{
- // FIXME: inefficient.
- for (int i = 0; i != size(); ++i) {
- const Inputs &haystack = at(i).first;
- // A mapping
- if (couldTriggerMap(haystack, *inputs)) {
- if (haystack.size() != inputs->size())
- return false; // This can be extended.
- // Actual mapping.
- *inputs = at(i).second;
- return true;
- }
+ if (m_modeMapping == m_parent->end())
+ return false;
+
+ if (!input.isValid()) {
+ m_invalidInputCount += 1;
+ return true;
+ }
+
+ ModeMapping::Iterator it;
+ if (isValid()) {
+ it = last()->find(input);
+ if (it == last()->end())
+ return false;
+ } else {
+ it = m_modeMapping->find(input);
+ if (it == m_modeMapping->end())
+ return false;
}
- // No extensible mapping found. Use inputs as-is.
+
+ if (!it->value().isEmpty())
+ m_lastValid = size();
+ append(it);
+
return true;
}
-private:
- static bool couldTriggerMap(const Inputs &haystack, const Inputs &needle)
+ bool walk(const Inputs &inputs)
{
- // Input is already too long.
- if (needle.size() > haystack.size())
- return false;
- for (int i = 0; i != needle.size(); ++i) {
- if (!needle.at(i).matchesForMap(haystack.at(i)))
+ foreach (const Input &input, inputs) {
+ if (!walk(input))
return false;
}
return true;
}
+
+ // Return current mapped value. Iterator must be valid.
+ const Inputs &inputs() const
+ {
+ return at(m_lastValid)->value();
+ }
+
+ void remove()
+ {
+ if (isValid()) {
+ if (canExtend()) {
+ last()->setValue(Inputs());
+ } else {
+ if (size() > 1) {
+ while (last()->empty()) {
+ at(size() - 2)->erase(last());
+ pop_back();
+ if (size() == 1 || !last()->value().isEmpty())
+ break;
+ }
+ if (last()->empty() && last()->value().isEmpty())
+ m_modeMapping->erase(last());
+ } else if (last()->empty() && !last()->value().isEmpty()) {
+ m_modeMapping->erase(last());
+ }
+ }
+ }
+ }
+
+ void setInputs(const Inputs &key, const Inputs &inputs, bool unique = false)
+ {
+ ModeMapping *current = &(*m_parent)[m_mode];
+ foreach (const Input &input, key)
+ current = &(*current)[input];
+ if (!unique || current->value().isEmpty())
+ current->setValue(inputs);
+ }
+
+private:
+ Mappings *m_parent;
+ Mappings::Iterator m_modeMapping;
+ int m_lastValid;
+ int m_invalidInputCount;
+ char m_mode;
};
+// state of current mapping
+struct MappingState {
+ MappingState()
+ : maxMapDepth(1000), noremap(false), silent(false) {}
+ MappingState(int depth, bool noremap, bool silent)
+ : maxMapDepth(depth), noremap(noremap), silent(silent) {}
+ int maxMapDepth;
+ bool noremap;
+ bool silent;
+};
class FakeVimHandler::Private : public QObject
{
@@ -855,8 +1142,9 @@ public:
friend class FakeVimHandler;
void init();
- EventResult handleKey(const Input &);
- Q_SLOT EventResult handleKey2();
+ EventResult handleKey(const Input &input);
+ EventResult handleDefaultKey(const Input &input);
+ Q_SLOT void handleMappedKeys();
EventResult handleInsertMode(const Input &);
EventResult handleReplaceMode(const Input &);
EventResult handleCommandMode(const Input &);
@@ -868,13 +1156,15 @@ public:
EventResult handleCloseSquareSubMode(const Input &);
EventResult handleSearchSubSubMode(const Input &);
EventResult handleCommandSubSubMode(const Input &);
- void finishMovement(const QString &dotCommand = QString());
- void finishMovement(const QString &dotCommand, int count);
+ void finishMovement(const QString &dotCommandMovement = QString());
+ void finishMovement(const QString &dotCommandMovement, int count);
void resetCommandMode();
- void search(const SearchData &sd);
+ void search(const SearchData &sd, bool showMessages = true);
+ void searchNext(bool forward = true);
void searchBalanced(bool forward, QChar needle, QChar other);
void highlightMatches(const QString &needle);
void stopIncrementalFind();
+ void updateFind(bool isComplete);
int mvCount() const { return m_mvcount.isEmpty() ? 1 : m_mvcount.toInt(); }
int opCount() const { return m_opcount.isEmpty() ? 1 : m_opcount.toInt(); }
@@ -882,8 +1172,19 @@ public:
QTextBlock block() const { return cursor().block(); }
int leftDist() const { return position() - block().position(); }
int rightDist() const { return block().length() - leftDist() - 1; }
+ bool atBlockStart() const { return cursor().atBlockStart(); }
bool atBlockEnd() const { return cursor().atBlockEnd(); }
bool atEndOfLine() const { return atBlockEnd() && block().length() > 1; }
+ bool atDocumentEnd() const { return cursor().atEnd(); }
+ bool atDocumentStart() const { return cursor().atStart(); }
+
+ bool atEmptyLine(const QTextCursor &tc = QTextCursor()) const;
+ bool atBoundary(bool end, bool simple, bool onlyWords = false,
+ const QTextCursor &tc = QTextCursor()) const;
+ bool atWordBoundary(bool end, bool simple, const QTextCursor &tc = QTextCursor()) const;
+ bool atWordStart(bool simple, const QTextCursor &tc = QTextCursor()) const;
+ bool atWordEnd(bool simple, const QTextCursor &tc = QTextCursor()) const;
+ bool isFirstNonBlankOnLine(int pos);
int lastPositionInDocument() const; // Returns last valid position in doc.
int firstPositionInLine(int line) const; // 1 based line, 0 based pos
@@ -924,15 +1225,25 @@ public:
void shiftRegionRight(int repeat = 1);
void moveToFirstNonBlankOnLine();
+ void moveToFirstNonBlankOnLine(QTextCursor *tc);
void moveToTargetColumn();
void setTargetColumn() {
m_targetColumn = logicalCursorColumn();
m_visualTargetColumn = m_targetColumn;
//qDebug() << "TARGET: " << m_targetColumn;
}
- void moveToNextWord(bool simple, bool deleteWord = false);
void moveToMatchingParanthesis();
- void moveToWordBoundary(bool simple, bool forward, bool changeWord = false);
+ void moveToBoundary(bool simple, bool forward = true);
+ void moveToNextBoundary(bool end, int count, bool simple, bool forward);
+ void moveToNextBoundaryStart(int count, bool simple, bool forward = true);
+ void moveToNextBoundaryEnd(int count, bool simple, bool forward = true);
+ void moveToBoundaryStart(int count, bool simple, bool forward = true);
+ void moveToBoundaryEnd(int count, bool simple, bool forward = true);
+ void moveToNextWord(bool end, int count, bool simple, bool forward, bool emptyLines);
+ void moveToNextWordStart(int count, bool simple, bool forward = true, bool emptyLines = true);
+ void moveToNextWordEnd(int count, bool simple, bool forward = true, bool emptyLines = true);
+ void moveToWordStart(int count, bool simple, bool forward = true, bool emptyLines = true);
+ void moveToWordEnd(int count, bool simple, bool forward = true, bool emptyLines = true);
// Convenience wrappers to reduce line noise.
void moveToStartOfLine();
@@ -992,45 +1303,39 @@ public:
void enterReplaceMode();
void enterCommandMode();
void enterExMode();
- void showRedMessage(const QString &msg);
- void showBlackMessage(const QString &msg);
+ void showMessage(MessageLevel level, const QString &msg);
+ void clearMessage() { showMessage(MessageInfo, QString()); }
void notImplementedYet();
void updateMiniBuffer();
void updateSelection();
+ void updateHighlights();
void updateCursorShape();
QWidget *editor() const;
QTextDocument *document() const { return EDITOR(document()); }
QChar characterAtCursor() const
{ return document()->characterAt(position()); }
- void beginEditBlock()
- { UNDO_DEBUG("BEGIN EDIT BLOCK"); cursor().beginEditBlock(); }
- void endEditBlock()
- { UNDO_DEBUG("END EDIT BLOCK"); cursor().endEditBlock(); }
- void joinPreviousEditBlock()
- { UNDO_DEBUG("JOIN"); cursor().joinPreviousEditBlock(); }
- void breakEditBlock() {
- QTextCursor tc = cursor();
- tc.clearSelection();
- tc.beginEditBlock();
- tc.insertText("x");
- tc.deletePreviousChar();
- tc.endEditBlock();
- setCursor(tc);
- }
+
+ void joinPreviousEditBlock();
+ void beginEditBlock(bool rememberPosition = true);
+ void beginLargeEditBlock() { beginEditBlock(false); }
+ void endEditBlock();
+ void breakEditBlock() { m_breakEditBlock = true; }
bool isVisualMode() const { return m_visualMode != NoVisualMode; }
bool isNoVisualMode() const { return m_visualMode == NoVisualMode; }
bool isVisualCharMode() const { return m_visualMode == VisualCharMode; }
bool isVisualLineMode() const { return m_visualMode == VisualLineMode; }
bool isVisualBlockMode() const { return m_visualMode == VisualBlockMode; }
+ char currentModeCode() const;
void updateEditor();
+ void selectTextObject(bool simple, bool inner);
void selectWordTextObject(bool inner);
void selectWORDTextObject(bool inner);
void selectSentenceTextObject(bool inner);
void selectParagraphTextObject(bool inner);
void selectBlockTextObject(bool inner, char left, char right);
- void changeNumberTextObject(bool doIncrement);
+ void changeNumberTextObject(int count);
void selectQuotedStringTextObject(bool inner, const QString &quote);
Q_SLOT void importSelection();
@@ -1067,17 +1372,14 @@ public:
int m_gflag; // whether current command started with 'g'
- QString m_commandPrefix;
- CommandBuffer m_commandBuffer;
QString m_currentFileName;
- QString m_currentMessage;
- bool m_lastSearchForward;
- bool m_findPending;
int m_findStartPosition;
QString m_lastInsertion;
QString m_lastDeletion;
+ bool m_breakEditBlock;
+
int anchor() const { return cursor().anchor(); }
int position() const { return cursor().position(); }
@@ -1120,15 +1422,19 @@ public:
void pasteText(bool afterCursor);
// undo handling
+ int revision() const { return document()->availableUndoSteps(); }
void undo();
void redo();
- void setUndoPosition();
- QMap<int, int> m_undoCursorPosition; // revision -> position
+ void setUndoPosition(bool overwrite = true);
+ // revision -> state
+ QStack<State> m_undo;
+ QStack<State> m_redo;
// extra data for '.'
void replay(const QString &text, int count);
void setDotCommand(const QString &cmd) { g.dotCommand = cmd; }
void setDotCommand(const QString &cmd, int n) { g.dotCommand = cmd.arg(n); }
+ QString visualDotCommand() const;
// extra data for ';'
QString m_semicolonCount;
@@ -1144,7 +1450,6 @@ public:
// marks as lines
int mark(int code) const;
void setMark(int code, int position);
- typedef QHash<int, QTextCursor> Marks;
typedef QHashIterator<int, QTextCursor> MarksIterator;
Marks m_marks;
@@ -1173,12 +1478,15 @@ public:
void getRegisterType(int reg, bool *isClipboard, bool *isSelection) const;
void recordJump();
- QVector<CursorPosition> m_jumpListUndo;
- QVector<CursorPosition> m_jumpListRedo;
+ void jump(int distance);
+ QStack<CursorPosition> m_jumpListUndo;
+ QStack<CursorPosition> m_jumpListRedo;
int m_lastChangePosition;
- QList<QTextEdit::ExtraSelection> m_searchSelections;
+ QList<QTextEdit::ExtraSelection> m_extraSelections;
QTextCursor m_searchCursor;
+ int m_searchStartPosition;
+ int m_searchFromScreenLine;
QString m_oldNeedle;
QString m_lastSubstituteFlags;
QRegExp m_lastSubstitutePattern;
@@ -1186,7 +1494,7 @@ public:
QTextCursor m_lastSelectionCursor;
VisualMode m_lastSelectionMode;
- bool handleExCommandHelper(const ExCommand &cmd); // Returns success.
+ bool handleExCommandHelper(ExCommand &cmd); // Returns success.
bool handleExPluginCommand(const ExCommand &cmd); // Handled by plugin?
bool handleExBangCommand(const ExCommand &cmd);
bool handleExDeleteCommand(const ExCommand &cmd);
@@ -1198,6 +1506,7 @@ public:
bool handleExNormalCommand(const ExCommand &cmd);
bool handleExReadCommand(const ExCommand &cmd);
bool handleExRedoCommand(const ExCommand &cmd);
+ bool handleExUndoCommand(const ExCommand &cmd);
bool handleExSetCommand(const ExCommand &cmd);
bool handleExShiftCommand(const ExCommand &cmd);
bool handleExSourceCommand(const ExCommand &cmd);
@@ -1212,31 +1521,45 @@ public:
signed char m_charClass[256];
bool m_ctrlVActive;
+ void miniBufferTextEdited(const QString &text, int cursorPos);
+
static struct GlobalData
{
GlobalData()
+ : mappings(), currentMap(&mappings), inputTimer(-1), currentMessageLevel(MessageInfo),
+ lastSearchForward(false), findPending(false)
{
- inputTimer = -1;
+ // default mapping state - shouldn't be removed
+ mapStates << MappingState();
+ commandBuffer.setPrompt(':');
}
- // Input.
- Inputs pendingInput;
- int inputTimer;
-
// Repetition.
QString dotCommand;
- // History for searches.
- History searchHistory;
-
- // History for :ex commands.
- History commandHistory;
-
QHash<int, Register> registers;
// All mappings.
- typedef QHash<char, ModeMapping> Mappings;
Mappings mappings;
+
+ // Input.
+ Inputs pendingInput;
+ MappingsIterator currentMap;
+ int inputTimer;
+ QStack<MappingState> mapStates;
+
+ // Command line buffers.
+ CommandBuffer commandBuffer;
+ CommandBuffer searchBuffer;
+
+ // Current mini buffer message.
+ QString currentMessage;
+ MessageLevel currentMessageLevel;
+
+ // Search state
+ QString lastSearch;
+ bool lastSearchForward;
+ bool findPending;
} g;
};
@@ -1259,12 +1582,12 @@ void FakeVimHandler::Private::init()
m_subsubmode = NoSubSubMode;
m_passing = false;
m_firstKeyPending = false;
- m_findPending = false;
+ g.findPending = false;
m_findStartPosition = -1;
m_fakeEnd = false;
m_positionPastEnd = false;
m_anchorPastEnd = false;
- m_lastSearchForward = true;
+ g.lastSearchForward = true;
m_register = '"';
m_gflag = false;
m_visualMode = NoVisualMode;
@@ -1281,6 +1604,9 @@ void FakeVimHandler::Private::init()
m_oldExternalPosition = -1;
m_oldPosition = -1;
m_lastChangePosition = -1;
+ m_breakEditBlock = false;
+ m_searchStartPosition = 0;
+ m_searchFromScreenLine = 0;
setupCharClass();
}
@@ -1305,7 +1631,7 @@ bool FakeVimHandler::Private::wantsOverride(QKeyEvent *ev)
}
// We are interested in overriding most Ctrl key combinations.
- if (mods == RealControlModifier
+ if (mods == int(HostOsInfo::controlModifier())
&& !config(ConfigPassControlKey).toBool()
&& ((key >= Key_A && key <= Key_Z && key != Key_K)
|| key == Key_BracketLeft || key == Key_BracketRight)) {
@@ -1388,12 +1714,11 @@ EventResult FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
QTextCursor tc = cursor();
tc.setVisualNavigation(true);
- setCursor(tc);
-
if (m_firstKeyPending) {
m_firstKeyPending = false;
recordJump();
}
+ setCursor(tc);
if (m_fakeEnd)
moveRight();
@@ -1489,7 +1814,10 @@ void FakeVimHandler::Private::exportSelection()
QTC_CHECK(false);
}
} else {
- setAnchorAndPosition(pos, pos);
+ if (m_subsubmode == SearchSubSubMode && !m_searchCursor.isNull())
+ setCursor(m_searchCursor);
+ else
+ setAnchorAndPosition(pos, pos);
}
m_oldExternalPosition = position();
m_oldExternalAnchor = anchor();
@@ -1512,7 +1840,7 @@ void FakeVimHandler::Private::importSelection()
// Import new selection.
Qt::KeyboardModifiers mods = QApplication::keyboardModifiers();
if (cursor().hasSelection()) {
- if (mods & RealControlModifier)
+ if (mods & HostOsInfo::controlModifier())
m_visualMode = VisualBlockMode;
else if (mods & Qt::AltModifier)
m_visualMode = VisualBlockMode;
@@ -1538,7 +1866,7 @@ void FakeVimHandler::Private::updateEditor()
void FakeVimHandler::Private::restoreWidget(int tabSize)
{
- //showBlackMessage(QString());
+ //clearMessage();
//updateMiniBuffer();
//EDITOR(removeEventFilter(q));
//EDITOR(setReadOnly(m_wasReadOnly));
@@ -1551,72 +1879,142 @@ void FakeVimHandler::Private::restoreWidget(int tabSize)
m_subsubmode = NoSubSubMode;
updateCursorShape();
updateSelection();
+ updateHighlights();
}
EventResult FakeVimHandler::Private::handleKey(const Input &input)
{
KEY_DEBUG("HANDLE INPUT: " << input << " MODE: " << mode);
- if (m_mode == ExMode)
- return handleExMode(input);
- if (m_subsubmode == SearchSubSubMode)
- return handleSearchSubSubMode(input);
- if (m_mode == InsertMode || m_mode == ReplaceMode || m_mode == CommandMode) {
+
+ bool handleMapped = true;
+ bool hasInput = input.isValid();
+
+ if (hasInput)
g.pendingInput.append(input);
- const char code = m_mode == InsertMode ? 'i' : 'n';
- if (g.mappings.value(code).mappingDone(&g.pendingInput))
- return handleKey2();
- if (g.inputTimer != -1)
- killTimer(g.inputTimer);
- g.inputTimer = startTimer(1000);
- return EventHandled;
+
+ // Waiting on input to complete mapping?
+ if (g.inputTimer != -1) {
+ killTimer(g.inputTimer);
+ g.inputTimer = -1;
+ // If there is a new input add it to incomplete input or
+ // if the mapped input can be completed complete.
+ if (hasInput && g.currentMap.walk(input)) {
+ if (g.currentMap.canExtend()) {
+ g.inputTimer = startTimer(1000);
+ return EventHandled;
+ } else {
+ hasInput = false;
+ handleMappedKeys();
+ }
+ } else if (g.currentMap.isComplete()) {
+ handleMappedKeys();
+ } else {
+ g.currentMap.reset();
+ handleMapped = false;
+ }
}
+
+ EventResult r = EventUnhandled;
+ while (!g.pendingInput.isEmpty()) {
+ const Input &in = g.pendingInput.front();
+
+ // invalid input is used to pop mapping state
+ if (!in.isValid()) {
+ g.mapStates.pop_back();
+ QTC_CHECK(!g.mapStates.empty());
+ endEditBlock();
+ if (g.mapStates.size() == 1)
+ g.commandBuffer.setHistoryAutoSave(true);
+ if (m_mode == ExMode || m_subsubmode == SearchSubSubMode)
+ updateMiniBuffer(); // update cursor position on command line
+ } else {
+ if (handleMapped && !g.mapStates.last().noremap && m_subsubmode != SearchSubSubMode) {
+ if (!g.currentMap.isValid()) {
+ g.currentMap.reset(currentModeCode());
+ if (!g.currentMap.walk(g.pendingInput) && g.currentMap.isComplete()) {
+ handleMappedKeys();
+ continue;
+ }
+ }
+
+ // handle user mapping
+ if (g.currentMap.canExtend()) {
+ // wait for user to press any key or trigger complete mapping after interval
+ g.inputTimer = startTimer(1000);
+ return EventHandled;
+ } else if (g.currentMap.isComplete()) {
+ handleMappedKeys();
+ continue;
+ }
+ }
+
+ r = handleDefaultKey(in);
+ // TODO: Unhadled events!
+ }
+ handleMapped = true;
+ g.pendingInput.pop_front();
+ }
+
+ return r;
+}
+
+EventResult FakeVimHandler::Private::handleDefaultKey(const Input &input)
+{
+ if (input == Nop)
+ return EventHandled;
+ else if (m_subsubmode == SearchSubSubMode)
+ return handleSearchSubSubMode(input);
+ else if (m_mode == CommandMode)
+ return handleCommandMode(input);
+ else if (m_mode == InsertMode)
+ return handleInsertMode(input);
+ else if (m_mode == ReplaceMode)
+ return handleReplaceMode(input);
+ else if (m_mode == ExMode)
+ return handleExMode(input);
return EventUnhandled;
}
-EventResult FakeVimHandler::Private::handleKey2()
+void FakeVimHandler::Private::handleMappedKeys()
{
- Inputs pendingInput = g.pendingInput;
- g.pendingInput.clear();
- if (m_mode == InsertMode) {
- EventResult result = EventUnhandled;
- foreach (const Input &in, pendingInput) {
- EventResult r = handleInsertMode(in);
- if (r == EventHandled)
- result = EventHandled;
- }
- return result;
- }
- if (m_mode == ReplaceMode) {
- EventResult result = EventUnhandled;
- foreach (const Input &in, pendingInput) {
- EventResult r = handleReplaceMode(in);
- if (r == EventHandled)
- result = EventHandled;
- }
- return result;
- }
- if (m_mode == CommandMode) {
- EventResult result = EventUnhandled;
- foreach (const Input &in, pendingInput) {
- EventResult r = handleCommandMode(in);
- if (r == EventHandled)
- result = EventHandled;
- }
- return result;
+ int maxMapDepth = g.mapStates.last().maxMapDepth - 1;
+
+ int invalidCount = g.currentMap.invalidInputCount();
+ if (invalidCount > 0) {
+ g.mapStates.remove(g.mapStates.size() - invalidCount, invalidCount);
+ QTC_CHECK(!g.mapStates.empty());
+ for (int i = 0; i < invalidCount; ++i)
+ endEditBlock();
}
- return EventUnhandled;
+
+ if (maxMapDepth <= 0) {
+ showMessage(MessageError, "recursive mapping");
+ g.pendingInput.remove(0, g.currentMap.mapLength() + invalidCount);
+ } else {
+ const Inputs &inputs = g.currentMap.inputs();
+ QVector<Input> rest = g.pendingInput.mid(g.currentMap.mapLength() + invalidCount);
+ g.pendingInput.clear();
+ g.pendingInput << inputs << Input() << rest;
+ g.mapStates << MappingState(maxMapDepth, inputs.noremap(), inputs.silent());
+ g.commandBuffer.setHistoryAutoSave(false);
+ beginLargeEditBlock();
+ }
+ g.currentMap.reset();
}
void FakeVimHandler::Private::timerEvent(QTimerEvent *ev)
{
- Q_UNUSED(ev);
- handleKey2();
+ if (ev->timerId() == g.inputTimer) {
+ if (g.currentMap.isComplete())
+ handleMappedKeys();
+ handleKey(Input());
+ }
}
void FakeVimHandler::Private::stopIncrementalFind()
{
- if (m_findPending) {
- m_findPending = false;
+ if (g.findPending) {
+ g.findPending = false;
QTextCursor tc = cursor();
setAnchorAndPosition(m_findStartPosition, tc.selectionStart());
finishMovement();
@@ -1624,13 +2022,96 @@ void FakeVimHandler::Private::stopIncrementalFind()
}
}
-void FakeVimHandler::Private::setUndoPosition()
+void FakeVimHandler::Private::updateFind(bool isComplete)
{
- int pos = qMin(position(), anchor());
- if (m_visualMode == VisualLineMode)
- pos = firstPositionInLine(lineForPosition(pos));
- const int rev = document()->availableUndoSteps();
- m_undoCursorPosition[rev] = pos;
+ if (!isComplete && !hasConfig(ConfigIncSearch))
+ return;
+
+ g.currentMessage.clear();
+
+ const QString &needle = g.searchBuffer.contents();
+ SearchData sd;
+ sd.needle = needle;
+ sd.forward = g.lastSearchForward;
+ sd.highlightMatches = isComplete;
+ search(sd, isComplete);
+}
+
+bool FakeVimHandler::Private::atEmptyLine(const QTextCursor &tc) const
+{
+ if (tc.isNull())
+ return atEmptyLine(cursor());
+ return tc.block().length() == 1;
+}
+
+bool FakeVimHandler::Private::atBoundary(bool end, bool simple, bool onlyWords,
+ const QTextCursor &tc) const
+{
+ if (tc.isNull())
+ return atBoundary(end, simple, onlyWords, cursor());
+ if (atEmptyLine(tc))
+ return true;
+ int pos = tc.position();
+ QChar c1 = document()->characterAt(pos);
+ QChar c2 = document()->characterAt(pos + (end ? 1 : -1));
+ int thisClass = charClass(c1, simple);
+ return (!onlyWords || thisClass != 0)
+ && (c2.isNull() || c2 == ParagraphSeparator || thisClass != charClass(c2, simple));
+}
+
+bool FakeVimHandler::Private::atWordBoundary(bool end, bool simple, const QTextCursor &tc) const
+{
+ return atBoundary(end, simple, true, tc);
+}
+
+bool FakeVimHandler::Private::atWordStart(bool simple, const QTextCursor &tc) const
+{
+ return atWordBoundary(false, simple, tc);
+}
+
+bool FakeVimHandler::Private::atWordEnd(bool simple, const QTextCursor &tc) const
+{
+ return atWordBoundary(true, simple, tc);
+}
+
+bool FakeVimHandler::Private::isFirstNonBlankOnLine(int pos)
+{
+ for (int i = document()->findBlock(pos).position(); i < pos; ++i) {
+ if (!document()->characterAt(i).isSpace())
+ return false;
+ }
+ return true;
+}
+
+void FakeVimHandler::Private::setUndoPosition(bool overwrite)
+{
+ const int rev = revision();
+ if (!overwrite && !m_undo.empty() && m_undo.top().revision >= rev)
+ return;
+
+ int pos = position();
+ if (m_mode != InsertMode && m_mode != ReplaceMode) {
+ if (isVisualMode() || m_submode == DeleteSubMode) {
+ pos = qMin(pos, anchor());
+ if (isVisualLineMode())
+ pos = firstPositionInLine(lineForPosition(pos));
+ } else if (m_movetype == MoveLineWise && hasConfig(ConfigStartOfLine)) {
+ QTextCursor tc = cursor();
+ if (m_submode == ShiftLeftSubMode || m_submode == ShiftRightSubMode
+ || m_submode == IndentSubMode) {
+ pos = qMin(pos, anchor());
+ }
+ tc.setPosition(pos);
+ moveToFirstNonBlankOnLine(&tc);
+ pos = qMin(pos, tc.position());
+ }
+ }
+
+ m_redo.clear();
+ while (!m_undo.empty() && m_undo.top().revision >= rev)
+ m_undo.pop();
+ m_undo.push(State(rev, pos, lineForPosition(pos), m_marks));
+ m_lastChangePosition = pos;
}
void FakeVimHandler::Private::moveDown(int n)
@@ -1677,12 +2158,12 @@ void FakeVimHandler::Private::moveToStartOfLine()
#endif
}
-void FakeVimHandler::Private::finishMovement(const QString &dotCommand, int count)
+void FakeVimHandler::Private::finishMovement(const QString &dotCommandMovement, int count)
{
- finishMovement(dotCommand.arg(count));
+ finishMovement(dotCommandMovement.arg(count));
}
-void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
+void FakeVimHandler::Private::finishMovement(const QString &dotCommandMovement)
{
//dump("FINISH MOVEMENT");
if (m_submode == FilterSubMode) {
@@ -1690,9 +2171,8 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
int endLine = lineForPosition(position());
setPosition(qMin(anchor(), position()));
enterExMode();
- m_currentMessage.clear();
- m_commandBuffer.setContents(QString(".,+%1!").arg(qAbs(endLine - beginLine)));
- //g.commandHistory.append(QString());
+ g.currentMessage.clear();
+ g.commandBuffer.setContents(QString(".,+%1!").arg(qAbs(endLine - beginLine)));
updateMiniBuffer();
return;
}
@@ -1705,6 +2185,22 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
|| m_submode == YankSubMode
|| m_submode == TransformSubMode) {
+ if (m_movetype == MoveExclusive) {
+ if (anchor() != position() && atBlockStart()) {
+ // Exlusive motion ending at the beginning of line
+ // becomes inclusive and end is moved to end of previous line.
+ m_movetype = MoveInclusive;
+ moveToStartOfLine();
+ moveLeft();
+
+ // Exclusive motion ending at the beginning of line and
+ // starting at or before first non-blank on a line becomes linewise.
+ if (anchor() < block().position() && isFirstNonBlankOnLine(anchor())) {
+ m_movetype = MoveLineWise;
+ }
+ }
+ }
+
if (m_submode != YankSubMode)
beginEditBlock();
@@ -1715,8 +2211,18 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
if (m_movetype == MoveInclusive) {
if (anchor() <= position()) {
- if (!cursor().atBlockEnd())
+ if (!atBlockEnd())
setPosition(position() + 1); // correction
+
+ // If more than one line is selected and all are selected completely
+ // movement becomes linewise.
+ int start = anchor();
+ if (start < block().position() && isFirstNonBlankOnLine(start) && atBlockEnd()) {
+ moveRight();
+ if (atEmptyLine())
+ moveRight();
+ m_movetype = MoveLineWise;
+ }
} else {
setAnchorAndPosition(anchor() + 1, position());
}
@@ -1746,17 +2252,19 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
if (m_rangemode == RangeLineMode)
m_rangemode = RangeLineModeExclusive;
removeText(currentRange());
- if (!dotCommand.isEmpty())
- setDotCommand(QLatin1Char('c') + dotCommand);
+ if (!dotCommandMovement.isEmpty())
+ setDotCommand(QLatin1Char('c') + dotCommandMovement);
if (m_movetype == MoveLineWise)
insertAutomaticIndentation(true);
endEditBlock();
enterInsertMode();
m_submode = NoSubMode;
} else if (m_submode == DeleteSubMode) {
- removeText(currentRange());
- if (!dotCommand.isEmpty())
- setDotCommand(QLatin1Char('d') + dotCommand);
+ setUndoPosition();
+ Range range = currentRange();
+ removeText(range);
+ if (!dotCommandMovement.isEmpty())
+ setDotCommand(QLatin1Char('d') + dotCommandMovement);
if (m_movetype == MoveLineWise)
handleStartOfLine();
m_submode = NoSubMode;
@@ -1777,20 +2285,20 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
setPosition(anchor());
}
if (la != lp)
- showBlackMessage(QString("%1 lines yanked").arg(qAbs(la - lp) + 1));
+ showMessage(MessageInfo, QString("%1 lines yanked").arg(qAbs(la - lp) + 1));
} else if (m_submode == TransformSubMode) {
if (m_subsubmode == InvertCaseSubSubMode) {
invertCase(currentRange());
- if (!dotCommand.isEmpty())
- setDotCommand(QLatin1Char('~') + dotCommand);
+ if (!dotCommandMovement.isEmpty())
+ setDotCommand(QLatin1Char('~') + dotCommandMovement);
} else if (m_subsubmode == UpCaseSubSubMode) {
upCase(currentRange());
- if (!dotCommand.isEmpty())
- setDotCommand("gU" + dotCommand);
+ if (!dotCommandMovement.isEmpty())
+ setDotCommand("gU" + dotCommandMovement);
} else if (m_subsubmode == DownCaseSubSubMode) {
downCase(currentRange());
- if (!dotCommand.isEmpty())
- setDotCommand("gu" + dotCommand);
+ if (!dotCommandMovement.isEmpty())
+ setDotCommand("gu" + dotCommandMovement);
}
m_submode = NoSubMode;
m_subsubmode = NoSubSubMode;
@@ -1799,25 +2307,29 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
handleStartOfLine();
endEditBlock();
} else if (m_submode == IndentSubMode) {
- setUndoPosition();
recordJump();
+ setUndoPosition();
indentSelectedText();
m_submode = NoSubMode;
+ if (!dotCommandMovement.isEmpty())
+ setDotCommand('=' + dotCommandMovement);
} else if (m_submode == ShiftRightSubMode) {
- setUndoPosition();
recordJump();
+ setUndoPosition();
shiftRegionRight(1);
m_submode = NoSubMode;
+ if (!dotCommandMovement.isEmpty())
+ setDotCommand('>' + dotCommandMovement);
} else if (m_submode == ShiftLeftSubMode) {
- setUndoPosition();
recordJump();
+ setUndoPosition();
shiftRegionLeft(1);
m_submode = NoSubMode;
+ if (!dotCommandMovement.isEmpty())
+ setDotCommand('<' + dotCommandMovement);
}
resetCommandMode();
- updateSelection();
- updateMiniBuffer();
}
void FakeVimHandler::Private::resetCommandMode()
@@ -1833,15 +2345,7 @@ void FakeVimHandler::Private::resetCommandMode()
void FakeVimHandler::Private::updateSelection()
{
- QList<QTextEdit::ExtraSelection> selections = m_searchSelections;
- if (!m_searchCursor.isNull()) {
- QTextEdit::ExtraSelection sel;
- sel.cursor = m_searchCursor;
- sel.format = m_searchCursor.blockCharFormat();
- sel.format.setForeground(Qt::white);
- sel.format.setBackground(Qt::black);
- selections.append(sel);
- }
+ QList<QTextEdit::ExtraSelection> selections = m_extraSelections;
if (hasConfig(ConfigShowMarks)) {
for (MarksIterator it(m_marks); it.hasNext(); ) {
it.next();
@@ -1860,6 +2364,12 @@ void FakeVimHandler::Private::updateSelection()
emit q->selectionChanged(selections);
}
+void FakeVimHandler::Private::updateHighlights()
+{
+ if (!hasConfig(ConfigUseCoreSearch))
+ emit q->highlightMatches(m_oldNeedle);
+}
+
void FakeVimHandler::Private::updateMiniBuffer()
{
if (!m_textedit && !m_plaintextedit)
@@ -1867,34 +2377,46 @@ void FakeVimHandler::Private::updateMiniBuffer()
QString msg;
int cursorPos = -1;
+ MessageLevel messageLevel = MessageMode;
+
+ if (g.mapStates.last().silent && g.currentMessageLevel < MessageInfo)
+ g.currentMessage.clear();
+
if (m_passing) {
- msg = "-- PASSING -- ";
- } else if (!m_currentMessage.isEmpty()) {
- msg = m_currentMessage;
+ msg = "PASSING";
+ } else if (m_subsubmode == SearchSubSubMode) {
+ msg = g.searchBuffer.display();
+ if (g.mapStates.size() == 1)
+ cursorPos = g.searchBuffer.cursorPos() + 1;
+ } else if (m_mode == ExMode) {
+ msg = g.commandBuffer.display();
+ if (g.mapStates.size() == 1)
+ cursorPos = g.commandBuffer.cursorPos() + 1;
+ } else if (!g.currentMessage.isEmpty()) {
+ msg = g.currentMessage;
+ g.currentMessage.clear();
+ messageLevel = g.currentMessageLevel;
+ } else if (g.mapStates.size() > 1 && !g.mapStates.last().silent) {
+ // Do not reset previous message when after running a mapped command.
+ return;
} else if (m_mode == CommandMode && isVisualMode()) {
if (isVisualCharMode()) {
- msg = "-- VISUAL --";
+ msg = "VISUAL";
} else if (isVisualLineMode()) {
- msg = "-- VISUAL LINE --";
+ msg = "VISUAL LINE";
} else if (isVisualBlockMode()) {
- msg = "-- VISUAL BLOCK --";
+ msg = "VISUAL BLOCK";
}
} else if (m_mode == InsertMode) {
- msg = "-- INSERT --";
+ msg = "INSERT";
} else if (m_mode == ReplaceMode) {
- msg = "-- REPLACE --";
- } else if (!m_commandPrefix.isEmpty()) {
- //QTC_ASSERT(m_mode == ExMode || m_subsubmode == SearchSubSubMode,
- // qDebug() << "MODE: " << m_mode << m_subsubmode);
- msg = m_commandPrefix + m_commandBuffer.display();
- if (m_mode != CommandMode)
- cursorPos = m_commandPrefix.size() + m_commandBuffer.cursorPos();
+ msg = "REPLACE";
} else {
QTC_CHECK(m_mode == CommandMode && m_subsubmode != SearchSubSubMode);
- msg = "-- COMMAND --";
+ msg = "COMMAND";
}
- emit q->commandBufferChanged(msg, cursorPos);
+ emit q->commandBufferChanged(msg, cursorPos, messageLevel, q);
int linesInDoc = linesInDocument();
int l = cursorLine();
@@ -1910,24 +2432,18 @@ void FakeVimHandler::Private::updateMiniBuffer()
emit q->statusDataChanged(status);
}
-void FakeVimHandler::Private::showRedMessage(const QString &msg)
-{
- //qDebug() << "MSG: " << msg;
- m_currentMessage = msg;
- updateMiniBuffer();
-}
-
-void FakeVimHandler::Private::showBlackMessage(const QString &msg)
+void FakeVimHandler::Private::showMessage(MessageLevel level, const QString &msg)
{
//qDebug() << "MSG: " << msg;
- m_commandBuffer.setContents(msg);
+ g.currentMessage = msg;
+ g.currentMessageLevel = level;
updateMiniBuffer();
}
void FakeVimHandler::Private::notImplementedYet()
{
qDebug() << "Not implemented in FakeVim";
- showRedMessage(FakeVimHandler::tr("Not implemented in FakeVim"));
+ showMessage(MessageError, FakeVimHandler::tr("Not implemented in FakeVim"));
updateMiniBuffer();
}
@@ -1998,14 +2514,18 @@ EventResult FakeVimHandler::Private::handleCommandSubSubMode(const Input &input)
m_subsubmode = NoSubSubMode;
} else if (m_subsubmode == BackTickSubSubMode
|| m_subsubmode == TickSubSubMode) {
- int m = mark(input.asChar().unicode());
+ ushort markChar = input.asChar().unicode();
+ int m = mark(markChar);
if (m != -1) {
+ if (markChar == '\'' && !m_jumpListUndo.isEmpty())
+ m_jumpListUndo.pop();
+ recordJump();
setPosition(m);
if (m_subsubmode == TickSubSubMode)
moveToFirstNonBlankOnLine();
finishMovement();
} else {
- showRedMessage(msgMarkNotSet(input.text()));
+ showMessage(MessageError, msgMarkNotSet(input.text()));
}
m_subsubmode = NoSubSubMode;
} else {
@@ -2055,7 +2575,6 @@ EventResult FakeVimHandler::Private::handleCommandMode(const Input &input)
finishMovement();
} else {
resetCommandMode();
- updateSelection();
updateMiniBuffer();
}
} else if (m_subsubmode != NoSubSubMode) {
@@ -2072,9 +2591,9 @@ EventResult FakeVimHandler::Private::handleCommandMode(const Input &input)
m_submode = NoSubMode;
m_rangemode = RangeLineMode;
} else if (m_submode == ReplaceSubMode) {
+ setDotCommand(visualDotCommand() + 'r' + input.asChar());
if (isVisualMode()) {
setUndoPosition();
- m_lastChangePosition = position();
if (isVisualLineMode())
m_rangemode = RangeLineMode;
else if (isVisualBlockMode())
@@ -2089,7 +2608,6 @@ EventResult FakeVimHandler::Private::handleCommandMode(const Input &input)
setPosition(range.beginPos);
} else if (count() <= rightDist()) {
setUndoPosition();
- m_lastChangePosition = position();
setAnchor();
moveRight(count());
Range range = currentRange();
@@ -2108,20 +2626,18 @@ EventResult FakeVimHandler::Private::handleCommandMode(const Input &input)
m_submode = NoSubMode;
finishMovement();
} else if (m_submode == ChangeSubMode && input.is('c')) { // tested
+ m_movetype = MoveLineWise;
setUndoPosition();
- m_lastChangePosition = position();
moveToStartOfLine();
setAnchor();
moveDown(count() - 1);
moveToEndOfLine();
- m_movetype = MoveLineWise;
m_lastInsertion.clear();
setDotCommand("%1cc", count());
finishMovement();
} else if (m_submode == DeleteSubMode && input.is('d')) { // tested
- setUndoPosition();
- m_lastChangePosition = position();
m_movetype = MoveLineWise;
+ setUndoPosition();
int endPos = firstPositionInLine(lineForPosition(position()) + count() - 1);
Range range(position(), endPos, RangeLineMode);
yankText(range);
@@ -2135,26 +2651,13 @@ EventResult FakeVimHandler::Private::handleCommandMode(const Input &input)
&& (input.is('a') || input.is('i'))) {
m_subsubmode = TextObjectSubSubMode;
m_subsubdata = input;
- } else if (m_submode == ShiftLeftSubMode && input.is('<')) {
- m_lastChangePosition = position();
- setAnchor();
- moveDown(count() - 1);
- m_movetype = MoveLineWise;
- setDotCommand("%1<<", count());
- finishMovement();
- } else if (m_submode == ShiftRightSubMode && input.is('>')) {
- m_lastChangePosition = position();
- setAnchor();
- moveDown(count() - 1);
+ } else if ((m_submode == ShiftLeftSubMode && input.is('<'))
+ || (m_submode == ShiftRightSubMode && input.is('>'))
+ || (m_submode == IndentSubMode && input.is('='))) {
m_movetype = MoveLineWise;
- setDotCommand("%1>>", count());
- finishMovement();
- } else if (m_submode == IndentSubMode && input.is('=')) {
- m_lastChangePosition = position();
- setAnchor();
+ setUndoPosition();
moveDown(count() - 1);
- m_movetype = MoveLineWise;
- setDotCommand("%1==", count());
+ setDotCommand(QString("%2%1%1").arg(input.asChar()), count());
finishMovement();
} else if (m_submode == ZSubMode) {
//qDebug() << "Z_MODE " << cursorLine() << linesOnScreen();
@@ -2236,30 +2739,31 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
handleExCommand(m_gflag ? "%s//~/&" : "s");
} else if (input.is(':')) {
enterExMode();
- g.commandHistory.restart();
- m_currentMessage.clear();
- m_commandBuffer.clear();
+ g.currentMessage.clear();
+ g.commandBuffer.clear();
if (isVisualMode())
- m_commandBuffer.setContents("'<,'>");
+ g.commandBuffer.setContents("'<,'>");
updateMiniBuffer();
} else if (input.is('/') || input.is('?')) {
- m_lastSearchForward = input.is('/');
- g.searchHistory.restart();
+ g.lastSearchForward = input.is('/');
if (hasConfig(ConfigUseCoreSearch)) {
// re-use the core dialog.
- m_findPending = true;
+ g.findPending = true;
m_findStartPosition = position();
m_movetype = MoveExclusive;
setAnchor(); // clear selection: otherwise, search is restricted to selection
- emit q->findRequested(!m_lastSearchForward);
+ emit q->findRequested(!g.lastSearchForward);
} else {
// FIXME: make core find dialog sufficiently flexible to
// produce the "default vi" behaviour too. For now, roll our own.
- m_currentMessage.clear();
+ g.currentMessage.clear();
m_movetype = MoveExclusive;
m_subsubmode = SearchSubSubMode;
- m_commandPrefix = QLatin1Char(m_lastSearchForward ? '/' : '?');
- m_commandBuffer.clear();
+ g.searchBuffer.setPrompt(g.lastSearchForward ? '/' : '?');
+ m_searchStartPosition = position();
+ m_searchFromScreenLine = firstVisibleLine();
+ m_searchCursor = QTextCursor();
+ g.searchBuffer.clear();
updateMiniBuffer();
}
} else if (input.is('`')) {
@@ -2271,22 +2775,15 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
QString needle;
QTextCursor tc = cursor();
tc.select(QTextCursor::WordUnderCursor);
- needle = "\\<" + tc.selection().toPlainText() + "\\>";
+ needle = QRegExp::escape(tc.selection().toPlainText());
+ if (!m_gflag)
+ needle = "\\<" + needle + "\\>";
setAnchorAndPosition(tc.position(), tc.anchor());
- g.searchHistory.append(needle);
- m_lastSearchForward = input.is('*');
- m_currentMessage.clear();
- m_commandPrefix = QLatin1Char(m_lastSearchForward ? '/' : '?');
- m_commandBuffer.setContents(needle);
- SearchData sd;
- sd.needle = needle;
- sd.forward = m_lastSearchForward;
- sd.highlightCursor = false;
- sd.highlightMatches = true;
- search(sd);
- //m_searchCursor = QTextCursor();
- //updateSelection();
- //updateMiniBuffer();
+ g.searchBuffer.historyPush(needle);
+ g.lastSearch = needle;
+ g.lastSearchForward = input.is('*');
+ searchNext();
+ finishMovement();
} else if (input.is('\'')) {
m_subsubmode = TickSubSubMode;
if (m_submode != NoSubMode)
@@ -2300,9 +2797,8 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
m_submode = FilterSubMode;
} else if (input.is('!') && isVisualMode()) {
enterExMode();
- m_currentMessage.clear();
- m_commandBuffer.setContents("'<,'>!");
- //g.commandHistory.append(QString());
+ g.currentMessage.clear();
+ g.commandBuffer.setContents("'<,'>!");
updateMiniBuffer();
} else if (input.is('"')) {
m_submode = RegisterSubMode;
@@ -2346,29 +2842,29 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
// << input;
QString savedCommand = g.dotCommand;
g.dotCommand.clear();
- replay(savedCommand, count());
+ replay(savedCommand, 1);
enterCommandMode();
g.dotCommand = savedCommand;
} else if (input.is('<')) {
- setUndoPosition();
if (isNoVisualMode()) {
m_submode = ShiftLeftSubMode;
+ setAnchor();
} else {
shiftRegionLeft(count());
leaveVisualMode();
}
} else if (input.is('>')) {
- setUndoPosition();
if (isNoVisualMode()) {
m_submode = ShiftRightSubMode;
+ setAnchor();
} else {
shiftRegionRight(count());
leaveVisualMode();
}
} else if (input.is('=')) {
- setUndoPosition();
if (isNoVisualMode()) {
m_submode = IndentSubMode;
+ setAnchor();
} else {
indentSelectedText();
leaveVisualMode();
@@ -2381,29 +2877,32 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
setUndoPosition();
breakEditBlock();
enterInsertMode();
+ setDotCommand(QString(QLatin1Char('a')));
m_lastInsertion.clear();
if (!atEndOfLine())
moveRight();
updateMiniBuffer();
} else if (input.is('A')) {
- setUndoPosition();
breakEditBlock();
moveBehindEndOfLine();
+ setUndoPosition();
setAnchor();
enterInsertMode();
setDotCommand(QString(QLatin1Char('A')));
m_lastInsertion.clear();
updateMiniBuffer();
} else if (input.isControl('a')) {
- changeNumberTextObject(true);
+ changeNumberTextObject(count());
+ setDotCommand("%1<c-a>", count());
+ finishMovement();
} else if (input.is('b') || input.isShift(Key_Left)) {
m_movetype = MoveExclusive;
- moveToWordBoundary(false, false);
+ moveToNextWordStart(count(), false, false);
setTargetColumn();
finishMovement();
} else if (input.is('B')) {
m_movetype = MoveExclusive;
- moveToWordBoundary(true, false);
+ moveToNextWordStart(count(), true, false);
setTargetColumn();
finishMovement();
} else if (input.is('c') && isNoVisualMode()) {
@@ -2414,6 +2913,7 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
m_submode = ChangeSubMode;
} else if ((input.is('c') || input.is('C') || input.is('s') || input.is('R'))
&& (isVisualCharMode() || isVisualLineMode())) {
+ setDotCommand(visualDotCommand() + input.asChar());
if ((input.is('c')|| input.is('s')) && isVisualCharMode()) {
leaveVisualMode();
m_rangemode = RangeCharMode;
@@ -2433,7 +2933,7 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
finishMovement();
} else if (input.isControl('c')) {
if (isNoVisualMode())
- showBlackMessage("Type Alt-v,Alt-v to quit FakeVim mode");
+ showMessage(MessageInfo, "Type Alt-v,Alt-v to quit FakeVim mode");
else
leaveVisualMode();
} else if (input.is('d') && isNoVisualMode()) {
@@ -2450,6 +2950,8 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
m_submode = DeleteSubMode;
} else if ((input.is('d') || input.is('x') || input.isKey(Key_Delete))
&& isVisualMode()) {
+ setUndoPosition();
+ setDotCommand(visualDotCommand() + 'x');
if (isVisualCharMode()) {
leaveVisualMode();
m_submode = DeleteSubMode;
@@ -2468,6 +2970,7 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
setPosition(qMin(position(), anchor()));
}
} else if (input.is('D') && isNoVisualMode()) {
+ setUndoPosition();
if (atEndOfLine())
moveLeft();
m_submode = DeleteSubMode;
@@ -2479,6 +2982,7 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
finishMovement();
} else if ((input.is('D') || input.is('X')) &&
(isVisualCharMode() || isVisualLineMode())) {
+ setDotCommand(visualDotCommand() + 'X');
leaveVisualMode();
m_rangemode = RangeLineMode;
m_submode = NoSubMode;
@@ -2486,6 +2990,7 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
removeText(currentRange());
moveToFirstNonBlankOnLine();
} else if ((input.is('D') || input.is('X')) && isVisualBlockMode()) {
+ setDotCommand(visualDotCommand() + 'X');
leaveVisualMode();
m_rangemode = RangeBlockAndTailMode;
yankText(currentRange(), m_register);
@@ -2498,14 +3003,24 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
handleStartOfLine();
scrollToLine(cursorLine() - sline);
finishMovement();
+ } else if (input.is('e') && m_gflag) {
+ m_movetype = MoveInclusive;
+ moveToNextWordEnd(count(), false, false);
+ setTargetColumn();
+ finishMovement("%1ge", count());
} else if (input.is('e') || input.isShift(Key_Right)) {
m_movetype = MoveInclusive;
- moveToWordBoundary(false, true);
+ moveToNextWordEnd(count(), false, true, false);
setTargetColumn();
finishMovement("%1e", count());
+ } else if (input.is('E') && m_gflag) {
+ m_movetype = MoveInclusive;
+ moveToNextWordEnd(count(), true, false);
+ setTargetColumn();
+ finishMovement("%1gE", count());
} else if (input.is('E')) {
m_movetype = MoveInclusive;
- moveToWordBoundary(true, true);
+ moveToNextWordEnd(count(), true, true, false);
setTargetColumn();
finishMovement("%1E", count());
} else if (input.isControl('e')) {
@@ -2558,7 +3073,6 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
finishMovement();
} else if (!isVisualMode() && (input.is('i') || input.isKey(Key_Insert))) {
setDotCommand(QString(QLatin1Char('i'))); // setDotCommand("%1i", count());
- setUndoPosition();
breakEditBlock();
enterInsertMode();
updateMiniBuffer();
@@ -2593,18 +3107,13 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
breakEditBlock();
enterInsertMode();
} else if (input.isControl('i')) {
- if (!m_jumpListRedo.isEmpty()) {
- m_jumpListUndo.append(cursorPosition());
- setCursorPosition(m_jumpListRedo.last());
- m_jumpListRedo.pop_back();
- }
+ jump(count());
} else if (input.is('j') || input.isKey(Key_Down)
|| input.isControl('j') || input.isControl('n')) {
m_movetype = MoveLineWise;
moveDown(count());
finishMovement("%1j", count());
} else if (input.is('J')) {
- setDotCommand("%1J", count());
beginEditBlock();
if (m_submode == NoSubMode) {
for (int i = qMax(count(), 2) - 1; --i >= 0; ) {
@@ -2625,7 +3134,7 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
moveLeft();
}
endEditBlock();
- finishMovement();
+ finishMovement("%1J");
} else if (input.is('k') || input.isKey(Key_Up) || input.isControl('p')) {
m_movetype = MoveLineWise;
moveUp(count());
@@ -2644,6 +3153,7 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
moveUp(qMax(count(), 1));
handleStartOfLine();
finishMovement();
+ finishMovement("%1L");
} else if (input.isControl('l')) {
// screen redraw. should not be needed
} else if (input.is('m')) {
@@ -2662,7 +3172,7 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
finishMovement();
} else if (input.is('n') || input.is('N')) {
if (hasConfig(ConfigUseCoreSearch)) {
- bool forward = (input.is('n')) ? m_lastSearchForward : !m_lastSearchForward;
+ bool forward = (input.is('n')) ? g.lastSearchForward : !g.lastSearchForward;
int pos = position();
emit q->findNextRequested(!forward);
if (forward && pos == cursor().selectionStart()) {
@@ -2671,12 +3181,8 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
}
setPosition(cursor().selectionStart());
} else {
- SearchData sd;
- sd.needle = g.searchHistory.current();
- sd.forward = input.is('n') ? m_lastSearchForward : !m_lastSearchForward;
- sd.highlightCursor = false;
- sd.highlightMatches = true;
- search(sd);
+ searchNext(input.is('n'));
+ finishMovement();
}
} else if (isVisualMode() && (input.is('o') || input.is('O'))) {
int pos = position();
@@ -2685,18 +3191,16 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
setTargetColumn();
if (m_positionPastEnd)
m_visualTargetColumn = -1;
- updateSelection();
} else if (input.is('o')) {
setDotCommand("%1o", count());
setUndoPosition();
- breakEditBlock();
- enterInsertMode();
beginEditBlock();
moveToFirstNonBlankOnLine();
moveBehindEndOfLine();
insertText(QString("\n"));
insertAutomaticIndentation(true);
endEditBlock();
+ enterInsertMode();
} else if (input.is('O')) {
setDotCommand("%1O", count());
setUndoPosition();
@@ -2710,18 +3214,13 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
insertAutomaticIndentation(false);
endEditBlock();
} else if (input.isControl('o')) {
- if (!m_jumpListUndo.isEmpty()) {
- m_jumpListRedo.append(cursorPosition());
- setCursorPosition(m_jumpListUndo.last());
- m_jumpListUndo.pop_back();
- }
+ jump(-count());
} else if (input.is('p') || input.is('P')) {
pasteText(input.is('p'));
setTargetColumn();
setDotCommand("%1p", count());
finishMovement();
} else if (input.is('r')) {
- setUndoPosition();
m_submode = ReplaceSubMode;
} else if (!isVisualMode() && input.is('R')) {
setUndoPosition();
@@ -2729,7 +3228,10 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
enterReplaceMode();
updateMiniBuffer();
} else if (input.isControl('r')) {
- redo();
+ int repeat = count();
+ while (--repeat >= 0)
+ redo();
+ finishMovement();
} else if (input.is('s') && isVisualBlockMode()) {
setUndoPosition();
Range range(position(), anchor(), RangeBlockMode);
@@ -2757,6 +3259,7 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
breakEditBlock();
enterInsertMode();
} else if (input.is('S')) {
+ m_movetype = MoveLineWise;
setUndoPosition();
beginEditBlock();
if (!isVisualMode()) {
@@ -2769,7 +3272,6 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
breakEditBlock();
enterInsertMode();
m_submode = ChangeSubMode;
- m_movetype = MoveLineWise;
endEditBlock();
finishMovement();
} else if (m_gflag && input.is('t')) {
@@ -2789,7 +3291,10 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
} else if (input.isControl('t')) {
handleExCommand("pop");
} else if (!m_gflag && input.is('u')) {
- undo();
+ int repeat = count();
+ while (--repeat >= 0)
+ undo();
+ finishMovement();
} else if (input.isControl('u')) {
int sline = cursorLineOnScreen();
// FIXME: this should use the "scroll" option, and "count"
@@ -2813,23 +3318,23 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
// cursor is on a non-blank - except if the cursor is on the last
// character of a word: only the current word will be changed
if (m_submode == ChangeSubMode) {
- moveToWordBoundary(false, true, true);
- setTargetColumn();
+ moveToWordEnd(count(), false, true);
m_movetype = MoveInclusive;
} else {
- moveToNextWord(false, m_submode == DeleteSubMode);
+ moveToNextWordStart(count(), false, true);
m_movetype = MoveExclusive;
}
+ setTargetColumn();
finishMovement("%1w", count());
} else if (input.is('W')) {
if (m_submode == ChangeSubMode) {
- moveToWordBoundary(true, true, true);
- setTargetColumn();
+ moveToWordEnd(count(), true, true);
m_movetype = MoveInclusive;
} else {
- moveToNextWord(true, m_submode == DeleteSubMode);
+ moveToNextWordStart(count(), true, true);
m_movetype = MoveExclusive;
}
+ setTargetColumn();
finishMovement("%1W", count());
} else if (input.isControl('w')) {
m_submode = WindowSubMode;
@@ -2841,7 +3346,9 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
setDotCommand("%1x", count());
finishMovement();
} else if (input.isControl('x')) {
- changeNumberTextObject(false);
+ changeNumberTextObject(-count());
+ setDotCommand("%1<c-x>", count());
+ finishMovement();
} else if (input.is('X')) {
if (leftDist() > 0) {
setAnchor();
@@ -2954,12 +3461,12 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
moveDown(count() * (linesOnScreen() - 2) - cursorLineOnScreen());
scrollToLine(cursorLine());
handleStartOfLine();
- finishMovement();
+ finishMovement("%1f", count());
} else if (input.isKey(Key_PageUp) || input.isControl('b')) {
moveUp(count() * (linesOnScreen() - 2) + cursorLineOnScreen());
scrollToLine(cursorLine() + linesOnScreen() - 2);
handleStartOfLine();
- finishMovement();
+ finishMovement("%1b", count());
} else if (input.isKey(Key_Delete)) {
setAnchor();
moveRight(qMin(1, rightDist()));
@@ -2994,6 +3501,7 @@ EventResult FakeVimHandler::Private::handleReplaceMode(const Input &input)
m_submode = NoSubMode;
m_mode = CommandMode;
finishMovement();
+ updateMiniBuffer();
} else if (input.isKey(Key_Left)) {
breakEditBlock();
moveLeft(1);
@@ -3075,7 +3583,7 @@ EventResult FakeVimHandler::Private::handleInsertMode(const Input &input)
m_ctrlVActive = true;
} else if (input.isControl('w')) {
int endPos = position();
- moveToWordBoundary(false, false, false);
+ moveToNextWordStart(count(), false, false);
setTargetColumn();
int beginPos = position();
Range range(beginPos, endPos, RangeCharMode);
@@ -3088,39 +3596,47 @@ EventResult FakeVimHandler::Private::handleInsertMode(const Input &input)
} else if (input.isKey(Key_Left)) {
moveLeft(count());
setTargetColumn();
+ breakEditBlock();
m_lastInsertion.clear();
} else if (input.isControl(Key_Left)) {
- moveToWordBoundary(false, false);
+ moveToNextWordStart(count(), false, false);
setTargetColumn();
+ breakEditBlock();
m_lastInsertion.clear();
} else if (input.isKey(Key_Down)) {
//removeAutomaticIndentation();
m_submode = NoSubMode;
moveDown(count());
+ breakEditBlock();
m_lastInsertion.clear();
} else if (input.isKey(Key_Up)) {
//removeAutomaticIndentation();
m_submode = NoSubMode;
moveUp(count());
+ breakEditBlock();
m_lastInsertion.clear();
} else if (input.isKey(Key_Right)) {
moveRight(count());
setTargetColumn();
+ breakEditBlock();
m_lastInsertion.clear();
} else if (input.isControl(Key_Right)) {
- moveToWordBoundary(false, true);
+ moveToNextWordStart(count(), false, true);
moveRight(); // we need one more move since we are in insert mode
setTargetColumn();
+ breakEditBlock();
m_lastInsertion.clear();
} else if (input.isKey(Key_Home)) {
moveToStartOfLine();
setTargetColumn();
+ breakEditBlock();
m_lastInsertion.clear();
} else if (input.isKey(Key_End)) {
if (count() > 1)
moveDown(count() - 1);
moveBehindEndOfLine();
setTargetColumn();
+ breakEditBlock();
m_lastInsertion.clear();
} else if (input.isReturn()) {
joinPreviousEditBlock();
@@ -3164,10 +3680,12 @@ EventResult FakeVimHandler::Private::handleInsertMode(const Input &input)
} else if (input.isKey(Key_PageDown) || input.isControl('f')) {
removeAutomaticIndentation();
moveDown(count() * (linesOnScreen() - 2));
+ breakEditBlock();
m_lastInsertion.clear();
} else if (input.isKey(Key_PageUp) || input.isControl('b')) {
removeAutomaticIndentation();
moveUp(count() * (linesOnScreen() - 2));
+ breakEditBlock();
m_lastInsertion.clear();
} else if (input.isKey(Key_Tab)) {
m_justAutoIndented = 0;
@@ -3203,7 +3721,7 @@ EventResult FakeVimHandler::Private::handleInsertMode(const Input &input)
// // ignore these
} else if (input.isControl('p') || input.isControl('n')) {
QTextCursor tc = EDITOR(textCursor());
- moveToWordBoundary(false, false);
+ moveToNextWordStart(count(), false, false);
QString str = selectText(Range(position(), tc.position()));
EDITOR(setTextCursor(tc));
emit q->simpleCompletionRequested(str, input.isControl('n'));
@@ -3239,130 +3757,93 @@ void FakeVimHandler::Private::insertInInsertMode(const QString &text)
EventResult FakeVimHandler::Private::handleExMode(const Input &input)
{
if (input.isEscape()) {
- m_commandBuffer.clear();
+ g.commandBuffer.clear();
enterCommandMode();
- updateMiniBuffer();
m_ctrlVActive = false;
} else if (m_ctrlVActive) {
- m_commandBuffer.insertChar(input.raw());
+ g.commandBuffer.insertChar(input.raw());
m_ctrlVActive = false;
} else if (input.isControl('v')) {
m_ctrlVActive = true;
+ return EventHandled;
} else if (input.isBackspace()) {
- if (m_commandBuffer.isEmpty()) {
- m_commandPrefix.clear();
+ if (g.commandBuffer.isEmpty())
enterCommandMode();
- } else {
- m_commandBuffer.deleteChar();
- }
- updateMiniBuffer();
+ else
+ g.commandBuffer.deleteChar();
} else if (input.isKey(Key_Tab)) {
- QStringList completions;
- foreach (const QString &entry, g.commandHistory.items()) {
- if (entry.startsWith(m_commandBuffer.contents()))
- completions.append(entry);
- }
- qDebug() << completions;
+ // FIXME: Complete actual commands.
+ g.commandBuffer.historyUp();
} else if (input.isKey(Key_Left)) {
- m_commandBuffer.moveLeft();
- updateMiniBuffer();
+ g.commandBuffer.moveLeft();
} else if (input.isReturn()) {
- if (!m_commandBuffer.isEmpty()) {
- //g.commandHistory.takeLast();
- g.commandHistory.append(m_commandBuffer.contents());
- handleExCommand(m_commandBuffer.contents());
- if (m_textedit || m_plaintextedit)
- leaveVisualMode();
- }
- updateMiniBuffer();
+ showMessage(MessageCommand, g.commandBuffer.display());
+ handleExCommand(g.commandBuffer.contents());
+ g.commandBuffer.clear();
+ if (m_textedit || m_plaintextedit)
+ leaveVisualMode();
} else if (input.isKey(Key_Up) || input.isKey(Key_PageUp)) {
- g.commandHistory.up();
- m_commandBuffer.setContents(g.commandHistory.current());
- updateMiniBuffer();
+ g.commandBuffer.historyUp();
} else if (input.isKey(Key_Down) || input.isKey(Key_PageDown)) {
- g.commandHistory.down();
- m_commandBuffer.setContents(g.commandHistory.current());
- updateMiniBuffer();
- } else if (m_commandBuffer.handleInput(input)) {
- updateMiniBuffer();
- } else {
+ g.commandBuffer.historyDown();
+ } else if (!g.commandBuffer.handleInput(input)) {
qDebug() << "IGNORED IN EX-MODE: " << input.key() << input.text();
return EventUnhandled;
}
+ updateMiniBuffer();
return EventHandled;
}
EventResult FakeVimHandler::Private::handleSearchSubSubMode(const Input &input)
{
if (input.isEscape()) {
- m_commandBuffer.clear();
- g.searchHistory.append(m_searchCursor.selectedText());
- m_searchCursor = QTextCursor();
- updateSelection();
+ g.currentMessage.clear();
+ g.searchBuffer.clear();
+ setAnchorAndPosition(m_searchStartPosition, m_searchStartPosition);
+ scrollToLine(m_searchFromScreenLine);
enterCommandMode();
- updateMiniBuffer();
} else if (input.isBackspace()) {
- if (m_commandBuffer.isEmpty()) {
- m_commandPrefix.clear();
- m_searchCursor = QTextCursor();
+ if (g.searchBuffer.isEmpty()) {
enterCommandMode();
} else {
- m_commandBuffer.deleteChar();
+ g.searchBuffer.deleteChar();
}
- updateMiniBuffer();
} else if (input.isKey(Key_Left)) {
- m_commandBuffer.moveLeft();
- updateMiniBuffer();
+ g.searchBuffer.moveLeft();
} else if (input.isKey(Key_Right)) {
- m_commandBuffer.moveRight();
- updateMiniBuffer();
+ g.searchBuffer.moveRight();
} else if (input.isReturn()) {
- m_searchCursor = QTextCursor();
- QString needle = m_commandBuffer.contents();
- if (!needle.isEmpty()) {
- g.searchHistory.append(needle);
- if (!hasConfig(ConfigIncSearch)) {
- SearchData sd;
- sd.needle = needle;
- sd.forward = m_lastSearchForward;
- sd.highlightCursor = false;
- sd.highlightMatches = true;
- search(sd);
- }
- finishMovement(m_commandPrefix + needle + '\n');
+ const QString &needle = g.searchBuffer.contents();
+ if (!needle.isEmpty())
+ g.lastSearch = needle;
+ else
+ g.searchBuffer.setContents(g.lastSearch);
+ if (!g.lastSearch.isEmpty()) {
+ updateFind(true);
+ finishMovement(g.searchBuffer.prompt() + g.lastSearch + '\n');
+ } else {
+ finishMovement();
}
+ if (g.currentMessage.isEmpty())
+ showMessage(MessageCommand, g.searchBuffer.display());
enterCommandMode();
- highlightMatches(needle);
- updateMiniBuffer();
+ g.searchBuffer.clear();
} else if (input.isKey(Key_Up) || input.isKey(Key_PageUp)) {
- // FIXME: This and the three cases below are wrong as vim
- // takes only matching entries in the history into account.
- g.searchHistory.up();
- showBlackMessage(g.searchHistory.current());
+ g.searchBuffer.historyUp();
} else if (input.isKey(Key_Down) || input.isKey(Key_PageDown)) {
- g.searchHistory.down();
- showBlackMessage(g.searchHistory.current());
+ g.searchBuffer.historyDown();
} else if (input.isKey(Key_Tab)) {
- m_commandBuffer.insertChar(QChar(9));
- updateMiniBuffer();
- } else if (m_commandBuffer.handleInput(input)) {
- updateMiniBuffer();
+ g.searchBuffer.insertChar(QChar(9));
+ } else if (!g.searchBuffer.handleInput(input)) {
+ //qDebug() << "IGNORED IN SEARCH MODE: " << input.key() << input.text();
+ return EventUnhandled;
}
- if (hasConfig(ConfigIncSearch) && !input.isReturn() && !input.isEscape()) {
- SearchData sd;
- sd.needle = m_commandBuffer.contents();
- sd.forward = m_lastSearchForward;
- sd.mustMove = false;
- sd.highlightCursor = true;
- sd.highlightMatches = false;
- search(sd);
- }
+ updateMiniBuffer();
+
+ if (!input.isReturn() && !input.isEscape())
+ updateFind(false);
- //else {
- // qDebug() << "IGNORED IN SEARCH MODE: " << input.key() << input.text();
- // return EventUnhandled;
- //}
return EventHandled;
}
@@ -3389,12 +3870,12 @@ int FakeVimHandler::Private::readLineCode(QString &cmd)
return linesInDocument();
if (c == '\'' && !cmd.isEmpty()) {
if (cmd.isEmpty()) {
- showRedMessage(msgMarkNotSet(QString()));
+ showMessage(MessageError, msgMarkNotSet(QString()));
return -1;
}
int m = mark(cmd.at(0).unicode());
if (m == -1) {
- showRedMessage(msgMarkNotSet(cmd.at(0)));
+ showMessage(MessageError, msgMarkNotSet(cmd.at(0)));
cmd = cmd.mid(1);
return -1;
}
@@ -3412,7 +3893,7 @@ int FakeVimHandler::Private::readLineCode(QString &cmd)
if (c == '\'' && !cmd.isEmpty()) {
int pos = mark(cmd.at(0).unicode());
if (pos == -1) {
- showRedMessage(msgMarkNotSet(cmd.at(0)));
+ showMessage(MessageError, msgMarkNotSet(cmd.at(0)));
cmd = cmd.mid(1);
return -1;
}
@@ -3524,8 +4005,6 @@ bool FakeVimHandler::Private::handleExSubstituteCommand(const ExCommand &cmd)
replacement = line.mid(pos1 + 1, pos2 - pos1 - 1);
flags = line.mid(pos2 + 1);
- needle.replace('$', '\n');
- needle.replace("\\\n", "\\$");
pattern = vimPatternToQtPattern(needle, hasConfig(ConfigSmartCase));
m_lastSubstituteFlags = flags;
@@ -3539,7 +4018,8 @@ bool FakeVimHandler::Private::handleExSubstituteCommand(const ExCommand &cmd)
if (flags.contains('i'))
pattern.setCaseSensitivity(Qt::CaseInsensitive);
- beginEditBlock();
+ int lastLine = -1;
+ int firstLine = -1;
const bool global = flags.contains('g');
for (int a = 0; a != count; ++a) {
const Range range = cmd.range.endPos == 0 ? rangeFromCurrentLine() : cmd.range;
@@ -3569,6 +4049,13 @@ bool FakeVimHandler::Private::handleExSubstituteCommand(const ExCommand &cmd)
repl.replace("\\&", "&");
text = text.left(pos) + repl + text.mid(pos + matched.size());
pos += repl.size();
+
+ firstLine = line;
+ if (lastLine == -1) {
+ lastLine = line;
+ beginEditBlock();
+ }
+
if (!global)
break;
}
@@ -3576,9 +4063,21 @@ bool FakeVimHandler::Private::handleExSubstituteCommand(const ExCommand &cmd)
setLineContents(line, text);
}
}
- moveToStartOfLine();
- setTargetColumn();
- endEditBlock();
+
+ if (lastLine != -1) {
+ State &state = m_undo.top();
+ state.line = firstLine;
+ state.position = firstPositionInLine(firstLine);
+
+ QTextCursor tc = cursor();
+ tc.setPosition(firstPositionInLine(lastLine));
+ setCursor(tc);
+ moveToFirstNonBlankOnLine();
+ setTargetColumn();
+
+ endEditBlock();
+ }
+
return true;
}
@@ -3625,31 +4124,50 @@ bool FakeVimHandler::Private::handleExMapCommand(const ExCommand &cmd0) // :map
else
return false;
- const int pos = cmd0.args.indexOf(QLatin1Char(' '));
- if (pos == -1) {
+ QString args = cmd0.args;
+ bool silent = false;
+ bool unique = false;
+ forever {
+ if (eatString("<silent>", &args)) {
+ silent = true;
+ } else if (eatString("<unique>", &args)) {
+ continue;
+ } else if (eatString("<special>", &args)) {
+ continue;
+ } else if (eatString("<buffer>", &args)) {
+ notImplementedYet();
+ continue;
+ } else if (eatString("<script>", &args)) {
+ notImplementedYet();
+ continue;
+ } else if (eatString("<expr>", &args)) {
+ notImplementedYet();
+ return true;
+ }
+ break;
+ }
+
+ const QString lhs = args.section(QRegExp("\\s+"), 0, 0);
+ const QString rhs = args.section(QRegExp("\\s+"), 1);
+ if ((rhs.isNull() && type != Unmap) || (!rhs.isNull() && type == Unmap)) {
// FIXME: Dump mappings here.
//qDebug() << g.mappings;
return true;
}
- QString lhs = cmd0.args.left(pos);
- QString rhs = cmd0.args.mid(pos + 1);
- Inputs key;
- key.parseFrom(lhs);
+ Inputs key(lhs);
//qDebug() << "MAPPING: " << modes << lhs << rhs;
switch (type) {
case Unmap:
foreach (char c, modes)
- if (g.mappings.contains(c))
- g.mappings[c].remove(key);
+ MappingsIterator(&g.mappings, c, key).remove();
break;
- case Map:
- rhs = rhs; // FIXME: expand rhs.
- // Fall through.
+ case Map: // fall through
case Noremap: {
- Inputs inputs(rhs);
+ Inputs inputs(rhs, type == Noremap, silent);
+ // TODO: Use MappingsIterator to insert mapping!
foreach (char c, modes)
- g.mappings[c].insert(key, inputs);
+ MappingsIterator(&g.mappings, c).setInputs(key, inputs, unique);
break;
}
}
@@ -3666,7 +4184,7 @@ bool FakeVimHandler::Private::handleExHistoryCommand(const ExCommand &cmd)
QString info;
info += "# command history\n";
int i = 0;
- foreach (const QString &item, g.commandHistory.items()) {
+ foreach (const QString &item, g.commandBuffer.historyItems()) {
++i;
info += QString("%1 %2\n").arg(i, -8).arg(item);
}
@@ -3711,10 +4229,10 @@ bool FakeVimHandler::Private::handleExSetCommand(const ExCommand &cmd)
if (!cmd.matches("se", "set"))
return false;
- showBlackMessage(QString());
+ clearMessage();
SavedAction *act = theFakeVimSettings()->item(cmd.args);
QTC_CHECK(!cmd.args.isEmpty()); // Handled by plugin.
- if (act && act->value().type() == QVariant::Bool) {
+ if (act && act->value().canConvert(QVariant::Bool)) {
// Boolean config to be switched on.
bool oldValue = act->value().toBool();
if (oldValue == false)
@@ -3723,7 +4241,7 @@ bool FakeVimHandler::Private::handleExSetCommand(const ExCommand &cmd)
{} // nothing to do
} else if (act) {
// Non-boolean to show.
- showBlackMessage(cmd.args + '=' + act->value().toString());
+ showMessage(MessageInfo, cmd.args + '=' + act->value().toString());
} else if (cmd.args.startsWith(_("no"))
&& (act = theFakeVimSettings()->item(cmd.args.mid(2)))) {
// Boolean config to be switched off.
@@ -3738,9 +4256,9 @@ bool FakeVimHandler::Private::handleExSetCommand(const ExCommand &cmd)
QString error = theFakeVimSettings()
->trySetValue(cmd.args.left(p), cmd.args.mid(p + 1));
if (!error.isEmpty())
- showRedMessage(error);
+ showMessage(MessageError, error);
} else {
- showRedMessage(FakeVimHandler::tr("Unknown option: ") + cmd.args);
+ showMessage(MessageError, FakeVimHandler::tr("Unknown option: ") + cmd.args);
}
updateMiniBuffer();
updateEditor();
@@ -3800,7 +4318,7 @@ bool FakeVimHandler::Private::handleExWriteCommand(const ExCommand &cmd)
QFile file1(fileName);
const bool exists = file1.exists();
if (exists && !forced && !noArgs) {
- showRedMessage(FakeVimHandler::tr
+ showMessage(MessageError, FakeVimHandler::tr
("File \"%1\" exists (add ! to override)").arg(fileName));
} else if (file1.open(QIODevice::ReadWrite)) {
// Nobody cared, so act ourselves.
@@ -3814,14 +4332,14 @@ bool FakeVimHandler::Private::handleExWriteCommand(const ExCommand &cmd)
QTextStream ts(&file2);
ts << contents;
} else {
- showRedMessage(FakeVimHandler::tr
+ showMessage(MessageError, FakeVimHandler::tr
("Cannot open file \"%1\" for writing").arg(fileName));
}
// Check result by reading back.
QFile file3(fileName);
file3.open(QIODevice::ReadOnly);
QByteArray ba = file3.readAll();
- showBlackMessage(FakeVimHandler::tr("\"%1\" %2 %3L, %4C written")
+ showMessage(MessageInfo, FakeVimHandler::tr("\"%1\" %2 %3L, %4C written")
.arg(fileName).arg(exists ? " " : tr(" [New] "))
.arg(ba.count('\n')).arg(ba.size()));
//if (quitAll)
@@ -3829,7 +4347,7 @@ bool FakeVimHandler::Private::handleExWriteCommand(const ExCommand &cmd)
//else if (quit)
// passUnknownExCommand(forced ? "q!" : "q");
} else {
- showRedMessage(FakeVimHandler::tr
+ showMessage(MessageError, FakeVimHandler::tr
("Cannot open file \"%1\" for reading").arg(fileName));
}
return true;
@@ -3852,7 +4370,7 @@ bool FakeVimHandler::Private::handleExReadCommand(const ExCommand &cmd)
QString data = ts.readAll();
insertText(data);
endEditBlock();
- showBlackMessage(FakeVimHandler::tr("\"%1\" %2L, %3C")
+ showMessage(MessageInfo, FakeVimHandler::tr("\"%1\" %2L, %3C")
.arg(m_currentFileName).arg(data.count('\n')).arg(data.size()));
return true;
}
@@ -3869,9 +4387,8 @@ bool FakeVimHandler::Private::handleExBangCommand(const ExCommand &cmd) // :!
QProcess proc;
proc.start(command);
proc.waitForStarted();
-#ifdef Q_OS_WIN
- text.replace(_("\n"), _("\r\n"));
-#endif
+ if (Utils::HostOsInfo::isWindowsHost())
+ text.replace(_("\n"), _("\r\n"));
proc.write(text.toUtf8());
proc.closeWriteChannel();
proc.waitForFinished();
@@ -3886,7 +4403,7 @@ bool FakeVimHandler::Private::handleExBangCommand(const ExCommand &cmd) // :!
endEditBlock();
leaveVisualMode();
//qDebug() << "FILTER: " << command;
- showBlackMessage(FakeVimHandler::tr("%n lines filtered", 0,
+ showMessage(MessageInfo, FakeVimHandler::tr("%n lines filtered", 0,
text.count('\n')));
}
return true;
@@ -3909,7 +4426,7 @@ bool FakeVimHandler::Private::handleExShiftCommand(const ExCommand &cmd)
leaveVisualMode();
const int beginLine = lineForPosition(range.beginPos);
const int endLine = lineForPosition(range.endPos);
- showBlackMessage(FakeVimHandler::tr("%n lines %1ed %2 time", 0,
+ showMessage(MessageInfo, FakeVimHandler::tr("%n lines %1ed %2 time", 0,
(endLine - beginLine + 1)).arg(cmd.cmd).arg(count));
return true;
}
@@ -3920,8 +4437,7 @@ bool FakeVimHandler::Private::handleExNohlsearchCommand(const ExCommand &cmd)
if (!cmd.cmd.startsWith("noh"))
return false;
- m_searchSelections.clear();
- updateSelection();
+ highlightMatches(QString());
return true;
}
@@ -3936,6 +4452,17 @@ bool FakeVimHandler::Private::handleExRedoCommand(const ExCommand &cmd)
return true;
}
+bool FakeVimHandler::Private::handleExUndoCommand(const ExCommand &cmd)
+{
+ // :undo
+ if (cmd.cmd != "u" && cmd.cmd != "un" && cmd.cmd != "undo")
+ return false;
+
+ undo();
+ updateMiniBuffer();
+ return true;
+}
+
bool FakeVimHandler::Private::handleExGotoCommand(const ExCommand &cmd)
{
// :<nr>
@@ -3944,7 +4471,7 @@ bool FakeVimHandler::Private::handleExGotoCommand(const ExCommand &cmd)
const int beginLine = lineForPosition(cmd.range.beginPos);
setPosition(firstPositionInLine(beginLine));
- showBlackMessage(QString());
+ clearMessage();
return true;
}
@@ -3957,30 +4484,44 @@ bool FakeVimHandler::Private::handleExSourceCommand(const ExCommand &cmd)
QString fileName = cmd.args;
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)) {
- showRedMessage(FakeVimHandler::tr("Cannot open file %1").arg(fileName));
+ showMessage(MessageError, FakeVimHandler::tr("Cannot open file %1").arg(fileName));
return true;
}
bool inFunction = false;
- while (!file.atEnd()) {
- QByteArray line = file.readLine();
- line = line.trimmed();
+ QByteArray line;
+ while (!file.atEnd() || !line.isEmpty()) {
+ QByteArray nextline = !file.atEnd() ? file.readLine() : QByteArray();
+
+ // remove comment
+ int i = nextline.lastIndexOf('"');
+ if (i != -1)
+ nextline = nextline.remove(i, nextline.size() - i);
+
+ nextline = nextline.trimmed();
+
+ // multi-line command?
+ if (nextline.startsWith('\\')) {
+ line += nextline.mid(1);
+ continue;
+ }
+
if (line.startsWith("function")) {
//qDebug() << "IGNORING FUNCTION" << line;
inFunction = true;
} else if (inFunction && line.startsWith("endfunction")) {
inFunction = false;
- } else if (line.startsWith("function")) {
- //qDebug() << "IGNORING FUNCTION" << line;
- inFunction = true;
- } else if (line.startsWith('"')) {
- // A comment.
} else if (!line.isEmpty() && !inFunction) {
//qDebug() << "EXECUTING: " << line;
ExCommand cmd;
cmd.setContentsFromLine(QString::fromLocal8Bit(line));
- handleExCommandHelper(cmd);
+ while (cmd.nextSubcommand()) {
+ if (!handleExCommandHelper(cmd))
+ break;
+ }
}
+
+ line = nextline;
}
file.close();
return true;
@@ -3991,7 +4532,7 @@ bool FakeVimHandler::Private::handleExEchoCommand(const ExCommand &cmd)
// :echo
if (cmd.cmd != "echo")
return false;
- m_currentMessage = cmd.args;
+ showMessage(MessageInfo, cmd.args);
return true;
}
@@ -4003,13 +4544,35 @@ void FakeVimHandler::Private::handleExCommand(const QString &line0)
line.chop(1);
int percent = line.toInt();
setPosition(firstPositionInLine(percent * linesInDocument() / 100));
- showBlackMessage(QString());
+ clearMessage();
return;
}
+ ExCommand cmd;
+ cmd.setContentsFromLine(line);
+ //qDebug() << "CMD: " << cmd;
+
+ beginLargeEditBlock();
+ while (cmd.nextSubcommand()) {
+ if (!handleExCommandHelper(cmd)) {
+ showMessage(MessageError,
+ tr("Not an editor command: %1").arg(cmd.printCommand()));
+ break;
+ }
+ }
+ endEditBlock();
+
+ enterCommandMode();
+}
+
+bool FakeVimHandler::Private::handleExCommandHelper(ExCommand &cmd)
+{
+ // parse range first
+ QString &line = cmd.cmd;
+
// FIXME: that seems to be different for %w and %s
if (line.startsWith(QLatin1Char('%')))
- line = "1,$" + line.mid(1);
+ line.replace(0, 1, "1,$");
const int beginLine = readLineCode(line);
int endLine = -1;
@@ -4019,24 +4582,13 @@ void FakeVimHandler::Private::handleExCommand(const QString &line0)
}
if (beginLine != -1 && endLine == -1)
endLine = beginLine;
- ExCommand cmd;
- cmd.setContentsFromLine(line);
if (beginLine != -1) {
const int beginPos = firstPositionInLine(beginLine);
const int endPos = lastPositionInLine(endLine);
cmd.range = Range(beginPos, endPos, RangeLineMode);
cmd.count = beginLine;
}
- //qDebug() << "CMD: " << cmd;
- enterCommandMode();
- showBlackMessage(QString());
- if (!handleExCommandHelper(cmd))
- showRedMessage(tr("Not an editor command: %1").arg(cmd.cmd));
-}
-
-bool FakeVimHandler::Private::handleExCommandHelper(const ExCommand &cmd)
-{
return handleExPluginCommand(cmd)
|| handleExGotoCommand(cmd)
|| handleExBangCommand(cmd)
@@ -4048,6 +4600,7 @@ bool FakeVimHandler::Private::handleExCommandHelper(const ExCommand &cmd)
|| handleExNormalCommand(cmd)
|| handleExReadCommand(cmd)
|| handleExRedoCommand(cmd)
+ || handleExUndoCommand(cmd)
|| handleExSetCommand(cmd)
|| handleExShiftCommand(cmd)
|| handleExSourceCommand(cmd)
@@ -4086,21 +4639,16 @@ void FakeVimHandler::Private::searchBalanced(bool forward, QChar needle, QChar o
// Making this unconditional feels better, but is not "vim like".
if (oldLine != cursorLine() - cursorLineOnScreen())
scrollToLine(cursorLine() - linesOnScreen() / 2);
+ recordJump();
setPosition(pos);
setTargetColumn();
- updateSelection();
- recordJump();
return;
}
}
}
-void FakeVimHandler::Private::search(const SearchData &sd)
+void FakeVimHandler::Private::search(const SearchData &sd, bool showMessages)
{
- if (sd.needle.isEmpty())
- return;
-
- const bool incSearch = hasConfig(ConfigIncSearch);
QTextDocument::FindFlags flags = QTextDocument::FindCaseSensitively;
if (!sd.forward)
flags |= QTextDocument::FindBackward;
@@ -4109,100 +4657,108 @@ void FakeVimHandler::Private::search(const SearchData &sd)
const int oldLine = cursorLine() - cursorLineOnScreen();
- int startPos = position();
- if (sd.mustMove)
- sd.forward ? ++startPos : --startPos;
+ int startPos = m_searchStartPosition + (sd.forward ? 1 : -1);
- m_searchCursor = QTextCursor();
+ int repeat = count();
QTextCursor tc = document()->find(needleExp, startPos, flags);
+ while (!tc.isNull() && --repeat >= 1)
+ tc = document()->find(needleExp, tc, flags);
+
if (tc.isNull()) {
- int startPos = sd.forward ? 0 : lastPositionInDocument();
- tc = document()->find(needleExp, startPos, flags);
- if (tc.isNull()) {
- if (!incSearch) {
- highlightMatches(QString());
- showRedMessage(FakeVimHandler::tr("Pattern not found: %1")
- .arg(needleExp.pattern()));
+ if (hasConfig(ConfigWrapScan)) {
+ int startPos = sd.forward ? 0 : lastPositionInDocument();
+ tc = document()->find(needleExp, startPos, flags);
+ while (!tc.isNull() && --repeat >= 1)
+ tc = document()->find(needleExp, tc, flags);
+ if (tc.isNull()) {
+ if (showMessages) {
+ showMessage(MessageError,
+ FakeVimHandler::tr("Pattern not found: %1").arg(sd.needle));
+ }
+ } else if (showMessages) {
+ QString msg = sd.forward
+ ? FakeVimHandler::tr("search hit BOTTOM, continuing at TOP")
+ : FakeVimHandler::tr("search hit TOP, continuing at BOTTOM");
+ showMessage(MessageWarning, msg);
}
- updateSelection();
- return;
- }
- if (!incSearch) {
+ } else if (showMessages) {
QString msg = sd.forward
- ? FakeVimHandler::tr("search hit BOTTOM, continuing at TOP")
- : FakeVimHandler::tr("search hit TOP, continuing at BOTTOM");
- showRedMessage(msg);
+ ? FakeVimHandler::tr("search hit BOTTOM without match for: %1")
+ : FakeVimHandler::tr("search hit TOP without match for: %1");
+ showMessage(MessageError, msg.arg(sd.needle));
}
}
- // Set Cursor. In contrast to the main editor we have the cursor
- // position before the anchor position.
- setAnchorAndPosition(tc.position(), tc.anchor());
+ if (tc.isNull()) {
+ tc = cursor();
+ tc.setPosition(m_searchStartPosition);
+ if (!needleExp.isValid() && showMessages) {
+ QString error = needleExp.errorString();
+ showMessage(MessageError,
+ FakeVimHandler::tr("Invalid regular expression: %1").arg(error));
+ }
+ }
+
+ recordJump();
+ if (isVisualMode()) {
+ int d = tc.anchor() - tc.position();
+ setPosition(tc.position() + d);
+ } else {
+ // Set Cursor. In contrast to the main editor we have the cursor
+ // position before the anchor position.
+ setAnchorAndPosition(tc.position(), tc.anchor());
+ }
// Making this unconditional feels better, but is not "vim like".
if (oldLine != cursorLine() - cursorLineOnScreen())
scrollToLine(cursorLine() - linesOnScreen() / 2);
- if (incSearch && sd.highlightCursor)
- m_searchCursor = cursor();
+ m_searchCursor = cursor();
setTargetColumn();
if (sd.highlightMatches)
- highlightMatches(sd.needle);
- updateSelection();
- recordJump();
+ highlightMatches(needleExp.pattern());
+}
+
+void FakeVimHandler::Private::searchNext(bool forward)
+{
+ SearchData sd;
+ sd.needle = g.lastSearch;
+ sd.forward = forward ? g.lastSearchForward : !g.lastSearchForward;
+ sd.highlightMatches = true;
+ m_searchStartPosition = position();
+ showMessage(MessageCommand, (g.lastSearchForward ? '/' : '?') + sd.needle);
+ search(sd);
}
void FakeVimHandler::Private::highlightMatches(const QString &needle)
{
- if (!hasConfig(ConfigHlSearch))
- return;
- if (needle == m_oldNeedle)
+ if (!hasConfig(ConfigHlSearch) || needle == m_oldNeedle)
return;
m_oldNeedle = needle;
- m_searchSelections.clear();
- if (!needle.isEmpty()) {
- QTextCursor tc = cursor();
- tc.movePosition(StartOfDocument, MoveAnchor);
-
- QRegExp needleExp = vimPatternToQtPattern(needle, hasConfig(ConfigSmartCase));
- if (!needleExp.isValid()) {
- QString error = needleExp.errorString();
- showRedMessage(
- FakeVimHandler::tr("Invalid regular expression: %1").arg(error));
- return;
- }
- while (!tc.atEnd()) {
- tc = tc.document()->find(needleExp, tc.position());
- if (tc.isNull())
- break;
- if (!tc.hasSelection())
- tc.movePosition(Right, KeepAnchor, 1);
- QTextEdit::ExtraSelection sel;
- sel.cursor = tc;
- sel.format = tc.blockCharFormat();
- sel.format.setBackground(QColor(177, 177, 0));
- m_searchSelections.append(sel);
- if (document()->characterAt(tc.position()) == ParagraphSeparator)
- tc.movePosition(Right, MoveAnchor);
- }
- }
- updateSelection();
+ updateHighlights();
}
void FakeVimHandler::Private::moveToFirstNonBlankOnLine()
{
- QTextDocument *doc = document();
- int firstPos = block().position();
+ QTextCursor tc2 = cursor();
+ moveToFirstNonBlankOnLine(&tc2);
+ setPosition(tc2.position());
+}
+
+void FakeVimHandler::Private::moveToFirstNonBlankOnLine(QTextCursor *tc)
+{
+ QTextDocument *doc = tc->document();
+ int firstPos = tc->block().position();
for (int i = firstPos, n = firstPos + block().length(); i < n; ++i) {
if (!doc->characterAt(i).isSpace() || i == n - 1) {
- setPosition(i);
+ tc->setPosition(i);
return;
}
}
- setPosition(block().position());
+ tc->setPosition(block().position());
}
void FakeVimHandler::Private::indentSelectedText(QChar typedChar)
@@ -4232,7 +4788,7 @@ void FakeVimHandler::Private::indentText(const Range &range, QChar typedChar)
// LineForPosition has returned 1-based line numbers.
emit q->indentRegion(beginLine - 1, endLine - 1, typedChar);
if (beginLine != endLine)
- showBlackMessage("MARKS ARE OFF NOW");
+ showMessage(MessageError, "MARKS ARE OFF NOW");
}
bool FakeVimHandler::Private::isElectricCharacter(QChar c) const
@@ -4255,6 +4811,7 @@ void FakeVimHandler::Private::shiftRegionRight(int repeat)
targetPos = firstPositionInLine(beginLine);
const int sw = config(ConfigShiftWidth).toInt();
+ m_movetype = MoveLineWise;
beginEditBlock();
for (int line = beginLine; line <= endLine; ++line) {
QString data = lineContents(line);
@@ -4284,6 +4841,7 @@ void FakeVimHandler::Private::shiftRegionLeft(int repeat)
if (hasConfig(ConfigStartOfLine))
targetPos = firstPositionInLine(beginLine);
+ m_movetype = MoveLineWise;
beginEditBlock();
for (int line = endLine; line >= beginLine; --line) {
int pos = firstPositionInLine(line);
@@ -4354,6 +4912,32 @@ int FakeVimHandler::Private::charClass(QChar c, bool simple) const
return c.isSpace() ? 0 : 1;
}
+void FakeVimHandler::Private::miniBufferTextEdited(const QString &text, int cursorPos)
+{
+ if (m_subsubmode != SearchSubSubMode && m_mode != ExMode) {
+ editor()->setFocus();
+ } else if (text.isEmpty()) {
+ // editing cancelled
+ handleDefaultKey(Input(Qt::Key_Escape, Qt::NoModifier, QString()));
+ editor()->setFocus();
+ updateCursorShape();
+ } else {
+ CommandBuffer &cmdBuf = (m_mode == ExMode) ? g.commandBuffer : g.searchBuffer;
+ // prepend prompt character if missing
+ if (!text.startsWith(cmdBuf.prompt())) {
+ emit q->commandBufferChanged(cmdBuf.prompt() + text, cmdBuf.cursorPos() + 1, 0, q);
+ cmdBuf.setContents(text, cursorPos - 1);
+ } else {
+ cmdBuf.setContents(text.mid(1), cursorPos - 1);
+ }
+ // update search expression
+ if (m_subsubmode == SearchSubSubMode) {
+ updateFind(false);
+ exportSelection();
+ }
+ }
+}
+
// Helper to parse a-z,A-Z,48-57,_
static int someInt(const QString &str)
{
@@ -4383,36 +4967,93 @@ void FakeVimHandler::Private::setupCharClass()
}
}
-void FakeVimHandler::Private::moveToWordBoundary(bool simple, bool forward, bool changeWord)
+void FakeVimHandler::Private::moveToBoundary(bool simple, bool forward)
{
- int repeat = count();
QTextDocument *doc = document();
- int n = forward ? lastPositionInDocument() : 0;
- int lastClass = -1;
- if (changeWord) {
- lastClass = charClass(characterAtCursor(), simple);
- --repeat;
- if (changeWord && block().length() == 1) // empty line
- --repeat;
- }
- while (repeat >= 0) {
- QChar c = doc->characterAt(position() + (forward ? 1 : -1));
+ QTextCursor tc(doc);
+ tc.setPosition(position());
+ if (forward ? tc.atBlockEnd() : tc.atBlockStart())
+ return;
+
+ QChar c = document()->characterAt(tc.position() + (forward ? -1 : 1));
+ int lastClass = tc.atStart() ? -1 : charClass(c, simple);
+ QTextCursor::MoveOperation op = forward ? Right : Left;
+ while (true) {
+ c = doc->characterAt(tc.position());
int thisClass = charClass(c, simple);
- if (thisClass != lastClass && (lastClass != 0 || changeWord))
- --repeat;
- if (repeat == -1)
+ if (thisClass != lastClass || (forward ? tc.atBlockEnd() : tc.atBlockStart())) {
+ if (tc != cursor())
+ tc.movePosition(forward ? Left : Right);
break;
+ }
lastClass = thisClass;
- if (position() == n)
- break;
- forward ? moveRight() : moveLeft();
- if (changeWord && block().length() == 1) // empty line
+ tc.movePosition(op);
+ }
+ setPosition(tc.position());
+}
+
+void FakeVimHandler::Private::moveToNextBoundary(bool end, int count, bool simple, bool forward)
+{
+ int repeat = count;
+ while (repeat > 0 && !(forward ? atDocumentEnd() : atDocumentStart())) {
+ setPosition(position() + (forward ? 1 : -1));
+ moveToBoundary(simple, forward);
+ if (atBoundary(end, simple))
--repeat;
- if (repeat == -1)
- break;
}
}
+void FakeVimHandler::Private::moveToNextBoundaryStart(int count, bool simple, bool forward)
+{
+ moveToNextBoundary(false, count, simple, forward);
+}
+
+void FakeVimHandler::Private::moveToNextBoundaryEnd(int count, bool simple, bool forward)
+{
+ moveToNextBoundary(true, count, simple, forward);
+}
+
+void FakeVimHandler::Private::moveToBoundaryStart(int count, bool simple, bool forward)
+{
+ moveToNextBoundaryStart(atBoundary(false, simple) ? count - 1 : count, simple, forward);
+}
+
+void FakeVimHandler::Private::moveToBoundaryEnd(int count, bool simple, bool forward)
+{
+ moveToNextBoundaryEnd(atBoundary(true, simple) ? count - 1 : count, simple, forward);
+}
+
+void FakeVimHandler::Private::moveToNextWord(bool end, int count, bool simple, bool forward, bool emptyLines)
+{
+ int repeat = count;
+ while (repeat > 0 && !(forward ? atDocumentEnd() : atDocumentStart())) {
+ setPosition(position() + (forward ? 1 : -1));
+ moveToBoundary(simple, forward);
+ if (atWordBoundary(end, simple) && (emptyLines || !atEmptyLine()) )
+ --repeat;
+ }
+}
+
+void FakeVimHandler::Private::moveToNextWordStart(int count, bool simple, bool forward, bool emptyLines)
+{
+ moveToNextWord(false, count, simple, forward, emptyLines);
+}
+
+void FakeVimHandler::Private::moveToNextWordEnd(int count, bool simple, bool forward, bool emptyLines)
+{
+ moveToNextWord(true, count, simple, forward, emptyLines);
+}
+
+void FakeVimHandler::Private::moveToWordStart(int count, bool simple, bool forward, bool emptyLines)
+{
+ moveToNextWordStart(atWordStart(simple) ? count - 1 : count, simple, forward, emptyLines);
+}
+
+void FakeVimHandler::Private::moveToWordEnd(int count, bool simple, bool forward, bool emptyLines)
+{
+ moveToNextWordEnd(atWordEnd(simple) ? count - 1 : count, simple, forward, emptyLines);
+}
+
bool FakeVimHandler::Private::handleFfTt(QString key)
{
int key0 = key.size() == 1 ? key.at(0).unicode() : 0;
@@ -4455,35 +5096,6 @@ bool FakeVimHandler::Private::handleFfTt(QString key)
return false;
}
-void FakeVimHandler::Private::moveToNextWord(bool simple, bool deleteWord)
-{
- int repeat = count();
- int n = lastPositionInDocument();
- int lastClass = charClass(characterAtCursor(), simple);
- while (true) {
- QChar c = characterAtCursor();
- int thisClass = charClass(c, simple);
- if (thisClass != lastClass && thisClass != 0)
- --repeat;
- if (repeat == 0)
- break;
- lastClass = thisClass;
- moveRight();
- if (deleteWord) {
- if (atBlockEnd())
- --repeat;
- } else {
- if (block().length() == 1) // empty line
- --repeat;
- }
- if (repeat == 0)
- break;
- if (position() == n)
- break;
- }
- setTargetColumn();
-}
-
void FakeVimHandler::Private::moveToMatchingParanthesis()
{
bool moved = false;
@@ -4758,7 +5370,6 @@ void FakeVimHandler::Private::insertText(const Register &reg)
qDebug() << "WRONG INSERT MODE: " << reg.rangemode; return);
setAnchor();
cursor().insertText(reg.contents);
- m_lastChangePosition = cursor().position();
//dump("AFTER INSERT");
}
@@ -5047,30 +5658,29 @@ void FakeVimHandler::Private::toggleVisualMode(VisualMode visualMode)
const int pos = position();
setAnchorAndPosition(pos, pos);
updateMiniBuffer();
- updateSelection();
}
}
void FakeVimHandler::Private::leaveVisualMode()
{
- if (isVisualMode()) {
- m_lastSelectionCursor = cursor();
- m_lastSelectionMode = m_visualMode;
- int from = m_lastSelectionCursor.anchor();
- int to = m_lastSelectionCursor.position();
- if (from > to)
- qSwap(from, to);
- setMark('<', from);
- setMark('>', to);
- if (isVisualLineMode())
- m_movetype = MoveLineWise;
- else if (isVisualCharMode())
- m_movetype = MoveInclusive;
- }
+ if (!isVisualMode())
+ return;
+
+ m_lastSelectionCursor = cursor();
+ m_lastSelectionMode = m_visualMode;
+ int from = m_lastSelectionCursor.anchor();
+ int to = m_lastSelectionCursor.position();
+ if (from > to)
+ qSwap(from, to);
+ setMark('<', from);
+ setMark('>', to);
+ if (isVisualLineMode())
+ m_movetype = MoveLineWise;
+ else if (isVisualCharMode())
+ m_movetype = MoveInclusive;
m_visualMode = NoVisualMode;
updateMiniBuffer();
- updateSelection();
}
QWidget *FakeVimHandler::Private::editor() const
@@ -5080,21 +5690,72 @@ QWidget *FakeVimHandler::Private::editor() const
: static_cast<QWidget *>(m_plaintextedit);
}
+void FakeVimHandler::Private::joinPreviousEditBlock()
+{
+ UNDO_DEBUG("JOIN");
+ if (m_breakEditBlock)
+ beginEditBlock();
+ else
+ cursor().joinPreviousEditBlock();
+}
+
+void FakeVimHandler::Private::beginEditBlock(bool rememberPosition)
+{
+ UNDO_DEBUG("BEGIN EDIT BLOCK");
+ cursor().beginEditBlock();
+ if (rememberPosition)
+ setUndoPosition(false);
+ m_breakEditBlock = false;
+}
+
+void FakeVimHandler::Private::endEditBlock()
+{
+ UNDO_DEBUG("END EDIT BLOCK");
+ cursor().endEditBlock();
+}
+
+char FakeVimHandler::Private::currentModeCode() const
+{
+ if (m_mode == ExMode)
+ return 'c';
+ else if (isVisualMode())
+ return 'v';
+ else if (m_mode == CommandMode)
+ return 'n';
+ else
+ return 'i';
+}
+
void FakeVimHandler::Private::undo()
{
// FIXME: That's only an approximaxtion. The real solution might
// be to store marks and old userData with QTextBlock setUserData
// and retrieve them afterward.
- const int current = document()->availableUndoSteps();
+ const int current = revision();
EDITOR(undo());
- const int rev = document()->availableUndoSteps();
- if (current == rev)
- showBlackMessage(FakeVimHandler::tr("Already at oldest change"));
- else
- showBlackMessage(QString());
+ const int rev = revision();
+
+ // rewind to last saved revision
+ while (!m_undo.empty() && m_undo.top().revision > rev)
+ m_undo.pop();
+
+ if (current == rev) {
+ showMessage(MessageInfo, FakeVimHandler::tr("Already at oldest change"));
+ return;
+ }
+ clearMessage();
+
+ if (!m_undo.empty()) {
+ State &state = m_undo.top();
+ if (state.revision == rev) {
+ m_lastChangePosition = state.position;
+ m_marks = state.marks;
+ setPosition(m_lastChangePosition);
+ state.revision = current;
+ m_redo.push(m_undo.pop());
+ }
+ }
- if (m_undoCursorPosition.contains(rev))
- setPosition(m_undoCursorPosition[rev]);
setTargetColumn();
if (atEndOfLine())
moveLeft();
@@ -5102,17 +5763,36 @@ void FakeVimHandler::Private::undo()
void FakeVimHandler::Private::redo()
{
- const int current = document()->availableUndoSteps();
+ const int current = revision();
EDITOR(redo());
- const int rev = document()->availableUndoSteps();
- if (rev == current)
- showBlackMessage(FakeVimHandler::tr("Already at newest change"));
- else
- showBlackMessage(QString());
+ const int rev = revision();
- if (m_undoCursorPosition.contains(rev))
- setPosition(m_undoCursorPosition[rev]);
+ // forward to last saved revision
+ while (!m_redo.empty() && m_redo.top().revision < rev)
+ m_redo.pop();
+
+ if (rev == current) {
+ showMessage(MessageInfo, FakeVimHandler::tr("Already at newest change"));
+ return;
+ }
+ clearMessage();
+
+ if (!m_redo.empty()) {
+ State &state = m_redo.top();
+ if (state.revision == rev) {
+ int pos = qMin(document()->characterCount() - 1, state.position);
+ if (lineForPosition(pos) != state.line)
+ pos = lastPositionInLine(state.line);
+ m_lastChangePosition = pos;
+ m_marks = state.marks;
+ setPosition(m_lastChangePosition);
+ state.revision = current;
+ m_undo.push(m_redo.pop());
+ }
+ }
setTargetColumn();
+ if (atEndOfLine())
+ moveLeft();
}
void FakeVimHandler::Private::updateCursorShape()
@@ -5130,7 +5810,6 @@ void FakeVimHandler::Private::enterReplaceMode()
m_mode = ReplaceMode;
m_submode = NoSubMode;
m_subsubmode = NoSubSubMode;
- m_commandPrefix.clear();
m_lastInsertion.clear();
m_lastDeletion.clear();
}
@@ -5140,7 +5819,6 @@ void FakeVimHandler::Private::enterInsertMode()
m_mode = InsertMode;
m_submode = NoSubMode;
m_subsubmode = NoSubSubMode;
- m_commandPrefix.clear();
m_lastInsertion.clear();
m_lastDeletion.clear();
}
@@ -5152,7 +5830,6 @@ void FakeVimHandler::Private::enterCommandMode()
m_mode = CommandMode;
m_submode = NoSubMode;
m_subsubmode = NoSubSubMode;
- m_commandPrefix.clear();
}
void FakeVimHandler::Private::enterExMode()
@@ -5160,16 +5837,31 @@ void FakeVimHandler::Private::enterExMode()
m_mode = ExMode;
m_submode = NoSubMode;
m_subsubmode = NoSubSubMode;
- m_commandPrefix = ':';
}
void FakeVimHandler::Private::recordJump()
{
- m_jumpListUndo.append(cursorPosition());
+ CursorPosition pos = cursorPosition();
+ setMark('\'', pos.position);
+ if (m_jumpListUndo.isEmpty() || m_jumpListUndo.top().position != pos.position)
+ m_jumpListUndo.push(pos);
m_jumpListRedo.clear();
UNDO_DEBUG("jumps: " << m_jumpListUndo);
}
+void FakeVimHandler::Private::jump(int distance)
+{
+ QStack<CursorPosition> &from = (distance > 0) ? m_jumpListRedo : m_jumpListUndo;
+ QStack<CursorPosition> &to = (distance > 0) ? m_jumpListUndo : m_jumpListRedo;
+ int len = qMin(qAbs(distance), from.size());
+ setMark('\'', position());
+ for (int i = 0; i < len; ++i) {
+ to.push(cursorPosition());
+ setCursorPosition(from.top());
+ from.pop();
+ }
+}
+
Column FakeVimHandler::Private::indentation(const QString &line) const
{
int ts = config(ConfigTabStop).toInt();
@@ -5245,40 +5937,106 @@ void FakeVimHandler::Private::handleStartOfLine()
void FakeVimHandler::Private::replay(const QString &command, int n)
{
//qDebug() << "REPLAY: " << quoteUnprintable(command);
+ Inputs inputs(command);
for (int i = n; --i >= 0; ) {
- foreach (QChar c, command) {
- //qDebug() << " REPLAY: " << c.unicode();
- handleKey(Input(c));
+ foreach (Input in, inputs) {
+ handleDefaultKey(in);
}
}
}
-void FakeVimHandler::Private::selectWordTextObject(bool inner)
+QString FakeVimHandler::Private::visualDotCommand() const
{
- Q_UNUSED(inner); // FIXME
- m_movetype = MoveExclusive;
- moveToWordBoundary(false, false, true);
- setAnchor();
- // FIXME: Rework the 'anchor' concept.
- //if (isVisualMode())
- // setMark('<', cursor().position());
- moveToWordBoundary(false, true, true);
+ QTextCursor start(cursor());
+ QTextCursor end(start);
+ end.setPosition(end.anchor());
+
+ if (isVisualCharMode())
+ return QString("v%1l").arg(qAbs(start.position() - end.position()));
+
+ if (isVisualLineMode())
+ return QString("V%1j").arg(qAbs(start.blockNumber() - end.blockNumber()));
+
+ if (isVisualBlockMode()) {
+ return QString("<c-v>%1l%2j")
+ .arg(qAbs(start.positionInBlock() - end.positionInBlock()))
+ .arg(qAbs(start.blockNumber() - end.blockNumber()));
+ }
+
+ return QString();
+}
+
+void FakeVimHandler::Private::selectTextObject(bool simple, bool inner)
+{
+ bool setupAnchor = (position() == anchor());
+
+ // set anchor if not already set
+ if (setupAnchor) {
+ moveToBoundaryStart(1, simple, false);
+ setAnchor();
+ } else {
+ moveRight();
+ if (atEndOfLine())
+ moveRight();
+ }
+
+ const int repeat = count();
+ if (inner) {
+ moveToBoundaryEnd(repeat, simple);
+ } else {
+ for (int i = 0; i < repeat; ++i) {
+ // select leading spaces
+ bool leadingSpace = characterAtCursor().isSpace();
+ if (leadingSpace)
+ moveToNextBoundaryStart(1, simple);
+
+ // select word
+ moveToWordEnd(1, simple);
+
+ // select trailing spaces if no leading space
+ if (!leadingSpace && document()->characterAt(position() + 1).isSpace()
+ && !atBlockStart()) {
+ moveToNextBoundaryEnd(1, simple);
+ }
+
+ // if there are no trailing spaces in selection select all leading spaces
+ // after previous character
+ if (setupAnchor && (!characterAtCursor().isSpace() || atBlockEnd())) {
+ int min = block().position();
+ int pos = anchor();
+ while (pos >= min && document()->characterAt(--pos).isSpace()) {}
+ if (pos >= min)
+ setAnchorAndPosition(pos + 1, position());
+ }
+
+ if (i + 1 < repeat) {
+ moveRight();
+ if (atEndOfLine())
+ moveRight();
+ }
+ }
+ }
+
+ if (inner) {
+ m_movetype = MoveInclusive;
+ } else {
+ m_movetype = MoveExclusive;
+ moveRight();
+ if (atEndOfLine())
+ moveRight();
+ }
+
setTargetColumn();
- m_movetype = MoveInclusive;
+}
+
+void FakeVimHandler::Private::selectWordTextObject(bool inner)
+{
+ selectTextObject(false, inner);
}
void FakeVimHandler::Private::selectWORDTextObject(bool inner)
{
- Q_UNUSED(inner); // FIXME
- m_movetype = MoveExclusive;
- moveToWordBoundary(true, false, true);
- setAnchor();
- // FIXME: Rework the 'anchor' concept.
- //if (isVisualMode())
- // setMark('<', cursor().position());
- moveToWordBoundary(true, true, true);
- setTargetColumn();
- m_movetype = MoveInclusive;
+ selectTextObject(true, inner);
}
void FakeVimHandler::Private::selectSentenceTextObject(bool inner)
@@ -5321,36 +6079,33 @@ static bool isSign(const QChar c)
return c.unicode() == '-' || c.unicode() == '+';
}
-void FakeVimHandler::Private::changeNumberTextObject(bool doIncrement)
+void FakeVimHandler::Private::changeNumberTextObject(int count)
{
QTextCursor tc = cursor();
int pos = tc.position();
- const int n = lastPositionInDocument();
+ const int n = lastPositionInLine(lineForPosition(pos));
QTextDocument *doc = document();
QChar c = doc->characterAt(pos);
- if (!c.isNumber()) {
- if (pos == n || !isSign(c))
+ while (!c.isNumber()) {
+ if (pos == n)
return;
++pos;
c = doc->characterAt(pos);
- if (!c.isNumber())
- return;
}
int p1 = pos;
while (p1 >= 1 && doc->characterAt(p1 - 1).isNumber())
--p1;
if (p1 >= 1 && isSign(doc->characterAt(p1 - 1)))
--p1;
- int p2 = pos;
- while (p2 <= n - 1 && doc->characterAt(p2 + 1).isNumber())
+ int p2 = pos + 1;
+ while (p2 <= n - 1 && doc->characterAt(p2).isNumber())
++p2;
- ++p2;
- setAnchorAndPosition(p2, p1);
+ setAnchorAndPosition(p1, p2);
QString orig = selectText(currentRange());
int value = orig.toInt();
- value = doIncrement ? value + 1 : value - 1;
- QString repl = QString::fromLatin1("%1").arg(value, orig.size(), 10, QLatin1Char('0'));
+ value += count;
+ QString repl = QString::fromLatin1("%1").arg(value);
replaceText(currentRange(), repl);
moveLeft();
}
@@ -5544,7 +6299,6 @@ bool FakeVimHandler::eventFilter(QObject *ob, QEvent *ev)
QMouseEvent *mev = static_cast<QMouseEvent *>(ev);
if (mev->button() == Qt::LeftButton) {
d->m_visualMode = NoVisualMode;
- d->updateSelection();
}
}
return QObject::eventFilter(ob, ev);
@@ -5570,7 +6324,7 @@ bool FakeVimHandler::eventFilter(QObject *ob, QEvent *ev)
return res == EventHandled;
}
- if (active && ev->type() == QEvent::KeyPress && ob == d->editor()) {
+ if (active && ev->type() == QEvent::KeyPress) {
QKeyEvent *kev = static_cast<QKeyEvent *>(ev);
KEY_DEBUG("KEYPRESS" << kev->key() << kev->text() << QChar(kev->key()));
EventResult res = d->handleEvent(kev);
@@ -5630,8 +6384,7 @@ void FakeVimHandler::handleInput(const QString &keys)
{
Mode oldMode = d->m_mode;
d->m_mode = CommandMode;
- Inputs inputs;
- inputs.parseFrom(keys);
+ Inputs inputs(keys);
foreach (const Input &input, inputs)
d->handleKey(input);
d->m_mode = oldMode;
@@ -5647,14 +6400,9 @@ QString FakeVimHandler::currentFileName() const
return d->m_currentFileName;
}
-void FakeVimHandler::showBlackMessage(const QString &msg)
+void FakeVimHandler::showMessage(MessageLevel level, const QString &msg)
{
- d->showBlackMessage(msg);
-}
-
-void FakeVimHandler::showRedMessage(const QString &msg)
-{
- d->showRedMessage(msg);
+ d->showMessage(level, msg);
}
QWidget *FakeVimHandler::widget()
@@ -5680,6 +6428,21 @@ QString FakeVimHandler::tabExpand(int n) const
return d->tabExpand(n);
}
+void FakeVimHandler::miniBufferTextEdited(const QString &text, int cursorPos)
+{
+ d->miniBufferTextEdited(text, cursorPos);
+}
+
+void FakeVimHandler::setTextCursorPosition(int position)
+{
+ int pos = qMax(0, qMin(position, d->lastPositionInDocument()));
+ if (d->isVisualMode())
+ d->setPosition(pos);
+ else
+ d->setAnchorAndPosition(pos, pos);
+ d->setTargetColumn();
+}
+
} // namespace Internal
} // namespace FakeVim
diff --git a/src/plugins/fakevim/fakevimhandler.h b/src/plugins/fakevim/fakevimhandler.h
index 833fe60ebc..e09d75fde3 100644
--- a/src/plugins/fakevim/fakevimhandler.h
+++ b/src/plugins/fakevim/fakevimhandler.h
@@ -69,13 +69,29 @@ struct ExCommand
bool matches(const QString &min, const QString &full) const;
void setContentsFromLine(const QString &line);
+ // set cmd to next subcommand and return false only if no subcommand is left
+ bool nextSubcommand();
+
+ QString printCommand() const;
+
QString cmd;
+ QStringList subCommands;
bool hasBang;
QString args;
Range range;
int count;
};
+// message levels sorted by severity
+enum MessageLevel
+{
+ MessageMode, // show current mode (format "-- %1 --")
+ MessageCommand, // show last Ex command or search
+ MessageInfo, // result of a command
+ MessageWarning, // warning
+ MessageError // error
+};
+
class FakeVimHandler : public QObject
{
Q_OBJECT
@@ -93,8 +109,7 @@ public slots:
void setCurrentFileName(const QString &fileName);
QString currentFileName() const;
- void showBlackMessage(const QString &msg);
- void showRedMessage(const QString &msg);
+ void showMessage(MessageLevel level, const QString &msg);
// This executes an "ex" style command taking context
// information from the current widget.
@@ -113,11 +128,17 @@ public slots:
int logicalIndentation(const QString &line) const;
QString tabExpand(int n) const;
+ void miniBufferTextEdited(const QString &text, int cursorPos);
+
+ // Set text cursor position. Keeps anchor if in visual mode.
+ void setTextCursorPosition(int position);
+
signals:
- void commandBufferChanged(const QString &msg, int pos);
+ void commandBufferChanged(const QString &msg, int pos, int messageLevel, QObject *eventFilter);
void statusDataChanged(const QString &msg);
void extraInformationChanged(const QString &msg);
void selectionChanged(const QList<QTextEdit::ExtraSelection> &selection);
+ void highlightMatches(const QString &needle);
void writeAllRequested(QString *error);
void moveToMatchingParenthesis(bool *moved, bool *forward, QTextCursor *cursor);
void checkForElectricCharacter(bool *result, QChar c);
diff --git a/src/plugins/fakevim/fakevimoptions.ui b/src/plugins/fakevim/fakevimoptions.ui
index ff324ce7c8..66a3aa1704 100644
--- a/src/plugins/fakevim/fakevimoptions.ui
+++ b/src/plugins/fakevim/fakevimoptions.ui
@@ -66,6 +66,13 @@
</property>
</widget>
</item>
+ <item row="3" column="2">
+ <widget class="QCheckBox" name="checkBoxWrapScan">
+ <property name="text">
+ <string>Use wrapscan</string>
+ </property>
+ </widget>
+ </item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxExpandTab">
<property name="text">
@@ -73,7 +80,7 @@
</property>
</widget>
</item>
- <item row="3" column="2">
+ <item row="4" column="2">
<widget class="QCheckBox" name="checkBoxShowMarks">
<property name="text">
<string>Show position of text marks</string>
@@ -87,7 +94,7 @@
</property>
</widget>
</item>
- <item row="4" column="2">
+ <item row="5" column="2">
<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>
diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp
index 8b9769f423..522d2c41d7 100644
--- a/src/plugins/fakevim/fakevimplugin.cpp
+++ b/src/plugins/fakevim/fakevimplugin.cpp
@@ -69,6 +69,7 @@
#include <find/findplugin.h>
#include <find/textfindconstants.h>
+#include <find/ifindsupport.h>
#include <utils/qtcassert.h>
#include <utils/savedaction.h>
@@ -77,12 +78,15 @@
#include <cpptools/cpptoolsconstants.h>
+#include <extensionsystem/pluginmanager.h>
+
#include <QAbstractTableModel>
#include <QDebug>
#include <QFile>
#include <QtPlugin>
#include <QObject>
#include <QSettings>
+#include <QStackedWidget>
#include <QTextStream>
#include <QDesktopServices>
@@ -108,49 +112,99 @@ const char SETTINGS_ID[] = "A.General";
const char SETTINGS_EX_CMDS_ID[] = "B.ExCommands";
const char SETTINGS_USER_CMDS_ID[] = "C.UserCommands";
-class MiniBuffer : public QLabel
+class MiniBuffer : public QStackedWidget
{
Q_OBJECT
public:
- void setContents(const QString &contents, int cursorPos)
+ MiniBuffer() : m_label(new QLabel(this)), m_edit(new QLineEdit(this)), m_eventFilter(0)
{
- QString msg = contents;
- if (cursorPos != -1)
- msg = contents.left(cursorPos) + QChar(10073) + contents.mid(cursorPos);
- setText(" " + msg);
+ m_edit->installEventFilter(this);
+ connect(m_edit, SIGNAL(textEdited(QString)), SLOT(changed()));
+ connect(m_edit, SIGNAL(cursorPositionChanged(int,int)), SLOT(changed()));
+ m_label->setTextInteractionFlags(Qt::TextSelectableByMouse);
+
+ addWidget(m_label);
+ addWidget(m_edit);
}
-};
-class MiniBuffer1 : public QLineEdit
-{
- Q_OBJECT
+ void setContents(const QString &contents, int cursorPos, int messageLevel, QObject *eventFilter)
+ {
+ if (cursorPos != -1) {
+ m_edit->blockSignals(true);
+ m_label->clear();
+ m_edit->setText(contents);
+ m_edit->setCursorPosition(cursorPos);
+ m_edit->blockSignals(false);
+
+ setCurrentWidget(m_edit);
+ m_edit->setFocus();
+ } else {
+ m_label->setText(messageLevel == MessageMode ? "-- " + contents + " --" : contents);
+
+ QString css;
+ if (messageLevel == MessageError) {
+ css = QString("border:1px solid rgba(255,255,255,150);"
+ "background-color:rgba(255,0,0,100);");
+ } else if (messageLevel == MessageWarning) {
+ css = QString("border:1px solid rgba(255,255,255,120);"
+ "background-color:rgba(255,255,0,20);");
+ }
+ m_label->setStyleSheet(QString(
+ "*{border-radius:2px;padding-left:4px;padding-right:4px;%1}").arg(css));
-public:
- MiniBuffer1()
+ if (m_edit->hasFocus())
+ emit edited(QString(), -1);
+
+ setCurrentWidget(m_label);
+ }
+
+ if (m_eventFilter != eventFilter) {
+ if (m_eventFilter != 0) {
+ m_edit->removeEventFilter(m_eventFilter);
+ disconnect(SIGNAL(edited(QString,int)));
+ }
+ if (eventFilter != 0) {
+ m_edit->installEventFilter(eventFilter);
+ connect(this, SIGNAL(edited(QString,int)),
+ eventFilter, SLOT(miniBufferTextEdited(QString,int)));
+ }
+ m_eventFilter = eventFilter;
+ }
+ }
+
+ QSize sizeHint() const
{
- setFrame(false);
+ QSize size = QWidget::sizeHint();
+ // reserve maximal width for line edit widget
+ return currentWidget() == m_edit ? QSize(maximumWidth(), size.height()) : size;
}
- void showEvent(QShowEvent *ev)
+
+signals:
+ void edited(const QString &text, int cursorPos);
+
+private slots:
+ void changed()
{
- QLineEdit::showEvent(ev);
- QColor color = Qt::black;
- QPalette pal = parentWidget()->palette();
- pal.setBrush(QPalette::All, QPalette::WindowText, color);
- pal.setBrush(QPalette::All, QPalette::ButtonText, color);
- pal.setBrush(QPalette::All, QPalette::Foreground, color);
- pal.setBrush(QPalette::All, QPalette::Background, color);
- //color.setAlpha(100);
- //pal.setBrush(QPalette::Disabled, QPalette::WindowText, color);
- //pal.setBrush(QPalette::Disabled, QPalette::ButtonText, color);
- //pal.setBrush(QPalette::Disabled, QPalette::Foreground, color);
- setPalette(pal);
+ emit edited(m_edit->text(), m_edit->cursorPosition());
}
- void setContents(const QString &contents, int cursorPos)
+
+ bool eventFilter(QObject *ob, QEvent *ev)
{
- setText(contents);
- setCursorPosition(cursorPos);
+ // cancel editing on escape
+ if (m_eventFilter != 0 && ob == m_edit && ev->type() == QEvent::ShortcutOverride
+ && static_cast<QKeyEvent*>(ev)->key() == Qt::Key_Escape) {
+ emit edited(QString(), -1);
+ ev->accept();
+ return true;
+ }
+ return false;
}
+
+private:
+ QLabel *m_label;
+ QLineEdit *m_edit;
+ QObject *m_eventFilter;
};
///////////////////////////////////////////////////////////////////////
@@ -231,12 +285,15 @@ QWidget *FakeVimOptionPage::createPage(QWidget *parent)
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(ConfigWrapScan),
+ m_ui.checkBoxWrapScan);
connect(m_ui.pushButtonCopyTextEditorSettings, SIGNAL(clicked()),
SLOT(copyTextEditorSettings()));
@@ -791,9 +848,12 @@ private slots:
void setBlockSelection(bool);
void hasBlockSelection(bool*);
- void showCommandBuffer(const QString &contents, int cursorPos);
+ void resetCommandBuffer();
+ void showCommandBuffer(const QString &contents, int cursorPos, int messageLevel,
+ QObject *eventFilter);
void showExtraInformation(const QString &msg);
void changeSelection(const QList<QTextEdit::ExtraSelection> &selections);
+ void highlightMatches(const QString &needle);
void moveToMatchingParenthesis(bool *moved, bool *forward, QTextCursor *cursor);
void checkForElectricCharacter(bool *result, QChar c);
void indentRegion(int beginLine, int endLine, QChar typedChar);
@@ -990,7 +1050,10 @@ bool FakeVimPluginPrivate::initialize()
this, SLOT(handleDelayedQuit(bool,Core::IEditor*)), Qt::QueuedConnection);
connect(this, SIGNAL(delayedQuitAllRequested(bool)),
this, SLOT(handleDelayedQuitAll(bool)), Qt::QueuedConnection);
- maybeReadVimRc();
+
+ // Vimrc can break test so don't source it if running tests.
+ if (!ExtensionSystem::PluginManager::runningTests())
+ maybeReadVimRc();
// << "MODE: " << theFakeVimSetting(ConfigUseFakeVim)->value();
return true;
@@ -1331,10 +1394,12 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor)
connect(handler, SIGNAL(extraInformationChanged(QString)),
SLOT(showExtraInformation(QString)));
- connect(handler, SIGNAL(commandBufferChanged(QString,int)),
- SLOT(showCommandBuffer(QString,int)));
+ connect(handler, SIGNAL(commandBufferChanged(QString,int,int,QObject*)),
+ SLOT(showCommandBuffer(QString,int,int,QObject*)));
connect(handler, SIGNAL(selectionChanged(QList<QTextEdit::ExtraSelection>)),
SLOT(changeSelection(QList<QTextEdit::ExtraSelection>)));
+ connect(handler, SIGNAL(highlightMatches(QString)),
+ SLOT(highlightMatches(QString)));
connect(handler, SIGNAL(moveToMatchingParenthesis(bool*,bool*,QTextCursor*)),
SLOT(moveToMatchingParenthesis(bool*,bool*,QTextCursor*)));
connect(handler, SIGNAL(indentRegion(int,int,QChar)),
@@ -1367,7 +1432,7 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor)
// pop up the bar
if (theFakeVimSetting(ConfigUseFakeVim)->value().toBool()) {
- showCommandBuffer(QString(), -1);
+ resetCommandBuffer();
handler->setupWidget();
}
}
@@ -1399,7 +1464,7 @@ void FakeVimPluginPrivate::setUseFakeVimInternal(bool on)
//ICore *core = ICore::instance();
//core->updateAdditionalContexts(Context(),
// Context(FAKEVIM_CONTEXT));
- showCommandBuffer(QString(), -1);
+ resetCommandBuffer();
foreach (IEditor *editor, m_editorToHandler.keys()) {
if (BaseTextEditorWidget *textEditor =
qobject_cast<BaseTextEditorWidget *>(editor->widget())) {
@@ -1476,22 +1541,22 @@ void FakeVimPluginPrivate::handleExCommand(bool *handled, const ExCommand &cmd)
QFile file3(fileName);
file3.open(QIODevice::ReadOnly);
QByteArray ba = file3.readAll();
- handler->showBlackMessage(FakeVimHandler::tr("\"%1\" %2 %3L, %4C written")
+ handler->showMessage(MessageInfo, FakeVimHandler::tr("\"%1\" %2 %3L, %4C written")
.arg(fileName).arg(" ")
.arg(ba.count('\n')).arg(ba.size()));
if (cmd.cmd == "wq")
delayedQuitRequested(cmd.hasBang, m_editorToHandler.key(handler));
} else {
- handler->showRedMessage(tr("File not saved"));
+ handler->showMessage(MessageError, tr("File not saved"));
}
} else if (cmd.matches("wa", "wall")) {
// :w[all]
QList<IDocument *> toSave = DocumentManager::modifiedDocuments();
QList<IDocument *> failed = DocumentManager::saveModifiedDocumentsSilently(toSave);
if (failed.isEmpty())
- handler->showBlackMessage(tr("Saving succeeded"));
+ handler->showMessage(MessageInfo, tr("Saving succeeded"));
else
- handler->showRedMessage(tr("%n files not saved", 0, failed.size()));
+ handler->showMessage(MessageError, tr("%n files not saved", 0, failed.size()));
} else if (cmd.matches("q", "quit")) {
// :q[uit]
emit delayedQuitRequested(cmd.hasBang, m_editorToHandler.key(handler));
@@ -1657,11 +1722,17 @@ void FakeVimPluginPrivate::quitFakeVim()
theFakeVimSetting(ConfigUseFakeVim)->setValue(false);
}
-void FakeVimPluginPrivate::showCommandBuffer(const QString &contents, int cursorPos)
+void FakeVimPluginPrivate::resetCommandBuffer()
+{
+ showCommandBuffer(QString(), -1, 0, 0);
+}
+
+void FakeVimPluginPrivate::showCommandBuffer(const QString &contents, int cursorPos,
+ int messageLevel, QObject *eventFilter)
{
//qDebug() << "SHOW COMMAND BUFFER" << contents;
if (MiniBuffer *w = qobject_cast<MiniBuffer *>(m_statusBar->widget()))
- w->setContents(contents, cursorPos);
+ w->setContents(contents, cursorPos, messageLevel, eventFilter);
}
void FakeVimPluginPrivate::showExtraInformation(const QString &text)
@@ -1671,14 +1742,22 @@ void FakeVimPluginPrivate::showExtraInformation(const QString &text)
QMessageBox::information(handler->widget(), tr("FakeVim Information"), text);
}
-void FakeVimPluginPrivate::changeSelection
- (const QList<QTextEdit::ExtraSelection> &selection)
+void FakeVimPluginPrivate::changeSelection(const QList<QTextEdit::ExtraSelection> &selection)
{
if (FakeVimHandler *handler = qobject_cast<FakeVimHandler *>(sender()))
if (BaseTextEditorWidget *bt = qobject_cast<BaseTextEditorWidget *>(handler->widget()))
bt->setExtraSelections(BaseTextEditorWidget::FakeVimSelection, selection);
}
+void FakeVimPluginPrivate::highlightMatches(const QString &needle)
+{
+ IEditor *editor = EditorManager::currentEditor();
+ QWidget *w = editor->widget();
+ Find::IFindSupport *find = Aggregation::query<Find::IFindSupport>(w);
+ if (find != 0)
+ find->highlightAll(needle, Find::FindRegularExpression | Find::FindCaseSensitively);
+}
+
int FakeVimPluginPrivate::currentFile() const
{
OpenEditorsModel *model = EditorManager::instance()->openedEditorsModel();
diff --git a/src/plugins/fakevim/fakevimplugin.h b/src/plugins/fakevim/fakevimplugin.h
index 5b4275355d..749cafe4ec 100644
--- a/src/plugins/fakevim/fakevimplugin.h
+++ b/src/plugins/fakevim/fakevimplugin.h
@@ -56,6 +56,26 @@ private:
private:
friend class FakeVimPluginPrivate;
FakeVimPluginPrivate *d;
+
+#ifdef WITH_TESTS
+private slots:
+ void test_vim_movement();
+ void test_vim_fFtT();
+ void test_vim_transform_numbers();
+ void test_vim_delete();
+ void test_vim_delete_inner_word();
+ void test_vim_delete_a_word();
+ void test_vim_change_a_word();
+ void test_vim_block_selection();
+ void test_vim_repeat();
+ void test_vim_search();
+ void test_vim_indent();
+ void test_vim_marks();
+ void test_vim_copy_paste();
+ void test_vim_undo_redo();
+ void test_advanced_commands();
+ void test_map();
+#endif
};
} // namespace Internal
diff --git a/src/plugins/find/find.qbs b/src/plugins/find/find.qbs
index 560bb28fda..56e3eab12a 100644
--- a/src/plugins/find/find.qbs
+++ b/src/plugins/find/find.qbs
@@ -9,24 +9,19 @@ QtcPlugin {
Depends { name: "Core" }
Depends { name: "cpp" }
- cpp.includePaths: [
- ".",
- "..",
+ cpp.includePaths: base.concat([
"generichighlighter",
"tooltip",
"snippets",
- "codeassist",
- "../../libs",
- buildDirectory
- ]
+ "codeassist"
+ ])
files: [
- "find.qrc",
- "findwidget.ui",
"basetextfind.cpp",
"basetextfind.h",
"currentdocumentfind.cpp",
"currentdocumentfind.h",
+ "find.qrc",
"find_global.h",
"finddialog.ui",
"findplugin.cpp",
@@ -35,6 +30,7 @@ QtcPlugin {
"findtoolbar.h",
"findtoolwindow.cpp",
"findtoolwindow.h",
+ "findwidget.ui",
"ifindfilter.cpp",
"ifindfilter.h",
"ifindsupport.cpp",
@@ -54,7 +50,6 @@ QtcPlugin {
"searchresultwindow.h",
"textfindconstants.h",
"treeviewfind.cpp",
- "treeviewfind.h"
+ "treeviewfind.h",
]
}
-
diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp
index 004e96da4e..6d35df5d48 100644
--- a/src/plugins/find/findtoolbar.cpp
+++ b/src/plugins/find/findtoolbar.cpp
@@ -43,6 +43,7 @@
#include <extensionsystem/pluginmanager.h>
+#include <utils/hostosinfo.h>
#include <utils/stylehelper.h>
#include <utils/flowlayout.h>
@@ -292,11 +293,7 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
if ((obj == m_ui.findEdit || obj == m_findCompleter->popup())
&& event->type() == QEvent::KeyPress) {
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
-#ifdef Q_OS_MAC
- if (ke->key() == Qt::Key_Space && (ke->modifiers() & Qt::MetaModifier)) {
-#else
- if (ke->key() == Qt::Key_Space && (ke->modifiers() & Qt::ControlModifier)) {
-#endif
+ if (ke->key() == Qt::Key_Space && (ke->modifiers() & Utils::HostOsInfo::controlModifier())) {
QString completedText = m_currentDocumentFind->completedFindString();
if (!completedText.isEmpty()) {
setFindText(completedText);
@@ -313,11 +310,7 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
event->accept();
return true;
}
-#ifdef Q_OS_MAC
- } else if (ke->key() == Qt::Key_Space && (ke->modifiers() & Qt::MetaModifier)) {
-#else
- } else if (ke->key() == Qt::Key_Space && (ke->modifiers() & Qt::ControlModifier)) {
-#endif
+ } else if (ke->key() == Qt::Key_Space && (ke->modifiers() & Utils::HostOsInfo::controlModifier())) {
event->accept();
return true;
}
diff --git a/src/plugins/find/searchresulttreemodel.cpp b/src/plugins/find/searchresulttreemodel.cpp
index 683ecf3e29..c30e7a06f5 100644
--- a/src/plugins/find/searchresulttreemodel.cpp
+++ b/src/plugins/find/searchresulttreemodel.cpp
@@ -410,10 +410,11 @@ QList<QModelIndex> SearchResultTreeModel::addResults(const QList<SearchResultIte
void SearchResultTreeModel::clear()
{
+ beginResetModel();
m_currentParent = NULL;
m_rootItem->clearChildren();
m_editorFontIsUsed = false;
- reset();
+ endResetModel();
}
QModelIndex SearchResultTreeModel::nextIndex(const QModelIndex &idx, bool *wrapped) const
diff --git a/src/plugins/genericprojectmanager/genericprojectmanager.qbs b/src/plugins/genericprojectmanager/genericprojectmanager.qbs
index 9b47c6767b..8a47a547cb 100644
--- a/src/plugins/genericprojectmanager/genericprojectmanager.qbs
+++ b/src/plugins/genericprojectmanager/genericprojectmanager.qbs
@@ -15,39 +15,31 @@ QtcPlugin {
Depends { name: "Locator" }
Depends { name: "QtSupport" }
- Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
-
files: [
+ "filesselectionwizardpage.cpp",
+ "filesselectionwizardpage.h",
+ "genericbuildconfiguration.cpp",
+ "genericbuildconfiguration.h",
+ "genericmakestep.cpp",
+ "genericmakestep.h",
+ "genericmakestep.ui",
+ "genericproject.cpp",
"genericproject.h",
- "genericprojectplugin.h",
- "genericprojectmanager.h",
+ "genericproject.qrc",
"genericprojectconstants.h",
- "genericprojectnodes.h",
- "genericprojectwizard.h",
+ "genericprojectfileseditor.cpp",
"genericprojectfileseditor.h",
- "pkgconfigtool.h",
- "genericmakestep.h",
- "genericbuildconfiguration.h",
- "selectablefilesmodel.h",
- "filesselectionwizardpage.h",
- "genericproject.cpp",
- "genericprojectplugin.cpp",
"genericprojectmanager.cpp",
+ "genericprojectmanager.h",
"genericprojectnodes.cpp",
+ "genericprojectnodes.h",
+ "genericprojectplugin.cpp",
+ "genericprojectplugin.h",
"genericprojectwizard.cpp",
- "genericprojectfileseditor.cpp",
+ "genericprojectwizard.h",
"pkgconfigtool.cpp",
- "genericmakestep.cpp",
- "genericbuildconfiguration.cpp",
+ "pkgconfigtool.h",
"selectablefilesmodel.cpp",
- "filesselectionwizardpage.cpp",
- "genericmakestep.ui",
- "genericproject.qrc",
+ "selectablefilesmodel.h",
]
}
-
diff --git a/src/plugins/git/gerrit/gerritoptionspage.h b/src/plugins/git/gerrit/gerritoptionspage.h
index e27729c0c4..a4111ae83f 100644
--- a/src/plugins/git/gerrit/gerritoptionspage.h
+++ b/src/plugins/git/gerrit/gerritoptionspage.h
@@ -34,7 +34,7 @@
#include <QWidget>
#include <QSharedPointer>
-#include <QWeakPointer>
+#include <QPointer>
QT_BEGIN_NAMESPACE
class QLineEdit;
@@ -84,7 +84,7 @@ public:
private:
const QSharedPointer<GerritParameters> &m_parameters;
- QWeakPointer<GerritOptionsWidget> m_widget;
+ QPointer<GerritOptionsWidget> m_widget;
};
} // namespace Internal
diff --git a/src/plugins/git/gerrit/gerritparameters.cpp b/src/plugins/git/gerrit/gerritparameters.cpp
index 007c14cb51..7a3c6c1801 100644
--- a/src/plugins/git/gerrit/gerritparameters.cpp
+++ b/src/plugins/git/gerrit/gerritparameters.cpp
@@ -35,6 +35,7 @@
#else
# include <utils/environment.h>
#endif
+#include <utils/hostosinfo.h>
#include <utils/pathchooser.h>
#include <QDebug>
#include <QFileInfo>
@@ -71,16 +72,16 @@ static inline QString detectSsh()
#endif
if (!ssh.isEmpty())
return ssh;
-#ifdef Q_OS_WIN // Windows: Use ssh.exe from git if it cannot be found.
- const QString git = GerritPlugin::gitBinary();
- if (!git.isEmpty()) {
- // Is 'git\cmd' in the path (folder containing .bats)?
- QString path = QFileInfo(git).absolutePath();
- if (path.endsWith(QLatin1String("cmd"), Qt::CaseInsensitive))
- path.replace(path.size() - 3, 3, QLatin1String("bin"));
- ssh = path + QLatin1Char('/') + QLatin1String(defaultSshC);
+ if (Utils::HostOsInfo::isWindowsHost()) { // Windows: Use ssh.exe from git if it cannot be found.
+ const QString git = GerritPlugin::gitBinary();
+ if (!git.isEmpty()) {
+ // Is 'git\cmd' in the path (folder containing .bats)?
+ QString path = QFileInfo(git).absolutePath();
+ if (path.endsWith(QLatin1String("cmd"), Qt::CaseInsensitive))
+ path.replace(path.size() - 3, 3, QLatin1String("bin"));
+ ssh = path + QLatin1Char('/') + QLatin1String(defaultSshC);
+ }
}
-#endif
return ssh;
}
diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp
index 815b4886b5..bc35d31c8f 100644
--- a/src/plugins/git/gerrit/gerritplugin.cpp
+++ b/src/plugins/git/gerrit/gerritplugin.cpp
@@ -33,10 +33,10 @@
#include "gerritmodel.h"
#include "gerritoptionspage.h"
-#include <gitplugin.h>
-#include <gitclient.h>
-#include <gitversioncontrol.h>
-#include <gitconstants.h>
+#include "../gitplugin.h"
+#include "../gitclient.h"
+#include "../gitversioncontrol.h"
+#include "../gitconstants.h"
#include <vcsbase/vcsbaseconstants.h>
#include <vcsbase/vcsbaseeditor.h>
diff --git a/src/plugins/git/gerrit/gerritplugin.h b/src/plugins/git/gerrit/gerritplugin.h
index 0ab90870b7..9e096f393e 100644
--- a/src/plugins/git/gerrit/gerritplugin.h
+++ b/src/plugins/git/gerrit/gerritplugin.h
@@ -31,8 +31,8 @@
#define GERRIT_INTERNAL_GERRITPLUGIN_H
#include <QObject>
+#include <QPointer>
#include <QSharedPointer>
-#include <QWeakPointer>
namespace Core {
class ActionContainer;
@@ -70,7 +70,7 @@ private:
void fetch(const QSharedPointer<Gerrit::Internal::GerritChange> &change, int mode);
QSharedPointer<GerritParameters> m_parameters;
- QWeakPointer<GerritDialog> m_dialog;
+ QPointer<GerritDialog> m_dialog;
};
} // namespace Internal
diff --git a/src/plugins/git/git.qbs b/src/plugins/git/git.qbs
index 64ce4ff905..e11a830c96 100644
--- a/src/plugins/git/git.qbs
+++ b/src/plugins/git/git.qbs
@@ -14,28 +14,16 @@ QtcPlugin {
Depends { name: "cpp" }
cpp.defines: base.concat(["QT_NO_CAST_FROM_ASCII"])
- cpp.includePaths: [
- ".",
- "gitorious",
- "gerrit",
- "..",
- "../../libs",
- buildDirectory
- ]
files: [
- "branchadddialog.ui",
- "branchdialog.ui",
- "git.qrc",
- "gitsubmitpanel.ui",
- "remoteadditiondialog.ui",
- "stashdialog.ui",
"annotationhighlighter.cpp",
"annotationhighlighter.h",
"branchadddialog.cpp",
"branchadddialog.h",
+ "branchadddialog.ui",
"branchdialog.cpp",
"branchdialog.h",
+ "branchdialog.ui",
"branchmodel.cpp",
"branchmodel.h",
"changeselectiondialog.cpp",
@@ -47,6 +35,7 @@ QtcPlugin {
"clonewizardpage.h",
"commitdata.cpp",
"commitdata.h",
+ "git.qrc",
"gitclient.cpp",
"gitclient.h",
"gitconstants.h",
@@ -60,10 +49,12 @@ QtcPlugin {
"gitsubmiteditor.h",
"gitsubmiteditorwidget.cpp",
"gitsubmiteditorwidget.h",
+ "gitsubmitpanel.ui",
"gitutils.cpp",
"gitutils.h",
"gitversioncontrol.cpp",
"gitversioncontrol.h",
+ "remoteadditiondialog.ui",
"remotedialog.cpp",
"remotedialog.h",
"remotedialog.ui",
@@ -75,29 +66,30 @@ QtcPlugin {
"settingspage.h",
"settingspage.ui",
"stashdialog.cpp",
- "stashdialog.h"
+ "stashdialog.h",
+ "stashdialog.ui",
]
Group {
prefix: "gitorious/"
files: [
- "gitorioushostwidget.ui",
- "gitoriousprojectwidget.ui",
- "gitoriousrepositorywizardpage.ui",
"gitorious.cpp",
"gitorious.h",
"gitoriousclonewizard.cpp",
"gitoriousclonewizard.h",
"gitorioushostwidget.cpp",
"gitorioushostwidget.h",
+ "gitorioushostwidget.ui",
"gitorioushostwizardpage.cpp",
"gitorioushostwizardpage.h",
"gitoriousprojectwidget.cpp",
"gitoriousprojectwidget.h",
+ "gitoriousprojectwidget.ui",
"gitoriousprojectwizardpage.cpp",
"gitoriousprojectwizardpage.h",
"gitoriousrepositorywizardpage.cpp",
- "gitoriousrepositorywizardpage.h"
+ "gitoriousrepositorywizardpage.h",
+ "gitoriousrepositorywizardpage.ui",
]
}
@@ -113,8 +105,7 @@ QtcPlugin {
"gerritparameters.cpp",
"gerritparameters.h",
"gerritplugin.cpp",
- "gerritplugin.h"
+ "gerritplugin.h",
]
}
}
-
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index bb27590aaf..9e02529b6a 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -51,6 +51,7 @@
#include <coreplugin/variablemanager.h>
#include <texteditor/itexteditor.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/synchronousprocess.h>
@@ -1439,18 +1440,17 @@ VcsBase::Command *GitClient::executeGit(const QString &workingDirectory,
QProcessEnvironment GitClient::processEnvironment() const
{
-
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
QString gitPath = settings()->stringValue(GitSettings::pathKey);
if (!gitPath.isEmpty()) {
- gitPath += Utils::SynchronousProcess::pathSeparator();
+ gitPath += Utils::HostOsInfo::pathListSeparator();
gitPath += environment.value(QLatin1String("PATH"));
environment.insert(QLatin1String("PATH"), gitPath);
}
-#ifdef Q_OS_WIN
- if (settings()->boolValue(GitSettings::winSetHomeEnvironmentKey))
+ if (Utils::HostOsInfo::isWindowsHost()
+ && settings()->boolValue(GitSettings::winSetHomeEnvironmentKey)) {
environment.insert(QLatin1String("HOME"), QDir::toNativeSeparators(QDir::homePath()));
-#endif // Q_OS_WIN
+ }
// Set up SSH and C locale (required by git using perl).
VcsBase::VcsBasePlugin::setProcessEnvironment(&environment, false);
return environment;
@@ -1657,15 +1657,16 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
const QString &gitBinDirectory,
bool silent)
{
-#ifdef Q_OS_WIN
- // Launch 'wish' shell from git binary directory with the gitk located there
- const QString binary = gitBinDirectory + QLatin1String("/wish");
- QStringList arguments(gitBinDirectory + QLatin1String("/gitk"));
-#else
- // Simple: Run gitk from binary path
- const QString binary = gitBinDirectory + QLatin1String("/gitk");
+ QString binary;
QStringList arguments;
-#endif
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ // Launch 'wish' shell from git binary directory with the gitk located there
+ binary = gitBinDirectory + QLatin1String("/wish");
+ arguments << (gitBinDirectory + QLatin1String("/gitk"));
+ } else {
+ // Simple: Run gitk from binary path
+ binary = gitBinDirectory + QLatin1String("/gitk");
+ }
VcsBase::VcsBaseOutputWindow *outwin = VcsBase::VcsBaseOutputWindow::instance();
const QString gitkOpts = settings()->stringValue(GitSettings::gitkOptionsKey);
if (!gitkOpts.isEmpty())
diff --git a/src/plugins/git/gitorious/gitoriousclonewizard.cpp b/src/plugins/git/gitorious/gitoriousclonewizard.cpp
index 6552e1e17c..eeefb55ce2 100644
--- a/src/plugins/git/gitorious/gitoriousclonewizard.cpp
+++ b/src/plugins/git/gitorious/gitoriousclonewizard.cpp
@@ -31,9 +31,9 @@
#include "gitorioushostwizardpage.h"
#include "gitoriousprojectwizardpage.h"
#include "gitoriousrepositorywizardpage.h"
-#include "clonewizardpage.h"
-#include <git/gitplugin.h>
+#include "../clonewizardpage.h"
+#include "../gitplugin.h"
#include <coreplugin/iversioncontrol.h>
#include <vcsbase/checkoutjobs.h>
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index 2d1f0ded42..009b935955 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -39,12 +39,12 @@
#include "branchdialog.h"
#include "remotedialog.h"
#include "clonewizard.h"
-#include "gitoriousclonewizard.h"
+#include "gitorious/gitoriousclonewizard.h"
#include "stashdialog.h"
#include "settingspage.h"
#include "resetdialog.h"
-#include <gerritplugin.h>
+#include "gerrit/gerritplugin.h"
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
@@ -810,8 +810,8 @@ static inline GitClientMemberFunc memberFunctionFromAction(const QObject *o)
if (o) {
if (const QAction *action = qobject_cast<const QAction *>(o)) {
const QVariant v = action->data();
- if (qVariantCanConvert<GitClientMemberFunc>(v))
- return qVariantValue<GitClientMemberFunc>(v);
+ if (v.canConvert<GitClientMemberFunc>())
+ return qvariant_cast<GitClientMemberFunc>(v);
}
}
return 0;
diff --git a/src/plugins/git/gitsettings.cpp b/src/plugins/git/gitsettings.cpp
index 22a34c8a57..374989a634 100644
--- a/src/plugins/git/gitsettings.cpp
+++ b/src/plugins/git/gitsettings.cpp
@@ -29,6 +29,7 @@
#include "gitsettings.h"
+#include <utils/hostosinfo.h>
#include <QCoreApplication>
namespace Git {
@@ -50,11 +51,7 @@ GitSettings::GitSettings()
setSettingsGroup(QLatin1String("Git"));
declareKey(binaryPathKey, QLatin1String("git"));
-#ifdef Q_OS_WIN
- declareKey(timeoutKey, 60);
-#else
- declareKey(timeoutKey, 30);
-#endif
+ declareKey(timeoutKey, Utils::HostOsInfo::isWindowsHost() ? 60 : 30);
declareKey(pullRebaseKey, false);
declareKey(omitAnnotationDateKey, false);
declareKey(ignoreSpaceChangesInDiffKey, true);
diff --git a/src/plugins/git/gitutils.cpp b/src/plugins/git/gitutils.cpp
index 792de00fc9..7731904afd 100644
--- a/src/plugins/git/gitutils.cpp
+++ b/src/plugins/git/gitutils.cpp
@@ -87,7 +87,7 @@ bool inputText(QWidget *parent, const QString &title, const QString &prompt, QSt
dialog.setLabelText(prompt);
dialog.setTextValue(*s);
// Nasty hack:
- if (QLineEdit *le = qFindChild<QLineEdit*>(&dialog))
+ if (QLineEdit *le = dialog.findChild<QLineEdit*>())
le->setMinimumWidth(500);
if (dialog.exec() != QDialog::Accepted)
return false;
diff --git a/src/plugins/git/remotemodel.cpp b/src/plugins/git/remotemodel.cpp
index a260ac76ac..c2fd62094d 100644
--- a/src/plugins/git/remotemodel.cpp
+++ b/src/plugins/git/remotemodel.cpp
@@ -185,8 +185,9 @@ void RemoteModel::clear()
{
if (m_remotes.isEmpty())
return;
+ beginResetModel();
m_remotes.clear();
- reset();
+ endResetModel();
}
bool RemoteModel::refresh(const QString &workingDirectory, QString *errorMessage)
@@ -199,6 +200,7 @@ bool RemoteModel::refresh(const QString &workingDirectory, QString *errorMessage
return false;
// Parse output
m_workingDirectory = workingDirectory;
+ beginResetModel();
m_remotes.clear();
const QStringList lines = output.split(QLatin1Char('\n'));
for (int r = 0; r < lines.count(); ++r) {
@@ -206,7 +208,7 @@ bool RemoteModel::refresh(const QString &workingDirectory, QString *errorMessage
if (newRemote.parse(lines.at(r)))
m_remotes.push_back(newRemote);
}
- reset();
+ endResetModel();
return true;
}
diff --git a/src/plugins/git/settingspage.cpp b/src/plugins/git/settingspage.cpp
index 4835db76af..cc1fca2943 100644
--- a/src/plugins/git/settingspage.cpp
+++ b/src/plugins/git/settingspage.cpp
@@ -33,6 +33,7 @@
#include "gitclient.h"
#include <vcsbase/vcsbaseconstants.h>
+#include <utils/hostosinfo.h>
#include <utils/pathchooser.h>
#include <QCoreApplication>
@@ -50,19 +51,19 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
QWidget(parent)
{
m_ui.setupUi(this);
-#ifdef Q_OS_WIN
- const QByteArray currentHome = qgetenv("HOME");
- const QString toolTip
- = tr("Set the environment variable HOME to '%1'\n(%2).\n"
- "This causes msysgit to look for the SSH-keys in that location\n"
- "instead of its installation directory when run outside git bash.").
- arg(QDir::homePath(),
- currentHome.isEmpty() ? tr("not currently set") :
- tr("currently set to '%1'").arg(QString::fromLocal8Bit(currentHome)));
- m_ui.winHomeCheckBox->setToolTip(toolTip);
-#else
- m_ui.winHomeCheckBox->setVisible(false);
-#endif
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ const QByteArray currentHome = qgetenv("HOME");
+ const QString toolTip
+ = tr("Set the environment variable HOME to '%1'\n(%2).\n"
+ "This causes msysgit to look for the SSH-keys in that location\n"
+ "instead of its installation directory when run outside git bash.").
+ arg(QDir::homePath(),
+ currentHome.isEmpty() ? tr("not currently set") :
+ tr("currently set to '%1'").arg(QString::fromLocal8Bit(currentHome)));
+ m_ui.winHomeCheckBox->setToolTip(toolTip);
+ } else {
+ m_ui.winHomeCheckBox->setVisible(false);
+ }
m_ui.repBrowserCommandPathChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_ui.repBrowserCommandPathChooser->setPromptDialogTitle(tr("Git Repository Browser Command"));
}
diff --git a/src/plugins/glsleditor/glsleditor.qbs b/src/plugins/glsleditor/glsleditor.qbs
index 3df8879e6f..6627277314 100644
--- a/src/plugins/glsleditor/glsleditor.qbs
+++ b/src/plugins/glsleditor/glsleditor.qbs
@@ -13,43 +13,34 @@ QtcPlugin {
Depends { name: "GLSL" }
Depends { name: "CPlusPlus" }
- Depends { name: "cpp" }
- cpp.includePaths: [
- "../..",
- "..",
- "../../libs",
- buildDirectory
- ]
-
files: [
+ "GLSLEditor.mimetypes.xml",
+ "glslautocompleter.cpp",
+ "glslautocompleter.h",
+ "glslcompletionassist.cpp",
+ "glslcompletionassist.h",
+ "glsleditor.cpp",
"glsleditor.h",
+ "glsleditor.qrc",
"glsleditor_global.h",
+ "glsleditoractionhandler.cpp",
"glsleditoractionhandler.h",
"glsleditorconstants.h",
+ "glsleditoreditable.cpp",
"glsleditoreditable.h",
+ "glsleditorfactory.cpp",
"glsleditorfactory.h",
+ "glsleditorplugin.cpp",
"glsleditorplugin.h",
+ "glslfilewizard.cpp",
"glslfilewizard.h",
+ "glslhighlighter.cpp",
"glslhighlighter.h",
- "glslautocompleter.h",
- "glslindenter.h",
+ "glslhoverhandler.cpp",
"glslhoverhandler.h",
- "glslcompletionassist.h",
- "reuse.h",
- "glsleditor.cpp",
- "glsleditoractionhandler.cpp",
- "glsleditoreditable.cpp",
- "glsleditorfactory.cpp",
- "glsleditorplugin.cpp",
- "glslfilewizard.cpp",
- "glslhighlighter.cpp",
- "glslautocompleter.cpp",
"glslindenter.cpp",
- "glslhoverhandler.cpp",
- "glslcompletionassist.cpp",
+ "glslindenter.h",
"reuse.cpp",
- "glsleditor.qrc",
- "GLSLEditor.mimetypes.xml"
+ "reuse.h",
]
}
-
diff --git a/src/plugins/helloworld/helloworld.qbs b/src/plugins/helloworld/helloworld.qbs
index d71e157d85..e5546e282a 100644
--- a/src/plugins/helloworld/helloworld.qbs
+++ b/src/plugins/helloworld/helloworld.qbs
@@ -6,20 +6,13 @@ QtcPlugin {
name: "HelloWorld"
Depends { name: "Core" }
- Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["widgets", "xml", "network", "script"] }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
-
files: [
+ "helloworldplugin.cpp",
"helloworldplugin.h",
+ "helloworldwindow.cpp",
"helloworldwindow.h",
- "helloworldplugin.cpp",
- "helloworldwindow.cpp"
]
}
diff --git a/src/plugins/help/externalhelpwindow.cpp b/src/plugins/help/externalhelpwindow.cpp
index c5781199cc..ca24542b2e 100644
--- a/src/plugins/help/externalhelpwindow.cpp
+++ b/src/plugins/help/externalhelpwindow.cpp
@@ -35,6 +35,7 @@
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
+#include <utils/hostosinfo.h>
#include <QAction>
#include <QHBoxLayout>
@@ -142,17 +143,17 @@ ExternalHelpWindow::ExternalHelpWindow(QWidget *parent)
tr("Show Sidebar"), this);
connect(action, SIGNAL(triggered()), this, SIGNAL(showHideSidebar()));
-#ifdef Q_OS_MAC
- reset->setShortcut(QKeySequence(Qt::ALT + Qt::Key_0));
- action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0));
- ctrlTab->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Tab));
- ctrlShiftTab->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + Qt::Key_Tab));
-#else
- reset->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0));
- action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_0));
- ctrlTab->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Tab));
- ctrlShiftTab->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab));
-#endif
+ if (Utils::HostOsInfo::isMacHost()) {
+ reset->setShortcut(QKeySequence(Qt::ALT + Qt::Key_0));
+ action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0));
+ ctrlTab->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Tab));
+ ctrlShiftTab->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + Qt::Key_Tab));
+ } else {
+ reset->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0));
+ action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_0));
+ ctrlTab->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Tab));
+ ctrlShiftTab->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab));
+ }
QToolButton *button = new QToolButton;
button->setDefaultAction(action);
diff --git a/src/plugins/help/generalsettingspage.cpp b/src/plugins/help/generalsettingspage.cpp
index cb0e4b09ee..fc2399fac8 100644
--- a/src/plugins/help/generalsettingspage.cpp
+++ b/src/plugins/help/generalsettingspage.cpp
@@ -79,7 +79,7 @@ QWidget *GeneralSettingsPage::createPage(QWidget *parent)
m_ui->styleComboBox->setEditable(false);
Core::HelpManager *manager = Core::HelpManager::instance();
- m_font = qVariantValue<QFont>(manager->customValue(QLatin1String("font"),
+ m_font = qvariant_cast<QFont>(manager->customValue(QLatin1String("font"),
m_font));
updateFontSize();
diff --git a/src/plugins/help/help.qbs b/src/plugins/help/help.qbs
index 97eaefe9ec..53dd30c2cd 100644
--- a/src/plugins/help/help.qbs
+++ b/src/plugins/help/help.qbs
@@ -18,85 +18,75 @@ QtcPlugin {
Depends { name: "Core" }
Depends { name: "Find" }
Depends { name: "Locator" }
+ Depends { name: "app_version_header" }
Depends { name: "cpp" }
Properties {
condition: qtcore.versionMajor >= 5
cpp.defines: base.concat(["QT_NO_WEBKIT"])
}
- cpp.defines: base.concat([
- "QT_CLUCENE_SUPPORT",
- "HELP_LIBRARY"
- ])
- cpp.includePaths: [
- "../../shared/help",
- ".",
- "..",
- "../..",
- "../../libs",
- buildDirectory
- ]
+ cpp.defines: base.concat(["QT_CLUCENE_SUPPORT"])
+ cpp.includePaths: base.concat("../../shared/help")
files: [
+ "centralwidget.cpp",
"centralwidget.h",
+ "docsettingspage.cpp",
"docsettingspage.h",
+ "docsettingspage.ui",
+ "externalhelpwindow.cpp",
+ "externalhelpwindow.h",
+ "filtersettingspage.cpp",
"filtersettingspage.h",
+ "filtersettingspage.ui",
+ "generalsettingspage.cpp",
"generalsettingspage.h",
+ "generalsettingspage.ui",
+ "help.qrc",
"help_global.h",
"helpconstants.h",
+ "helpfindsupport.cpp",
"helpfindsupport.h",
+ "helpindexfilter.cpp",
"helpindexfilter.h",
- "localhelpmanager.h",
+ "helpmode.cpp",
"helpmode.h",
+ "helpplugin.cpp",
"helpplugin.h",
+ "helpviewer.cpp",
"helpviewer.h",
"helpviewer_p.h",
- "openpagesmanager.h",
- "openpagesmodel.h",
- "openpagesswitcher.h",
- "openpageswidget.h",
- "remotehelpfilter.h",
- "searchwidget.h",
- "xbelsupport.h",
- "externalhelpwindow.h",
- "centralwidget.cpp",
- "docsettingspage.cpp",
- "filtersettingspage.cpp",
- "generalsettingspage.cpp",
- "helpfindsupport.cpp",
- "helpindexfilter.cpp",
- "localhelpmanager.cpp",
- "helpmode.cpp",
- "helpplugin.cpp",
- "helpviewer.cpp",
"helpviewer_qtb.cpp",
"helpviewer_qwv.cpp",
+ "localhelpmanager.cpp",
+ "localhelpmanager.h",
"openpagesmanager.cpp",
+ "openpagesmanager.h",
"openpagesmodel.cpp",
+ "openpagesmodel.h",
"openpagesswitcher.cpp",
+ "openpagesswitcher.h",
"openpageswidget.cpp",
+ "openpageswidget.h",
"remotehelpfilter.cpp",
+ "remotehelpfilter.h",
+ "remotehelpfilter.ui",
"searchwidget.cpp",
+ "searchwidget.h",
"xbelsupport.cpp",
- "externalhelpwindow.cpp",
- "docsettingspage.ui",
- "filtersettingspage.ui",
- "generalsettingspage.ui",
- "remotehelpfilter.ui",
- "help.qrc",
- "../../shared/help/bookmarkmanager.h",
- "../../shared/help/contentwindow.h",
- "../../shared/help/filternamedialog.h",
- "../../shared/help/indexwindow.h",
- "../../shared/help/topicchooser.h",
+ "xbelsupport.h",
+ "../../shared/help/bookmarkdialog.ui",
"../../shared/help/bookmarkmanager.cpp",
+ "../../shared/help/bookmarkmanager.h",
"../../shared/help/contentwindow.cpp",
+ "../../shared/help/contentwindow.h",
"../../shared/help/filternamedialog.cpp",
+ "../../shared/help/filternamedialog.h",
+ "../../shared/help/filternamedialog.ui",
"../../shared/help/indexwindow.cpp",
+ "../../shared/help/indexwindow.h",
"../../shared/help/topicchooser.cpp",
- "../../shared/help/bookmarkdialog.ui",
- "../../shared/help/filternamedialog.ui",
- "../../shared/help/topicchooser.ui"
+ "../../shared/help/topicchooser.h",
+ "../../shared/help/topicchooser.ui",
]
}
-
diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp
index 5f7edb0f79..3eeaf50cbc 100644
--- a/src/plugins/help/helpplugin.cpp
+++ b/src/plugins/help/helpplugin.cpp
@@ -66,6 +66,7 @@
#include <extensionsystem/pluginmanager.h>
#include <find/findplugin.h>
#include <texteditor/texteditorconstants.h>
+#include <utils/hostosinfo.h>
#include <utils/styledbar.h>
#include <QDir>
@@ -252,12 +253,12 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F1));
connect(action, SIGNAL(triggered()), this, SLOT(activateContext()));
-#ifndef Q_OS_MAC
- action = new QAction(this);
- action->setSeparator(true);
- cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Separator"), globalcontext);
- Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
-#endif
+ if (!Utils::HostOsInfo::isMacHost()) {
+ action = new QAction(this);
+ action->setSeparator(true);
+ cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Separator"), globalcontext);
+ Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
+ }
action = new QAction(tr("Technical Support"), this);
cmd = Core::ActionManager::registerAction(action, Core::Id("Help.TechSupport"), globalcontext);
@@ -269,12 +270,12 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
connect(action, SIGNAL(triggered()), this, SLOT(slotReportBug()));
-#ifndef Q_OS_MAC
- action = new QAction(this);
- action->setSeparator(true);
- cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Separator2"), globalcontext);
- Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
-#endif
+ if (!Utils::HostOsInfo::isMacHost()) {
+ action = new QAction(this);
+ action->setSeparator(true);
+ cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Separator2"), globalcontext);
+ Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
+ }
action = new QAction(this);
Core::ActionManager::registerAction(action, Core::Constants::PRINT, modecontext);
@@ -772,7 +773,7 @@ void HelpPlugin::fontChanged()
createRightPaneContextViewer();
const QHelpEngine &engine = LocalHelpManager::helpEngine();
- QFont font = qVariantValue<QFont>(engine.customValue(QLatin1String("font"),
+ QFont font = qvariant_cast<QFont>(engine.customValue(QLatin1String("font"),
m_helpViewerForSideBar->viewerFont()));
m_helpViewerForSideBar->setFont(font);
diff --git a/src/plugins/help/helpviewer_qtb.cpp b/src/plugins/help/helpviewer_qtb.cpp
index 59cee629c8..65b56e1967 100644
--- a/src/plugins/help/helpviewer_qtb.cpp
+++ b/src/plugins/help/helpviewer_qtb.cpp
@@ -35,6 +35,8 @@
#include "helpviewer_p.h"
#include "localhelpmanager.h"
+#include <utils/hostosinfo.h>
+
#include <QApplication>
#include <QClipboard>
#include <QContextMenuEvent>
@@ -79,7 +81,7 @@ HelpViewer::~HelpViewer()
QFont HelpViewer::viewerFont() const
{
const QHelpEngineCore &engine = LocalHelpManager::helpEngine();
- return qVariantValue<QFont>(engine.customValue(QLatin1String("font"),
+ return qvariant_cast<QFont>(engine.customValue(QLatin1String("font"),
qApp->font()));
}
@@ -285,19 +287,15 @@ void HelpViewer::wheelEvent(QWheelEvent *e)
void HelpViewer::mousePressEvent(QMouseEvent *e)
{
-#ifdef Q_OS_LINUX
- if (handleForwardBackwardMouseButtons(e))
+ if (Utils::HostOsInfo::isLinuxHost() && handleForwardBackwardMouseButtons(e))
return;
-#endif
QTextBrowser::mousePressEvent(e);
}
void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
{
-#ifndef Q_OS_LINUX
- if (handleForwardBackwardMouseButtons(e))
+ if (!Utils::HostOsInfo::isLinuxHost() && handleForwardBackwardMouseButtons(e))
return;
-#endif
bool controlPressed = e->modifiers() & Qt::ControlModifier;
if ((controlPressed && d->hasAnchorAt(this, e->pos())) ||
diff --git a/src/plugins/help/helpviewer_qwv.cpp b/src/plugins/help/helpviewer_qwv.cpp
index 8e6717ae52..d743498f1a 100644
--- a/src/plugins/help/helpviewer_qwv.cpp
+++ b/src/plugins/help/helpviewer_qwv.cpp
@@ -36,6 +36,8 @@
#include "localhelpmanager.h"
#include "openpagesmanager.h"
+#include <utils/hostosinfo.h>
+
#include <QDebug>
#include <QFileInfo>
#include <QString>
@@ -54,6 +56,8 @@
#include <utils/networkaccessmanager.h>
+#include <cstring>
+
using namespace Find;
using namespace Help;
using namespace Help::Internal;
@@ -144,7 +148,7 @@ qint64 HelpNetworkReply::readData(char *buffer, qint64 maxlen)
{
qint64 len = qMin(qint64(data.length()), maxlen);
if (len) {
- qMemCopy(buffer, data.constData(), len);
+ std::memcpy(buffer, data.constData(), len);
data.remove(0, len);
}
return len;
@@ -361,7 +365,7 @@ QFont HelpViewer::viewerFont() const
QFont font(QApplication::font().family(),
webSettings->fontSize(QWebSettings::DefaultFontSize));
const QHelpEngineCore &engine = LocalHelpManager::helpEngine();
- return qVariantValue<QFont>(engine.customValue(QLatin1String("font"),
+ return qvariant_cast<QFont>(engine.customValue(QLatin1String("font"),
font));
}
@@ -499,10 +503,8 @@ void HelpViewer::wheelEvent(QWheelEvent *event)
void HelpViewer::mousePressEvent(QMouseEvent *event)
{
-#ifdef Q_OS_LINUX
- if (handleForwardBackwardMouseButtons(event))
+ if (Utils::HostOsInfo::isLinuxHost() && handleForwardBackwardMouseButtons(event))
return;
-#endif
if (HelpPage *currentPage = static_cast<HelpPage*> (page())) {
currentPage->m_pressedButtons = event->buttons();
@@ -514,10 +516,8 @@ void HelpViewer::mousePressEvent(QMouseEvent *event)
void HelpViewer::mouseReleaseEvent(QMouseEvent *event)
{
-#ifndef Q_OS_LINUX
- if (handleForwardBackwardMouseButtons(event))
+ if (!Utils::HostOsInfo::isLinuxHost() && handleForwardBackwardMouseButtons(event))
return;
-#endif
QWebView::mouseReleaseEvent(event);
}
diff --git a/src/plugins/help/openpagesswitcher.cpp b/src/plugins/help/openpagesswitcher.cpp
index f5c81b307d..21969b76e0 100644
--- a/src/plugins/help/openpagesswitcher.cpp
+++ b/src/plugins/help/openpagesswitcher.cpp
@@ -33,6 +33,8 @@
#include "openpagesmodel.h"
#include "openpageswidget.h"
+#include <utils/hostosinfo.h>
+
#include <QEvent>
#include <QKeyEvent>
@@ -53,9 +55,8 @@ OpenPagesSwitcher::OpenPagesSwitcher(OpenPagesModel *model)
// We disable the frame on this list view and use a QFrame around it instead.
// This improves the look with QGTKStyle.
-#ifndef Q_OS_MAC
- setFrameStyle(m_openPagesWidget->frameStyle());
-#endif
+ if (!Utils::HostOsInfo::isMacHost())
+ setFrameStyle(m_openPagesWidget->frameStyle());
m_openPagesWidget->setFrameStyle(QFrame::NoFrame);
m_openPagesWidget->allowContextMenu(false);
@@ -124,11 +125,8 @@ bool OpenPagesSwitcher::eventFilter(QObject *object, QEvent *event)
emit setCurrentPage(m_openPagesWidget->currentIndex());
return true;
}
-#ifdef Q_OS_MAC
- const Qt::KeyboardModifier modifier = Qt::AltModifier;
-#else
- const Qt::KeyboardModifier modifier = Qt::ControlModifier;
-#endif
+ const Qt::KeyboardModifiers modifier = Utils::HostOsInfo::isMacHost()
+ ? Qt::AltModifier : Qt::ControlModifier;
if (key == Qt::Key_Backtab
&& (ke->modifiers() == (modifier | Qt::ShiftModifier)))
gotoNextPage();
diff --git a/src/plugins/help/remotehelpfilter.cpp b/src/plugins/help/remotehelpfilter.cpp
index e1ccdad2bc..464c59791b 100644
--- a/src/plugins/help/remotehelpfilter.cpp
+++ b/src/plugins/help/remotehelpfilter.cpp
@@ -49,6 +49,8 @@ RemoteFilterOptions::RemoteFilterOptions(RemoteHelpFilter *filter, QWidget *pare
connect(m_ui.add, SIGNAL(clicked()), this, SLOT(addNewItem()));
connect(m_ui.remove, SIGNAL(clicked()), this, SLOT(removeItem()));
+ connect(m_ui.listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), SLOT(updateRemoveButton()));
+ updateRemoveButton();
}
void RemoteFilterOptions::addNewItem()
@@ -57,6 +59,7 @@ void RemoteFilterOptions::addNewItem()
m_ui.listWidget->addItem(item);
item->setSelected(true);
item->setFlags(item->flags() | Qt::ItemIsEditable);
+ m_ui.listWidget->setCurrentItem(item);
m_ui.listWidget->editItem(item);
}
@@ -68,6 +71,11 @@ void RemoteFilterOptions::removeItem()
}
}
+void RemoteFilterOptions::updateRemoveButton()
+{
+ m_ui.remove->setEnabled(m_ui.listWidget->currentItem());
+}
+
// -- RemoteHelpFilter
RemoteHelpFilter::RemoteHelpFilter()
diff --git a/src/plugins/help/remotehelpfilter.h b/src/plugins/help/remotehelpfilter.h
index 7c05cff3af..c76e4f12cb 100644
--- a/src/plugins/help/remotehelpfilter.h
+++ b/src/plugins/help/remotehelpfilter.h
@@ -78,6 +78,7 @@ public:
private slots:
void addNewItem();
void removeItem();
+ void updateRemoveButton();
private:
RemoteHelpFilter *m_filter;
diff --git a/src/plugins/help/searchwidget.cpp b/src/plugins/help/searchwidget.cpp
index e40bbd0ea4..2bc80ba80a 100644
--- a/src/plugins/help/searchwidget.cpp
+++ b/src/plugins/help/searchwidget.cpp
@@ -67,7 +67,7 @@ SearchWidget::~SearchWidget()
void SearchWidget::zoomIn()
{
- QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
+ QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
if (browser && zoomCount != 10) {
zoomCount++;
browser->zoomIn();
@@ -76,7 +76,7 @@ void SearchWidget::zoomIn()
void SearchWidget::zoomOut()
{
- QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
+ QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
if (browser && zoomCount != -5) {
zoomCount--;
browser->zoomOut();
@@ -88,7 +88,7 @@ void SearchWidget::resetZoom()
if (zoomCount == 0)
return;
- QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
+ QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
if (browser) {
browser->zoomOut(zoomCount);
zoomCount = 0;
@@ -135,7 +135,7 @@ void SearchWidget::showEvent(QShowEvent *event)
connect(searchEngine, SIGNAL(searchingFinished(int)), this,
SLOT(searchingFinished(int)));
- QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
+ QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
browser->viewport()->installEventFilter(this);
connect(searchEngine, SIGNAL(indexingStarted()), this,
@@ -214,7 +214,7 @@ void SearchWidget::indexingFinished()
bool SearchWidget::eventFilter(QObject *o, QEvent *e)
{
- QTextBrowser *browser = qFindChild<QTextBrowser *>(resultWidget);
+ QTextBrowser *browser = resultWidget->findChild<QTextBrowser *>();
if (browser && o == browser->viewport()
&& e->type() == QEvent::MouseButtonRelease){
QMouseEvent *me = static_cast<QMouseEvent *>(e);
@@ -232,7 +232,7 @@ bool SearchWidget::eventFilter(QObject *o, QEvent *e)
void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent)
{
- QTextBrowser *browser = qFindChild<QTextBrowser *>(resultWidget);
+ QTextBrowser *browser = resultWidget->findChild<QTextBrowser *>();
if (!browser)
return;
diff --git a/src/plugins/imageviewer/imageviewer.qbs b/src/plugins/imageviewer/imageviewer.qbs
index d2257621cc..79e5528baa 100644
--- a/src/plugins/imageviewer/imageviewer.qbs
+++ b/src/plugins/imageviewer/imageviewer.qbs
@@ -8,31 +8,22 @@ QtcPlugin {
Depends { name: "Qt"; submodules: ["widgets", "svg"] }
Depends { name: "Core" }
- Depends { name: "cpp" }
- cpp.includePaths: [
- ".",
- "..",
- "../../libs",
- buildDirectory
- ]
-
files: [
- "imageviewerplugin.h",
- "imageviewerfactory.h",
- "imageviewerfile.h",
- "imageviewer.h",
+ "ImageViewer.mimetypes.xml",
+ "imageview.cpp",
"imageview.h",
- "imageviewerconstants.h",
+ "imageviewer.cpp",
+ "imageviewer.h",
+ "imageviewer.qrc",
+ "imagevieweractionhandler.cpp",
"imagevieweractionhandler.h",
- "imageviewerplugin.cpp",
+ "imageviewerconstants.h",
"imageviewerfactory.cpp",
+ "imageviewerfactory.h",
"imageviewerfile.cpp",
- "imageviewer.cpp",
- "imageview.cpp",
- "imagevieweractionhandler.cpp",
+ "imageviewerfile.h",
+ "imageviewerplugin.cpp",
+ "imageviewerplugin.h",
"imageviewertoolbar.ui",
- "imageviewer.qrc",
- "ImageViewer.mimetypes.xml"
]
}
-
diff --git a/src/plugins/locator/basefilefilter.cpp b/src/plugins/locator/basefilefilter.cpp
index 45e5d41b9e..1f3e3dd016 100644
--- a/src/plugins/locator/basefilefilter.cpp
+++ b/src/plugins/locator/basefilefilter.cpp
@@ -30,12 +30,14 @@
#include "basefilefilter.h"
#include <coreplugin/editormanager/editormanager.h>
+#include <utils/fileutils.h>
#include <QDir>
#include <QStringMatcher>
using namespace Core;
using namespace Locator;
+using namespace Utils;
BaseFileFilter::BaseFileFilter()
: m_forceNewSearchList(false)
@@ -80,7 +82,7 @@ QList<FilterEntry> BaseFileFilter::matchesFor(QFutureInterface<Locator::FilterEn
|| (!hasWildcard && matcher.indexIn(name) != -1)) {
QFileInfo fi(path);
FilterEntry entry(this, fi.fileName(), QString(path + lineNoSuffix));
- entry.extraInfo = QDir::toNativeSeparators(fi.path());
+ entry.extraInfo = FileUtils::shortNativePath(FileName(fi));
entry.resolveFileIcon = true;
if (name.startsWith(needle))
matches.append(entry);
diff --git a/src/plugins/locator/locator.qbs b/src/plugins/locator/locator.qbs
index 651fece80a..af809cfd84 100644
--- a/src/plugins/locator/locator.qbs
+++ b/src/plugins/locator/locator.qbs
@@ -9,32 +9,29 @@ QtcPlugin {
Depends { name: "Core" }
Depends { name: "cpp" }
- cpp.includePaths: [
- ".",
- "..",
+ cpp.includePaths: base.concat([
"generichighlighter",
"tooltip",
"snippets",
- "codeassist",
- "../../libs",
- buildDirectory
- ]
+ "codeassist"
+ ])
files: [
- "directoryfilter.ui",
- "filesystemfilter.ui",
- "locator.qrc",
- "settingspage.ui",
"basefilefilter.cpp",
"basefilefilter.h",
"commandlocator.cpp",
"commandlocator.h",
"directoryfilter.cpp",
"directoryfilter.h",
+ "directoryfilter.ui",
+ "executefilter.cpp",
"executefilter.h",
"filesystemfilter.cpp",
"filesystemfilter.h",
+ "filesystemfilter.ui",
"ilocatorfilter.cpp",
+ "ilocatorfilter.h",
+ "locator.qrc",
"locator_global.h",
"locatorconstants.h",
"locatorfiltersfilter.cpp",
@@ -43,16 +40,14 @@ QtcPlugin {
"locatormanager.h",
"locatorplugin.cpp",
"locatorplugin.h",
+ "locatorwidget.cpp",
+ "locatorwidget.h",
"opendocumentsfilter.cpp",
"opendocumentsfilter.h",
"settingspage.cpp",
"settingspage.h",
- "executefilter.cpp",
- "ilocatorfilter.h",
- "locatorwidget.cpp",
- "locatorwidget.h",
+ "settingspage.ui",
"images/locator.png",
- "images/reload.png"
+ "images/reload.png",
]
}
-
diff --git a/src/plugins/locator/locatorwidget.cpp b/src/plugins/locator/locatorwidget.cpp
index c1103ac0cc..8d59455f8d 100644
--- a/src/plugins/locator/locatorwidget.cpp
+++ b/src/plugins/locator/locatorwidget.cpp
@@ -44,6 +44,7 @@
#include <coreplugin/coreconstants.h>
#include <coreplugin/fileiconprovider.h>
#include <utils/filterlineedit.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/runextensions.h>
@@ -203,8 +204,9 @@ QVariant LocatorModel::data(const QModelIndex &index, int role) const
void LocatorModel::setEntries(const QList<FilterEntry> &entries)
{
+ beginResetModel();
mEntries = entries;
- reset();
+ endResetModel();
}
// =========== CompletionList ===========
@@ -220,12 +222,12 @@ CompletionList::CompletionList(QWidget *parent)
// This is too slow when done on all results
//header()->setResizeMode(QHeaderView::ResizeToContents);
setWindowFlags(Qt::ToolTip);
-#ifdef Q_OS_MAC
- if (horizontalScrollBar())
- horizontalScrollBar()->setAttribute(Qt::WA_MacMiniSize);
- if (verticalScrollBar())
- verticalScrollBar()->setAttribute(Qt::WA_MacMiniSize);
-#endif
+ if (Utils::HostOsInfo::isMacHost()) {
+ if (horizontalScrollBar())
+ horizontalScrollBar()->setAttribute(Qt::WA_MacMiniSize);
+ if (verticalScrollBar())
+ verticalScrollBar()->setAttribute(Qt::WA_MacMiniSize);
+ }
}
void CompletionList::updatePreferredSize()
@@ -407,11 +409,14 @@ bool LocatorWidget::eventFilter(QObject *obj, QEvent *event)
}
}
} else if (obj == m_fileLineEdit && event->type() == QEvent::FocusOut) {
-#if defined(Q_OS_WIN)
- QFocusEvent *fev = static_cast<QFocusEvent*>(event);
- if (fev->reason() != Qt::ActiveWindowFocusReason ||
- (fev->reason() == Qt::ActiveWindowFocusReason && !m_completionList->isActiveWindow()))
-#endif
+ bool hideList = true;
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ QFocusEvent *fev = static_cast<QFocusEvent*>(event);
+ if (fev->reason() == Qt::ActiveWindowFocusReason &&
+ !(fev->reason() == Qt::ActiveWindowFocusReason && !m_completionList->isActiveWindow()))
+ hideList = false;
+ }
+ if (hideList)
m_completionList->hide();
} else if (obj == m_fileLineEdit && event->type() == QEvent::FocusIn) {
showPopupNow();
diff --git a/src/plugins/locator/opendocumentsfilter.cpp b/src/plugins/locator/opendocumentsfilter.cpp
index 57e90705bc..53b8c9daa4 100644
--- a/src/plugins/locator/opendocumentsfilter.cpp
+++ b/src/plugins/locator/opendocumentsfilter.cpp
@@ -31,6 +31,7 @@
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
+#include <utils/fileutils.h>
#include <QFileInfo>
#include <QDir>
@@ -38,6 +39,7 @@
using namespace Core;
using namespace Locator;
using namespace Locator::Internal;
+using namespace Utils;
OpenDocumentsFilter::OpenDocumentsFilter(EditorManager *editorManager) :
m_editorManager(editorManager)
@@ -71,7 +73,7 @@ QList<FilterEntry> OpenDocumentsFilter::matchesFor(QFutureInterface<Locator::Fil
if (!fileName.isEmpty()) {
QFileInfo fi(fileName);
FilterEntry fiEntry(this, fi.fileName(), QString(fileName + lineNoSuffix));
- fiEntry.extraInfo = QDir::toNativeSeparators(fi.path());
+ fiEntry.extraInfo = FileUtils::shortNativePath(FileName(fi));
fiEntry.resolveFileIcon = true;
value.append(fiEntry);
}
diff --git a/src/plugins/macros/macros.qbs b/src/plugins/macros/macros.qbs
index 1712dc5661..c30877a7cc 100644
--- a/src/plugins/macros/macros.qbs
+++ b/src/plugins/macros/macros.qbs
@@ -10,19 +10,9 @@ QtcPlugin {
Depends { name: "Locator" }
Depends { name: "Find" }
Depends { name: "TextEditor" }
-
- Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- "../..",
- buildDirectory
- ]
+ Depends { name: "app_version_header" }
files: [
- "macrooptionswidget.ui",
- "macros.qrc",
- "savedialog.ui",
"actionmacrohandler.cpp",
"actionmacrohandler.h",
"findmacrohandler.cpp",
@@ -41,6 +31,8 @@ QtcPlugin {
"macrooptionspage.h",
"macrooptionswidget.cpp",
"macrooptionswidget.h",
+ "macrooptionswidget.ui",
+ "macros.qrc",
"macros_global.h",
"macrosconstants.h",
"macrosplugin.cpp",
@@ -49,8 +41,8 @@ QtcPlugin {
"macrotextfind.h",
"savedialog.cpp",
"savedialog.h",
+ "savedialog.ui",
"texteditormacrohandler.cpp",
- "texteditormacrohandler.h"
+ "texteditormacrohandler.h",
]
}
-
diff --git a/src/plugins/madde/Madde.pluginspec.in b/src/plugins/madde/Madde.pluginspec.in
index ff3f26eb74..edd4826395 100644
--- a/src/plugins/madde/Madde.pluginspec.in
+++ b/src/plugins/madde/Madde.pluginspec.in
@@ -15,5 +15,6 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
<url>http://www.qt-project.org</url>
<dependencyList>
<dependency name=\"RemoteLinux\" version=\"$$QTCREATOR_VERSION\"/>
+ <dependency name=\"Qt4ProjectManager\" version=\"$$QTCREATOR_VERSION\"/>
</dependencyList>
</plugin>
diff --git a/src/plugins/madde/debianmanager.cpp b/src/plugins/madde/debianmanager.cpp
index 0ff98b8936..582e801f7c 100644
--- a/src/plugins/madde/debianmanager.cpp
+++ b/src/plugins/madde/debianmanager.cpp
@@ -537,7 +537,7 @@ bool DebianManager::setPackageManagerIcon(const Utils::FileName &debianDir, Core
QBuffer buffer(&iconAsBase64);
buffer.open(QIODevice::WriteOnly);
if (!pixmap.scaled(MaddeDevice::packageManagerIconSize(deviceType))
- .save(&buffer, iconPath.toFileInfo().suffix().toAscii())) {
+ .save(&buffer, iconPath.toFileInfo().suffix().toLatin1())) {
if (error)
*error = tr("Could not export image file '%1'.").arg(iconPath.toUserOutput());
return false;
@@ -635,7 +635,7 @@ DebianManager::ActionStatus DebianManager::createTemplate(Qt4ProjectManager::Qt4
if (!QFile::rename(location.appendPath(QLatin1String("debian")).toString(), debianDir.toString())) {
raiseError(tr("Unable to move new debian directory to '%1'.").arg(debianDir.toUserOutput()));
- Utils::FileUtils::removeRecursively(location.toString(), &error);
+ Utils::FileUtils::removeRecursively(location, &error);
return ActionFailed;
}
diff --git a/src/plugins/madde/madde.pro b/src/plugins/madde/madde.pro
index 73bf1efad4..7bf61f30c0 100644
--- a/src/plugins/madde/madde.pro
+++ b/src/plugins/madde/madde.pro
@@ -36,7 +36,6 @@ HEADERS += \
maemoqemusettings.h \
qt4maemodeployconfiguration.h \
maemodeviceconfigwizard.h \
- maemodeployconfigurationwidget.h \
maemoinstalltosysrootstep.h \
maemodeploymentmounter.h \
maemopackageinstaller.h \
@@ -80,7 +79,6 @@ SOURCES += \
maemoqemusettings.cpp \
qt4maemodeployconfiguration.cpp \
maemodeviceconfigwizard.cpp \
- maemodeployconfigurationwidget.cpp \
maemoinstalltosysrootstep.cpp \
maemodeploymentmounter.cpp \
maemopackageinstaller.cpp \
@@ -107,8 +105,7 @@ FORMS += \
maemodeviceconfigwizardpreviouskeysetupcheckpage.ui \
maemodeviceconfigwizardreusekeyscheckpage.ui \
maemodeviceconfigwizardkeycreationpage.ui \
- maemodeviceconfigwizardkeydeploymentpage.ui \
- maemodeployconfigurationwidget.ui
+ maemodeviceconfigwizardkeydeploymentpage.ui
RESOURCES += qt-maemo.qrc
DEFINES += QT_NO_CAST_TO_ASCII
diff --git a/src/plugins/madde/madde.qbs b/src/plugins/madde/madde.qbs
index 260ca82050..86adadbf5e 100644
--- a/src/plugins/madde/madde.qbs
+++ b/src/plugins/madde/madde.qbs
@@ -13,31 +13,29 @@ QtcPlugin {
Depends { name: "Qt.gui" }
Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
cpp.defines: base.concat(['QT_NO_CAST_TO_ASCII'])
files: [
+ "debianmanager.cpp",
+ "debianmanager.h",
"madde_exports.h",
+ "maddedevice.cpp",
+ "maddedevice.h",
"maddedeviceconfigurationfactory.cpp",
"maddedeviceconfigurationfactory.h",
"maddedevicetester.cpp",
"maddedevicetester.h",
"maddeplugin.cpp",
"maddeplugin.h",
- "maddeuploadandinstallpackagesteps.cpp",
- "maddeuploadandinstallpackagesteps.h",
"maddeqemustartstep.cpp",
"maddeqemustartstep.h",
+ "maddeuploadandinstallpackagesteps.cpp",
+ "maddeuploadandinstallpackagesteps.h",
+ "maemoapplicationrunnerhelperactions.cpp",
+ "maemoapplicationrunnerhelperactions.h",
"maemoconstants.h",
"maemodeploybymountsteps.cpp",
"maemodeploybymountsteps.h",
- "maemodeployconfigurationwidget.cpp",
- "maemodeployconfigurationwidget.h",
- "maemodeployconfigurationwidget.ui",
"maemodeploymentmounter.cpp",
"maemodeploymentmounter.h",
"maemodeploystepfactory.cpp",
@@ -115,11 +113,5 @@ QtcPlugin {
"qt-maemo.qrc",
"qt4maemodeployconfiguration.cpp",
"qt4maemodeployconfiguration.h",
- "maddedevice.cpp",
- "maddedevice.h",
- "debianmanager.h",
- "debianmanager.cpp",
- "maemoapplicationrunnerhelperactions.h",
- "maemoapplicationrunnerhelperactions.cpp"
]
}
diff --git a/src/plugins/madde/madde_dependencies.pri b/src/plugins/madde/madde_dependencies.pri
index 94d99fc73d..630796bcbf 100644
--- a/src/plugins/madde/madde_dependencies.pri
+++ b/src/plugins/madde/madde_dependencies.pri
@@ -1 +1,2 @@
+include(../../plugins/qt4projectmanager/qt4projectmanager.pri)
include(../../plugins/remotelinux/remotelinux.pri)
diff --git a/src/plugins/madde/maemoconstants.h b/src/plugins/madde/maemoconstants.h
index b5143fc87a..4e14fb6e85 100644
--- a/src/plugins/madde/maemoconstants.h
+++ b/src/plugins/madde/maemoconstants.h
@@ -40,12 +40,6 @@ const char HarmattanOsType[] = "HarmattanOsType";
#define PREFIX "Qt4ProjectManager.MaemoRunConfiguration"
-#ifdef Q_OS_WIN32
-#define EXEC_SUFFIX ".exe"
-#else
-#define EXEC_SUFFIX ""
-#endif
-
static const char MAEMO_RC_ID_PREFIX[] = PREFIX ":";
static const QLatin1String LastDeployedHostsKey(PREFIX ".LastDeployedHosts");
diff --git a/src/plugins/madde/maemodeploybymountsteps.cpp b/src/plugins/madde/maemodeploybymountsteps.cpp
index 036a225f8c..5b58e32e76 100644
--- a/src/plugins/madde/maemodeploybymountsteps.cpp
+++ b/src/plugins/madde/maemodeploybymountsteps.cpp
@@ -37,13 +37,13 @@
#include "maemoremotecopyfacility.h"
#include "qt4maemodeployconfiguration.h"
+#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <remotelinux/abstractremotelinuxdeployservice.h>
-#include <remotelinux/deployablefile.h>
-#include <remotelinux/deploymentinfo.h>
#include <remotelinux/linuxdevice.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <ssh/sshconnection.h>
@@ -129,7 +129,7 @@ private:
void cancelInstallation();
void handleInstallationSuccess();
- Q_SLOT void handleFileCopied(const RemoteLinux::DeployableFile&deployable);
+ Q_SLOT void handleFileCopied(const ProjectExplorer::DeployableFile &deployable);
MaemoRemoteCopyFacility * const m_copyFacility;
mutable QList<DeployableFile> m_filesToCopy;
@@ -304,8 +304,8 @@ MaemoMountAndCopyFilesService::MaemoMountAndCopyFilesService(QObject *parent)
connect(m_copyFacility, SIGNAL(stdoutData(QString)), SIGNAL(stdOutData(QString)));
connect(m_copyFacility, SIGNAL(stderrData(QString)), SIGNAL(stdErrData(QString)));
connect(m_copyFacility, SIGNAL(progress(QString)), SIGNAL(progressMessage(QString)));
- connect(m_copyFacility, SIGNAL(fileCopied(RemoteLinux::DeployableFile)),
- SLOT(handleFileCopied(RemoteLinux::DeployableFile)));
+ connect(m_copyFacility, SIGNAL(fileCopied(ProjectExplorer::DeployableFile)),
+ SLOT(handleFileCopied(ProjectExplorer::DeployableFile)));
connect(m_copyFacility, SIGNAL(finished(QString)), SLOT(handleInstallationFinished(QString)));
}
@@ -314,7 +314,7 @@ bool MaemoMountAndCopyFilesService::isDeploymentNecessary() const
m_filesToCopy.clear();
for (int i = 0; i < m_deployableFiles.count(); ++i) {
const DeployableFile &d = m_deployableFiles.at(i);
- if (hasChangedSinceLastDeployment(d) || QFileInfo(d.localFilePath).isDir())
+ if (hasChangedSinceLastDeployment(d) || d.localFilePath().toFileInfo().isDir())
m_filesToCopy << d;
}
return !m_filesToCopy.isEmpty();
@@ -323,29 +323,31 @@ bool MaemoMountAndCopyFilesService::isDeploymentNecessary() const
QList<MaemoMountSpecification> MaemoMountAndCopyFilesService::mountSpecifications() const
{
QList<MaemoMountSpecification> mountSpecs;
-#ifdef Q_OS_WIN
- bool drivesToMount[26];
- qFill(drivesToMount, drivesToMount + sizeof drivesToMount / sizeof drivesToMount[0], false);
- for (int i = 0; i < m_filesToCopy.count(); ++i) {
- const QString localDir = QFileInfo(m_filesToCopy.at(i).localFilePath).canonicalPath();
- const char driveLetter = localDir.at(0).toLower().toLatin1();
- if (driveLetter < 'a' || driveLetter > 'z') {
- qWarning("Weird: drive letter is '%c'.", driveLetter);
- continue;
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ bool drivesToMount[26];
+ qFill(drivesToMount, drivesToMount + sizeof drivesToMount / sizeof drivesToMount[0], false);
+ for (int i = 0; i < m_filesToCopy.count(); ++i) {
+ const QString localDir
+ = m_filesToCopy.at(i).localFilePath().toFileInfo().canonicalPath();
+ const char driveLetter = localDir.at(0).toLower().toLatin1();
+ if (driveLetter < 'a' || driveLetter > 'z') {
+ qWarning("Weird: drive letter is '%c'.", driveLetter);
+ continue;
+ }
+
+ const int index = driveLetter - 'a';
+ if (drivesToMount[index])
+ continue;
+
+ const QString mountPoint = deployMountPoint() + QLatin1Char('/')
+ + QLatin1Char(driveLetter);
+ const MaemoMountSpecification mountSpec(localDir.left(3), mountPoint);
+ mountSpecs << mountSpec;
+ drivesToMount[index] = true;
}
-
- const int index = driveLetter - 'a';
- if (drivesToMount[index])
- continue;
-
- const QString mountPoint = deployMountPoint() + QLatin1Char('/') + QLatin1Char(driveLetter);
- const MaemoMountSpecification mountSpec(localDir.left(3), mountPoint);
- mountSpecs << mountSpec;
- drivesToMount[index] = true;
+ } else {
+ mountSpecs << MaemoMountSpecification(QLatin1String("/"), deployMountPoint());
}
-#else
- mountSpecs << MaemoMountSpecification(QLatin1String("/"), deployMountPoint());
-#endif
return mountSpecs;
}
@@ -444,12 +446,7 @@ AbstractRemoteLinuxDeployService *MaemoCopyFilesViaMountStep::deployService() co
bool MaemoCopyFilesViaMountStep::initInternal(QString *error)
{
- QList<DeployableFile> deployableFiles;
- const DeploymentInfo * const deploymentInfo = deployConfiguration()->deploymentInfo();
- const int deployableCount = deploymentInfo->deployableCount();
- for (int i = 0; i < deployableCount; ++i)
- deployableFiles << deploymentInfo->deployableAt(i);
- m_deployService->setDeployableFiles(deployableFiles);
+ m_deployService->setDeployableFiles(target()->deploymentData().allFiles());
return deployService()->isDeploymentPossible(error);
}
diff --git a/src/plugins/madde/maemodeployconfigurationwidget.cpp b/src/plugins/madde/maemodeployconfigurationwidget.cpp
deleted file mode 100644
index 049848d14f..0000000000
--- a/src/plugins/madde/maemodeployconfigurationwidget.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 "maemodeployconfigurationwidget.h"
-#include "ui_maemodeployconfigurationwidget.h"
-
-#include "maemoglobal.h"
-#include "maemoconstants.h"
-#include "qt4maemodeployconfiguration.h"
-
-#include <projectexplorer/kitinformation.h>
-#include <projectexplorer/target.h>
-#include <qt4projectmanager/qt4nodes.h>
-#include <remotelinux/deployablefile.h>
-#include <remotelinux/deployablefilesperprofile.h>
-#include <remotelinux/deploymentinfo.h>
-#include <remotelinux/deploymentsettingsassistant.h>
-#include <remotelinux/remotelinuxdeployconfigurationwidget.h>
-#include <utils/fileutils.h>
-#include <utils/qtcassert.h>
-
-#include <QFileInfo>
-#include <QFileDialog>
-#include <QMessageBox>
-#include <QPixmap>
-#include <QVBoxLayout>
-
-using namespace ProjectExplorer;
-using namespace Qt4ProjectManager;
-using namespace RemoteLinux;
-
-namespace Madde {
-namespace Internal {
-
-MaemoDeployConfigurationWidget::MaemoDeployConfigurationWidget(QWidget *parent)
- : DeployConfigurationWidget(parent),
- ui(new Ui::MaemoDeployConfigurationWidget),
- m_remoteLinuxWidget(new RemoteLinuxDeployConfigurationWidget)
-{
- QVBoxLayout *mainLayout = new QVBoxLayout(this);
- mainLayout->setSpacing(0);
- mainLayout->addWidget(m_remoteLinuxWidget);
- QWidget * const subWidget = new QWidget;
- ui->setupUi(subWidget);
- mainLayout->addWidget(subWidget);
- mainLayout->addStretch(1);
-
- connect(m_remoteLinuxWidget,
- SIGNAL(currentModelChanged(const RemoteLinux::DeployableFilesPerProFile*)),
- SLOT(handleCurrentModelChanged(const RemoteLinux::DeployableFilesPerProFile*)));
- handleCurrentModelChanged(m_remoteLinuxWidget->currentModel());
-}
-
-MaemoDeployConfigurationWidget::~MaemoDeployConfigurationWidget()
-{
- delete ui;
-}
-
-void MaemoDeployConfigurationWidget::init(DeployConfiguration *dc)
-{
- m_remoteLinuxWidget->init(dc);
- connect(ui->addDesktopFileButton, SIGNAL(clicked()), SLOT(addDesktopFile()));
- connect(ui->addIconButton, SIGNAL(clicked()), SLOT(addIcon()));
- connect(deployConfiguration()->deploymentInfo(), SIGNAL(modelAboutToBeReset()),
- SLOT(handleDeploymentInfoToBeReset()));
-}
-
-Qt4MaemoDeployConfiguration *MaemoDeployConfigurationWidget::deployConfiguration() const
-{
- return qobject_cast<Qt4MaemoDeployConfiguration *>(m_remoteLinuxWidget->deployConfiguration());
-}
-
-void MaemoDeployConfigurationWidget::handleDeploymentInfoToBeReset()
-{
- ui->addDesktopFileButton->setEnabled(false);
- ui->addIconButton->setEnabled(false);
-}
-
-void MaemoDeployConfigurationWidget::handleCurrentModelChanged(const DeployableFilesPerProFile *proFileInfo)
-{
- ui->addDesktopFileButton->setEnabled(canAddDesktopFile(proFileInfo));
- ui->addIconButton->setEnabled(canAddIcon(proFileInfo));
-}
-
-void MaemoDeployConfigurationWidget::addDesktopFile()
-{
- DeployableFilesPerProFile * const proFileInfo = m_remoteLinuxWidget->currentModel();
- QTC_ASSERT(canAddDesktopFile(proFileInfo), return);
-
- const QString desktopFilePath = QFileInfo(proFileInfo->proFilePath()).path()
- + QLatin1Char('/') + proFileInfo->projectName() + QLatin1String(".desktop");
- if (!QFile::exists(desktopFilePath)) {
- const QString desktopTemplate = QLatin1String("[Desktop Entry]\nEncoding=UTF-8\n"
- "Version=1.0\nType=Application\nTerminal=false\nName=%1\nExec=%2\n"
- "Icon=%1\nX-Window-Icon=\nX-HildonDesk-ShowInToolbar=true\n"
- "X-Osso-Type=application/x-executable\n");
- Utils::FileSaver saver(desktopFilePath);
- saver.write(desktopTemplate.arg(proFileInfo->projectName(),
- proFileInfo->remoteExecutableFilePath()).toUtf8());
- if (!saver.finalize(this))
- return;
- }
-
- DeployableFile d;
- d.remoteDir = QLatin1String("/usr/share/applications");
- Core::Id deviceType
- = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(deployConfiguration()->target()->kit());
- if (deviceType == Maemo5OsType)
- d.remoteDir += QLatin1String("/hildon");
- d.localFilePath = desktopFilePath;
- if (!deployConfiguration()->deploymentSettingsAssistant()
- ->addDeployableToProFile(deployConfiguration()->qmakeScope(), proFileInfo,
- QLatin1String("desktopfile"), d)) {
- QMessageBox::critical(this, tr("Project File Update Failed"),
- tr("Could not update the project file."));
- } else {
- ui->addDesktopFileButton->setEnabled(false);
- }
-}
-
-void MaemoDeployConfigurationWidget::addIcon()
-{
- DeployableFilesPerProFile * const proFileInfo = m_remoteLinuxWidget->currentModel();
- const int iconDim
- = MaemoGlobal::applicationIconSize(deployConfiguration()->target());
- const QString origFilePath = QFileDialog::getOpenFileName(this,
- tr("Choose Icon (will be scaled to %1x%1 pixels, if necessary)").arg(iconDim),
- proFileInfo->projectDir(), QLatin1String("(*.png)"));
- if (origFilePath.isEmpty())
- return;
- QPixmap pixmap(origFilePath);
- if (pixmap.isNull()) {
- QMessageBox::critical(this, tr("Invalid Icon"),
- tr("Unable to read image"));
- return;
- }
- const QSize iconSize(iconDim, iconDim);
- if (pixmap.size() != iconSize)
- pixmap = pixmap.scaled(iconSize);
- const QString newFileName = proFileInfo->projectName() + QLatin1Char('.')
- + QFileInfo(origFilePath).suffix();
- const QString newFilePath = proFileInfo->projectDir() + QLatin1Char('/') + newFileName;
- if (!pixmap.save(newFilePath)) {
- QMessageBox::critical(this, tr("Failed to Save Icon"),
- tr("Could not save icon to '%1'.").arg(newFilePath));
- return;
- }
-
- if (!deployConfiguration()->deploymentSettingsAssistant()
- ->addDeployableToProFile(deployConfiguration()->qmakeScope(), proFileInfo,
- QLatin1String("icon"), DeployableFile(newFilePath, remoteIconDir()))) {
- QMessageBox::critical(this, tr("Project File Update Failed"),
- tr("Could not update the project file."));
- } else {
- ui->addIconButton->setEnabled(false);
- }
-}
-
-bool MaemoDeployConfigurationWidget::canAddDesktopFile(const DeployableFilesPerProFile *proFileInfo) const
-{
- return proFileInfo && proFileInfo->isApplicationProject()
- && deployConfiguration()->localDesktopFilePath(proFileInfo).isEmpty();
-}
-
-bool MaemoDeployConfigurationWidget::canAddIcon(const DeployableFilesPerProFile *proFileInfo) const
-{
- return proFileInfo && proFileInfo->isApplicationProject()
- && remoteIconFilePath(proFileInfo).isEmpty();
-}
-
-QString MaemoDeployConfigurationWidget::remoteIconFilePath(const DeployableFilesPerProFile *proFileInfo) const
-{
- QTC_ASSERT(proFileInfo->projectType() == ApplicationTemplate, return QString());
-
- const QStringList imageTypes = QStringList() << QLatin1String("jpg") << QLatin1String("png")
- << QLatin1String("svg");
- for (int i = 0; i < proFileInfo->rowCount(); ++i) {
- const DeployableFile &d = proFileInfo->deployableAt(i);
- const QString extension = QFileInfo(d.localFilePath).suffix();
- if (d.remoteDir.startsWith(remoteIconDir()) && imageTypes.contains(extension))
- return d.remoteDir + QLatin1Char('/') + QFileInfo(d.localFilePath).fileName();
- }
- return QString();
-}
-
-QString MaemoDeployConfigurationWidget::remoteIconDir() const
-{
- return QString::fromLatin1("/usr/share/icons/hicolor/%1x%1/apps")
- .arg(MaemoGlobal::applicationIconSize(deployConfiguration()->target()));
-}
-
-} // namespace Internal
-} // namespace Madde
diff --git a/src/plugins/madde/maemodeployconfigurationwidget.h b/src/plugins/madde/maemodeployconfigurationwidget.h
deleted file mode 100644
index 1d848eff2e..0000000000
--- a/src/plugins/madde/maemodeployconfigurationwidget.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 MAEMODEPLOYCONFIGURATIONWIDGET_H
-#define MAEMODEPLOYCONFIGURATIONWIDGET_H
-
-#include <projectexplorer/deployconfiguration.h>
-
-namespace RemoteLinux {
-class DeployableFilesPerProFile;
-class RemoteLinuxDeployConfigurationWidget;
-}
-
-namespace Madde {
-namespace Internal {
-
-class Qt4MaemoDeployConfiguration;
-namespace Ui { class MaemoDeployConfigurationWidget; }
-
-
-class MaemoDeployConfigurationWidget : public ProjectExplorer::DeployConfigurationWidget
-{
- Q_OBJECT
-
-public:
- explicit MaemoDeployConfigurationWidget(QWidget *parent = 0);
- ~MaemoDeployConfigurationWidget();
-
- void init(ProjectExplorer::DeployConfiguration *dc);
-
- Qt4MaemoDeployConfiguration *deployConfiguration() const;
-
-private slots:
- void addDesktopFile();
- void addIcon();
- void handleDeploymentInfoToBeReset();
- void handleCurrentModelChanged(const RemoteLinux::DeployableFilesPerProFile *proFileInfo);
-
-private:
- bool canAddDesktopFile(const RemoteLinux::DeployableFilesPerProFile *proFileInfo) const;
- bool canAddIcon(const RemoteLinux::DeployableFilesPerProFile *proFileInfo) const;
- QString remoteIconFilePath(const RemoteLinux::DeployableFilesPerProFile *proFileInfo) const;
- QString remoteIconDir() const;
-
- Ui::MaemoDeployConfigurationWidget *ui;
- RemoteLinux::RemoteLinuxDeployConfigurationWidget * const m_remoteLinuxWidget;
-};
-
-} // namespace Internal
-} // namespace Madde
-
-#endif // MAEMODEPLOYCONFIGURATIONWIDGET_H
diff --git a/src/plugins/madde/maemodeployconfigurationwidget.ui b/src/plugins/madde/maemodeployconfigurationwidget.ui
deleted file mode 100644
index 04f5b74fd9..0000000000
--- a/src/plugins/madde/maemodeployconfigurationwidget.ui
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Madde::Internal::MaemoDeployConfigurationWidget</class>
- <widget class="QWidget" name="Madde::Internal::MaemoDeployConfigurationWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>276</width>
- <height>45</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QPushButton" name="addDesktopFileButton">
- <property name="text">
- <string>Add Desktop File</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="addIconButton">
- <property name="text">
- <string>Add Launcher Icon...</string>
- </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>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/plugins/madde/maemoglobal.cpp b/src/plugins/madde/maemoglobal.cpp
index bc4dcb907c..eeac3d7f37 100644
--- a/src/plugins/madde/maemoglobal.cpp
+++ b/src/plugins/madde/maemoglobal.cpp
@@ -39,6 +39,7 @@
#include <qtsupport/qtkitinformation.h>
#include <remotelinux/remotelinux_constants.h>
#include <utils/environment.h>
+#include <utils/hostosinfo.h>
#include <QDir>
#include <QFileInfo>
@@ -50,12 +51,11 @@ using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Constants;
using namespace RemoteLinux;
+using namespace Utils;
namespace Madde {
namespace Internal {
-namespace {
-static const QLatin1String binQmake("/bin/qmake" EXEC_SUFFIX);
-} // namespace
+static const QString binQmake = QLatin1String("/bin/qmake" QTC_HOST_EXE_SUFFIX);
bool MaemoGlobal::hasMaemoDevice(const Kit *k)
{
@@ -95,7 +95,7 @@ bool MaemoGlobal::isValidMaemoQtVersion(const QString &qmakePath, Core::Id devic
return false;
madAdminProc.setReadChannel(QProcess::StandardOutput);
- const QByteArray tgtName = targetName(qmakePath).toAscii();
+ const QByteArray tgtName = targetName(qmakePath).toLatin1();
while (madAdminProc.canReadLine()) {
const QByteArray &line = madAdminProc.readLine();
if (line.contains(tgtName)
@@ -140,16 +140,16 @@ QString MaemoGlobal::remoteSourceProfilesCommand()
QByteArray remoteCall(":");
foreach (const QByteArray &profile, profiles)
remoteCall += "; test -f " + profile + " && source " + profile;
- return QString::fromAscii(remoteCall);
+ return QString::fromLatin1(remoteCall);
}
-Utils::PortList MaemoGlobal::freePorts(const Kit *k)
+PortList MaemoGlobal::freePorts(const Kit *k)
{
IDevice::ConstPtr device = DeviceKitInformation::device(k);
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k);
if (!device || !qtVersion)
- return Utils::PortList();
+ return PortList();
if (device->machineType() == IDevice::Emulator) {
MaemoQemuRuntime rt;
const int id = qtVersion->uniqueId();
@@ -166,19 +166,14 @@ QString MaemoGlobal::maddeRoot(const QString &qmakePath)
return dir.absolutePath();
}
-Utils::FileName MaemoGlobal::maddeRoot(const Kit *k)
+FileName MaemoGlobal::maddeRoot(const Kit *k)
{
return SysRootKitInformation::sysRoot(k).parentDir().parentDir();
}
QString MaemoGlobal::targetRoot(const QString &qmakePath)
{
-#ifdef Q_OS_WIN
- Qt::CaseSensitivity cs = Qt::CaseInsensitive;
-#else
- Qt::CaseSensitivity cs = Qt::CaseSensitive;
-#endif
- return QDir::cleanPath(qmakePath).remove(binQmake, cs);
+ return QDir::cleanPath(qmakePath).remove(binQmake, HostOsInfo::fileNameCaseSensitivity());
}
QString MaemoGlobal::targetName(const QString &qmakePath)
@@ -226,32 +221,26 @@ QString MaemoGlobal::architecture(const QString &qmakePath)
return arch;
}
-void MaemoGlobal::addMaddeEnvironment(Utils::Environment &env, const QString &qmakePath)
+void MaemoGlobal::addMaddeEnvironment(Environment &env, const QString &qmakePath)
{
- Utils::Environment maddeEnv;
-#ifdef Q_OS_WIN
- const QString root = maddeRoot(qmakePath);
- env.prependOrSetPath(root + QLatin1String("/bin"));
- env.prependOrSet(QLatin1String("HOME"),
- QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
-#else
- Q_UNUSED(qmakePath);
-#endif
- for (Utils::Environment::const_iterator it = maddeEnv.constBegin(); it != maddeEnv.constEnd(); ++it)
+ Environment maddeEnv;
+ if (HostOsInfo::isWindowsHost()) {
+ const QString root = maddeRoot(qmakePath);
+ env.prependOrSetPath(root + QLatin1String("/bin"));
+ env.prependOrSet(QLatin1String("HOME"),
+ QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
+ }
+ for (Environment::const_iterator it = maddeEnv.constBegin(); it != maddeEnv.constEnd(); ++it)
env.prependOrSet(it.key(), it.value());
}
void MaemoGlobal::transformMaddeCall(QString &command, QStringList &args, const QString &qmakePath)
{
-#ifdef Q_OS_WIN
- const QString root = maddeRoot(qmakePath);
- args.prepend(command);
- command = root + QLatin1String("/bin/sh.exe");
-#else
- Q_UNUSED(command);
- Q_UNUSED(args);
- Q_UNUSED(qmakePath);
-#endif
+ if (HostOsInfo::isWindowsHost()) {
+ const QString root = maddeRoot(qmakePath);
+ args.prepend(command);
+ command = root + QLatin1String("/bin/sh.exe");
+ }
}
bool MaemoGlobal::callMad(QProcess &proc, const QStringList &args,
@@ -276,7 +265,7 @@ bool MaemoGlobal::callMaddeShellScript(QProcess &proc,
return false;
QString actualCommand = command;
QStringList actualArgs = targetArgs(qmakePath, useTarget) + args;
- Utils::Environment env(proc.systemEnvironment());
+ Environment env(proc.systemEnvironment());
addMaddeEnvironment(env, qmakePath);
proc.setEnvironment(env.toStringList());
transformMaddeCall(actualCommand, actualArgs, qmakePath);
diff --git a/src/plugins/madde/maemoinstalltosysrootstep.cpp b/src/plugins/madde/maemoinstalltosysrootstep.cpp
index 1c1d0699a4..11016c3589 100644
--- a/src/plugins/madde/maemoinstalltosysrootstep.cpp
+++ b/src/plugins/madde/maemoinstalltosysrootstep.cpp
@@ -34,19 +34,19 @@
#include "maemopackagecreationstep.h"
#include "maemoqtversion.h"
-#include <utils/fileutils.h>
+#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
-#include <remotelinux/deploymentinfo.h>
#include <remotelinux/remotelinuxdeployconfiguration.h>
+#include <utils/fileutils.h>
#include <QDir>
#include <QFileInfo>
#include <QLatin1Char>
+#include <QPointer>
#include <QProcess>
-#include <QWeakPointer>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
@@ -110,7 +110,7 @@ class MaemoCopyFilesToSysrootWidget : public BuildStepConfigWidget
{
Q_OBJECT
public:
- MaemoCopyFilesToSysrootWidget(const BuildStep *buildStep)
+ MaemoCopyFilesToSysrootWidget(BuildStep *buildStep)
: m_buildStep(buildStep)
{
if (m_buildStep) {
@@ -125,7 +125,7 @@ public:
}
virtual bool showWidget() const { return false; }
private:
- const QWeakPointer<const BuildStep> m_buildStep;
+ const QPointer<BuildStep> m_buildStep;
};
@@ -281,11 +281,7 @@ bool MaemoCopyToSysrootStep::init()
}
m_systemRoot = ProjectExplorer::SysRootKitInformation::sysRoot(target()->kit()).toString();
- const DeploymentInfo * const deploymentInfo
- = static_cast<RemoteLinuxDeployConfiguration *>(deployConfiguration())->deploymentInfo();
- m_files.clear();
- for (int i = 0; i < deploymentInfo->deployableCount(); ++i)
- m_files << deploymentInfo->deployableAt(i);
+ m_files = target()->deploymentData().allFiles();
return true;
}
@@ -297,14 +293,14 @@ void MaemoCopyToSysrootStep::run(QFutureInterface<bool> &fi)
const QChar sep = QLatin1Char('/');
foreach (const DeployableFile &deployable, m_files) {
- const QFileInfo localFileInfo(deployable.localFilePath);
+ const QFileInfo localFileInfo = deployable.localFilePath().toFileInfo();
const QString targetFilePath = m_systemRoot + sep
- + deployable.remoteDir + sep + localFileInfo.fileName();
- sysrootDir.mkpath(deployable.remoteDir.mid(1));
+ + deployable.remoteDirectory() + sep + localFileInfo.fileName();
+ sysrootDir.mkpath(deployable.remoteDirectory().mid(1));
QString errorMsg;
- Utils::FileUtils::removeRecursively(targetFilePath, &errorMsg);
- if (!Utils::FileUtils::copyRecursively(deployable.localFilePath,
- targetFilePath, &errorMsg)) {
+ Utils::FileUtils::removeRecursively(Utils::FileName::fromString(targetFilePath), &errorMsg);
+ if (!Utils::FileUtils::copyRecursively(deployable.localFilePath(),
+ Utils::FileName::fromString(targetFilePath), &errorMsg)) {
emit addOutput(tr("Sysroot installation failed: %1\n"
" Continuing anyway.").arg(errorMsg), ErrorMessageOutput);
}
diff --git a/src/plugins/madde/maemoinstalltosysrootstep.h b/src/plugins/madde/maemoinstalltosysrootstep.h
index c712c6badf..cd79e31fd7 100644
--- a/src/plugins/madde/maemoinstalltosysrootstep.h
+++ b/src/plugins/madde/maemoinstalltosysrootstep.h
@@ -32,7 +32,7 @@
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/buildstep.h>
-#include <remotelinux/deployablefile.h>
+#include <projectexplorer/deployablefile.h>
#include <QStringList>
@@ -104,7 +104,7 @@ public:
static QString displayName();
private:
QString m_systemRoot;
- QList<RemoteLinux::DeployableFile> m_files;
+ QList<ProjectExplorer::DeployableFile> m_files;
};
class MaemoMakeInstallToSysrootStep : public ProjectExplorer::AbstractProcessStep
diff --git a/src/plugins/madde/maemopackagecreationstep.cpp b/src/plugins/madde/maemopackagecreationstep.cpp
index 58707a2421..9a0a194a97 100644
--- a/src/plugins/madde/maemopackagecreationstep.cpp
+++ b/src/plugins/madde/maemopackagecreationstep.cpp
@@ -42,6 +42,7 @@
#include <qtsupport/qtkitinformation.h>
#include <utils/environment.h>
#include <utils/fileutils.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QDateTime>
@@ -57,6 +58,7 @@ using ProjectExplorer::BuildStepList;
using ProjectExplorer::BuildStepConfigWidget;
using ProjectExplorer::Task;
using namespace Qt4ProjectManager;
+using namespace Utils;
namespace Madde {
namespace Internal {
@@ -225,7 +227,7 @@ bool AbstractMaemoPackageCreationStep::callPackagingCommand(QProcess *proc,
void AbstractMaemoPackageCreationStep::preparePackagingProcess(QProcess *proc,
const Qt4BuildConfiguration *bc, const QString &workingDir)
{
- Utils::Environment env = bc->environment();
+ Environment env = bc->environment();
if (bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild) {
env.appendOrSet(QLatin1String("DEB_BUILD_OPTIONS"),
QLatin1String("nostrip"), QLatin1String(" "));
@@ -329,12 +331,12 @@ bool MaemoDebianPackageCreationStep::createPackage(QProcess *buildProc,
bool MaemoDebianPackageCreationStep::isMetaDataNewerThan(const QDateTime &packageDate) const
{
- const Utils::FileName debianPath = DebianManager::debianDirectory(target());
+ const FileName debianPath = DebianManager::debianDirectory(target());
if (packageDate <= debianPath.toFileInfo().lastModified())
return true;
const QStringList debianFiles = DebianManager::debianFiles(debianPath);
foreach (const QString &debianFile, debianFiles) {
- Utils::FileName absFilePath = debianPath;
+ FileName absFilePath = debianPath;
absFilePath.appendPath(debianFile);
if (packageDate <= absFilePath.toFileInfo().lastModified())
return true;
@@ -351,7 +353,7 @@ void MaemoDebianPackageCreationStep::checkProjectName()
"Debian packages.\nThey must only use lower-case letters, "
"numbers, '-', '+' and '.'.\n""We will try to work around that, "
"but you may experience problems."),
- Utils::FileName(), -1, Core::Id(TASK_CATEGORY_BUILDSYSTEM)));
+ FileName(), -1, Core::Id(TASK_CATEGORY_BUILDSYSTEM)));
}
}
@@ -370,7 +372,7 @@ bool MaemoDebianPackageCreationStep::copyDebianFiles(bool inSourceBuild)
return false;
}
QString error;
- if (!Utils::FileUtils::removeRecursively(debianDirPath, &error)) {
+ if (!FileUtils::removeRecursively(FileName::fromString(debianDirPath), &error)) {
raiseError(tr("Packaging failed: Could not remove directory '%1': %2")
.arg(debianDirPath, error));
return false;
@@ -396,7 +398,7 @@ bool MaemoDebianPackageCreationStep::copyDebianFiles(bool inSourceBuild)
}
if (newFileName == DebianManager::packageName(DebianManager::debianDirectory(target())) + QLatin1String(".aegis")) {
- Utils::FileReader reader;
+ FileReader reader;
if (!reader.fetch(srcFile)) {
raiseError(tr("Could not read manifest file '%1': %2.")
.arg(QDir::toNativeSeparators(srcFile), reader.errorString()));
@@ -436,9 +438,8 @@ bool MaemoDebianPackageCreationStep::copyDebianFiles(bool inSourceBuild)
QString MaemoDebianPackageCreationStep::packagingCommand(const QString &maddeRoot, const QString &commandName)
{
QString perl;
-#ifdef Q_OS_WIN
- perl = maddeRoot + QLatin1String("/bin/perl.exe ");
-#endif
+ if (HostOsInfo::isWindowsHost())
+ perl = maddeRoot + QLatin1String("/bin/perl.exe ");
return perl + maddeRoot + QLatin1String("/madbin/") + commandName;
}
@@ -457,7 +458,7 @@ void MaemoDebianPackageCreationStep::ensureShlibdeps(QByteArray &rulesContent)
bool MaemoDebianPackageCreationStep::adaptRulesFile(
const QString &templatePath, const QString &rulesFilePath)
{
- Utils::FileReader reader;
+ FileReader reader;
if (!reader.fetch(templatePath)) {
raiseError(reader.errorString());
return false;
@@ -467,7 +468,7 @@ bool MaemoDebianPackageCreationStep::adaptRulesFile(
if (!m_debugBuild)
ensureShlibdeps(content);
- Utils::FileSaver saver(rulesFilePath);
+ FileSaver saver(rulesFilePath);
saver.write(content);
if (!saver.finalize()) {
raiseError(saver.errorString());
diff --git a/src/plugins/madde/maemopackagecreationwidget.cpp b/src/plugins/madde/maemopackagecreationwidget.cpp
index e873095e85..2a2d88b932 100644
--- a/src/plugins/madde/maemopackagecreationwidget.cpp
+++ b/src/plugins/madde/maemopackagecreationwidget.cpp
@@ -188,7 +188,7 @@ void MaemoPackageCreationWidget::setPackageManagerIcon()
QString imageFilter = tr("Images") + QLatin1String("( ");
const QList<QByteArray> &imageTypes = QImageReader::supportedImageFormats();
foreach (const QByteArray &imageType, imageTypes)
- imageFilter += "*." + QString::fromAscii(imageType) + QLatin1Char(' ');
+ imageFilter += "*." + QString::fromLatin1(imageType) + QLatin1Char(' ');
imageFilter += QLatin1Char(')');
const QSize iconSize = MaddeDevice::packageManagerIconSize(deviceType);
const QString iconFileName = QFileDialog::getOpenFileName(this,
diff --git a/src/plugins/madde/maemopublisherfremantlefree.cpp b/src/plugins/madde/maemopublisherfremantlefree.cpp
index b4308e9281..604fd0e195 100644
--- a/src/plugins/madde/maemopublisherfremantlefree.cpp
+++ b/src/plugins/madde/maemopublisherfremantlefree.cpp
@@ -42,8 +42,6 @@
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
-#include <remotelinux/deployablefilesperprofile.h>
-#include <remotelinux/deploymentinfo.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <ssh/sshremoteprocessrunner.h>
@@ -59,6 +57,7 @@ using namespace Core;
using namespace Qt4ProjectManager;
using namespace RemoteLinux;
using namespace QSsh;
+using namespace Utils;
namespace Madde {
namespace Internal {
@@ -128,7 +127,7 @@ void MaemoPublisherFremantleFree::createPackage()
if (QFileInfo(tmpDirContainer()).exists()) {
emit progressReport(tr("Removing left-over temporary directory..."));
QString error;
- if (!Utils::FileUtils::removeRecursively(tmpDirContainer(), &error)) {
+ if (!FileUtils::removeRecursively(FileName::fromString(tmpDirContainer()), &error)) {
finishWithFailure(tr("Error removing temporary directory: %1").arg(error),
tr("Publishing failed: Could not create source package."));
return;
@@ -152,13 +151,6 @@ void MaemoPublisherFremantleFree::createPackage()
return;
}
- QString error;
- if (!updateDesktopFiles(&error)) {
- finishWithFailure(error,
- tr("Publishing failed: Could not create package."));
- return;
- }
-
emit progressReport(tr("Cleaning up temporary directory..."));
AbstractMaemoPackageCreationStep::preparePackagingProcess(m_process,
m_buildConfig, m_tmpProjectDir);
@@ -209,7 +201,7 @@ bool MaemoPublisherFremantleFree::copyRecursively(const QString &srcFilePath,
}
} else {
if (tgtFilePath == m_tmpProjectDir + QLatin1String("/debian/rules")) {
- Utils::FileReader reader;
+ FileReader reader;
if (!reader.fetch(srcFilePath)) {
emit progressReport(reader.errorString(), ErrorOutput);
return false;
@@ -219,7 +211,7 @@ bool MaemoPublisherFremantleFree::copyRecursively(const QString &srcFilePath,
rulesContents.replace("# Add here commands to configure the package.",
"qmake " + QFileInfo(m_project->document()->fileName()).fileName().toLocal8Bit());
MaemoDebianPackageCreationStep::ensureShlibdeps(rulesContents);
- Utils::FileSaver saver(tgtFilePath);
+ FileSaver saver(tgtFilePath);
saver.write(rulesContents);
if (!saver.finalize()) {
emit progressReport(saver.errorString(), ErrorOutput);
@@ -251,7 +243,7 @@ bool MaemoPublisherFremantleFree::fixNewlines()
const QStringList &fileNames = debianDir.entryList(QDir::Files);
foreach (const QString &fileName, fileNames) {
QString filePath = debianDir.filePath(fileName);
- Utils::FileReader reader;
+ FileReader reader;
if (!reader.fetch(filePath))
return false;
QByteArray contents = reader.data();
@@ -259,7 +251,7 @@ bool MaemoPublisherFremantleFree::fixNewlines()
if (!contents.contains(crlf))
continue;
contents.replace(crlf, "\n");
- Utils::FileSaver saver(filePath);
+ FileSaver saver(filePath);
saver.write(contents);
if (!saver.finalize())
return false;
@@ -373,7 +365,7 @@ void MaemoPublisherFremantleFree::runDpkgBuildPackage()
}
foreach (const QString &filePath, d.filesToExclude()) {
QString error;
- if (!Utils::FileUtils::removeRecursively(filePath, &error)) {
+ if (!FileUtils::removeRecursively(FileName::fromString(filePath), &error)) {
finishWithFailure(error,
tr("Publishing failed: Could not create package."));
}
@@ -541,65 +533,6 @@ void MaemoPublisherFremantleFree::finishWithFailure(const QString &progressMsg,
setState(Inactive);
}
-bool MaemoPublisherFremantleFree::updateDesktopFiles(QString *error) const
-{
- bool success = true;
- const Qt4MaemoDeployConfiguration *const deployConfig
- = qobject_cast<Qt4MaemoDeployConfiguration *>(m_buildConfig->target()->activeDeployConfiguration());
- QTC_ASSERT(deployConfig, return false);
- const DeploymentInfo *const deploymentInfo = deployConfig->deploymentInfo();
- for (int i = 0; i < deploymentInfo->modelCount(); ++i) {
- const DeployableFilesPerProFile * const model = deploymentInfo->modelAt(i);
- QString desktopFilePath = deployConfig->localDesktopFilePath(model);
- if (desktopFilePath.isEmpty())
- continue;
- desktopFilePath.replace(model->projectDir(), m_tmpProjectDir);
- const QString executableFilePath = model->remoteExecutableFilePath();
- if (executableFilePath.isEmpty()) {
- qDebug("%s: Skipping subproject %s with missing deployment information.",
- Q_FUNC_INFO, qPrintable(model->proFilePath()));
- continue;
- }
- Utils::FileReader reader;
- if (!reader.fetch(desktopFilePath, error)) {
- success = false;
- continue;
- }
- QByteArray desktopFileContents = reader.data();
- bool fileNeedsUpdate = addOrReplaceDesktopFileValue(desktopFileContents,
- "Exec", executableFilePath.toUtf8());
- if (fileNeedsUpdate) {
- Utils::FileSaver saver(desktopFilePath);
- saver.write(desktopFileContents);
- if (!saver.finalize(error))
- success = false;
- }
- }
- return success;
-}
-
-bool MaemoPublisherFremantleFree::addOrReplaceDesktopFileValue(QByteArray &fileContent,
- const QByteArray &key, const QByteArray &newValue) const
-{
- const int keyPos = fileContent.indexOf(key + '=');
- if (keyPos == -1) {
- if (!fileContent.endsWith('\n'))
- fileContent += '\n';
- fileContent += key + '=' + newValue + '\n';
- return true;
- }
- int nextNewlinePos = fileContent.indexOf('\n', keyPos);
- if (nextNewlinePos == -1)
- nextNewlinePos = fileContent.count();
- const int replacePos = keyPos + key.count() + 1;
- const int replaceCount = nextNewlinePos - replacePos;
- const QByteArray &oldValue = fileContent.mid(replacePos, replaceCount);
- if (oldValue == newValue)
- return false;
- fileContent.replace(replacePos, replaceCount, newValue);
- return true;
-}
-
QStringList MaemoPublisherFremantleFree::findProblems() const
{
QStringList problems;
diff --git a/src/plugins/madde/maemopublisherfremantlefree.h b/src/plugins/madde/maemopublisherfremantlefree.h
index f36ba3a8e0..b1b41d2581 100644
--- a/src/plugins/madde/maemopublisherfremantlefree.h
+++ b/src/plugins/madde/maemopublisherfremantlefree.h
@@ -104,9 +104,6 @@ private:
void prepareToSendFile();
void sendFile();
void finishWithFailure(const QString &progressMsg, const QString &resultMsg);
- bool updateDesktopFiles(QString *error = 0) const;
- bool addOrReplaceDesktopFileValue(QByteArray &fileContent,
- const QByteArray &key, const QByteArray &newValue) const;
QStringList findProblems() const;
const ProjectExplorer::Project * const m_project;
diff --git a/src/plugins/madde/maemoqemuruntimeparser.cpp b/src/plugins/madde/maemoqemuruntimeparser.cpp
index a7551d83cd..2d13b5b224 100644
--- a/src/plugins/madde/maemoqemuruntimeparser.cpp
+++ b/src/plugins/madde/maemoqemuruntimeparser.cpp
@@ -32,6 +32,7 @@
#include "maemoqemusettings.h"
#include <qtsupport/baseqtversion.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QDir>
@@ -198,17 +199,17 @@ void MaemoQemuRuntimeParserV1::fillRuntimeInformation(MaemoQemuRuntime *runtime)
// This is complex because of extreme MADDE weirdness.
const QString root = m_maddeRoot + QLatin1Char('/');
const bool pathIsRelative = QFileInfo(runtime->m_bin).isRelative();
- runtime->m_bin =
- #ifdef Q_OS_WIN
- root + (pathIsRelative
- ? QLatin1String("madlib/") + runtime->m_bin // Fremantle.
- : runtime->m_bin) // Harmattan.
- + QLatin1String(".exe");
- #else
- pathIsRelative
- ? root + QLatin1String("madlib/") + runtime->m_bin // Fremantle.
- : runtime->m_bin; // Harmattan.
- #endif
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ runtime->m_bin =
+ root + (pathIsRelative
+ ? QLatin1String("madlib/") + runtime->m_bin // Fremantle.
+ : runtime->m_bin) // Harmattan.
+ + QLatin1String(".exe");
+ } else {
+ runtime->m_bin = pathIsRelative
+ ? root + QLatin1String("madlib/") + runtime->m_bin // Fremantle.
+ : runtime->m_bin; // Harmattan.
+ }
}
}
}
@@ -335,17 +336,17 @@ void MaemoQemuRuntimeParserV2::handleEnvironmentTag(MaemoQemuRuntime &runtime)
while (m_madInfoReader.readNextStartElement())
handleVariableTag(runtime);
-#ifdef Q_OS_WIN
- const QString root = QDir::toNativeSeparators(m_maddeRoot)
- + QLatin1Char('/');
- const QLatin1Char colon(';');
- const QLatin1String key("PATH");
- QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
- runtime.m_normalVars << MaemoQemuRuntime::Variable(key,
- root + QLatin1String("bin") + colon + env.value(key));
- runtime.m_normalVars << MaemoQemuRuntime::Variable(key,
- root + QLatin1String("madlib") + colon + env.value(key));
-#endif
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ const QString root = QDir::toNativeSeparators(m_maddeRoot)
+ + QLatin1Char('/');
+ const QLatin1Char colon(';');
+ const QLatin1String key("PATH");
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+ runtime.m_normalVars << MaemoQemuRuntime::Variable(key,
+ root + QLatin1String("bin") + colon + env.value(key));
+ runtime.m_normalVars << MaemoQemuRuntime::Variable(key,
+ root + QLatin1String("madlib") + colon + env.value(key));
+ }
}
void MaemoQemuRuntimeParserV2::handleVariableTag(MaemoQemuRuntime &runtime)
diff --git a/src/plugins/madde/maemoqtversion.cpp b/src/plugins/madde/maemoqtversion.cpp
index f79197a41d..f65d5c3ddd 100644
--- a/src/plugins/madde/maemoqtversion.cpp
+++ b/src/plugins/madde/maemoqtversion.cpp
@@ -34,6 +34,7 @@
#include <projectexplorer/kitinformation.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qtsupport/qtsupportconstants.h>
+#include <utils/hostosinfo.h>
#include <QCoreApplication>
#include <QFile>
@@ -124,10 +125,7 @@ QString MaemoQtVersion::description() const
bool MaemoQtVersion::supportsShadowBuilds() const
{
-#ifdef Q_OS_WIN
- return false;
-#endif
- return true;
+ return !Utils::HostOsInfo::isWindowsHost();
}
Core::Id MaemoQtVersion::deviceType() const
diff --git a/src/plugins/madde/maemoremotecopyfacility.cpp b/src/plugins/madde/maemoremotecopyfacility.cpp
index 71bf3cfdef..945ed62b52 100644
--- a/src/plugins/madde/maemoremotecopyfacility.cpp
+++ b/src/plugins/madde/maemoremotecopyfacility.cpp
@@ -32,12 +32,12 @@
#include <ssh/sshconnection.h>
#include <ssh/sshremoteprocessrunner.h>
+#include <utils/hostosinfo.h>
#include <QDir>
using namespace ProjectExplorer;
using namespace QSsh;
-using namespace RemoteLinux;
namespace Madde {
namespace Internal {
@@ -124,19 +124,19 @@ void MaemoRemoteCopyFacility::copyNextFile()
const DeployableFile &d = m_deployables.first();
QString sourceFilePath = m_mountPoint;
-#ifdef Q_OS_WIN
- const QString localFilePath = QDir::fromNativeSeparators(d.localFilePath);
- sourceFilePath += QLatin1Char('/') + localFilePath.at(0).toLower()
- + localFilePath.mid(2);
-#else
- sourceFilePath += d.localFilePath;
-#endif
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ const QString localFilePath = QDir::fromNativeSeparators(d.localFilePath().toString());
+ sourceFilePath += QLatin1Char('/') + localFilePath.at(0).toLower()
+ + localFilePath.mid(2);
+ } else {
+ sourceFilePath += d.localFilePath().toString();
+ }
QString command = QString::fromLatin1("%1 mkdir -p %3 && %1 cp -a %2 %3")
.arg(MaemoGlobal::remoteSudo(m_devConf->type(), m_devConf->sshParameters().userName),
- sourceFilePath, d.remoteDir);
+ sourceFilePath, d.remoteDirectory());
emit progress(tr("Copying file '%1' to directory '%2' on the device...")
- .arg(d.localFilePath, d.remoteDir));
+ .arg(d.localFilePath().toString(), d.remoteDirectory()));
m_copyRunner->run(command.toUtf8(), m_devConf->sshParameters());
}
diff --git a/src/plugins/madde/maemoremotecopyfacility.h b/src/plugins/madde/maemoremotecopyfacility.h
index 15d1d66ef7..ceabe8eeba 100644
--- a/src/plugins/madde/maemoremotecopyfacility.h
+++ b/src/plugins/madde/maemoremotecopyfacility.h
@@ -30,7 +30,7 @@
#ifndef MAEMOREMOTECOPYFACILITY_H
#define MAEMOREMOTECOPYFACILITY_H
-#include <remotelinux/deployablefile.h>
+#include <projectexplorer/deployablefile.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <QList>
@@ -53,14 +53,14 @@ public:
void copyFiles(QSsh::SshConnection *connection,
const ProjectExplorer::IDevice::ConstPtr &device,
- const QList<RemoteLinux::DeployableFile> &deployables, const QString &mountPoint);
+ const QList<ProjectExplorer::DeployableFile> &deployables, const QString &mountPoint);
void cancel();
signals:
void stdoutData(const QString &output);
void stderrData(const QString &output);
void progress(const QString &message);
- void fileCopied(const RemoteLinux::DeployableFile &deployable);
+ void fileCopied(const ProjectExplorer::DeployableFile &deployable);
void finished(const QString &errorMsg = QString());
private slots:
@@ -76,7 +76,7 @@ private:
QSsh::SshRemoteProcessRunner *m_copyRunner;
QSsh::SshRemoteProcessRunner *m_killProcess;
ProjectExplorer::IDevice::ConstPtr m_devConf;
- QList<RemoteLinux::DeployableFile> m_deployables;
+ QList<ProjectExplorer::DeployableFile> m_deployables;
QString m_mountPoint;
bool m_isCopying; // TODO: Redundant due to being in sync with m_copyRunner?
};
diff --git a/src/plugins/madde/maemorunconfiguration.h b/src/plugins/madde/maemorunconfiguration.h
index eab18edd76..59c6660f94 100644
--- a/src/plugins/madde/maemorunconfiguration.h
+++ b/src/plugins/madde/maemorunconfiguration.h
@@ -40,7 +40,8 @@ class MaemoRunConfiguration : public RemoteLinux::RemoteLinuxRunConfiguration
Q_OBJECT
public:
- MaemoRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &proFilePath);
+ MaemoRunConfiguration(ProjectExplorer::Target *parent, Core::Id id,
+ const QString &projectFilePath);
MaemoRunConfiguration(ProjectExplorer::Target *parent, MaemoRunConfiguration *source);
QVariantMap toMap() const;
diff --git a/src/plugins/madde/maemorunfactories.cpp b/src/plugins/madde/maemorunfactories.cpp
index 8b451113be..c21855a652 100644
--- a/src/plugins/madde/maemorunfactories.cpp
+++ b/src/plugins/madde/maemorunfactories.cpp
@@ -110,7 +110,8 @@ bool MaemoRunConfigurationFactory::canClone(Target *parent,
return false;
const RemoteLinuxRunConfiguration * const rlrc
= qobject_cast<RemoteLinuxRunConfiguration *>(source);
- QString idStr = QString::fromLatin1(source->id().name()) + QLatin1Char('.') + rlrc->proFilePath();
+ QString idStr = QString::fromLatin1(source->id().name()) + QLatin1Char('.')
+ + rlrc->projectFilePath();
return rlrc && canCreate(parent, Core::Id(idStr));
}
@@ -178,7 +179,7 @@ QList<RunConfiguration *> MaemoRunConfigurationFactory::runConfigurationsForNode
QList<ProjectExplorer::RunConfiguration *> result;
foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations())
if (MaemoRunConfiguration *mrc = qobject_cast<MaemoRunConfiguration *>(rc))
- if (mrc->proFilePath() == n->path())
+ if (mrc->projectFilePath() == n->path())
result << rc;
return result;
}
diff --git a/src/plugins/madde/qt4maemodeployconfiguration.cpp b/src/plugins/madde/qt4maemodeployconfiguration.cpp
index 90dfa29438..1ab972d7fe 100644
--- a/src/plugins/madde/qt4maemodeployconfiguration.cpp
+++ b/src/plugins/madde/qt4maemodeployconfiguration.cpp
@@ -33,23 +33,21 @@
#include "maddeuploadandinstallpackagesteps.h"
#include "maemoconstants.h"
#include "maemodeploybymountsteps.h"
-#include "maemodeployconfigurationwidget.h"
#include "maemoglobal.h"
#include "maemoinstalltosysrootstep.h"
#include "maemopackagecreationstep.h"
#include <coreplugin/icore.h>
#include <projectexplorer/buildsteplist.h>
+#include <projectexplorer/deployablefile.h>
#include <projectexplorer/target.h>
#include <projectexplorer/projectexplorer.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4project.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
-#include <remotelinux/deployablefile.h>
-#include <remotelinux/deployablefilesperprofile.h>
-#include <remotelinux/deploymentinfo.h>
#include <remotelinux/remotelinuxcheckforfreediskspacestep.h>
+#include <remotelinux/remotelinuxdeployconfigurationwidget.h>
#include <utils/qtcassert.h>
#include <QFileInfo>
@@ -62,38 +60,27 @@ using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
using namespace RemoteLinux;
-const char OldDeployConfigId[] = "2.2MaemoDeployConfig";
-const char DEPLOYMENT_ASSISTANT_SETTING[] = "RemoteLinux.DeploymentAssistant";
-
namespace Madde {
namespace Internal {
Qt4MaemoDeployConfiguration::Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target,
const Core::Id id, const QString &displayName)
: RemoteLinuxDeployConfiguration(target, id, displayName)
-{ init(); }
+{
+ init();
+}
Qt4MaemoDeployConfiguration::Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target,
Qt4MaemoDeployConfiguration *source)
: RemoteLinuxDeployConfiguration(target, source)
-{ init(); }
-
-QString Qt4MaemoDeployConfiguration::localDesktopFilePath(const DeployableFilesPerProFile *proFileInfo) const
{
- QTC_ASSERT(proFileInfo->projectType() == ApplicationTemplate, return QString());
-
- for (int i = 0; i < proFileInfo->rowCount(); ++i) {
- const DeployableFile &d = proFileInfo->deployableAt(i);
- if (QFileInfo(d.localFilePath).fileName().endsWith(QLatin1String(".desktop")))
- return d.localFilePath;
- }
- return QString();
+ init();
+ cloneSteps(source);
}
-
DeployConfigurationWidget *Qt4MaemoDeployConfiguration::configurationWidget() const
{
- return new MaemoDeployConfigurationWidget;
+ return new RemoteLinuxDeployConfigurationWidget;
}
Qt4MaemoDeployConfiguration::~Qt4MaemoDeployConfiguration() {}
@@ -113,33 +100,6 @@ Core::Id Qt4MaemoDeployConfiguration::harmattanId()
return Core::Id("DeployToHarmattan");
}
-DeploymentSettingsAssistant *Qt4MaemoDeployConfiguration::deploymentSettingsAssistant()
-{
- return static_cast<DeploymentSettingsAssistant *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_ASSISTANT_SETTING)).value<QObject *>());
-}
-
-QString Qt4MaemoDeployConfiguration::qmakeScope() const
-{
- Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(target()->kit());
-
- if (deviceType == Maemo5OsType)
- return QLatin1String("maemo5");
- if (deviceType == HarmattanOsType)
- return QLatin1String("contains(MEEGO_EDITION,harmattan)");
- return QString("unix");
-}
-
-QString Qt4MaemoDeployConfiguration::installPrefix() const
-{
- Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(target()->kit());
-
- if (deviceType == Maemo5OsType)
- return QLatin1String("/opt");
- if (deviceType == HarmattanOsType)
- return QLatin1String("/opt");
- return QLatin1String("/usr/local");
-}
-
void Qt4MaemoDeployConfiguration::debianDirChanged(const Utils::FileName &dir)
{
if (dir == DebianManager::debianDirectory(target()))
@@ -246,15 +206,6 @@ void Qt4MaemoDeployConfiguration::addFilesToProject(const QStringList &files)
void Qt4MaemoDeployConfiguration::init()
{
- // Make sure we have deploymentInfo, but create it only once:
- DeploymentSettingsAssistant *assistant
- = qobject_cast<DeploymentSettingsAssistant *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_ASSISTANT_SETTING)).value<QObject *>());
- if (!assistant) {
- assistant = new DeploymentSettingsAssistant(deploymentInfo(), static_cast<Qt4ProjectManager::Qt4Project *>(target()->project()));
- QVariant data = QVariant::fromValue(static_cast<QObject *>(assistant));
- target()->project()->setNamedSettings(QLatin1String(DEPLOYMENT_ASSISTANT_SETTING), data);
- }
-
connect(target()->project(), SIGNAL(fileListChanged()), this, SLOT(setupPackaging()));
}
@@ -327,25 +278,16 @@ DeployConfiguration *Qt4MaemoDeployConfigurationFactory::create(Target *parent,
bool Qt4MaemoDeployConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
{
Core::Id id = idFromMap(map);
- return canHandle(parent)
- && (availableCreationIds(parent).contains(id) || id == OldDeployConfigId)
+ return canHandle(parent) && availableCreationIds(parent).contains(id)
&& MaemoGlobal::supportsMaemoDevice(parent->kit());
}
DeployConfiguration *Qt4MaemoDeployConfigurationFactory::restore(Target *parent, const QVariantMap &map)
{
- if (!canRestore(parent, map))
- return 0;
- Core::Id id = idFromMap(map);
- Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(parent->kit());
- if (id == OldDeployConfigId) {
- if (deviceType == Maemo5OsType)
- id = Qt4MaemoDeployConfiguration::fremantleWithPackagingId();
- else if (deviceType == HarmattanOsType)
- id = Qt4MaemoDeployConfiguration::harmattanId();
- }
+ QTC_ASSERT(canRestore(parent, map), return 0);
+
Qt4MaemoDeployConfiguration * const dc
- = qobject_cast<Qt4MaemoDeployConfiguration *>(create(parent, id));
+ = qobject_cast<Qt4MaemoDeployConfiguration *>(create(parent, idFromMap(map)));
if (!dc->fromMap(map)) {
delete dc;
return 0;
diff --git a/src/plugins/madde/qt4maemodeployconfiguration.h b/src/plugins/madde/qt4maemodeployconfiguration.h
index 56b56fe35b..89f236190d 100644
--- a/src/plugins/madde/qt4maemodeployconfiguration.h
+++ b/src/plugins/madde/qt4maemodeployconfiguration.h
@@ -30,15 +30,9 @@
#ifndef QT4PROJECTMANAGER_QT4DEPLOYCONFIGURATION_H
#define QT4PROJECTMANAGER_QT4DEPLOYCONFIGURATION_H
-#include <remotelinux/deploymentsettingsassistant.h>
#include <remotelinux/remotelinuxdeployconfiguration.h>
#include <utils/fileutils.h>
-namespace RemoteLinux {
-class DeployableFilesPerProFile;
-class DeploymentSettingsAssistant;
-} // namespace RemoteLinux
-
namespace Madde {
namespace Internal {
@@ -70,17 +64,10 @@ public:
ProjectExplorer::DeployConfigurationWidget *configurationWidget() const;
- QString localDesktopFilePath(const RemoteLinux::DeployableFilesPerProFile *proFileInfo) const;
-
static Core::Id fremantleWithPackagingId();
static Core::Id fremantleWithoutPackagingId();
static Core::Id harmattanId();
- RemoteLinux::DeploymentSettingsAssistant *deploymentSettingsAssistant();
-
- QString qmakeScope() const;
- QString installPrefix() const;
-
private slots:
void debianDirChanged(const Utils::FileName &dir);
void setupPackaging();
diff --git a/src/plugins/mercurial/mercurial.qbs b/src/plugins/mercurial/mercurial.qbs
index 3875ddd979..fcf9752e5f 100644
--- a/src/plugins/mercurial/mercurial.qbs
+++ b/src/plugins/mercurial/mercurial.qbs
@@ -12,46 +12,38 @@ QtcPlugin {
Depends { name: "VcsBase" }
Depends { name: "Locator" }
- Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
-
files: [
- "mercurialplugin.cpp",
- "optionspage.cpp",
- "mercurialcontrol.cpp",
- "mercurialclient.cpp",
"annotationhighlighter.cpp",
- "mercurialeditor.cpp",
- "revertdialog.cpp",
- "srcdestdialog.cpp",
- "mercurialcommitwidget.cpp",
- "commiteditor.cpp",
- "clonewizardpage.cpp",
+ "annotationhighlighter.h",
"clonewizard.cpp",
- "mercurialsettings.cpp",
- "mercurialplugin.h",
+ "clonewizard.h",
+ "clonewizardpage.cpp",
+ "clonewizardpage.h",
+ "commiteditor.cpp",
+ "commiteditor.h",
"constants.h",
- "optionspage.h",
- "mercurialcontrol.h",
+ "mercurial.qrc",
+ "mercurialclient.cpp",
"mercurialclient.h",
- "annotationhighlighter.h",
- "mercurialeditor.h",
- "revertdialog.h",
- "srcdestdialog.h",
+ "mercurialcommitpanel.ui",
+ "mercurialcommitwidget.cpp",
"mercurialcommitwidget.h",
- "commiteditor.h",
- "clonewizardpage.h",
- "clonewizard.h",
+ "mercurialcontrol.cpp",
+ "mercurialcontrol.h",
+ "mercurialeditor.cpp",
+ "mercurialeditor.h",
+ "mercurialplugin.cpp",
+ "mercurialplugin.h",
+ "mercurialsettings.cpp",
"mercurialsettings.h",
+ "optionspage.cpp",
+ "optionspage.h",
"optionspage.ui",
+ "revertdialog.cpp",
+ "revertdialog.h",
"revertdialog.ui",
+ "srcdestdialog.cpp",
+ "srcdestdialog.h",
"srcdestdialog.ui",
- "mercurialcommitpanel.ui",
- "mercurial.qrc"
]
}
-
diff --git a/src/plugins/perforce/perforce.qbs b/src/plugins/perforce/perforce.qbs
index 9c4c3d881b..ee31c90959 100644
--- a/src/plugins/perforce/perforce.qbs
+++ b/src/plugins/perforce/perforce.qbs
@@ -12,42 +12,34 @@ QtcPlugin {
Depends { name: "VcsBase" }
Depends { name: "Locator" }
- Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
-
files: [
- "perforceplugin.h",
- "perforcechecker.h",
- "settingspage.h",
- "perforceeditor.h",
+ "annotationhighlighter.cpp",
+ "annotationhighlighter.h",
+ "changenumberdialog.cpp",
"changenumberdialog.h",
- "perforcesubmiteditor.h",
+ "changenumberdialog.ui",
+ "pendingchangesdialog.cpp",
"pendingchangesdialog.h",
- "perforceconstants.h",
- "perforceversioncontrol.h",
- "perforcesettings.h",
- "annotationhighlighter.h",
- "perforcesubmiteditorwidget.h",
- "perforceplugin.cpp",
+ "pendingchangesdialog.ui",
+ "perforce.qrc",
"perforcechecker.cpp",
- "settingspage.cpp",
+ "perforcechecker.h",
+ "perforceconstants.h",
"perforceeditor.cpp",
- "changenumberdialog.cpp",
- "perforcesubmiteditor.cpp",
- "pendingchangesdialog.cpp",
- "perforceversioncontrol.cpp",
+ "perforceeditor.h",
+ "perforceplugin.cpp",
+ "perforceplugin.h",
"perforcesettings.cpp",
- "annotationhighlighter.cpp",
+ "perforcesettings.h",
+ "perforcesubmiteditor.cpp",
+ "perforcesubmiteditor.h",
"perforcesubmiteditorwidget.cpp",
+ "perforcesubmiteditorwidget.h",
+ "perforceversioncontrol.cpp",
+ "perforceversioncontrol.h",
+ "settingspage.cpp",
+ "settingspage.h",
"settingspage.ui",
- "changenumberdialog.ui",
- "pendingchangesdialog.ui",
"submitpanel.ui",
- "perforce.qrc"
]
}
-
diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp
index 3d7ca3d410..4ddf5f2e1f 100644
--- a/src/plugins/perforce/perforceplugin.cpp
+++ b/src/plugins/perforce/perforceplugin.cpp
@@ -108,7 +108,7 @@ static inline const VcsBase::VcsBaseEditorParameters *findType(int ie)
static inline QString debugCodec(const QTextCodec *c)
{
- return c ? QString::fromAscii(c->name()) : QString::fromAscii("Null codec");
+ return c ? QString::fromLatin1(c->name()) : QString::fromLatin1("Null codec");
}
// Ensure adding "..." to relative paths which is p4's convention
@@ -623,7 +623,7 @@ void PerforcePlugin::startSubmitProject()
Utils::TempFileSaver saver;
saver.setAutoRemove(false);
- saver.write(result.stdOut.toAscii());
+ saver.write(result.stdOut.toLatin1());
if (!saver.finalize()) {
VcsBase::VcsBaseOutputWindow::instance()->appendError(saver.errorString());
cleanCommitMessageFile();
diff --git a/src/plugins/perforce/perforcesettings.cpp b/src/plugins/perforce/perforcesettings.cpp
index afe00cec9a..acb5438e45 100644
--- a/src/plugins/perforce/perforcesettings.cpp
+++ b/src/plugins/perforce/perforcesettings.cpp
@@ -33,6 +33,7 @@
#include <utils/qtcassert.h>
#include <utils/environment.h>
+#include <utils/hostosinfo.h>
#include <QDebug>
#include <QSettings>
@@ -56,12 +57,7 @@ enum { defaultTimeOutS = 30, defaultLogCount = 1000 };
static QString defaultCommand()
{
- QString rc;
- rc = QLatin1String("p4");
-#if defined(Q_OS_WIN32)
- rc.append(QLatin1String(".exe"));
-#endif
- return rc;
+ return QLatin1String("p4" QTC_HOST_EXE_SUFFIX);
}
namespace Perforce {
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 3e9b100c6d..d813e889bd 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -163,7 +163,7 @@ plugin_remotelinux.subdir = remotelinux
plugin_remotelinux.depends += plugin_coreplugin
plugin_remotelinux.depends += plugin_debugger
plugin_remotelinux.depends += plugin_projectexplorer
-plugin_remotelinux.depends += plugin_qt4projectmanager
+plugin_remotelinux.depends += plugin_qtsupport
plugin_android.subdir = android
plugin_android.depends = plugin_coreplugin
@@ -173,6 +173,7 @@ plugin_android.depends += plugin_qt4projectmanager
plugin_madde.subdir = madde
plugin_madde.depends += plugin_remotelinux
+plugin_madde.depends += plugin_qt4projectmanager
plugin_locator.subdir = locator
plugin_locator.depends = plugin_coreplugin
diff --git a/src/plugins/projectexplorer/abi.cpp b/src/plugins/projectexplorer/abi.cpp
index 223f211034..af2d77c949 100644
--- a/src/plugins/projectexplorer/abi.cpp
+++ b/src/plugins/projectexplorer/abi.cpp
@@ -697,7 +697,7 @@ QList<Abi> Abi::abisOfBinary(const Utils::FileName &path)
quint64 fileNameOffset = 0;
if (fileName.startsWith(QLatin1String("#1/")))
fileNameOffset = fileName.mid(3).toInt();
- const QString fileLength = QString::fromAscii(data.mid(48, 10));
+ const QString fileLength = QString::fromLatin1(data.mid(48, 10));
int toSkip = 60 + fileNameOffset;
offset += fileLength.toInt() + 60 /* header */;
diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp
index ddeca1614e..849c16c592 100644
--- a/src/plugins/projectexplorer/applicationlauncher.cpp
+++ b/src/plugins/projectexplorer/applicationlauncher.cpp
@@ -28,13 +28,13 @@
****************************************************************************/
#include "applicationlauncher.h"
-#include "consoleprocess.h"
#ifdef Q_OS_WIN
#include "windebuginterface.h"
#endif
#include <coreplugin/icore.h>
+#include <utils/consoleprocess.h>
#include <utils/qtcprocess.h>
#ifdef Q_OS_WIN
#include <utils/winutils.h>
diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp
index f9387779b3..ee5e2085ed 100644
--- a/src/plugins/projectexplorer/buildconfiguration.cpp
+++ b/src/plugins/projectexplorer/buildconfiguration.cpp
@@ -281,6 +281,7 @@ IBuildConfigurationFactory::IBuildConfigurationFactory(QObject *parent) :
IBuildConfigurationFactory::~IBuildConfigurationFactory()
{ }
+// restore
IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, const QVariantMap &map)
{
QList<IBuildConfigurationFactory *> factories
@@ -292,6 +293,7 @@ IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, con
return 0;
}
+// create
IBuildConfigurationFactory * IBuildConfigurationFactory::find(Target *parent)
{
QList<IBuildConfigurationFactory *> factories
@@ -303,4 +305,15 @@ IBuildConfigurationFactory * IBuildConfigurationFactory::find(Target *parent)
return 0;
}
+// clone
+IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, BuildConfiguration *bc)
+{
+ QList<IBuildConfigurationFactory *> factories
+ = ExtensionSystem::PluginManager::instance()->getObjects<IBuildConfigurationFactory>();
+ foreach (IBuildConfigurationFactory *factory, factories) {
+ if (factory->canClone(parent, bc))
+ return factory;
+ }
+ return 0;
+}
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/buildconfiguration.h b/src/plugins/projectexplorer/buildconfiguration.h
index 981d72b13c..3f530b54d0 100644
--- a/src/plugins/projectexplorer/buildconfiguration.h
+++ b/src/plugins/projectexplorer/buildconfiguration.h
@@ -144,6 +144,7 @@ public:
static IBuildConfigurationFactory *find(Target *parent, const QVariantMap &map);
static IBuildConfigurationFactory *find(Target *parent);
+ static IBuildConfigurationFactory *find(Target *parent, BuildConfiguration *bc);
signals:
void availableCreationIdsChanged();
diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp
index b09305bfc0..4fcac55256 100644
--- a/src/plugins/projectexplorer/buildmanager.cpp
+++ b/src/plugins/projectexplorer/buildmanager.cpp
@@ -48,6 +48,7 @@
#include <utils/qtcassert.h>
#include <QDir>
+#include <QPointer>
#include <QTime>
#include <QTimer>
#include <QMetaType>
@@ -97,7 +98,7 @@ struct BuildManagerPrivate {
int m_maxProgress;
QFutureInterface<void> *m_progressFutureInterface;
QFutureWatcher<void> m_progressWatcher;
- QWeakPointer<Core::FutureProgress> m_futureProgress;
+ QPointer<Core::FutureProgress> m_futureProgress;
};
BuildManagerPrivate::BuildManagerPrivate() :
@@ -274,7 +275,7 @@ void BuildManager::clearBuildQueue()
d->m_progressWatcher.setFuture(QFuture<void>());
delete d->m_progressFutureInterface;
d->m_progressFutureInterface = 0;
- d->m_futureProgress.clear();
+ d->m_futureProgress = 0;
d->m_maxProgress = 0;
emit buildQueueFinished(false);
@@ -321,10 +322,10 @@ void BuildManager::startBuildQueue(const QStringList &preambleMessage)
d->m_taskHub->clearTasks(Core::Id(Constants::TASK_CATEGORY_COMPILE));
d->m_taskHub->clearTasks(Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
progressManager->setApplicationLabel(QString());
- d->m_futureProgress = QWeakPointer<Core::FutureProgress>(progressManager->addTask(d->m_progressFutureInterface->future(),
+ d->m_futureProgress = progressManager->addTask(d->m_progressFutureInterface->future(),
QString(),
QLatin1String(Constants::TASK_BUILD),
- Core::ProgressManager::KeepOnFinish | Core::ProgressManager::ShowInApplicationIcon));
+ Core::ProgressManager::KeepOnFinish | Core::ProgressManager::ShowInApplicationIcon);
connect(d->m_futureProgress.data(), SIGNAL(clicked()), this, SLOT(showBuildResults()));
d->m_futureProgress.data()->setWidget(new Internal::BuildProgress(d->m_taskWindow));
d->m_progress = 0;
diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp
index f48e16dd68..71a53d2b68 100644
--- a/src/plugins/projectexplorer/buildstepspage.cpp
+++ b/src/plugins/projectexplorer/buildstepspage.cpp
@@ -38,6 +38,7 @@
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
#include <utils/detailswidget.h>
+#include <utils/hostosinfo.h>
#include <QSignalMapper>
@@ -53,6 +54,7 @@
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
+using namespace Utils;
ToolWidget::ToolWidget(QWidget *parent)
: Utils::FadingPanel(parent), m_buildStepEnabled(true)
@@ -67,11 +69,7 @@ ToolWidget::ToolWidget(QWidget *parent)
hbox->setContentsMargins(0, 0, 0, 0);
hbox->setSpacing(0);
m_firstWidget->setLayout(hbox);
-#ifdef Q_OS_MAC
- QSize buttonSize(20, 20);
-#else
- QSize buttonSize(20, 26);
-#endif
+ QSize buttonSize(20, HostOsInfo::isMacHost() ? 20 : 26);
m_disableButton = new QToolButton(m_firstWidget);
m_disableButton->setAutoRaise(true);
@@ -138,17 +136,15 @@ void ToolWidget::setBuildStepEnabled(bool b)
{
m_buildStepEnabled = b;
if (m_buildStepEnabled) {
-#ifdef Q_OS_MAC
- m_firstWidget->setOpacity(m_targetOpacity);
-#else
- m_firstWidget->fadeTo(m_targetOpacity);
-#endif
+ if (HostOsInfo::isMacHost())
+ m_firstWidget->setOpacity(m_targetOpacity);
+ else
+ m_firstWidget->fadeTo(m_targetOpacity);
} else {
-#ifdef Q_OS_MAC
- m_firstWidget->setOpacity(1.0);
-#else
- m_firstWidget->fadeTo(1.0);
-#endif
+ if (HostOsInfo::isMacHost())
+ m_firstWidget->setOpacity(1.0);
+ else
+ m_firstWidget->fadeTo(1.0);
}
m_disableButton->setChecked(!b);
}
@@ -461,9 +457,8 @@ void BuildStepListWidget::setupUi()
hboxLayout->addStretch(10);
-#ifdef Q_OS_MAC
- m_addButton->setAttribute(Qt::WA_MacSmallSize);
-#endif
+ if (HostOsInfo::isMacHost())
+ m_addButton->setAttribute(Qt::WA_MacSmallSize);
m_vbox->addLayout(hboxLayout);
diff --git a/src/plugins/projectexplorer/buildtargetinfo.h b/src/plugins/projectexplorer/buildtargetinfo.h
index d368d2d371..9151cb4b61 100644
--- a/src/plugins/projectexplorer/buildtargetinfo.h
+++ b/src/plugins/projectexplorer/buildtargetinfo.h
@@ -34,6 +34,7 @@
#include <utils/fileutils.h>
#include <QList>
+#include <QSet>
namespace ProjectExplorer {
@@ -58,6 +59,22 @@ public:
bool isValid() const { return !targetFilePath.isEmpty(); }
};
+inline bool operator==(const BuildTargetInfo &ti1, const BuildTargetInfo &ti2)
+{
+ return ti1.targetFilePath == ti2.targetFilePath;
+}
+
+inline bool operator!=(const BuildTargetInfo &ti1, const BuildTargetInfo &ti2)
+{
+ return !(ti1 == ti2);
+}
+
+inline uint qHash(const BuildTargetInfo &ti)
+{
+ return qHash(ti.targetFilePath);
+}
+
+
class PROJECTEXPLORER_EXPORT BuildTargetInfoList
{
public:
@@ -78,6 +95,16 @@ public:
QList<BuildTargetInfo> list;
};
+inline bool operator==(const BuildTargetInfoList &til1, const BuildTargetInfoList &til2)
+{
+ return til1.list.toSet() == til2.list.toSet();
+}
+
+inline bool operator!=(const BuildTargetInfoList &til1, const BuildTargetInfoList &til2)
+{
+ return !(til1 == til2);
+}
+
} // namespace ProjectExplorer
#endif // BUILDTARGETINFO_H
diff --git a/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp b/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
index acc599e996..5aeaa6fac4 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
+++ b/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
@@ -31,6 +31,7 @@
#include "customwizard.h"
#include "customwizardparameters.h"
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QProcess>
@@ -65,15 +66,16 @@ QStringList fixGeneratorScript(const QString &configFile, QString binary)
}
} // not absolute
QStringList rc(binary);
-#ifdef Q_OS_WIN // Windows: Cannot run scripts by QProcess, do 'cmd /c'
- const QString extension = binaryInfo.suffix();
- if (!extension.isEmpty() && extension.compare(QLatin1String("exe"), Qt::CaseInsensitive) != 0) {
- rc.push_front(QLatin1String("/C"));
- rc.push_front(QString::fromLocal8Bit(qgetenv("COMSPEC")));
- if (rc.front().isEmpty())
- rc.front() = QLatin1String("cmd.exe");
+ if (Utils::HostOsInfo::isWindowsHost()) { // Windows: Cannot run scripts by QProcess, do 'cmd /c'
+ const QString extension = binaryInfo.suffix();
+ if (!extension.isEmpty() && extension.compare(QLatin1String("exe"),
+ Qt::CaseInsensitive) != 0) {
+ rc.push_front(QLatin1String("/C"));
+ rc.push_front(QString::fromLocal8Bit(qgetenv("COMSPEC")));
+ if (rc.front().isEmpty())
+ rc.front() = QLatin1String("cmd.exe");
+ }
}
-#endif
return rc;
}
diff --git a/src/plugins/projectexplorer/dependenciespanel.cpp b/src/plugins/projectexplorer/dependenciespanel.cpp
index b7dbd2ee5d..5f85e0bf37 100644
--- a/src/plugins/projectexplorer/dependenciespanel.cpp
+++ b/src/plugins/projectexplorer/dependenciespanel.cpp
@@ -81,9 +81,10 @@ DependenciesModel::~DependenciesModel()
void DependenciesModel::resetModel()
{
+ beginResetModel();
m_projects = m_session->projects();
m_projects.removeAll(m_project);
- reset();
+ endResetModel();
}
int DependenciesModel::rowCount(const QModelIndex &index) const
diff --git a/src/plugins/projectexplorer/deployconfiguration.cpp b/src/plugins/projectexplorer/deployconfiguration.cpp
index b4b5c9e97e..adf95a56b0 100644
--- a/src/plugins/projectexplorer/deployconfiguration.cpp
+++ b/src/plugins/projectexplorer/deployconfiguration.cpp
@@ -64,7 +64,8 @@ DeployConfiguration::DeployConfiguration(Target *target, const Core::Id id) :
}
DeployConfiguration::DeployConfiguration(Target *target, DeployConfiguration *source) :
- ProjectConfiguration(target, source)
+ ProjectConfiguration(target, source),
+ m_stepList(0)
{
Q_ASSERT(target);
// Do not clone stepLists here, do that in the derived constructor instead
@@ -150,6 +151,21 @@ void DeployConfiguration::cloneSteps(DeployConfiguration *source)
}
///
+// DefaultDeployConfiguration
+///
+DefaultDeployConfiguration::DefaultDeployConfiguration(Target *target, const Core::Id id)
+ : DeployConfiguration(target, id)
+{
+
+}
+
+DefaultDeployConfiguration::DefaultDeployConfiguration(Target *target, DeployConfiguration *source)
+ : DeployConfiguration(target, source)
+{
+ cloneSteps(source);
+}
+
+///
// DeployConfigurationFactory
///
@@ -186,7 +202,7 @@ DeployConfiguration *DeployConfigurationFactory::create(Target *parent, const Co
{
if (!canCreate(parent, id))
return 0;
- return new DeployConfiguration(parent, id);
+ return new DefaultDeployConfiguration(parent, id);
}
bool DeployConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
@@ -198,7 +214,7 @@ DeployConfiguration *DeployConfigurationFactory::restore(Target *parent, const Q
{
if (!canRestore(parent, map))
return 0;
- DeployConfiguration *dc = new DeployConfiguration(parent, idFromMap(map));
+ DefaultDeployConfiguration *dc = new DefaultDeployConfiguration(parent, idFromMap(map));
if (!dc->fromMap(map)) {
delete dc;
return 0;
@@ -215,7 +231,7 @@ DeployConfiguration *DeployConfigurationFactory::clone(Target *parent, DeployCon
{
if (!canClone(parent, product))
return 0;
- return new DeployConfiguration(parent, product);
+ return new DefaultDeployConfiguration(parent, product);
}
DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent, const QVariantMap &map)
@@ -240,6 +256,17 @@ DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent)
return 0;
}
+DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent, DeployConfiguration *dc)
+{
+ QList<DeployConfigurationFactory *> factories
+ = ExtensionSystem::PluginManager::instance()->getObjects<DeployConfigurationFactory>();
+ foreach (DeployConfigurationFactory *factory, factories) {
+ if (factory->canClone(parent, dc))
+ return factory;
+ }
+ return 0;
+}
+
bool DeployConfigurationFactory::canHandle(Target *parent) const
{
if (!parent->project()->supportsKit(parent->kit()))
diff --git a/src/plugins/projectexplorer/deployconfiguration.h b/src/plugins/projectexplorer/deployconfiguration.h
index 015ec40129..28f70fd83c 100644
--- a/src/plugins/projectexplorer/deployconfiguration.h
+++ b/src/plugins/projectexplorer/deployconfiguration.h
@@ -77,11 +77,18 @@ protected:
bool fromMap(const QVariantMap &map);
private:
- friend class DeployConfigurationFactory;
-
BuildStepList *m_stepList;
};
+class PROJECTEXPLORER_EXPORT DefaultDeployConfiguration : public DeployConfiguration
+{
+ Q_OBJECT
+ friend class DeployConfigurationFactory; // for the ctors
+protected:
+ DefaultDeployConfiguration(Target *target, const Core::Id id);
+ DefaultDeployConfiguration(Target *target, DeployConfiguration *source);
+};
+
class PROJECTEXPLORER_EXPORT DeployConfigurationFactory :
public QObject
{
@@ -106,6 +113,7 @@ public:
static DeployConfigurationFactory *find(Target *parent, const QVariantMap &map);
static DeployConfigurationFactory *find(Target *parent);
+ static DeployConfigurationFactory *find(Target *parent, DeployConfiguration *dc);
signals:
void availableCreationIdsChanged();
diff --git a/src/plugins/projectexplorer/environmentitemswidget.cpp b/src/plugins/projectexplorer/environmentitemswidget.cpp
index a9eb3d60de..d1b6f38888 100644
--- a/src/plugins/projectexplorer/environmentitemswidget.cpp
+++ b/src/plugins/projectexplorer/environmentitemswidget.cpp
@@ -30,6 +30,7 @@
#include "environmentitemswidget.h"
#include <utils/environment.h>
+#include <utils/hostosinfo.h>
#include <texteditor/snippets/snippeteditor.h>
#include <texteditor/texteditorsettings.h>
@@ -53,9 +54,8 @@ QList<Utils::EnvironmentItem> EnvironmentItemsWidgetPrivate::cleanUp(
QSet<QString> uniqueSet;
for (int i = items.count() - 1; i >= 0; i--) {
Utils::EnvironmentItem item = items.at(i);
-#if defined(Q_OS_WIN)
- item.name = item.name.toUpper();
-#endif
+ if (Utils::HostOsInfo::isWindowsHost())
+ item.name = item.name.toUpper();
const QString &itemName = item.name;
QString emptyName = itemName;
emptyName.remove(QLatin1Char(' '));
diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp
index ad1c22cfa2..765720f84b 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -37,6 +37,7 @@
#include <utils/detailswidget.h>
#include <utils/environment.h>
+#include <utils/hostosinfo.h>
#include <utils/synchronousprocess.h>
#include <utils/qtcassert.h>
#include <utils/pathchooser.h>
@@ -131,19 +132,19 @@ static QByteArray gccPredefinedMacros(const FileName &gcc, const QStringList &ar
arguments << QLatin1String("-");
QByteArray predefinedMacros = runGcc(gcc, arguments, env);
-#ifdef Q_OS_MAC
- // Turn off flag indicating Apple's blocks support
- const QByteArray blocksDefine("#define __BLOCKS__ 1");
- const QByteArray blocksUndefine("#undef __BLOCKS__");
- const int idx = predefinedMacros.indexOf(blocksDefine);
- if (idx != -1) {
- predefinedMacros.replace(idx, blocksDefine.length(), blocksUndefine);
- }
+ if (Utils::HostOsInfo::isMacHost()) {
+ // Turn off flag indicating Apple's blocks support
+ const QByteArray blocksDefine("#define __BLOCKS__ 1");
+ const QByteArray blocksUndefine("#undef __BLOCKS__");
+ const int idx = predefinedMacros.indexOf(blocksDefine);
+ if (idx != -1) {
+ predefinedMacros.replace(idx, blocksDefine.length(), blocksUndefine);
+ }
- // Define __strong and __weak (used for Apple's GC extension of C) to be empty
- predefinedMacros.append("#define __strong\n");
- predefinedMacros.append("#define __weak\n");
-#endif // Q_OS_MAC
+ // Define __strong and __weak (used for Apple's GC extension of C) to be empty
+ predefinedMacros.append("#define __strong\n");
+ predefinedMacros.append("#define __weak\n");
+ }
return predefinedMacros;
}
@@ -589,11 +590,11 @@ ToolChain *Internal::GccToolChainFactory::create()
QList<ToolChain *> Internal::GccToolChainFactory::autoDetect()
{
QList<ToolChain *> tcs;
-#ifdef Q_OS_MAC
- // Old mac compilers needed to support macx-gccXY mkspecs:
- tcs.append(autoDetectToolchains(QLatin1String("g++-4.0"), Abi::hostAbi()));
- tcs.append(autoDetectToolchains(QLatin1String("g++-4.2"), Abi::hostAbi()));
-#endif
+ if (Utils::HostOsInfo::isMacHost()) {
+ // Old mac compilers needed to support macx-gccXY mkspecs:
+ tcs.append(autoDetectToolchains(QLatin1String("g++-4.0"), Abi::hostAbi()));
+ tcs.append(autoDetectToolchains(QLatin1String("g++-4.2"), Abi::hostAbi()));
+ }
tcs.append(autoDetectToolchains(QLatin1String("g++"), Abi::hostAbi()));
return tcs;
@@ -767,12 +768,12 @@ QString ClangToolChain::typeDisplayName() const
QString ClangToolChain::makeCommand(const Utils::Environment &environment) const
{
QStringList makes;
-#if defined(Q_OS_WIN)
- makes << QLatin1String("mingw32-make.exe");
- makes << QLatin1String("make.exe");
-#else
- makes << QLatin1String("make");
-#endif
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ makes << QLatin1String("mingw32-make.exe");
+ makes << QLatin1String("make.exe");
+ } else {
+ makes << QLatin1String("make");
+ }
QString tmp;
foreach (const QString &make, makes) {
@@ -877,31 +878,30 @@ QString MingwToolChain::typeDisplayName() const
QList<FileName> MingwToolChain::suggestedMkspecList() const
{
-#if defined(Q_OS_WIN)
- return QList<FileName>() << FileName::fromString(QLatin1String("win32-g++"));
-#elif defined(Q_OS_LINUX)
- if (version().startsWith("4.6."))
- return QList<FileName>()
- << FileName::fromString(QLatin1String("win32-g++-4.6-cross"))
- << FileName::fromString(QLatin1String("unsupported/win32-g++-4.6-cross"));
- else
- return QList<FileName>()
- << FileName::fromString(QLatin1String("win32-g++-cross"))
- << FileName::fromString(QLatin1String("unsupported/win32-g++-cross"));
-#else
+ if (Utils::HostOsInfo::isWindowsHost())
+ return QList<FileName>() << FileName::fromString(QLatin1String("win32-g++"));
+ if (Utils::HostOsInfo::isLinuxHost()) {
+ if (version().startsWith("4.6."))
+ return QList<FileName>()
+ << FileName::fromString(QLatin1String("win32-g++-4.6-cross"))
+ << FileName::fromString(QLatin1String("unsupported/win32-g++-4.6-cross"));
+ else
+ return QList<FileName>()
+ << FileName::fromString(QLatin1String("win32-g++-cross"))
+ << FileName::fromString(QLatin1String("unsupported/win32-g++-cross"));
+ }
return QList<FileName>();
-#endif
}
QString MingwToolChain::makeCommand(const Utils::Environment &environment) const
{
QStringList makes;
-#ifdef Q_OS_WIN
+ if (Utils::HostOsInfo::isWindowsHost()) {
makes << QLatin1String("mingw32-make.exe");
makes << QLatin1String("make.exe");
-#else
+ } else {
makes << QLatin1String("make");
-#endif
+ }
QString tmp;
foreach (const QString &make, makes) {
diff --git a/src/plugins/projectexplorer/images/targetchangebutton.png b/src/plugins/projectexplorer/images/targetchangebutton.png
new file mode 100644
index 0000000000..1311d38ef8
--- /dev/null
+++ b/src/plugins/projectexplorer/images/targetchangebutton.png
Binary files differ
diff --git a/src/plugins/projectexplorer/images/targetchangebutton2.png b/src/plugins/projectexplorer/images/targetchangebutton2.png
new file mode 100644
index 0000000000..d5d5cfefd9
--- /dev/null
+++ b/src/plugins/projectexplorer/images/targetchangebutton2.png
Binary files differ
diff --git a/src/plugins/projectexplorer/images/targetremovebutton.png b/src/plugins/projectexplorer/images/targetremovebutton.png
deleted file mode 100644
index 15e8502ccf..0000000000
--- a/src/plugins/projectexplorer/images/targetremovebutton.png
+++ /dev/null
Binary files differ
diff --git a/src/plugins/projectexplorer/images/targetremovebuttondark.png b/src/plugins/projectexplorer/images/targetremovebuttondark.png
deleted file mode 100644
index c1ec33f910..0000000000
--- a/src/plugins/projectexplorer/images/targetremovebuttondark.png
+++ /dev/null
Binary files differ
diff --git a/src/plugins/projectexplorer/processstep.h b/src/plugins/projectexplorer/processstep.h
index a9b47b6569..18d559becf 100644
--- a/src/plugins/projectexplorer/processstep.h
+++ b/src/plugins/projectexplorer/processstep.h
@@ -32,7 +32,8 @@
#include "ui_processstep.h"
#include "abstractprocessstep.h"
-#include "environment.h"
+
+#include <utils/environment.h>
namespace ProjectExplorer {
diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index a79362e6a5..ca42de0f92 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -32,7 +32,6 @@
#include "buildconfiguration.h"
#include "deployconfiguration.h"
#include "editorconfiguration.h"
-#include "environment.h"
#include "projectexplorer.h"
#include "projectexplorerconstants.h"
#include "projectnodes.h"
@@ -48,6 +47,7 @@
#include <projectexplorer/kitmanager.h>
#include <limits>
#include <utils/qtcassert.h>
+#include <utils/environment.h>
/*!
\class ProjectExplorer::Project
@@ -425,7 +425,7 @@ QVariant Project::namedSettings(const QString &name) const
return d->m_pluginSettings.value(name);
}
-void Project::setNamedSettings(const QString &name, QVariant &value)
+void Project::setNamedSettings(const QString &name, const QVariant &value)
{
if (value.isNull())
d->m_pluginSettings.remove(name);
diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h
index b67304cb80..0385f28c6e 100644
--- a/src/plugins/projectexplorer/project.h
+++ b/src/plugins/projectexplorer/project.h
@@ -118,7 +118,7 @@ public:
virtual Core::Context projectLanguage() const;
QVariant namedSettings(const QString &name) const;
- void setNamedSettings(const QString &name, QVariant &value);
+ void setNamedSettings(const QString &name, const QVariant &value);
virtual bool needsConfiguration() const;
virtual void configureAsExampleProject(const QStringList &platforms);
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index c7dc84bbe9..33b6e7b232 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -1081,6 +1081,8 @@ void ProjectExplorerPlugin::closeAllProjects()
d->m_session->closeAllProjects();
updateActions();
+
+ Core::ModeManager::activateMode(Core::Id(Core::Constants::MODE_WELCOME));
}
void ProjectExplorerPlugin::extensionsInitialized()
@@ -1447,6 +1449,21 @@ void ProjectExplorerPlugin::determineSessionToRestoreAtStartup()
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
}
+// Return a list of glob patterns for project files ("*.pro", etc), use first, main pattern only.
+static inline QStringList projectFileGlobs()
+{
+ QStringList result;
+ const Core::MimeDatabase *mimeDatabase = Core::ICore::instance()->mimeDatabase();
+ foreach (const IProjectManager *ipm, ExtensionSystem::PluginManager::getObjects<IProjectManager>()) {
+ if (const Core::MimeType mimeType = mimeDatabase->findByType(ipm->mimeType())) {
+ const QList<Core::MimeGlobPattern> patterns = mimeType.globPatterns();
+ if (!patterns.isEmpty())
+ result.push_back(patterns.front().regExp().pattern());
+ }
+ }
+ return result;
+}
+
/*!
\fn void ProjectExplorerPlugin::restoreSession()
@@ -1462,8 +1479,55 @@ void ProjectExplorerPlugin::restoreSession()
// We have command line arguments, try to find a session in them
QStringList arguments = ExtensionSystem::PluginManager::arguments();
- arguments.removeOne(d->m_sessionToRestoreAtStartup);
-
+ if (!d->m_sessionToRestoreAtStartup.isEmpty() && !arguments.isEmpty())
+ arguments.removeOne(d->m_sessionToRestoreAtStartup);
+
+ // Massage the argument list.
+ // Be smart about directories: If there is a session of that name, load it.
+ // Other than that, look for project files in it. The idea is to achieve
+ // 'Do what I mean' functionality when starting Creator in a directory with
+ // the single command line argument '.' and avoid editor warnings about not
+ // being able to open directories.
+ // In addition, convert "filename" "+45" or "filename" ":23" into
+ // "filename+45" and "filename:23".
+ if (!arguments.isEmpty()) {
+ const QStringList sessions = d->m_session->sessions();
+ QStringList projectGlobs = projectFileGlobs();
+ for (int a = 0; a < arguments.size(); ) {
+ const QString &arg = arguments.at(a);
+ const QFileInfo fi(arg);
+ if (fi.isDir()) {
+ const QDir dir(fi.absoluteFilePath());
+ // Does the directory name match a session?
+ if (d->m_sessionToRestoreAtStartup.isEmpty()
+ && sessions.contains(dir.dirName())) {
+ d->m_sessionToRestoreAtStartup = dir.dirName();
+ arguments.removeAt(a);
+ continue;
+ } else {
+ // Are there project files in that directory?
+ const QFileInfoList proFiles
+ = dir.entryInfoList(projectGlobs, QDir::Files);
+ if (!proFiles.isEmpty()) {
+ arguments[a] = proFiles.front().absoluteFilePath();
+ ++a;
+ continue;
+ }
+ }
+ // Cannot handle: Avoid mime type warning for directory.
+ qWarning("Skipping directory '%s' passed on to command line.",
+ qPrintable(QDir::toNativeSeparators(arg)));
+ arguments.removeAt(a);
+ continue;
+ } // Done directories.
+ // Converts "filename" "+45" or "filename" ":23" into "filename+45" and "filename:23"
+ if (a && (arg.startsWith(QLatin1Char('+')) || arg.startsWith(QLatin1Char(':')))) {
+ arguments[a - 1].append(arguments.takeAt(a));
+ continue;
+ }
+ ++a;
+ } // for arguments
+ } // !arguments.isEmpty()
// Restore latest session or what was passed on the command line
if (!d->m_sessionToRestoreAtStartup.isEmpty())
d->m_session->loadSession(d->m_sessionToRestoreAtStartup);
@@ -1475,19 +1539,7 @@ void ProjectExplorerPlugin::restoreSession()
connect(d->m_welcomePage, SIGNAL(requestSession(QString)), this, SLOT(loadSession(QString)));
connect(d->m_welcomePage, SIGNAL(requestProject(QString)), this, SLOT(openProjectWelcomePage(QString)));
- QStringList combinedList;
- // Converts "filename" "+45" or "filename" ":23"
- // into "filename+45" and "filename:23"
- foreach (const QString &str, arguments) {
- if (!combinedList.isEmpty() && (str.startsWith(QLatin1Char('+'))
- || str.startsWith(QLatin1Char(':')))) {
- combinedList.last().append(str);
- } else {
- combinedList << str;
- }
- }
-
- Core::ICore::openFiles(combinedList, Core::ICore::OpenFilesFlags(Core::ICore::CanContainLineNumbers | Core::ICore::SwitchMode));
+ Core::ICore::openFiles(arguments, Core::ICore::OpenFilesFlags(Core::ICore::CanContainLineNumbers | Core::ICore::SwitchMode));
updateActions();
}
diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs
index 9e368cbc93..d5a1127af4 100644
--- a/src/plugins/projectexplorer/projectexplorer.qbs
+++ b/src/plugins/projectexplorer/projectexplorer.qbs
@@ -1,5 +1,7 @@
import qbs.base 1.0
+
import "../QtcPlugin.qbs" as QtcPlugin
+import "../../../qbs/defaults.js" as Defaults
QtcPlugin {
name: "ProjectExplorer"
@@ -13,78 +15,95 @@ QtcPlugin {
Depends { name: "cpp" }
cpp.defines: base.concat(["QTC_CPU=X86Architecture"])
- cpp.includePaths: [
- ".",
- "..",
- "../../libs",
- "../../libs/utils",
+ cpp.includePaths: base.concat([
"customwizard",
- "publishing",
- buildDirectory
- ]
+ "publishing"
+ ])
files: [
- "doubletabwidget.ui",
- "processstep.ui",
- "projectexplorer.qrc",
- "sessiondialog.ui",
- "targetsettingswidget.ui",
- "projectwizardpage.ui",
+ "abi.cpp",
"abi.h",
"abiwidget.cpp",
"abiwidget.h",
"abstractprocessstep.cpp",
"abstractprocessstep.h",
"allprojectsfilter.cpp",
+ "allprojectsfilter.h",
"allprojectsfind.cpp",
"allprojectsfind.h",
"applicationlauncher.cpp",
"applicationlauncher.h",
+ "applicationrunconfiguration.cpp",
"applicationrunconfiguration.h",
+ "appoutputpane.cpp",
"appoutputpane.h",
"baseprojectwizarddialog.cpp",
"baseprojectwizarddialog.h",
+ "buildconfiguration.cpp",
"buildconfiguration.h",
"buildconfigurationmodel.cpp",
"buildconfigurationmodel.h",
"buildenvironmentwidget.cpp",
"buildenvironmentwidget.h",
+ "buildmanager.cpp",
"buildmanager.h",
+ "buildprogress.cpp",
"buildprogress.h",
+ "buildsettingspropertiespage.cpp",
"buildsettingspropertiespage.h",
"buildstep.cpp",
+ "buildstep.h",
"buildsteplist.cpp",
"buildsteplist.h",
+ "buildstepspage.cpp",
"buildstepspage.h",
+ "buildtargetinfo.h",
"cesdkhandler.cpp",
"cesdkhandler.h",
+ "clangparser.cpp",
"clangparser.h",
+ "codestylesettingspropertiespage.cpp",
"codestylesettingspropertiespage.h",
"codestylesettingspropertiespage.ui",
"compileoutputwindow.cpp",
"compileoutputwindow.h",
+ "copytaskhandler.cpp",
"copytaskhandler.h",
"corelistenercheckingforrunningbuild.cpp",
"corelistenercheckingforrunningbuild.h",
"currentprojectfilter.cpp",
+ "currentprojectfilter.h",
"currentprojectfind.cpp",
"currentprojectfind.h",
+ "dependenciespanel.cpp",
"dependenciespanel.h",
+ "deployablefile.cpp",
+ "deployablefile.h",
"deployconfiguration.cpp",
"deployconfiguration.h",
"deployconfigurationmodel.cpp",
"deployconfigurationmodel.h",
+ "deploymentdata.h",
+ "doubletabwidget.cpp",
"doubletabwidget.h",
+ "doubletabwidget.ui",
"editorconfiguration.cpp",
"editorconfiguration.h",
+ "editorsettingspropertiespage.cpp",
"editorsettingspropertiespage.h",
"editorsettingspropertiespage.ui",
"environmentitemswidget.cpp",
+ "environmentitemswidget.h",
+ "environmentwidget.cpp",
"environmentwidget.h",
"foldernavigationwidget.cpp",
"foldernavigationwidget.h",
+ "gccparser.cpp",
"gccparser.h",
+ "gcctoolchain.cpp",
+ "gcctoolchain.h",
"gcctoolchainfactories.h",
+ "gnumakeparser.cpp",
"gnumakeparser.h",
"headerpath.h",
"ioutputparser.cpp",
@@ -92,21 +111,6 @@ QtcPlugin {
"iprojectmanager.h",
"iprojectproperties.h",
"itaskhandler.h",
- "ldparser.h",
- "linuxiccparser.h",
- "metatypedeclarations.h",
- "miniprojecttargetselector.h",
- "namedwidget.cpp",
- "namedwidget.h",
- "nodesvisitor.cpp",
- "nodesvisitor.h",
- "outputparser_test.h",
- "pluginfilefactory.cpp",
- "pluginfilefactory.h",
- "processparameters.cpp",
- "processparameters.h",
- "processstep.cpp",
- "processstep.h",
"kit.cpp",
"kit.h",
"kitchooser.cpp",
@@ -124,29 +128,68 @@ QtcPlugin {
"kitmodel.h",
"kitoptionspage.cpp",
"kitoptionspage.h",
+ "ldparser.cpp",
+ "ldparser.h",
+ "linuxiccparser.cpp",
+ "linuxiccparser.h",
+ "localapplicationruncontrol.cpp",
+ "localapplicationruncontrol.h",
+ "metatypedeclarations.h",
+ "miniprojecttargetselector.cpp",
+ "miniprojecttargetselector.h",
+ "namedwidget.cpp",
+ "namedwidget.h",
+ "nodesvisitor.cpp",
+ "nodesvisitor.h",
+ "outputparser_test.cpp",
+ "outputparser_test.h",
+ "pluginfilefactory.cpp",
+ "pluginfilefactory.h",
+ "processparameters.cpp",
+ "processparameters.h",
+ "processstep.cpp",
+ "processstep.h",
+ "processstep.ui",
"project.cpp",
"project.h",
"projectconfiguration.cpp",
"projectconfiguration.h",
+ "projectexplorer.cpp",
+ "projectexplorer.h",
+ "projectexplorer.qrc",
"projectexplorer_export.h",
+ "projectexplorerconstants.h",
+ "projectexplorersettings.h",
+ "projectexplorersettingspage.cpp",
"projectexplorersettingspage.h",
+ "projectexplorersettingspage.ui",
"projectfilewizardextension.cpp",
"projectfilewizardextension.h",
"projectmodels.cpp",
"projectmodels.h",
"projectnodes.cpp",
"projectnodes.h",
+ "projecttreewidget.cpp",
"projecttreewidget.h",
+ "projectwelcomepage.cpp",
"projectwelcomepage.h",
"projectwindow.cpp",
"projectwindow.h",
+ "projectwizardpage.cpp",
"projectwizardpage.h",
+ "projectwizardpage.ui",
+ "runconfiguration.cpp",
+ "runconfiguration.h",
"runconfigurationmodel.cpp",
"runconfigurationmodel.h",
"runsettingspropertiespage.cpp",
"runsettingspropertiespage.h",
+ "session.cpp",
"session.h",
+ "sessiondialog.cpp",
"sessiondialog.h",
+ "sessiondialog.ui",
+ "settingsaccessor.cpp",
"settingsaccessor.h",
"showineditortaskhandler.cpp",
"showineditortaskhandler.h",
@@ -160,87 +203,74 @@ QtcPlugin {
"targetsettingspanel.h",
"targetsettingswidget.cpp",
"targetsettingswidget.h",
+ "targetsettingswidget.ui",
"task.cpp",
"task.h",
"taskhub.cpp",
"taskhub.h",
+ "taskmodel.cpp",
"taskmodel.h",
+ "taskwindow.cpp",
"taskwindow.h",
"toolchain.cpp",
"toolchain.h",
"toolchainconfigwidget.cpp",
"toolchainconfigwidget.h",
- "toolchainmanager.h",
- "toolchainoptionspage.h",
- "vcsannotatetaskhandler.h",
- "environmentitemswidget.h",
- "abi.cpp",
- "allprojectsfilter.h",
- "applicationrunconfiguration.cpp",
- "appoutputpane.cpp",
- "buildconfiguration.cpp",
- "buildmanager.cpp",
- "buildprogress.cpp",
- "buildsettingspropertiespage.cpp",
- "buildstep.h",
- "buildstepspage.cpp",
- "clangparser.cpp",
- "codestylesettingspropertiespage.cpp",
- "copytaskhandler.cpp",
- "currentprojectfilter.h",
- "dependenciespanel.cpp",
- "doubletabwidget.cpp",
- "editorsettingspropertiespage.cpp",
- "environmentwidget.cpp",
- "gccparser.cpp",
- "gcctoolchain.cpp",
- "gcctoolchain.h",
- "gnumakeparser.cpp",
- "ldparser.cpp",
- "linuxiccparser.cpp",
- "localapplicationruncontrol.cpp",
- "localapplicationruncontrol.h",
- "miniprojecttargetselector.cpp",
- "outputparser_test.cpp",
- "projectexplorer.cpp",
- "projectexplorer.h",
- "projectexplorerconstants.h",
- "projectexplorersettings.h",
- "projectexplorersettingspage.cpp",
- "projectexplorersettingspage.ui",
- "projecttreewidget.cpp",
- "projectwelcomepage.cpp",
- "projectwizardpage.cpp",
- "runconfiguration.cpp",
- "runconfiguration.h",
- "session.cpp",
- "sessiondialog.cpp",
- "settingsaccessor.cpp",
- "taskmodel.cpp",
- "taskwindow.cpp",
"toolchainmanager.cpp",
+ "toolchainmanager.h",
"toolchainoptionspage.cpp",
+ "toolchainoptionspage.h",
"vcsannotatetaskhandler.cpp",
+ "vcsannotatetaskhandler.h",
+ "customwizard/customwizard.cpp",
"customwizard/customwizard.h",
"customwizard/customwizardpage.cpp",
"customwizard/customwizardpage.h",
+ "customwizard/customwizardparameters.cpp",
"customwizard/customwizardparameters.h",
"customwizard/customwizardpreprocessor.cpp",
"customwizard/customwizardpreprocessor.h",
"customwizard/customwizardscriptgenerator.cpp",
"customwizard/customwizardscriptgenerator.h",
- "customwizard/customwizard.cpp",
- "customwizard/customwizardparameters.cpp",
- "deployablefile.h",
- "deployablefile.cpp",
- "deploymentdata.h",
- "buildtargetinfo.h",
+ "devicesupport/desktopdevice.cpp",
+ "devicesupport/desktopdevice.h",
+ "devicesupport/desktopdevicefactory.cpp",
+ "devicesupport/desktopdevicefactory.h",
+ "devicesupport/deviceapplicationrunner.cpp",
+ "devicesupport/deviceapplicationrunner.h",
+ "devicesupport/devicefactoryselectiondialog.cpp",
+ "devicesupport/devicefactoryselectiondialog.h",
+ "devicesupport/devicefactoryselectiondialog.ui",
+ "devicesupport/devicemanager.cpp",
+ "devicesupport/devicemanager.h",
+ "devicesupport/devicemanagermodel.cpp",
+ "devicesupport/devicemanagermodel.h",
+ "devicesupport/deviceprocessesdialog.cpp",
+ "devicesupport/deviceprocessesdialog.h",
+ "devicesupport/deviceprocesslist.cpp",
+ "devicesupport/deviceprocesslist.h",
+ "devicesupport/devicesettingspage.cpp",
+ "devicesupport/devicesettingspage.h",
+ "devicesupport/devicesettingswidget.cpp",
+ "devicesupport/devicesettingswidget.h",
+ "devicesupport/devicesettingswidget.ui",
+ "devicesupport/deviceusedportsgatherer.cpp",
+ "devicesupport/deviceusedportsgatherer.h",
+ "devicesupport/idevice.cpp",
+ "devicesupport/idevice.h",
+ "devicesupport/idevicefactory.cpp",
+ "devicesupport/idevicefactory.h",
+ "devicesupport/idevicewidget.h",
+ "devicesupport/localprocesslist.cpp",
+ "devicesupport/localprocesslist.h",
+ "devicesupport/sshdeviceprocesslist.cpp",
+ "devicesupport/sshdeviceprocesslist.h",
"images/BuildSettings.png",
"images/CodeStyleSettings.png",
+ "images/Desktop.png",
"images/DeviceConnected.png",
"images/DeviceDisconnected.png",
"images/DeviceReadyToUse.png",
- "images/Desktop.png",
"images/EditorSettings.png",
"images/MaemoDevice.png",
"images/ProjectDependencies.png",
@@ -269,75 +299,45 @@ QtcPlugin {
"images/session.png",
"images/stop.png",
"images/stop_small.png",
- "images/targetleftbutton.png",
- "images/targetrightbutton.png",
"images/targetbuildselected.png",
+ "images/targetleftbutton.png",
"images/targetpanel_bottom.png",
"images/targetpanel_gradient.png",
"images/targetremovebutton.png",
"images/targetremovebuttondark.png",
+ "images/targetrightbutton.png",
"images/targetrunselected.png",
"images/targetseparatorbackground.png",
"images/targetunselected.png",
"images/window.png",
- "publishing/publishingwizardselectiondialog.ui",
"publishing/ipublishingwizardfactory.h",
"publishing/publishingwizardselectiondialog.cpp",
"publishing/publishingwizardselectiondialog.h",
- "devicesupport/idevice.h",
- "devicesupport/idevice.cpp",
- "devicesupport/desktopdevice.cpp",
- "devicesupport/desktopdevice.h",
- "devicesupport/desktopdevicefactory.cpp",
- "devicesupport/desktopdevicefactory.h",
- "devicesupport/devicemanager.h",
- "devicesupport/devicemanager.cpp",
- "devicesupport/devicemanagermodel.h",
- "devicesupport/devicemanagermodel.cpp",
- "devicesupport/devicesettingspage.h",
- "devicesupport/devicesettingspage.cpp",
- "devicesupport/devicefactoryselectiondialog.cpp",
- "devicesupport/devicefactoryselectiondialog.h",
- "devicesupport/devicefactoryselectiondialog.ui",
- "devicesupport/deviceprocesslist.cpp",
- "devicesupport/deviceprocesslist.h",
- "devicesupport/sshdeviceprocesslist.cpp",
- "devicesupport/sshdeviceprocesslist.h",
- "devicesupport/deviceprocessesdialog.cpp",
- "devicesupport/deviceprocessesdialog.h",
- "devicesupport/devicesettingswidget.cpp",
- "devicesupport/devicesettingswidget.h",
- "devicesupport/devicesettingswidget.ui",
- "devicesupport/deviceusedportsgatherer.cpp",
- "devicesupport/deviceusedportsgatherer.h",
- "devicesupport/idevicewidget.h",
- "devicesupport/idevicefactory.cpp",
- "devicesupport/idevicefactory.h",
- "devicesupport/deviceapplicationrunner.cpp",
- "devicesupport/deviceapplicationrunner.h",
- "devicesupport/localprocesslist.h",
- "devicesupport/localprocesslist.cpp"
+ "publishing/publishingwizardselectiondialog.ui",
]
Group {
- condition: qbs.targetOS == "windows"
+ condition: qbs.targetOS == "windows" || Defaults.testsEnabled(qbs)
files: [
- "wincetoolchain.cpp",
- "wincetoolchain.h",
- "windebuginterface.cpp",
- "windebuginterface.h",
+ "abstractmsvctoolchain.cpp",
+ "abstractmsvctoolchain.h",
"msvcparser.cpp",
"msvcparser.h",
"msvctoolchain.cpp",
"msvctoolchain.h",
- "abstractmsvctoolchain.cpp",
- "abstractmsvctoolchain.h"
+ "wincetoolchain.cpp",
+ "wincetoolchain.h",
+ "windebuginterface.cpp",
+ "windebuginterface.h",
]
}
+ Group {
+ condition: Defaults.testsEnabled(qbs)
+ files: ["outputparser_test.h", "outputparser_test.cpp"]
+ }
+
ProductModule {
- Depends { name: "cpp" }
- Depends { name: "Qt"; submodules: ["network"] }
- cpp.includePaths: [".."]
+ Depends { name: "Qt.network" }
}
}
diff --git a/src/plugins/projectexplorer/projectexplorer.qrc b/src/plugins/projectexplorer/projectexplorer.qrc
index b36371d106..85ea369bbe 100644
--- a/src/plugins/projectexplorer/projectexplorer.qrc
+++ b/src/plugins/projectexplorer/projectexplorer.qrc
@@ -40,7 +40,7 @@
<file>images/unconfigured.png</file>
<file>images/targetleftbutton.png</file>
<file>images/targetrightbutton.png</file>
- <file>images/targetremovebutton.png</file>
- <file>images/targetremovebuttondark.png</file>
+ <file>images/targetchangebutton.png</file>
+ <file>images/targetchangebutton2.png</file>
</qresource>
</RCC>
diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.cpp b/src/plugins/projectexplorer/projectexplorersettingspage.cpp
index b840ab16b4..830efb5f5d 100644
--- a/src/plugins/projectexplorer/projectexplorersettingspage.cpp
+++ b/src/plugins/projectexplorer/projectexplorersettingspage.cpp
@@ -34,6 +34,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/documentmanager.h>
+#include <utils/hostosinfo.h>
#include <QLabel>
#include <QCoreApplication>
@@ -47,9 +48,7 @@ ProjectExplorerSettingsWidget::ProjectExplorerSettingsWidget(QWidget *parent) :
QWidget(parent)
{
m_ui.setupUi(this);
-#ifndef Q_OS_WIN
- setJomVisible(false);
-#endif
+ setJomVisible(Utils::HostOsInfo::isWindowsHost());
m_ui.directoryButtonGroup->setId(m_ui.currentDirectoryRadioButton, UseCurrentDirectory);
m_ui.directoryButtonGroup->setId(m_ui.directoryRadioButton, UseProjectDirectory);
connect(m_ui.directoryButtonGroup, SIGNAL(buttonClicked(int)),
diff --git a/src/plugins/projectexplorer/projectmodels.cpp b/src/plugins/projectexplorer/projectmodels.cpp
index 444023641c..18c6cd64bb 100644
--- a/src/plugins/projectexplorer/projectmodels.cpp
+++ b/src/plugins/projectexplorer/projectmodels.cpp
@@ -451,8 +451,9 @@ void FlatModel::setStartupProject(ProjectNode *projectNode)
void FlatModel::reset()
{
+ beginResetModel();
m_childNodes.clear();
- QAbstractItemModel::reset();
+ endResetModel();
}
QModelIndex FlatModel::indexForNode(const Node *node_)
diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp
index a23efe5289..f1c4ab9f65 100644
--- a/src/plugins/projectexplorer/projectwelcomepage.cpp
+++ b/src/plugins/projectexplorer/projectwelcomepage.cpp
@@ -110,7 +110,8 @@ bool SessionModel::isDefaultVirgin() const
void SessionModel::resetSessions()
{
- reset();
+ beginResetModel();
+ endResetModel();
}
void SessionModel::cloneSession(const QString &session)
@@ -123,8 +124,9 @@ void SessionModel::cloneSession(const QString &session)
QString newSession = newSessionInputDialog.value();
if (newSession.isEmpty() || m_manager->sessions().contains(newSession))
return;
+ beginResetModel();
m_manager->cloneSession(session, newSession);
- reset();
+ endResetModel();
if (newSessionInputDialog.isSwitchToRequested()) {
m_manager->loadSession(newSession);
@@ -134,8 +136,9 @@ void SessionModel::cloneSession(const QString &session)
void SessionModel::deleteSession(const QString &session)
{
+ beginResetModel();
m_manager->deleteSession(session);
- reset();
+ endResetModel();
}
void SessionModel::renameSession(const QString &session)
@@ -148,8 +151,9 @@ void SessionModel::renameSession(const QString &session)
QString newSession = newSessionInputDialog.value();
if (newSession.isEmpty() || m_manager->sessions().contains(newSession))
return;
+ beginResetModel();
m_manager->renameSession(session, newSession);
- reset();
+ endResetModel();
if (newSessionInputDialog.isSwitchToRequested()) {
m_manager->loadSession(newSession);
@@ -193,7 +197,8 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const
void ProjectModel::resetProjects()
{
- reset();
+ beginResetModel();
+ endResetModel();
}
///////////////////
diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp
index 0ec71ee083..10c9f82e63 100644
--- a/src/plugins/projectexplorer/runconfiguration.cpp
+++ b/src/plugins/projectexplorer/runconfiguration.cpp
@@ -122,16 +122,17 @@ DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(RunConfiguration
m_suppressQmlDebuggingSpinbox(false)
{}
-DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(DebuggerRunConfigurationAspect *other) :
- m_runConfiguration(other->m_runConfiguration),
- m_useCppDebugger(other->m_useCppDebugger),
- m_useQmlDebugger(other->m_useQmlDebugger),
- m_qmlDebugServerPort(other->m_qmlDebugServerPort),
- m_useMultiProcess(other->m_useMultiProcess),
- m_suppressDisplay(other->m_suppressDisplay),
- m_suppressQmlDebuggingOptions(other->m_suppressQmlDebuggingOptions),
- m_suppressCppDebuggingOptions(other->m_suppressCppDebuggingOptions),
- m_suppressQmlDebuggingSpinbox(other->m_suppressQmlDebuggingSpinbox)
+DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(RunConfiguration *runConfiguration,
+ DebuggerRunConfigurationAspect *other)
+ : m_runConfiguration(runConfiguration),
+ m_useCppDebugger(other->m_useCppDebugger),
+ m_useQmlDebugger(other->m_useQmlDebugger),
+ m_qmlDebugServerPort(other->m_qmlDebugServerPort),
+ m_useMultiProcess(other->m_useMultiProcess),
+ m_suppressDisplay(other->m_suppressDisplay),
+ m_suppressQmlDebuggingOptions(other->m_suppressQmlDebuggingOptions),
+ m_suppressCppDebuggingOptions(other->m_suppressCppDebuggingOptions),
+ m_suppressQmlDebuggingSpinbox(other->m_suppressQmlDebuggingSpinbox)
{}
RunConfiguration *DebuggerRunConfigurationAspect::runConfiguration()
@@ -283,10 +284,18 @@ RunConfiguration::RunConfiguration(Target *target, const Core::Id id) :
RunConfiguration::RunConfiguration(Target *target, RunConfiguration *source) :
ProjectConfiguration(target, source),
- m_debuggerAspect(new DebuggerRunConfigurationAspect(source->debuggerAspect()))
+ m_debuggerAspect(new DebuggerRunConfigurationAspect(this, source->debuggerAspect()))
{
Q_ASSERT(target);
- addExtraAspects();
+ QList<IRunControlFactory *> factories = ExtensionSystem::PluginManager::getObjects<IRunControlFactory>();
+ foreach (IRunConfigurationAspect *aspect, source->m_aspects) {
+ foreach (IRunControlFactory *factory, factories) {
+ if (IRunConfigurationAspect *clone = factory->cloneRunConfigurationAspect(aspect)) {
+ m_aspects.append(clone);
+ break;
+ }
+ }
+ }
}
RunConfiguration::~RunConfiguration()
@@ -454,6 +463,17 @@ IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, const Q
return 0;
}
+IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, RunConfiguration *rc)
+{
+ QList<IRunConfigurationFactory *> factories
+ = ExtensionSystem::PluginManager::instance()->getObjects<IRunConfigurationFactory>();
+ foreach (IRunConfigurationFactory *factory, factories) {
+ if (factory->canClone(parent, rc))
+ return factory;
+ }
+ return 0;
+}
+
QList<IRunConfigurationFactory *> IRunConfigurationFactory::find(Target *parent)
{
QList<IRunConfigurationFactory *> factories
@@ -504,6 +524,12 @@ IRunConfigurationAspect *IRunControlFactory::createRunConfigurationAspect()
return 0;
}
+IRunConfigurationAspect *IRunControlFactory::cloneRunConfigurationAspect(IRunConfigurationAspect *source)
+{
+ Q_UNUSED(source);
+ return 0;
+}
+
RunConfigWidget *IRunControlFactory::createConfigurationWidget(RunConfiguration *)
{
return 0;
diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h
index a4274553d2..c846606d31 100644
--- a/src/plugins/projectexplorer/runconfiguration.h
+++ b/src/plugins/projectexplorer/runconfiguration.h
@@ -37,7 +37,7 @@
#include <utils/outputformat.h>
#include <QMetaType>
-#include <QWeakPointer>
+#include <QPointer>
#include <QWidget>
QT_FORWARD_DECLARE_CLASS(QIcon)
@@ -90,7 +90,7 @@ class PROJECTEXPLORER_EXPORT DebuggerRunConfigurationAspect
public:
DebuggerRunConfigurationAspect(RunConfiguration *runConfiguration);
- DebuggerRunConfigurationAspect(DebuggerRunConfigurationAspect *other);
+ DebuggerRunConfigurationAspect(RunConfiguration *runConfiguration, DebuggerRunConfigurationAspect *other);
enum QmlDebuggerStatus {
DisableQmlDebugger = 0,
@@ -213,6 +213,7 @@ public:
virtual RunConfiguration *clone(Target *parent, RunConfiguration *product) = 0;
static IRunConfigurationFactory *find(Target *parent, const QVariantMap &map);
+ static IRunConfigurationFactory *find(Target *parent, RunConfiguration *rc);
static QList<IRunConfigurationFactory *> find(Target *parent);
signals:
@@ -234,6 +235,7 @@ public:
virtual QString displayName() const = 0;
virtual IRunConfigurationAspect *createRunConfigurationAspect();
+ virtual IRunConfigurationAspect *cloneRunConfigurationAspect(IRunConfigurationAspect *);
virtual RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
};
@@ -304,7 +306,7 @@ protected:
private:
QString m_displayName;
RunMode m_runMode;
- const QWeakPointer<RunConfiguration> m_runConfiguration;
+ const QPointer<RunConfiguration> m_runConfiguration;
Utils::OutputFormatter *m_outputFormatter;
// A handle to the actual application process.
diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp
index dfa78d0f03..c7eb57aeb5 100644
--- a/src/plugins/projectexplorer/settingsaccessor.cpp
+++ b/src/plugins/projectexplorer/settingsaccessor.cpp
@@ -42,6 +42,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
#include <extensionsystem/pluginmanager.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/persistentsettings.h>
@@ -1890,7 +1891,6 @@ static const char * const lameArgListKeys[] = {
0
};
-#ifdef Q_OS_UNIX
inline static bool isSpecialChar(ushort c)
{
// Chars that should be quoted (TM). This includes:
@@ -1909,27 +1909,26 @@ inline static bool hasSpecialChars(const QString &arg)
return true;
return false;
}
-#endif
// These were split according to sane (even if a bit arcane) rules
static QVariant version8ArgNodeHandler(const QVariant &var)
{
QString ret;
foreach (const QVariant &svar, var.toList()) {
-#ifdef Q_OS_UNIX
- // We don't just addArg, so we don't disarm existing env expansions.
- // This is a bit fuzzy logic ...
- QString s = svar.toString();
- s.replace(QLatin1Char('\\'), QLatin1String("\\\\"));
- s.replace(QLatin1Char('"'), QLatin1String("\\\""));
- s.replace(QLatin1Char('`'), QLatin1String("\\`"));
- if (s != svar.toString() || hasSpecialChars(s))
- s.prepend(QLatin1Char('"')).append(QLatin1Char('"'));
- Utils::QtcProcess::addArgs(&ret, s);
-#else
- // Under windows, env expansions cannot be quoted anyway.
- Utils::QtcProcess::addArg(&ret, svar.toString());
-#endif
+ if (Utils::HostOsInfo::isAnyUnixHost()) {
+ // We don't just addArg, so we don't disarm existing env expansions.
+ // This is a bit fuzzy logic ...
+ QString s = svar.toString();
+ s.replace(QLatin1Char('\\'), QLatin1String("\\\\"));
+ s.replace(QLatin1Char('"'), QLatin1String("\\\""));
+ s.replace(QLatin1Char('`'), QLatin1String("\\`"));
+ if (s != svar.toString() || hasSpecialChars(s))
+ s.prepend(QLatin1Char('"')).append(QLatin1Char('"'));
+ Utils::QtcProcess::addArgs(&ret, s);
+ } else {
+ // Under windows, env expansions cannot be quoted anyway.
+ Utils::QtcProcess::addArg(&ret, svar.toString());
+ }
}
return QVariant(ret);
}
@@ -1984,13 +1983,13 @@ static const char * const envExpandedKeys[] = {
static QString version8NewVar(const QString &old)
{
QString ret = old;
-#ifdef Q_OS_UNIX
- ret.prepend(QLatin1String("${"));
- ret.append(QLatin1Char('}'));
-#else
- ret.prepend(QLatin1Char('%'));
- ret.append(QLatin1Char('%'));
-#endif
+ if (Utils::HostOsInfo::isAnyUnixHost()) {
+ ret.prepend(QLatin1String("${"));
+ ret.append(QLatin1Char('}'));
+ } else {
+ ret.prepend(QLatin1Char('%'));
+ ret.append(QLatin1Char('%'));
+ }
return ret;
}
@@ -2004,65 +2003,65 @@ static QVariant version8EnvNodeTransform(const QVariant &var)
QLatin1String("%{sourceDir}"));
result.replace(QRegExp(QLatin1String("%BUILDDIR%|\\$(BUILDDIR\\b|\\{BUILDDIR\\})")),
QLatin1String("%{buildDir}"));
-#ifdef Q_OS_UNIX
- for (int vStart = -1, i = 0; i < result.length(); ) {
- QChar c = result.at(i++);
- if (c == QLatin1Char('%')) {
- if (vStart > 0 && vStart < i - 1) {
- QString nv = version8NewVar(result.mid(vStart, i - 1 - vStart));
- result.replace(vStart - 1, i - vStart + 1, nv);
- i = vStart - 1 + nv.length();
- vStart = -1;
- } else {
- vStart = i;
+ if (Utils::HostOsInfo::isAnyUnixHost()) {
+ for (int vStart = -1, i = 0; i < result.length(); ) {
+ QChar c = result.at(i++);
+ if (c == QLatin1Char('%')) {
+ if (vStart > 0 && vStart < i - 1) {
+ QString nv = version8NewVar(result.mid(vStart, i - 1 - vStart));
+ result.replace(vStart - 1, i - vStart + 1, nv);
+ i = vStart - 1 + nv.length();
+ vStart = -1;
+ } else {
+ vStart = i;
+ }
+ } else if (vStart > 0) {
+ // Sanity check so we don't catch too much garbage
+ if (!c.isLetterOrNumber() && c != QLatin1Char('_'))
+ vStart = -1;
}
- } else if (vStart > 0) {
- // Sanity check so we don't catch too much garbage
- if (!c.isLetterOrNumber() && c != QLatin1Char('_'))
- vStart = -1;
}
- }
-#else
- enum { BASE, OPTIONALVARIABLEBRACE, VARIABLE, BRACEDVARIABLE } state = BASE;
- int vStart = -1;
-
- for (int i = 0; i < result.length();) {
- QChar c = result.at(i++);
- if (state == BASE) {
- if (c == QLatin1Char('$'))
- state = OPTIONALVARIABLEBRACE;
- } else if (state == OPTIONALVARIABLEBRACE) {
- if (c == QLatin1Char('{')) {
- state = BRACEDVARIABLE;
- vStart = i;
- } else if (c.isLetterOrNumber() || c == QLatin1Char('_')) {
- state = VARIABLE;
- vStart = i - 1;
- } else {
- state = BASE;
- }
- } else if (state == BRACEDVARIABLE) {
- if (c == QLatin1Char('}')) {
- QString nv = version8NewVar(result.mid(vStart, i - 1 - vStart));
- result.replace(vStart - 2, i - vStart + 2, nv);
- i = vStart + nv.length();
- state = BASE;
- }
- } else if (state == VARIABLE) {
- if (!c.isLetterOrNumber() && c != QLatin1Char('_')) {
- QString nv = version8NewVar(result.mid(vStart, i - 1 - vStart));
- result.replace(vStart - 1, i - vStart, nv);
- i = vStart - 1 + nv.length(); // On the same char - could be next expansion.
- state = BASE;
+ } else {
+ enum { BASE, OPTIONALVARIABLEBRACE, VARIABLE, BRACEDVARIABLE } state = BASE;
+ int vStart = -1;
+
+ for (int i = 0; i < result.length();) {
+ QChar c = result.at(i++);
+ if (state == BASE) {
+ if (c == QLatin1Char('$'))
+ state = OPTIONALVARIABLEBRACE;
+ } else if (state == OPTIONALVARIABLEBRACE) {
+ if (c == QLatin1Char('{')) {
+ state = BRACEDVARIABLE;
+ vStart = i;
+ } else if (c.isLetterOrNumber() || c == QLatin1Char('_')) {
+ state = VARIABLE;
+ vStart = i - 1;
+ } else {
+ state = BASE;
+ }
+ } else if (state == BRACEDVARIABLE) {
+ if (c == QLatin1Char('}')) {
+ QString nv = version8NewVar(result.mid(vStart, i - 1 - vStart));
+ result.replace(vStart - 2, i - vStart + 2, nv);
+ i = vStart + nv.length();
+ state = BASE;
+ }
+ } else if (state == VARIABLE) {
+ if (!c.isLetterOrNumber() && c != QLatin1Char('_')) {
+ QString nv = version8NewVar(result.mid(vStart, i - 1 - vStart));
+ result.replace(vStart - 1, i - vStart, nv);
+ i = vStart - 1 + nv.length(); // On the same char - could be next expansion.
+ state = BASE;
+ }
}
}
+ if (state == VARIABLE) {
+ QString nv = version8NewVar(result.mid(vStart));
+ result.truncate(vStart - 1);
+ result += nv;
+ }
}
- if (state == VARIABLE) {
- QString nv = version8NewVar(result.mid(vStart));
- result.truncate(vStart - 1);
- result += nv;
- }
-#endif
return QVariant(result);
}
@@ -2539,14 +2538,8 @@ void Version11Handler::addRunConfigurations(Kit *k,
static QString targetRoot(const QString &qmakePath)
{
-#ifdef Q_OS_WIN
- Qt::CaseSensitivity cs = Qt::CaseInsensitive;
- const QString binQmake = "/bin/qmake.exe";
-#else
- Qt::CaseSensitivity cs = Qt::CaseSensitive;
- const QString binQmake = "/bin/qmake";
-#endif
- return QDir::cleanPath(qmakePath).remove(binQmake, cs);
+ return QDir::cleanPath(qmakePath).remove(QLatin1String("/bin/qmake" QTC_HOST_EXE_SUFFIX),
+ Utils::HostOsInfo::fileNameCaseSensitivity());
}
static QString maddeRoot(const QString &qmakePath)
diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp
index 13a522d504..953b4059db 100644
--- a/src/plugins/projectexplorer/target.cpp
+++ b/src/plugins/projectexplorer/target.cpp
@@ -368,7 +368,10 @@ void Target::setActiveDeployConfiguration(DeployConfiguration *dc)
void Target::setDeploymentData(const DeploymentData &deploymentData)
{
- d->m_deploymentData = deploymentData;
+ if (d->m_deploymentData != deploymentData) {
+ d->m_deploymentData = deploymentData;
+ emit deploymentDataChanged();
+ }
}
DeploymentData Target::deploymentData() const
@@ -378,7 +381,10 @@ DeploymentData Target::deploymentData() const
void Target::setApplicationTargets(const BuildTargetInfoList &appTargets)
{
- d->m_appTargets = appTargets;
+ if (d->m_appTargets != appTargets) {
+ d->m_appTargets = appTargets;
+ emit applicationTargetsChanged();
+ }
}
BuildTargetInfoList Target::applicationTargets() const
diff --git a/src/plugins/projectexplorer/target.h b/src/plugins/projectexplorer/target.h
index 57be3ff413..805e3c8c6b 100644
--- a/src/plugins/projectexplorer/target.h
+++ b/src/plugins/projectexplorer/target.h
@@ -148,6 +148,9 @@ signals:
void deployConfigurationEnabledChanged();
void runConfigurationEnabledChanged();
+ void deploymentDataChanged();
+ void applicationTargetsChanged();
+
// Remove all the signals below, they are stupid
/// Emitted whenever the current build configuartion changed or the build directory of the current
/// build configuration was changed.
diff --git a/src/plugins/projectexplorer/targetselector.cpp b/src/plugins/projectexplorer/targetselector.cpp
index 686042ab3b..cd58c4ca0b 100644
--- a/src/plugins/projectexplorer/targetselector.cpp
+++ b/src/plugins/projectexplorer/targetselector.cpp
@@ -36,10 +36,41 @@
#include <QMenu>
#include <QMouseEvent>
#include <QFontMetrics>
+#include <QPushButton>
static const int TARGET_HEIGHT = 43;
static const int NAVBUTTON_WIDTH = 27;
+namespace ProjectExplorer {
+namespace Internal {
+class QPixmapButton : public QPushButton
+{
+public:
+ QPixmapButton(QWidget *parent, const QPixmap &first, const QPixmap &second)
+ : QPushButton(parent), m_showFirst(true), m_first(first), m_second(second)
+ {
+ setFixedSize(m_first.size());
+ }
+
+ void paintEvent(QPaintEvent *)
+ {
+ QPainter p(this);
+ p.drawPixmap(0, 0, m_showFirst ? m_first : m_second);
+ }
+
+ void setFirst(bool f)
+ {
+ m_showFirst = f;
+ }
+
+private:
+ bool m_showFirst;
+ const QPixmap m_first;
+ const QPixmap m_second;
+};
+}
+}
+
using namespace ProjectExplorer::Internal;
TargetSelector::TargetSelector(QWidget *parent) :
@@ -49,11 +80,12 @@ TargetSelector::TargetSelector(QWidget *parent) :
m_buildselected(QLatin1String(":/projectexplorer/images/targetbuildselected.png")),
m_targetRightButton(QLatin1String(":/projectexplorer/images/targetrightbutton.png")),
m_targetLeftButton(QLatin1String(":/projectexplorer/images/targetleftbutton.png")),
- m_targetRemoveButton(QLatin1String(":/projectexplorer/images/targetremovebutton.png")),
- m_targetRemoveDarkButton(QLatin1String(":/projectexplorer/images/targetremovebuttondark.png")),
+ m_targetChangePixmap(QLatin1String(":/projectexplorer/images/targetchangebutton.png")),
+ m_targetChangePixmap2(QLatin1String(":/projectexplorer/images/targetchangebutton2.png")),
m_currentTargetIndex(-1),
m_currentHoveredTargetIndex(-1),
- m_startIndex(0)
+ m_startIndex(0),
+ m_menuShown(false)
{
QFont f = font();
f.setPixelSize(10);
@@ -61,6 +93,27 @@ TargetSelector::TargetSelector(QWidget *parent) :
setFont(f);
setMouseTracking(true);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+
+ m_targetChangeButton = new QPixmapButton(this, m_targetChangePixmap2, m_targetChangePixmap);
+ m_targetChangeButton->hide();
+ connect(m_targetChangeButton, SIGNAL(pressed()), this, SLOT(changeButtonPressed()));
+}
+
+void TargetSelector::changeButtonPressed()
+{
+ emit menuShown(m_currentHoveredTargetIndex);
+}
+
+void TargetSelector::menuAboutToShow()
+{
+ m_menuShown = true;
+ updateButtons();
+}
+
+void TargetSelector::menuAboutToHide()
+{
+ m_menuShown = false;
+ updateButtons();
}
void TargetSelector::insertTarget(int index, const QString &name)
@@ -136,6 +189,25 @@ TargetSelector::Target TargetSelector::targetAt(int index) const
return m_targets.at(index);
}
+void TargetSelector::setTargetMenu(QMenu *menu)
+{
+ if (m_targetChangeButton->menu()) {
+ disconnect(m_targetChangeButton->menu(), SIGNAL(aboutToShow()),
+ this, SLOT(menuAboutToShow()));
+ disconnect(m_targetChangeButton->menu(), SIGNAL(aboutToHide()),
+ this, SLOT(menuAboutToHide()));
+ }
+
+ m_targetChangeButton->setMenu(menu);
+
+ if (menu) {
+ connect(m_targetChangeButton->menu(), SIGNAL(aboutToShow()),
+ this, SLOT(menuAboutToShow()));
+ connect(m_targetChangeButton->menu(), SIGNAL(aboutToHide()),
+ this, SLOT(menuAboutToHide()));
+ }
+}
+
int TargetSelector::targetWidth() const
{
static int width = -1;
@@ -157,7 +229,7 @@ int TargetSelector::maxVisibleTargets() const
return (width() - ((NAVBUTTON_WIDTH + 1) * 2 + 3))/(targetWidth() + 1);
}
-void TargetSelector::getControlAt(int x, int y, int *buttonIndex, int *targetIndex, int *targetSubIndex, bool *removeButton)
+void TargetSelector::getControlAt(int x, int y, int *buttonIndex, int *targetIndex, int *targetSubIndex)
{
if (buttonIndex)
*buttonIndex = -1;
@@ -165,8 +237,6 @@ void TargetSelector::getControlAt(int x, int y, int *buttonIndex, int *targetInd
*targetIndex = -1;
if (targetSubIndex)
*targetSubIndex = -1;
- if (removeButton)
- *removeButton = false;
// left button?
if (m_startIndex > 0 /* button visible */ && x >= 0 && x < NAVBUTTON_WIDTH + 2) {
@@ -196,6 +266,7 @@ void TargetSelector::getControlAt(int x, int y, int *buttonIndex, int *targetInd
}
--index;
tx -= targetWidth() + 1;
+
if (index >= 0 && index < m_targets.size()) {
if (targetIndex)
*targetIndex = index;
@@ -209,10 +280,6 @@ void TargetSelector::getControlAt(int x, int y, int *buttonIndex, int *targetInd
if (targetSubIndex)
*targetSubIndex = 0;
}
- } else if (y < m_targetRemoveButton.height() + 3
- && x >= tx + targetWidth() - m_targetRemoveButton.width() - 1) {
- if (removeButton)
- *removeButton = true;
}
}
}
@@ -222,8 +289,7 @@ void TargetSelector::mousePressEvent(QMouseEvent *event)
int buttonIndex;
int targetIndex;
int targetSubIndex;
- bool removeButton;
- getControlAt(event->x(), event->y(), &buttonIndex, &targetIndex, &targetSubIndex, &removeButton);
+ getControlAt(event->x(), event->y(), &buttonIndex, &targetIndex, &targetSubIndex);
if (buttonIndex == 0) {
event->accept();
--m_startIndex;
@@ -235,7 +301,7 @@ void TargetSelector::mousePressEvent(QMouseEvent *event)
} else if (targetIndex != -1) {
event->accept();
bool updateNeeded = false;
- if (targetIndex != m_currentTargetIndex && !removeButton) {
+ if (targetIndex != m_currentTargetIndex) {
m_currentTargetIndex = targetIndex;
updateNeeded = true;
}
@@ -244,8 +310,6 @@ void TargetSelector::mousePressEvent(QMouseEvent *event)
m_targets[m_currentTargetIndex].currentSubIndex = targetSubIndex;
updateNeeded = true;
}
- } else if (removeButton) {
- emit removeButtonClicked(targetIndex);
}
if (updateNeeded) {
update();
@@ -259,11 +323,12 @@ void TargetSelector::mousePressEvent(QMouseEvent *event)
void TargetSelector::mouseMoveEvent(QMouseEvent *event)
{
int targetIndex;
- getControlAt(event->x(), event->y(), 0, &targetIndex, 0, 0);
+ getControlAt(event->x(), event->y(), 0, &targetIndex, 0);
if (m_currentHoveredTargetIndex != targetIndex) {
m_currentHoveredTargetIndex = targetIndex;
if (targetIndex != -1)
event->accept();
+ updateButtons();
update();
}
}
@@ -272,18 +337,34 @@ void TargetSelector::leaveEvent(QEvent *event)
{
Q_UNUSED(event)
m_currentHoveredTargetIndex = -1;
+ updateButtons();
update();
}
+void TargetSelector::updateButtons()
+{
+ if (m_menuShown) {
+ // Do nothing while the menu is show
+ } else if (m_currentHoveredTargetIndex == -1) {
+ m_targetChangeButton->hide();
+ } else {
+ int tx = NAVBUTTON_WIDTH + 3 + (m_currentHoveredTargetIndex - m_startIndex) * (targetWidth() + 1);
+
+ QPoint buttonTopLeft(tx + targetWidth() - m_targetChangePixmap.width() - 1, 3);
+ m_targetChangeButton->move(buttonTopLeft);
+ m_targetChangeButton->setVisible(true);
+ m_targetChangeButton->setFirst(m_currentHoveredTargetIndex == m_currentTargetIndex);
+ }
+}
+
bool TargetSelector::event(QEvent *e)
{
if (e->type() == QEvent::ToolTip) {
const QHelpEvent *helpEvent = static_cast<const QHelpEvent *>(e);
int targetIndex;
int subTargetIndex;
- bool removeButton;
- getControlAt(helpEvent->x(), helpEvent->y(), 0, &targetIndex, &subTargetIndex, &removeButton);
- if (targetIndex >= 0 && subTargetIndex < 0 && !removeButton) {
+ getControlAt(helpEvent->x(), helpEvent->y(), 0, &targetIndex, &subTargetIndex);
+ if (targetIndex >= 0 && subTargetIndex < 0) {
emit toolTipRequested(helpEvent->globalPos(), targetIndex);
e->accept();
return true;
@@ -340,12 +421,6 @@ void TargetSelector::paintEvent(QPaintEvent *event)
p.drawText(x + (targetWidth()- fm.width(nameText))/2 + 1, 7 + fm.ascent(),
nameText);
- // remove button
- if (m_currentHoveredTargetIndex == index) {
- p.drawPixmap(x + targetWidth() - m_targetRemoveButton.width() - 2, 3,
- index == m_currentTargetIndex ? m_targetRemoveDarkButton : m_targetRemoveButton);
- }
-
// Build
int margin = 2; // position centered within the rounded buttons
QFontMetrics fm = fontMetrics();
diff --git a/src/plugins/projectexplorer/targetselector.h b/src/plugins/projectexplorer/targetselector.h
index 097a7d3363..2f97269a69 100644
--- a/src/plugins/projectexplorer/targetselector.h
+++ b/src/plugins/projectexplorer/targetselector.h
@@ -35,10 +35,12 @@
QT_BEGIN_NAMESPACE
class QMenu;
+class QPushButton;
QT_END_NAMESPACE
namespace ProjectExplorer {
namespace Internal {
+class QPixmapButton;
class TargetSelector : public QWidget
{
@@ -62,6 +64,8 @@ public:
int currentIndex() const { return m_currentTargetIndex; }
int currentSubIndex() const { return m_targets.at(m_currentTargetIndex).currentSubIndex; }
+ void setTargetMenu(QMenu *menu);
+
public:
void insertTarget(int index, const QString &name);
void renameTarget(int index, const QString &name);
@@ -70,11 +74,11 @@ public:
void setCurrentSubIndex(int subindex);
signals:
- void removeButtonClicked(int targetIndex);
// This signal is emitted whenever the target pointed to by the indices
// has changed.
void currentChanged(int targetIndex, int subIndex);
void toolTipRequested(const QPoint &globalPosition, int targetIndex);
+ void menuShown(int targetIndex);
protected:
void paintEvent(QPaintEvent *event);
@@ -83,8 +87,13 @@ protected:
void leaveEvent(QEvent *event);
bool event(QEvent *e);
+private slots:
+ void changeButtonPressed();
+ void updateButtons();
+ void menuAboutToShow();
+ void menuAboutToHide();
private:
- void getControlAt(int x, int y, int *buttonIndex, int *targetIndex, int *targetSubIndex, bool *removeButton);
+ void getControlAt(int x, int y, int *buttonIndex, int *targetIndex, int *targetSubIndex);
int maxVisibleTargets() const;
const QImage m_unselected;
@@ -92,14 +101,17 @@ private:
const QImage m_buildselected;
const QPixmap m_targetRightButton;
const QPixmap m_targetLeftButton;
- const QPixmap m_targetRemoveButton;
- const QPixmap m_targetRemoveDarkButton;
+ const QPixmap m_targetChangePixmap;
+ const QPixmap m_targetChangePixmap2;
+
+ QPixmapButton *m_targetChangeButton;
QList<Target> m_targets;
int m_currentTargetIndex;
int m_currentHoveredTargetIndex;
int m_startIndex;
+ bool m_menuShown;
};
} // namespace Internal
diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp
index e57a20751a..b38371e237 100644
--- a/src/plugins/projectexplorer/targetsettingspanel.cpp
+++ b/src/plugins/projectexplorer/targetsettingspanel.cpp
@@ -44,6 +44,9 @@
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/deployconfiguration.h>
+#include <projectexplorer/runconfiguration.h>
#include <utils/qtcassert.h>
#include <QCoreApplication>
@@ -69,6 +72,8 @@ TargetSettingsPanelWidget::TargetSettingsPanelWidget(Project *project) :
m_project(project),
m_selector(0),
m_centralWidget(0),
+ m_changeMenu(0),
+ m_duplicateMenu(0),
m_lastAction(0)
{
Q_ASSERT(m_project);
@@ -77,6 +82,7 @@ TargetSettingsPanelWidget::TargetSettingsPanelWidget(Project *project) :
m_panelWidgets[1] = 0;
m_addMenu = new QMenu(this);
+ m_targetMenu = new QMenu(this);
setFocusPolicy(Qt::NoFocus);
@@ -91,7 +97,7 @@ TargetSettingsPanelWidget::TargetSettingsPanelWidget(Project *project) :
this, SLOT(activeTargetChanged(ProjectExplorer::Target*)));
connect(KitManager::instance(), SIGNAL(kitsChanged()),
- this, SLOT(updateTargetAddAndRemoveButtons()));
+ this, SLOT(updateTargetButtons()));
}
TargetSettingsPanelWidget::~TargetSettingsPanelWidget()
@@ -101,21 +107,35 @@ TargetSettingsPanelWidget::~TargetSettingsPanelWidget()
bool TargetSettingsPanelWidget::event(QEvent *event)
{
if (event->type() == QEvent::StatusTip) {
+ QAction *act = 0;
+ QMenu *menu = 0;
+ if (m_addMenu->activeAction()) {
+ menu = m_addMenu;
+ act = m_addMenu->activeAction();
+ } else if (m_changeMenu && m_changeMenu->activeAction()) {
+ menu = m_changeMenu;
+ act = m_changeMenu->activeAction();
+ } else if (m_duplicateMenu && m_duplicateMenu->activeAction()) {
+ menu = m_duplicateMenu;
+ act = m_duplicateMenu->activeAction();
+ } else {
+ return QWidget::event(event);
+ }
+
QStatusTipEvent *ev = static_cast<QStatusTipEvent *>(event);
ev->accept();
- QAction *act = m_addMenu->activeAction();
if (act != m_lastAction)
QToolTip::showText(QPoint(), QString());
m_lastAction = act;
if (act) {
- QRect actionRect = m_addMenu->actionGeometry(act);
- actionRect.translate(m_addMenu->pos());
+ QRect actionRect = menu->actionGeometry(act);
+ actionRect.translate(menu->pos());
QPoint p = QCursor::pos();
if (!actionRect.contains(p))
p = actionRect.center();
p.setY(actionRect.center().y());
- QToolTip::showText(p, ev->tip(), m_addMenu, m_addMenu->actionGeometry(act));
+ QToolTip::showText(p, ev->tip(), menu, menu->actionGeometry(act));
} else {
QToolTip::showText(QPoint(), QString());
}
@@ -168,18 +188,20 @@ void TargetSettingsPanelWidget::setupUi()
connect(m_selector, SIGNAL(currentChanged(int,int)),
this, SLOT(currentTargetChanged(int,int)));
- connect(m_selector, SIGNAL(removeButtonClicked(int)),
- this, SLOT(removeTarget(int)));
connect(m_selector, SIGNAL(manageButtonClicked()),
this, SLOT(openTargetPreferences()));
connect(m_selector, SIGNAL(toolTipRequested(QPoint,int)),
this, SLOT(showTargetToolTip(QPoint,int)));
+ connect(m_selector, SIGNAL(menuShown(int)),
+ this, SLOT(menuShown(int)));
- m_selector->setAddButtonMenu(m_addMenu);
connect(m_addMenu, SIGNAL(triggered(QAction*)),
- this, SLOT(addTarget(QAction*)));
+ this, SLOT(addActionTriggered(QAction*)));
- updateTargetAddAndRemoveButtons();
+ m_selector->setAddButtonMenu(m_addMenu);
+ m_selector->setTargetMenu(m_targetMenu);
+
+ updateTargetButtons();
}
void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subIndex)
@@ -242,7 +264,36 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
m_project->setActiveTarget(target);
}
-void TargetSettingsPanelWidget::addTarget(QAction *action)
+void TargetSettingsPanelWidget::menuShown(int targetIndex)
+{
+ m_menuTargetIndex = targetIndex;
+}
+
+void TargetSettingsPanelWidget::changeActionTriggered(QAction *action)
+{
+ Kit *k = KitManager::instance()->find(action->data().value<Core::Id>());
+ Target *sourceTarget = m_targets.at(m_menuTargetIndex);
+ Target *newTarget = cloneTarget(sourceTarget, k);
+
+ if (newTarget) {
+ m_project->addTarget(newTarget);
+ m_project->setActiveTarget(newTarget);
+ m_project->removeTarget(sourceTarget);
+ }
+}
+
+void TargetSettingsPanelWidget::duplicateActionTriggered(QAction *action)
+{
+ Kit *k = KitManager::instance()->find(action->data().value<Core::Id>());
+ Target *newTarget = cloneTarget(m_targets.at(m_menuTargetIndex), k);
+
+ if (newTarget) {
+ m_project->addTarget(newTarget);
+ m_project->setActiveTarget(newTarget);
+ }
+}
+
+void TargetSettingsPanelWidget::addActionTriggered(QAction *action)
{
Kit *k = KitManager::instance()->find(action->data().value<Core::Id>());
QTC_ASSERT(!m_project->target(k), return);
@@ -253,10 +304,146 @@ void TargetSettingsPanelWidget::addTarget(QAction *action)
m_project->addTarget(target);
}
-void TargetSettingsPanelWidget::removeTarget(int targetIndex)
+Target *TargetSettingsPanelWidget::cloneTarget(Target *sourceTarget, Kit *k)
+{
+ Target *newTarget = new Target(m_project, k);
+
+ QStringList buildconfigurationError;
+ QStringList deployconfigurationError;
+ QStringList runconfigurationError;
+
+ foreach (BuildConfiguration *sourceBc, sourceTarget->buildConfigurations()) {
+ IBuildConfigurationFactory *factory = IBuildConfigurationFactory::find(newTarget, sourceBc);
+ if (!factory) {
+ buildconfigurationError << sourceBc->displayName();
+ continue;
+ }
+ BuildConfiguration *newBc = factory->clone(newTarget, sourceBc);
+ if (!newBc) {
+ buildconfigurationError << sourceBc->displayName();
+ continue;
+ }
+ newBc->setDisplayName(sourceBc->displayName());
+ newTarget->addBuildConfiguration(newBc);
+ if (sourceTarget->activeBuildConfiguration() == sourceBc)
+ newTarget->setActiveBuildConfiguration(newBc);
+ }
+ if (!newTarget->activeBuildConfiguration()) {
+ QList<BuildConfiguration *> bcs = newTarget->buildConfigurations();
+ if (!bcs.isEmpty())
+ newTarget->setActiveBuildConfiguration(bcs.first());
+ }
+
+ foreach (DeployConfiguration *sourceDc, sourceTarget->deployConfigurations()) {
+ DeployConfigurationFactory *factory = DeployConfigurationFactory::find(newTarget, sourceDc);
+ if (!factory) {
+ deployconfigurationError << sourceDc->displayName();
+ continue;
+ }
+ DeployConfiguration *newDc = factory->clone(newTarget, sourceDc);
+ if (!newDc) {
+ deployconfigurationError << sourceDc->displayName();
+ continue;
+ }
+ newDc->setDisplayName(sourceDc->displayName());
+ newTarget->addDeployConfiguration(newDc);
+ if (sourceTarget->activeDeployConfiguration() == sourceDc)
+ newTarget->setActiveDeployConfiguration(newDc);
+ }
+ if (!newTarget->activeBuildConfiguration()) {
+ QList<DeployConfiguration *> dcs = newTarget->deployConfigurations();
+ if (!dcs.isEmpty())
+ newTarget->setActiveDeployConfiguration(dcs.first());
+ }
+
+ foreach (RunConfiguration *sourceRc, sourceTarget->runConfigurations()) {
+ IRunConfigurationFactory *factory = IRunConfigurationFactory::find(newTarget, sourceRc);
+ if (!factory) {
+ runconfigurationError << sourceRc->displayName();
+ continue;
+ }
+ RunConfiguration *newRc = factory->clone(newTarget, sourceRc);
+ if (!newRc) {
+ runconfigurationError << sourceRc->displayName();
+ continue;
+ }
+ newRc->setDisplayName(sourceRc->displayName());
+ newTarget->addRunConfiguration(newRc);
+ if (sourceTarget->activeRunConfiguration() == sourceRc)
+ newTarget->setActiveRunConfiguration(newRc);
+ }
+ if (!newTarget->activeRunConfiguration()) {
+ QList<RunConfiguration *> rcs = newTarget->runConfigurations();
+ if (!rcs.isEmpty())
+ newTarget->setActiveRunConfiguration(rcs.first());
+ }
+
+ bool fatalError = false;
+ if (buildconfigurationError.count() == sourceTarget->buildConfigurations().count())
+ fatalError = true;
+
+ if (deployconfigurationError.count() == sourceTarget->deployConfigurations().count())
+ fatalError = true;
+
+ if (runconfigurationError.count() == sourceTarget->runConfigurations().count())
+ fatalError = true;
+
+ if (fatalError) {
+ // That could be a more granular error message
+ QMessageBox::critical(Core::ICore::mainWindow(),
+ tr("Incompatible Kit"),
+ tr("The Kit %1 is incompatible with Kit %2.")
+ .arg(sourceTarget->kit()->displayName())
+ .arg(k->displayName()));
+
+ delete newTarget;
+ newTarget = 0;
+ } else if (!buildconfigurationError.isEmpty()
+ || !deployconfigurationError.isEmpty()
+ || ! runconfigurationError.isEmpty()) {
+
+ QString error;
+ if (!buildconfigurationError.isEmpty())
+ error += tr("Build configurations:\n")
+ + buildconfigurationError.join(QLatin1String("\n"));
+
+ if (!deployconfigurationError.isEmpty()) {
+ if (!error.isEmpty())
+ error.append(QLatin1Char('\n'));
+ error += tr("Deploy configurations:\n")
+ + deployconfigurationError.join(QLatin1String("\n"));
+ }
+
+ if (!runconfigurationError.isEmpty()) {
+ if (!error.isEmpty())
+ error.append(QLatin1Char('\n'));
+ error += tr("Run configurations ")
+ + runconfigurationError.join(QLatin1String("\n"));
+ }
+
+ QMessageBox msgBox(Core::ICore::mainWindow());
+ msgBox.setIcon(QMessageBox::Warning);
+ msgBox.setWindowTitle(tr("Partial Incompatible Kit"));
+ msgBox.setText(tr("Some configurations could not be copied."));
+ msgBox.setDetailedText(error);
+ msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
+ if (msgBox.exec() != QDialog::Accepted) {
+ delete newTarget;
+ newTarget = 0;
+ }
+ }
+
+ return newTarget;
+}
+
+void TargetSettingsPanelWidget::removeTarget()
{
- Target *t = m_targets.at(targetIndex);
+ Target *t = m_targets.at(m_menuTargetIndex);
+ removeTarget(t);
+}
+void TargetSettingsPanelWidget::removeTarget(Target *t)
+{
ProjectExplorer::BuildManager *bm = ProjectExplorerPlugin::instance()->buildManager();
if (bm->isBuilding(t)) {
QMessageBox box;
@@ -307,7 +494,7 @@ void TargetSettingsPanelWidget::targetAdded(ProjectExplorer::Target *target)
}
connect(target, SIGNAL(displayNameChanged()), this, SLOT(renameTarget()));
- updateTargetAddAndRemoveButtons();
+ updateTargetButtons();
}
void TargetSettingsPanelWidget::removedTarget(ProjectExplorer::Target *target)
@@ -322,7 +509,7 @@ void TargetSettingsPanelWidget::removedTarget(ProjectExplorer::Target *target)
m_selector->removeTarget(index);
- updateTargetAddAndRemoveButtons();
+ updateTargetButtons();
}
void TargetSettingsPanelWidget::activeTargetChanged(ProjectExplorer::Target *target)
@@ -333,37 +520,61 @@ void TargetSettingsPanelWidget::activeTargetChanged(ProjectExplorer::Target *tar
m_selector->setCurrentIndex(index);
}
-void TargetSettingsPanelWidget::updateTargetAddAndRemoveButtons()
+namespace {
+bool diplayNameSorter(Kit *a, Kit *b)
+{
+ return a->displayName() < b->displayName();
+}
+}
+
+void TargetSettingsPanelWidget::createAction(Kit *k, QMenu *menu)
+{
+ QAction *action = new QAction(k->displayName(), menu);
+ action->setData(QVariant::fromValue(k->id()));
+ QString errorMessage;
+ if (!m_project->supportsKit(k, &errorMessage)) {
+ action->setEnabled(false);
+ action->setStatusTip(errorMessage);
+ }
+ menu->addAction(action);
+}
+
+void TargetSettingsPanelWidget::updateTargetButtons()
{
if (!m_selector)
return;
m_addMenu->clear();
+ m_targetMenu->clear();
- foreach (Kit *k, KitManager::instance()->kits()) {
- if (m_project->target(k))
- continue;
+ m_changeMenu = m_targetMenu->addMenu(tr("Change Kit"));
+ m_duplicateMenu = m_targetMenu->addMenu(tr("Copy to Kit"));
+ QAction *removeAction = m_targetMenu->addAction(tr("Remove Kit"));
- QAction *action = new QAction(k->displayName(), m_addMenu);
- action->setData(QVariant::fromValue(k->id()));
- QString errorMessage;
- if (!m_project->supportsKit(k, &errorMessage)) {
- action->setEnabled(false);
- action->setStatusTip(errorMessage);
- }
+ if (m_project->targets().size() < 2)
+ removeAction->setEnabled(false);
- bool inserted = false;
- foreach (QAction *existing, m_addMenu->actions()) {
- if (existing->text() > action->text()) {
- m_addMenu->insertAction(existing, action);
- inserted = true;
- break;
- }
- }
- if (!inserted)
- m_addMenu->addAction(action);
+ connect(m_changeMenu, SIGNAL(triggered(QAction*)),
+ this, SLOT(changeActionTriggered(QAction*)));
+ connect(m_duplicateMenu, SIGNAL(triggered(QAction*)),
+ this, SLOT(duplicateActionTriggered(QAction*)));
+ connect(removeAction, SIGNAL(triggered()), this, SLOT(removeTarget()));
+
+ QList<Kit *> kits = KitManager::instance()->kits();
+ qSort(kits.begin(), kits.end(), diplayNameSorter);
+ foreach (Kit *k, kits) {
+ if (m_project->target(k))
+ continue;
+ createAction(k, m_addMenu);
+ createAction(k, m_changeMenu);
+ createAction(k, m_duplicateMenu);
}
+ if (m_changeMenu->actions().isEmpty())
+ m_changeMenu->setEnabled(false);
+ if (m_duplicateMenu->actions().isEmpty())
+ m_duplicateMenu->setEnabled(false);
+
m_selector->setAddButtonEnabled(!m_addMenu->actions().isEmpty());
}
diff --git a/src/plugins/projectexplorer/targetsettingspanel.h b/src/plugins/projectexplorer/targetsettingspanel.h
index 3d9aa908e7..5749055d05 100644
--- a/src/plugins/projectexplorer/targetsettingspanel.h
+++ b/src/plugins/projectexplorer/targetsettingspanel.h
@@ -42,6 +42,7 @@ namespace ProjectExplorer {
class Target;
class Project;
+class Kit;
namespace Internal {
@@ -64,17 +65,24 @@ protected:
bool event(QEvent *event);
private slots:
void currentTargetChanged(int targetIndex, int subIndex);
- void removeTarget(int targetIndex);
void showTargetToolTip(const QPoint &globalPos, int targetIndex);
- void addTarget(QAction *);
void targetAdded(ProjectExplorer::Target *target);
void removedTarget(ProjectExplorer::Target *target);
void activeTargetChanged(ProjectExplorer::Target *target);
- void updateTargetAddAndRemoveButtons();
+ void updateTargetButtons();
void renameTarget();
void openTargetPreferences();
+ void removeTarget();
+ void menuShown(int targetIndex);
+ void addActionTriggered(QAction *action);
+ void changeActionTriggered(QAction *action);
+ void duplicateActionTriggered(QAction *action);
private:
+ Target *cloneTarget(Target *sourceTarget, Kit *k);
+ void removeTarget(Target *t);
+ void createAction(Kit *k, QMenu *menu);
+
Target *m_currentTarget;
Project *m_project;
TargetSettingsWidget *m_selector;
@@ -82,8 +90,12 @@ private:
QWidget *m_noTargetLabel;
PanelsWidget *m_panelWidgets[2];
QList<Target *> m_targets;
+ QMenu *m_targetMenu;
+ QMenu *m_changeMenu;
+ QMenu *m_duplicateMenu;
QMenu *m_addMenu;
QAction *m_lastAction;
+ int m_menuTargetIndex;
};
} // namespace Internal
diff --git a/src/plugins/projectexplorer/targetsettingswidget.cpp b/src/plugins/projectexplorer/targetsettingswidget.cpp
index 427903bd82..f2bdbb2e2b 100644
--- a/src/plugins/projectexplorer/targetsettingswidget.cpp
+++ b/src/plugins/projectexplorer/targetsettingswidget.cpp
@@ -62,12 +62,12 @@ TargetSettingsWidget::TargetSettingsWidget(QWidget *parent) :
headerLayout->addWidget(m_targetSelector, 0, Qt::AlignBottom);
headerLayout->addStretch(10);
- connect(m_targetSelector, SIGNAL(removeButtonClicked(int)),
- this, SIGNAL(removeButtonClicked(int)));
connect(m_targetSelector, SIGNAL(currentChanged(int,int)),
this, SIGNAL(currentChanged(int,int)));
connect(m_targetSelector, SIGNAL(toolTipRequested(QPoint,int)),
this, SIGNAL(toolTipRequested(QPoint,int)));
+ connect(m_targetSelector, SIGNAL(menuShown(int)),
+ this, SIGNAL(menuShown(int)));
QPalette shadowPal = palette();
QLinearGradient grad(0, 0, 0, 2);
@@ -118,6 +118,11 @@ void TargetSettingsWidget::setAddButtonMenu(QMenu *menu)
m_addButton->setMenu(menu);
}
+void TargetSettingsWidget::setTargetMenu(QMenu *menu)
+{
+ m_targetSelector->setTargetMenu(menu);
+}
+
QString TargetSettingsWidget::targetNameAt(int index) const
{
return m_targetSelector->targetAt(index).name;
diff --git a/src/plugins/projectexplorer/targetsettingswidget.h b/src/plugins/projectexplorer/targetsettingswidget.h
index 78eef585a4..227146d7d2 100644
--- a/src/plugins/projectexplorer/targetsettingswidget.h
+++ b/src/plugins/projectexplorer/targetsettingswidget.h
@@ -38,6 +38,8 @@ class QPushButton;
QT_END_NAMESPACE
namespace ProjectExplorer {
+class Target;
+class Kit;
namespace Internal {
namespace Ui {
@@ -66,12 +68,14 @@ public:
void setCurrentSubIndex(int index);
void setAddButtonEnabled(bool enabled);
void setAddButtonMenu(QMenu *menu);
-
+ void setTargetMenu(QMenu *menu);
signals:
- void removeButtonClicked(int targetIndex);
void currentChanged(int targetIndex, int subIndex);
void manageButtonClicked();
+ void duplicateButtonClicked();
+ void changeKitButtonClicked();
void toolTipRequested(const QPoint &globalPosition, int targetIndex);
+ void menuShown(int targetIndex);
protected:
void changeEvent(QEvent *e);
diff --git a/src/plugins/qmldesigner/components/componentcore/componentcore.pri b/src/plugins/qmldesigner/components/componentcore/componentcore.pri
new file mode 100644
index 0000000000..9035a629d7
--- /dev/null
+++ b/src/plugins/qmldesigner/components/componentcore/componentcore.pri
@@ -0,0 +1,5 @@
+VPATH += $$PWD
+INCLUDEPATH += $$PWD
+SOURCES += modelnodecontextmenu.cpp
+
+HEADERS += modelnodecontextmenu.h
diff --git a/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu.cpp
index 622b9bff04..92c0139683 100644
--- a/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu.cpp
@@ -433,6 +433,12 @@ void ModelNodeContextMenu::setScenePos(const QPoint &pos)
m_scenePos = pos;
}
+void ModelNodeContextMenu::showContextMenu(QmlModelView *view, const QPoint &globalPosition, const QPoint &scenePosition, bool showSelection)
+{
+ ModelNodeContextMenu contextMenu(view);
+ contextMenu.setScenePos(scenePosition);
+ contextMenu.execute(globalPosition, showSelection);
+}
ModelNodeAction* ModelNodeContextMenu::createModelNodeAction(const QString &description, QMenu *menu, const QList<ModelNode> &modelNodeList, ModelNodeAction::ModelNodeActionType type, bool enabled)
{
diff --git a/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h b/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu.h
index 4704952480..6aa11aa750 100644
--- a/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h
+++ b/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu.h
@@ -117,6 +117,8 @@ public:
void execute(const QPoint &pos, bool selectionMenu);
void setScenePos(const QPoint &pos);
+ static void showContextMenu(QmlModelView *view, const QPoint &globalPosition, const QPoint &scenePosition, bool showSelection);
+
private:
ModelNodeAction* createModelNodeAction(const QString &description, QMenu *menu, const QList<ModelNode> &modelNodeList, ModelNodeAction::ModelNodeActionType type, bool enabled = true);
diff --git a/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp b/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp
index e74b93dba4..11a31d3bec 100644
--- a/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp
@@ -31,6 +31,8 @@
#include "formeditorview.h"
#include "formeditorview.h"
+#include <modelnodecontextmenu.h>
+
#include <coreplugin/editormanager/editormanager.h>
#include <QDebug>
@@ -210,7 +212,7 @@ void AbstractFormEditorTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &
void AbstractFormEditorTool::showContextMenu(QGraphicsSceneMouseEvent *event)
{
- view()->showContextMenu(event->screenPos(), event->scenePos().toPoint(), true);
+ ModelNodeContextMenu::showContextMenu(view(), event->screenPos(), event->scenePos().toPoint(), true);
}
void AbstractFormEditorTool::clear()
diff --git a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp
index 28e90b4d9d..0e0897ffd8 100644
--- a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp
@@ -362,10 +362,10 @@ void MoveManipulator::reparentTo(FormEditorItem *newParent)
if (!itemsCanReparented())
return;
- if (!newParent->qmlItemNode().modelNode().metaInfo().isSubclassOf("<cpp>.QDeclarativeBasePositioner", -1, -1)
+ if (!newParent->qmlItemNode().modelNode().metaInfo().isPositioner()
&& newParent->qmlItemNode().modelNode().hasParentProperty()) {
ModelNode grandParent = newParent->qmlItemNode().modelNode().parentProperty().parentModelNode();
- if (grandParent.metaInfo().isSubclassOf("<cpp>.QDeclarativeBasePositioner", -1, -1))
+ if (grandParent.metaInfo().isPositioner())
newParent = m_view.data()->scene()->itemForQmlItemNode(QmlItemNode(grandParent));
}
diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp
index a61fdcfe80..afb145d567 100644
--- a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp
+++ b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp
@@ -31,30 +31,19 @@
#include "designdocumentcontrollerview.h"
#include "xuifiledialog.h"
#include "componentview.h"
-#include "subcomponentmanager.h"
-#include "model/viewlogger.h"
-#include <itemlibraryview.h>
#include <itemlibrarywidget.h>
-#include <navigatorview.h>
-#include <stateseditorview.h>
-#include <formeditorview.h>
-#include <propertyeditor.h>
#include <formeditorwidget.h>
#include <toolbox.h>
-#include <basetexteditmodifier.h>
-#include <componenttextmodifier.h>
#include <metainfo.h>
#include <invalidargumentexception.h>
-#include <componentview.h>
#include <componentaction.h>
#include <qmlobjectnode.h>
-#include <rewriterview.h>
#include <rewritingexception.h>
#include <nodelistproperty.h>
#include <variantproperty.h>
#include <rewritingexception.h>
-#include <model/modelnodecontextmenu.h>
+#include <modelnodecontextmenu.h>
#include <designmodewidget.h>
#include <projectexplorer/projectexplorer.h>
@@ -95,41 +84,9 @@ enum {
namespace QmlDesigner {
-class DesignDocumentControllerPrivate {
-public:
- QWeakPointer<FormEditorView> formEditorView;
-
- QWeakPointer<ItemLibraryView> itemLibraryView;
- QWeakPointer<NavigatorView> navigator;
- QWeakPointer<PropertyEditor> propertyEditorView;
- QWeakPointer<StatesEditorView> statesEditorView;
- QWeakPointer<QStackedWidget> stackedWidget;
- QWeakPointer<NodeInstanceView> nodeInstanceView;
- QWeakPointer<ComponentView> componentView;
-
- QWeakPointer<QmlDesigner::Model> model;
- QWeakPointer<QmlDesigner::Model> subComponentModel;
- QWeakPointer<QmlDesigner::Model> masterModel;
- QWeakPointer<QPlainTextEdit> textEdit;
- QWeakPointer<RewriterView> rewriterView;
- QmlDesigner::BaseTextEditModifier *textModifier;
- QmlDesigner::ComponentTextModifier *componentTextModifier;
- QWeakPointer<SubComponentManager> subComponentManager;
- QWeakPointer<Internal::ViewLogger> viewLogger;
- ModelNode componentNode;
-
- QString fileName;
- QUrl searchPath;
- bool documentLoaded;
- bool syncBlocked;
- int qt_versionId;
- static bool clearCrumblePath;
- static bool pushCrumblePath;
-};
-
-bool DesignDocumentControllerPrivate::clearCrumblePath = true;
-bool DesignDocumentControllerPrivate::pushCrumblePath = true;
+bool DesignDocumentController::s_clearCrumblePath = true;
+bool DesignDocumentController::s_pushCrumblePath = true;
/**
@@ -139,11 +96,10 @@ bool DesignDocumentControllerPrivate::pushCrumblePath = true;
and the different views/widgets accessing it.
*/
DesignDocumentController::DesignDocumentController(QObject *parent) :
- QObject(parent),
- d(new DesignDocumentControllerPrivate)
+ QObject(parent)
{
- d->documentLoaded = false;
- d->syncBlocked = false;
+ m_documentLoaded = false;
+ m_syncBlocked = false;
ProjectExplorer::ProjectExplorerPlugin *projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
connect(projectExplorer, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)), this, SLOT(activeQtVersionChanged()));
@@ -152,58 +108,56 @@ DesignDocumentController::DesignDocumentController(QObject *parent) :
DesignDocumentController::~DesignDocumentController()
{
- delete d->model.data();
- delete d->subComponentModel.data();
-
- delete d->rewriterView.data();
+ delete m_model.data();
+ delete m_subComponentModel.data();
- if (d->componentTextModifier) //componentTextModifier might not be created
- delete d->componentTextModifier;
+ delete m_rewriterView.data();
- delete d;
+ if (m_componentTextModifier) //componentTextModifier might not be created
+ delete m_componentTextModifier;
}
Model *DesignDocumentController::model() const
{
- return d->model.data();
+ return m_model.data();
}
Model *DesignDocumentController::masterModel() const
{
- return d->masterModel.data();
+ return m_masterModel.data();
}
void DesignDocumentController::detachNodeInstanceView()
{
- if (d->nodeInstanceView)
- model()->detachView(d->nodeInstanceView.data());
+ if (m_nodeInstanceView)
+ model()->detachView(m_nodeInstanceView.data());
}
void DesignDocumentController::attachNodeInstanceView()
{
- if (d->nodeInstanceView) {
- model()->attachView(d->nodeInstanceView.data());
+ if (m_nodeInstanceView) {
+ model()->attachView(m_nodeInstanceView.data());
}
- if (d->formEditorView) {
- d->formEditorView->resetView();
+ if (m_formEditorView) {
+ m_formEditorView->resetView();
}
}
void DesignDocumentController::changeToMasterModel()
{
- d->model->detachView(d->rewriterView.data());
- d->rewriterView->setTextModifier(d->textModifier);
- d->model = d->masterModel;
- d->model->attachView(d->rewriterView.data());
- d->componentNode = d->rewriterView->rootModelNode();
+ m_model->detachView(m_rewriterView.data());
+ m_rewriterView->setTextModifier(m_textModifier);
+ m_model = m_masterModel;
+ m_model->attachView(m_rewriterView.data());
+ m_componentNode = m_rewriterView->rootModelNode();
}
QVariant DesignDocumentController::createCrumbleBarInfo()
{
CrumbleBarInfo info;
info.fileName = fileName();
- info.modelNode = d->componentNode;
+ info.modelNode = m_componentNode;
return QVariant::fromValue<CrumbleBarInfo>(info);
}
@@ -214,7 +168,7 @@ QWidget *DesignDocumentController::centralWidget() const
QString DesignDocumentController::pathToQt() const
{
- QtSupport::BaseQtVersion *activeQtVersion = QtSupport::QtVersionManager::instance()->version(d->qt_versionId);
+ QtSupport::BaseQtVersion *activeQtVersion = QtSupport::QtVersionManager::instance()->version(m_qt_versionId);
if (activeQtVersion && (activeQtVersion->qtVersion().majorVersion > 3)
&& (activeQtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT)
|| activeQtVersion->type() == QLatin1String(QtSupport::Constants::SIMULATORQT)))
@@ -227,7 +181,7 @@ QString DesignDocumentController::pathToQt() const
*/
bool DesignDocumentController::isModelSyncBlocked() const
{
- return d->syncBlocked;
+ return m_syncBlocked;
}
/*!
@@ -239,35 +193,35 @@ bool DesignDocumentController::isModelSyncBlocked() const
*/
void DesignDocumentController::blockModelSync(bool block)
{
- if (d->syncBlocked == block)
+ if (m_syncBlocked == block)
return;
- d->syncBlocked = block;
+ m_syncBlocked = block;
- if (d->textModifier) {
- if (d->syncBlocked) {
+ if (m_textModifier) {
+ if (m_syncBlocked) {
detachNodeInstanceView();
- d->textModifier->deactivateChangeSignals();
+ m_textModifier->deactivateChangeSignals();
} else {
activeQtVersionChanged();
changeToMasterModel();
QmlModelState state;
//We go back to base state (and back again) to avoid side effects from text editing.
- if (d->statesEditorView && d->statesEditorView->model()) {
- state = d->statesEditorView->currentState();
- d->statesEditorView->setCurrentState(d->statesEditorView->baseState());
+ if (m_statesEditorView && m_statesEditorView->model()) {
+ state = m_statesEditorView->currentState();
+ m_statesEditorView->setCurrentState(m_statesEditorView->baseState());
}
- d->textModifier->reactivateChangeSignals();
+ m_textModifier->reactivateChangeSignals();
- if (state.isValid() && d->statesEditorView)
- d->statesEditorView->setCurrentState(state);
+ if (state.isValid() && m_statesEditorView)
+ m_statesEditorView->setCurrentState(state);
attachNodeInstanceView();
- if (d->propertyEditorView)
- d->propertyEditorView->resetView();
- if (d->formEditorView)
- d->formEditorView->resetView();
+ if (m_propertyEditorView)
+ m_propertyEditorView->resetView();
+ if (m_formEditorView)
+ m_formEditorView->resetView();
}
}
}
@@ -277,43 +231,43 @@ void DesignDocumentController::blockModelSync(bool block)
*/
QList<RewriterView::Error> DesignDocumentController::qmlErrors() const
{
- return d->rewriterView->errors();
+ return m_rewriterView->errors();
}
void DesignDocumentController::setItemLibraryView(ItemLibraryView* itemLibraryView)
{
- d->itemLibraryView = itemLibraryView;
+ m_itemLibraryView = itemLibraryView;
}
void DesignDocumentController::setNavigator(NavigatorView* navigatorView)
{
- d->navigator = navigatorView;
+ m_navigator = navigatorView;
}
void DesignDocumentController::setPropertyEditorView(PropertyEditor *propertyEditor)
{
- d->propertyEditorView = propertyEditor;
+ m_propertyEditorView = propertyEditor;
}
void DesignDocumentController::setStatesEditorView(StatesEditorView* statesEditorView)
{
- d->statesEditorView = statesEditorView;
+ m_statesEditorView = statesEditorView;
}
void DesignDocumentController::setFormEditorView(FormEditorView *formEditorView)
{
- d->formEditorView = formEditorView;
+ m_formEditorView = formEditorView;
}
void DesignDocumentController::setNodeInstanceView(NodeInstanceView *nodeInstanceView)
{
- d->nodeInstanceView = nodeInstanceView;
+ m_nodeInstanceView = nodeInstanceView;
}
void DesignDocumentController::setComponentView(ComponentView *componentView)
{
- d->componentView = componentView;
- connect(d->componentView->action(), SIGNAL(currentComponentChanged(ModelNode)), SLOT(changeCurrentModelTo(ModelNode)));
+ m_componentView = componentView;
+ connect(componentView->action(), SIGNAL(currentComponentChanged(ModelNode)), SLOT(changeCurrentModelTo(ModelNode)));
}
static inline bool compareCrumbleBarInfo(const CrumbleBarInfo &crumbleBarInfo1, const CrumbleBarInfo &crumbleBarInfo2)
@@ -323,20 +277,20 @@ static inline bool compareCrumbleBarInfo(const CrumbleBarInfo &crumbleBarInfo1,
void DesignDocumentController::setCrumbleBarInfo(const CrumbleBarInfo &crumbleBarInfo)
{
- DesignDocumentControllerPrivate::clearCrumblePath = false;
- DesignDocumentControllerPrivate::pushCrumblePath = false;
- while (!compareCrumbleBarInfo(d->formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>(), crumbleBarInfo))
- d->formEditorView->crumblePath()->popElement();
+ s_clearCrumblePath = false;
+ s_pushCrumblePath = false;
+ while (!compareCrumbleBarInfo(m_formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>(), crumbleBarInfo))
+ m_formEditorView->crumblePath()->popElement();
Core::EditorManager::openEditor(crumbleBarInfo.fileName);
- DesignDocumentControllerPrivate::pushCrumblePath = true;
+ s_pushCrumblePath = true;
Internal::DesignModeWidget::instance()->currentDesignDocumentController()->changeToSubComponent(crumbleBarInfo.modelNode);
- DesignDocumentControllerPrivate::clearCrumblePath = true;
+ s_clearCrumblePath = true;
}
void DesignDocumentController::setBlockCrumbleBar(bool b)
{
- DesignDocumentControllerPrivate::clearCrumblePath = !b;
- DesignDocumentControllerPrivate::pushCrumblePath = !b;
+ s_clearCrumblePath = !b;
+ s_pushCrumblePath = !b;
}
QString DesignDocumentController::displayName() const
@@ -349,14 +303,14 @@ QString DesignDocumentController::displayName() const
QString DesignDocumentController::simplfiedDisplayName() const
{
- if (!d->componentNode.isRootNode()) {
- if (d->componentNode.id().isEmpty()) {
- if (d->formEditorView->rootModelNode().id().isEmpty()) {
- return d->formEditorView->rootModelNode().simplifiedTypeName();
+ if (!m_componentNode.isRootNode()) {
+ if (m_componentNode.id().isEmpty()) {
+ if (m_formEditorView->rootModelNode().id().isEmpty()) {
+ return m_formEditorView->rootModelNode().simplifiedTypeName();
}
- return d->formEditorView->rootModelNode().id();
+ return m_formEditorView->rootModelNode().id();
}
- return d->componentNode.id();
+ return m_componentNode.id();
}
QStringList list = displayName().split(QLatin1Char('/'));
@@ -365,24 +319,24 @@ QString DesignDocumentController::simplfiedDisplayName() const
QString DesignDocumentController::fileName() const
{
- return d->fileName;
+ return m_fileName;
}
void DesignDocumentController::setFileName(const QString &fileName)
{
- d->fileName = fileName;
+ m_fileName = fileName;
if (QFileInfo(fileName).exists()) {
- d->searchPath = QUrl::fromLocalFile(fileName);
+ m_searchPath = QUrl::fromLocalFile(fileName);
} else {
- d->searchPath = QUrl(fileName);
+ m_searchPath = QUrl(fileName);
}
- if (d->model)
- d->model->setFileUrl(d->searchPath);
+ if (m_model)
+ m_model->setFileUrl(m_searchPath);
- if (d->itemLibraryView)
- d->itemLibraryView->widget()->setResourcePath(QFileInfo(fileName).absolutePath());
+ if (m_itemLibraryView)
+ m_itemLibraryView->widget()->setResourcePath(QFileInfo(fileName).absolutePath());
emit displayNameChanged(displayName());
}
@@ -390,7 +344,7 @@ QList<RewriterView::Error> DesignDocumentController::loadMaster(QPlainTextEdit *
{
Q_CHECK_PTR(edit);
- d->textEdit = edit;
+ m_textEdit = edit;
connect(edit, SIGNAL(undoAvailable(bool)),
this, SIGNAL(undoAvailable(bool)));
@@ -399,70 +353,70 @@ QList<RewriterView::Error> DesignDocumentController::loadMaster(QPlainTextEdit *
connect(edit, SIGNAL(modificationChanged(bool)),
this, SIGNAL(dirtyStateChanged(bool)));
- d->textModifier = new BaseTextEditModifier(dynamic_cast<TextEditor::BaseTextEditorWidget*>(d->textEdit.data()));
+ m_textModifier = new BaseTextEditModifier(dynamic_cast<TextEditor::BaseTextEditorWidget*>(m_textEdit.data()));
- d->componentTextModifier = 0;
+ m_componentTextModifier = 0;
- //d->masterModel = Model::create(d->textModifier, d->searchPath, errors);
+ //masterModel = Model::create(textModifier, searchPath, errors);
- d->masterModel = Model::create("QtQuick.Rectangle", 1, 0);
+ m_masterModel = Model::create("QtQuick.Rectangle", 1, 0);
#if defined(VIEWLOGGER)
- d->viewLogger = new Internal::ViewLogger(d->model.data());
- d->masterModel->attachView(d->viewLogger.data());
+ m_viewLogger = new Internal::ViewLogger(m_model.data());
+ m_masterModel->attachView(m_viewLogger.data());
#endif
- d->masterModel->setFileUrl(d->searchPath);
+ m_masterModel->setFileUrl(m_searchPath);
- d->subComponentModel = Model::create("QtQuick.Rectangle", 1, 0);
- d->subComponentModel->setFileUrl(d->searchPath);
+ m_subComponentModel = Model::create("QtQuick.Rectangle", 1, 0);
+ m_subComponentModel->setFileUrl(m_searchPath);
- d->rewriterView = new RewriterView(RewriterView::Amend, d->masterModel.data());
- d->rewriterView->setTextModifier( d->textModifier);
- connect(d->rewriterView.data(), SIGNAL(errorsChanged(QList<RewriterView::Error>)),
+ m_rewriterView = new RewriterView(RewriterView::Amend, m_masterModel.data());
+ m_rewriterView->setTextModifier( m_textModifier);
+ connect(m_rewriterView.data(), SIGNAL(errorsChanged(QList<RewriterView::Error>)),
this, SIGNAL(qmlErrorsChanged(QList<RewriterView::Error>)));
- d->masterModel->attachView(d->rewriterView.data());
- d->model = d->masterModel;
- d->componentNode = d->rewriterView->rootModelNode();
+ m_masterModel->attachView(m_rewriterView.data());
+ m_model = m_masterModel;
+ m_componentNode = m_rewriterView->rootModelNode();
- d->subComponentManager = new SubComponentManager(d->masterModel.data(), this);
- d->subComponentManager->update(d->searchPath, d->model->imports());
+ m_subComponentManager = new SubComponentManager(m_masterModel.data(), this);
+ m_subComponentManager->update(m_searchPath, m_model->imports());
loadCurrentModel();
- d->masterModel->attachView(d->componentView.data());
+ m_masterModel->attachView(m_componentView.data());
- return d->rewriterView->errors();
+ return m_rewriterView->errors();
}
void DesignDocumentController::changeCurrentModelTo(const ModelNode &node)
{
- if (d->componentNode == node)
+ if (m_componentNode == node)
return;
if (Internal::DesignModeWidget::instance()->currentDesignDocumentController() != this)
return;
- DesignDocumentControllerPrivate::clearCrumblePath = false;
- while (d->formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>().modelNode.isValid() &&
- !d->formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>().modelNode.isRootNode())
- d->formEditorView->crumblePath()->popElement();
- if (node.isRootNode() && d->formEditorView->crumblePath()->dataForLastIndex().isValid())
- d->formEditorView->crumblePath()->popElement();
+ s_clearCrumblePath = false;
+ while (m_formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>().modelNode.isValid() &&
+ !m_formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>().modelNode.isRootNode())
+ m_formEditorView->crumblePath()->popElement();
+ if (node.isRootNode() && m_formEditorView->crumblePath()->dataForLastIndex().isValid())
+ m_formEditorView->crumblePath()->popElement();
changeToSubComponent(node);
- DesignDocumentControllerPrivate::clearCrumblePath = true;
+ s_clearCrumblePath = true;
}
void DesignDocumentController::changeToSubComponent(const ModelNode &componentNode)
{
- Q_ASSERT(d->masterModel);
- QWeakPointer<Model> oldModel = d->model;
+ Q_ASSERT(m_masterModel);
+ QWeakPointer<Model> oldModel = m_model;
Q_ASSERT(oldModel.data());
- if (d->model == d->subComponentModel) {
+ if (m_model == m_subComponentModel) {
changeToMasterModel();
}
- QString componentText = d->rewriterView->extractText(QList<ModelNode>() << componentNode).value(componentNode);
+ QString componentText = m_rewriterView->extractText(QList<ModelNode>() << componentNode).value(componentNode);
if (componentText.isEmpty())
return;
@@ -472,110 +426,110 @@ void DesignDocumentController::changeToSubComponent(const ModelNode &componentNo
explicitComponent = true;
}
- d->componentNode = componentNode;
+ m_componentNode = componentNode;
if (!componentNode.isRootNode()) {
- Q_ASSERT(d->model == d->masterModel);
+ Q_ASSERT(m_model == m_masterModel);
Q_ASSERT(componentNode.isValid());
//change to subcomponent model
ModelNode rootModelNode = componentNode.view()->rootModelNode();
Q_ASSERT(rootModelNode.isValid());
- if (d->componentTextModifier)
- delete d->componentTextModifier;
+ if (m_componentTextModifier)
+ delete m_componentTextModifier;
int componentStartOffset;
int componentEndOffset;
- int rootStartOffset = d->rewriterView->nodeOffset(rootModelNode);
+ int rootStartOffset = m_rewriterView->nodeOffset(rootModelNode);
if (explicitComponent) { //the component is explciit we have to find the first definition inside
- componentStartOffset = d->rewriterView->firstDefinitionInsideOffset(componentNode);
- componentEndOffset = componentStartOffset + d->rewriterView->firstDefinitionInsideLength(componentNode);
+ componentStartOffset = m_rewriterView->firstDefinitionInsideOffset(componentNode);
+ componentEndOffset = componentStartOffset + m_rewriterView->firstDefinitionInsideLength(componentNode);
} else { //the component is implicit
- componentStartOffset = d->rewriterView->nodeOffset(componentNode);
- componentEndOffset = componentStartOffset + d->rewriterView->nodeLength(componentNode);
+ componentStartOffset = m_rewriterView->nodeOffset(componentNode);
+ componentEndOffset = componentStartOffset + m_rewriterView->nodeLength(componentNode);
}
- d->componentTextModifier = new ComponentTextModifier (d->textModifier, componentStartOffset, componentEndOffset, rootStartOffset);
+ m_componentTextModifier = new ComponentTextModifier (m_textModifier, componentStartOffset, componentEndOffset, rootStartOffset);
- d->model->detachView(d->rewriterView.data());
+ m_model->detachView(m_rewriterView.data());
- d->rewriterView->setTextModifier(d->componentTextModifier);
+ m_rewriterView->setTextModifier(m_componentTextModifier);
- d->subComponentModel->attachView(d->rewriterView.data());
+ m_subComponentModel->attachView(m_rewriterView.data());
- Q_ASSERT(d->rewriterView->rootModelNode().isValid());
+ Q_ASSERT(m_rewriterView->rootModelNode().isValid());
- d->model = d->subComponentModel;
+ m_model = m_subComponentModel;
}
- Q_ASSERT(d->masterModel);
- Q_ASSERT(d->model);
+ Q_ASSERT(m_masterModel);
+ Q_ASSERT(m_model);
loadCurrentModel();
- d->componentView->setComponentNode(componentNode);
+ m_componentView->setComponentNode(componentNode);
}
void DesignDocumentController::changeToExternalSubComponent(const QString &fileName)
{
- DesignDocumentControllerPrivate::clearCrumblePath = false;
+ s_clearCrumblePath = false;
Core::EditorManager::openEditor(fileName);
- DesignDocumentControllerPrivate::clearCrumblePath = true;
+ s_clearCrumblePath = true;
}
void DesignDocumentController::goIntoComponent()
{
- if (!d->model)
+ if (!m_model)
return;
QList<ModelNode> selectedNodes;
- if (d->formEditorView)
- selectedNodes = d->formEditorView->selectedModelNodes();
+ if (m_formEditorView)
+ selectedNodes = m_formEditorView->selectedModelNodes();
- DesignDocumentControllerPrivate::clearCrumblePath = false;
+ s_clearCrumblePath = false;
if (selectedNodes.count() == 1)
ModelNodeAction::goIntoComponent(selectedNodes.first());
- DesignDocumentControllerPrivate::clearCrumblePath = true;
+ s_clearCrumblePath = true;
}
void DesignDocumentController::loadCurrentModel()
{
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
- Q_ASSERT(d->masterModel);
- Q_ASSERT(d->model);
- d->model->setMasterModel(d->masterModel.data());
- d->masterModel->attachView(d->componentView.data());
+ Q_ASSERT(m_masterModel);
+ Q_ASSERT(m_model);
+ m_model->setMasterModel(m_masterModel.data());
+ m_masterModel->attachView(m_componentView.data());
- d->nodeInstanceView->setPathToQt(pathToQt());
- d->model->attachView(d->nodeInstanceView.data());
- d->model->attachView(d->navigator.data());
- d->itemLibraryView->widget()->setResourcePath(QFileInfo(d->fileName).absolutePath());
+ m_nodeInstanceView->setPathToQt(pathToQt());
+ m_model->attachView(m_nodeInstanceView.data());
+ m_model->attachView(m_navigator.data());
+ m_itemLibraryView->widget()->setResourcePath(QFileInfo(m_fileName).absolutePath());
- d->model->attachView(d->formEditorView.data());
- d->model->attachView(d->itemLibraryView.data());
+ m_model->attachView(m_formEditorView.data());
+ m_model->attachView(m_itemLibraryView.data());
- if (!d->textEdit->parent()) // hack to prevent changing owner of external text edit
- d->stackedWidget->addWidget(d->textEdit.data());
+ if (!m_textEdit->parent()) // hack to prevent changing owner of external text edit
+ m_stackedWidget->addWidget(m_textEdit.data());
// Will call setCurrentState (formEditorView etc has to be constructed first)
- d->model->attachView(d->statesEditorView.data());
+ m_model->attachView(m_statesEditorView.data());
- d->model->attachView(d->propertyEditorView.data());
+ m_model->attachView(m_propertyEditorView.data());
- if (DesignDocumentControllerPrivate::clearCrumblePath)
- d->formEditorView->crumblePath()->clear();
+ if (s_clearCrumblePath)
+ m_formEditorView->crumblePath()->clear();
- if (DesignDocumentControllerPrivate::pushCrumblePath &&
- !compareCrumbleBarInfo(d->formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>(),
+ if (s_pushCrumblePath &&
+ !compareCrumbleBarInfo(m_formEditorView->crumblePath()->dataForLastIndex().value<CrumbleBarInfo>(),
createCrumbleBarInfo().value<CrumbleBarInfo>()))
- d->formEditorView->crumblePath()->pushElement(simplfiedDisplayName(), createCrumbleBarInfo());
+ m_formEditorView->crumblePath()->pushElement(simplfiedDisplayName(), createCrumbleBarInfo());
- d->documentLoaded = true;
- d->subComponentManager->update(d->searchPath, d->model->imports());
- Q_ASSERT(d->masterModel);
+ m_documentLoaded = true;
+ m_subComponentManager->update(m_searchPath, m_model->imports());
+ Q_ASSERT(m_masterModel);
QApplication::restoreOverrideCursor();
}
@@ -589,7 +543,7 @@ QList<RewriterView::Error> DesignDocumentController::loadMaster(const QByteArray
void DesignDocumentController::saveAs(QWidget *parent)
{
- QFileInfo oldFileInfo(d->fileName);
+ QFileInfo oldFileInfo(m_fileName);
XUIFileDialog::runSaveFileDialog(oldFileInfo.path(), parent, this, SLOT(doRealSaveAs(QString)));
}
@@ -621,8 +575,8 @@ void DesignDocumentController::doRealSaveAs(const QString &fileName)
bool DesignDocumentController::isDirty() const
{
- if (d->textEdit)
- return d->textEdit->document()->isModified();
+ if (m_textEdit)
+ return m_textEdit->document()->isModified();
else
return false;
}
@@ -630,33 +584,33 @@ bool DesignDocumentController::isDirty() const
bool DesignDocumentController::isUndoAvailable() const
{
- if (d->textEdit)
- return d->textEdit->document()->isUndoAvailable();
+ if (m_textEdit)
+ return m_textEdit->document()->isUndoAvailable();
return false;
}
bool DesignDocumentController::isRedoAvailable() const
{
- if (d->textEdit)
- return d->textEdit->document()->isRedoAvailable();
+ if (m_textEdit)
+ return m_textEdit->document()->isRedoAvailable();
return false;
}
void DesignDocumentController::close()
{
- d->documentLoaded = false;
+ m_documentLoaded = false;
emit designDocumentClosed();
}
void DesignDocumentController::deleteSelected()
{
- if (!d->model)
+ if (!m_model)
return;
try {
- if (d->formEditorView) {
- RewriterTransaction transaction(d->formEditorView.data());
- QList<ModelNode> toDelete = d->formEditorView->selectedModelNodes();
+ if (m_formEditorView) {
+ RewriterTransaction transaction(m_formEditorView.data());
+ QList<ModelNode> toDelete = m_formEditorView->selectedModelNodes();
foreach (ModelNode node, toDelete) {
if (node.isValid() && !node.isRootNode() && QmlObjectNode(node).isValid())
QmlObjectNode(node).destroy();
@@ -669,15 +623,15 @@ void DesignDocumentController::deleteSelected()
void DesignDocumentController::copySelected()
{
- QScopedPointer<Model> model(Model::create("QtQuick.Rectangle", 1, 0, this->model()));
- model->setFileUrl(d->model->fileUrl());
- model->changeImports(d->model->imports(), QList<Import>());
+ QScopedPointer<Model> copyModel(Model::create("QtQuick.Rectangle", 1, 0, model()));
+ copyModel->setFileUrl(model()->fileUrl());
+ copyModel->changeImports(model()->imports(), QList<Import>());
- Q_ASSERT(model);
+ Q_ASSERT(copyModel);
DesignDocumentControllerView view;
- d->model->attachView(&view);
+ m_model->attachView(&view);
if (view.selectedModelNodes().isEmpty())
return;
@@ -697,9 +651,9 @@ void DesignDocumentController::copySelected()
if (!selectedNode.isValid())
return;
- d->model->detachView(&view);
+ m_model->detachView(&view);
- model->attachView(&view);
+ copyModel->attachView(&view);
view.replaceModel(selectedNode);
Q_ASSERT(view.rootModelNode().isValid());
@@ -707,8 +661,8 @@ void DesignDocumentController::copySelected()
view.toClipboard();
} else { //multi items selected
- d->model->detachView(&view);
- model->attachView(&view);
+ m_model->detachView(&view);
+ copyModel->attachView(&view);
foreach (ModelNode node, view.rootModelNode().allDirectSubModelNodes()) {
node.destroy();
@@ -764,17 +718,17 @@ static void scatterItem(ModelNode pastedNode, const ModelNode targetNode, int of
void DesignDocumentController::paste()
{
- QScopedPointer<Model> model(Model::create("empty", 1, 0, this->model()));
- model->setFileUrl(d->model->fileUrl());
- model->changeImports(d->model->imports(), QList<Import>());
+ QScopedPointer<Model> pasteModel(Model::create("empty", 1, 0, model()));
+ pasteModel->setFileUrl(model()->fileUrl());
+ pasteModel->changeImports(model()->imports(), QList<Import>());
- Q_ASSERT(model);
+ Q_ASSERT(pasteModel);
- if (!d->model)
+ if (!pasteModel)
return;
DesignDocumentControllerView view;
- model->attachView(&view);
+ pasteModel->attachView(&view);
view.fromClipboard();
@@ -787,8 +741,8 @@ void DesignDocumentController::paste()
QList<ModelNode> selectedNodes = rootNode.allDirectSubModelNodes();
qDebug() << rootNode;
qDebug() << selectedNodes;
- model->detachView(&view);
- d->model->attachView(&view);
+ pasteModel->detachView(&view);
+ m_model->attachView(&view);
ModelNode targetNode;
@@ -813,7 +767,7 @@ void DesignDocumentController::paste()
QList<ModelNode> pastedNodeList;
try {
- RewriterTransaction transaction(d->formEditorView.data());
+ RewriterTransaction transaction(m_formEditorView.data());
int offset = double(qrand()) / RAND_MAX * 20 - 10;
@@ -831,10 +785,10 @@ void DesignDocumentController::paste()
}
} else {
try {
- RewriterTransaction transaction(d->formEditorView.data());
+ RewriterTransaction transaction(m_formEditorView.data());
- model->detachView(&view);
- d->model->attachView(&view);
+ pasteModel->detachView(&view);
+ m_model->attachView(&view);
ModelNode pastedNode(view.insertModel(rootNode));
ModelNode targetNode;
@@ -870,11 +824,11 @@ void DesignDocumentController::paste()
void DesignDocumentController::selectAll()
{
- if (!d->model)
+ if (!m_model)
return;
DesignDocumentControllerView view;
- d->model->attachView(&view);
+ m_model->attachView(&view);
QList<ModelNode> allNodesExceptRootNode(view.allModelNodes());
@@ -884,21 +838,21 @@ void DesignDocumentController::selectAll()
RewriterView *DesignDocumentController::rewriterView() const
{
- return d->rewriterView.data();
+ return m_rewriterView.data();
}
void DesignDocumentController::undo()
{
- if (d->rewriterView && !d->rewriterView->modificationGroupActive())
- d->textEdit->undo();
- d->propertyEditorView->resetView();
+ if (m_rewriterView && !m_rewriterView->modificationGroupActive())
+ m_textEdit->undo();
+ m_propertyEditorView->resetView();
}
void DesignDocumentController::redo()
{
- if (d->rewriterView && !d->rewriterView->modificationGroupActive())
- d->textEdit->redo();
- d->propertyEditorView->resetView();
+ if (m_rewriterView && !m_rewriterView->modificationGroupActive())
+ m_textEdit->redo();
+ m_propertyEditorView->resetView();
}
static inline QtSupport::BaseQtVersion *getActiveQtVersion(DesignDocumentController *controller)
@@ -929,48 +883,48 @@ void DesignDocumentController::activeQtVersionChanged()
QtSupport::BaseQtVersion *newQtVersion = getActiveQtVersion(this);
if (!newQtVersion ) {
- d->qt_versionId = -1;
+ m_qt_versionId = -1;
return;
}
- if (d->qt_versionId == newQtVersion->uniqueId())
+ if (m_qt_versionId == newQtVersion->uniqueId())
return;
- d->qt_versionId = newQtVersion->uniqueId();
+ m_qt_versionId = newQtVersion->uniqueId();
- if (d->nodeInstanceView)
- d->nodeInstanceView->setPathToQt(pathToQt());
+ if (m_nodeInstanceView)
+ m_nodeInstanceView->setPathToQt(pathToQt());
}
#ifdef ENABLE_TEXT_VIEW
void DesignDocumentController::showText()
{
- d->stackedWidget->setCurrentWidget(d->textEdit.data());
+ m_stackedWidget->setCurrentWidget(m_textEdit.data());
}
#endif // ENABLE_TEXT_VIEW
#ifdef ENABLE_TEXT_VIEW
void DesignDocumentController::showForm()
{
- d->stackedWidget->setCurrentWidget(d->formEditorView->widget());
+ m_stackedWidget->setCurrentWidget(m_formEditorView->widget());
}
#endif // ENABLE_TEXT_VIEW
bool DesignDocumentController::save(QWidget *parent)
{
- // qDebug() << "Saving document to file \"" << d->fileName << "\"...";
+ // qDebug() << "Saving document to file \"" << fileName << "\"...";
//
- if (d->fileName.isEmpty()) {
+ if (m_fileName.isEmpty()) {
saveAs(parent);
return true;
}
- Utils::FileSaver saver(d->fileName, QIODevice::Text);
- if (d->model)
- saver.write(d->textEdit->toPlainText().toLatin1());
- if (!saver.finalize(parent ? parent : d->stackedWidget.data()))
+ Utils::FileSaver saver(m_fileName, QIODevice::Text);
+ if (m_model)
+ saver.write(m_textEdit->toPlainText().toLatin1());
+ if (!saver.finalize(parent ? parent : m_stackedWidget.data()))
return false;
- if (d->model)
- d->textEdit->setPlainText(d->textEdit->toPlainText()); // clear undo/redo history
+ if (m_model)
+ m_textEdit->setPlainText(m_textEdit->toPlainText()); // clear undo/redo history
return true;
}
@@ -979,7 +933,7 @@ bool DesignDocumentController::save(QWidget *parent)
QString DesignDocumentController::contextHelpId() const
{
DesignDocumentControllerView view;
- d->model->attachView(&view);
+ m_model->attachView(&view);
QList<ModelNode> nodes = view.selectedModelNodes();
QString helpId;
diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.h b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.h
index 097c5a3919..6d74305e9c 100644
--- a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.h
+++ b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.h
@@ -32,9 +32,24 @@
#include "rewriterview.h"
+#include <model.h>
+#include <rewriterview.h>
+#include <itemlibraryview.h>
+#include <navigatorview.h>
+#include <stateseditorview.h>
+#include <formeditorview.h>
+#include <propertyeditor.h>
+#include <componentview.h>
+#include <basetexteditmodifier.h>
+#include <componenttextmodifier.h>
+#include <subcomponentmanager.h>
+#include <model/viewlogger.h>
+
#include <QObject>
#include <QString>
+#include <QStackedWidget>
+
QT_BEGIN_NAMESPACE
class QUndoStack;
class QWidget;
@@ -46,23 +61,14 @@ QT_END_NAMESPACE
namespace QmlDesigner {
-class Model;
class ModelNode;
class TextModifier;
class QmlObjectNode;
-class RewriterView;
-class ItemLibraryView;
-class NavigatorView;
-class ComponentView;
-class PropertyEditor;
-class StatesEditorView;
-class FormEditorView;
struct CrumbleBarInfo;
class DesignDocumentController: public QObject
{
Q_OBJECT
-
public:
DesignDocumentController(QObject *parent);
~DesignDocumentController();
@@ -71,7 +77,7 @@ public:
QString simplfiedDisplayName() const;
QString fileName() const;
- void setFileName(const QString &fileName);
+ void setFileName(const QString &m_fileName);
QList<RewriterView::Error> loadMaster(QPlainTextEdit *edit);
QList<RewriterView::Error> loadMaster(const QByteArray &qml);
@@ -93,13 +99,13 @@ public:
QString contextHelpId() const;
QList<RewriterView::Error> qmlErrors() const;
- void setItemLibraryView(ItemLibraryView* itemLibraryView);
+ void setItemLibraryView(ItemLibraryView* m_itemLibraryView);
void setNavigator(NavigatorView* navigatorView);
void setPropertyEditorView(PropertyEditor *propertyEditor);
- void setStatesEditorView(StatesEditorView* statesEditorView);
- void setFormEditorView(FormEditorView *formEditorView);
- void setNodeInstanceView(NodeInstanceView *nodeInstanceView);
- void setComponentView(ComponentView *componentView);
+ void setStatesEditorView(StatesEditorView* m_statesEditorView);
+ void setFormEditorView(FormEditorView *m_formEditorView);
+ void setNodeInstanceView(NodeInstanceView *m_nodeInstanceView);
+ void setComponentView(ComponentView *m_componentView);
void setCrumbleBarInfo(const CrumbleBarInfo &crumbleBarInfo);
static void setBlockCrumbleBar(bool);
@@ -128,7 +134,7 @@ public slots:
void activeQtVersionChanged();
void changeCurrentModelTo(const ModelNode &node);
void changeToSubComponent(const ModelNode &node);
- void changeToExternalSubComponent(const QString &fileName);
+ void changeToExternalSubComponent(const QString &m_fileName);
void goIntoComponent();
#ifdef ENABLE_TEXT_VIEW
@@ -137,9 +143,9 @@ public slots:
#endif // ENABLE_TEXT_VIEW
private slots:
- void doRealSaveAs(const QString &fileName);
+ void doRealSaveAs(const QString &m_fileName);
-private:
+private: // functions
void detachNodeInstanceView();
void attachNodeInstanceView();
void changeToMasterModel();
@@ -148,8 +154,35 @@ private:
QWidget *centralWidget() const;
QString pathToQt() const;
-
- class DesignDocumentControllerPrivate *d;
+private: // variables
+ QWeakPointer<FormEditorView> m_formEditorView;
+
+ QWeakPointer<ItemLibraryView> m_itemLibraryView;
+ QWeakPointer<NavigatorView> m_navigator;
+ QWeakPointer<PropertyEditor> m_propertyEditorView;
+ QWeakPointer<StatesEditorView> m_statesEditorView;
+ QWeakPointer<QStackedWidget> m_stackedWidget;
+ QWeakPointer<NodeInstanceView> m_nodeInstanceView;
+ QWeakPointer<ComponentView> m_componentView;
+
+ QWeakPointer<Model> m_model;
+ QWeakPointer<Model> m_subComponentModel;
+ QWeakPointer<Model> m_masterModel;
+ QWeakPointer<QPlainTextEdit> m_textEdit;
+ QWeakPointer<RewriterView> m_rewriterView;
+ BaseTextEditModifier *m_textModifier;
+ ComponentTextModifier *m_componentTextModifier;
+ QWeakPointer<SubComponentManager> m_subComponentManager;
+ QWeakPointer<Internal::ViewLogger> m_viewLogger;
+ ModelNode m_componentNode;
+
+ QString m_fileName;
+ QUrl m_searchPath;
+ bool m_documentLoaded;
+ bool m_syncBlocked;
+ int m_qt_versionId;
+ static bool s_clearCrumblePath;
+ static bool s_pushCrumblePath;
};
diff --git a/src/plugins/qmldesigner/components/integration/integration.pri b/src/plugins/qmldesigner/components/integration/integration.pri
index 1548688998..66efed8971 100644
--- a/src/plugins/qmldesigner/components/integration/integration.pri
+++ b/src/plugins/qmldesigner/components/integration/integration.pri
@@ -1,7 +1,6 @@
VPATH += $$PWD
INCLUDEPATH += $$PWD
SOURCES += \
- integrationcore.cpp \
designdocumentcontroller.cpp \
designdocumentcontrollerview.cpp \
utilitypanelcontroller.cpp \
@@ -11,7 +10,6 @@ SOURCES += \
xuifiledialog.cpp
HEADERS += \
- integrationcore.h \
designdocumentcontrollerview.h \
designdocumentcontroller.h \
utilitypanelcontroller.h \
diff --git a/src/plugins/qmldesigner/components/integration/integrationcore.cpp b/src/plugins/qmldesigner/components/integration/integrationcore.cpp
deleted file mode 100644
index 9c8ba64eb8..0000000000
--- a/src/plugins/qmldesigner/components/integration/integrationcore.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 "integrationcore.h"
-#include "pluginmanager.h"
-#include "itemlibraryview.h"
-#include "navigatorwidget.h"
-#include "metainfo.h"
-
-#include <QCoreApplication>
-#include <QObject>
-
-namespace QmlDesigner {
-
-class CorePrivate
-{
- public:
- CorePrivate();
- ~CorePrivate();
-
- static IntegrationCore *m_instance;
-
- PluginManager m_pluginManager;
-};
-
-CorePrivate::CorePrivate()
-{
-}
-
-CorePrivate::~CorePrivate()
-{
- MetaInfo::clearGlobal();
-}
-
-IntegrationCore *CorePrivate::m_instance = 0;
-
-/*!
- \class QmlDesigner::Core
-
- Convenience class to access the plugin manager singleton,
- and manage the lifecycle of static data (e.g. in the metatype system).
-*/
-
-IntegrationCore::IntegrationCore() :
- d(new CorePrivate)
-{
- Q_ASSERT(CorePrivate::m_instance == 0);
- CorePrivate::m_instance = this;
-}
-
-IntegrationCore::~IntegrationCore()
-{
- CorePrivate::m_instance = 0;
- delete d;
-}
-
-IntegrationCore *IntegrationCore::instance()
-{
- Q_ASSERT(CorePrivate::m_instance);
- return CorePrivate::m_instance;
-}
-
-PluginManager *IntegrationCore::pluginManager() const
-{
- return &d->m_pluginManager;
-}
-
-}
diff --git a/src/plugins/qmldesigner/components/integration/integrationcore.h b/src/plugins/qmldesigner/components/integration/integrationcore.h
deleted file mode 100644
index d54e1a93b9..0000000000
--- a/src/plugins/qmldesigner/components/integration/integrationcore.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 QMLDESIGNERCORE_H
-#define QMLDESIGNERCORE_H
-
-#include <QObject>
-
-QT_BEGIN_NAMESPACE
-class QWidget;
-class QDialog;
-QT_END_NAMESPACE
-
-namespace QmlDesigner {
-
-class ItemLibraryWidget;
-class FormWindowManager;
-class PluginManager;
-class CorePrivate;
-
-class IntegrationCore
-{
- Q_DISABLE_COPY(IntegrationCore)
-public:
- IntegrationCore();
- ~IntegrationCore();
-
- PluginManager *pluginManager() const;
-
- static IntegrationCore *instance();
-
-private:
- CorePrivate *d;
-};
-
-} // namspace QmlDesigner
-
-#endif // QMLDESIGNERCORE_H
diff --git a/src/plugins/qmldesigner/components/integration/xuifiledialog.cpp b/src/plugins/qmldesigner/components/integration/xuifiledialog.cpp
index 29ae301e58..e573d2f3e4 100644
--- a/src/plugins/qmldesigner/components/integration/xuifiledialog.cpp
+++ b/src/plugins/qmldesigner/components/integration/xuifiledialog.cpp
@@ -27,6 +27,8 @@
**
****************************************************************************/
+#include <utils/hostosinfo.h>
+
#include <QDebug>
#include <QDir>
#include <QObject>
@@ -56,21 +58,21 @@ void XUIFileDialog::runSaveFileDialog(const QString& path, QWidget* parent, QObj
if (dir.isNull())
dir = XUIFileDialog::defaultFolder();
-#ifdef Q_OS_MAC
- QFileDialog *dialog = new QFileDialog(parent, Qt::Sheet);
- dialog->setFileMode(QFileDialog::AnyFile);
- dialog->setAcceptMode(QFileDialog::AcceptSave);
- dialog->setNameFilters(XUIFileDialog::fileNameFilters());
- dialog->setDirectory(dir);
- dialog->open(receiver, member);
-#else // !Q_OS_MAC
- QString caption = QCoreApplication::translate("QmlDesigner::XUIFileDialog", "Save File");
- QString fileName = QFileDialog::getSaveFileName(parent, caption, dir, XUIFileDialog::fileNameFilters().join(";;"));
+ if (Utils::HostOsInfo::isMacHost()) {
+ QFileDialog *dialog = new QFileDialog(parent, Qt::Sheet);
+ dialog->setFileMode(QFileDialog::AnyFile);
+ dialog->setAcceptMode(QFileDialog::AcceptSave);
+ dialog->setNameFilters(XUIFileDialog::fileNameFilters());
+ dialog->setDirectory(dir);
+ dialog->open(receiver, member);
+ } else {
+ QString caption = QCoreApplication::translate("QmlDesigner::XUIFileDialog", "Save File");
+ QString fileName = QFileDialog::getSaveFileName(parent, caption, dir, XUIFileDialog::fileNameFilters().join(";;"));
- QmlDesigner::Internal::SignalEmitter emitter;
- QObject::connect(&emitter, SIGNAL(fileNameSelected(QString)), receiver, member);
- emitter.emitFileNameSelected(fileName);
-#endif // Q_OS_MAC
+ QmlDesigner::Internal::SignalEmitter emitter;
+ QObject::connect(&emitter, SIGNAL(fileNameSelected(QString)), receiver, member);
+ emitter.emitFileNameSelected(fileName);
+ }
}
QStringList XUIFileDialog::fileNameFilters()
diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp
index e5e208c04a..273fdd9bed 100644
--- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp
+++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp
@@ -29,10 +29,8 @@
#include "itemlibrarywidget.h"
-#include <utils/filterlineedit.h>
#include <utils/fileutils.h>
#include <coreplugin/coreconstants.h>
-#include "itemlibrarycomponents.h"
#include "itemlibrarymodel.h"
#include "itemlibraryimageprovider.h"
#include "customdraganddrop.h"
@@ -41,7 +39,6 @@
#include "rewritingexception.h"
#include <QFileInfo>
-#include <QFileIconProvider>
#include <QFileSystemModel>
#include <QStackedWidget>
#include <QGridLayout>
@@ -52,131 +49,62 @@
#include <QMenu>
#include <QApplication>
-#include <QDeclarativeView>
#include <QDeclarativeItem>
#include <private/qdeclarativeengine_p.h>
namespace QmlDesigner {
-class MyFileIconProvider : public QFileIconProvider
-{
-public:
- MyFileIconProvider(const QSize &iconSize)
- : QFileIconProvider(),
- m_iconSize(iconSize)
- {}
-
- virtual QIcon icon ( const QFileInfo & info ) const
- {
- QPixmap pixmap(info.absoluteFilePath());
- if (pixmap.isNull()) {
- QIcon defaultIcon(QFileIconProvider::icon(info));
- pixmap = defaultIcon.pixmap(defaultIcon.actualSize(m_iconSize));
- }
-
- if (pixmap.width() == m_iconSize.width()
- && pixmap.height() == m_iconSize.height())
- return pixmap;
- if ((pixmap.width() > m_iconSize.width())
- || (pixmap.height() > m_iconSize.height()))
- return pixmap.scaled(m_iconSize, Qt::KeepAspectRatio,
- Qt::SmoothTransformation);
-
- QPoint offset((m_iconSize.width() - pixmap.width()) / 2,
- (m_iconSize.height() - pixmap.height()) / 2);
- QImage newIcon(m_iconSize, QImage::Format_ARGB32_Premultiplied);
- newIcon.fill(Qt::transparent);
- QPainter painter(&newIcon);
- painter.drawPixmap(offset, pixmap);
- return QPixmap::fromImage(newIcon);
- }
-private:
- QSize m_iconSize;
-};
-
-
-// ---------- ItemLibraryPrivate
-class ItemLibraryWidgetPrivate {
-public:
- ItemLibraryWidgetPrivate(QObject *object);
-
- Internal::ItemLibraryModel *m_itemLibraryModel;
- QFileSystemModel *m_resourcesFileSystemModel;
-
- QStackedWidget *m_stackedWidget;
- Utils::FilterLineEdit *m_lineEdit;
- QDeclarativeView *m_itemsView;
- Internal::ItemLibraryTreeView *m_resourcesView;
- QWeakPointer<ItemLibraryInfo> m_itemLibraryInfo;
-
- QSize m_itemIconSize, m_resIconSize;
- MyFileIconProvider m_iconProvider;
- Model *model;
-};
-
-ItemLibraryWidgetPrivate::ItemLibraryWidgetPrivate(QObject *object) :
- m_itemLibraryModel(0),
- m_resourcesFileSystemModel(0),
- m_stackedWidget(0),
- m_lineEdit(0),
- m_itemsView(0),
- m_resourcesView(0),
- m_itemIconSize(24, 24),
- m_resIconSize(24, 24),
- m_iconProvider(m_resIconSize),
- model(0)
-{
- Q_UNUSED(object);
-}
ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
QFrame(parent),
- d(new ItemLibraryWidgetPrivate(this)),
+ m_iconProvider(m_resIconSize),
+ m_itemIconSize(24, 24),
+ m_resIconSize(24, 24),
+ m_itemsView(new QDeclarativeView(this)),
+ m_resourcesView(new Internal::ItemLibraryTreeView(this)),
m_filterFlag(QtBasic)
{
setWindowTitle(tr("Library", "Title of library view"));
/* create Items view and its model */
- d->m_itemsView = new QDeclarativeView(this);
- d->m_itemsView->setAttribute(Qt::WA_OpaquePaintEvent);
- d->m_itemsView->setAttribute(Qt::WA_NoSystemBackground);
- d->m_itemsView->setAcceptDrops(false);
- d->m_itemsView->setFocusPolicy(Qt::ClickFocus);
- d->m_itemsView->setResizeMode(QDeclarativeView::SizeRootObjectToView);
- d->m_itemLibraryModel = new Internal::ItemLibraryModel(QDeclarativeEnginePrivate::getScriptEngine(d->m_itemsView->engine()), this);
- d->m_itemLibraryModel->setItemIconSize(d->m_itemIconSize);
-
- QDeclarativeContext *rootContext = d->m_itemsView->rootContext();
- rootContext->setContextProperty(QLatin1String("itemLibraryModel"), d->m_itemLibraryModel);
- rootContext->setContextProperty(QLatin1String("itemLibraryIconWidth"), d->m_itemIconSize.width());
- rootContext->setContextProperty(QLatin1String("itemLibraryIconHeight"), d->m_itemIconSize.height());
+ m_itemsView->setAttribute(Qt::WA_OpaquePaintEvent);
+ m_itemsView->setAttribute(Qt::WA_NoSystemBackground);
+ m_itemsView->setAcceptDrops(false);
+ m_itemsView->setFocusPolicy(Qt::ClickFocus);
+ m_itemsView->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ m_itemLibraryModel = new Internal::ItemLibraryModel(QDeclarativeEnginePrivate::getScriptEngine(m_itemsView->engine()), this);
+ m_itemLibraryModel->setItemIconSize(m_itemIconSize);
+
+ QDeclarativeContext *rootContext = m_itemsView->rootContext();
+ rootContext->setContextProperty(QLatin1String("itemLibraryModel"), m_itemLibraryModel.data());
+ rootContext->setContextProperty(QLatin1String("itemLibraryIconWidth"), m_itemIconSize.width());
+ rootContext->setContextProperty(QLatin1String("itemLibraryIconHeight"), m_itemIconSize.height());
QColor highlightColor = palette().highlight().color();
if (0.5*highlightColor.saturationF()+0.75-highlightColor.valueF() < 0)
highlightColor.setHsvF(highlightColor.hsvHueF(),0.1 + highlightColor.saturationF()*2.0, highlightColor.valueF());
- d->m_itemsView->rootContext()->setContextProperty(QLatin1String("highlightColor"), highlightColor);
+ m_itemsView->rootContext()->setContextProperty(QLatin1String("highlightColor"), highlightColor);
// loading the qml has to come after all needed context properties are set
- d->m_itemsView->setSource(QUrl("qrc:/ItemLibrary/qml/ItemsView.qml"));
+ m_itemsView->setSource(QUrl("qrc:/ItemLibrary/qml/ItemsView.qml"));
- QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(d->m_itemsView->rootObject());
+ QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(m_itemsView->rootObject());
connect(rootItem, SIGNAL(itemSelected(int)), this, SLOT(showItemInfo(int)));
connect(rootItem, SIGNAL(itemDragged(int)), this, SLOT(startDragAndDrop(int)));
connect(this, SIGNAL(scrollItemsView(QVariant)), rootItem, SLOT(scrollView(QVariant)));
connect(this, SIGNAL(resetItemsView()), rootItem, SLOT(resetView()));
/* create Resources view and its model */
- d->m_resourcesFileSystemModel = new QFileSystemModel(this);
- d->m_resourcesFileSystemModel->setIconProvider(&d->m_iconProvider);
- d->m_resourcesView = new Internal::ItemLibraryTreeView(this);
- d->m_resourcesView->setModel(d->m_resourcesFileSystemModel);
- d->m_resourcesView->setIconSize(d->m_resIconSize);
+ m_resourcesFileSystemModel = new QFileSystemModel(this);
+ m_resourcesFileSystemModel->setIconProvider(&m_iconProvider);
+ m_resourcesView->setModel(m_resourcesFileSystemModel.data());
+ m_resourcesView->setIconSize(m_resIconSize);
/* create image provider for loading item icons */
- d->m_itemsView->engine()->addImageProvider(QLatin1String("qmldesigner_itemlibrary"), new Internal::ItemLibraryImageProvider);
+ m_itemsView->engine()->addImageProvider(QLatin1String("qmldesigner_itemlibrary"), new Internal::ItemLibraryImageProvider);
/* other widgets */
QTabBar *tabBar = new QTabBar(this);
@@ -184,12 +112,12 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
tabBar->addTab(tr("Resources", "Title of library resources view"));
tabBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- d->m_lineEdit = new Utils::FilterLineEdit(this);
- d->m_lineEdit->setObjectName(QLatin1String("itemLibrarySearchInput"));
- d->m_lineEdit->setPlaceholderText(tr("<Filter>", "Library search input hint text"));
- d->m_lineEdit->setDragEnabled(false);
- d->m_lineEdit->setMinimumWidth(75);
- d->m_lineEdit->setTextMargins(0, 0, 20, 0);
+ m_lineEdit = new Utils::FilterLineEdit(this);
+ m_lineEdit->setObjectName(QLatin1String("itemLibrarySearchInput"));
+ m_lineEdit->setPlaceholderText(tr("<Filter>", "Library search input hint text"));
+ m_lineEdit->setDragEnabled(false);
+ m_lineEdit->setMinimumWidth(75);
+ m_lineEdit->setTextMargins(0, 0, 20, 0);
QWidget *lineEditFrame = new QWidget(this);
lineEditFrame->setObjectName(QLatin1String("itemLibrarySearchInputFrame"));
QGridLayout *lineEditLayout = new QGridLayout(lineEditFrame);
@@ -197,15 +125,15 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
lineEditLayout->setSpacing(0);
lineEditLayout->addItem(new QSpacerItem(5, 3, QSizePolicy::Fixed, QSizePolicy::Fixed), 0, 0, 1, 3);
lineEditLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 0);
- lineEditLayout->addWidget(d->m_lineEdit, 1, 1, 1, 1);
+ lineEditLayout->addWidget(m_lineEdit.data(), 1, 1, 1, 1);
lineEditLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 2);
- connect(d->m_lineEdit, SIGNAL(filterChanged(QString)), this, SLOT(setSearchFilter(QString)));
+ connect(m_lineEdit.data(), SIGNAL(filterChanged(QString)), this, SLOT(setSearchFilter(QString)));
- d->m_stackedWidget = new QStackedWidget(this);
- d->m_stackedWidget->addWidget(d->m_itemsView);
- d->m_stackedWidget->addWidget(d->m_resourcesView);
+ m_stackedWidget = new QStackedWidget(this);
+ m_stackedWidget->addWidget(m_itemsView.data());
+ m_stackedWidget->addWidget(m_resourcesView.data());
connect(tabBar, SIGNAL(currentChanged(int)),
- d->m_stackedWidget, SLOT(setCurrentIndex(int)));
+ m_stackedWidget.data(), SLOT(setCurrentIndex(int)));
connect(tabBar, SIGNAL(currentChanged(int)),
this, SLOT(updateSearch()));
@@ -219,37 +147,28 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
layout->addWidget(tabBar, 0, 0, 1, 1);
layout->addWidget(spacer, 1, 0);
layout->addWidget(lineEditFrame, 2, 0, 1, 1);
- layout->addWidget(d->m_stackedWidget, 3, 0, 1, 1);
+ layout->addWidget(m_stackedWidget.data(), 3, 0, 1, 1);
setResourcePath(QDir::currentPath());
setSearchFilter(QString());
/* style sheets */
setStyleSheet(QLatin1String(Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css")));
- d->m_resourcesView->setStyleSheet(
+ m_resourcesView->setStyleSheet(
QLatin1String(Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css")));
}
-ItemLibraryWidget::~ItemLibraryWidget()
-{
- /* workaround: delete the items view before the model is deleted.
- This prevents qml warnings when the item library is destructed. */
- delete d->m_itemsView;
- delete d->m_resourcesView;
- delete d;
-}
-
void ItemLibraryWidget::setItemLibraryInfo(ItemLibraryInfo *itemLibraryInfo)
{
- if (d->m_itemLibraryInfo.data() == itemLibraryInfo)
+ if (m_itemLibraryInfo.data() == itemLibraryInfo)
return;
- if (d->m_itemLibraryInfo)
- disconnect(d->m_itemLibraryInfo.data(), SIGNAL(entriesChanged()),
+ if (m_itemLibraryInfo)
+ disconnect(m_itemLibraryInfo.data(), SIGNAL(entriesChanged()),
this, SLOT(updateModel()));
- d->m_itemLibraryInfo = itemLibraryInfo;
+ m_itemLibraryInfo = itemLibraryInfo;
if (itemLibraryInfo)
- connect(d->m_itemLibraryInfo.data(), SIGNAL(entriesChanged()),
+ connect(m_itemLibraryInfo.data(), SIGNAL(entriesChanged()),
this, SLOT(updateModel()));
updateModel();
@@ -260,9 +179,9 @@ void ItemLibraryWidget::updateImports()
{
FilterChangeFlag filter;
filter = QtBasic;
- if (d->model) {
+ if (m_model) {
QStringList imports;
- foreach (const Import &import, d->model->imports())
+ foreach (const Import &import, m_model->imports())
if (import.isLibraryImport())
imports << import.url();
if (imports.contains("com.nokia.meego", Qt::CaseInsensitive))
@@ -307,31 +226,31 @@ QList<QToolButton *> ItemLibraryWidget::createToolBarWidgets()
void ItemLibraryWidget::setSearchFilter(const QString &searchFilter)
{
- if (d->m_stackedWidget->currentIndex() == 0) {
- d->m_itemLibraryModel->setSearchText(searchFilter);
+ if (m_stackedWidget->currentIndex() == 0) {
+ m_itemLibraryModel->setSearchText(searchFilter);
emit resetItemsView();
- d->m_itemsView->update();
+ m_itemsView->update();
} else {
QStringList nameFilterList;
if (searchFilter.contains('.')) {
nameFilterList.append(QString("*%1*").arg(searchFilter));
} else {
foreach (const QByteArray &extension, QImageReader::supportedImageFormats()) {
- nameFilterList.append(QString("*%1*.%2").arg(searchFilter, QString::fromAscii(extension)));
+ nameFilterList.append(QString("*%1*.%2").arg(searchFilter, QString::fromLatin1(extension)));
}
}
- d->m_resourcesFileSystemModel->setFilter(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
- d->m_resourcesFileSystemModel->setNameFilterDisables(false);
- d->m_resourcesFileSystemModel->setNameFilters(nameFilterList);
- d->m_resourcesView->expandToDepth(1);
- d->m_resourcesView->scrollToTop();
+ m_resourcesFileSystemModel->setFilter(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
+ m_resourcesFileSystemModel->setNameFilterDisables(false);
+ m_resourcesFileSystemModel->setNameFilters(nameFilterList);
+ m_resourcesView->expandToDepth(1);
+ m_resourcesView->scrollToTop();
}
}
void ItemLibraryWidget::setModel(Model *model)
{
- d->model = model;
+ m_model = model;
if (!model)
return;
setItemLibraryInfo(model->metaInfo().itemLibraryInfo());
@@ -340,13 +259,13 @@ void ItemLibraryWidget::setModel(Model *model)
void ItemLibraryWidget::emitImportChecked()
{
- if (!d->model)
+ if (!m_model)
return;
bool qtOnlyImport = false;
bool meegoImport = false;
- foreach (const Import &import, d->model->imports()) {
+ foreach (const Import &import, m_model->imports()) {
if (import.isLibraryImport()) {
if (import.url().contains(QString("meego"), Qt::CaseInsensitive))
meegoImport = true;
@@ -367,7 +286,7 @@ void ItemLibraryWidget::setImportFilter(FilterChangeFlag flag)
return;
static bool block = false;
- if (!d->model)
+ if (!m_model)
return;
if (flag == m_filterFlag)
return;
@@ -413,36 +332,36 @@ void ItemLibraryWidget::onMeegoChecked(bool b)
void ItemLibraryWidget::updateModel()
{
- d->m_itemLibraryModel->update(d->m_itemLibraryInfo.data(), d->model);
+ m_itemLibraryModel->update(m_itemLibraryInfo.data(), m_model.data());
updateImports();
updateSearch();
}
void ItemLibraryWidget::updateSearch()
{
- setSearchFilter(d->m_lineEdit->text());
+ setSearchFilter(m_lineEdit->text());
}
void ItemLibraryWidget::setResourcePath(const QString &resourcePath)
{
- if (d->m_resourcesView->model() == d->m_resourcesFileSystemModel) {
- d->m_resourcesFileSystemModel->setRootPath(resourcePath);
- d->m_resourcesView->setRootIndex(d->m_resourcesFileSystemModel->index(resourcePath));
+ if (m_resourcesView->model() == m_resourcesFileSystemModel.data()) {
+ m_resourcesFileSystemModel->setRootPath(resourcePath);
+ m_resourcesView->setRootIndex(m_resourcesFileSystemModel->index(resourcePath));
}
updateSearch();
}
void ItemLibraryWidget::startDragAndDrop(int itemLibId)
{
- QMimeData *mimeData = d->m_itemLibraryModel->getMimeData(itemLibId);
+ QMimeData *mimeData = m_itemLibraryModel->getMimeData(itemLibId);
CustomItemLibraryDrag *drag = new CustomItemLibraryDrag(this);
const QImage image = qvariant_cast<QImage>(mimeData->imageData());
- drag->setPixmap(d->m_itemLibraryModel->getIcon(itemLibId).pixmap(32, 32));
+ drag->setPixmap(m_itemLibraryModel->getIcon(itemLibId).pixmap(32, 32));
drag->setPreview(QPixmap::fromImage(image));
drag->setMimeData(mimeData);
- QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(d->m_itemsView->rootObject());
+ QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(m_itemsView->rootObject());
connect(rootItem, SIGNAL(stopDragAndDrop()), drag, SLOT(stopDrag()));
drag->exec();
@@ -455,32 +374,62 @@ void ItemLibraryWidget::showItemInfo(int /*itemLibId*/)
void ItemLibraryWidget::wheelEvent(QWheelEvent *event)
{
- if (d->m_stackedWidget->currentIndex() == 0 &&
- d->m_itemsView->rect().contains(event->pos())) {
+ if (m_stackedWidget->currentIndex() == 0 &&
+ m_itemsView->rect().contains(event->pos())) {
emit scrollItemsView(event->delta());
event->accept();
} else
QFrame::wheelEvent(event);
}
- void ItemLibraryWidget::removeImport(const QString &name)
- {
- if (!d->model)
- return;
+void ItemLibraryWidget::removeImport(const QString &name)
+{
+ if (!m_model)
+ return;
+
+ QList<Import> toBeRemovedImportList;
+ foreach (const Import &import, m_model->imports())
+ if (import.isLibraryImport() && import.url().compare(name, Qt::CaseInsensitive) == 0)
+ toBeRemovedImportList.append(import);
- QList<Import> toBeRemovedImportList;
- foreach (const Import &import, d->model->imports())
- if (import.isLibraryImport() && import.url().compare(name, Qt::CaseInsensitive) == 0)
- toBeRemovedImportList.append(import);
+ m_model->changeImports(QList<Import>(), toBeRemovedImportList);
+}
- d->model->changeImports(QList<Import>(), toBeRemovedImportList);
- }
+void ItemLibraryWidget::addImport(const QString &name, const QString &version)
+{
+ if (!m_model)
+ return;
+ m_model->changeImports(QList<Import>() << Import::createLibraryImport(name, version), QList<Import>());
+}
- void ItemLibraryWidget::addImport(const QString &name, const QString &version)
- {
- if (!d->model)
- return;
- d->model->changeImports(QList<Import>() << Import::createLibraryImport(name, version), QList<Import>());
- }
+QIcon ItemLibraryFileIconProvider::icon(const QFileInfo &info) const
+{
+ QPixmap pixmap(info.absoluteFilePath());
+ if (pixmap.isNull()) {
+ QIcon defaultIcon(QFileIconProvider::icon(info));
+ pixmap = defaultIcon.pixmap(defaultIcon.actualSize(m_iconSize));
+ }
+
+ if (pixmap.width() == m_iconSize.width()
+ && pixmap.height() == m_iconSize.height())
+ return pixmap;
+
+ if ((pixmap.width() > m_iconSize.width())
+ || (pixmap.height() > m_iconSize.height()))
+ return pixmap.scaled(m_iconSize, Qt::KeepAspectRatio,
+ Qt::SmoothTransformation);
+
+ QPoint offset((m_iconSize.width() - pixmap.width()) / 2,
+ (m_iconSize.height() - pixmap.height()) / 2);
+ QImage newIcon(m_iconSize, QImage::Format_ARGB32_Premultiplied);
+ newIcon.fill(Qt::transparent);
+ QPainter painter(&newIcon);
+ painter.drawPixmap(offset, pixmap);
+ return QPixmap::fromImage(newIcon);
+}
+ItemLibraryFileIconProvider::ItemLibraryFileIconProvider(const QSize &iconSize)
+ : QFileIconProvider(),
+ m_iconSize(iconSize)
+{}
}
diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.h b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.h
index 309be86013..310b964a8f 100644
--- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.h
+++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.h
@@ -31,16 +31,43 @@
#define ITEMLIBRARYWIDGET_H
#include "itemlibraryinfo.h"
+#include "itemlibrarycomponents.h"
+
+#include <utils/filterlineedit.h>
+
#include <QFrame>
#include <QToolButton>
+#include <QFileIconProvider>
+#include <QDeclarativeView>
+
+QT_BEGIN_NAMESPACE
+class QFileSystemModel;
+class QStackedWidget;
+QT_END_NAMESPACE
namespace QmlDesigner {
-class ItemLibraryWidgetPrivate;
class MetaInfo;
class ItemLibraryEntry;
class Model;
+namespace Internal {
+ class ItemLibraryModel;
+ class ItemLibraryTreeView;
+}
+
+class ItemLibraryFileIconProvider : public QFileIconProvider
+{
+public:
+ ItemLibraryFileIconProvider(const QSize &iconSize);
+
+ QIcon icon( const QFileInfo & info ) const;
+
+private:
+ QSize m_iconSize;
+};
+
+
class ItemLibraryWidget : public QFrame
{
Q_OBJECT
@@ -52,7 +79,6 @@ class ItemLibraryWidget : public QFrame
public:
ItemLibraryWidget(QWidget *parent = 0);
- virtual ~ItemLibraryWidget();
void setItemLibraryInfo(ItemLibraryInfo *itemLibraryInfo);
QList<QToolButton *> createToolBarWidgets();
@@ -90,7 +116,21 @@ signals:
void meegoChecked(bool b);
private:
- ItemLibraryWidgetPrivate *d;
+ ItemLibraryFileIconProvider m_iconProvider;
+ QSize m_itemIconSize;
+ QSize m_resIconSize;
+
+ QWeakPointer<ItemLibraryInfo> m_itemLibraryInfo;
+
+ QWeakPointer<Internal::ItemLibraryModel> m_itemLibraryModel;
+ QWeakPointer<QFileSystemModel> m_resourcesFileSystemModel;
+
+ QWeakPointer<QStackedWidget> m_stackedWidget;
+ QWeakPointer<Utils::FilterLineEdit> m_lineEdit;
+ QScopedPointer<QDeclarativeView> m_itemsView;
+ QScopedPointer<Internal::ItemLibraryTreeView> m_resourcesView;
+
+ QWeakPointer<Model> m_model;
FilterChangeFlag m_filterFlag;
};
diff --git a/src/plugins/qmldesigner/components/navigator/navigator.pri b/src/plugins/qmldesigner/components/navigator/navigator.pri
index 3ce8bc6877..60b0527f5d 100644
--- a/src/plugins/qmldesigner/components/navigator/navigator.pri
+++ b/src/plugins/qmldesigner/components/navigator/navigator.pri
@@ -4,6 +4,7 @@ SOURCES += navigatorview.cpp \
navigatortreemodel.cpp \
navigatorwidget.cpp \
navigatortreeview.cpp
+
HEADERS += navigatorview.h \
navigatortreemodel.h \
navigatorwidget.h \
diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp
index 7747eeb127..0dbab09aec 100644
--- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp
+++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp
@@ -39,6 +39,7 @@
#include <rewriterview.h>
#include <invalididexception.h>
#include <rewritingexception.h>
+#include <modelnodecontextmenu.h>
#include <QMimeData>
#include <QMessageBox>
@@ -544,7 +545,7 @@ void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty parentPropert
}
}
- if (parentProperty.isDefaultProperty() && parentProperty.parentModelNode().metaInfo().isSubclassOf("<cpp>.QDeclarativeBasePositioner", -1, -1)) {
+ if (parentProperty.isDefaultProperty() && parentProperty.parentModelNode().metaInfo().isPositioner()) {
ModelNode currentNode = node;
if (currentNode.hasProperty("x"))
currentNode.removeProperty("x");
@@ -627,7 +628,7 @@ QStringList NavigatorTreeModel::visibleProperties(const ModelNode &node) const
QString qmlType = qmlTypeInQtContainer(node.metaInfo().propertyTypeName(propertyName));
if (node.model()->metaInfo(qmlType).isValid() &&
- node.model()->metaInfo(qmlType).isSubclassOf("<cpp>.QGraphicsObject", -1, -1)) {
+ node.model()->metaInfo(qmlType).isSubclassOf("QtQuick.Item", -1, -1)) {
propertyList.append(propertyName);
}
}
@@ -658,10 +659,9 @@ void NavigatorTreeModel::setVisible(const QModelIndex &index, bool visible)
itemRow.visibilityItem->setCheckState(visible ? Qt::Checked : Qt::Unchecked);
}
-void NavigatorTreeModel::openContextMenu(const QPoint &p)
+void NavigatorTreeModel::openContextMenu(const QPoint &position)
{
- if (m_view)
- m_view->showContextMenu(p, QPoint(), false);
+ ModelNodeContextMenu::showContextMenu(m_view.data(), position, QPoint(), false);
}
} // QmlDesigner
diff --git a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp
index 7d7715fbc7..1b2fd58bee 100644
--- a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp
+++ b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp
@@ -30,6 +30,7 @@
#include "navigatorview.h"
#include "navigatortreemodel.h"
#include "navigatorwidget.h"
+#include "modelnodecontextmenu.h"
#include <coreplugin/editormanager/editormanager.h>
diff --git a/src/plugins/qmldesigner/components/pluginmanager/pluginmanager.cpp b/src/plugins/qmldesigner/components/pluginmanager/pluginmanager.cpp
index 4f799e4462..06c68d08d5 100644
--- a/src/plugins/qmldesigner/components/pluginmanager/pluginmanager.cpp
+++ b/src/plugins/qmldesigner/components/pluginmanager/pluginmanager.cpp
@@ -29,7 +29,6 @@
#include "pluginmanager.h"
#include "iplugin.h"
-#include "pluginpath.h"
#include <metainfo.h>
#include <QCoreApplication>
@@ -55,88 +54,28 @@ enum { debug = 0 };
namespace QmlDesigner {
-// Initialize and create instance of a plugin from scratch,
-// that is, make sure the library is loaded and has an instance
-// of the IPlugin type. Once something fails, mark it as failed
-// ignore it from then on.
-//static IPlugin *instance(PluginData &p)
-//{
-// // Go stale once something fails
-// if (p.failed)
-// return 0;
-// // Pull up the plugin, retrieve IPlugin instance.
-// if (!p.instanceGuard) {
-// p.instance = 0;
-// QPluginLoader loader(p.path);
-// if (!(loader.isLoaded() || loader.load())) {
-// p.failed = true;
-// p.errorMessage = loader.errorString();
-// return 0;
-// }
-// QObject *object = loader.instance();
-// if (!object) {
-// p.failed = true;
-// p.errorMessage = QCoreApplication::translate("PluginManager", "Failed to create instance.");
-// return 0;
-// }
-// IPlugin *iplugin = qobject_cast<IPlugin *>(object);
-// if (!iplugin) {
-// p.failed = true;
-// p.errorMessage = QCoreApplication::translate("PluginManager", "Not a QmlDesigner plugin.");
-// delete object;
-// return 0;
-// }
-// p.instanceGuard = object;
-// p.instance = iplugin;
-// }
-// // Ensure it is initialized
-// if (!p.instance->isInitialized()) {
-// if (!p.instance->initialize(&p.errorMessage)) {
-// p.failed = true;
-// delete p.instance;
-// p.instance = 0;
-// return 0;
-// }
-// }
-// return p.instance;
-//}
-
-
-// ---- PluginManager[Private]
-class PluginManagerPrivate {
-public:
- typedef QList<PluginPath> PluginPathList;
- PluginPathList m_paths;
-};
-
-PluginManager::PluginManager() :
- d(new PluginManagerPrivate)
-{
-}
-
-PluginManager::~PluginManager()
-{
- delete d;
-}
-
PluginManager::IPluginList PluginManager::instances()
{
IPluginList rc;
- const PluginManagerPrivate::PluginPathList::iterator end = d->m_paths.end();
- for (PluginManagerPrivate::PluginPathList::iterator it = d->m_paths.begin(); it != end; ++it)
+ const PluginPathList::iterator end = m_paths.end();
+ for (PluginPathList::iterator it = m_paths.begin(); it != end; ++it)
it->getInstances(&rc);
if (debug)
qDebug() << '<' << Q_FUNC_INFO << rc.size();
return rc;
}
+PluginManager::PluginManager()
+{
+}
+
void PluginManager::setPluginPaths(const QStringList &paths)
{
foreach (const QString &path, paths) {
const QDir dir(path);
if (!dir.exists())
continue;
- d->m_paths.push_back(PluginPath(dir));
+ m_paths.push_back(PluginPath(dir));
}
// also register path in widgetpluginmanager
@@ -146,8 +85,8 @@ void PluginManager::setPluginPaths(const QStringList &paths)
QAbstractItemModel *PluginManager::createModel(QObject *parent)
{
QStandardItemModel *model = new QStandardItemModel(parent);
- const PluginManagerPrivate::PluginPathList::iterator end = d->m_paths.end();
- for (PluginManagerPrivate::PluginPathList::iterator it = d->m_paths.begin(); it != end; ++it)
+ const PluginPathList::iterator end = m_paths.end();
+ for (PluginPathList::iterator it = m_paths.begin(); it != end; ++it)
model->appendRow(it->createModelItem());
return model;
}
diff --git a/src/plugins/qmldesigner/components/pluginmanager/pluginmanager.h b/src/plugins/qmldesigner/components/pluginmanager/pluginmanager.h
index bbc209cc41..16fcefa82d 100644
--- a/src/plugins/qmldesigner/components/pluginmanager/pluginmanager.h
+++ b/src/plugins/qmldesigner/components/pluginmanager/pluginmanager.h
@@ -30,6 +30,7 @@
#ifndef PLUGINMANAGER_H
#define PLUGINMANAGER_H
+#include "pluginpath.h"
#include <QObject>
#include <QList>
@@ -44,8 +45,6 @@ namespace QmlDesigner {
class IPlugin;
-class PluginManagerPrivate;
-
// PluginManager: Loads the plugin libraries on demand "as lazy as
// possible", that is, directories are scanned and
// instances are created only when instances() is called.
@@ -53,11 +52,13 @@ class PluginManagerPrivate;
class PluginManager
{
Q_DISABLE_COPY(PluginManager)
+
+ typedef QList<PluginPath> PluginPathList;
+
public:
typedef QList<IPlugin *> IPluginList;
PluginManager();
- ~PluginManager();
void setPluginPaths(const QStringList &paths);
@@ -65,12 +66,13 @@ public:
QDialog *createAboutPluginDialog(QWidget *parent);
-private:
+private: // functions
// Convenience to create a model for an "About Plugins"
// dialog. Forces plugin initialization.
QAbstractItemModel *createModel(QObject *parent = 0);
- PluginManagerPrivate *d;
+private: // variables
+ PluginPathList m_paths;
};
} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/components/pluginmanager/pluginpath.cpp b/src/plugins/qmldesigner/components/pluginmanager/pluginpath.cpp
index 90e98a4eb8..d0fc3cf7c1 100644
--- a/src/plugins/qmldesigner/components/pluginmanager/pluginpath.cpp
+++ b/src/plugins/qmldesigner/components/pluginmanager/pluginpath.cpp
@@ -28,6 +28,8 @@
****************************************************************************/
#include "pluginpath.h"
+#include "pluginmanager.h"
+
#include <iplugin.h>
#include <QLibrary>
#include <QWeakPointer>
diff --git a/src/plugins/qmldesigner/components/pluginmanager/pluginpath.h b/src/plugins/qmldesigner/components/pluginmanager/pluginpath.h
index d2607c14da..dda674ad82 100644
--- a/src/plugins/qmldesigner/components/pluginmanager/pluginpath.h
+++ b/src/plugins/qmldesigner/components/pluginmanager/pluginpath.h
@@ -30,8 +30,6 @@
#ifndef PLUGINPATH_H
#define PLUGINPATH_H
-#include "pluginmanager.h"
-
#include <QObject>
#include <QWeakPointer>
#include <QList>
@@ -71,11 +69,13 @@ struct PluginData {
// IPlugins.
class PluginPath {
+
+ typedef QList<IPlugin *> IPluginList;
public:
explicit PluginPath(const QDir &path);
- void getInstances(PluginManager::IPluginList *list);
+ void getInstances(IPluginList *list);
QDir path() const { return m_path; }
diff --git a/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp b/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp
index 9d919d6e55..20446215a4 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp
@@ -37,94 +37,71 @@
namespace QmlDesigner {
-class DeclarativeWidgetViewPrivate
+void DeclarativeWidgetView::execute()
{
-public:
- DeclarativeWidgetViewPrivate(DeclarativeWidgetView *view)
- : q(view), root(0), component(0) {}
- ~DeclarativeWidgetViewPrivate() { delete root; }
- void execute();
+ if (m_root)
+ delete m_root.data();
- DeclarativeWidgetView *q;
+ if (m_component)
+ delete m_component.data();
- QPointer<QWidget> root;
- QUrl source;
- QDeclarativeEngine engine;
- QDeclarativeComponent *component;
-};
-
-void DeclarativeWidgetViewPrivate::execute()
-{
- if (root) {
- delete root;
- root = 0;
- }
- if (component) {
- delete component;
- component = 0;
- }
- if (!source.isEmpty()) {
- component = new QDeclarativeComponent(&engine, source, q);
- if (!component->isLoading()) {
- q->continueExecute();
+ if (!m_source.isEmpty()) {
+ m_component = new QDeclarativeComponent(&m_engine, m_source, this);
+ if (!m_component->isLoading()) {
+ continueExecute();
} else {
- QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), q, SLOT(continueExecute()));
+ connect(m_component.data(), SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(continueExecute()));
}
}
}
DeclarativeWidgetView::DeclarativeWidgetView(QWidget *parent) :
- QWidget(parent), d(new DeclarativeWidgetViewPrivate(this))
-{
-}
-
-DeclarativeWidgetView::~DeclarativeWidgetView()
+ QWidget(parent)
{
- delete d;
}
QUrl DeclarativeWidgetView::source() const
{
- return d->source;
+ return m_source;
}
void DeclarativeWidgetView::setSource(const QUrl& url)
{
- d->source = url;
- d->execute();
+ m_source = url;
+ execute();
}
QDeclarativeEngine* DeclarativeWidgetView::engine()
{
- return &d->engine;
+ return &m_engine;
}
QWidget *DeclarativeWidgetView::rootWidget() const
{
- return d->root;
+ return m_root.data();
}
QDeclarativeContext* DeclarativeWidgetView::rootContext()
{
- return d->engine.rootContext();
+ return m_engine.rootContext();
}
DeclarativeWidgetView::Status DeclarativeWidgetView::status() const
{
- if (!d->component)
+ if (!m_component)
return DeclarativeWidgetView::Null;
- return DeclarativeWidgetView::Status(d->component->status());
+ return DeclarativeWidgetView::Status(m_component->status());
}
void DeclarativeWidgetView::continueExecute()
{
- disconnect(d->component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(continueExecute()));
+ disconnect(m_component.data(), SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(continueExecute()));
- if (d->component->isError()) {
- QList<QDeclarativeError> errorList = d->component->errors();
+ if (m_component->isError()) {
+ QList<QDeclarativeError> errorList = m_component->errors();
foreach (const QDeclarativeError &error, errorList) {
qWarning() << error;
}
@@ -132,10 +109,10 @@ void DeclarativeWidgetView::continueExecute()
return;
}
- QObject *obj = d->component->create();
+ QObject *obj = m_component->create();
- if(d->component->isError()) {
- QList<QDeclarativeError> errorList = d->component->errors();
+ if (m_component->isError()) {
+ QList<QDeclarativeError> errorList = m_component->errors();
foreach (const QDeclarativeError &error, errorList) {
qWarning() << error;
}
@@ -149,7 +126,7 @@ void DeclarativeWidgetView::continueExecute()
void DeclarativeWidgetView::setRootWidget(QWidget *widget)
{
- if (d->root == widget)
+ if (m_root.data() == widget)
return;
window()->setAttribute(Qt::WA_OpaquePaintEvent, false);
@@ -159,10 +136,10 @@ void DeclarativeWidgetView::setRootWidget(QWidget *widget)
widget->setVisible(true);
}
resize(widget->size());
- d->root = widget;
+ m_root.reset(widget);
- if (d->root) {
- QSize initialSize = d->root->size();
+ if (m_root) {
+ QSize initialSize = m_root->size();
if (initialSize != size()) {
resize(initialSize);
}
diff --git a/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.h b/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.h
index c8ac5accb3..adf52b61d7 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.h
@@ -32,17 +32,16 @@
#include <QWidget>
#include <QUrl>
+#include <QDeclarativeEngine>
QT_BEGIN_NAMESPACE
-class QDeclarativeEngine;
class QDeclarativeContext;
class QDeclarativeError;
+class QDeclarativeComponent;
QT_END_NAMESPACE
namespace QmlDesigner {
-class DeclarativeWidgetViewPrivate;
-
class DeclarativeWidgetView : public QWidget
{
Q_OBJECT
@@ -51,8 +50,6 @@ class DeclarativeWidgetView : public QWidget
public:
explicit DeclarativeWidgetView(QWidget *parent = 0);
- virtual ~DeclarativeWidgetView();
-
QUrl source() const;
void setSource(const QUrl&);
@@ -68,14 +65,17 @@ signals:
void statusChanged(DeclarativeWidgetView::Status);
protected:
- virtual void setRootWidget(QWidget *);
+ void setRootWidget(QWidget *);
+ void execute();
private Q_SLOTS:
void continueExecute();
private:
- friend class DeclarativeWidgetViewPrivate;
- DeclarativeWidgetViewPrivate *d;
+ QScopedPointer<QWidget> m_root;
+ QUrl m_source;
+ QDeclarativeEngine m_engine;
+ QWeakPointer<QDeclarativeComponent> m_component;
};
diff --git a/src/plugins/qmldesigner/components/propertyeditor/gradientlineqmladaptor.cpp b/src/plugins/qmldesigner/components/propertyeditor/gradientlineqmladaptor.cpp
index 2aa8961369..3abdf648b6 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/gradientlineqmladaptor.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/gradientlineqmladaptor.cpp
@@ -137,7 +137,7 @@ void GradientLineQmlAdaptor::writeGradient()
gradientNode.setId(oldId);
for (int i = 0;i < stops.size(); i++) {
- ModelNode gradientStopNode = modelNode.view()->createModelNode("QtQuick.GradientStop", 1, 0);
+ ModelNode gradientStopNode = modelNode.view()->createModelNode("QtQuick.GradientStop", modelNode.majorQtQuickVersion(), 0);
gradientStopNode.variantProperty("position") = roundReal(stops.at(i).first);
gradientStopNode.variantProperty("color") = normalizeColor(stops.at(i).second);
gradientNode.nodeListProperty("stops").reparentHere(gradientStopNode);
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
index 9ef5e8440a..ca5804700e 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
@@ -137,8 +137,9 @@ void StatesEditorView::addState()
try {
if ((rootStateGroup().allStates().count() < 1) && //QtQuick import might be missing
- (!model()->hasImport(Import::createLibraryImport("QtQuick", "1.0"), true) &&
- !model()->hasImport(Import::createLibraryImport("QtQuick", "1.1"), true)))
+ (!model()->hasImport(Import::createLibraryImport("QtQuick", "1.0"), true)
+ && !model()->hasImport(Import::createLibraryImport("QtQuick", "1.1"), true)
+ && !model()->hasImport(Import::createLibraryImport("QtQuick", "2.0"), true)))
model()->changeImports(QList<Import>() << Import::createLibraryImport("QtQuick", "1.0"), QList<Import>());
ModelNode newState = rootStateGroup().addState(newStateName);
setCurrentState(newState);
diff --git a/src/plugins/qmldesigner/designercore/designercore.pri b/src/plugins/qmldesigner/designercore/designercore.pri
index 4cd9644a99..54bc62961c 100644
--- a/src/plugins/qmldesigner/designercore/designercore.pri
+++ b/src/plugins/qmldesigner/designercore/designercore.pri
@@ -74,8 +74,7 @@ SOURCES += $$PWD/model/abstractview.cpp \
$$PWD/model/rewriteactioncompressor.cpp \
$$PWD/model/qmltextgenerator.cpp \
$$PWD/model/modelmerger.cpp \
- $$PWD/exceptions/rewritingexception.cpp \
- $$PWD/model/modelnodecontextmenu.cpp
+ $$PWD/exceptions/rewritingexception.cpp
HEADERS += $$PWD/include/corelib_global.h \
$$PWD/include/abstractview.h \
@@ -144,8 +143,7 @@ HEADERS += $$PWD/include/corelib_global.h \
$$PWD/include/modelmerger.h \
$$PWD/include/mathutils.h \
$$PWD/include/customnotifications.h \
- $$PWD/include/rewritingexception.h \
- $$PWD//model/modelnodecontextmenu.h
+ $$PWD/include/rewritingexception.h
contains(CONFIG, plugin) {
# If core.pri has been included in the qmldesigner plugin
diff --git a/src/plugins/qmldesigner/designercore/include/itemlibraryinfo.h b/src/plugins/qmldesigner/designercore/include/itemlibraryinfo.h
index e0ae84eac1..c9aa09c998 100644
--- a/src/plugins/qmldesigner/designercore/include/itemlibraryinfo.h
+++ b/src/plugins/qmldesigner/designercore/include/itemlibraryinfo.h
@@ -40,7 +40,6 @@ namespace QmlDesigner {
namespace Internal {
class ItemLibraryEntryData;
-class ItemLibraryInfoPrivate;
class MetaInfoPrivate;
}
@@ -100,7 +99,6 @@ class CORESHARED_EXPORT ItemLibraryInfo : public QObject
friend class Internal::MetaInfoPrivate;
public:
- ~ItemLibraryInfo();
QList<ItemLibraryEntry> entries() const;
QList<ItemLibraryEntry> entriesForType(const QString &typeName, int majorVersion, int minorVersion) const;
@@ -113,10 +111,13 @@ public:
signals:
void entriesChanged();
-private:
+private: // functions
ItemLibraryInfo(QObject *parent = 0);
- void setBaseInfo(ItemLibraryInfo *baseInfo);
- Internal::ItemLibraryInfoPrivate *d;
+ void setBaseInfo(ItemLibraryInfo *m_baseInfo);
+
+private: // variables
+ QHash<QString, ItemLibraryEntry> m_nameToEntryHash;
+ QWeakPointer<ItemLibraryInfo> m_baseInfo;
};
} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/designercore/include/model.h b/src/plugins/qmldesigner/designercore/include/model.h
index d6cd667922..89ab059ad0 100644
--- a/src/plugins/qmldesigner/designercore/include/model.h
+++ b/src/plugins/qmldesigner/designercore/include/model.h
@@ -80,7 +80,7 @@ public:
virtual ~Model();
- static Model *create(QString type, int major = 4, int minor = 7, Model *metaInfoPropxyModel = 0);
+ static Model *create(QString type, int major = 1, int minor = 1, Model *metaInfoPropxyModel = 0);
Model *masterModel() const;
void setMasterModel(Model *model);
diff --git a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
index 29e3d2cb1d..c568427e8a 100644
--- a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
+++ b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
@@ -183,6 +183,8 @@ private: // functions
RemoveInstancesCommand createRemoveInstancesCommand(const QList<ModelNode> &nodeList) const;
RemoveInstancesCommand createRemoveInstancesCommand(const ModelNode &node) const;
RemovePropertiesCommand createRemovePropertiesCommand(const QList<AbstractProperty> &propertyList) const;
+ RemoveSharedMemoryCommand createRemoveSharedMemoryCommand(const QString &sharedMemoryTypeName, quint32 keyNumber);
+ RemoveSharedMemoryCommand createRemoveSharedMemoryCommand(const QString &sharedMemoryTypeName, const QList<ModelNode> &nodeList);
void resetHorizontalAnchors(const ModelNode &node);
void resetVerticalAnchors(const ModelNode &node);
diff --git a/src/plugins/qmldesigner/designercore/include/nodemetainfo.h b/src/plugins/qmldesigner/designercore/include/nodemetainfo.h
index 4771f1eb1c..e596c59673 100644
--- a/src/plugins/qmldesigner/designercore/include/nodemetainfo.h
+++ b/src/plugins/qmldesigner/designercore/include/nodemetainfo.h
@@ -97,6 +97,8 @@ public:
bool availableInVersion(int majorVersion, int minorVersion) const;
bool isSubclassOf(const QString& type, int majorVersion, int minorVersio) const;
+ bool isPositioner() const;
+
static void clearCache();
private:
diff --git a/src/plugins/qmldesigner/designercore/include/qmlmodelnodefacade.h b/src/plugins/qmldesigner/designercore/include/qmlmodelnodefacade.h
index c7dfa30ee3..817aad0947 100644
--- a/src/plugins/qmldesigner/designercore/include/qmlmodelnodefacade.h
+++ b/src/plugins/qmldesigner/designercore/include/qmlmodelnodefacade.h
@@ -47,10 +47,10 @@ public:
QmlModelNodeFacade();
bool isRootNode() const;
+ QmlModelView* qmlModelView() const;
protected:
QmlModelNodeFacade(const ModelNode &modelNode);
- QmlModelView* qmlModelView() const;
private:
ModelNode m_modelNode;
diff --git a/src/plugins/qmldesigner/designercore/include/qmlmodelview.h b/src/plugins/qmldesigner/designercore/include/qmlmodelview.h
index 63b8c24c19..5350cb58df 100644
--- a/src/plugins/qmldesigner/designercore/include/qmlmodelview.h
+++ b/src/plugins/qmldesigner/designercore/include/qmlmodelview.h
@@ -67,6 +67,8 @@ public:
int minorVersion,
const PropertyListType &propertyList = PropertyListType());
+ ModelNode createQmlState(const PropertyListType &propertyList = PropertyListType());
+
QmlItemNode createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, QmlItemNode parentNode);
QmlItemNode createQmlItemNodeFromImage(const QString &imageName, const QPointF &position, QmlItemNode parentNode);
@@ -120,8 +122,6 @@ public:
void importsChanged(const QList<Import> &addedImports, const QList<Import> &removedImports);
void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource);
- void showContextMenu(const QPoint &globalPos, const QPoint &scenePos, bool showSelection);
-
protected:
NodeInstance instanceForModelNode(const ModelNode &modelNode);
bool hasInstanceForModelNode(const ModelNode &modelNode);
diff --git a/src/plugins/qmldesigner/designercore/include/variantproperty.h b/src/plugins/qmldesigner/designercore/include/variantproperty.h
index f375fba7d8..be0aa95ab2 100644
--- a/src/plugins/qmldesigner/designercore/include/variantproperty.h
+++ b/src/plugins/qmldesigner/designercore/include/variantproperty.h
@@ -57,7 +57,7 @@ public:
VariantProperty& operator= (const QVariant &value);
void setDynamicTypeNameAndValue(const QString &type, const QVariant &value);
- VariantProperty& operator= (const QPair<QString, QVariant> &typeValuePair);
+ Q_DECL_DEPRECATED VariantProperty& operator= (const QPair<QString, QVariant> &typeValuePair);
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 13687835a4..fba672b847 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
@@ -35,6 +35,7 @@
#include <QCoreApplication>
#include <QUuid>
#include <QFileInfo>
+#include <QTimer>
#include "propertyabstractcontainer.h"
#include "propertyvaluecontainer.h"
@@ -63,14 +64,27 @@
#include "statepreviewimagechangedcommand.h"
#include "componentcompletedcommand.h"
#include "tokencommand.h"
-
+#include "removesharedmemorycommand.h"
+#include "endpuppetcommand.h"
#include "synchronizecommand.h"
#include "nodeinstanceview.h"
#include "import.h"
+
+#include <utils/hostosinfo.h>
+
#include <QMessageBox>
+namespace {
+static QLatin1String qmlPuppetApplicationDirectoryForTests()
+{
+ if (Utils::HostOsInfo::isWindowsHost())
+ //one more - debug/release dir
+ return QLatin1String("/../../../../../../bin/");
+ return QLatin1String("/../../../../../bin/");
+}
+} //namespace
namespace QmlDesigner {
@@ -108,7 +122,9 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
QString applicationPath = pathToQt + QLatin1String("/bin");
if (runModus == TestModus) {
- applicationPath = QCoreApplication::applicationDirPath() + QLatin1String("/../../../../../bin");
+ applicationPath = QCoreApplication::applicationDirPath()
+ + qmlPuppetApplicationDirectoryForTests()
+ + qmlPuppetApplicationName();
} else {
applicationPath = macOSBundlePath(applicationPath);
applicationPath += QLatin1Char('/') + qmlPuppetApplicationName();
@@ -216,6 +232,8 @@ NodeInstanceServerProxy::~NodeInstanceServerProxy()
{
disconnect(this, SLOT(processFinished(int,QProcess::ExitStatus)));
+ writeCommand(QVariant::fromValue(EndPuppetCommand()));
+
if (m_firstSocket)
m_firstSocket->close();
@@ -227,13 +245,13 @@ NodeInstanceServerProxy::~NodeInstanceServerProxy()
if (m_qmlPuppetEditorProcess)
- m_qmlPuppetEditorProcess->kill();
+ QTimer::singleShot(3000, m_qmlPuppetEditorProcess.data(), SLOT(terminate()));
if (m_qmlPuppetPreviewProcess)
- m_qmlPuppetPreviewProcess->kill();
+ QTimer::singleShot(3000, m_qmlPuppetPreviewProcess.data(), SLOT(terminate()));
if (m_qmlPuppetRenderProcess)
- m_qmlPuppetRenderProcess->kill();
+ QTimer::singleShot(3000, m_qmlPuppetRenderProcess.data(), SLOT(terminate()));
}
void NodeInstanceServerProxy::dispatchCommand(const QVariant &command)
@@ -303,7 +321,7 @@ void NodeInstanceServerProxy::writeCommand(const QVariant &command)
writeCommandToSocket(QVariant::fromValue(synchronizeCommand), m_firstSocket.data(), m_writeCommandCounter);
m_writeCommandCounter++;
- while(m_firstSocket->waitForReadyRead()) {
+ while (m_firstSocket->waitForReadyRead(100)) {
readFirstDataStream();
if (m_synchronizeId == synchronizeId)
return;
@@ -314,6 +332,9 @@ void NodeInstanceServerProxy::writeCommand(const QVariant &command)
void NodeInstanceServerProxy::processFinished(int /*exitCode*/, QProcess::ExitStatus exitStatus)
{
qDebug() << "Process finished:" << sender();
+
+ writeCommand(QVariant::fromValue(EndPuppetCommand()));
+
if (m_firstSocket)
m_firstSocket->close();
if (m_secondSocket)
@@ -442,25 +463,16 @@ void NodeInstanceServerProxy::readThirdDataStream()
QString NodeInstanceServerProxy::qmlPuppetApplicationName() const
{
- QString appName;
- if (hasQtQuick2(m_nodeInstanceView.data())) {
- appName = QLatin1String("qml2puppet");
- } else {
- appName = QLatin1String("qmlpuppet");
- }
- #ifdef Q_OS_WIN
- appName += QLatin1String(".exe");
- #endif
-
- return appName;
+ if (hasQtQuick2(m_nodeInstanceView.data()))
+ return QLatin1String("qml2puppet" QTC_HOST_EXE_SUFFIX);
+ return QLatin1String("qmlpuppet" QTC_HOST_EXE_SUFFIX);
}
QString NodeInstanceServerProxy::macOSBundlePath(const QString &path) const
{
QString applicationPath = path;
-#ifdef Q_OS_MACX
- applicationPath += QLatin1String("/qmlpuppet.app/Contents/MacOS");
-#endif
+ if (Utils::HostOsInfo::isMacHost())
+ applicationPath += QLatin1String("/qmlpuppet.app/Contents/MacOS");
return applicationPath;
}
@@ -539,4 +551,9 @@ void NodeInstanceServerProxy::token(const TokenCommand &command)
writeCommand(QVariant::fromValue(command));
}
+void NodeInstanceServerProxy::removeSharedMemory(const RemoveSharedMemoryCommand &command)
+{
+ writeCommand(QVariant::fromValue(command));
+}
+
} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
index 8f2c983b18..9156c667fc 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
@@ -69,6 +69,7 @@ public:
void completeComponent(const CompleteComponentCommand &command);
void changeNodeSource(const ChangeNodeSourceCommand &command);
void token(const TokenCommand &command);
+ void removeSharedMemory(const RemoveSharedMemoryCommand &command);
protected:
void writeCommand(const QVariant &command);
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
index 91f344a461..87e5ac80e0 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
@@ -32,7 +32,6 @@
#include <QDeclarativeEngine>
#include <QDeclarativeContext>
-#include <QDebug>
#include <QUrl>
#include <QGraphicsView>
#include <QGraphicsScene>
@@ -77,6 +76,7 @@
#include "completecomponentcommand.h"
#include "componentcompletedcommand.h"
#include "tokencommand.h"
+#include "removesharedmemorycommand.h"
#include "nodeinstanceserverproxy.h"
@@ -240,6 +240,7 @@ void NodeInstanceView::nodeCreated(const ModelNode &createdNode)
void NodeInstanceView::nodeAboutToBeRemoved(const ModelNode &removedNode)
{
nodeInstanceServer()->removeInstances(createRemoveInstancesCommand(removedNode));
+ nodeInstanceServer()->removeSharedMemory(createRemoveSharedMemoryCommand("Image", removedNode.internalId()));
removeInstanceAndSubInstances(removedNode);
}
@@ -311,6 +312,7 @@ void NodeInstanceView::propertiesAboutToBeRemoved(const QList<AbstractProperty>&
}
nodeInstanceServer()->removeInstances(createRemoveInstancesCommand(nodeList));
+ nodeInstanceServer()->removeSharedMemory(createRemoveSharedMemoryCommand("Image", nodeList));
nodeInstanceServer()->removeProperties(createRemovePropertiesCommand(nonNodePropertyList));
foreach (const AbstractProperty &property, propertyList) {
@@ -1033,6 +1035,21 @@ RemovePropertiesCommand NodeInstanceView::createRemovePropertiesCommand(const QL
return RemovePropertiesCommand(containerList);
}
+RemoveSharedMemoryCommand NodeInstanceView::createRemoveSharedMemoryCommand(const QString &sharedMemoryTypeName, quint32 keyNumber)
+{
+ return RemoveSharedMemoryCommand(sharedMemoryTypeName, QVector<qint32>() << keyNumber);
+}
+
+RemoveSharedMemoryCommand NodeInstanceView::createRemoveSharedMemoryCommand(const QString &sharedMemoryTypeName, const QList<ModelNode> &nodeList)
+{
+ QVector<qint32> keyNumberVector;
+
+ foreach (const ModelNode &modelNode, nodeList)
+ keyNumberVector.append(modelNode.internalId());
+
+ return RemoveSharedMemoryCommand(sharedMemoryTypeName, keyNumberVector);
+}
+
void NodeInstanceView::valuesChanged(const ValuesChangedCommand &command)
{
if (!model())
@@ -1050,6 +1067,8 @@ void NodeInstanceView::valuesChanged(const ValuesChangedCommand &command)
}
}
+ nodeInstanceServer()->removeSharedMemory(createRemoveSharedMemoryCommand(QLatin1String("Values"), command.keyNumber()));
+
if (!valuePropertyChangeList.isEmpty())
emitInstancePropertyChange(valuePropertyChangeList);
}
@@ -1128,7 +1147,7 @@ void NodeInstanceView::statePreviewImagesChanged(const StatePreviewImageChangedC
QVector<ModelNode> previewImageChangeVector;
foreach (const ImageContainer &container, command.previews()) {
- if (container.instanceId() == 0) {
+ if (container.keyNumber() == -1) {
m_baseStatePreviewImage = container.image();
previewImageChangeVector.append(rootModelNode());
} else if (hasInstanceForId(container.instanceId())) {
diff --git a/src/plugins/qmldesigner/designercore/metainfo/itemlibraryinfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/itemlibraryinfo.cpp
index d4a0e03688..c6ab1683bb 100644
--- a/src/plugins/qmldesigner/designercore/metainfo/itemlibraryinfo.cpp
+++ b/src/plugins/qmldesigner/designercore/metainfo/itemlibraryinfo.cpp
@@ -55,14 +55,6 @@ public:
bool forceImport;
};
-class ItemLibraryInfoPrivate
-{
-public:
- QHash<QString, ItemLibraryEntry> nameToEntryHash;
-
- QWeakPointer<ItemLibraryInfo> baseInfo;
-};
-
} // namespace Internal
//
@@ -252,50 +244,46 @@ QDataStream& operator>>(QDataStream& stream, ItemLibraryEntry &itemLibraryEntry)
// ItemLibraryInfo
//
-ItemLibraryInfo::ItemLibraryInfo(QObject *parent) :
- QObject(parent),
- d(new Internal::ItemLibraryInfoPrivate())
+ItemLibraryInfo::ItemLibraryInfo(QObject *parent)
+ : QObject(parent)
{
}
-ItemLibraryInfo::~ItemLibraryInfo()
-{
- delete d;
-}
+
QList<ItemLibraryEntry> ItemLibraryInfo::entriesForType(const QString &typeName, int majorVersion, int minorVersion) const
{
QList<ItemLibraryEntry> entries;
- foreach (const ItemLibraryEntry &entry, d->nameToEntryHash) {
+ foreach (const ItemLibraryEntry &entry, m_nameToEntryHash) {
if (entry.typeName() == typeName
&& entry.majorVersion() >= majorVersion
&& entry.minorVersion() >= minorVersion)
entries += entry;
}
- if (d->baseInfo)
- entries += d->baseInfo->entriesForType(typeName, majorVersion, minorVersion);
+ if (m_baseInfo)
+ entries += m_baseInfo->entriesForType(typeName, majorVersion, minorVersion);
return entries;
}
ItemLibraryEntry ItemLibraryInfo::entry(const QString &name) const
{
- if (d->nameToEntryHash.contains(name))
- return d->nameToEntryHash.value(name);
+ if (m_nameToEntryHash.contains(name))
+ return m_nameToEntryHash.value(name);
- if (d->baseInfo)
- return d->baseInfo->entry(name);
+ if (m_baseInfo)
+ return m_baseInfo->entry(name);
return ItemLibraryEntry();
}
QList<ItemLibraryEntry> ItemLibraryInfo::entries() const
{
- QList<ItemLibraryEntry> list = d->nameToEntryHash.values();
- if (d->baseInfo)
- list += d->baseInfo->entries();
+ QList<ItemLibraryEntry> list = m_nameToEntryHash.values();
+ if (m_baseInfo)
+ list += m_baseInfo->entries();
return list;
}
@@ -307,9 +295,9 @@ static inline QString keyForEntry(const ItemLibraryEntry &entry)
void ItemLibraryInfo::addEntry(const ItemLibraryEntry &entry)
{
const QString key = keyForEntry(entry);
- if (d->nameToEntryHash.contains(key))
+ if (m_nameToEntryHash.contains(key))
throw InvalidMetaInfoException(__LINE__, __FUNCTION__, __FILE__);
- d->nameToEntryHash.insert(key, entry);
+ m_nameToEntryHash.insert(key, entry);
emit entriesChanged();
}
@@ -317,18 +305,18 @@ void ItemLibraryInfo::addEntry(const ItemLibraryEntry &entry)
bool ItemLibraryInfo::containsEntry(const ItemLibraryEntry &entry)
{
const QString key = keyForEntry(entry);
- return d->nameToEntryHash.contains(key);
+ return m_nameToEntryHash.contains(key);
}
void ItemLibraryInfo::clearEntries()
{
- d->nameToEntryHash.clear();
+ m_nameToEntryHash.clear();
emit entriesChanged();
}
void ItemLibraryInfo::setBaseInfo(ItemLibraryInfo *baseInfo)
{
- d->baseInfo = baseInfo;
+ m_baseInfo = baseInfo;
}
} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
index 72d362dac4..f5722f1ce3 100644
--- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
+++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
@@ -337,7 +337,7 @@ public:
Model *model() const
{ return m_model; }
- QString packageName() const;
+ QString cppPackageName() const;
QString componentSource() const;
QString componentFileName() const;
@@ -672,6 +672,14 @@ QString NodeMetaInfoPrivate::propertyEnumScope(const QString &propertyName) cons
return QString();
}
+static QString getUnqualifiedName(const QString &name)
+{
+ const QStringList nameComponents = name.split('.');
+ if (nameComponents.size() < 2)
+ return QString();
+ return nameComponents.last();
+}
+
bool NodeMetaInfoPrivate::cleverCheckType(const QString &otherType) const
{
if (otherType == qualfiedTypeName())
@@ -687,8 +695,8 @@ bool NodeMetaInfoPrivate::cleverCheckType(const QString &otherType) const
package = split.first();
typeName = split.at(1);
}
- if (packageName() == package)
- return QString(package + '.' + typeName) == qualfiedTypeName();
+ if (cppPackageName() == package)
+ return QString(package + '.' + typeName) == cppPackageName() + '.' + getUnqualifiedName(qualfiedTypeName());
const CppComponentValue *qmlObjectValue = getCppComponentValue();
if (!qmlObjectValue)
@@ -751,7 +759,7 @@ QStringList NodeMetaInfoPrivate::keysForEnum(const QString &enumName) const
return qmlObjectValue->getEnum(enumName).keys();
}
-QString NodeMetaInfoPrivate::packageName() const
+QString NodeMetaInfoPrivate::cppPackageName() const
{
if (!isComponent()) {
if (const CppComponentValue *qmlObject = getCppComponentValue())
@@ -1096,4 +1104,11 @@ void NodeMetaInfo::clearCache()
Internal::NodeMetaInfoPrivate::clearCache();
}
+bool NodeMetaInfo::isPositioner() const
+{
+ if (majorVersion() < 2)
+ return isSubclassOf("<cpp>.QDeclarativeBasePositioner", -1, -1);
+ return isSubclassOf("QtQuick.Positioner", -1, -1);
+}
+
} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp
index 02c27b7e87..e88f7519b6 100644
--- a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp
+++ b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp
@@ -31,6 +31,8 @@
#include "model.h"
#include "metainfo.h"
+#include <utils/hostosinfo.h>
+
#include <QDir>
#include <QMetaType>
#include <QUrl>
@@ -55,12 +57,8 @@ static inline QStringList importPaths() {
// env import paths
QByteArray envImportPath = qgetenv("QML_IMPORT_PATH");
if (!envImportPath.isEmpty()) {
-#if defined(Q_OS_WIN)
- QLatin1Char pathSep(';');
-#else
- QLatin1Char pathSep(':');
-#endif
- paths = QString::fromLatin1(envImportPath).split(pathSep, QString::SkipEmptyParts);
+ paths = QString::fromLatin1(envImportPath)
+ .split(Utils::HostOsInfo::pathListSeparator(), QString::SkipEmptyParts);
}
return paths;
@@ -79,7 +77,7 @@ SubComponentManager::SubComponentManager(Model *model, QObject *parent)
void SubComponentManager::addImport(int pos, const Import &import)
{
if (debug)
- qDebug() << Q_FUNC_INFO << pos << import.file().toAscii();
+ qDebug() << Q_FUNC_INFO << pos << import.file().toLatin1();
if (import.isFileImport()) {
QFileInfo dirInfo = QFileInfo(m_filePath.resolved(import.file()).toLocalFile());
diff --git a/src/plugins/qmldesigner/designercore/model/model.cpp b/src/plugins/qmldesigner/designercore/model/model.cpp
index 261622d4ff..f6f40c9871 100644
--- a/src/plugins/qmldesigner/designercore/model/model.cpp
+++ b/src/plugins/qmldesigner/designercore/model/model.cpp
@@ -91,7 +91,7 @@ ModelPrivate::ModelPrivate(Model *model) :
m_writeLock(false),
m_internalIdCounter(1)
{
- m_rootInternalNode = createNode("QtQuick/Item", 1, 0, PropertyListType(), PropertyListType(), QString(), ModelNode::NodeWithoutSource,true);
+ m_rootInternalNode = createNode("QtQuick.Item", 1, 0, PropertyListType(), PropertyListType(), QString(), ModelNode::NodeWithoutSource,true);
m_acutalStateNode = m_rootInternalNode;
}
@@ -107,15 +107,15 @@ void ModelPrivate::detachAllViews()
m_viewList.clear();
- if (m_rewriterView) {
- m_rewriterView->modelAboutToBeDetached(m_q);
- m_rewriterView.clear();
- }
-
if (m_nodeInstanceView) {
m_nodeInstanceView->modelAboutToBeDetached(m_q);
m_nodeInstanceView.clear();
}
+
+ if (m_rewriterView) {
+ m_rewriterView->modelAboutToBeDetached(m_q);
+ m_rewriterView.clear();
+ }
}
Model *ModelPrivate::create(QString type, int major, int minor, Model *metaInfoPropxyModel)
diff --git a/src/plugins/qmldesigner/designercore/model/modelnode.cpp b/src/plugins/qmldesigner/designercore/model/modelnode.cpp
index 3b16155a76..4c5c4f5745 100644
--- a/src/plugins/qmldesigner/designercore/model/modelnode.cpp
+++ b/src/plugins/qmldesigner/designercore/model/modelnode.cpp
@@ -248,10 +248,12 @@ int ModelNode::majorQtQuickVersion() const
}
if (metaInfo().isValid()) {
+ if (type() == "QtQuick.QtObject")
+ return majorVersion();
NodeMetaInfo superClass = metaInfo().directSuperClass();
while (superClass.isValid()) {
- if (superClass.typeName() == "QtQuick.Item")
+ if (superClass.typeName() == "QtQuick.QtObject")
return superClass.majorVersion();
superClass = superClass.directSuperClass();
}
diff --git a/src/plugins/qmldesigner/designercore/model/propertyparser.cpp b/src/plugins/qmldesigner/designercore/model/propertyparser.cpp
index e29963afa9..934a6c20dd 100644
--- a/src/plugins/qmldesigner/designercore/model/propertyparser.cpp
+++ b/src/plugins/qmldesigner/designercore/model/propertyparser.cpp
@@ -59,8 +59,8 @@ static uchar fromHex(const uchar c, const uchar c2)
static uchar fromHex(const QString &s, int idx)
{
- uchar c = s.at(idx).toAscii();
- uchar c2 = s.at(idx + 1).toAscii();
+ uchar c = s.at(idx).toLatin1();
+ uchar c2 = s.at(idx + 1).toLatin1();
return fromHex(c, c2);
}
@@ -191,7 +191,7 @@ QVariant read(const QString &typeStr, const QString &str, const MetaInfo &)
QVariant read(const QString &typeStr, const QString &str)
{
- int type = QMetaType::type(typeStr.toAscii().constData());
+ int type = QMetaType::type(typeStr.toLatin1().constData());
if (type == 0) {
qWarning() << "Type " << typeStr
<< " is unknown to QMetaType system. Cannot create properly typed QVariant for value "
diff --git a/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp b/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp
index 08f3917607..dd69cc85a4 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp
@@ -56,7 +56,9 @@ bool QmlPropertyChanges::isValid() const
bool QmlModelStateOperation::isValid() const
{
- return QmlModelNodeFacade::isValid() && modelNode().metaInfo().isSubclassOf("<cpp>.QDeclarativeStateOperation", -1, -1);
+ return QmlModelNodeFacade::isValid() && (
+ modelNode().metaInfo().isSubclassOf("<cpp>.QDeclarative1StateOperation", -1, -1)
+ || modelNode().metaInfo().isSubclassOf("<cpp>.QDeclarativeStateOperation", -1, -1));
}
void QmlPropertyChanges::removeProperty(const QString &name)
diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
index 12edc2012b..f9c27fc897 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
@@ -328,7 +328,7 @@ QmlModelState QmlModelStateGroup::addState(const QString &name)
PropertyListType propertyList;
propertyList.append(qMakePair(QString("name"), QVariant(name)));
- ModelNode newState = modelNode().view()->createModelNode("QtQuick.State", 1, 0, propertyList);
+ ModelNode newState = QmlObjectNode(modelNode()).qmlModelView()->createQmlState(propertyList);
modelNode().nodeListProperty("states").reparentHere(newState);
return newState;
diff --git a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp
index c993335281..86002b5ece 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp
@@ -45,8 +45,8 @@
#include "rewriterview.h"
#include "plaintexteditmodifier.h"
#include "modelmerger.h"
-#include "modelnodecontextmenu.h"
+#include <utils/qtcassert.h>
namespace QmlDesigner {
@@ -424,13 +424,6 @@ void QmlModelView::nodeSourceChanged(const ModelNode &, const QString & /*newNod
}
-void QmlModelView::showContextMenu(const QPoint &globalPos, const QPoint &scenePos, bool showSelection)
-{
- ModelNodeContextMenu contextMenu(this);
- contextMenu.setScenePos(scenePos);
- contextMenu.execute(globalPos, showSelection);
-}
-
void QmlModelView::rewriterBeginTransaction()
{
@@ -473,5 +466,17 @@ void QmlModelView::otherPropertyChanged(const QmlObjectNode &/*qmlObjectNode*/,
{
}
+ModelNode QmlModelView::createQmlState(const QmlDesigner::PropertyListType &propertyList)
+{
+
+ QTC_CHECK(rootModelNode().majorQtQuickVersion() < 3);
+
+ if (rootModelNode().majorQtQuickVersion() > 1) {
+ return createModelNode("QtQuick.State", 2, 0, propertyList);
+ } else {
+ return createModelNode("QtQuick.State", 1, 0, propertyList);
+ }
+}
+
} //QmlDesigner
diff --git a/src/plugins/qmldesigner/designercore/model/qmlstate.cpp b/src/plugins/qmldesigner/designercore/model/qmlstate.cpp
index a1b87fc02e..623c6c23ac 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlstate.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlstate.cpp
@@ -177,7 +177,13 @@ void QmlModelState::addChangeSetIfNotExists(const ModelNode &node)
return; //changeSet already there
}
- ModelNode newChangeSet = modelNode().view()->createModelNode("QtQuick.PropertyChanges", 1, 0);
+ ModelNode newChangeSet;
+ if (qmlModelView()->rootModelNode().majorQtQuickVersion() > 1) {
+ newChangeSet = modelNode().view()->createModelNode("QtQuick.PropertyChanges", 2, 0);
+ } else {
+ newChangeSet = modelNode().view()->createModelNode("QtQuick.PropertyChanges", 1, 0);
+ }
+
modelNode().nodeListProperty("changes").reparentHere(newChangeSet);
QmlPropertyChanges(newChangeSet).setTarget(node);
@@ -244,7 +250,7 @@ bool QmlModelState::isValid() const
{
return QmlModelNodeFacade::isValid() &&
modelNode().metaInfo().isValid() &&
- (modelNode().metaInfo().isSubclassOf("QtQuick.State", 1, 0) || isBaseState());
+ (modelNode().metaInfo().isSubclassOf("QtQuick.State", -1, -1) || isBaseState());
}
/**
@@ -278,7 +284,7 @@ QmlModelState QmlModelState::duplicate(const QString &name) const
// QmlModelState newState(stateGroup().addState(name));
PropertyListType propertyList;
propertyList.append(qMakePair(QString("name"), QVariant(name)));
- QmlModelState newState ( qmlModelView()->createModelNode("QtQuick.State", 1, 0, propertyList) );
+ QmlModelState newState ( qmlModelView()->createQmlState(propertyList) );
foreach (const ModelNode &childNode, modelNode().nodeListProperty("changes").toModelNodeList()) {
ModelNode newModelNode(qmlModelView()->createModelNode(childNode.type(), childNode.majorVersion(), childNode.minorVersion()));
diff --git a/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp b/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp
index be42f2151c..c331365a85 100644
--- a/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp
@@ -54,8 +54,12 @@ inline static QString properColorName(const QColor &color)
inline static QString doubleToString(double d)
{
QString string = QString::number(d, 'f', 3);
- if (string.endsWith(".000"))
- string.chop(4);
+ if (string.contains(QLatin1Char('.'))) {
+ while (string.at(string.length()- 1) == QLatin1Char('0'))
+ string.chop(1);
+ if (string.at(string.length()- 1) == QLatin1Char('.'))
+ string.chop(1);
+ }
return string;
}
diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
index 159f472d09..c3a890f471 100644
--- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
+++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
@@ -125,27 +125,6 @@ static inline QString fixEscapedUnicodeChar(const QString &value) //convert "\u2
return value;
}
-static inline int fixUpMajorVersionForQt(const QString &value, int i)
-{
- if (i == 4 && value == "Qt")
- return 1;
- else return i;
-}
-
-static inline int fixUpMinorVersionForQt(const QString &value, int i)
-{
- if (i == 7 && value == "Qt")
- return 0;
- else return i;
-}
-
-static inline QString fixUpPackeNameForQt(const QString &value)
-{
- if (value == "Qt")
- return "QtQuick";
- return value;
-}
-
static inline bool isSignalPropertyName(const QString &signalName)
{
// see QmlCompiler::isSignalPropertyName
@@ -343,11 +322,10 @@ public:
const CppComponentValue * qmlValue = value_cast<CppComponentValue>(value);
if (qmlValue) {
- typeName = fixUpPackeNameForQt(qmlValue->moduleName()) + QLatin1String(".") + qmlValue->className();
+ typeName = qmlValue->moduleName() + QLatin1String(".") + qmlValue->className();
- //### todo this is just a hack to support QtQuick 1.0
- majorVersion = fixUpMajorVersionForQt(qmlValue->moduleName(), qmlValue->componentVersion().majorVersion());
- minorVersion = fixUpMinorVersionForQt(qmlValue->moduleName(), qmlValue->componentVersion().minorVersion());
+ majorVersion = qmlValue->componentVersion().majorVersion();
+ minorVersion = qmlValue->componentVersion().minorVersion();
} else {
for (UiQualifiedId *iter = astTypeNode; iter; iter = iter->next)
if (!iter->next && !iter->name.isEmpty())
diff --git a/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginmanager.cpp b/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginmanager.cpp
index 47acad9d72..5ef5a980b0 100644
--- a/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginmanager.cpp
+++ b/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginmanager.cpp
@@ -28,7 +28,6 @@
****************************************************************************/
#include "widgetpluginmanager.h"
-#include "widgetpluginpath.h"
#include <iwidgetplugin.h>
#include <QCoreApplication>
@@ -51,28 +50,15 @@ namespace QmlDesigner {
namespace Internal {
-// ---- PluginManager[Private]
-class WidgetPluginManagerPrivate {
-public:
- typedef QList<WidgetPluginPath> PluginPathList;
- PluginPathList m_paths;
-};
-
-WidgetPluginManager::WidgetPluginManager() :
- d(new WidgetPluginManagerPrivate)
-{
-}
-
-WidgetPluginManager::~WidgetPluginManager()
+WidgetPluginManager::WidgetPluginManager()
{
- delete d;
}
WidgetPluginManager::IWidgetPluginList WidgetPluginManager::instances()
{
IWidgetPluginList rc;
- const WidgetPluginManagerPrivate::PluginPathList::iterator end = d->m_paths.end();
- for (WidgetPluginManagerPrivate::PluginPathList::iterator it = d->m_paths.begin(); it != end; ++it)
+ const PluginPathList::iterator end = m_paths.end();
+ for (PluginPathList::iterator it = m_paths.begin(); it != end; ++it)
it->getInstances(&rc);
if (debug)
qDebug() << '<' << Q_FUNC_INFO << rc.size();
@@ -84,15 +70,15 @@ bool WidgetPluginManager::addPath(const QString &path)
const QDir dir(path);
if (!dir.exists())
return false;
- d->m_paths.push_back(WidgetPluginPath(dir));
+ m_paths.push_back(WidgetPluginPath(dir));
return true;
}
QAbstractItemModel *WidgetPluginManager::createModel(QObject *parent)
{
QStandardItemModel *model = new QStandardItemModel(parent);
- const WidgetPluginManagerPrivate::PluginPathList::iterator end = d->m_paths.end();
- for (WidgetPluginManagerPrivate::PluginPathList::iterator it = d->m_paths.begin(); it != end; ++it)
+ const PluginPathList::iterator end = m_paths.end();
+ for (PluginPathList::iterator it = m_paths.begin(); it != end; ++it)
model->appendRow(it->createModelItem());
return model;
}
diff --git a/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginmanager.h b/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginmanager.h
index 2e7ceb75e0..fe1fa66161 100644
--- a/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginmanager.h
+++ b/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginmanager.h
@@ -33,6 +33,9 @@
#include <QObject>
#include <QList>
+#include "widgetpluginpath.h"
+
+
QT_BEGIN_NAMESPACE
class QString;
class QAbstractItemModel;
@@ -44,8 +47,6 @@ class IWidgetPlugin;
namespace Internal {
-class WidgetPluginManagerPrivate;
-
// PluginManager: Loads the plugin libraries on demand "as lazy as
// possible", that is, directories are scanned and
// instances are created only when instances() is called.
@@ -53,11 +54,11 @@ class WidgetPluginManagerPrivate;
class WidgetPluginManager
{
Q_DISABLE_COPY(WidgetPluginManager)
+ typedef QList<WidgetPluginPath> PluginPathList;
public:
typedef QList<IWidgetPlugin *> IWidgetPluginList;
WidgetPluginManager();
- ~WidgetPluginManager();
bool addPath(const QString &path);
@@ -68,7 +69,7 @@ public:
QAbstractItemModel *createModel(QObject *parent = 0);
private:
- WidgetPluginManagerPrivate *d;
+ PluginPathList m_paths;
};
} // namespace Internal
diff --git a/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginpath.cpp b/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginpath.cpp
index d150e983e7..dd09e3fd69 100644
--- a/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginpath.cpp
+++ b/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginpath.cpp
@@ -172,7 +172,7 @@ void WidgetPluginPath::ensureLoaded()
}
}
-void WidgetPluginPath::getInstances(WidgetPluginManager::IWidgetPluginList *list)
+void WidgetPluginPath::getInstances(IWidgetPluginList *list)
{
ensureLoaded();
// Compile list of instances
diff --git a/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginpath.h b/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginpath.h
index 2e61bee02b..292eb5c1c5 100644
--- a/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginpath.h
+++ b/src/plugins/qmldesigner/designercore/pluginmanager/widgetpluginpath.h
@@ -30,8 +30,6 @@
#ifndef WIDGETPLUGINPATH_H
#define WIDGETPLUGINPATH_H
-#include "widgetpluginmanager.h"
-
#include <QObject>
#include <QWeakPointer>
#include <QList>
@@ -73,11 +71,12 @@ struct WidgetPluginData {
// IPlugins.
class WidgetPluginPath {
+ typedef QList<IWidgetPlugin *> IWidgetPluginList;
public:
explicit WidgetPluginPath(const QDir &path);
- void getInstances(WidgetPluginManager::IWidgetPluginList *list);
+ void getInstances(IWidgetPluginList *list);
QDir path() const { return m_path; }
diff --git a/src/plugins/qmldesigner/designmodewidget.h b/src/plugins/qmldesigner/designmodewidget.h
index 2736a3aabe..14c746198a 100644
--- a/src/plugins/qmldesigner/designmodewidget.h
+++ b/src/plugins/qmldesigner/designmodewidget.h
@@ -35,8 +35,6 @@
#include <utils/faketooltip.h>
#include <texteditor/itexteditor.h>
-#include <integrationcore.h>
-
#include <designdocumentcontroller.h>
#include <itemlibraryview.h>
#include <navigatorwidget.h>
diff --git a/src/plugins/qmldesigner/qmldesigner.qbs b/src/plugins/qmldesigner/qmldesigner.qbs
index 419a6e114b..b59049546b 100644
--- a/src/plugins/qmldesigner/qmldesigner.qbs
+++ b/src/plugins/qmldesigner/qmldesigner.qbs
@@ -20,440 +20,458 @@ QtcPlugin {
Depends { name: "QtSupport" }
Depends { name: "cpp" }
- cpp.defines: base.concat(project.additionalCppDefines.concat(["QWEAKPOINTER_ENABLE_ARROW"]))
- cpp.includePaths: [
- ".",
+ cpp.defines: base.concat(["QWEAKPOINTER_ENABLE_ARROW"])
+ cpp.includePaths: base.concat([
"designercore",
"designercore/include",
"../../../share/qtcreator/qml/qmlpuppet/interfaces",
"../../../share/qtcreator/qml/qmlpuppet/container",
"../../../share/qtcreator/qml/qmlpuppet/commands",
+ "components/componentcore",
"components/integration",
"components/propertyeditor",
"components/formeditor",
"components/itemlibrary",
"components/navigator",
"components/pluginmanager",
- "components/stateseditor",
- "..",
- "../../libs",
- buildDirectory
- ]
+ "components/stateseditor"
+ ])
+
+ Group {
+ prefix: "designercore/filemanager/"
+ files: [
+ "addarraymembervisitor.cpp",
+ "addarraymembervisitor.h",
+ "addobjectvisitor.cpp",
+ "addobjectvisitor.h",
+ "addpropertyvisitor.cpp",
+ "addpropertyvisitor.h",
+ "astobjecttextextractor.cpp",
+ "astobjecttextextractor.h",
+ "changeimportsvisitor.cpp",
+ "changeimportsvisitor.h",
+ "changeobjecttypevisitor.cpp",
+ "changeobjecttypevisitor.h",
+ "changepropertyvisitor.cpp",
+ "changepropertyvisitor.h",
+ "firstdefinitionfinder.cpp",
+ "firstdefinitionfinder.h",
+ "moveobjectbeforeobjectvisitor.cpp",
+ "moveobjectbeforeobjectvisitor.h",
+ "moveobjectvisitor.cpp",
+ "moveobjectvisitor.h",
+ "objectlengthcalculator.cpp",
+ "objectlengthcalculator.h",
+ "qmlrefactoring.cpp",
+ "qmlrefactoring.h",
+ "qmlrewriter.cpp",
+ "qmlrewriter.h",
+ "removepropertyvisitor.cpp",
+ "removepropertyvisitor.h",
+ "removeuiobjectmembervisitor.cpp",
+ "removeuiobjectmembervisitor.h",
+ ]
+ }
+
+ Group {
+ prefix: "../../../share/qtcreator/qml/qmlpuppet/"
+ files: [
+ "commands/changeauxiliarycommand.cpp",
+ "commands/changeauxiliarycommand.h",
+ "commands/changebindingscommand.cpp",
+ "commands/changebindingscommand.h",
+ "commands/changefileurlcommand.cpp",
+ "commands/changefileurlcommand.h",
+ "commands/changeidscommand.cpp",
+ "commands/changeidscommand.h",
+ "commands/changenodesourcecommand.cpp",
+ "commands/changenodesourcecommand.h",
+ "commands/changestatecommand.cpp",
+ "commands/changestatecommand.h",
+ "commands/changevaluescommand.cpp",
+ "commands/changevaluescommand.h",
+ "commands/childrenchangedcommand.cpp",
+ "commands/childrenchangedcommand.h",
+ "commands/clearscenecommand.cpp",
+ "commands/clearscenecommand.h",
+ "commands/completecomponentcommand.cpp",
+ "commands/completecomponentcommand.h",
+ "commands/componentcompletedcommand.cpp",
+ "commands/componentcompletedcommand.h",
+ "commands/createinstancescommand.cpp",
+ "commands/createinstancescommand.h",
+ "commands/createscenecommand.cpp",
+ "commands/createscenecommand.h",
+ "commands/informationchangedcommand.cpp",
+ "commands/informationchangedcommand.h",
+ "commands/pixmapchangedcommand.cpp",
+ "commands/pixmapchangedcommand.h",
+ "commands/removeinstancescommand.cpp",
+ "commands/removeinstancescommand.h",
+ "commands/removepropertiescommand.cpp",
+ "commands/removepropertiescommand.h",
+ "commands/reparentinstancescommand.cpp",
+ "commands/reparentinstancescommand.h",
+ "commands/statepreviewimagechangedcommand.cpp",
+ "commands/statepreviewimagechangedcommand.h",
+ "commands/synchronizecommand.cpp",
+ "commands/synchronizecommand.h",
+ "commands/tokencommand.cpp",
+ "commands/tokencommand.h",
+ "commands/valueschangedcommand.cpp",
+ "commands/valueschangedcommand.h",
+ "container/addimportcontainer.cpp",
+ "container/addimportcontainer.h",
+ "container/idcontainer.cpp",
+ "container/idcontainer.h",
+ "container/imagecontainer.cpp",
+ "container/imagecontainer.h",
+ "container/informationcontainer.cpp",
+ "container/informationcontainer.h",
+ "container/instancecontainer.cpp",
+ "container/instancecontainer.h",
+ "container/propertyabstractcontainer.cpp",
+ "container/propertyabstractcontainer.h",
+ "container/propertybindingcontainer.cpp",
+ "container/propertybindingcontainer.h",
+ "container/propertyvaluecontainer.cpp",
+ "container/propertyvaluecontainer.h",
+ "container/reparentcontainer.cpp",
+ "container/reparentcontainer.h",
+ "interfaces/commondefines.h",
+ "interfaces/nodeinstanceclientinterface.h",
+ "interfaces/nodeinstanceserverinterface.cpp",
+ "interfaces/nodeinstanceserverinterface.h",
+ ]
+ }
+
+ Group {
+ prefix: "designercore/"
+ files: [
+ "rewritertransaction.cpp",
+ "rewritertransaction.h",
+ "exceptions/exception.cpp",
+ "exceptions/invalidargumentexception.cpp",
+ "exceptions/invalididexception.cpp",
+ "exceptions/invalidmetainfoexception.cpp",
+ "exceptions/invalidmodelnodeexception.cpp",
+ "exceptions/invalidmodelstateexception.cpp",
+ "exceptions/invalidpropertyexception.cpp",
+ "exceptions/invalidqmlsourceexception.cpp",
+ "exceptions/invalidreparentingexception.cpp",
+ "exceptions/invalidslideindexexception.cpp",
+ "exceptions/notimplementedexception.cpp",
+ "exceptions/removebasestateexception.cpp",
+ "exceptions/rewritingexception.cpp",
+ "include/abstractproperty.h",
+ "include/abstractview.h",
+ "include/basetexteditmodifier.h",
+ "include/basetexteditmodifier.h",
+ "include/bindingproperty.h",
+ "include/componenttextmodifier.h",
+ "include/corelib_global.h",
+ "include/customnotifications.h",
+ "include/exception.h",
+ "include/forwardview.h",
+ "include/import.h",
+ "include/invalidargumentexception.h",
+ "include/invalididexception.h",
+ "include/invalidmetainfoexception.h",
+ "include/invalidmodelstateexception.h",
+ "include/invalidpropertyexception.h",
+ "include/invalidqmlsourceexception.h",
+ "include/invalidreparentingexception.h",
+ "include/invalidslideindexexception.h",
+ "include/itemlibraryinfo.h",
+ "include/mathutils.h",
+ "include/metainfo.h",
+ "include/metainfoparser.h",
+ "include/model.h",
+ "include/modelmerger.h",
+ "include/modelnode.h",
+ "include/modelnodepositionstorage.h",
+ "include/nodeabstractproperty.h",
+ "include/nodeinstance.h",
+ "include/nodeinstanceview.h",
+ "include/nodelistproperty.h",
+ "include/nodemetainfo.h",
+ "include/nodeproperty.h",
+ "include/notimplementedexception.h",
+ "include/plaintexteditmodifier.h",
+ "include/propertycontainer.h",
+ "include/propertynode.h",
+ "include/propertyparser.h",
+ "include/qmlanchors.h",
+ "include/qmlchangeset.h",
+ "include/qmlitemnode.h",
+ "include/qmlmodelnodefacade.h",
+ "include/qmlmodelview.h",
+ "include/qmlobjectnode.h",
+ "include/qmlstate.h",
+ "include/removebasestateexception.h",
+ "include/rewriterview.h",
+ "include/rewritingexception.h",
+ "include/subcomponentmanager.h",
+ "include/textmodifier.h",
+ "include/variantproperty.h",
+ "instances/nodeinstance.cpp",
+ "instances/nodeinstanceserverproxy.cpp",
+ "instances/nodeinstanceserverproxy.h",
+ "instances/nodeinstanceview.cpp",
+ "metainfo/itemlibraryinfo.cpp",
+ "metainfo/metainfo.cpp",
+ "metainfo/metainfoparser.cpp",
+ "metainfo/nodemetainfo.cpp",
+ "metainfo/subcomponentmanager.cpp",
+ "model/abstractproperty.cpp",
+ "model/abstractview.cpp",
+ "model/basetexteditmodifier.cpp",
+ "model/bindingproperty.cpp",
+ "model/componenttextmodifier.cpp",
+ "model/import.cpp",
+ "model/internalbindingproperty.cpp",
+ "model/internalbindingproperty.h",
+ "model/internalnode.cpp",
+ "model/internalnode_p.h",
+ "model/internalnodeabstractproperty.cpp",
+ "model/internalnodeabstractproperty.h",
+ "model/internalnodelistproperty.cpp",
+ "model/internalnodelistproperty.h",
+ "model/internalnodeproperty.cpp",
+ "model/internalnodeproperty.h",
+ "model/internalproperty.cpp",
+ "model/internalproperty.h",
+ "model/internalvariantproperty.cpp",
+ "model/internalvariantproperty.h",
+ "model/model.cpp",
+ "model/model_p.h",
+ "model/modelmerger.cpp",
+ "model/modelnode.cpp",
+ "model/modelnodepositionrecalculator.cpp",
+ "model/modelnodepositionrecalculator.h",
+ "model/modelnodepositionstorage.cpp",
+ "model/modeltotextmerger.cpp",
+ "model/modeltotextmerger.h",
+ "model/nodeabstractproperty.cpp",
+ "model/nodelistproperty.cpp",
+ "model/nodeproperty.cpp",
+ "model/painteventfilter.cpp",
+ "model/painteventfilter_p.h",
+ "model/plaintexteditmodifier.cpp",
+ "model/propertycontainer.cpp",
+ "model/propertynode.cpp",
+ "model/propertyparser.cpp",
+ "model/qmlanchors.cpp",
+ "model/qmlchangeset.cpp",
+ "model/qmlitemnode.cpp",
+ "model/qmlmodelnodefacade.cpp",
+ "model/qmlmodelview.cpp",
+ "model/qmlobjectnode.cpp",
+ "model/qmlstate.cpp",
+ "model/qmltextgenerator.cpp",
+ "model/qmltextgenerator.h",
+ "model/rewriteaction.cpp",
+ "model/rewriteaction.h",
+ "model/rewriteactioncompressor.cpp",
+ "model/rewriteactioncompressor.h",
+ "model/rewriterview.cpp",
+ "model/textmodifier.cpp",
+ "model/texttomodelmerger.cpp",
+ "model/texttomodelmerger.h",
+ "model/variantproperty.cpp",
+ "model/viewlogger.cpp",
+ "model/viewlogger.h",
+ "pluginmanager/widgetpluginmanager.cpp",
+ "pluginmanager/widgetpluginmanager.h",
+ "pluginmanager/widgetpluginpath.cpp",
+ "pluginmanager/widgetpluginpath.h",
+ ]
+ }
+
+ Group {
+ prefix: "components/"
+ files: [
+ "componentcore/modelnodecontextmenu.cpp",
+ "componentcore/modelnodecontextmenu.h",
+ "formeditor/abstractformeditortool.cpp",
+ "formeditor/abstractformeditortool.h",
+ "formeditor/controlelement.cpp",
+ "formeditor/controlelement.h",
+ "formeditor/dragtool.cpp",
+ "formeditor/dragtool.h",
+ "formeditor/formeditor.qrc",
+ "formeditor/formeditorgraphicsview.cpp",
+ "formeditor/formeditorgraphicsview.h",
+ "formeditor/formeditoritem.cpp",
+ "formeditor/formeditoritem.h",
+ "formeditor/formeditorscene.cpp",
+ "formeditor/formeditorscene.h",
+ "formeditor/formeditorview.cpp",
+ "formeditor/formeditorview.h",
+ "formeditor/formeditorwidget.cpp",
+ "formeditor/formeditorwidget.h",
+ "formeditor/itemutilfunctions.cpp",
+ "formeditor/itemutilfunctions.h",
+ "formeditor/layeritem.cpp",
+ "formeditor/layeritem.h",
+ "formeditor/lineeditaction.cpp",
+ "formeditor/lineeditaction.h",
+ "formeditor/movemanipulator.cpp",
+ "formeditor/movemanipulator.h",
+ "formeditor/movetool.cpp",
+ "formeditor/movetool.h",
+ "formeditor/numberseriesaction.cpp",
+ "formeditor/numberseriesaction.h",
+ "formeditor/onedimensionalcluster.cpp",
+ "formeditor/onedimensionalcluster.h",
+ "formeditor/resizecontroller.cpp",
+ "formeditor/resizecontroller.h",
+ "formeditor/resizehandleitem.cpp",
+ "formeditor/resizehandleitem.h",
+ "formeditor/resizeindicator.cpp",
+ "formeditor/resizeindicator.h",
+ "formeditor/resizemanipulator.cpp",
+ "formeditor/resizemanipulator.h",
+ "formeditor/resizetool.cpp",
+ "formeditor/resizetool.h",
+ "formeditor/rubberbandselectionmanipulator.cpp",
+ "formeditor/rubberbandselectionmanipulator.h",
+ "formeditor/scaleitem.cpp",
+ "formeditor/scaleitem.h",
+ "formeditor/scalemanipulator.cpp",
+ "formeditor/scalemanipulator.h",
+ "formeditor/selectionindicator.cpp",
+ "formeditor/selectionindicator.h",
+ "formeditor/selectionrectangle.cpp",
+ "formeditor/selectionrectangle.h",
+ "formeditor/selectiontool.cpp",
+ "formeditor/selectiontool.h",
+ "formeditor/singleselectionmanipulator.cpp",
+ "formeditor/singleselectionmanipulator.h",
+ "formeditor/snapper.cpp",
+ "formeditor/snapper.h",
+ "formeditor/snappinglinecreator.cpp",
+ "formeditor/snappinglinecreator.h",
+ "formeditor/toolbox.cpp",
+ "formeditor/toolbox.h",
+ "formeditor/zoomaction.cpp",
+ "formeditor/zoomaction.h",
+ "integration/componentaction.cpp",
+ "integration/componentaction.h",
+ "integration/componentview.cpp",
+ "integration/componentview.h",
+ "integration/designdocumentcontroller.cpp",
+ "integration/designdocumentcontroller.h",
+ "integration/designdocumentcontrollerview.cpp",
+ "integration/designdocumentcontrollerview.h",
+ "integration/stackedutilitypanelcontroller.cpp",
+ "integration/stackedutilitypanelcontroller.h",
+ "integration/utilitypanelcontroller.cpp",
+ "integration/utilitypanelcontroller.h",
+ "integration/xuifiledialog.cpp",
+ "integration/xuifiledialog.h",
+ "itemlibrary/customdraganddrop.cpp",
+ "itemlibrary/customdraganddrop.h",
+ "itemlibrary/itemlibrary.qrc",
+ "itemlibrary/itemlibrarycomponents.cpp",
+ "itemlibrary/itemlibrarycomponents.h",
+ "itemlibrary/itemlibraryimageprovider.cpp",
+ "itemlibrary/itemlibraryimageprovider.h",
+ "itemlibrary/itemlibrarymodel.cpp",
+ "itemlibrary/itemlibrarymodel.h",
+ "itemlibrary/itemlibraryview.cpp",
+ "itemlibrary/itemlibraryview.h",
+ "itemlibrary/itemlibrarywidget.cpp",
+ "itemlibrary/itemlibrarywidget.h",
+ "itemlibrary/qml/ItemView.qml",
+ "itemlibrary/qml/ItemsView.qml",
+ "itemlibrary/qml/ItemsViewStyle.qml",
+ "itemlibrary/qml/Scrollbar.qml",
+ "itemlibrary/qml/SectionView.qml",
+ "itemlibrary/qml/Selector.qml",
+ "navigator/navigator.qrc",
+ "navigator/navigatortreemodel.cpp",
+ "navigator/navigatortreemodel.h",
+ "navigator/navigatortreeview.cpp",
+ "navigator/navigatortreeview.h",
+ "navigator/navigatorview.cpp",
+ "navigator/navigatorview.h",
+ "navigator/navigatorwidget.cpp",
+ "navigator/navigatorwidget.h",
+ "pluginmanager/iplugin.cpp",
+ "pluginmanager/iplugin.h",
+ "pluginmanager/pluginmanager.cpp",
+ "pluginmanager/pluginmanager.h",
+ "pluginmanager/pluginpath.cpp",
+ "pluginmanager/pluginpath.h",
+ "propertyeditor/basiclayouts.cpp",
+ "propertyeditor/basiclayouts.h",
+ "propertyeditor/basicwidgets.cpp",
+ "propertyeditor/basicwidgets.h",
+ "propertyeditor/behaviordialog.cpp",
+ "propertyeditor/behaviordialog.h",
+ "propertyeditor/behaviordialog.ui",
+ "propertyeditor/declarativewidgetview.cpp",
+ "propertyeditor/declarativewidgetview.h",
+ "propertyeditor/designerpropertymap.h",
+ "propertyeditor/filewidget.cpp",
+ "propertyeditor/filewidget.h",
+ "propertyeditor/fontwidget.cpp",
+ "propertyeditor/fontwidget.h",
+ "propertyeditor/gradientlineqmladaptor.cpp",
+ "propertyeditor/gradientlineqmladaptor.h",
+ "propertyeditor/layoutwidget.cpp",
+ "propertyeditor/layoutwidget.h",
+ "propertyeditor/originwidget.cpp",
+ "propertyeditor/originwidget.h",
+ "propertyeditor/propertyeditor.cpp",
+ "propertyeditor/propertyeditor.h",
+ "propertyeditor/propertyeditor.qrc",
+ "propertyeditor/propertyeditorcontextobject.cpp",
+ "propertyeditor/propertyeditorcontextobject.h",
+ "propertyeditor/propertyeditortransaction.cpp",
+ "propertyeditor/propertyeditortransaction.h",
+ "propertyeditor/propertyeditorvalue.cpp",
+ "propertyeditor/propertyeditorvalue.h",
+ "propertyeditor/qlayoutobject.cpp",
+ "propertyeditor/qlayoutobject.h",
+ "propertyeditor/qmlanchorbindingproxy.cpp",
+ "propertyeditor/qmlanchorbindingproxy.h",
+ "propertyeditor/qproxylayoutitem.cpp",
+ "propertyeditor/qproxylayoutitem.h",
+ "propertyeditor/resetwidget.cpp",
+ "propertyeditor/resetwidget.h",
+ "propertyeditor/siblingcombobox.cpp",
+ "propertyeditor/siblingcombobox.h",
+ "resources/resources.qrc",
+ "stateseditor/HorizontalScrollBar.qml",
+ "stateseditor/stateseditor.qrc",
+ "stateseditor/stateseditorimageprovider.cpp",
+ "stateseditor/stateseditorimageprovider.cpp",
+ "stateseditor/stateseditormodel.cpp",
+ "stateseditor/stateseditormodel.h",
+ "stateseditor/stateseditorview.cpp",
+ "stateseditor/stateseditorview.h",
+ "stateseditor/stateseditorwidget.cpp",
+ "stateseditor/stateseditorwidget.h",
+ "stateseditor/stateslist.qml",
+ ]
+ }
files: [
- "designercore/filemanager/qmlrewriter.h",
- "designercore/filemanager/qmlrefactoring.h",
- "designercore/filemanager/changeobjecttypevisitor.h",
- "designercore/filemanager/changepropertyvisitor.h",
- "designercore/filemanager/removeuiobjectmembervisitor.h",
- "designercore/filemanager/removepropertyvisitor.h",
- "designercore/filemanager/addpropertyvisitor.h",
- "designercore/filemanager/moveobjectvisitor.h",
- "designercore/filemanager/addobjectvisitor.h",
- "designercore/filemanager/addarraymembervisitor.h",
- "designercore/filemanager/astobjecttextextractor.h",
- "designercore/filemanager/objectlengthcalculator.h",
- "designercore/filemanager/firstdefinitionfinder.h",
- "designercore/filemanager/moveobjectbeforeobjectvisitor.h",
- "designercore/filemanager/changeimportsvisitor.h",
- "designercore/include/nodeinstance.h",
- "designercore/instances/nodeinstanceserverproxy.h",
- "../../../share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceclientinterface.h",
- "../../../share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.h",
- "../../../share/qtcreator/qml/qmlpuppet/interfaces/commondefines.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/synchronizecommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/tokencommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/componentcompletedcommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/completecomponentcommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/statepreviewimagechangedcommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/childrenchangedcommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/changebindingscommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/changefileurlcommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/changeidscommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/changenodesourcecommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/changestatecommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/changevaluescommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/createscenecommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/clearscenecommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/createinstancescommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/informationchangedcommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/pixmapchangedcommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/removeinstancescommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/removepropertiescommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/reparentinstancescommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/valueschangedcommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/commands/changeauxiliarycommand.h",
- "../../../share/qtcreator/qml/qmlpuppet/container/addimportcontainer.h",
- "../../../share/qtcreator/qml/qmlpuppet/container/imagecontainer.h",
- "../../../share/qtcreator/qml/qmlpuppet/container/idcontainer.h",
- "../../../share/qtcreator/qml/qmlpuppet/container/informationcontainer.h",
- "../../../share/qtcreator/qml/qmlpuppet/container/instancecontainer.h",
- "../../../share/qtcreator/qml/qmlpuppet/container/reparentcontainer.h",
- "../../../share/qtcreator/qml/qmlpuppet/container/propertyabstractcontainer.h",
- "../../../share/qtcreator/qml/qmlpuppet/container/propertybindingcontainer.h",
- "../../../share/qtcreator/qml/qmlpuppet/container/propertyvaluecontainer.h",
- "designercore/include/corelib_global.h",
- "designercore/include/abstractview.h",
- "designercore/include/nodeinstanceview.h",
- "designercore/include/rewriterview.h",
- "designercore/include/metainfo.h",
- "designercore/include/metainfoparser.h",
- "designercore/include/nodemetainfo.h",
- "designercore/include/itemlibraryinfo.h",
- "designercore/model/internalproperty.h",
- "designercore/include/modelnode.h",
- "designercore/include/model.h",
- "designercore/include/nodeproperty.h",
- "designercore/include/subcomponentmanager.h",
- "designercore/include/propertycontainer.h",
- "designercore/model/internalnode_p.h",
- "designercore/model/model_p.h",
- "designercore/model/painteventfilter_p.h",
- "designercore/include/propertyparser.h",
- "designercore/pluginmanager/widgetpluginmanager.h",
- "designercore/pluginmanager/widgetpluginpath.h",
- "designercore/include/exception.h",
- "designercore/include/invalidreparentingexception.h",
- "designercore/include/invalidmetainfoexception.h",
- "designercore/include/invalidargumentexception.h",
- "designercore/include/notimplementedexception.h",
- "designercore/include/invalidpropertyexception.h",
- "designercore/include/invalidmodelstateexception.h",
- "designercore/include/removebasestateexception.h",
- "designercore/include/invalididexception.h",
- "designercore/include/propertynode.h",
- "designercore/include/invalidslideindexexception.h",
- "designercore/include/import.h",
- "designercore/include/invalidqmlsourceexception.h",
- "designercore/model/viewlogger.h",
- "designercore/model/internalvariantproperty.h",
- "designercore/model/internalnodelistproperty.h",
- "designercore/include/variantproperty.h",
- "designercore/include/nodelistproperty.h",
- "designercore/include/abstractproperty.h",
- "designercore/model/internalbindingproperty.h",
- "designercore/include/bindingproperty.h",
- "designercore/model/internalnodeproperty.h",
- "designercore/model/internalnodeabstractproperty.h",
- "designercore/include/nodeabstractproperty.h",
- "designercore/include/plaintexteditmodifier.h",
- "designercore/include/basetexteditmodifier.h",
- "designercore/include/componenttextmodifier.h",
- "designercore/include/textmodifier.h",
- "designercore/model/modeltotextmerger.h",
- "designercore/model/texttomodelmerger.h",
- "designercore/include/qmlmodelview.h",
- "designercore/include/qmlitemnode.h",
- "designercore/include/qmlstate.h",
- "designercore/include/qmlchangeset.h",
- "designercore/include/qmlmodelnodefacade.h",
- "designercore/include/forwardview.h",
- "designercore/include/qmlobjectnode.h",
- "designercore/include/qmlanchors.h",
- "designercore/rewritertransaction.h",
- "designercore/model/rewriteaction.h",
- "designercore/include/modelnodepositionstorage.h",
- "designercore/model/modelnodepositionrecalculator.h",
- "designercore/model/rewriteactioncompressor.h",
- "designercore/model/qmltextgenerator.h",
- "designercore/include/modelmerger.h",
- "designercore/include/mathutils.h",
- "designercore/include/customnotifications.h",
- "designercore/include/rewritingexception.h",
- "designercore/model/modelnodecontextmenu.h",
- "designercore/include/basetexteditmodifier.h",
- "components/integration/integrationcore.h",
- "components/integration/designdocumentcontrollerview.h",
- "components/integration/designdocumentcontroller.h",
- "components/integration/utilitypanelcontroller.h",
- "components/integration/stackedutilitypanelcontroller.h",
- "components/integration/componentaction.h",
- "components/integration/componentview.h",
- "components/integration/xuifiledialog.h",
- "components/integration/integrationcore.cpp",
- "components/integration/designdocumentcontroller.cpp",
- "components/integration/designdocumentcontrollerview.cpp",
- "components/integration/utilitypanelcontroller.cpp",
- "components/integration/stackedutilitypanelcontroller.cpp",
- "components/integration/componentaction.cpp",
- "components/integration/componentview.cpp",
- "components/integration/xuifiledialog.cpp",
- "components/propertyeditor/propertyeditor.h",
- "components/propertyeditor/qmlanchorbindingproxy.h",
- "components/propertyeditor/resetwidget.h",
- "components/propertyeditor/qlayoutobject.h",
- "components/propertyeditor/basiclayouts.h",
- "components/propertyeditor/basicwidgets.h",
- "components/propertyeditor/behaviordialog.h",
- "components/propertyeditor/qproxylayoutitem.h",
- "components/propertyeditor/layoutwidget.h",
- "components/propertyeditor/filewidget.h",
- "components/propertyeditor/propertyeditorvalue.h",
- "components/propertyeditor/fontwidget.h",
- "components/propertyeditor/originwidget.h",
- "components/propertyeditor/siblingcombobox.h",
- "components/propertyeditor/propertyeditortransaction.h",
- "components/propertyeditor/designerpropertymap.h",
- "components/propertyeditor/propertyeditorcontextobject.h",
- "components/propertyeditor/declarativewidgetview.h",
- "components/propertyeditor/gradientlineqmladaptor.h",
- "components/propertyeditor/propertyeditor.cpp",
- "components/propertyeditor/qmlanchorbindingproxy.cpp",
- "components/propertyeditor/resetwidget.cpp",
- "components/propertyeditor/qlayoutobject.cpp",
- "components/propertyeditor/basiclayouts.cpp",
- "components/propertyeditor/basicwidgets.cpp",
- "components/propertyeditor/behaviordialog.cpp",
- "components/propertyeditor/qproxylayoutitem.cpp",
- "components/propertyeditor/layoutwidget.cpp",
- "components/propertyeditor/filewidget.cpp",
- "components/propertyeditor/propertyeditorvalue.cpp",
- "components/propertyeditor/fontwidget.cpp",
- "components/propertyeditor/originwidget.cpp",
- "components/propertyeditor/siblingcombobox.cpp",
- "components/propertyeditor/propertyeditortransaction.cpp",
- "components/propertyeditor/propertyeditorcontextobject.cpp",
- "components/propertyeditor/declarativewidgetview.cpp",
- "components/propertyeditor/gradientlineqmladaptor.cpp",
- "components/propertyeditor/propertyeditor.qrc",
- "components/formeditor/formeditorscene.h",
- "components/formeditor/formeditorwidget.h",
- "components/formeditor/formeditoritem.h",
- "components/formeditor/formeditorview.h",
- "components/formeditor/selectiontool.h",
- "components/formeditor/abstractformeditortool.h",
- "components/formeditor/controlelement.h",
- "components/formeditor/resizemanipulator.h",
- "components/formeditor/movemanipulator.h",
- "components/formeditor/layeritem.h",
- "components/formeditor/itemutilfunctions.h",
- "components/formeditor/selectionrectangle.h",
- "components/formeditor/rubberbandselectionmanipulator.h",
- "components/formeditor/movetool.h",
- "components/formeditor/selectionindicator.h",
- "components/formeditor/snappinglinecreator.h",
- "components/formeditor/snapper.h",
- "components/formeditor/onedimensionalcluster.h",
- "components/formeditor/singleselectionmanipulator.h",
- "components/formeditor/scalemanipulator.h",
- "components/formeditor/resizetool.h",
- "components/formeditor/resizeindicator.h",
- "components/formeditor/scaleitem.h",
- "components/formeditor/resizecontroller.h",
- "components/formeditor/resizehandleitem.h",
- "components/formeditor/dragtool.h",
- "components/formeditor/toolbox.h",
- "components/formeditor/zoomaction.h",
- "components/formeditor/formeditorgraphicsview.h",
- "components/formeditor/numberseriesaction.h",
- "components/formeditor/lineeditaction.h",
- "components/formeditor/formeditoritem.cpp",
- "components/formeditor/formeditorview.cpp",
- "components/formeditor/formeditorscene.cpp",
- "components/formeditor/formeditorwidget.cpp",
- "components/formeditor/selectiontool.cpp",
- "components/formeditor/abstractformeditortool.cpp",
- "components/formeditor/controlelement.cpp",
- "components/formeditor/resizemanipulator.cpp",
- "components/formeditor/movemanipulator.cpp",
- "components/formeditor/layeritem.cpp",
- "components/formeditor/itemutilfunctions.cpp",
- "components/formeditor/selectionrectangle.cpp",
- "components/formeditor/rubberbandselectionmanipulator.cpp",
- "components/formeditor/movetool.cpp",
- "components/formeditor/selectionindicator.cpp",
- "components/formeditor/snappinglinecreator.cpp",
- "components/formeditor/snapper.cpp",
- "components/formeditor/onedimensionalcluster.cpp",
- "components/formeditor/singleselectionmanipulator.cpp",
- "components/formeditor/scalemanipulator.cpp",
- "components/formeditor/resizetool.cpp",
- "components/formeditor/resizeindicator.cpp",
- "components/formeditor/scaleitem.cpp",
- "components/formeditor/resizecontroller.cpp",
- "components/formeditor/resizehandleitem.cpp",
- "components/formeditor/dragtool.cpp",
- "components/formeditor/toolbox.cpp",
- "components/formeditor/zoomaction.cpp",
- "components/formeditor/formeditorgraphicsview.cpp",
- "components/formeditor/numberseriesaction.cpp",
- "components/formeditor/lineeditaction.cpp",
- "components/formeditor/formeditor.qrc",
- "qmldesignerconstants.h",
- "qmldesignerplugin.h",
- "designmodewidget.h",
+ "designersettings.cpp",
"designersettings.h",
- "settingspage.h",
+ "designmodecontext.cpp",
"designmodecontext.h",
- "styledoutputpaneplaceholder.h",
- "designercore/filemanager/qmlrewriter.cpp",
- "designercore/filemanager/qmlrefactoring.cpp",
- "designercore/filemanager/changeobjecttypevisitor.cpp",
- "designercore/filemanager/changepropertyvisitor.cpp",
- "designercore/filemanager/removeuiobjectmembervisitor.cpp",
- "designercore/filemanager/removepropertyvisitor.cpp",
- "designercore/filemanager/addpropertyvisitor.cpp",
- "designercore/filemanager/moveobjectvisitor.cpp",
- "designercore/filemanager/addobjectvisitor.cpp",
- "designercore/filemanager/addarraymembervisitor.cpp",
- "designercore/filemanager/astobjecttextextractor.cpp",
- "designercore/filemanager/objectlengthcalculator.cpp",
- "designercore/filemanager/firstdefinitionfinder.cpp",
- "designercore/filemanager/moveobjectbeforeobjectvisitor.cpp",
- "designercore/filemanager/changeimportsvisitor.cpp",
- "designercore/instances/nodeinstanceserverproxy.cpp",
- "designercore/instances/nodeinstance.cpp",
- "designercore/instances/nodeinstanceview.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/synchronizecommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/tokencommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/componentcompletedcommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/completecomponentcommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/statepreviewimagechangedcommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/childrenchangedcommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/changebindingscommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/changefileurlcommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/changeidscommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/changenodesourcecommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/changestatecommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/changevaluescommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/informationchangedcommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/removeinstancescommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/removepropertiescommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/reparentinstancescommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/valueschangedcommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/clearscenecommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/createinstancescommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/createscenecommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/pixmapchangedcommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/commands/changeauxiliarycommand.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/container/addimportcontainer.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/container/imagecontainer.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/container/idcontainer.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/container/informationcontainer.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/container/instancecontainer.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/container/reparentcontainer.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/container/propertyabstractcontainer.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/container/propertybindingcontainer.cpp",
- "../../../share/qtcreator/qml/qmlpuppet/container/propertyvaluecontainer.cpp",
- "designercore/model/abstractview.cpp",
- "designercore/model/rewriterview.cpp",
- "designercore/metainfo/metainfo.cpp",
- "designercore/metainfo/metainfoparser.cpp",
- "designercore/metainfo/nodemetainfo.cpp",
- "designercore/metainfo/itemlibraryinfo.cpp",
- "designercore/metainfo/subcomponentmanager.cpp",
- "designercore/model/internalproperty.cpp",
- "designercore/model/model.cpp",
- "designercore/model/modelnode.cpp",
- "designercore/model/painteventfilter.cpp",
- "designercore/model/internalnode.cpp",
- "designercore/model/propertyparser.cpp",
- "designercore/model/propertycontainer.cpp",
- "designercore/pluginmanager/widgetpluginmanager.cpp",
- "designercore/pluginmanager/widgetpluginpath.cpp",
- "designercore/exceptions/exception.cpp",
- "designercore/exceptions/invalidpropertyexception.cpp",
- "designercore/exceptions/invalidmodelnodeexception.cpp",
- "designercore/exceptions/invalidreparentingexception.cpp",
- "designercore/exceptions/invalidmetainfoexception.cpp",
- "designercore/exceptions/invalidargumentexception.cpp",
- "designercore/exceptions/notimplementedexception.cpp",
- "designercore/exceptions/invalidmodelstateexception.cpp",
- "designercore/exceptions/removebasestateexception.cpp",
- "designercore/exceptions/invalididexception.cpp",
- "designercore/model/propertynode.cpp",
- "designercore/exceptions/invalidslideindexexception.cpp",
- "designercore/model/import.cpp",
- "designercore/exceptions/invalidqmlsourceexception.cpp",
- "designercore/model/viewlogger.cpp",
- "designercore/model/internalvariantproperty.cpp",
- "designercore/model/internalnodelistproperty.cpp",
- "designercore/model/variantproperty.cpp",
- "designercore/model/nodelistproperty.cpp",
- "designercore/model/abstractproperty.cpp",
- "designercore/model/internalbindingproperty.cpp",
- "designercore/model/bindingproperty.cpp",
- "designercore/model/internalnodeproperty.cpp",
- "designercore/model/internalnodeabstractproperty.cpp",
- "designercore/model/nodeabstractproperty.cpp",
- "designercore/model/nodeproperty.cpp",
- "designercore/model/modeltotextmerger.cpp",
- "designercore/model/texttomodelmerger.cpp",
- "designercore/model/plaintexteditmodifier.cpp",
- "designercore/model/componenttextmodifier.cpp",
- "designercore/model/textmodifier.cpp",
- "designercore/model/qmlmodelview.cpp",
- "designercore/model/qmlitemnode.cpp",
- "designercore/model/qmlstate.cpp",
- "designercore/model/qmlchangeset.cpp",
- "designercore/model/qmlmodelnodefacade.cpp",
- "designercore/model/qmlobjectnode.cpp",
- "designercore/model/qmlanchors.cpp",
- "designercore/rewritertransaction.cpp",
- "designercore/model/rewriteaction.cpp",
- "designercore/model/modelnodepositionstorage.cpp",
- "designercore/model/modelnodepositionrecalculator.cpp",
- "designercore/model/rewriteactioncompressor.cpp",
- "designercore/model/qmltextgenerator.cpp",
- "designercore/model/modelmerger.cpp",
- "designercore/exceptions/rewritingexception.cpp",
- "designercore/model/modelnodecontextmenu.cpp",
- "designercore/model/basetexteditmodifier.cpp",
- "components/propertyeditor/behaviordialog.ui",
- "components/itemlibrary/itemlibraryview.cpp",
- "components/itemlibrary/itemlibrarywidget.cpp",
- "components/itemlibrary/customdraganddrop.cpp",
- "components/itemlibrary/itemlibrarymodel.cpp",
- "components/itemlibrary/itemlibrarycomponents.cpp",
- "components/itemlibrary/itemlibraryimageprovider.cpp",
- "components/itemlibrary/itemlibraryview.h",
- "components/itemlibrary/itemlibrarywidget.h",
- "components/itemlibrary/customdraganddrop.h",
- "components/itemlibrary/itemlibrarymodel.h",
- "components/itemlibrary/itemlibrarycomponents.h",
- "components/itemlibrary/itemlibraryimageprovider.h",
- "components/itemlibrary/itemlibrary.qrc",
- "components/navigator/navigatorview.h",
- "components/navigator/navigatortreemodel.h",
- "components/navigator/navigatorwidget.h",
- "components/navigator/navigatortreeview.h",
- "components/navigator/navigatorview.cpp",
- "components/navigator/navigatortreemodel.cpp",
- "components/navigator/navigatorwidget.cpp",
- "components/navigator/navigatortreeview.cpp",
- "components/navigator/navigator.qrc",
- "components/pluginmanager/pluginmanager.cpp",
- "components/pluginmanager/pluginpath.cpp",
- "components/pluginmanager/iplugin.cpp",
- "components/pluginmanager/pluginmanager.h",
- "components/pluginmanager/pluginpath.h",
- "components/pluginmanager/iplugin.h",
- "components/stateseditor/stateseditorwidget.h",
- "components/stateseditor/stateseditormodel.h",
- "components/stateseditor/stateseditorview.h",
- "components/stateseditor/stateseditorimageprovider.cpp",
- "components/stateseditor/stateseditorwidget.cpp",
- "components/stateseditor/stateseditormodel.cpp",
- "components/stateseditor/stateseditorview.cpp",
- "components/stateseditor/stateseditorimageprovider.cpp",
- "components/stateseditor/stateseditor.qrc",
- "components/stateseditor/stateslist.qml",
- "components/stateseditor/HorizontalScrollBar.qml",
- "qmldesignerplugin.cpp",
"designmodewidget.cpp",
- "designersettings.cpp",
+ "designmodewidget.h",
+ "qmldesignerconstants.h",
+ "qmldesignerplugin.cpp",
+ "qmldesignerplugin.h",
"settingspage.cpp",
- "designmodecontext.cpp",
- "styledoutputpaneplaceholder.cpp",
+ "settingspage.h",
"settingspage.ui",
- "components/resources/resources.qrc",
- "components/itemlibrary/qml/Selector.qml",
- "components/itemlibrary/qml/SectionView.qml",
- "components/itemlibrary/qml/Scrollbar.qml",
- "components/itemlibrary/qml/ItemView.qml",
- "components/itemlibrary/qml/ItemsViewStyle.qml",
- "components/itemlibrary/qml/ItemsView.qml"
+ "styledoutputpaneplaceholder.cpp",
+ "styledoutputpaneplaceholder.h",
]
}
-
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp
index 0da7a35312..cf592faf1e 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.cpp
+++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp
@@ -54,10 +54,9 @@
#include <extensionsystem/pluginmanager.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
-#include <integrationcore.h>
-
#include <QAction>
#include <QFileInfo>
@@ -78,7 +77,6 @@ bool shouldAssertInException()
}
BauhausPlugin::BauhausPlugin() :
- m_designerCore(0),
m_designMode(0),
m_isActive(false),
m_revertToSavedAction(new QAction(this)),
@@ -105,7 +103,6 @@ BauhausPlugin::BauhausPlugin() :
BauhausPlugin::~BauhausPlugin()
{
- delete m_designerCore;
Core::ICore::removeContextObject(m_context);
}
@@ -124,17 +121,13 @@ bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *error
switchAction, QmlDesigner::Constants::SWITCH_TEXT_DESIGN, switchContext);
command->setDefaultKeySequence(QKeySequence(Qt::Key_F4));
- m_designerCore = new QmlDesigner::IntegrationCore;
m_pluginInstance = this;
-#ifdef Q_OS_MAC
- const QString pluginPath = QCoreApplication::applicationDirPath() + "/../PlugIns/QmlDesigner";
-#else
- const QString pluginPath = QCoreApplication::applicationDirPath() + "/../"
- + QLatin1String(IDE_LIBRARY_BASENAME) + "/qtcreator/qmldesigner";
-#endif
-
- m_designerCore->pluginManager()->setPluginPaths(QStringList() << pluginPath);
+ const QString pluginPath = Utils::HostOsInfo::isMacHost()
+ ? QString(QCoreApplication::applicationDirPath() + "/../PlugIns/QmlDesigner")
+ : QString(QCoreApplication::applicationDirPath() + "/../"
+ + QLatin1String(IDE_LIBRARY_BASENAME) + "/qtcreator/qmldesigner");
+ m_pluginManager.setPluginPaths(QStringList() << pluginPath);
createDesignModeWidget();
connect(switchAction, SIGNAL(triggered()), this, SLOT(switchTextDesign()));
@@ -259,15 +252,14 @@ void BauhausPlugin::createDesignModeWidget()
command = Core::ActionManager::registerAction(m_mainWidget->hideSidebarsAction(),
Core::Constants::TOGGLE_SIDEBAR, qmlDesignerMainContext);
-#ifdef Q_OS_MACX
- // add second shortcut to trigger delete
- QAction *deleteAction = new QAction(m_mainWidget);
- deleteAction->setShortcut(QKeySequence(QLatin1String("Backspace")));
- connect(deleteAction, SIGNAL(triggered()), m_mainWidget->deleteAction(),
- SIGNAL(triggered()));
-
- m_mainWidget->addAction(deleteAction);
-#endif // Q_OS_MACX
+ if (Utils::HostOsInfo::isMacHost()) {
+ // add second shortcut to trigger delete
+ QAction *deleteAction = new QAction(m_mainWidget);
+ deleteAction->setShortcut(QKeySequence(QLatin1String("Backspace")));
+ connect(deleteAction, SIGNAL(triggered()), m_mainWidget->deleteAction(),
+ SIGNAL(triggered()));
+ m_mainWidget->addAction(deleteAction);
+ }
connect(m_editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(updateEditor(Core::IEditor*)));
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.h b/src/plugins/qmldesigner/qmldesignerplugin.h
index 7464d42cc6..dd7ca6f52d 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.h
+++ b/src/plugins/qmldesigner/qmldesignerplugin.h
@@ -34,6 +34,8 @@
#include <extensionsystem/iplugin.h>
+#include <pluginmanager.h>
+
#include <QWeakPointer>
#include <QStringList>
@@ -50,10 +52,6 @@ namespace Core {
}
namespace QmlDesigner {
- class IntegrationCore;
-}
-
-namespace QmlDesigner {
namespace Internal {
class DesignModeWidget;
@@ -91,7 +89,7 @@ private:
QStringList m_mimeTypes;
DesignModeWidget *m_mainWidget;
- QmlDesigner::IntegrationCore *m_designerCore;
+ QmlDesigner::PluginManager m_pluginManager;
static BauhausPlugin *m_pluginInstance;
DesignerSettings m_settings;
DesignModeContext *m_context;
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.pri b/src/plugins/qmldesigner/qmldesignerplugin.pri
new file mode 100644
index 0000000000..efe34c0bff
--- /dev/null
+++ b/src/plugins/qmldesigner/qmldesignerplugin.pri
@@ -0,0 +1,16 @@
+HEADERS += $$PWD/qmldesignerconstants.h \
+ $$PWD/qmldesignerplugin.h \
+ $$PWD/designmodewidget.h \
+ $$PWD/designersettings.h \
+ $$PWD/settingspage.h \
+ $$PWD/designmodecontext.h \
+ $$PWD/styledoutputpaneplaceholder.h
+
+SOURCES += $$PWD/qmldesignerplugin.cpp \
+ $$PWD/designmodewidget.cpp \
+ $$PWD/designersettings.cpp \
+ $$PWD/settingspage.cpp \
+ $$PWD/designmodecontext.cpp \
+ $$PWD/styledoutputpaneplaceholder.cpp
+
+FORMS += $$PWD/settingspage.ui
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.pro b/src/plugins/qmldesigner/qmldesignerplugin.pro
index d042701c19..dee55d0678 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.pro
+++ b/src/plugins/qmldesigner/qmldesignerplugin.pro
@@ -10,6 +10,7 @@ include(../../private_headers.pri)
include(qmldesigner_dependencies.pri)
include(designercore/designercore.pri)
+include(components/componentcore/componentcore.pri)
include(components/integration/integration.pri)
include(components/propertyeditor/propertyeditor.pri)
include(components/formeditor/formeditor.pri)
@@ -18,20 +19,4 @@ include(components/navigator/navigator.pri)
include(components/pluginmanager/pluginmanager.pri)
include(components/stateseditor/stateseditor.pri)
include(components/resources/resources.pri)
-
-HEADERS += qmldesignerconstants.h \
- qmldesignerplugin.h \
- designmodewidget.h \
- designersettings.h \
- settingspage.h \
- designmodecontext.h \
- styledoutputpaneplaceholder.h
-
-SOURCES += qmldesignerplugin.cpp \
- designmodewidget.cpp \
- designersettings.cpp \
- settingspage.cpp \
- designmodecontext.cpp \
- styledoutputpaneplaceholder.cpp
-
-FORMS += settingspage.ui
+include(qmldesignerplugin.pri)
diff --git a/src/plugins/qmljseditor/qmljseditor.qbs b/src/plugins/qmljseditor/qmljseditor.qbs
index b78578ca99..9e81ca3ca3 100644
--- a/src/plugins/qmljseditor/qmljseditor.qbs
+++ b/src/plugins/qmljseditor/qmljseditor.qbs
@@ -18,16 +18,8 @@ QtcPlugin {
Depends { name: "cpp" }
cpp.defines: base.concat(["QT_CREATOR"])
- cpp.includePaths: [
- ".",
- "..",
- "../../libs",
- buildDirectory
- ]
files: [
- "qmljseditor.qrc",
- "quicktoolbarsettingspage.ui",
"QmlJSEditor.mimetypes.xml",
"jsfilewizard.cpp",
"jsfilewizard.h",
@@ -46,6 +38,7 @@ QtcPlugin {
"qmljscomponentnamedialog.ui",
"qmljseditor.cpp",
"qmljseditor.h",
+ "qmljseditor.qrc",
"qmljseditor_global.h",
"qmljseditoractionhandler.cpp",
"qmljseditoractionhandler.h",
@@ -82,6 +75,7 @@ QtcPlugin {
"qmljssnippetprovider.cpp",
"qmljssnippetprovider.h",
"qmljswrapinloader.cpp",
+ "qmljswrapinloader.h",
"qmloutlinemodel.cpp",
"qmloutlinemodel.h",
"qmltaskmanager.cpp",
@@ -90,12 +84,11 @@ QtcPlugin {
"quicktoolbar.h",
"quicktoolbarsettingspage.cpp",
"quicktoolbarsettingspage.h",
- "qmljswrapinloader.h",
- "images/qmlfile.png"
+ "quicktoolbarsettingspage.ui",
+ "images/qmlfile.png",
]
ProductModule {
Depends { name: "QmlJSTools" }
}
}
-
diff --git a/src/plugins/qmljseditor/qmljspreviewrunner.cpp b/src/plugins/qmljseditor/qmljspreviewrunner.cpp
index 5fb75a77ef..07e2a044f3 100644
--- a/src/plugins/qmljseditor/qmljspreviewrunner.cpp
+++ b/src/plugins/qmljseditor/qmljspreviewrunner.cpp
@@ -30,6 +30,7 @@
#include "qmljspreviewrunner.h"
#include <utils/environment.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcprocess.h>
#include <utils/synchronousprocess.h>
@@ -46,7 +47,7 @@ QmlJSPreviewRunner::QmlJSPreviewRunner(QObject *parent) :
{
// prepend creator/bin dir to search path (only useful for special creator-qml package)
const QString searchPath = QCoreApplication::applicationDirPath()
- + Utils::SynchronousProcess::pathSeparator()
+ + Utils::HostOsInfo::pathListSeparator()
+ QString(qgetenv("PATH"));
m_qmlViewerDefaultPath = Utils::SynchronousProcess::locateBinary(searchPath, QLatin1String("qmlviewer"));
diff --git a/src/plugins/qmljseditor/quicktoolbar.cpp b/src/plugins/qmljseditor/quicktoolbar.cpp
index 028587c7db..79a5323221 100644
--- a/src/plugins/qmljseditor/quicktoolbar.cpp
+++ b/src/plugins/qmljseditor/quicktoolbar.cpp
@@ -28,10 +28,11 @@
****************************************************************************/
#include "quicktoolbar.h"
-#include <contextpanewidget.h>
-#include <quicktoolbarsettingspage.h>
+#include "quicktoolbarsettingspage.h"
#include <utils/changeset.h>
+#include <qmleditorwidgets/contextpanewidget.h>
+#include <qmleditorwidgets/customcolordialog.h>
#include <qmljs/parser/qmljsast_p.h>
#include <qmljs/qmljsdocument.h>
#include <qmljs/qmljspropertyreader.h>
@@ -45,7 +46,6 @@
#include <texteditor/basetexteditor.h>
#include <texteditor/tabsettings.h>
#include <coreplugin/icore.h>
-#include <customcolordialog.h>
#include <QDebug>
@@ -122,7 +122,7 @@ QuickToolBar::~QuickToolBar()
//if the pane was never activated the widget is not in a widget tree
if (!m_widget.isNull())
delete m_widget.data();
- m_widget.clear();
+ m_widget = 0;
}
void QuickToolBar::apply(TextEditor::BaseTextEditor *editor, Document::Ptr document, const ScopeChain *scopeChain, AST::Node *node, bool update, bool force)
@@ -213,7 +213,7 @@ void QuickToolBar::apply(TextEditor::BaseTextEditor *editor, Document::Ptr docum
rect.setHeight(widget()->height() + 10);
rect.setWidth(reg.boundingRect().width() - reg.boundingRect().left());
rect.moveTo(reg.boundingRect().topLeft());
- reg = reg.intersect(rect);
+ reg = reg.intersected(rect);
if (contextWidget()->acceptsType(m_prototypes)) {
m_node = 0;
diff --git a/src/plugins/qmljseditor/quicktoolbar.h b/src/plugins/qmljseditor/quicktoolbar.h
index 76d4bb58c7..acd6e7ab45 100644
--- a/src/plugins/qmljseditor/quicktoolbar.h
+++ b/src/plugins/qmljseditor/quicktoolbar.h
@@ -32,6 +32,8 @@
#include <qmljs/qmljsicontextpane.h>
+#include <QPointer>
+
namespace TextEditor {
class BaseTextEditor;
}
@@ -65,7 +67,7 @@ public slots:
private:
QmlEditorWidgets::ContextPaneWidget* contextWidget();
- QWeakPointer<QmlEditorWidgets::ContextPaneWidget> m_widget;
+ QPointer<QmlEditorWidgets::ContextPaneWidget> m_widget;
QmlJS::Document::Ptr m_doc;
QmlJS::AST::Node *m_node;
TextEditor::BaseTextEditor *m_editor;
diff --git a/src/plugins/debugger/images/collapse.png b/src/plugins/qmljstools/images/collapse.png
index 64ae3720c1..64ae3720c1 100644
--- a/src/plugins/debugger/images/collapse.png
+++ b/src/plugins/qmljstools/images/collapse.png
Binary files differ
diff --git a/src/plugins/debugger/images/error.png b/src/plugins/qmljstools/images/error.png
index 39768b9f39..39768b9f39 100644
--- a/src/plugins/debugger/images/error.png
+++ b/src/plugins/qmljstools/images/error.png
Binary files differ
diff --git a/src/plugins/debugger/images/expand.png b/src/plugins/qmljstools/images/expand.png
index 7959bfc97e..7959bfc97e 100644
--- a/src/plugins/debugger/images/expand.png
+++ b/src/plugins/qmljstools/images/expand.png
Binary files differ
diff --git a/src/plugins/debugger/images/log.png b/src/plugins/qmljstools/images/log.png
index e4766f228b..e4766f228b 100644
--- a/src/plugins/debugger/images/log.png
+++ b/src/plugins/qmljstools/images/log.png
Binary files differ
diff --git a/src/plugins/debugger/images/prompt.png b/src/plugins/qmljstools/images/prompt.png
index a333a87198..a333a87198 100644
--- a/src/plugins/debugger/images/prompt.png
+++ b/src/plugins/qmljstools/images/prompt.png
Binary files differ
diff --git a/src/plugins/debugger/images/warning.png b/src/plugins/qmljstools/images/warning.png
index 3200efc4fd..3200efc4fd 100644
--- a/src/plugins/debugger/images/warning.png
+++ b/src/plugins/qmljstools/images/warning.png
Binary files differ
diff --git a/src/plugins/debugger/qtmessagelogeditor.cpp b/src/plugins/qmljstools/qmlconsoleedit.cpp
index 07043259e4..be4d99c82b 100644
--- a/src/plugins/debugger/qtmessagelogeditor.cpp
+++ b/src/plugins/qmljstools/qmlconsoleedit.cpp
@@ -27,11 +27,9 @@
**
****************************************************************************/
-#include "qtmessagelogeditor.h"
-#include "qtmessageloghandler.h"
-#include "debuggerstringutils.h"
-#include "debuggercore.h"
-#include "debuggerengine.h"
+#include "qmlconsoleedit.h"
+#include "qmlconsoleitemmodel.h"
+#include "qmlconsolemanager.h"
#include <utils/qtcassert.h>
@@ -39,54 +37,56 @@
#include <QMenu>
#include <QKeyEvent>
-namespace Debugger {
+namespace QmlJSTools {
namespace Internal {
///////////////////////////////////////////////////////////////////////
//
-// QtMessageLogEditor
+// QmlConsoleEdit
//
///////////////////////////////////////////////////////////////////////
-QtMessageLogEditor::QtMessageLogEditor(const QModelIndex &index,
- QWidget *parent) :
+QmlConsoleEdit::QmlConsoleEdit(const QModelIndex &index, QWidget *parent) :
QTextEdit(parent),
m_historyIndex(index),
- m_prompt(_(":/debugger/images/prompt.png")),
+ m_prompt(QLatin1String(":/qmljstools/images/prompt.png")),
m_startOfEditableArea(0)
{
setFrameStyle(QFrame::NoFrame);
setUndoRedoEnabled(false);
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
- document()->addResource(QTextDocument::ImageResource,
- QUrl(_("prompt")), m_prompt);
+ document()->addResource(QTextDocument::ImageResource, QUrl(QLatin1String("prompt")), m_prompt);
QTextImageFormat format;
- format.setName(_("prompt"));
+ format.setName(QLatin1String("prompt"));
format.setHeight(9);
format.setWidth(9);
- textCursor().insertText(_(" "));
+ textCursor().insertText(QLatin1String(" "));
textCursor().insertImage(format);
- textCursor().insertText(_(" "));
+ textCursor().insertText(QLatin1String(" "));
m_startOfEditableArea = textCursor().position();
ensureCursorVisible();
setTextInteractionFlags(Qt::TextEditorInteraction);
}
-void QtMessageLogEditor::keyPressEvent(QKeyEvent *e)
+void QmlConsoleEdit::keyPressEvent(QKeyEvent *e)
{
bool keyConsumed = false;
switch (e->key()) {
case Qt::Key_Return:
case Qt::Key_Enter: {
- keyConsumed = debuggerCore()->evaluateScriptExpression(getCurrentScript());
- if (keyConsumed) {
+ m_interpreter.clearText();
+ QString currentScript = getCurrentScript();
+ m_interpreter.appendText(currentScript);
+ if (currentScript.isEmpty()) {
+ emit editingFinished();
+ } else if (m_interpreter.canEvaluate()) {
+ QmlConsoleModel::evaluate(currentScript);
emit editingFinished();
- debuggerCore()->currentEngine()->qtMessageLogHandler()->appendEditableRow();
}
- }
break;
+ }
case Qt::Key_Backspace:
if (textCursor().selectionStart() <= m_startOfEditableArea)
@@ -98,14 +98,13 @@ void QtMessageLogEditor::keyPressEvent(QKeyEvent *e)
keyConsumed = true;
break;
- case Qt::Key_Home:
- {
+ case Qt::Key_Home: {
QTextCursor c(textCursor());
c.setPosition(m_startOfEditableArea);
setTextCursor(c);
keyConsumed = true;
- }
break;
+ }
case Qt::Key_Up:
handleUpKey();
@@ -160,10 +159,9 @@ void QtMessageLogEditor::keyPressEvent(QKeyEvent *e)
QTextEdit::keyPressEvent(e);
}
-void QtMessageLogEditor::contextMenuEvent(QContextMenuEvent *event)
+void QmlConsoleEdit::contextMenuEvent(QContextMenuEvent *event)
{
- //TODO:: on right click the editor closes
- //FIXIT
+ // TODO:: on right click the editor closes
return QTextEdit::contextMenuEvent(event);
QTextCursor cursor = textCursor();
@@ -192,12 +190,12 @@ void QtMessageLogEditor::contextMenuEvent(QContextMenuEvent *event)
delete menu;
}
-void QtMessageLogEditor::focusOutEvent(QFocusEvent * /*e*/)
+void QmlConsoleEdit::focusOutEvent(QFocusEvent * /*e*/)
{
emit editingFinished();
}
-void QtMessageLogEditor::handleUpKey()
+void QmlConsoleEdit::handleUpKey()
{
QTC_ASSERT(m_historyIndex.isValid(), return);
int currentRow = m_historyIndex.row();
@@ -209,19 +207,17 @@ void QtMessageLogEditor::handleUpKey()
currentRow--;
if (model->hasIndex(currentRow, 0)) {
QModelIndex index = model->index(currentRow, 0);
- if (QtMessageLogHandler::InputType == (QtMessageLogHandler::ItemType)model->data(
- index, QtMessageLogHandler::TypeRole).toInt()) {
+ if (QmlConsoleItem::InputType == (QmlConsoleItem::ItemType)model->data(
+ index, QmlConsoleItemModel::TypeRole).toInt()) {
m_historyIndex = index;
- replaceCurrentScript(model->data(
- index, Qt::DisplayRole).
- toString());
+ replaceCurrentScript(model->data(index, Qt::DisplayRole).toString());
break;
}
}
}
}
-void QtMessageLogEditor::handleDownKey()
+void QmlConsoleEdit::handleDownKey()
{
QTC_ASSERT(m_historyIndex.isValid(), return);
int currentRow = m_historyIndex.row();
@@ -230,32 +226,29 @@ void QtMessageLogEditor::handleDownKey()
currentRow++;
if (model->hasIndex(currentRow, 0)) {
QModelIndex index = model->index(currentRow, 0);
- if (QtMessageLogHandler::InputType == (QtMessageLogHandler::ItemType)model->data(
- index, QtMessageLogHandler::TypeRole).toInt()) {
+ if (QmlConsoleItem::InputType == (QmlConsoleItem::ItemType)model->data(
+ index, QmlConsoleItemModel::TypeRole).toInt()) {
m_historyIndex = index;
if (currentRow == model->rowCount() - 1)
replaceCurrentScript(m_cachedScript);
else
- replaceCurrentScript(model->data(
- index, Qt::DisplayRole).
- toString());
+ replaceCurrentScript(model->data(index, Qt::DisplayRole).toString());
break;
}
}
}
}
-QString QtMessageLogEditor::getCurrentScript() const
+QString QmlConsoleEdit::getCurrentScript() const
{
QTextCursor cursor = textCursor();
cursor.setPosition(m_startOfEditableArea);
cursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
QString script = cursor.selectedText();
- //remove WS
return script.trimmed();
}
-void QtMessageLogEditor::replaceCurrentScript(const QString &script)
+void QmlConsoleEdit::replaceCurrentScript(const QString &script)
{
QTextCursor cursor = textCursor();
cursor.setPosition(m_startOfEditableArea);
@@ -265,5 +258,5 @@ void QtMessageLogEditor::replaceCurrentScript(const QString &script)
setTextCursor(cursor);
}
-} //Internal
-} //Debugger
+} // Internal
+} // QmlJSTools
diff --git a/src/plugins/debugger/qtmessagelogeditor.h b/src/plugins/qmljstools/qmlconsoleedit.h
index 798017b096..00c7259080 100644
--- a/src/plugins/debugger/qtmessagelogeditor.h
+++ b/src/plugins/qmljstools/qmlconsoleedit.h
@@ -27,21 +27,22 @@
**
****************************************************************************/
-#ifndef QTMESSAGELOGEDITOR_H
-#define QTMESSAGELOGEDITOR_H
+#ifndef QMLCONSOLEEDIT_H
+#define QMLCONSOLEEDIT_H
+
+#include "qmljsinterpreter.h"
-#include <QModelIndex>
#include <QTextEdit>
+#include <QModelIndex>
-namespace Debugger {
+namespace QmlJSTools {
namespace Internal {
-class QtMessageLogEditor : public QTextEdit
+class QmlConsoleEdit : public QTextEdit
{
Q_OBJECT
public:
- explicit QtMessageLogEditor(const QModelIndex &index,
- QWidget *parent = 0);
+ QmlConsoleEdit(const QModelIndex &index, QWidget *parent);
QString getCurrentScript() const;
@@ -64,9 +65,10 @@ private:
QString m_cachedScript;
QImage m_prompt;
int m_startOfEditableArea;
+ QmlJSInterpreter m_interpreter;
};
-} //Internal
-} //Debugger
+} // QmlJSTools
+} // Internal
-#endif // QTMESSAGELOGEDITOR_H
+#endif // QMLCONSOLEEDIT_H
diff --git a/src/plugins/qmljstools/qmlconsoleitem.cpp b/src/plugins/qmljstools/qmlconsoleitem.cpp
new file mode 100644
index 0000000000..6de05bbf8c
--- /dev/null
+++ b/src/plugins/qmljstools/qmlconsoleitem.cpp
@@ -0,0 +1,153 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: http://www.qt-project.org/
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+
+#include "qmlconsoleitem.h"
+
+namespace QmlJSTools {
+
+///////////////////////////////////////////////////////////////////////
+//
+// QmlConsoleItem
+//
+///////////////////////////////////////////////////////////////////////
+
+QmlConsoleItem::QmlConsoleItem(QmlConsoleItem *parent, QmlConsoleItem::ItemType itemType,
+ const QString &text)
+ : m_parentItem(parent),
+ itemType(itemType),
+ line(-1)
+
+{
+ setText(text);
+}
+
+QmlConsoleItem::~QmlConsoleItem()
+{
+ qDeleteAll(m_childItems);
+}
+
+QmlConsoleItem *QmlConsoleItem::child(int number)
+{
+ return m_childItems.value(number);
+}
+
+int QmlConsoleItem::childCount() const
+{
+ return m_childItems.size();
+}
+
+int QmlConsoleItem::childNumber() const
+{
+ if (m_parentItem)
+ return m_parentItem->m_childItems.indexOf(const_cast<QmlConsoleItem *>(this));
+
+ return 0;
+}
+
+bool QmlConsoleItem::insertChildren(int position, int count)
+{
+ if (position < 0 || position > m_childItems.size())
+ return false;
+
+ for (int row = 0; row < count; ++row) {
+ QmlConsoleItem *item = new QmlConsoleItem(this, QmlConsoleItem::UndefinedType,
+ QString());
+ m_childItems.insert(position, item);
+ }
+
+ return true;
+}
+
+void QmlConsoleItem::insertChild(QmlConsoleItem *item, bool sorted)
+{
+ if (!sorted) {
+ m_childItems.insert(m_childItems.count(), item);
+ return;
+ }
+
+ int i = 0;
+ for (; i < m_childItems.count(); i++) {
+ if (item->m_text < m_childItems[i]->m_text)
+ break;
+ }
+ m_childItems.insert(i, item);
+}
+
+bool QmlConsoleItem::insertChild(int position, QmlConsoleItem *item)
+{
+ if (position < 0 || position > m_childItems.size())
+ return false;
+
+ m_childItems.insert(position, item);
+
+ return true;
+}
+
+QmlConsoleItem *QmlConsoleItem::parent()
+{
+ return m_parentItem;
+}
+
+bool QmlConsoleItem::removeChildren(int position, int count)
+{
+ if (position < 0 || position + count > m_childItems.size())
+ return false;
+
+ for (int row = 0; row < count; ++row)
+ delete m_childItems.takeAt(position);
+
+ return true;
+}
+
+bool QmlConsoleItem::detachChild(int position)
+{
+ if (position < 0 || position > m_childItems.size())
+ return false;
+
+ m_childItems.removeAt(position);
+
+ return true;
+}
+
+void QmlConsoleItem::setText(const QString &text)
+{
+ m_text = text;
+ for (int i = 0; i < m_text.length(); ++i) {
+ if (m_text.at(i).isPunct())
+ m_text.insert(++i, QChar(0x200b)); // ZERO WIDTH SPACE
+ }
+}
+
+const QString &QmlConsoleItem::text() const
+{
+ return m_text;
+}
+
+} // QmlJSTools
diff --git a/src/plugins/qmljstools/qmlconsoleitem.h b/src/plugins/qmljstools/qmlconsoleitem.h
new file mode 100644
index 0000000000..dc4445e696
--- /dev/null
+++ b/src/plugins/qmljstools/qmlconsoleitem.h
@@ -0,0 +1,85 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: http://www.qt-project.org/
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+
+#ifndef QMLCONSOLEITEM_H
+#define QMLCONSOLEITEM_H
+
+#include "qmljstools_global.h"
+
+#include <QList>
+#include <QString>
+
+namespace QmlJSTools {
+
+class QMLJSTOOLS_EXPORT QmlConsoleItem
+{
+public:
+ enum ItemType
+ {
+ UndefinedType = 0x01, // Can be used for unknown and for Return values
+ DebugType = 0x02,
+ WarningType = 0x04,
+ ErrorType = 0x08,
+ InputType = 0x10,
+ DefaultTypes = InputType | UndefinedType
+ };
+ Q_DECLARE_FLAGS(ItemTypes, ItemType)
+
+ QmlConsoleItem(QmlConsoleItem *parent,
+ QmlConsoleItem::ItemType type = QmlConsoleItem::UndefinedType,
+ const QString &data = QString());
+ ~QmlConsoleItem();
+
+ QmlConsoleItem *child(int number);
+ int childCount() const;
+ bool insertChildren(int position, int count);
+ void insertChild(QmlConsoleItem *item, bool sorted);
+ bool insertChild(int position, QmlConsoleItem *item);
+ QmlConsoleItem *parent();
+ bool removeChildren(int position, int count);
+ bool detachChild(int position);
+ int childNumber() const;
+ void setText(const QString &text);
+ const QString &text() const;
+
+private:
+ QmlConsoleItem *m_parentItem;
+ QList<QmlConsoleItem *> m_childItems;
+ QString m_text;
+
+public:
+ QmlConsoleItem::ItemType itemType;
+ QString file;
+ int line;
+};
+
+} // QmlJSTools
+
+#endif // QMLCONSOLEITEM_H
diff --git a/src/plugins/debugger/qtmessagelogitemdelegate.cpp b/src/plugins/qmljstools/qmlconsoleitemdelegate.cpp
index 7dbd885c83..f1e6ba825d 100644
--- a/src/plugins/debugger/qtmessagelogitemdelegate.cpp
+++ b/src/plugins/qmljstools/qmlconsoleitemdelegate.cpp
@@ -27,8 +27,8 @@
**
****************************************************************************/
-#include "qtmessagelogitemdelegate.h"
-#include "qtmessagelogeditor.h"
+#include "qmlconsoleitemdelegate.h"
+#include "qmlconsoleedit.h"
#include <QPainter>
#include <QTreeView>
@@ -53,55 +53,54 @@ const char CONSOLE_BORDER_COLOR[] = "#C9C9C9";
const int ELLIPSIS_GRADIENT_WIDTH = 16;
-namespace Debugger {
+namespace QmlJSTools {
namespace Internal {
///////////////////////////////////////////////////////////////////////
//
-// QtMessageLogItemDelegate
+// QmlConsoleItemDelegate
//
///////////////////////////////////////////////////////////////////////
-QtMessageLogItemDelegate::QtMessageLogItemDelegate(QObject *parent) :
+QmlConsoleItemDelegate::QmlConsoleItemDelegate(QObject *parent) :
QStyledItemDelegate(parent),
- m_logIcon(QLatin1String(":/debugger/images/log.png")),
- m_warningIcon(QLatin1String(":/debugger/images/warning.png")),
- m_errorIcon(QLatin1String(":/debugger/images/error.png")),
- m_expandIcon(QLatin1String(":/debugger/images/expand.png")),
- m_collapseIcon(QLatin1String(":/debugger/images/collapse.png")),
- m_prompt(QLatin1String(":/debugger/images/prompt.png")),
- m_itemModel(0),
+ m_logIcon(QLatin1String(":/qmljstools/images/log.png")),
+ m_warningIcon(QLatin1String(":/qmljstools/images/warning.png")),
+ m_errorIcon(QLatin1String(":/qmljstools/images/error.png")),
+ m_expandIcon(QLatin1String(":/qmljstools/images/expand.png")),
+ m_collapseIcon(QLatin1String(":/qmljstools/images/collapse.png")),
+ m_prompt(QLatin1String(":/qmljstools/images/prompt.png")),
m_cachedHeight(0)
{
}
-void QtMessageLogItemDelegate::emitSizeHintChanged(const QModelIndex &index)
+void QmlConsoleItemDelegate::emitSizeHintChanged(const QModelIndex &index)
{
emit sizeHintChanged(index);
}
-QColor QtMessageLogItemDelegate::drawBackground(QPainter *painter, const QRect &rect,
- const QModelIndex &index,
- bool selected) const
+QColor QmlConsoleItemDelegate::drawBackground(QPainter *painter, const QRect &rect,
+ const QModelIndex &index,
+ bool selected) const
{
painter->save();
- QtMessageLogHandler::ItemType itemType = (QtMessageLogHandler::ItemType)index.data(
- QtMessageLogHandler::TypeRole).toInt();
+ QmlConsoleItem::ItemType itemType = (QmlConsoleItem::ItemType)index.data(
+ QmlConsoleItemModel::TypeRole).toInt();
QColor backgroundColor;
switch (itemType) {
- case QtMessageLogHandler::DebugType:
+ case QmlConsoleItem::DebugType:
backgroundColor = selected ? QColor(CONSOLE_LOG_BACKGROUND_SELECTED_COLOR) :
QColor(CONSOLE_LOG_BACKGROUND_COLOR);
break;
- case QtMessageLogHandler::WarningType:
+ case QmlConsoleItem::WarningType:
backgroundColor = selected ? QColor(CONSOLE_WARNING_BACKGROUND_SELECTED_COLOR) :
QColor(CONSOLE_WARNING_BACKGROUND_COLOR);
break;
- case QtMessageLogHandler::ErrorType:
+ case QmlConsoleItem::ErrorType:
backgroundColor = selected ? QColor(CONSOLE_ERROR_BACKGROUND_SELECTED_COLOR) :
QColor(CONSOLE_ERROR_BACKGROUND_COLOR);
break;
- case QtMessageLogHandler::InputType:
+ case QmlConsoleItem::InputType:
default:
backgroundColor = selected ? QColor(CONSOLE_EDITOR_BACKGROUND_SELECTED_COLOR) :
QColor(CONSOLE_EDITOR_BACKGROUND_COLOR);
@@ -116,37 +115,37 @@ QColor QtMessageLogItemDelegate::drawBackground(QPainter *painter, const QRect &
painter->setPen(QColor(CONSOLE_BORDER_COLOR));
if (!(index.flags() & Qt::ItemIsEditable))
painter->drawLine(0, rect.bottom(), rect.right(),
- rect.bottom());
+ rect.bottom());
painter->restore();
return backgroundColor;
}
-void QtMessageLogItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const
+void QmlConsoleItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const
{
QStyleOptionViewItemV4 opt = option;
initStyleOption(&opt, index);
painter->save();
- //Set Colors
+ // Set Colors
QColor textColor;
QIcon taskIcon;
- QtMessageLogHandler::ItemType type = (QtMessageLogHandler::ItemType)index.data(
- QtMessageLogHandler::TypeRole).toInt();
+ QmlConsoleItem::ItemType type = (QmlConsoleItem::ItemType)index.data(
+ QmlConsoleItemModel::TypeRole).toInt();
switch (type) {
- case QtMessageLogHandler::DebugType:
+ case QmlConsoleItem::DebugType:
textColor = QColor(CONSOLE_LOG_TEXT_COLOR);
taskIcon = m_logIcon;
break;
- case QtMessageLogHandler::WarningType:
+ case QmlConsoleItem::WarningType:
textColor = QColor(CONSOLE_WARNING_TEXT_COLOR);
taskIcon = m_warningIcon;
break;
- case QtMessageLogHandler::ErrorType:
+ case QmlConsoleItem::ErrorType:
textColor = QColor(CONSOLE_ERROR_TEXT_COLOR);
taskIcon = m_errorIcon;
break;
- case QtMessageLogHandler::InputType:
+ case QmlConsoleItem::InputType:
textColor = QColor(CONSOLE_EDITOR_TEXT_COLOR);
taskIcon = m_prompt;
break;
@@ -155,11 +154,11 @@ void QtMessageLogItemDelegate::paint(QPainter *painter, const QStyleOptionViewIt
break;
}
- //Paint background
+ // Paint background
QColor backgroundColor = drawBackground(painter, opt.rect, index,
- bool(opt.state & QStyle::State_Selected));
+ bool(opt.state & QStyle::State_Selected));
- //Calculate positions
+ // Calculate positions
const QTreeView *view = qobject_cast<const QTreeView *>(opt.widget);
int level = 0;
QModelIndex idx(index);
@@ -167,14 +166,12 @@ void QtMessageLogItemDelegate::paint(QPainter *painter, const QStyleOptionViewIt
idx = idx.parent();
level++;
}
- int width = view->width() - level * view->indentation() -
- view->verticalScrollBar()->width();
+ int width = view->width() - level * view->indentation() - view->verticalScrollBar()->width();
bool showTypeIcon = index.parent() == QModelIndex();
- bool showExpandableIcon = type == QtMessageLogHandler::UndefinedType;
+ bool showExpandableIcon = type == QmlConsoleItem::UndefinedType;
QRect rect(opt.rect.x(), opt.rect.top(), width, opt.rect.height());
- ConsoleItemPositions positions(rect, opt.font, showTypeIcon,
- showExpandableIcon, m_itemModel);
+ ConsoleItemPositions positions(rect, opt.font, showTypeIcon, showExpandableIcon);
// Paint TaskIconArea:
if (showTypeIcon)
@@ -195,11 +192,10 @@ void QtMessageLogItemDelegate::paint(QPainter *painter, const QStyleOptionViewIt
tl.draw(painter, QPoint(positions.textAreaLeft(), positions.adjustedTop()));
} else {
QFontMetrics fm(opt.font);
- painter->drawText(positions.textArea(),
- fm.elidedText(str, Qt::ElideRight,
- positions.textAreaWidth()));
+ painter->drawText(positions.textArea(), fm.elidedText(str, Qt::ElideRight,
+ positions.textAreaWidth()));
}
- //skip if area is editable
+ // skip if area is editable
if (showExpandableIcon) {
// Paint ExpandableIconArea:
QIcon expandCollapseIcon;
@@ -209,16 +205,14 @@ void QtMessageLogItemDelegate::paint(QPainter *painter, const QStyleOptionViewIt
else
expandCollapseIcon = m_expandIcon;
}
- painter->drawPixmap(positions.expandCollapseIconLeft(),
- positions.adjustedTop(),
- expandCollapseIcon.pixmap(
- positions.expandCollapseIconWidth(),
- positions.expandCollapseIconHeight()));
+ painter->drawPixmap(positions.expandCollapseIconLeft(), positions.adjustedTop(),
+ expandCollapseIcon.pixmap(positions.expandCollapseIconWidth(),
+ positions.expandCollapseIconHeight()));
}
if (showFileLineInfo) {
- //Check for file info
- QString file = index.data(QtMessageLogHandler::FileRole).toString();
+ // Check for file info
+ QString file = index.data(QmlConsoleItemModel::FileRole).toString();
if (!file.isEmpty()) {
QFontMetrics fm(option.font);
// Paint FileArea
@@ -227,22 +221,20 @@ void QtMessageLogItemDelegate::paint(QPainter *painter, const QStyleOptionViewIt
file = file.mid(pos +1);
const int realFileWidth = fm.width(file);
painter->setClipRect(positions.fileArea());
- painter->drawText(positions.fileAreaLeft(),
- positions.adjustedTop() + fm.ascent(), file);
+ painter->drawText(positions.fileAreaLeft(), positions.adjustedTop() + fm.ascent(),
+ file);
if (realFileWidth > positions.fileAreaWidth()) {
// draw a gradient to mask the text
int gradientStart = positions.fileAreaLeft() - 1;
- QLinearGradient lg(gradientStart +
- ELLIPSIS_GRADIENT_WIDTH, 0, gradientStart, 0);
+ QLinearGradient lg(gradientStart + ELLIPSIS_GRADIENT_WIDTH, 0, gradientStart, 0);
lg.setColorAt(0, Qt::transparent);
lg.setColorAt(1, backgroundColor);
painter->fillRect(gradientStart, positions.adjustedTop(),
- ELLIPSIS_GRADIENT_WIDTH, positions.lineHeight(),
- lg);
+ ELLIPSIS_GRADIENT_WIDTH, positions.lineHeight(), lg);
}
// Paint LineArea
- QString lineText = index.data(QtMessageLogHandler::LineRole).toString();
+ QString lineText = index.data(QmlConsoleItemModel::LineRole).toString();
painter->setClipRect(positions.lineArea());
const int realLineWidth = fm.width(lineText);
painter->drawText(positions.lineAreaRight() - realLineWidth,
@@ -253,8 +245,8 @@ void QtMessageLogItemDelegate::paint(QPainter *painter, const QStyleOptionViewIt
painter->restore();
}
-QSize QtMessageLogItemDelegate::sizeHint(const QStyleOptionViewItem &option,
- const QModelIndex &index) const
+QSize QmlConsoleItemDelegate::sizeHint(const QStyleOptionViewItem &option,
+ const QModelIndex &index) const
{
QStyleOptionViewItemV4 opt = option;
initStyleOption(&opt, index);
@@ -266,8 +258,7 @@ QSize QtMessageLogItemDelegate::sizeHint(const QStyleOptionViewItem &option,
idx = idx.parent();
level++;
}
- int width = view->width() - level * view->indentation() -
- view->verticalScrollBar()->width();
+ int width = view->width() - level * view->indentation() - view->verticalScrollBar()->width();
if (index.flags() & Qt::ItemIsEditable)
return QSize(width, view->height() * 1/2);
@@ -275,14 +266,13 @@ QSize QtMessageLogItemDelegate::sizeHint(const QStyleOptionViewItem &option,
if (!selected && option.font == m_cachedFont && m_cachedHeight > 0)
return QSize(width, m_cachedHeight);
- QtMessageLogHandler::ItemType type = (QtMessageLogHandler::ItemType)index.data(
- QtMessageLogHandler::TypeRole).toInt();
+ QmlConsoleItem::ItemType type = (QmlConsoleItem::ItemType)index.data(
+ QmlConsoleItemModel::TypeRole).toInt();
bool showTypeIcon = index.parent() == QModelIndex();
- bool showExpandableIcon = type == QtMessageLogHandler::UndefinedType;
+ bool showExpandableIcon = type == QmlConsoleItem::UndefinedType;
QRect rect(level * view->indentation(), 0, width, 0);
- ConsoleItemPositions positions(rect, opt.font,
- showTypeIcon, showExpandableIcon, m_itemModel);
+ ConsoleItemPositions positions(rect, opt.font, showTypeIcon, showExpandableIcon);
QFontMetrics fm(option.font);
qreal height = fm.height();
@@ -307,58 +297,56 @@ QSize QtMessageLogItemDelegate::sizeHint(const QStyleOptionViewItem &option,
return QSize(width, height);
}
-QWidget *QtMessageLogItemDelegate::createEditor(QWidget *parent,
- const QStyleOptionViewItem &/*option*/,
- const QModelIndex &index) const
+QWidget *QmlConsoleItemDelegate::createEditor(QWidget *parent,
+ const QStyleOptionViewItem &/*option*/,
+ const QModelIndex &index) const
{
- QtMessageLogEditor *editor = new QtMessageLogEditor(index, parent);
- connect(editor, SIGNAL(editingFinished()),
- this, SLOT(commitAndCloseEditor()));
+ QmlConsoleEdit *editor = new QmlConsoleEdit(index, parent);
+ connect(editor, SIGNAL(editingFinished()), this, SLOT(commitAndCloseEditor()));
return editor;
}
-void QtMessageLogItemDelegate::setEditorData(QWidget *editor,
- const QModelIndex &index) const
+void QmlConsoleItemDelegate::setEditorData(QWidget *editor,
+ const QModelIndex &index) const
{
- QtMessageLogEditor *edtr = qobject_cast<QtMessageLogEditor *>(editor);
+ QmlConsoleEdit *edtr = qobject_cast<QmlConsoleEdit *>(editor);
edtr->insertPlainText(index.data(Qt::DisplayRole).toString());
}
-void QtMessageLogItemDelegate::setModelData(QWidget *editor,
- QAbstractItemModel *model,
- const QModelIndex &index) const
+void QmlConsoleItemDelegate::setModelData(QWidget *editor,
+ QAbstractItemModel *model,
+ const QModelIndex &index) const
{
- QtMessageLogEditor *edtr = qobject_cast<QtMessageLogEditor *>(editor);
+ QmlConsoleEdit *edtr = qobject_cast<QmlConsoleEdit *>(editor);
model->setData(index, edtr->getCurrentScript(), Qt::DisplayRole);
- model->setData(index, QtMessageLogHandler::InputType, QtMessageLogHandler::TypeRole);
+ model->setData(index, QmlConsoleItem::InputType, QmlConsoleItemModel::TypeRole);
}
-void QtMessageLogItemDelegate::updateEditorGeometry(QWidget *editor,
- const QStyleOptionViewItem &option,
- const QModelIndex &/*index*/) const
+void QmlConsoleItemDelegate::updateEditorGeometry(QWidget *editor,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &/*index*/) const
{
QStyleOptionViewItemV4 opt = option;
- editor->setGeometry(QRect(opt.rect.x(), opt.rect.top(),
- opt.rect.width(), opt.rect.bottom()));
+ editor->setGeometry(QRect(opt.rect.x(), opt.rect.top(), opt.rect.width(), opt.rect.bottom()));
}
-void QtMessageLogItemDelegate::currentChanged(const QModelIndex &current,
- const QModelIndex &previous)
+void QmlConsoleItemDelegate::currentChanged(const QModelIndex &current,
+ const QModelIndex &previous)
{
emit sizeHintChanged(current);
emit sizeHintChanged(previous);
}
-void QtMessageLogItemDelegate::commitAndCloseEditor()
+void QmlConsoleItemDelegate::commitAndCloseEditor()
{
- QtMessageLogEditor *editor = qobject_cast<QtMessageLogEditor *>(sender());
+ QmlConsoleEdit *editor = qobject_cast<QmlConsoleEdit *>(sender());
emit commitData(editor);
emit closeEditor(editor);
}
-qreal QtMessageLogItemDelegate::layoutText(QTextLayout &tl, int width,
- bool *showFileLineInfo) const
+qreal QmlConsoleItemDelegate::layoutText(QTextLayout &tl, int width,
+ bool *showFileLineInfo) const
{
qreal height = 0;
tl.beginLayout();
@@ -378,10 +366,5 @@ qreal QtMessageLogItemDelegate::layoutText(QTextLayout &tl, int width,
return height;
}
-void QtMessageLogItemDelegate::setItemModel(QtMessageLogHandler *model)
-{
- m_itemModel = model;
-}
-
-} //Internal
-} //Debugger
+} // Internal
+} // QmlJSTools
diff --git a/src/plugins/debugger/qtmessagelogitemdelegate.h b/src/plugins/qmljstools/qmlconsoleitemdelegate.h
index f6a8a707aa..477618b474 100644
--- a/src/plugins/debugger/qtmessagelogitemdelegate.h
+++ b/src/plugins/qmljstools/qmlconsoleitemdelegate.h
@@ -27,28 +27,27 @@
**
****************************************************************************/
-#ifndef QTMESSAGELOGITEMDELEGATE_H
-#define QTMESSAGELOGITEMDELEGATE_H
+#ifndef QMLCONSOLEITEMDELEGATE_H
+#define QMLCONSOLEITEMDELEGATE_H
-#include "qtmessageloghandler.h"
+#include "qmlconsoleitemmodel.h"
+#include "qmlconsolemanager.h"
-#include <QTextLayout>
#include <QStyledItemDelegate>
+#include <QTextLayout>
-namespace Debugger {
+namespace QmlJSTools {
namespace Internal {
-class QtMessageLogItemDelegate : public QStyledItemDelegate
+class QmlConsoleItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
- explicit QtMessageLogItemDelegate(QObject *parent = 0);
- void emitSizeHintChanged(const QModelIndex &index);
- QColor drawBackground(QPainter *painter, const QRect &rect,
- const QModelIndex &index,
- bool selected) const;
+ QmlConsoleItemDelegate(QObject *parent);
- void setItemModel(QtMessageLogHandler *model);
+ void emitSizeHintChanged(const QModelIndex &index);
+ QColor drawBackground(QPainter *painter, const QRect &rect, const QModelIndex &index,
+ bool selected) const;
public slots:
void currentChanged(const QModelIndex &current, const QModelIndex &previous);
@@ -61,11 +60,9 @@ protected:
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const;
void setEditorData(QWidget *editor, const QModelIndex &index) const;
- void setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const;
+ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
- void updateEditorGeometry(QWidget *editor,
- const QStyleOptionViewItem &option,
+ void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
const QModelIndex &index) const;
private slots:
@@ -81,7 +78,6 @@ private:
const QIcon m_expandIcon;
const QIcon m_collapseIcon;
const QIcon m_prompt;
- QtMessageLogHandler *m_itemModel;
mutable int m_cachedHeight;
mutable QFont m_cachedFont;
};
@@ -101,11 +97,8 @@ private:
class ConsoleItemPositions
{
public:
- ConsoleItemPositions(const QRect &rect,
- const QFont &font,
- bool showTaskIconArea,
- bool showExpandableIconArea,
- QtMessageLogHandler *model = 0)
+ ConsoleItemPositions(const QRect &rect, const QFont &font, bool showTaskIconArea,
+ bool showExpandableIconArea)
: m_x(rect.x()),
m_width(rect.width()),
m_top(rect.top()),
@@ -116,10 +109,9 @@ public:
m_showExpandableIconArea(showExpandableIconArea)
{
m_fontHeight = QFontMetrics(font).height();
- if (model) {
- m_maxFileLength = model->sizeOfFile(font);
- m_maxLineLength = model->sizeOfLineNumber(font);
- }
+ QmlConsoleItemModel *model = QmlConsoleModel::qmlConsoleItemModel();
+ m_maxFileLength = model->sizeOfFile(font);
+ m_maxLineLength = model->sizeOfLineNumber(font);
}
int adjustedTop() const { return m_top + ITEM_PADDING; }
@@ -129,44 +121,41 @@ public:
int lineHeight() const { return m_fontHeight + 1; }
int minimumHeight() const { return typeIconHeight() + 2 * ITEM_PADDING; }
- //PROMPTAREA is same as TYPEICONAREA
+ // PROMPTAREA is same as TYPEICONAREA
int typeIconLeft() const { return adjustedLeft(); }
int typeIconWidth() const { return TASK_ICON_SIZE; }
int typeIconHeight() const { return TASK_ICON_SIZE; }
- int typeIconRight() const { return m_showTaskIconArea ?
- typeIconLeft() + typeIconWidth() : adjustedLeft(); }
- QRect typeIcon() const { return
- QRect(typeIconLeft(), adjustedTop(),
- typeIconWidth(), typeIconHeight()); }
-
- int expandCollapseIconLeft() const { return typeIconRight() +
- ITEM_SPACING; }
+ int typeIconRight() const { return m_showTaskIconArea ? typeIconLeft() + typeIconWidth()
+ : adjustedLeft(); }
+ QRect typeIcon() const { return QRect(typeIconLeft(), adjustedTop(), typeIconWidth(),
+ typeIconHeight()); }
+
+ int expandCollapseIconLeft() const { return typeIconRight() + ITEM_SPACING; }
int expandCollapseIconWidth() const { return TASK_ICON_SIZE; }
int expandCollapseIconHeight() const { return TASK_ICON_SIZE; }
int expandCollapseIconRight() const { return m_showExpandableIconArea ?
- expandCollapseIconLeft() + expandCollapseIconWidth() :
- typeIconRight(); }
- QRect expandCollapseIcon() const { return
- QRect(expandCollapseIconLeft(), adjustedTop(),
- expandCollapseIconWidth(), expandCollapseIconHeight()); }
+ expandCollapseIconLeft() + expandCollapseIconWidth() : typeIconRight(); }
+ QRect expandCollapseIcon() const { return QRect(expandCollapseIconLeft(), adjustedTop(),
+ expandCollapseIconWidth(),
+ expandCollapseIconHeight()); }
int textAreaLeft() const { return expandCollapseIconRight() + ITEM_SPACING; }
int textAreaWidth() const { return textAreaRight() - textAreaLeft(); }
int textAreaRight() const { return fileAreaLeft() - ITEM_SPACING; }
- QRect textArea() const { return
- QRect(textAreaLeft(), adjustedTop(), textAreaWidth(), lineHeight()); }
+ QRect textArea() const { return QRect(textAreaLeft(), adjustedTop(), textAreaWidth(),
+ lineHeight()); }
int fileAreaLeft() const { return fileAreaRight() - fileAreaWidth(); }
int fileAreaWidth() const { return m_maxFileLength; }
int fileAreaRight() const { return lineAreaLeft() - ITEM_SPACING; }
- QRect fileArea() const { return
- QRect(fileAreaLeft(), adjustedTop(), fileAreaWidth(), lineHeight()); }
+ QRect fileArea() const { return QRect(fileAreaLeft(), adjustedTop(), fileAreaWidth(),
+ lineHeight()); }
int lineAreaLeft() const { return lineAreaRight() - lineAreaWidth(); }
int lineAreaWidth() const { return m_maxLineLength; }
int lineAreaRight() const { return adjustedRight() - ITEM_SPACING; }
- QRect lineArea() const { return
- QRect(lineAreaLeft(), adjustedTop(), lineAreaWidth(), lineHeight()); }
+ QRect lineArea() const { return QRect(lineAreaLeft(), adjustedTop(), lineAreaWidth(),
+ lineHeight()); }
private:
int m_x;
@@ -185,7 +174,8 @@ public:
static const int ITEM_SPACING = 4;
};
-} //Internal
-} //Debugger
-#endif // QTMESSAGELOGITEMDELEGATE_H
+} // namespace Internal
+} // namespace QmlJSTools
+
+#endif // QMLCONSOLEITEMDELEGATE_H
diff --git a/src/plugins/qmljstools/qmlconsoleitemmodel.cpp b/src/plugins/qmljstools/qmlconsoleitemmodel.cpp
new file mode 100644
index 0000000000..b4475d30e1
--- /dev/null
+++ b/src/plugins/qmljstools/qmlconsoleitemmodel.cpp
@@ -0,0 +1,282 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: http://www.qt-project.org/
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+
+#include "qmlconsoleitemmodel.h"
+
+#include <utils/qtcassert.h>
+
+#include <QFontMetrics>
+
+namespace QmlJSTools {
+namespace Internal {
+
+///////////////////////////////////////////////////////////////////////
+//
+// QmlConsoleItemModel
+//
+///////////////////////////////////////////////////////////////////////
+
+QmlConsoleItemModel::QmlConsoleItemModel(QObject *parent) :
+ QAbstractItemModel(parent),
+ m_hasEditableRow(false),
+ m_rootItem(new QmlConsoleItem(0)),
+ m_maxSizeOfFileName(0)
+{
+}
+
+QmlConsoleItemModel::~QmlConsoleItemModel()
+{
+ delete m_rootItem;
+}
+
+void QmlConsoleItemModel::clear()
+{
+ beginResetModel();
+ reset();
+ delete m_rootItem;
+ m_rootItem = new QmlConsoleItem(0);
+ endResetModel();
+
+ if (m_hasEditableRow)
+ appendEditableRow();
+}
+
+bool QmlConsoleItemModel::appendItem(QmlConsoleItem *item, int position)
+{
+ if (position < 0)
+ position = m_rootItem->childCount() - 1;
+
+ if (position < 0)
+ position = 0;
+
+ beginInsertRows(QModelIndex(), position, position);
+ bool success = m_rootItem->insertChild(position, item);
+ endInsertRows();
+
+ return success;
+}
+
+bool QmlConsoleItemModel::appendMessage(QmlConsoleItem::ItemType itemType,
+ const QString &message, int position)
+{
+ return appendItem(new QmlConsoleItem(m_rootItem, itemType, message), position);
+}
+
+void QmlConsoleItemModel::setHasEditableRow(bool hasEditableRow)
+{
+ if (m_hasEditableRow && !hasEditableRow)
+ removeEditableRow();
+
+ if (!m_hasEditableRow && hasEditableRow)
+ appendEditableRow();
+
+ m_hasEditableRow = hasEditableRow;
+}
+
+bool QmlConsoleItemModel::hasEditableRow() const
+{
+ return m_hasEditableRow;
+}
+
+void QmlConsoleItemModel::appendEditableRow()
+{
+ int position = m_rootItem->childCount();
+ if (appendItem(new QmlConsoleItem(m_rootItem, QmlConsoleItem::InputType), position))
+ emit selectEditableRow(index(position, 0), QItemSelectionModel::ClearAndSelect);
+}
+
+void QmlConsoleItemModel::removeEditableRow()
+{
+ if (m_rootItem->child(m_rootItem->childCount() - 1)->itemType == QmlConsoleItem::InputType)
+ removeRow(m_rootItem->childCount() - 1);
+}
+
+int QmlConsoleItemModel::sizeOfFile(const QFont &font)
+{
+ int lastReadOnlyRow = m_rootItem->childCount();
+ if (m_hasEditableRow)
+ lastReadOnlyRow -= 2;
+ else
+ lastReadOnlyRow -= 1;
+ if (lastReadOnlyRow < 0)
+ return 0;
+ QString filename = m_rootItem->child(lastReadOnlyRow)->file;
+ const int pos = filename.lastIndexOf(QLatin1Char('/'));
+ if (pos != -1)
+ filename = filename.mid(pos + 1);
+
+ QFontMetrics fm(font);
+ m_maxSizeOfFileName = qMax(m_maxSizeOfFileName, fm.width(filename));
+
+ return m_maxSizeOfFileName;
+}
+
+int QmlConsoleItemModel::sizeOfLineNumber(const QFont &font)
+{
+ QFontMetrics fm(font);
+ return fm.width(QLatin1String("88888"));
+}
+
+QVariant QmlConsoleItemModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid())
+ return QVariant();
+
+ QmlConsoleItem *item = getItem(index);
+
+ if (role == Qt::DisplayRole )
+ return item->text();
+ else if (role == QmlConsoleItemModel::TypeRole)
+ return int(item->itemType);
+ else if (role == QmlConsoleItemModel::FileRole)
+ return item->file;
+ else if (role == QmlConsoleItemModel::LineRole)
+ return item->line;
+ else
+ return QVariant();
+}
+
+QModelIndex QmlConsoleItemModel::index(int row, int column, const QModelIndex &parent) const
+{
+ if (parent.isValid() && parent.column() != 0)
+ return QModelIndex();
+
+ if (column > 0)
+ return QModelIndex();
+
+ QmlConsoleItem *parentItem = getItem(parent);
+
+ QmlConsoleItem *childItem = parentItem->child(row);
+ if (childItem)
+ return createIndex(row, column, childItem);
+ else
+ return QModelIndex();
+}
+
+QModelIndex QmlConsoleItemModel::parent(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return QModelIndex();
+
+ QmlConsoleItem *childItem = getItem(index);
+ QmlConsoleItem *parentItem = childItem->parent();
+
+ if (parentItem == m_rootItem)
+ return QModelIndex();
+
+ if (!parentItem)
+ return QModelIndex();
+ return createIndex(parentItem->childNumber(), 0, parentItem);
+}
+
+int QmlConsoleItemModel::rowCount(const QModelIndex &parent) const
+{
+ QmlConsoleItem *parentItem = getItem(parent);
+
+ return parentItem->childCount();
+}
+
+int QmlConsoleItemModel::columnCount(const QModelIndex & /* parent */) const
+{
+ return 1;
+}
+
+Qt::ItemFlags QmlConsoleItemModel::flags(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return 0;
+
+ QmlConsoleItem *item = getItem(index);
+ if (m_hasEditableRow && item->parent() == m_rootItem
+ && index.row() == m_rootItem->childCount() - 1)
+ return Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+ return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+}
+
+bool QmlConsoleItemModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ QmlConsoleItem *item = getItem(index);
+ bool result = false;
+ if (role == Qt::DisplayRole) {
+ item->setText(value.toString());
+ result = true;
+ } else if (role == QmlConsoleItemModel::TypeRole) {
+ item->itemType = (QmlConsoleItem::ItemType)value.toInt();
+ result = true;
+ } else if (role == QmlConsoleItemModel::FileRole) {
+ item->file = value.toString();
+ result = true;
+ } else if (role == QmlConsoleItemModel::LineRole) {
+ item->line = value.toInt();
+ result = true;
+ }
+
+ if (result)
+ emit dataChanged(index, index);
+
+ return result;
+}
+
+bool QmlConsoleItemModel::insertRows(int position, int rows, const QModelIndex &parent)
+{
+ QmlConsoleItem *parentItem = getItem(parent);
+ bool success;
+
+ beginInsertRows(parent, position, position + rows - 1);
+ success = parentItem->insertChildren(position, rows);
+ endInsertRows();
+
+ return success;
+}
+
+bool QmlConsoleItemModel::removeRows(int position, int rows, const QModelIndex &parent)
+{
+ QmlConsoleItem *parentItem = getItem(parent);
+ bool success = true;
+
+ beginRemoveRows(parent, position, position + rows - 1);
+ success = parentItem->removeChildren(position, rows);
+ endRemoveRows();
+
+ return success;
+}
+
+QmlConsoleItem *QmlConsoleItemModel::getItem(const QModelIndex &index) const
+{
+ if (index.isValid()) {
+ QmlConsoleItem *item = static_cast<QmlConsoleItem*>(index.internalPointer());
+ if (item)
+ return item;
+ }
+ return m_rootItem;
+}
+
+} // Internal
+} // QmlJSTools
diff --git a/src/plugins/qmljstools/qmlconsoleitemmodel.h b/src/plugins/qmljstools/qmlconsoleitemmodel.h
new file mode 100644
index 0000000000..a66ec58888
--- /dev/null
+++ b/src/plugins/qmljstools/qmlconsoleitemmodel.h
@@ -0,0 +1,103 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: http://www.qt-project.org/
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+
+#ifndef QMLCONSOLEITEMMODEL_H
+#define QMLCONSOLEITEMMODEL_H
+
+#include "qmlconsoleitem.h"
+
+#include <QAbstractItemModel>
+#include <QItemSelectionModel>
+#include <QFont>
+
+namespace QmlJSTools {
+namespace Internal {
+
+class QmlConsoleItemModel : public QAbstractItemModel
+{
+ Q_OBJECT
+public:
+ enum Roles { TypeRole = Qt::UserRole, FileRole, LineRole };
+
+ explicit QmlConsoleItemModel(QObject *parent = 0);
+ ~QmlConsoleItemModel();
+
+ void setHasEditableRow(bool hasEditableRow);
+ bool hasEditableRow() const;
+ void appendEditableRow();
+ void removeEditableRow();
+
+ bool appendItem(QmlConsoleItem *item, int position = -1);
+ bool appendMessage(QmlConsoleItem::ItemType itemType, const QString &message,
+ int position = -1);
+
+ QAbstractItemModel *model() { return this; }
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+
+ int sizeOfFile(const QFont &font);
+ int sizeOfLineNumber(const QFont &font);
+
+ QmlConsoleItem *root() const { return m_rootItem; }
+
+public slots:
+ void clear();
+
+signals:
+ void selectEditableRow(const QModelIndex &index, QItemSelectionModel::SelectionFlags flags);
+ void rowInserted(const QModelIndex &index);
+
+protected:
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex parent(const QModelIndex &index) const;
+
+
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+
+ Qt::ItemFlags flags(const QModelIndex &index) const;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
+
+ bool insertRows(int position, int rows, const QModelIndex &parent = QModelIndex());
+ bool removeRows(int position, int rows, const QModelIndex &parent = QModelIndex());
+
+ QmlConsoleItem *getItem(const QModelIndex &index) const;
+
+private:
+ bool m_hasEditableRow;
+ QmlConsoleItem *m_rootItem;
+ int m_maxSizeOfFileName;
+};
+
+} // Internal
+} // QmlJSTools
+
+#endif // QMLCONSOLEITEMMODEL_H
diff --git a/src/plugins/qmljstools/qmlconsolemanager.cpp b/src/plugins/qmljstools/qmlconsolemanager.cpp
new file mode 100644
index 0000000000..963ed68dd3
--- /dev/null
+++ b/src/plugins/qmljstools/qmlconsolemanager.cpp
@@ -0,0 +1,194 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: http://www.qt-project.org/
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+
+#include "qmlconsolemanager.h"
+#include "qmlconsolepane.h"
+#include "qmlconsoleitemmodel.h"
+
+#include <extensionsystem/pluginmanager.h>
+
+#include <debugger/debuggerengine.h>
+
+#include <QScriptEngine>
+#include <QVariant>
+
+namespace QmlJSTools {
+
+QmlConsoleManager *QmlConsoleManager::m_instance = 0;
+
+class QmlConsoleManagerPrivate
+{
+public:
+ QScriptEngine *scriptEngine;
+ Internal::QmlConsoleItemModel *qmlConsoleItemModel;
+ Internal::QmlConsolePane *qmlConsolePane;
+ Debugger::DebuggerEngine *debuggerEngine;
+};
+
+QmlConsoleManager::QmlConsoleManager(QObject *parent)
+ : QObject(parent),
+ d(new QmlConsoleManagerPrivate)
+{
+ m_instance = this;
+ d->scriptEngine = new QScriptEngine(this);
+ d->qmlConsoleItemModel = new Internal::QmlConsoleItemModel(this);
+ d->qmlConsoleItemModel->setHasEditableRow(true);
+ d->qmlConsolePane = new Internal::QmlConsolePane(this);
+ ExtensionSystem::PluginManager::addObject(d->qmlConsolePane);
+ d->debuggerEngine = 0;
+}
+
+QmlConsoleManager::~QmlConsoleManager()
+{
+ if (d->qmlConsolePane) {
+ ExtensionSystem::PluginManager::removeObject(d->qmlConsolePane);
+ }
+ delete d;
+ m_instance = 0;
+}
+
+void QmlConsoleManager::showConsolePane()
+{
+ if (d->qmlConsolePane)
+ d->qmlConsolePane->popup(Core::IOutputPane::ModeSwitch);
+}
+
+QmlConsoleItem *QmlConsoleManager::rootItem() const
+{
+ return d->qmlConsoleItemModel->root();
+}
+
+void QmlConsoleManager::setDebuggerEngine(Debugger::DebuggerEngine *debuggerEngine)
+{
+ d->debuggerEngine = debuggerEngine;
+ if (!debuggerEngine)
+ setContext(QString());
+}
+
+void QmlConsoleManager::setContext(const QString &context)
+{
+ d->qmlConsolePane->setContext(context);
+}
+
+void QmlConsoleManager::printToConsolePane(QmlConsoleItem::ItemType itemType,
+ const QString &text, bool bringToForeground)
+{
+ if (!d->qmlConsolePane)
+ return;
+ if (itemType == QmlConsoleItem::ErrorType)
+ bringToForeground = true;
+ if (bringToForeground)
+ d->qmlConsolePane->popup(Core::IOutputPane::ModeSwitch);
+ d->qmlConsoleItemModel->appendMessage(itemType, text);
+}
+
+void QmlConsoleManager::printToConsolePane(QmlConsoleItem *item, bool bringToForeground)
+{
+ if (!d->qmlConsolePane)
+ return;
+ if (item->itemType == QmlConsoleItem::ErrorType)
+ bringToForeground = true;
+ if (bringToForeground)
+ d->qmlConsolePane->popup(Core::IOutputPane::ModeSwitch);
+ d->qmlConsoleItemModel->appendItem(item);
+}
+
+namespace Internal {
+
+QmlConsoleItem *constructLogItemTree(QmlConsoleItem *parent, const QVariant &result,
+ const QString &key = QString())
+{
+ if (!result.isValid())
+ return 0;
+
+ QmlConsoleItem *item = new QmlConsoleItem(parent);
+ if (result.type() == QVariant::Map) {
+ if (key.isEmpty())
+ item->setText(QLatin1String("Object"));
+ else
+ item->setText(key + QLatin1String(" : Object"));
+
+ QMapIterator<QString, QVariant> i(result.toMap());
+ while (i.hasNext()) {
+ i.next();
+ QmlConsoleItem *child = constructLogItemTree(item, i.value(), i.key());
+ if (child)
+ item->insertChild(child, true);
+ }
+ } else if (result.type() == QVariant::List) {
+ if (key.isEmpty())
+ item->setText(QLatin1String("List"));
+ else
+ item->setText(QString(QLatin1String("[%1] : List")).arg(key));
+ QVariantList resultList = result.toList();
+ for (int i = 0; i < resultList.count(); i++) {
+ QmlConsoleItem *child = constructLogItemTree(item, resultList.at(i),
+ QString::number(i));
+ if (child)
+ item->insertChild(child, true);
+ }
+ } else if (result.canConvert(QVariant::String)) {
+ item->setText(result.toString());
+ } else {
+ item->setText(QLatin1String("Unknown Value"));
+ }
+
+ return item;
+}
+
+QmlConsoleItemModel *QmlConsoleModel::qmlConsoleItemModel()
+{
+ QmlConsoleManager *manager = QmlConsoleManager::instance();
+ if (manager)
+ return manager->d->qmlConsoleItemModel;
+ return 0;
+}
+
+void QmlConsoleModel::evaluate(const QString &expression)
+{
+ QmlConsoleManager *manager = QmlConsoleManager::instance();
+ if (manager) {
+ if (manager->d->debuggerEngine) {
+ QmlConsoleModel::qmlConsoleItemModel()->appendEditableRow();
+ manager->d->debuggerEngine->evaluateScriptExpression(expression);
+ } else {
+ QVariant result = manager->d->scriptEngine->evaluate(expression).toVariant();
+ QmlConsoleItem *root = manager->rootItem();
+ QmlConsoleItem *item = constructLogItemTree(root, result);
+ if (item) {
+ QmlConsoleModel::qmlConsoleItemModel()->appendEditableRow();
+ manager->printToConsolePane(item);
+ }
+ }
+ }
+}
+
+} // Internal
+} // QmlJSTools
diff --git a/src/plugins/debugger/qtmessagelogwindow.h b/src/plugins/qmljstools/qmlconsolemanager.h
index 1fb38aaf0c..0a537be326 100644
--- a/src/plugins/debugger/qtmessagelogwindow.h
+++ b/src/plugins/qmljstools/qmlconsolemanager.h
@@ -27,55 +27,62 @@
**
****************************************************************************/
-#ifndef QTMESSAGELOGWINDOW_H
-#define QTMESSAGELOGWINDOW_H
+#ifndef QMLCONSOLEMANAGER_H
+#define QMLCONSOLEMANAGER_H
-#include <QWidget>
+#include "qmljstools_global.h"
+#include "qmlconsoleitem.h"
-QT_BEGIN_NAMESPACE
-class QAbstractItemModel;
-class QAction;
-QT_END_NAMESPACE
+#include <QObject>
-namespace Utils {
-class StatusLabel;
-class SavedAction;
+namespace Debugger {
+class DebuggerEngine;
}
+namespace QmlJSTools {
-namespace Debugger {
namespace Internal {
+class QmlConsoleItemModel;
+class QmlConsoleModel;
+}
-class QtMessageLogView;
-class QtMessageLogItemDelegate;
-class QtMessageLogProxyModel;
-class QtMessageLogWindow : public QWidget
+class QmlConsoleManagerPrivate;
+class QMLJSTOOLS_EXPORT QmlConsoleManager : public QObject
{
Q_OBJECT
-
public:
- QtMessageLogWindow(QWidget *parent = 0);
- ~QtMessageLogWindow();
+ QmlConsoleManager(QObject *parent);
+ ~QmlConsoleManager();
+
+ static QmlConsoleManager *instance() { return m_instance; }
+
+ void showConsolePane();
+
+ QmlConsoleItem *rootItem() const;
- void setModel(QAbstractItemModel *model);
- void readSettings();
- void showStatus(const QString &context, int timeout);
+ void setDebuggerEngine(Debugger::DebuggerEngine *debuggerEngine);
+ void setContext(const QString &context);
-public slots:
- void writeSettings() const;
+ void printToConsolePane(QmlConsoleItem::ItemType itemType, const QString &text,
+ bool bringToForeground = false);
+ void printToConsolePane(QmlConsoleItem *item, bool bringToForeground = false);
private:
- Utils::StatusLabel *m_statusLabel;
- Utils::SavedAction *m_showLogAction;
- Utils::SavedAction *m_showWarningAction;
- Utils::SavedAction *m_showErrorAction;
- QAction *m_clearAction;
- QtMessageLogView *m_treeView;
- QtMessageLogItemDelegate *m_itemDelegate;
- QtMessageLogProxyModel *m_proxyModel;
+ QmlConsoleManagerPrivate *d;
+ static QmlConsoleManager *m_instance;
+ friend class Internal::QmlConsoleModel;
};
-} // namespace Internal
-} // namespace Debugger
+namespace Internal {
+
+class QmlConsoleModel
+{
+public:
+ static QmlConsoleItemModel *qmlConsoleItemModel();
+ static void evaluate(const QString &expression);
+};
+
+}
-#endif // QTMESSAGELOGWINDOW_H
+} // namespace QmlJSTools
+#endif // QMLCONSOLEMANAGER_H
diff --git a/src/plugins/qmljstools/qmlconsolepane.cpp b/src/plugins/qmljstools/qmlconsolepane.cpp
new file mode 100644
index 0000000000..56c1d69d3e
--- /dev/null
+++ b/src/plugins/qmljstools/qmlconsolepane.cpp
@@ -0,0 +1,245 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: http://www.qt-project.org/
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+
+#include "qmlconsolepane.h"
+#include "qmlconsoleview.h"
+#include "qmlconsoleproxymodel.h"
+#include "qmlconsoleitemmodel.h"
+#include "qmlconsolemanager.h"
+#include "qmlconsoleitemdelegate.h"
+
+#include <coreplugin/icore.h>
+#include <coreplugin/icontext.h>
+#include <coreplugin/findplaceholder.h>
+#include <utils/savedaction.h>
+#include <aggregation/aggregate.h>
+#include <find/treeviewfind.h>
+
+#include <QToolButton>
+#include <QLabel>
+#include <QVBoxLayout>
+
+static const char CONSOLE[] = "Console";
+static const char SHOW_LOG[] = "showLog";
+static const char SHOW_WARNING[] = "showWarning";
+static const char SHOW_ERROR[] = "showError";
+
+namespace QmlJSTools {
+namespace Internal {
+
+/////////////////////////////////////////////////////////////////////
+//
+// QmlConsolePane
+//
+/////////////////////////////////////////////////////////////////////
+
+QmlConsolePane::QmlConsolePane(QObject *parent)
+ : Core::IOutputPane(parent)
+{
+ m_consoleWidget = new QWidget;
+ m_consoleWidget->setWindowTitle(displayName());
+ m_consoleWidget->setEnabled(true);
+
+ QVBoxLayout *vbox = new QVBoxLayout(m_consoleWidget);
+ vbox->setMargin(0);
+ vbox->setSpacing(0);
+
+ m_consoleView = new QmlConsoleView(m_consoleWidget);
+ m_proxyModel = new QmlConsoleProxyModel(this);
+ m_proxyModel->setSourceModel(QmlConsoleModel::qmlConsoleItemModel());
+ connect(QmlConsoleModel::qmlConsoleItemModel(),
+ SIGNAL(selectEditableRow(QModelIndex, QItemSelectionModel::SelectionFlags)),
+ m_proxyModel,
+ SLOT(selectEditableRow(QModelIndex,QItemSelectionModel::SelectionFlags)));
+
+ //Scroll to bottom when rows matching current filter settings are inserted
+ //Not connecting rowsRemoved as the only way to remove rows is to clear the
+ //model which will automatically reset the view.
+ connect(QmlConsoleModel::qmlConsoleItemModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
+ m_proxyModel, SLOT(onRowsInserted(QModelIndex,int,int)));
+ m_consoleView->setModel(m_proxyModel);
+
+ connect(m_proxyModel,
+ SIGNAL(setCurrentIndex(QModelIndex,QItemSelectionModel::SelectionFlags)),
+ m_consoleView->selectionModel(),
+ SLOT(setCurrentIndex(QModelIndex,QItemSelectionModel::SelectionFlags)));
+ connect(m_proxyModel, SIGNAL(scrollToBottom()), m_consoleView, SLOT(onScrollToBottom()));
+
+ m_itemDelegate = new QmlConsoleItemDelegate(this);
+ connect(m_consoleView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
+ m_itemDelegate, SLOT(currentChanged(QModelIndex,QModelIndex)));
+ m_consoleView->setItemDelegate(m_itemDelegate);
+
+ Aggregation::Aggregate *aggregate = new Aggregation::Aggregate();
+ aggregate->add(m_consoleView);
+ aggregate->add(new Find::TreeViewFind(m_consoleView));
+
+ vbox->addWidget(m_consoleView);
+ vbox->addWidget(new Core::FindToolBarPlaceHolder(m_consoleWidget));
+
+ m_showDebugButton = new QToolButton(m_consoleWidget);
+ m_showDebugButton->setAutoRaise(true);
+
+ m_showDebugButtonAction = new Utils::SavedAction(this);
+ m_showDebugButtonAction->setDefaultValue(true);
+ m_showDebugButtonAction->setSettingsKey(QLatin1String(CONSOLE), QLatin1String(SHOW_LOG));
+ m_showDebugButtonAction->setToolTip(tr("Show debug, log, and info messages."));
+ m_showDebugButtonAction->setCheckable(true);
+ m_showDebugButtonAction->setIcon(QIcon(QLatin1String(":/qmljstools/images/log.png")));
+ connect(m_showDebugButtonAction, SIGNAL(toggled(bool)), m_proxyModel, SLOT(setShowLogs(bool)));
+ m_showDebugButton->setDefaultAction(m_showDebugButtonAction);
+
+ m_showWarningButton = new QToolButton(m_consoleWidget);
+ m_showWarningButton->setAutoRaise(true);
+
+ m_showWarningButtonAction = new Utils::SavedAction(this);
+ m_showWarningButtonAction->setDefaultValue(true);
+ m_showWarningButtonAction->setSettingsKey(QLatin1String(CONSOLE), QLatin1String(SHOW_WARNING));
+ m_showWarningButtonAction->setToolTip(tr("Show debug, log, and info messages."));
+ m_showWarningButtonAction->setCheckable(true);
+ m_showWarningButtonAction->setIcon(QIcon(QLatin1String(":/qmljstools/images/warning.png")));
+ connect(m_showWarningButtonAction, SIGNAL(toggled(bool)), m_proxyModel,
+ SLOT(setShowWarnings(bool)));
+ m_showWarningButton->setDefaultAction(m_showWarningButtonAction);
+
+ m_showErrorButton = new QToolButton(m_consoleWidget);
+ m_showErrorButton->setAutoRaise(true);
+
+ m_showErrorButtonAction = new Utils::SavedAction(this);
+ m_showErrorButtonAction->setDefaultValue(true);
+ m_showErrorButtonAction->setSettingsKey(QLatin1String(CONSOLE), QLatin1String(SHOW_ERROR));
+ m_showErrorButtonAction->setToolTip(tr("Show debug, log, and info messages."));
+ m_showErrorButtonAction->setCheckable(true);
+ m_showErrorButtonAction->setIcon(QIcon(QLatin1String(":/qmljstools/images/error.png")));
+ connect(m_showErrorButtonAction, SIGNAL(toggled(bool)), m_proxyModel,
+ SLOT(setShowErrors(bool)));
+ m_showErrorButton->setDefaultAction(m_showErrorButtonAction);
+
+ m_spacer = new QWidget(m_consoleWidget);
+ m_spacer->setMinimumWidth(30);
+
+ m_statusLabel = new QLabel(m_consoleWidget);
+
+ readSettings();
+ connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()), SLOT(writeSettings()));
+}
+
+QmlConsolePane::~QmlConsolePane()
+{
+ writeSettings();
+ delete m_consoleWidget;
+}
+
+QWidget *QmlConsolePane::outputWidget(QWidget *)
+{
+ return m_consoleWidget;
+}
+
+QList<QWidget *> QmlConsolePane::toolBarWidgets() const
+{
+ return QList<QWidget *>() << m_showDebugButton << m_showWarningButton << m_showErrorButton
+ << m_spacer << m_statusLabel;
+}
+
+int QmlConsolePane::priorityInStatusBar() const
+{
+ return 20;
+}
+
+void QmlConsolePane::clearContents()
+{
+ QmlConsoleModel::qmlConsoleItemModel()->clear();
+}
+
+void QmlConsolePane::visibilityChanged(bool /*visible*/)
+{
+}
+
+bool QmlConsolePane::canFocus() const
+{
+ return true;
+}
+
+bool QmlConsolePane::hasFocus() const
+{
+ return m_consoleWidget->hasFocus();
+}
+
+void QmlConsolePane::setFocus()
+{
+ m_consoleWidget->setFocus();
+}
+
+bool QmlConsolePane::canNext() const
+{
+ return false;
+}
+
+bool QmlConsolePane::canPrevious() const
+{
+ return false;
+}
+
+void QmlConsolePane::goToNext()
+{
+}
+
+void QmlConsolePane::goToPrev()
+{
+}
+
+bool QmlConsolePane::canNavigate() const
+{
+ return false;
+}
+
+void QmlConsolePane::readSettings()
+{
+ QSettings *settings = Core::ICore::settings();
+ m_showDebugButtonAction->readSettings(settings);
+ m_showWarningButtonAction->readSettings(settings);
+ m_showErrorButtonAction->readSettings(settings);
+}
+
+void QmlConsolePane::setContext(const QString &context)
+{
+ m_statusLabel->setText(context);
+}
+
+void QmlConsolePane::writeSettings() const
+{
+ QSettings *settings = Core::ICore::settings();
+ m_showDebugButtonAction->writeSettings(settings);
+ m_showWarningButtonAction->writeSettings(settings);
+ m_showErrorButtonAction->writeSettings(settings);
+}
+
+} // Internal
+} // QmlJSTools
diff --git a/src/plugins/qmljstools/qmlconsolepane.h b/src/plugins/qmljstools/qmlconsolepane.h
new file mode 100644
index 0000000000..2606485df2
--- /dev/null
+++ b/src/plugins/qmljstools/qmlconsolepane.h
@@ -0,0 +1,101 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: http://www.qt-project.org/
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+
+#ifndef QMLCONSOLEPANE_H
+#define QMLCONSOLEPANE_H
+
+#include <coreplugin/ioutputpane.h>
+
+QT_BEGIN_NAMESPACE
+class QToolButton;
+class QLabel;
+QT_END_NAMESPACE
+
+namespace Utils {
+class SavedAction;
+}
+
+namespace QmlJSTools {
+
+namespace Internal {
+
+class QmlConsoleView;
+class QmlConsoleItemDelegate;
+class QmlConsoleProxyModel;
+class QmlConsoleItemModel;
+
+class QmlConsolePane : public Core::IOutputPane
+{
+ Q_OBJECT
+public:
+ QmlConsolePane(QObject *parent);
+ ~QmlConsolePane();
+
+ QWidget *outputWidget(QWidget *);
+ QList<QWidget *> toolBarWidgets() const;
+ QString displayName() const { return tr("Console"); }
+ int priorityInStatusBar() const;
+ void clearContents();
+ void visibilityChanged(bool visible);
+ bool canFocus() const;
+ bool hasFocus() const;
+ void setFocus();
+
+ bool canNext() const;
+ bool canPrevious() const;
+ void goToNext();
+ void goToPrev();
+ bool canNavigate() const;
+
+ void readSettings();
+ void setContext(const QString &context);
+
+public slots:
+ void writeSettings() const;
+
+private:
+ QToolButton *m_showDebugButton;
+ QToolButton *m_showWarningButton;
+ QToolButton *m_showErrorButton;
+ Utils::SavedAction *m_showDebugButtonAction;
+ Utils::SavedAction *m_showWarningButtonAction;
+ Utils::SavedAction *m_showErrorButtonAction;
+ QWidget *m_spacer;
+ QLabel *m_statusLabel;
+ QmlConsoleView *m_consoleView;
+ QmlConsoleItemDelegate *m_itemDelegate;
+ QmlConsoleProxyModel *m_proxyModel;
+ QWidget *m_consoleWidget;
+};
+
+} // namespace Internal
+} // namespace QmlJSTools
+
+#endif // QMLCONSOLEPANE_H
diff --git a/src/plugins/debugger/qtmessagelogproxymodel.cpp b/src/plugins/qmljstools/qmlconsoleproxymodel.cpp
index 78397711ea..cc1b4f5d4d 100644
--- a/src/plugins/debugger/qtmessagelogproxymodel.cpp
+++ b/src/plugins/qmljstools/qmlconsoleproxymodel.cpp
@@ -27,54 +27,52 @@
**
****************************************************************************/
-#include "qtmessagelogproxymodel.h"
+#include "qmlconsoleproxymodel.h"
+#include "qmlconsoleitemmodel.h"
-namespace Debugger {
+namespace QmlJSTools {
namespace Internal {
-QtMessageLogProxyModel::QtMessageLogProxyModel(QObject *parent) :
+QmlConsoleProxyModel::QmlConsoleProxyModel(QObject *parent) :
QSortFilterProxyModel(parent),
- m_filter(QtMessageLogHandler::DefaultTypes)
+ m_filter(QmlConsoleItem::DefaultTypes)
{
}
-void QtMessageLogProxyModel::setShowLogs(bool show)
+void QmlConsoleProxyModel::setShowLogs(bool show)
{
- m_filter = show ? m_filter | QtMessageLogHandler::DebugType :
- m_filter & ~QtMessageLogHandler::DebugType;
+ m_filter = show ? m_filter | QmlConsoleItem::DebugType : m_filter & ~QmlConsoleItem::DebugType;
setFilterRegExp(QString());
}
-void QtMessageLogProxyModel::setShowWarnings(bool show)
+void QmlConsoleProxyModel::setShowWarnings(bool show)
{
- m_filter = show ? m_filter | QtMessageLogHandler::WarningType :
- m_filter & ~QtMessageLogHandler::WarningType;
+ m_filter = show ? m_filter | QmlConsoleItem::WarningType
+ : m_filter & ~QmlConsoleItem::WarningType;
setFilterRegExp(QString());
}
-void QtMessageLogProxyModel::setShowErrors(bool show)
+void QmlConsoleProxyModel::setShowErrors(bool show)
{
- m_filter = show ? m_filter | QtMessageLogHandler::ErrorType :
- m_filter & ~QtMessageLogHandler::ErrorType;
+ m_filter = show ? m_filter | QmlConsoleItem::ErrorType : m_filter & ~QmlConsoleItem::ErrorType;
setFilterRegExp(QString());
}
-void QtMessageLogProxyModel::selectEditableRow(const QModelIndex &index,
+void QmlConsoleProxyModel::selectEditableRow(const QModelIndex &index,
QItemSelectionModel::SelectionFlags command)
{
emit setCurrentIndex(mapFromSource(index), command);
}
-bool QtMessageLogProxyModel::filterAcceptsRow(int sourceRow,
+bool QmlConsoleProxyModel::filterAcceptsRow(int sourceRow,
const QModelIndex &sourceParent) const
{
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
- return m_filter.testFlag((QtMessageLogHandler::ItemType)
- sourceModel()->data(
- index, QtMessageLogHandler::TypeRole).toInt());
+ return m_filter.testFlag((QmlConsoleItem::ItemType)sourceModel()->data(
+ index, QmlConsoleItemModel::TypeRole).toInt());
}
-void QtMessageLogProxyModel::onRowsInserted(const QModelIndex &index, int start, int end)
+void QmlConsoleProxyModel::onRowsInserted(const QModelIndex &index, int start, int end)
{
int rowIndex = end;
do {
@@ -85,5 +83,5 @@ void QtMessageLogProxyModel::onRowsInserted(const QModelIndex &index, int start,
} while (--rowIndex >= start);
}
-} // namespace Internal
-} // namespace Debugger
+} // Internal
+} // QmlJSTools
diff --git a/src/plugins/debugger/qtmessagelogproxymodel.h b/src/plugins/qmljstools/qmlconsoleproxymodel.h
index 9f30c17590..ac7fd72bcb 100644
--- a/src/plugins/debugger/qtmessagelogproxymodel.h
+++ b/src/plugins/qmljstools/qmlconsoleproxymodel.h
@@ -27,22 +27,22 @@
**
****************************************************************************/
-#ifndef QTMESSAGELOGPROXYMODEL_H
-#define QTMESSAGELOGPROXYMODEL_H
+#ifndef QMLCONSOLEPROXYMODEL_H
+#define QMLCONSOLEPROXYMODEL_H
-#include "qtmessageloghandler.h"
+#include "qmlconsoleitem.h"
#include <QSortFilterProxyModel>
#include <QItemSelectionModel>
-namespace Debugger {
+namespace QmlJSTools {
namespace Internal {
-class QtMessageLogProxyModel : public QSortFilterProxyModel
+class QmlConsoleProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
- explicit QtMessageLogProxyModel(QObject *parent = 0);
+ explicit QmlConsoleProxyModel(QObject *parent);
public slots:
void setShowLogs(bool show);
@@ -61,10 +61,10 @@ protected:
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
private:
- QFlags<QtMessageLogHandler::ItemType> m_filter;
+ QFlags<QmlConsoleItem::ItemType> m_filter;
};
-} // namespace Internal
-} // namespace Debugger
+} // Internal
+} // QmlJSTools
-#endif // QTMESSAGELOGPROXYMODEL_H
+#endif // QMLCONSOLEPROXYMODEL_H
diff --git a/src/plugins/debugger/qtmessagelogview.cpp b/src/plugins/qmljstools/qmlconsoleview.cpp
index 65ecdc2784..e0eebae43d 100644
--- a/src/plugins/debugger/qtmessagelogview.cpp
+++ b/src/plugins/qmljstools/qmlconsoleview.cpp
@@ -27,12 +27,9 @@
**
****************************************************************************/
-#include "qtmessagelogview.h"
-#include "qtmessagelogitemdelegate.h"
-#include "qtmessageloghandler.h"
-#include "debuggerstringutils.h"
-#include "debuggercore.h"
-#include "debuggerengine.h"
+#include "qmlconsoleview.h"
+#include "qmlconsoleitemdelegate.h"
+#include "qmlconsoleitemmodel.h"
#include <texteditor/basetexteditor.h>
@@ -46,24 +43,20 @@
#include <QUrl>
#include <QScrollBar>
-namespace Debugger {
+namespace QmlJSTools {
namespace Internal {
-class QtMessageLogViewViewStyle : public QProxyStyle
+class QmlConsoleViewStyle : public QProxyStyle
{
public:
- void drawPrimitive(PrimitiveElement element,
- const QStyleOption *option,
- QPainter *painter,
+ void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter,
const QWidget *widget = 0) const
{
if (element != QStyle::PE_PanelItemViewRow)
QProxyStyle::drawPrimitive(element, option, painter, widget);
}
- int styleHint(StyleHint hint,
- const QStyleOption *option = 0,
- const QWidget *widget = 0,
+ int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0,
QStyleHintReturn *returnData = 0) const {
if (hint == SH_ItemView_ShowDecorationSelected)
return 0;
@@ -74,11 +67,11 @@ public:
///////////////////////////////////////////////////////////////////////
//
-// QtMessageLogView
+// QmlConsoleView
//
///////////////////////////////////////////////////////////////////////
-QtMessageLogView::QtMessageLogView(QWidget *parent) :
+QmlConsoleView::QmlConsoleView(QWidget *parent) :
QTreeView(parent)
{
setFrameStyle(QFrame::NoFrame);
@@ -102,36 +95,35 @@ QtMessageLogView::QtMessageLogView(QWidget *parent) :
"QTreeView::branch:open:has-children:has-siblings {"
"border-image: none;"
"image: none; }"));
- QtMessageLogViewViewStyle *style = new QtMessageLogViewViewStyle;
+ QmlConsoleViewStyle *style = new QmlConsoleViewStyle;
setStyle(style);
style->setParent(this);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
- connect(this, SIGNAL(activated(QModelIndex)),
- SLOT(onRowActivated(QModelIndex)));
+ connect(this, SIGNAL(activated(QModelIndex)), SLOT(onRowActivated(QModelIndex)));
}
-void QtMessageLogView::onScrollToBottom()
+void QmlConsoleView::onScrollToBottom()
{
- //Keep scrolling to bottom if scroll bar is at maximum()
+ // Keep scrolling to bottom if scroll bar is at maximum()
if (verticalScrollBar()->value() == verticalScrollBar()->maximum())
scrollToBottom();
}
-void QtMessageLogView::mousePressEvent(QMouseEvent *event)
+void QmlConsoleView::mousePressEvent(QMouseEvent *event)
{
QPoint pos = event->pos();
QModelIndex index = indexAt(pos);
if (index.isValid()) {
- QtMessageLogHandler::ItemType type = (QtMessageLogHandler::ItemType)index.data(
- QtMessageLogHandler::TypeRole).toInt();
+ QmlConsoleItem::ItemType type = (QmlConsoleItem::ItemType)index.data(
+ QmlConsoleItemModel::TypeRole).toInt();
bool handled = false;
- if (type == QtMessageLogHandler::UndefinedType) {
+ if (type == QmlConsoleItem::UndefinedType) {
bool showTypeIcon = index.parent() == QModelIndex();
- ConsoleItemPositions positions(visualRect(index), viewOptions().font,
- showTypeIcon, true);
+ ConsoleItemPositions positions(visualRect(index), viewOptions().font, showTypeIcon,
+ true);
if (positions.expandCollapseIcon().contains(pos)) {
if (isExpanded(index))
@@ -144,13 +136,12 @@ void QtMessageLogView::mousePressEvent(QMouseEvent *event)
if (!handled)
QTreeView::mousePressEvent(event);
} else {
- selectionModel()->setCurrentIndex(model()->index(
- model()->rowCount() - 1, 0),
- QItemSelectionModel::ClearAndSelect);
+ selectionModel()->setCurrentIndex(model()->index(model()->rowCount() - 1, 0),
+ QItemSelectionModel::ClearAndSelect);
}
}
-void QtMessageLogView::keyPressEvent(QKeyEvent *e)
+void QmlConsoleView::keyPressEvent(QKeyEvent *e)
{
if (!e->modifiers() && e->key() == Qt::Key_Return) {
emit activated(currentIndex());
@@ -160,22 +151,22 @@ void QtMessageLogView::keyPressEvent(QKeyEvent *e)
QTreeView::keyPressEvent(e);
}
-void QtMessageLogView::resizeEvent(QResizeEvent *e)
+void QmlConsoleView::resizeEvent(QResizeEvent *e)
{
- static_cast<QtMessageLogItemDelegate *>(itemDelegate())->emitSizeHintChanged(
+ static_cast<QmlConsoleItemDelegate *>(itemDelegate())->emitSizeHintChanged(
selectionModel()->currentIndex());
QTreeView::resizeEvent(e);
}
-void QtMessageLogView::drawBranches(QPainter *painter, const QRect &rect,
- const QModelIndex &index) const
+void QmlConsoleView::drawBranches(QPainter *painter, const QRect &rect,
+ const QModelIndex &index) const
{
- static_cast<QtMessageLogItemDelegate *>(itemDelegate())->drawBackground(
- painter, rect, index, false);
+ static_cast<QmlConsoleItemDelegate *>(itemDelegate())->drawBackground(painter, rect, index,
+ false);
QTreeView::drawBranches(painter, rect, index);
}
-void QtMessageLogView::contextMenuEvent(QContextMenuEvent *event)
+void QmlConsoleView::contextMenuEvent(QContextMenuEvent *event)
{
QModelIndex itemIndex = indexAt(event->pos());
QMenu menu;
@@ -194,69 +185,59 @@ void QtMessageLogView::contextMenuEvent(QContextMenuEvent *event)
if (a == 0)
return;
- if (a == copy)
+ if (a == copy) {
copyToClipboard(itemIndex);
- else if (a == show)
+ } else if (a == show) {
onRowActivated(itemIndex);
- else if (a == clear) {
- QAbstractProxyModel *proxyModel =
- qobject_cast<QAbstractProxyModel *>(model());
- QtMessageLogHandler *handler =
- qobject_cast<QtMessageLogHandler *>(proxyModel->sourceModel());
+ } else if (a == clear) {
+ QAbstractProxyModel *proxyModel = qobject_cast<QAbstractProxyModel *>(model());
+ QmlConsoleItemModel *handler = qobject_cast<QmlConsoleItemModel *>(
+ proxyModel->sourceModel());
handler->clear();
}
}
-void QtMessageLogView::onRowActivated(const QModelIndex &index)
+void QmlConsoleView::onRowActivated(const QModelIndex &index)
{
if (!index.isValid())
return;
- //See if we have file and line Info
+ // See if we have file and line Info
QString filePath = model()->data(index,
- QtMessageLogHandler::FileRole).toString();
+ QmlConsoleItemModel::FileRole).toString();
if (!filePath.isEmpty()) {
- filePath = debuggerCore()->currentEngine()->toFileInProject(
- QUrl(filePath));
QFileInfo fi(filePath);
if (fi.exists() && fi.isFile() && fi.isReadable()) {
- int line = model()->data(index,
- QtMessageLogHandler::LineRole).toInt();
- TextEditor::BaseTextEditorWidget::openEditorAt(
- fi.canonicalFilePath(), line);
+ int line = model()->data(index, QmlConsoleItemModel::LineRole).toInt();
+ TextEditor::BaseTextEditorWidget::openEditorAt(fi.canonicalFilePath(), line);
}
}
}
-void QtMessageLogView::copyToClipboard(const QModelIndex &index)
+void QmlConsoleView::copyToClipboard(const QModelIndex &index)
{
if (!index.isValid())
return;
QString contents = model()->data(index).toString();
- //See if we have file and line Info
- QString filePath = model()->data(index,
- QtMessageLogHandler::FileRole).toString();
+ // See if we have file and line Info
+ QString filePath = model()->data(index, QmlConsoleItemModel::FileRole).toString();
if (!filePath.isEmpty()) {
- contents = QString(_("%1 %2: %3")).arg(contents).arg(filePath).arg(
- model()->data(index,
- QtMessageLogHandler::LineRole).toString());
+ contents = QString(QLatin1String("%1 %2: %3")).arg(contents).arg(filePath).arg(
+ model()->data(index, QmlConsoleItemModel::LineRole).toString());
}
QClipboard *cb = QApplication::clipboard();
cb->setText(contents);
}
-bool QtMessageLogView::canShowItemInTextEditor(const QModelIndex &index)
+bool QmlConsoleView::canShowItemInTextEditor(const QModelIndex &index)
{
if (!index.isValid())
return false;
- //See if we have file and line Info
- QString filePath = model()->data(index,
- QtMessageLogHandler::FileRole).toString();
+ // See if we have file and line Info
+ QString filePath = model()->data(index, QmlConsoleItemModel::FileRole).toString();
if (!filePath.isEmpty()) {
- filePath = debuggerCore()->currentEngine()->toFileInProject(
- QUrl(filePath));
QFileInfo fi(filePath);
if (fi.exists() && fi.isFile() && fi.isReadable()) {
return true;
@@ -265,5 +246,5 @@ bool QtMessageLogView::canShowItemInTextEditor(const QModelIndex &index)
return false;
}
-} //Internal
-} //Debugger
+} // Internal
+} // QmlJSTools
diff --git a/src/plugins/debugger/qtmessagelogview.h b/src/plugins/qmljstools/qmlconsoleview.h
index c783816685..d37fb5b853 100644
--- a/src/plugins/debugger/qtmessagelogview.h
+++ b/src/plugins/qmljstools/qmlconsoleview.h
@@ -27,19 +27,19 @@
**
****************************************************************************/
-#ifndef QTMESSAGELOGVIEW_H
-#define QTMESSAGELOGVIEW_H
+#ifndef QMLCONSOLEVIEW_H
+#define QMLCONSOLEVIEW_H
#include <QTreeView>
-namespace Debugger {
+namespace QmlJSTools {
namespace Internal {
-class QtMessageLogView : public QTreeView
+class QmlConsoleView : public QTreeView
{
Q_OBJECT
public:
- explicit QtMessageLogView(QWidget *parent = 0);
+ QmlConsoleView(QWidget *parent);
public slots:
void onScrollToBottom();
@@ -60,7 +60,7 @@ private:
bool canShowItemInTextEditor(const QModelIndex &index);
};
-} //Internal
-} //Debugger
+} // Internal
+} // QmlJSTools
-#endif // QTMESSAGELOGVIEW_H
+#endif // QMLCONSOLEVIEW_H
diff --git a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp
index 6ec0d5b7e0..b546ed5699 100644
--- a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp
+++ b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp
@@ -176,7 +176,7 @@ QmlJSCodeStyleSettingsPage::QmlJSCodeStyleSettingsPage(/*QSharedPointer<CppFileS
QWidget *QmlJSCodeStyleSettingsPage::createPage(QWidget *parent)
{
TextEditor::SimpleCodeStylePreferences *originalTabPreferences
- = QmlJSToolsSettings::instance()->qmlJSCodeStyle();
+ = QmlJSToolsSettings::globalCodeStyle();
m_pageTabPreferences = new TextEditor::SimpleCodeStylePreferences(m_widget);
m_pageTabPreferences->setDelegatingPool(originalTabPreferences->delegatingPool());
m_pageTabPreferences->setTabSettings(originalTabPreferences->tabSettings());
@@ -194,7 +194,7 @@ void QmlJSCodeStyleSettingsPage::apply()
if (m_widget) {
QSettings *s = Core::ICore::settings();
- TextEditor::SimpleCodeStylePreferences *originalTabPreferences = QmlJSToolsSettings::instance()->qmlJSCodeStyle();
+ TextEditor::SimpleCodeStylePreferences *originalTabPreferences = QmlJSToolsSettings::globalCodeStyle();
if (originalTabPreferences->tabSettings() != m_pageTabPreferences->tabSettings()) {
originalTabPreferences->setTabSettings(m_pageTabPreferences->tabSettings());
if (s)
diff --git a/src/plugins/qmljstools/qmljsfunctionfilter.h b/src/plugins/qmljstools/qmljsfunctionfilter.h
index df3d59f300..55c9bb3a2c 100644
--- a/src/plugins/qmljstools/qmljsfunctionfilter.h
+++ b/src/plugins/qmljstools/qmljsfunctionfilter.h
@@ -44,7 +44,7 @@ public:
explicit FunctionFilter(LocatorData *data, QObject *parent = 0);
~FunctionFilter();
- QString displayName() const { return tr("Methods and Functions"); }
+ QString displayName() const { return tr("QML Methods and Functions"); }
QString id() const { return QLatin1String("Functions"); }
Priority priority() const { return Medium; }
QList<Locator::FilterEntry> matchesFor(QFutureInterface<Locator::FilterEntry> &future, const QString &entry);
diff --git a/src/plugins/qmljstools/qmljsinterpreter.cpp b/src/plugins/qmljstools/qmljsinterpreter.cpp
new file mode 100644
index 0000000000..691f65d160
--- /dev/null
+++ b/src/plugins/qmljstools/qmljsinterpreter.cpp
@@ -0,0 +1,88 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: http://www.qt-project.org/
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+
+#include "qmljsinterpreter.h"
+
+namespace QmlJSTools {
+namespace Internal {
+
+bool QmlJSInterpreter::canEvaluate()
+{
+ int yyaction = 0;
+ int yytoken = -1;
+ int yytos = -1;
+
+ setCode(m_code, 1);
+ m_tokens.append(T_FEED_JS_PROGRAM);
+
+ do {
+ if (++yytos == m_stateStack.size())
+ m_stateStack.resize(m_stateStack.size() * 2);
+
+ m_stateStack[yytos] = yyaction;
+
+again:
+ if (yytoken == -1 && action_index[yyaction] != -TERMINAL_COUNT) {
+ if (m_tokens.isEmpty())
+ yytoken = lex();
+ else
+ yytoken = m_tokens.takeFirst();
+ }
+
+ yyaction = t_action(yyaction, yytoken);
+ if (yyaction > 0) {
+ if (yyaction == ACCEPT_STATE) {
+ --yytos;
+ return true;
+ }
+ yytoken = -1;
+ } else if (yyaction < 0) {
+ const int ruleno = -yyaction - 1;
+ yytos -= rhs[ruleno];
+ yyaction = nt_action(m_stateStack[yytos], lhs[ruleno] - TERMINAL_COUNT);
+ }
+ } while (yyaction);
+
+ const int errorState = m_stateStack[yytos];
+ if (t_action(errorState, T_AUTOMATIC_SEMICOLON) && canInsertAutomaticSemicolon(yytoken)) {
+ yyaction = errorState;
+ m_tokens.prepend(yytoken);
+ yytoken = T_SEMICOLON;
+ goto again;
+ }
+
+ if (yytoken != EOF_SYMBOL)
+ return true;
+
+ return false;
+}
+
+} // namespace Internal
+} // namespace QmlJSTools
diff --git a/src/plugins/qmljstools/qmljsinterpreter.h b/src/plugins/qmljstools/qmljsinterpreter.h
new file mode 100644
index 0000000000..7c4f86f688
--- /dev/null
+++ b/src/plugins/qmljstools/qmljsinterpreter.h
@@ -0,0 +1,70 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: http://www.qt-project.org/
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+
+#ifndef QMLJSINTERPRETER_H
+#define QMLJSINTERPRETER_H
+
+#include <qmljs/parser/qmljslexer_p.h>
+#include <qmljs/parser/qmljsengine_p.h>
+
+#include <QVector>
+#include <QString>
+#include <QList>
+
+namespace QmlJSTools {
+namespace Internal {
+
+class QmlJSInterpreter: QmlJS::Lexer
+{
+public:
+ QmlJSInterpreter()
+ : Lexer(&m_engine),
+ m_stateStack(128)
+ {
+
+ }
+
+ void clearText() { m_code.clear(); }
+ void appendText(const QString &text) { m_code += text; }
+
+ QString code() const { return m_code; }
+ bool canEvaluate();
+
+private:
+ QmlJS::Engine m_engine;
+ QVector<int> m_stateStack;
+ QList<int> m_tokens;
+ QString m_code;
+};
+
+} // namespace Internal
+} // namespace QmlJSTools
+
+#endif // QMLJSINTERPRETER_H
diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp
index a2d59c61a7..94bfb7a93a 100644
--- a/src/plugins/qmljstools/qmljsmodelmanager.cpp
+++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp
@@ -50,6 +50,7 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h>
#include <qtsupport/baseqtversion.h>
+#include <utils/hostosinfo.h>
#include <QDir>
#include <QFile>
@@ -464,9 +465,9 @@ static bool findNewQmlLibraryInPath(const QString &path,
return false;
}
-#ifdef Q_OS_WIN
- // QTCREATORBUG-3402 - be case sensitive even here?
-#endif
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ // QTCREATORBUG-3402 - be case sensitive even here?
+ }
// found a new library!
qmldirFile.open(QFile::ReadOnly);
@@ -653,12 +654,8 @@ static QStringList environmentImportPaths()
QByteArray envImportPath = qgetenv("QML_IMPORT_PATH");
-#if defined(Q_OS_WIN)
- QLatin1Char pathSep(';');
-#else
- QLatin1Char pathSep(':');
-#endif
- foreach (const QString &path, QString::fromLatin1(envImportPath).split(pathSep, QString::SkipEmptyParts)) {
+ foreach (const QString &path, QString::fromLatin1(envImportPath)
+ .split(Utils::HostOsInfo::pathListSeparator(), QString::SkipEmptyParts)) {
QString canonicalPath = QDir(path).canonicalPath();
if (!canonicalPath.isEmpty() && !paths.contains(canonicalPath))
paths.append(canonicalPath);
diff --git a/src/plugins/qmljstools/qmljstools-lib.pri b/src/plugins/qmljstools/qmljstools-lib.pri
deleted file mode 100644
index e618816549..0000000000
--- a/src/plugins/qmljstools/qmljstools-lib.pri
+++ /dev/null
@@ -1,45 +0,0 @@
-!dll {
- DEFINES += QMLJSTOOLS_STATIC
-}
-
-INCLUDEPATH += $$PWD/..
-
-HEADERS += \
- $$PWD/qmljstools_global.h \
- $$PWD/qmljstoolsplugin.h \
- $$PWD/qmljstoolsconstants.h \
- $$PWD/qmljstoolssettings.h \
- $$PWD/qmljscodestylepreferencesfactory.h \
- $$PWD/qmljsmodelmanager.h \
- $$PWD/qmljsqtstylecodeformatter.h \
- $$PWD/qmljsrefactoringchanges.h \
- $$PWD/qmljsplugindumper.h \
- $$PWD/qmljsfunctionfilter.h \
- $$PWD/qmljslocatordata.h \
- $$PWD/qmljsindenter.h \
- $$PWD/qmljscodestylesettingspage.h \
- $$PWD/qmljsfindexportedcpptypes.h \
- $$PWD/qmljssemanticinfo.h
-
-SOURCES += \
- $$PWD/qmljstoolsplugin.cpp \
- $$PWD/qmljstoolssettings.cpp \
- $$PWD/qmljscodestylepreferencesfactory.cpp \
- $$PWD/qmljsmodelmanager.cpp \
- $$PWD/qmljsqtstylecodeformatter.cpp \
- $$PWD/qmljsrefactoringchanges.cpp \
- $$PWD/qmljsplugindumper.cpp \
- $$PWD/qmljsfunctionfilter.cpp \
- $$PWD/qmljslocatordata.cpp \
- $$PWD/qmljsindenter.cpp \
- $$PWD/qmljscodestylesettingspage.cpp \
- $$PWD/qmljsfindexportedcpptypes.cpp \
- $$PWD/qmljssemanticinfo.cpp
-
-FORMS += \
- $$PWD/qmljscodestylesettingspage.ui
-
-equals(TEST, 1) {
- SOURCES += \
- $$PWD/qmljstools_test.cpp
-}
diff --git a/src/plugins/qmljstools/qmljstools.pri b/src/plugins/qmljstools/qmljstools.pri
index 75415d0c1f..1d36f5e406 100644
--- a/src/plugins/qmljstools/qmljstools.pri
+++ b/src/plugins/qmljstools/qmljstools.pri
@@ -1,5 +1,3 @@
include(qmljstools_dependencies.pri)
-INCLUDEPATH *= $$PWD/..
-
LIBS *= -l$$qtLibraryName(QmlJSTools)
diff --git a/src/plugins/qmljstools/qmljstools.pro b/src/plugins/qmljstools/qmljstools.pro
index 86426bb3b7..9313110d88 100644
--- a/src/plugins/qmljstools/qmljstools.pro
+++ b/src/plugins/qmljstools/qmljstools.pro
@@ -7,4 +7,69 @@ include(qmljstools_dependencies.pri)
DEFINES += QT_NO_CAST_TO_ASCII
DEFINES += QMLJSTOOLS_LIBRARY
-include(qmljstools-lib.pri)
+!dll {
+ DEFINES += QMLJSTOOLS_STATIC
+}
+
+QT += script
+
+HEADERS += \
+ $$PWD/qmljstoolsplugin.h \
+ $$PWD/qmljstoolsconstants.h \
+ $$PWD/qmljstoolssettings.h \
+ $$PWD/qmljscodestylepreferencesfactory.h \
+ $$PWD/qmljsmodelmanager.h \
+ $$PWD/qmljsqtstylecodeformatter.h \
+ $$PWD/qmljsrefactoringchanges.h \
+ $$PWD/qmljsplugindumper.h \
+ $$PWD/qmljsfunctionfilter.h \
+ $$PWD/qmljslocatordata.h \
+ $$PWD/qmljsindenter.h \
+ $$PWD/qmljscodestylesettingspage.h \
+ $$PWD/qmljsfindexportedcpptypes.h \
+ $$PWD/qmljssemanticinfo.h \
+ $$PWD/qmljstools_global.h \
+ $$PWD/qmlconsolemanager.h \
+ $$PWD/qmlconsoleitem.h \
+ $$PWD/qmlconsoleitemmodel.h \
+ $$PWD/qmlconsolepane.h \
+ $$PWD/qmlconsoleview.h \
+ $$PWD/qmlconsoleitemdelegate.h \
+ $$PWD/qmlconsoleedit.h \
+ $$PWD/qmljsinterpreter.h \
+ $$PWD/qmlconsoleproxymodel.h
+
+SOURCES += \
+ $$PWD/qmljstoolsplugin.cpp \
+ $$PWD/qmljstoolssettings.cpp \
+ $$PWD/qmljscodestylepreferencesfactory.cpp \
+ $$PWD/qmljsmodelmanager.cpp \
+ $$PWD/qmljsqtstylecodeformatter.cpp \
+ $$PWD/qmljsrefactoringchanges.cpp \
+ $$PWD/qmljsplugindumper.cpp \
+ $$PWD/qmljsfunctionfilter.cpp \
+ $$PWD/qmljslocatordata.cpp \
+ $$PWD/qmljsindenter.cpp \
+ $$PWD/qmljscodestylesettingspage.cpp \
+ $$PWD/qmljsfindexportedcpptypes.cpp \
+ $$PWD/qmljssemanticinfo.cpp \
+ $$PWD/qmlconsolemanager.cpp \
+ $$PWD/qmlconsoleitem.cpp \
+ $$PWD/qmlconsoleitemmodel.cpp \
+ $$PWD/qmlconsolepane.cpp \
+ $$PWD/qmlconsoleview.cpp \
+ $$PWD/qmlconsoleitemdelegate.cpp \
+ $$PWD/qmlconsoleedit.cpp \
+ $$PWD/qmljsinterpreter.cpp \
+ $$PWD/qmlconsoleproxymodel.cpp
+
+RESOURCES += \
+ qmljstools.qrc
+
+FORMS += \
+ $$PWD/qmljscodestylesettingspage.ui
+
+equals(TEST, 1) {
+ SOURCES += \
+ $$PWD/qmljstools_test.cpp
+}
diff --git a/src/plugins/qmljstools/qmljstools.qbs b/src/plugins/qmljstools/qmljstools.qbs
index 2d5d58c64f..e1567641d1 100644
--- a/src/plugins/qmljstools/qmljstools.qbs
+++ b/src/plugins/qmljstools/qmljstools.qbs
@@ -1,6 +1,7 @@
import qbs.base 1.0
import "../QtcPlugin.qbs" as QtcPlugin
+import "../../../qbs/defaults.js" as Defaults
QtcPlugin {
name: "QmlJSTools"
@@ -18,16 +19,11 @@ QtcPlugin {
Depends { name: "cpp" }
cpp.defines: base.concat(["QT_NO_CAST_TO_ASCII"])
- cpp.includePaths: [
- "..",
- "../../libs",
- "../../libs/3rdparty",
- buildDirectory
- ]
+ cpp.includePaths: base.concat("../../libs/3rdparty")
files: [
- "qmljsmodelmanager.cpp",
- "qmljsmodelmanager.h",
+ "qmljscodestylepreferencesfactory.cpp",
+ "qmljscodestylepreferencesfactory.h",
"qmljscodestylesettingspage.cpp",
"qmljscodestylesettingspage.h",
"qmljscodestylesettingspage.ui",
@@ -40,6 +36,8 @@ QtcPlugin {
"qmljslocatordata.cpp",
"qmljslocatordata.h",
"qmljsmodelmanager.cpp",
+ "qmljsmodelmanager.cpp",
+ "qmljsmodelmanager.h",
"qmljsmodelmanager.h",
"qmljsplugindumper.cpp",
"qmljsplugindumper.h",
@@ -47,21 +45,42 @@ QtcPlugin {
"qmljsqtstylecodeformatter.h",
"qmljsrefactoringchanges.cpp",
"qmljsrefactoringchanges.h",
+ "qmljssemanticinfo.cpp",
+ "qmljssemanticinfo.h",
"qmljstools_global.h",
"qmljstoolsconstants.h",
"qmljstoolsplugin.cpp",
"qmljstoolsplugin.h",
"qmljstoolssettings.cpp",
"qmljstoolssettings.h",
- "qmljscodestylepreferencesfactory.cpp",
- "qmljscodestylepreferencesfactory.h",
- "qmljssemanticinfo.cpp",
- "qmljssemanticinfo.h"
+ "qmlconsolemanager.cpp",
+ "qmlconsolemanager.h",
+ "qmlconsoleitem.cpp",
+ "qmlconsoleitem.h",
+ "qmlcomsoleitemmodel.cpp",
+ "qmlconsoleitemmodel.h",
+ "qmlconsolepane.cpp",
+ "qmlconsolepane.h",
+ "qmlconsoleview.cpp",
+ "qmlconsoleview.h",
+ "qmlconsoleitemdelegate.cpp",
+ "qmlconsoleitemdelegate.h",
+ "qmlconsoleedit.cpp",
+ "qmlconsoleedit.h",
+ "qmljsinterpreter.cpp",
+ "qmljsinterpreter.h",
+ "qmljsconsoleproxymodel.cpp",
+ "qmljsconsoleproxymodel.h",
+ "qmljstools.qrc"
]
+ Group {
+ condition: Defaults.testsEnabled(qbs)
+ files: ["qmljstools_test.cpp"]
+ }
+
ProductModule {
Depends { name: "CppTools" }
Depends { name: "QmlDebug" }
}
}
-
diff --git a/src/plugins/qmljstools/qmljstools.qrc b/src/plugins/qmljstools/qmljstools.qrc
new file mode 100644
index 0000000000..9e396a3995
--- /dev/null
+++ b/src/plugins/qmljstools/qmljstools.qrc
@@ -0,0 +1,10 @@
+<RCC>
+ <qresource prefix="/qmljstools">
+ <file>images/prompt.png</file>
+ <file>images/collapse.png</file>
+ <file>images/warning.png</file>
+ <file>images/log.png</file>
+ <file>images/expand.png</file>
+ <file>images/error.png</file>
+ </qresource>
+</RCC>
diff --git a/src/plugins/qmljstools/qmljstoolsplugin.cpp b/src/plugins/qmljstools/qmljstoolsplugin.cpp
index 69bf5eef8d..fb27af25ad 100644
--- a/src/plugins/qmljstools/qmljstoolsplugin.cpp
+++ b/src/plugins/qmljstools/qmljstoolsplugin.cpp
@@ -34,6 +34,7 @@
#include "qmljscodestylesettingspage.h"
#include "qmljstoolsconstants.h"
#include "qmljstoolssettings.h"
+#include "qmlconsolemanager.h"
#include <extensionsystem/pluginmanager.h>
@@ -51,6 +52,7 @@
#include <QSettings>
#include <QMenu>
+using namespace QmlJSTools;
using namespace QmlJSTools::Internal;
enum { debug = 0 };
@@ -67,6 +69,7 @@ QmlJSToolsPlugin::~QmlJSToolsPlugin()
{
m_instance = 0;
m_modelManager = 0; // deleted automatically
+ m_consoleManager = 0; // deleted automatically
}
bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
@@ -78,6 +81,8 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
// Objects
m_modelManager = new ModelManager(this);
+ m_consoleManager = new QmlConsoleManager(this);
+
// Core::VCSManager *vcsManager = core->vcsManager();
// Core::DocumentManager *fileManager = core->fileManager();
// connect(vcsManager, SIGNAL(repositoryChanged(QString)),
diff --git a/src/plugins/qmljstools/qmljstoolsplugin.h b/src/plugins/qmljstools/qmljstoolsplugin.h
index df6297e628..e1ca0036a7 100644
--- a/src/plugins/qmljstools/qmljstoolsplugin.h
+++ b/src/plugins/qmljstools/qmljstoolsplugin.h
@@ -45,6 +45,7 @@ QT_END_NAMESPACE
namespace QmlJSTools {
class QmlJSToolsSettings;
+class QmlConsoleManager;
namespace Internal {
@@ -76,6 +77,7 @@ private slots:
private:
ModelManager *m_modelManager;
+ QmlConsoleManager *m_consoleManager;
QmlJSToolsSettings *m_settings;
QAction *m_resetCodeModelAction;
diff --git a/src/plugins/qmljstools/qmljstoolssettings.cpp b/src/plugins/qmljstools/qmljstoolssettings.cpp
index b602db0544..24be181d7c 100644
--- a/src/plugins/qmljstools/qmljstoolssettings.cpp
+++ b/src/plugins/qmljstools/qmljstoolssettings.cpp
@@ -42,53 +42,40 @@
#include <QSettings>
-static const char *idKey = "QmlJSGlobal";
-
-using namespace QmlJSTools;
-using TextEditor::TabSettings;
+using namespace TextEditor;
namespace QmlJSTools {
-namespace Internal {
-class QmlJSToolsSettingsPrivate
-{
-public:
- TextEditor::SimpleCodeStylePreferences *m_globalCodeStyle;
-};
+const char idKey[] = "QmlJSGlobal";
-} // namespace Internal
-} // namespace QmlJSTools
-
-QmlJSToolsSettings *QmlJSToolsSettings::m_instance = 0;
+static TextEditor::SimpleCodeStylePreferences *m_globalCodeStyle = 0;
QmlJSToolsSettings::QmlJSToolsSettings(QObject *parent)
: QObject(parent)
- , d(new Internal::QmlJSToolsSettingsPrivate)
{
- QTC_ASSERT(!m_instance, return);
- m_instance = this;
+ QTC_ASSERT(!m_globalCodeStyle, return);
- TextEditor::TextEditorSettings *textEditorSettings = TextEditor::TextEditorSettings::instance();
+ TextEditorSettings *textEditorSettings = TextEditorSettings::instance();
// code style factory
- TextEditor::ICodeStylePreferencesFactory *factory = new QmlJSTools::QmlJSCodeStylePreferencesFactory();
+ ICodeStylePreferencesFactory *factory = new QmlJSCodeStylePreferencesFactory();
textEditorSettings->registerCodeStyleFactory(factory);
// code style pool
- TextEditor::CodeStylePool *pool = new TextEditor::CodeStylePool(factory, this);
+ CodeStylePool *pool = new CodeStylePool(factory, this);
textEditorSettings->registerCodeStylePool(Constants::QML_JS_SETTINGS_ID, pool);
// global code style settings
- d->m_globalCodeStyle = new TextEditor::SimpleCodeStylePreferences(this);
- d->m_globalCodeStyle->setDelegatingPool(pool);
- d->m_globalCodeStyle->setDisplayName(tr("Global", "Settings"));
- d->m_globalCodeStyle->setId(idKey);
- pool->addCodeStyle(d->m_globalCodeStyle);
- textEditorSettings->registerCodeStyle(QmlJSTools::Constants::QML_JS_SETTINGS_ID, d->m_globalCodeStyle);
+ m_globalCodeStyle = new SimpleCodeStylePreferences(this);
+ m_globalCodeStyle->setDelegatingPool(pool);
+ m_globalCodeStyle->setDisplayName(tr("Global", "Settings"));
+ m_globalCodeStyle->setId(idKey);
+ pool->addCodeStyle(m_globalCodeStyle);
+ textEditorSettings->registerCodeStyle(QmlJSTools::Constants::QML_JS_SETTINGS_ID, m_globalCodeStyle);
// built-in settings
// Qt style
- TextEditor::SimpleCodeStylePreferences *qtCodeStyle = new TextEditor::SimpleCodeStylePreferences();
+ SimpleCodeStylePreferences *qtCodeStyle = new SimpleCodeStylePreferences();
qtCodeStyle->setId(QLatin1String("qt"));
qtCodeStyle->setDisplayName(tr("Qt"));
qtCodeStyle->setReadOnly(true);
@@ -101,13 +88,13 @@ QmlJSToolsSettings::QmlJSToolsSettings(QObject *parent)
pool->addCodeStyle(qtCodeStyle);
// default delegate for global preferences
- d->m_globalCodeStyle->setCurrentDelegate(qtCodeStyle);
+ m_globalCodeStyle->setCurrentDelegate(qtCodeStyle);
pool->loadCustomCodeStyles();
// load global settings (after built-in settings are added to the pool)
QSettings *s = Core::ICore::settings();
- d->m_globalCodeStyle->fromSettings(QmlJSTools::Constants::QML_JS_SETTINGS_ID, s);
+ m_globalCodeStyle->fromSettings(QmlJSTools::Constants::QML_JS_SETTINGS_ID, s);
// legacy handling start (Qt Creator Version < 2.4)
const bool legacyTransformed =
@@ -136,13 +123,13 @@ QmlJSToolsSettings::QmlJSToolsSettings(QObject *parent)
}
// create custom code style out of old settings
- TextEditor::ICodeStylePreferences *oldCreator = pool->createCodeStyle(
+ ICodeStylePreferences *oldCreator = pool->createCodeStyle(
QLatin1String("legacy"), legacyTabSettings,
QVariant(), tr("Old Creator"));
// change the current delegate and save
- d->m_globalCodeStyle->setCurrentDelegate(oldCreator);
- d->m_globalCodeStyle->toSettings(QmlJSTools::Constants::QML_JS_SETTINGS_ID, s);
+ m_globalCodeStyle->setCurrentDelegate(oldCreator);
+ m_globalCodeStyle->toSettings(QmlJSTools::Constants::QML_JS_SETTINGS_ID, s);
}
// mark old settings as transformed
s->setValue(QLatin1String("QmlJSTabPreferences/LegacyTransformed"), true);
@@ -163,19 +150,13 @@ QmlJSToolsSettings::QmlJSToolsSettings(QObject *parent)
QmlJSToolsSettings::~QmlJSToolsSettings()
{
- delete d;
-
- m_instance = 0;
-}
-
-QmlJSToolsSettings *QmlJSToolsSettings::instance()
-{
- return m_instance;
+ delete m_globalCodeStyle;
+ m_globalCodeStyle = 0;
}
-TextEditor::SimpleCodeStylePreferences *QmlJSToolsSettings::qmlJSCodeStyle() const
+SimpleCodeStylePreferences *QmlJSToolsSettings::globalCodeStyle()
{
- return d->m_globalCodeStyle;
+ return m_globalCodeStyle;
}
-
+} // namespace QmlJSTools
diff --git a/src/plugins/qmljstools/qmljstoolssettings.h b/src/plugins/qmljstools/qmljstoolssettings.h
index ffd1589887..4118b8df85 100644
--- a/src/plugins/qmljstools/qmljstoolssettings.h
+++ b/src/plugins/qmljstools/qmljstoolssettings.h
@@ -34,18 +34,9 @@
#include <QObject>
-namespace TextEditor
-{
-class SimpleCodeStylePreferences;
-}
-
-namespace QmlJSTools
-{
+namespace TextEditor { class SimpleCodeStylePreferences; }
-namespace Internal
-{
-class QmlJSToolsSettingsPrivate;
-}
+namespace QmlJSTools {
/**
* This class provides a central place for cpp tools settings.
@@ -58,14 +49,7 @@ public:
explicit QmlJSToolsSettings(QObject *parent);
~QmlJSToolsSettings();
- static QmlJSToolsSettings *instance();
-
- TextEditor::SimpleCodeStylePreferences *qmlJSCodeStyle() const;
-
-private:
- Internal::QmlJSToolsSettingsPrivate *d;
-
- static QmlJSToolsSettings *m_instance;
+ static TextEditor::SimpleCodeStylePreferences *globalCodeStyle();
};
} // namespace QmlJSTools
diff --git a/src/plugins/qmlprofiler/qmlprofiler.qbs b/src/plugins/qmlprofiler/qmlprofiler.qbs
index 92fa17e5d4..24996f068c 100644
--- a/src/plugins/qmlprofiler/qmlprofiler.qbs
+++ b/src/plugins/qmlprofiler/qmlprofiler.qbs
@@ -20,17 +20,13 @@ QtcPlugin {
Depends { name: "CPlusPlus" }
Depends { name: "cpp" }
- cpp.includePaths: [
- "canvas",
- "..",
- "../../libs",
- buildDirectory
- ]
+ cpp.includePaths: base.concat("canvas")
files: [
"abstractqmlprofilerrunner.h",
"localqmlprofilerrunner.cpp",
"localqmlprofilerrunner.h",
+ "qmlprofiler_global.h",
"qmlprofilerattachdialog.cpp",
"qmlprofilerattachdialog.h",
"qmlprofilerattachdialog.ui",
@@ -45,7 +41,6 @@ QtcPlugin {
"qmlprofilerengine.h",
"qmlprofilereventview.cpp",
"qmlprofilereventview.h",
- "qmlprofiler_global.h",
"qmlprofilerplugin.cpp",
"qmlprofilerplugin.h",
"qmlprofilerstatemanager.cpp",
@@ -75,6 +70,7 @@ QtcPlugin {
"qml/Detail.qml",
"qml/Label.qml",
"qml/MainView.qml",
+ "qml/Overview.js",
"qml/Overview.qml",
"qml/RangeDetails.qml",
"qml/RangeMover.qml",
@@ -84,7 +80,5 @@ QtcPlugin {
"qml/TimeDisplay.qml",
"qml/TimeMarks.qml",
"qml/qmlprofiler.qrc",
- "qml/Overview.js"
]
}
-
diff --git a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp
index 625bb99a69..68d02cd636 100644
--- a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp
@@ -36,7 +36,7 @@
#include <qmldebug/qv8profilerclient.h>
#include <utils/qtcassert.h>
-#include <QWeakPointer>
+#include <QPointer>
#include <QTimer>
#include <QMessageBox>
@@ -53,8 +53,8 @@ public:
QmlProfilerStateManager* profilerState;
QmlDebugConnection *connection;
- QWeakPointer<QmlProfilerTraceClient> qmlclientplugin;
- QWeakPointer<QV8ProfilerClient> v8clientplugin;
+ QPointer<QmlProfilerTraceClient> qmlclientplugin;
+ QPointer<QV8ProfilerClient> v8clientplugin;
QTimer connectionTimer;
int connectionAttempts;
diff --git a/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp b/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp
index 161bf8aa43..81ed97d1c0 100644
--- a/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp
+++ b/src/plugins/qmlprojectmanager/fileformat/filefilteritems.cpp
@@ -325,7 +325,7 @@ ImageFileFilterItem::ImageFileFilterItem(QObject *parent)
// supported image formats according to
QList<QByteArray> extensions = QImageReader::supportedImageFormats();
foreach (const QByteArray &extension, extensions) {
- filter.append(QString("*.%1;").arg(QString::fromAscii(extension)));
+ filter.append(QString("*.%1;").arg(QString::fromLatin1(extension)));
}
setFilter(filter);
}
diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h
index 13a08bf045..95dca50dc5 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.h
+++ b/src/plugins/qmlprojectmanager/qmlproject.h
@@ -35,6 +35,7 @@
#include <projectexplorer/project.h>
#include <QDeclarativeEngine>
+#include <QPointer>
namespace QmlJS { class ModelManagerInterface; }
namespace Utils { class FileSystemWatcher; }
@@ -114,7 +115,7 @@ private:
// qml based, new format
QDeclarativeEngine m_engine;
- QWeakPointer<QmlProjectItem> m_projectItem;
+ QPointer<QmlProjectItem> m_projectItem;
Internal::QmlProjectNode *m_rootNode;
};
diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs b/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs
index 9ac468e42c..9b453b8363 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs
+++ b/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs
@@ -13,46 +13,39 @@ QtcPlugin {
Depends { name: "QmlJS" }
Depends { name: "Debugger" }
Depends { name: "QtSupport" }
-
- Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
+ Depends { name: "app_version_header" }
files: [
- "fileformat/qmlprojectitem.h",
- "fileformat/filefilteritems.h",
- "fileformat/qmlprojectfileformat.h",
+ "QmlProject.mimetypes.xml",
+ "qmlproject.cpp",
"qmlproject.h",
- "qmlprojectplugin.h",
- "qmlprojectmanager.h",
+ "qmlproject.qrc",
+ "qmlprojectapplicationwizard.cpp",
+ "qmlprojectapplicationwizard.h",
"qmlprojectconstants.h",
- "qmlprojectnodes.h",
+ "qmlprojectfile.cpp",
"qmlprojectfile.h",
- "qmlprojectruncontrol.h",
- "qmlprojectrunconfiguration.h",
- "qmlprojectrunconfigurationfactory.h",
- "qmlprojectapplicationwizard.h",
+ "qmlprojectmanager.cpp",
+ "qmlprojectmanager.h",
"qmlprojectmanager_global.h",
"qmlprojectmanagerconstants.h",
- "qmlprojectrunconfigurationwidget.h",
- "fileformat/qmlprojectitem.cpp",
- "fileformat/filefilteritems.cpp",
- "fileformat/qmlprojectfileformat.cpp",
- "qmlproject.cpp",
- "qmlprojectplugin.cpp",
- "qmlprojectmanager.cpp",
"qmlprojectnodes.cpp",
- "qmlprojectfile.cpp",
- "qmlprojectruncontrol.cpp",
+ "qmlprojectnodes.h",
+ "qmlprojectplugin.cpp",
+ "qmlprojectplugin.h",
"qmlprojectrunconfiguration.cpp",
+ "qmlprojectrunconfiguration.h",
"qmlprojectrunconfigurationfactory.cpp",
- "qmlprojectapplicationwizard.cpp",
+ "qmlprojectrunconfigurationfactory.h",
"qmlprojectrunconfigurationwidget.cpp",
- "qmlproject.qrc",
- "QmlProject.mimetypes.xml"
+ "qmlprojectrunconfigurationwidget.h",
+ "qmlprojectruncontrol.cpp",
+ "qmlprojectruncontrol.h",
+ "fileformat/filefilteritems.cpp",
+ "fileformat/filefilteritems.h",
+ "fileformat/qmlprojectfileformat.cpp",
+ "fileformat/qmlprojectfileformat.h",
+ "fileformat/qmlprojectitem.cpp",
+ "fileformat/qmlprojectitem.h",
]
}
-
diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h
index 837c0da9ef..361380930f 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h
+++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h
@@ -34,7 +34,7 @@
#include <projectexplorer/runconfiguration.h>
-#include <QWeakPointer>
+#include <QPointer>
QT_FORWARD_DECLARE_CLASS(QStringListModel)
@@ -124,7 +124,7 @@ private:
QString m_scriptFile;
QString m_qmlViewerArgs;
- QWeakPointer<Internal::QmlProjectRunConfigurationWidget> m_configurationWidget;
+ QPointer<Internal::QmlProjectRunConfigurationWidget> m_configurationWidget;
bool m_isEnabled;
diff --git a/src/plugins/qnx/blackberrydeployconfiguration.cpp b/src/plugins/qnx/blackberrydeployconfiguration.cpp
index 4f6e6a7a09..be1da6989f 100644
--- a/src/plugins/qnx/blackberrydeployconfiguration.cpp
+++ b/src/plugins/qnx/blackberrydeployconfiguration.cpp
@@ -59,6 +59,7 @@ BlackBerryDeployConfiguration::BlackBerryDeployConfiguration(ProjectExplorer::Ta
: ProjectExplorer::DeployConfiguration(parent, source)
{
ctor();
+ cloneSteps(source);
}
void BlackBerryDeployConfiguration::ctor()
diff --git a/src/plugins/qnx/blackberrydeviceconfigurationwizard.cpp b/src/plugins/qnx/blackberrydeviceconfigurationwizard.cpp
index 5955a078a2..d7b80d7eb5 100644
--- a/src/plugins/qnx/blackberrydeviceconfigurationwizard.cpp
+++ b/src/plugins/qnx/blackberrydeviceconfigurationwizard.cpp
@@ -66,7 +66,7 @@ BlackBerryDeviceConfigurationWizard::BlackBerryDeviceConfigurationWizard(QWidget
ProjectExplorer::IDevice::Ptr BlackBerryDeviceConfigurationWizard::device()
{
QSsh::SshConnectionParameters sshParams;
- sshParams.proxyType = QSsh::SshConnectionParameters::NoProxy;
+ sshParams.options = QSsh::SshIgnoreDefaultProxy;
sshParams.host = m_setupPage->hostName();
sshParams.password = m_setupPage->password();
sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationByKey;
diff --git a/src/plugins/qnx/blackberryqtversion.cpp b/src/plugins/qnx/blackberryqtversion.cpp
index 70eb76c91a..89a595ca9d 100644
--- a/src/plugins/qnx/blackberryqtversion.cpp
+++ b/src/plugins/qnx/blackberryqtversion.cpp
@@ -33,6 +33,7 @@
#include "qnxconstants.h"
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QTextStream>
@@ -70,11 +71,8 @@ QMultiMap<QString, QString> parseEnvironmentFile(const QString &fileName)
QMapIterator<QString, QString> it(fileContent);
while (it.hasNext()) {
it.next();
-#if defined Q_OS_WIN
- QStringList values = it.value().split(QLatin1Char(';'));
-#elif defined Q_OS_UNIX
- QStringList values = it.value().split(QLatin1Char(':'));
-#endif
+ const QStringList values
+ = it.value().split(Utils::HostOsInfo::pathListSeparator());
QString key = it.key();
foreach (const QString &value, values) {
const QString ownKeyAsWindowsVar = QLatin1Char('%') + key + QLatin1Char('%');
@@ -143,11 +141,11 @@ QMultiMap<QString, QString> BlackBerryQtVersion::environment() const
if (sdkPath().isEmpty())
return QMultiMap<QString, QString>();
-#if defined Q_OS_WIN
- const QString envFile = sdkPath() + QLatin1String("/bbndk-env.bat");
-#elif defined Q_OS_UNIX
- const QString envFile = sdkPath() + QLatin1String("/bbndk-env.sh");
-#endif
+ QString envFile;
+ if (Utils::HostOsInfo::isWindowsHost())
+ envFile = sdkPath() + QLatin1String("/bbndk-env.bat");
+ else if (Utils::HostOsInfo::isAnyUnixHost())
+ envFile = sdkPath() + QLatin1String("/bbndk-env.sh");
return parseEnvironmentFile(envFile);
}
diff --git a/src/plugins/qnx/blackberryruncontrolfactory.cpp b/src/plugins/qnx/blackberryruncontrolfactory.cpp
index 06c86a29d9..21bd416775 100644
--- a/src/plugins/qnx/blackberryruncontrolfactory.cpp
+++ b/src/plugins/qnx/blackberryruncontrolfactory.cpp
@@ -72,7 +72,7 @@ bool BlackBerryRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runC
// not launch a second instance. Disable the Run button if the application is already
// running on the device.
if (m_activeRunControls.contains(rc->key())) {
- QWeakPointer<ProjectExplorer::RunControl> activeRunControl = m_activeRunControls[rc->key()];
+ QPointer<ProjectExplorer::RunControl> activeRunControl = m_activeRunControls[rc->key()];
if (activeRunControl && activeRunControl.data()->isRunning())
return false;
else
@@ -101,7 +101,7 @@ ProjectExplorer::RunControl *BlackBerryRunControlFactory::create(ProjectExplorer
if (mode == ProjectExplorer::NormalRunMode) {
BlackBerryRunControl *runControl = new BlackBerryRunControl(rc);
- m_activeRunControls[rc->key()] = QWeakPointer<ProjectExplorer::RunControl>(runControl);
+ m_activeRunControls[rc->key()] = runControl;
return runControl;
}
@@ -111,7 +111,7 @@ ProjectExplorer::RunControl *BlackBerryRunControlFactory::create(ProjectExplorer
return 0;
new BlackBerryDebugSupport(rc, runControl);
- m_activeRunControls[rc->key()] = QWeakPointer<ProjectExplorer::RunControl>(runControl);
+ m_activeRunControls[rc->key()] = runControl;
return runControl;
}
diff --git a/src/plugins/qnx/blackberryruncontrolfactory.h b/src/plugins/qnx/blackberryruncontrolfactory.h
index 0f014cc04e..d87379957f 100644
--- a/src/plugins/qnx/blackberryruncontrolfactory.h
+++ b/src/plugins/qnx/blackberryruncontrolfactory.h
@@ -66,7 +66,7 @@ public:
private:
static Debugger::DebuggerStartParameters startParameters( const BlackBerryRunConfiguration *runConfig);
- mutable QMap<QString, QWeakPointer<ProjectExplorer::RunControl> > m_activeRunControls;
+ mutable QMap<QString, QPointer<ProjectExplorer::RunControl> > m_activeRunControls;
};
} // namespace Internal
diff --git a/src/plugins/qnx/qnx.qbs b/src/plugins/qnx/qnx.qbs
index 27e89f17c9..ff11e279aa 100644
--- a/src/plugins/qnx/qnx.qbs
+++ b/src/plugins/qnx/qnx.qbs
@@ -18,12 +18,7 @@ QtcPlugin {
property var pluginspecreplacements: ({"QNX_EXPERIMENTAL_STR": (enable ? "false" : "true")})
cpp.defines: base.concat(["QT_NO_CAST_TO_ASCII", "QT_NO_CAST_FROM_ASCII"])
- cpp.includePaths: [
- "..",
- buildDirectory,
- "../../libs",
- "../../shared"
- ]
+ cpp.includePaths: base.concat("../../shared")
files: [
"bardescriptorfileimagewizardpage.cpp",
@@ -35,33 +30,33 @@ QtcPlugin {
"blackberryapplicationrunner.h",
"blackberryconnect.cpp",
"blackberryconnect.h",
+ "blackberrycreatepackagestep.cpp",
+ "blackberrycreatepackagestep.h",
"blackberrycreatepackagestepconfigwidget.cpp",
"blackberrycreatepackagestepconfigwidget.h",
- "blackberrycreatepackagestep.cpp",
"blackberrycreatepackagestepfactory.cpp",
"blackberrycreatepackagestepfactory.h",
- "blackberrycreatepackagestep.h",
"blackberrydebugsupport.cpp",
"blackberrydebugsupport.h",
"blackberrydeployconfiguration.cpp",
+ "blackberrydeployconfiguration.h",
"blackberrydeployconfigurationfactory.cpp",
"blackberrydeployconfigurationfactory.h",
- "blackberrydeployconfiguration.h",
"blackberrydeployconfigurationwidget.cpp",
"blackberrydeployconfigurationwidget.h",
"blackberrydeployconfigurationwidget.ui",
"blackberrydeployinformation.cpp",
"blackberrydeployinformation.h",
+ "blackberrydeploystep.cpp",
+ "blackberrydeploystep.h",
"blackberrydeploystepconfigwidget.cpp",
"blackberrydeploystepconfigwidget.h",
- "blackberrydeploystep.cpp",
"blackberrydeploystepfactory.cpp",
"blackberrydeploystepfactory.h",
- "blackberrydeploystep.h",
"blackberrydeviceconfiguration.cpp",
+ "blackberrydeviceconfiguration.h",
"blackberrydeviceconfigurationfactory.cpp",
"blackberrydeviceconfigurationfactory.h",
- "blackberrydeviceconfiguration.h",
"blackberrydeviceconfigurationwidget.cpp",
"blackberrydeviceconfigurationwidget.h",
"blackberrydeviceconfigurationwidget.ui",
@@ -72,26 +67,25 @@ QtcPlugin {
"blackberrydeviceconfigurationwizardsetuppage.ui",
"blackberrydeviceconfigurationwizardsshkeypage.ui",
"blackberryqtversion.cpp",
+ "blackberryqtversion.h",
"blackberryqtversionfactory.cpp",
"blackberryqtversionfactory.h",
- "blackberryqtversion.h",
"blackberryrunconfiguration.cpp",
+ "blackberryrunconfiguration.h",
"blackberryrunconfigurationfactory.cpp",
"blackberryrunconfigurationfactory.h",
- "blackberryrunconfiguration.h",
"blackberryrunconfigurationwidget.cpp",
"blackberryrunconfigurationwidget.h",
"blackberryrunconfigurationwidget.ui",
"blackberryruncontrol.cpp",
+ "blackberryruncontrol.h",
"blackberryruncontrolfactory.cpp",
"blackberryruncontrolfactory.h",
- "blackberryruncontrol.h",
"blackberrywizardextension.cpp",
"blackberrywizardextension.h",
- "images/target.png",
- "images/target-small.png",
"pathchooserdelegate.cpp",
"pathchooserdelegate.h",
+ "qnx.qrc",
"qnxabstractqtversion.cpp",
"qnxabstractqtversion.h",
"qnxbaseqtconfigwidget.cpp",
@@ -101,35 +95,36 @@ QtcPlugin {
"qnxdebugsupport.cpp",
"qnxdebugsupport.h",
"qnxdeployconfiguration.cpp",
+ "qnxdeployconfiguration.h",
"qnxdeployconfigurationfactory.cpp",
"qnxdeployconfigurationfactory.h",
- "qnxdeployconfiguration.h",
"qnxdeploystepfactory.cpp",
"qnxdeploystepfactory.h",
"qnxdeviceconfiguration.cpp",
+ "qnxdeviceconfiguration.h",
"qnxdeviceconfigurationfactory.cpp",
"qnxdeviceconfigurationfactory.h",
- "qnxdeviceconfiguration.h",
"qnxdeviceconfigurationwizard.cpp",
"qnxdeviceconfigurationwizard.h",
"qnxdeviceconfigurationwizardpages.cpp",
"qnxdeviceconfigurationwizardpages.h",
"qnxplugin.cpp",
"qnxplugin.h",
- "qnx.qrc",
"qnxqtversion.cpp",
+ "qnxqtversion.h",
"qnxqtversionfactory.cpp",
"qnxqtversionfactory.h",
- "qnxqtversion.h",
"qnxrunconfiguration.cpp",
+ "qnxrunconfiguration.h",
"qnxrunconfigurationfactory.cpp",
"qnxrunconfigurationfactory.h",
- "qnxrunconfiguration.h",
"qnxruncontrol.cpp",
+ "qnxruncontrol.h",
"qnxruncontrolfactory.cpp",
"qnxruncontrolfactory.h",
- "qnxruncontrol.h",
"qnxutils.cpp",
- "qnxutils.h"
+ "qnxutils.h",
+ "images/target-small.png",
+ "images/target.png",
]
}
diff --git a/src/plugins/qnx/qnxdeployconfiguration.cpp b/src/plugins/qnx/qnxdeployconfiguration.cpp
index 1058455014..88265ec345 100644
--- a/src/plugins/qnx/qnxdeployconfiguration.cpp
+++ b/src/plugins/qnx/qnxdeployconfiguration.cpp
@@ -42,4 +42,5 @@ QnxDeployConfiguration::QnxDeployConfiguration(ProjectExplorer::Target *target,
QnxDeployConfiguration::QnxDeployConfiguration(ProjectExplorer::Target *target, QnxDeployConfiguration *source)
: RemoteLinux::RemoteLinuxDeployConfiguration(target, source)
{
+ cloneSteps(source);
}
diff --git a/src/plugins/qnx/qnxdeviceconfigurationwizard.cpp b/src/plugins/qnx/qnxdeviceconfigurationwizard.cpp
index f1c8281773..725bdac76a 100644
--- a/src/plugins/qnx/qnxdeviceconfigurationwizard.cpp
+++ b/src/plugins/qnx/qnxdeviceconfigurationwizard.cpp
@@ -61,7 +61,7 @@ QnxDeviceConfigurationWizard::QnxDeviceConfigurationWizard(QWidget *parent) :
IDevice::Ptr QnxDeviceConfigurationWizard::device()
{
QSsh::SshConnectionParameters sshParams;
- sshParams.proxyType = QSsh::SshConnectionParameters::NoProxy;
+ sshParams.options = QSsh::SshIgnoreDefaultProxy;
sshParams.host = m_setupPage->hostName();
sshParams.userName = m_setupPage->userName();
sshParams.port = 22;
diff --git a/src/plugins/qnx/qnxqtversion.cpp b/src/plugins/qnx/qnxqtversion.cpp
index 795ecfeda7..fc008451f9 100644
--- a/src/plugins/qnx/qnxqtversion.cpp
+++ b/src/plugins/qnx/qnxqtversion.cpp
@@ -33,6 +33,8 @@
#include "qnxconstants.h"
+#include <utils/hostosinfo.h>
+
using namespace Qnx;
using namespace Qnx::Internal;
@@ -94,26 +96,26 @@ QMultiMap<QString, QString> QnxQtVersion::environment() const
QMultiMap<QString, QString> environment;
-#if defined Q_OS_WIN
- // TODO:
- //environment.insert(QLatin1String("QNX_CONFIGURATION"), QLatin1String("/etc/qnx"));
- environment.insert(QLatin1String(Constants::QNX_TARGET_KEY), sdkPath() + QLatin1String("/target/qnx6"));
- environment.insert(QLatin1String(Constants::QNX_HOST_KEY), sdkPath() + QLatin1String("/host/win32/x86"));
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ // TODO:
+ //environment.insert(QLatin1String("QNX_CONFIGURATION"), QLatin1String("/etc/qnx"));
+ environment.insert(QLatin1String(Constants::QNX_TARGET_KEY), sdkPath() + QLatin1String("/target/qnx6"));
+ environment.insert(QLatin1String(Constants::QNX_HOST_KEY), sdkPath() + QLatin1String("/host/win32/x86"));
- environment.insert(QLatin1String("PATH"), sdkPath() + QLatin1String("/host/win32/x86/usr/bin"));
+ environment.insert(QLatin1String("PATH"), sdkPath() + QLatin1String("/host/win32/x86/usr/bin"));
- // TODO:
- //environment.insert(QLatin1String("PATH"), QLatin1String("/etc/qnx/bin"));
-#elif defined Q_OS_UNIX
- environment.insert(QLatin1String("QNX_CONFIGURATION"), QLatin1String("/etc/qnx"));
- environment.insert(QLatin1String(Constants::QNX_TARGET_KEY), sdkPath() + QLatin1String("/target/qnx6"));
- environment.insert(QLatin1String(Constants::QNX_HOST_KEY), sdkPath() + QLatin1String("/host/linux/x86"));
+ // TODO:
+ //environment.insert(QLatin1String("PATH"), QLatin1String("/etc/qnx/bin"));
+ } else if (Utils::HostOsInfo::isAnyUnixHost()) {
+ environment.insert(QLatin1String("QNX_CONFIGURATION"), QLatin1String("/etc/qnx"));
+ environment.insert(QLatin1String(Constants::QNX_TARGET_KEY), sdkPath() + QLatin1String("/target/qnx6"));
+ environment.insert(QLatin1String(Constants::QNX_HOST_KEY), sdkPath() + QLatin1String("/host/linux/x86"));
- environment.insert(QLatin1String("PATH"), sdkPath() + QLatin1String("/host/linux/x86/usr/bin"));
- environment.insert(QLatin1String("PATH"), QLatin1String("/etc/qnx/bin"));
+ environment.insert(QLatin1String("PATH"), sdkPath() + QLatin1String("/host/linux/x86/usr/bin"));
+ environment.insert(QLatin1String("PATH"), QLatin1String("/etc/qnx/bin"));
- environment.insert(QLatin1String("LD_LIBRARY_PATH"), sdkPath() + QLatin1String("/host/linux/x86/usr/lib"));
-#endif
+ environment.insert(QLatin1String("LD_LIBRARY_PATH"), sdkPath() + QLatin1String("/host/linux/x86/usr/lib"));
+ }
environment.insert(QLatin1String("QNX_JAVAHOME"), sdkPath() + QLatin1String("/_jvm"));
environment.insert(QLatin1String("MAKEFLAGS"), QLatin1String("-I") + sdkPath() + QLatin1String("/target/qnx6/usr/include"));
diff --git a/src/plugins/qnx/qnxrunconfiguration.h b/src/plugins/qnx/qnxrunconfiguration.h
index 29a51bdcae..93704398a0 100644
--- a/src/plugins/qnx/qnxrunconfiguration.h
+++ b/src/plugins/qnx/qnxrunconfiguration.h
@@ -41,7 +41,8 @@ class QnxRunConfiguration : public RemoteLinux::RemoteLinuxRunConfiguration
{
Q_OBJECT
public:
- QnxRunConfiguration(ProjectExplorer::Target *parent, const Core::Id id, const QString &proFilePath);
+ QnxRunConfiguration(ProjectExplorer::Target *parent, const Core::Id id,
+ const QString &projectFilePath);
QString environmentPreparationCommand() const;
diff --git a/src/plugins/qt4projectmanager/addlibrarywizard.cpp b/src/plugins/qt4projectmanager/addlibrarywizard.cpp
index 2ce0d1241b..4d8ec4c729 100644
--- a/src/plugins/qt4projectmanager/addlibrarywizard.cpp
+++ b/src/plugins/qt4projectmanager/addlibrarywizard.cpp
@@ -31,6 +31,8 @@
#include "ui_librarydetailswidget.h"
#include "librarydetailscontroller.h"
+#include <utils/hostosinfo.h>
+
#include <QVBoxLayout>
#include <QRadioButton>
#include <QLabel>
@@ -175,10 +177,10 @@ LibraryTypePage::LibraryTypePage(AddLibraryWizard *parent)
packageLabel->setAttribute(Qt::WA_MacSmallSize, true);
layout->addWidget(packageLabel);
-#ifdef Q_OS_WIN
- m_packageRadio->setVisible(false);
- packageLabel->setVisible(false);
-#endif
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ m_packageRadio->setVisible(false);
+ packageLabel->setVisible(false);
+ }
// select the default
m_internalRadio->setChecked(true);
diff --git a/src/plugins/qt4projectmanager/librarydetailscontroller.cpp b/src/plugins/qt4projectmanager/librarydetailscontroller.cpp
index b1f7ce4852..d8f964320b 100644
--- a/src/plugins/qt4projectmanager/librarydetailscontroller.cpp
+++ b/src/plugins/qt4projectmanager/librarydetailscontroller.cpp
@@ -40,6 +40,7 @@
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/buildconfiguration.h>
+#include <utils/hostosinfo.h>
#include <QFileInfo>
#include <QDir>
@@ -66,27 +67,31 @@ LibraryDetailsController::LibraryDetailsController(
m_windowsGroupVisible(true),
m_libraryDetailsWidget(libraryDetails)
{
-#ifdef Q_OS_MAC
- m_creatorPlatform = CreatorMac;
-#endif
-#ifdef Q_OS_LINUX
- m_creatorPlatform = CreatorLinux;
-#endif
-#ifdef Q_OS_WIN
- m_creatorPlatform = CreatorWindows;
-#endif
-
-#ifndef Q_OS_LINUX
- // project for which we are going to insert the snippet
- const ProjectExplorer::Project *project =
- ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projectForFile(proFile);
- // if its tool chain is maemo behave the same as we would be on linux
- ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(project->activeTarget()->kit());
- if (tc
- && (tc->targetAbi().osFlavor() == ProjectExplorer::Abi::HarmattanLinuxFlavor
- || tc->targetAbi().osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor))
+ switch (Utils::HostOsInfo::hostOs()) {
+ case Utils::HostOsInfo::HostOsMac:
+ m_creatorPlatform = CreatorMac;
+ break;
+ case Utils::HostOsInfo::HostOsLinux:
m_creatorPlatform = CreatorLinux;
-#endif
+ break;
+ case Utils::HostOsInfo::HostOsWindows:
+ m_creatorPlatform = CreatorWindows;
+ break;
+ default:
+ break;
+ }
+
+ if (!Utils::HostOsInfo::isLinuxHost()) {
+ // project for which we are going to insert the snippet
+ const ProjectExplorer::Project *project =
+ ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projectForFile(proFile);
+ // if its tool chain is maemo behave the same as we would be on linux
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(project->activeTarget()->kit());
+ if (tc
+ && (tc->targetAbi().osFlavor() == ProjectExplorer::Abi::HarmattanLinuxFlavor
+ || tc->targetAbi().osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor))
+ m_creatorPlatform = CreatorLinux;
+ }
setPlatformsVisible(true);
setLinkageGroupVisible(true);
diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp
index 26e4eefb7c..6081ae9c28 100644
--- a/src/plugins/qt4projectmanager/qmakestep.cpp
+++ b/src/plugins/qt4projectmanager/qmakestep.cpp
@@ -53,6 +53,7 @@
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtversionmanager.h>
#include <qtsupport/debugginghelperbuildtask.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
@@ -65,6 +66,7 @@
using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
using namespace ProjectExplorer;
+using namespace Utils;
namespace {
const char * const QMAKE_BS_ID("QtProjectManager.QMakeBuildStep");
@@ -136,7 +138,7 @@ QString QMakeStep::allArguments(bool shorted)
arguments << QLatin1String("-r");
bool userProvidedMkspec = false;
- for (Utils::QtcProcess::ConstArgIterator ait(m_userArgs); ait.next(); ) {
+ for (QtcProcess::ConstArgIterator ait(m_userArgs); ait.next(); ) {
if (ait.value() == QLatin1String("-spec")) {
if (ait.next()) {
userProvidedMkspec = true;
@@ -144,7 +146,7 @@ QString QMakeStep::allArguments(bool shorted)
}
}
}
- Utils::FileName specArg = mkspec();
+ FileName specArg = mkspec();
if (!userProvidedMkspec && !specArg.isEmpty())
arguments << QLatin1String("-spec") << specArg.toUserOutput();
@@ -153,12 +155,12 @@ QString QMakeStep::allArguments(bool shorted)
arguments << deducedArguments();
- QString args = Utils::QtcProcess::joinArgs(arguments);
+ QString args = QtcProcess::joinArgs(arguments);
// User arguments
- Utils::QtcProcess::addArgs(&args, m_userArgs);
+ QtcProcess::addArgs(&args, m_userArgs);
// moreArgumentsAfter
foreach (const QString &arg, deducedArgumentsAfter())
- Utils::QtcProcess::addArg(&args, arg);
+ QtcProcess::addArg(&args, arg);
return args;
}
@@ -174,11 +176,11 @@ QStringList QMakeStep::deducedArguments()
ProjectExplorer::Abi targetAbi;
if (tc)
targetAbi = tc->targetAbi();
-#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
- if ((targetAbi.osFlavor() == ProjectExplorer::Abi::HarmattanLinuxFlavor
- || targetAbi.osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor))
+ if ((HostOsInfo::isWindowsHost() || HostOsInfo::isMacHost())
+ && (targetAbi.osFlavor() == ProjectExplorer::Abi::HarmattanLinuxFlavor
+ || targetAbi.osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor)) {
arguments << QLatin1String("-unix");
-#endif
+ }
// explicitly add architecture to CONFIG
if ((targetAbi.os() == ProjectExplorer::Abi::MacOS)
@@ -256,7 +258,7 @@ bool QMakeStep::init()
else
workingDirectory = qt4bc->buildDirectory();
- Utils::FileName program = qtVersion->qmakeCommand();
+ FileName program = qtVersion->qmakeCommand();
QString makefile = workingDirectory;
@@ -443,7 +445,7 @@ void QMakeStep::setLinkQmlDebuggingLibrary(bool enable)
QStringList QMakeStep::parserArguments()
{
QStringList result;
- for (Utils::QtcProcess::ConstArgIterator ait(allArguments()); ait.next(); )
+ for (QtcProcess::ConstArgIterator ait(allArguments()); ait.next(); )
if (ait.isSimple())
result << ait.value();
return result;
@@ -454,13 +456,13 @@ QString QMakeStep::userArguments()
return m_userArgs;
}
-Utils::FileName QMakeStep::mkspec()
+FileName QMakeStep::mkspec()
{
QString additionalArguments = m_userArgs;
- for (Utils::QtcProcess::ArgIterator ait(&additionalArguments); ait.next(); ) {
+ for (QtcProcess::ArgIterator ait(&additionalArguments); ait.next(); ) {
if (ait.value() == QLatin1String("-spec")) {
if (ait.next())
- return Utils::FileName::fromUserInput(ait.value());
+ return FileName::fromUserInput(ait.value());
}
}
diff --git a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp
index d9926c400f..292ae22df7 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp
+++ b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp
@@ -28,7 +28,7 @@
****************************************************************************/
#include "desktopqtversion.h"
-#include "qt4projectmanagerconstants.h"
+#include "../qt4projectmanagerconstants.h"
#include <qtsupport/qtsupportconstants.h>
#include <proparser/profileevaluator.h>
diff --git a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversionfactory.cpp b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversionfactory.cpp
index 8697760557..66dd8a1fdb 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversionfactory.cpp
+++ b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversionfactory.cpp
@@ -27,8 +27,8 @@
**
****************************************************************************/
#include "desktopqtversionfactory.h"
-#include "qt4projectmanagerconstants.h"
#include "desktopqtversion.h"
+#include "../qt4projectmanagerconstants.h"
#include <qtsupport/qtversionmanager.h>
#include <qtsupport/qtsupportconstants.h>
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp
index e316d45222..c27ec27869 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp
@@ -29,12 +29,12 @@
#include "qt4runconfiguration.h"
-#include "makestep.h"
-#include "qt4nodes.h"
-#include "qt4project.h"
-#include "qt4buildconfiguration.h"
-#include "qt4projectmanagerconstants.h"
-#include "qmakestep.h"
+#include "../makestep.h"
+#include "../qt4nodes.h"
+#include "../qt4project.h"
+#include "../qt4buildconfiguration.h"
+#include "../qt4projectmanagerconstants.h"
+#include "../qmakestep.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
@@ -58,6 +58,7 @@
#include <qtsupport/baseqtversion.h>
#include <qtsupport/profilereader.h>
#include <qtsupport/qtkitinformation.h>
+#include <utils/hostosinfo.h>
#include <QFormLayout>
#include <QInputDialog>
@@ -261,13 +262,13 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
toplayout->addRow(QString(), m_useTerminalCheck);
m_useTerminalCheck->setVisible(!m_qt4RunConfiguration->forcedGuiMode());
-#ifdef Q_OS_MAC
- m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"), this);
- m_usingDyldImageSuffix->setChecked(m_qt4RunConfiguration->isUsingDyldImageSuffix());
- toplayout->addRow(QString(), m_usingDyldImageSuffix);
- connect(m_usingDyldImageSuffix, SIGNAL(toggled(bool)),
- this, SLOT(usingDyldImageSuffixToggled(bool)));
-#endif
+ if (Utils::HostOsInfo::isMacHost()) {
+ m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"), this);
+ m_usingDyldImageSuffix->setChecked(m_qt4RunConfiguration->isUsingDyldImageSuffix());
+ toplayout->addRow(QString(), m_usingDyldImageSuffix);
+ connect(m_usingDyldImageSuffix, SIGNAL(toggled(bool)),
+ this, SLOT(usingDyldImageSuffixToggled(bool)));
+ }
QLabel *environmentLabel = new QLabel(this);
environmentLabel->setText(tr("Run Environment"));
diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
index 1e6faa75f0..cd9fc73ce6 100644
--- a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
@@ -53,19 +53,19 @@
#include <QInputDialog>
-using namespace Qt4ProjectManager;
-using namespace Qt4ProjectManager::Internal;
-using namespace ProjectExplorer;
+namespace Qt4ProjectManager {
-namespace {
-const char * const QT4_BC_ID("Qt4ProjectManager.Qt4BuildConfiguration");
+using namespace Internal;
+using namespace ProjectExplorer;
+using namespace QtSupport;
+using namespace Utils;
-const char * const USE_SHADOW_BUILD_KEY("Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild");
-const char * const BUILD_DIRECTORY_KEY("Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory");
-const char * const BUILD_CONFIGURATION_KEY("Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration");
+const char QT4_BC_ID[] = "Qt4ProjectManager.Qt4BuildConfiguration";
+const char USE_SHADOW_BUILD_KEY[] = "Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild";
+const char BUILD_DIRECTORY_KEY[] = "Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory";
+const char BUILD_CONFIGURATION_KEY[] = "Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration";
enum { debug = 0 };
-}
Qt4BuildConfiguration::Qt4BuildConfiguration(Target *target) :
BuildConfiguration(target, Core::Id(QT4_BC_ID)),
@@ -121,7 +121,7 @@ bool Qt4BuildConfiguration::fromMap(const QVariantMap &map)
return false;
m_shadowBuild = map.value(QLatin1String(USE_SHADOW_BUILD_KEY), true).toBool();
- m_qmakeBuildConfiguration = QtSupport::BaseQtVersion::QmakeBuildConfigs(map.value(QLatin1String(BUILD_CONFIGURATION_KEY)).toInt());
+ m_qmakeBuildConfiguration = BaseQtVersion::QmakeBuildConfigs(map.value(QLatin1String(BUILD_CONFIGURATION_KEY)).toInt());
m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY), defaultShadowBuildDirectory()).toString();
m_lastEmmitedBuildDirectory = buildDirectory();
@@ -158,9 +158,9 @@ void Qt4BuildConfiguration::emitBuildDirectoryChanged()
}
}
-Utils::Environment Qt4BuildConfiguration::baseEnvironment() const
+Environment Qt4BuildConfiguration::baseEnvironment() const
{
- Utils::Environment env = BuildConfiguration::baseEnvironment();
+ Environment env = BuildConfiguration::baseEnvironment();
target()->kit()->addToEnvironment(env);
return env;
}
@@ -192,7 +192,7 @@ QString Qt4BuildConfiguration::rawBuildDirectory() const
return workingDirectory;
}
-/// returns the build directory
+/// Returns the build directory.
QString Qt4BuildConfiguration::buildDirectory() const
{
QString path = QDir::cleanPath(environment().expandVariables(rawBuildDirectory()));
@@ -201,14 +201,14 @@ QString Qt4BuildConfiguration::buildDirectory() const
bool Qt4BuildConfiguration::supportsShadowBuilds()
{
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
+ BaseQtVersion *version = QtKitInformation::qtVersion(target()->kit());
return !version || version->supportsShadowBuilds();
}
/// If only a sub tree should be build this function returns which sub node
/// should be build
/// \see Qt4BuildConfiguration::setSubNodeBuild
-Qt4ProjectManager::Qt4ProFileNode *Qt4BuildConfiguration::subNodeBuild() const
+Qt4ProFileNode *Qt4BuildConfiguration::subNodeBuild() const
{
return m_subNodeBuild;
}
@@ -219,7 +219,7 @@ Qt4ProjectManager::Qt4ProFileNode *Qt4BuildConfiguration::subNodeBuild() const
/// calling BuildManager::buildProject( BuildConfiguration * )
/// and reset immediately afterwards
/// That is m_subNodesBuild is set only temporarly
-void Qt4BuildConfiguration::setSubNodeBuild(Qt4ProjectManager::Qt4ProFileNode *node)
+void Qt4BuildConfiguration::setSubNodeBuild(Qt4ProFileNode *node)
{
m_subNodeBuild = node;
}
@@ -254,7 +254,7 @@ QString Qt4BuildConfiguration::shadowBuildDirectory() const
void Qt4BuildConfiguration::setShadowBuildAndDirectory(bool shadowBuild, const QString &buildDirectory)
{
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
+ BaseQtVersion *version = QtKitInformation::qtVersion(target()->kit());
QString directoryToSet = buildDirectory;
bool toSet = (shadowBuild && version && version->isValid() && version->supportsShadowBuilds());
if (m_shadowBuild == toSet && m_buildDirectory == directoryToSet)
@@ -270,8 +270,8 @@ void Qt4BuildConfiguration::setShadowBuildAndDirectory(bool shadowBuild, const Q
QString Qt4BuildConfiguration::defaultMakeTarget() const
{
- ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
+ ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
+ BaseQtVersion *version = QtKitInformation::qtVersion(target()->kit());
if (!tc || !version)
return QString();
@@ -283,12 +283,12 @@ QString Qt4BuildConfiguration::makefile() const
return static_cast<Qt4Project *>(target()->project())->rootQt4ProjectNode()->makefile();
}
-QtSupport::BaseQtVersion::QmakeBuildConfigs Qt4BuildConfiguration::qmakeBuildConfiguration() const
+BaseQtVersion::QmakeBuildConfigs Qt4BuildConfiguration::qmakeBuildConfiguration() const
{
return m_qmakeBuildConfiguration;
}
-void Qt4BuildConfiguration::setQMakeBuildConfiguration(QtSupport::BaseQtVersion::QmakeBuildConfigs config)
+void Qt4BuildConfiguration::setQMakeBuildConfiguration(BaseQtVersion::QmakeBuildConfigs config)
{
if (m_qmakeBuildConfiguration == config)
return;
@@ -315,17 +315,18 @@ void Qt4BuildConfiguration::emitQMakeBuildConfigurationChanged()
QStringList Qt4BuildConfiguration::configCommandLineArguments() const
{
QStringList result;
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
- QtSupport::BaseQtVersion::QmakeBuildConfigs defaultBuildConfiguration = version ? version->defaultBuildConfig() : (QtSupport::BaseQtVersion::DebugBuild | QtSupport::BaseQtVersion::BuildAll);
- QtSupport::BaseQtVersion::QmakeBuildConfigs userBuildConfiguration = m_qmakeBuildConfiguration;
- if ((defaultBuildConfiguration & QtSupport::BaseQtVersion::BuildAll) && !(userBuildConfiguration & QtSupport::BaseQtVersion::BuildAll))
+ BaseQtVersion *version = QtKitInformation::qtVersion(target()->kit());
+ BaseQtVersion::QmakeBuildConfigs defaultBuildConfiguration =
+ version ? version->defaultBuildConfig() : (BaseQtVersion::DebugBuild | BaseQtVersion::BuildAll);
+ BaseQtVersion::QmakeBuildConfigs userBuildConfiguration = m_qmakeBuildConfiguration;
+ if ((defaultBuildConfiguration & BaseQtVersion::BuildAll) && !(userBuildConfiguration & BaseQtVersion::BuildAll))
result << QLatin1String("CONFIG-=debug_and_release");
- if (!(defaultBuildConfiguration & QtSupport::BaseQtVersion::BuildAll) && (userBuildConfiguration & QtSupport::BaseQtVersion::BuildAll))
+ if (!(defaultBuildConfiguration & BaseQtVersion::BuildAll) && (userBuildConfiguration & BaseQtVersion::BuildAll))
result << QLatin1String("CONFIG+=debug_and_release");
- if ((defaultBuildConfiguration & QtSupport::BaseQtVersion::DebugBuild) && !(userBuildConfiguration & QtSupport::BaseQtVersion::DebugBuild))
+ if ((defaultBuildConfiguration & BaseQtVersion::DebugBuild) && !(userBuildConfiguration & BaseQtVersion::DebugBuild))
result << QLatin1String("CONFIG+=release");
- if (!(defaultBuildConfiguration & QtSupport::BaseQtVersion::DebugBuild) && (userBuildConfiguration & QtSupport::BaseQtVersion::DebugBuild))
+ if (!(defaultBuildConfiguration & BaseQtVersion::DebugBuild) && (userBuildConfiguration & BaseQtVersion::DebugBuild))
result << QLatin1String("CONFIG+=debug");
return result;
}
@@ -352,19 +353,19 @@ MakeStep *Qt4BuildConfiguration::makeStep() const
return 0;
}
-// returns true if both are equal
+// Returns true if both are equal.
Qt4BuildConfiguration::MakefileState Qt4BuildConfiguration::compareToImportFrom(const QString &makefile)
{
QMakeStep *qs = qmakeStep();
if (QFileInfo(makefile).exists() && qs) {
- Utils::FileName qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
+ FileName qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(makefile);
+ BaseQtVersion *version = QtKitInformation::qtVersion(target()->kit());
if (!version)
return MakefileForWrongProject;
if (version->qmakeCommand() == qmakePath) {
// same qtversion
- QPair<QtSupport::BaseQtVersion::QmakeBuildConfigs, QString> result =
- QtSupport::QtVersionManager::scanMakeFile(makefile, version->defaultBuildConfig());
+ QPair<BaseQtVersion::QmakeBuildConfigs, QString> result =
+ QtVersionManager::scanMakeFile(makefile, version->defaultBuildConfig());
if (qmakeBuildConfiguration() == result.first) {
// The qmake Build Configuration are the same,
// now compare arguments lists
@@ -377,17 +378,17 @@ Qt4BuildConfiguration::MakefileState Qt4BuildConfiguration::compareToImportFrom(
// are not interested in), splitting them up into individual strings:
extractSpecFromArguments(&userArgs, workingDirectory, version, &actualArgs);
actualArgs = qs->deducedArguments() + actualArgs + qs->deducedArgumentsAfter();
- Utils::FileName actualSpec = qs->mkspec();
+ FileName actualSpec = qs->mkspec();
QString qmakeArgs = result.second;
QStringList parsedArgs;
- Utils::FileName parsedSpec = extractSpecFromArguments(&qmakeArgs, workingDirectory, version, &parsedArgs);
+ FileName parsedSpec = extractSpecFromArguments(&qmakeArgs, workingDirectory, version, &parsedArgs);
if (debug) {
- qDebug()<<"Actual args:"<<actualArgs;
- qDebug()<<"Parsed args:"<<parsedArgs;
- qDebug()<<"Actual spec:"<<actualSpec.toString();
- qDebug()<<"Parsed spec:"<<parsedSpec.toString();
+ qDebug() << "Actual args:" << actualArgs;
+ qDebug() << "Parsed args:" << parsedArgs;
+ qDebug() << "Actual spec:" << actualSpec.toString();
+ qDebug() << "Parsed spec:" << parsedSpec.toString();
}
// Comparing the sorted list is obviously wrong
@@ -411,20 +412,22 @@ Qt4BuildConfiguration::MakefileState Qt4BuildConfiguration::compareToImportFrom(
if (actualSpec == parsedSpec)
return MakefileMatches;
// Actual spec is the default one
-// qDebug()<<"AS vs VS"<<actualSpec<<version->mkspec();
- if ((actualSpec == version->mkspec() || actualSpec == Utils::FileName::fromString(QLatin1String("default")))
- && (parsedSpec == version->mkspec() || parsedSpec == Utils::FileName::fromString(QLatin1String("default")) || parsedSpec.isEmpty()))
+// qDebug() << "AS vs VS" << actualSpec << version->mkspec();
+ if ((actualSpec == version->mkspec() || actualSpec == FileName::fromString(QLatin1String("default")))
+ && (parsedSpec == version->mkspec() || parsedSpec == FileName::fromString(QLatin1String("default")) || parsedSpec.isEmpty()))
return MakefileMatches;
}
return MakefileIncompatible;
} else {
if (debug)
- qDebug()<<"different qmake buildconfigurations buildconfiguration:"<<qmakeBuildConfiguration()<<" Makefile:"<<result.first;
+ qDebug() << "different qmake buildconfigurations buildconfiguration:"
+ << qmakeBuildConfiguration() << " Makefile:" << result.first;
return MakefileIncompatible;
}
} else {
if (debug)
- qDebug() << "different Qt versions, buildconfiguration:" << version->qmakeCommand().toString() << " Makefile:"<< qmakePath.toString();
+ qDebug() << "different Qt versions, buildconfiguration:" << version->qmakeCommand().toString()
+ << " Makefile:"<< qmakePath.toString();
return MakefileForWrongProject;
}
}
@@ -434,7 +437,7 @@ Qt4BuildConfiguration::MakefileState Qt4BuildConfiguration::compareToImportFrom(
bool Qt4BuildConfiguration::removeQMLInspectorFromArguments(QString *args)
{
bool removedArgument = false;
- for (Utils::QtcProcess::ArgIterator ait(args); ait.next(); ) {
+ for (QtcProcess::ArgIterator ait(args); ait.next(); ) {
const QString arg = ait.value();
if (arg.contains(QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH))
|| arg.contains(QLatin1String(Constants::QMAKEVAR_DECLARATIVE_DEBUG4))
@@ -446,21 +449,21 @@ bool Qt4BuildConfiguration::removeQMLInspectorFromArguments(QString *args)
return removedArgument;
}
-Utils::FileName Qt4BuildConfiguration::extractSpecFromArguments(QString *args,
- const QString &directory, const QtSupport::BaseQtVersion *version,
- QStringList *outArgs)
+FileName Qt4BuildConfiguration::extractSpecFromArguments(QString *args,
+ const QString &directory, const BaseQtVersion *version,
+ QStringList *outArgs)
{
- Utils::FileName parsedSpec;
+ FileName parsedSpec;
bool ignoreNext = false;
bool nextIsSpec = false;
- for (Utils::QtcProcess::ArgIterator ait(args); ait.next(); ) {
+ for (QtcProcess::ArgIterator ait(args); ait.next(); ) {
if (ignoreNext) {
ignoreNext = false;
ait.deleteArg();
} else if (nextIsSpec) {
nextIsSpec = false;
- parsedSpec = Utils::FileName::fromUserInput(ait.value());
+ parsedSpec = FileName::fromUserInput(ait.value());
ait.deleteArg();
} else if (ait.value() == QLatin1String("-spec") || ait.value() == QLatin1String("-platform")) {
nextIsSpec = true;
@@ -480,9 +483,9 @@ Utils::FileName Qt4BuildConfiguration::extractSpecFromArguments(QString *args,
}
if (parsedSpec.isEmpty())
- return Utils::FileName();
+ return FileName();
- Utils::FileName baseMkspecDir = Utils::FileName::fromUserInput(
+ FileName baseMkspecDir = FileName::fromUserInput(
version->qmakeProperty("QT_HOST_DATA") + QLatin1String("/mkspecs"));
baseMkspecDir = Utils::FileName::fromString(baseMkspecDir.toFileInfo().canonicalFilePath());
@@ -493,23 +496,23 @@ Utils::FileName Qt4BuildConfiguration::extractSpecFromArguments(QString *args,
// for the other one we don't need to do anything
if (parsedSpec.toFileInfo().isRelative()) {
if (QFileInfo(directory + QLatin1Char('/') + parsedSpec.toString()).exists()) {
- parsedSpec = Utils::FileName::fromUserInput(directory + QLatin1Char('/') + parsedSpec.toString());
+ parsedSpec = FileName::fromUserInput(directory + QLatin1Char('/') + parsedSpec.toString());
} else {
- parsedSpec = Utils::FileName::fromUserInput(baseMkspecDir.toString() + QLatin1Char('/') + parsedSpec.toString());
+ parsedSpec = FileName::fromUserInput(baseMkspecDir.toString() + QLatin1Char('/') + parsedSpec.toString());
}
}
QFileInfo f2 = parsedSpec.toFileInfo();
while (f2.isSymLink()) {
- parsedSpec = Utils::FileName::fromString(f2.symLinkTarget());
+ parsedSpec = FileName::fromString(f2.symLinkTarget());
f2.setFile(parsedSpec.toString());
}
if (parsedSpec.isChildOf(baseMkspecDir)) {
parsedSpec = parsedSpec.relativeChildPath(baseMkspecDir);
} else {
- Utils::FileName sourceMkSpecPath = Utils::FileName::fromString(version->sourcePath().toString()
- + QLatin1String("/mkspecs"));
+ FileName sourceMkSpecPath = FileName::fromString(version->sourcePath().toString()
+ + QLatin1String("/mkspecs"));
if (parsedSpec.isChildOf(sourceMkSpecPath)) {
parsedSpec = parsedSpec.relativeChildPath(sourceMkSpecPath);
}
@@ -517,7 +520,7 @@ Utils::FileName Qt4BuildConfiguration::extractSpecFromArguments(QString *args,
return parsedSpec;
}
-ProjectExplorer::IOutputParser *Qt4BuildConfiguration::createOutputParser() const
+IOutputParser *Qt4BuildConfiguration::createOutputParser() const
{
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
return tc ? tc->outputParser() : 0;
@@ -548,11 +551,11 @@ void Qt4BuildConfiguration::setEnabled(bool enabled)
*/
Qt4BuildConfigurationFactory::Qt4BuildConfigurationFactory(QObject *parent) :
- ProjectExplorer::IBuildConfigurationFactory(parent)
+ IBuildConfigurationFactory(parent)
{
update();
- QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
+ QtVersionManager *vm = QtVersionManager::instance();
connect(vm, SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
this, SLOT(update()));
}
@@ -594,12 +597,12 @@ bool Qt4BuildConfigurationFactory::canCreate(const Target *parent, const Core::I
return id == QT4_BC_ID;
}
-BuildConfiguration *Qt4BuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name)
+BuildConfiguration *Qt4BuildConfigurationFactory::create(Target *parent, const Core::Id id, const QString &name)
{
if (!canCreate(parent, id))
return 0;
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(parent->kit());
+ BaseQtVersion *version = QtKitInformation::qtVersion(parent->kit());
Q_ASSERT(version);
bool ok = true;
@@ -626,7 +629,7 @@ BuildConfiguration *Qt4BuildConfigurationFactory::create(ProjectExplorer::Target
if (buildConfigurationName != version->displayName())
customSecondName = tr("%1 Release").arg(buildConfigurationName);
- if (!(version->defaultBuildConfig() & QtSupport::BaseQtVersion::DebugBuild)) {
+ if (!(version->defaultBuildConfig() & BaseQtVersion::DebugBuild)) {
qSwap(defaultFirstName, defaultSecondName);
qSwap(customFirstName, customSecondName);
}
@@ -636,12 +639,12 @@ BuildConfiguration *Qt4BuildConfigurationFactory::create(ProjectExplorer::Target
version->defaultBuildConfig(), QString(), QString(), false);
parent->addBuildConfiguration(
Qt4BuildConfiguration::setup(parent, defaultSecondName, customSecondName,
- (version->defaultBuildConfig() ^ QtSupport::BaseQtVersion::DebugBuild),
+ (version->defaultBuildConfig() ^ BaseQtVersion::DebugBuild),
QString(), QString(), false));
return bc;
}
-bool Qt4BuildConfigurationFactory::canClone(const Target *parent, ProjectExplorer::BuildConfiguration *source) const
+bool Qt4BuildConfigurationFactory::canClone(const Target *parent, BuildConfiguration *source) const
{
return canHandle(parent) && qobject_cast<Qt4BuildConfiguration *>(source);
}
@@ -672,20 +675,20 @@ BuildConfiguration *Qt4BuildConfigurationFactory::restore(Target *parent, const
return 0;
}
-QList<BuildConfigurationInfo> Qt4BuildConfigurationFactory::availableBuildConfigurations(const ProjectExplorer::Kit *k,
+QList<BuildConfigurationInfo> Qt4BuildConfigurationFactory::availableBuildConfigurations(const Kit *k,
const QString &proFilePath)
{
QList<BuildConfigurationInfo> infoList;
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
+ BaseQtVersion *version = QtKitInformation::qtVersion(k);
if (!version || !version->isValid())
return infoList;
- QtSupport::BaseQtVersion::QmakeBuildConfigs config = version->defaultBuildConfig();
+ BaseQtVersion::QmakeBuildConfigs config = version->defaultBuildConfig();
BuildConfigurationInfo info = BuildConfigurationInfo(config, QString(), QString(), false);
info.directory = Qt4Project::shadowBuildDirectory(proFilePath, k, buildConfigurationDisplayName(info));
infoList.append(info);
- info.buildConfig = config ^ QtSupport::BaseQtVersion::DebugBuild;
+ info.buildConfig = config ^ BaseQtVersion::DebugBuild;
info.directory = Qt4Project::shadowBuildDirectory(proFilePath, k, buildConfigurationDisplayName(info));
infoList.append(info);
return infoList;
@@ -694,7 +697,7 @@ QList<BuildConfigurationInfo> Qt4BuildConfigurationFactory::availableBuildConfig
// Return name of a build configuration.
QString Qt4BuildConfigurationFactory::buildConfigurationDisplayName(const BuildConfigurationInfo &info)
{
- return (info.buildConfig & QtSupport::BaseQtVersion::DebugBuild) ?
+ return (info.buildConfig & BaseQtVersion::DebugBuild) ?
//: Name of a debug build configuration to created by a project wizard. We recommend not translating it.
tr("Debug") :
//: Name of a release build configuration to be created by a project wizard. We recommend not translating it.
@@ -703,7 +706,7 @@ QString Qt4BuildConfigurationFactory::buildConfigurationDisplayName(const BuildC
BuildConfiguration::BuildType Qt4BuildConfiguration::buildType() const
{
- if (qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild)
+ if (qmakeBuildConfiguration() & BaseQtVersion::DebugBuild)
return Debug;
else
return Release;
@@ -711,21 +714,19 @@ BuildConfiguration::BuildType Qt4BuildConfiguration::buildType() const
Qt4BuildConfiguration *Qt4BuildConfiguration::setup(Target *t, QString defaultDisplayName,
QString displayName,
- QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
+ BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
QString additionalArguments, QString directory,
bool importing)
{
- bool debug = qmakeBuildConfiguration & QtSupport::BaseQtVersion::DebugBuild;
+ bool debug = qmakeBuildConfiguration & BaseQtVersion::DebugBuild;
- // Add the buildconfiguration
+ // Add the build configuration.
Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(t);
bc->setDefaultDisplayName(defaultDisplayName);
bc->setDisplayName(displayName);
- ProjectExplorer::BuildStepList *buildSteps =
- bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
- ProjectExplorer::BuildStepList *cleanSteps =
- bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
+ BuildStepList *buildSteps = bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
+ BuildStepList *cleanSteps = bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
Q_ASSERT(buildSteps);
Q_ASSERT(cleanSteps);
@@ -735,7 +736,7 @@ Qt4BuildConfiguration *Qt4BuildConfiguration::setup(Target *t, QString defaultDi
MakeStep *makeStep = new MakeStep(buildSteps);
buildSteps->insertStep(1, makeStep);
- MakeStep* cleanStep = new MakeStep(cleanSteps);
+ MakeStep *cleanStep = new MakeStep(cleanSteps);
cleanStep->setClean(true);
cleanStep->setUserArguments(QLatin1String("clean"));
cleanSteps->insertStep(0, cleanStep);
@@ -747,8 +748,8 @@ Qt4BuildConfiguration *Qt4BuildConfiguration::setup(Target *t, QString defaultDi
if (importing)
qmakeStep->setLinkQmlDebuggingLibrary(enableQmlDebugger);
- // set some options for qmake and make
- if (qmakeBuildConfiguration & QtSupport::BaseQtVersion::BuildAll) // debug_and_release => explicit targets
+ // Set some options for qmake and make.
+ if (qmakeBuildConfiguration & BaseQtVersion::BuildAll) // debug_and_release => explicit targets
makeStep->setUserArguments(debug ? QLatin1String("debug") : QLatin1String("release"));
bc->setQMakeBuildConfiguration(qmakeBuildConfiguration);
@@ -758,3 +759,5 @@ Qt4BuildConfiguration *Qt4BuildConfiguration::setup(Target *t, QString defaultDi
return bc;
}
+
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp
index 02b573e2b5..82bd9351e9 100644
--- a/src/plugins/qt4projectmanager/qt4nodes.cpp
+++ b/src/plugins/qt4projectmanager/qt4nodes.cpp
@@ -57,6 +57,7 @@
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/stringutils.h>
#include <utils/fileutils.h>
@@ -337,10 +338,8 @@ struct InternalNode
fileWithoutPrefix = file;
}
QStringList parts = fileWithoutPrefix.toString().split(separator, QString::SkipEmptyParts);
-#ifndef Q_OS_WIN
- if (!isRelative && parts.count() > 0)
+ if (!Utils::HostOsInfo::isWindowsHost() && !isRelative && parts.count() > 0)
parts[0].prepend(separator);
-#endif
QStringListIterator it(parts);
InternalNode *currentNode = this;
QString path = (isRelative ? (projectDirFileName.toString() + QLatin1Char('/')) : QString());
@@ -1391,28 +1390,19 @@ TargetInformation Qt4ProFileNode::targetInformation(const QString &fileName) con
QString Qt4ProFileNode::makefile() const
{
- if (m_varValues[Makefile].isEmpty())
- return QString();
- return m_varValues[Makefile].first();
+ return singleVariableValue(Makefile);
}
QString Qt4ProFileNode::objectExtension() const
{
- if (m_varValues[ObjectExt].isEmpty()) {
-#ifdef Q_OS_WIN
- return QLatin1String(".obj");
-#else
- return QLatin1String(".o");
-#endif
- }
+ if (m_varValues[ObjectExt].isEmpty())
+ return Utils::HostOsInfo::isWindowsHost() ? QLatin1String(".obj") : QLatin1String(".o");
return m_varValues[ObjectExt].first();
}
QString Qt4ProFileNode::objectsDirectory() const
{
- if (m_varValues[ObjectsDir].isEmpty())
- return QString();
- return m_varValues[ObjectsDir].first();
+ return singleVariableValue(ObjectsDir);
}
QByteArray Qt4ProFileNode::cxxDefines() const
@@ -1919,7 +1909,6 @@ void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async)
m_subProjectsNotToDeploy = subProjectsNotToDeploy;
setupInstallsList(m_readerExact);
- setupProjectVersion(m_readerExact);
// update other variables
QHash<Qt4Variable, QStringList> newVarValues;
@@ -2250,13 +2239,12 @@ TargetInformation Qt4ProFileNode::targetInformation(QtSupport::ProFileReader *re
if (result.target.isEmpty())
result.target = QFileInfo(m_projectFilePath).baseName();
-#if defined (Q_OS_MAC)
- if (reader->values(QLatin1String("CONFIG")).contains(QLatin1String("app_bundle"))) {
+ if (Utils::HostOsInfo::isMacHost()
+ && reader->values(QLatin1String("CONFIG")).contains(QLatin1String("app_bundle"))) {
result.workingDir += QLatin1Char('/')
+ result.target
+ QLatin1String(".app/Contents/MacOS");
}
-#endif
result.workingDir = QDir::cleanPath(result.workingDir);
@@ -2283,9 +2271,7 @@ TargetInformation Qt4ProFileNode::targetInformation(QtSupport::ProFileReader *re
result.executable = QDir::cleanPath(wd + QLatin1Char('/') + result.target);
//qDebug() << "##### updateTarget sets:" << result.workingDir << result.executable;
-#if defined (Q_OS_WIN)
- result.executable += QLatin1String(".exe");
-#endif
+ Utils::HostOsInfo::appendExecutableSuffix(result.executable);
result.valid = true;
return result;
}
@@ -2343,59 +2329,6 @@ void Qt4ProFileNode::setupInstallsList(const QtSupport::ProFileReader *reader)
}
}
-void Qt4ProFileNode::setupProjectVersion(const QtSupport::ProFileReader *reader)
-{
- m_projectVersion.major = m_projectVersion.minor = m_projectVersion.patch = -1;
- bool ok;
- int val = reader->value(QLatin1String("VER_MAJ")).toInt(&ok);
- if (ok)
- m_projectVersion.major = val;
- val = reader->value(QLatin1String("VER_MIN")).toInt(&ok);
- if (ok)
- m_projectVersion.minor = val;
- val = reader->value(QLatin1String("VER_PAT")).toInt(&ok);
- if (ok)
- m_projectVersion.patch = val;
- if (m_projectVersion.major != -1 && m_projectVersion.minor != -1
- && m_projectVersion.patch != -1) {
- return;
- }
-
- const QString &version = reader->value(QLatin1String("VERSION"));
- const QChar dot(QLatin1Char('.'));
- int dotIndex = version.indexOf(dot);
- if (m_projectVersion.major == -1) {
- val = version.left(dotIndex).toInt(&ok);
- if (ok)
- m_projectVersion.major = val;
- }
- if (dotIndex != -1) {
- int numberStartIndex = dotIndex + 1;
- dotIndex = version.indexOf(dot, numberStartIndex);
- if (m_projectVersion.minor == -1) {
- val = version.mid(numberStartIndex, dotIndex - numberStartIndex).toInt(&ok);
- if (ok)
- m_projectVersion.minor = val;
- }
- }
- if (dotIndex != -1) {
- int numberStartIndex = dotIndex + 1;
- dotIndex = version.indexOf(dot, numberStartIndex);
- if (m_projectVersion.patch == -1) {
- val = version.mid(numberStartIndex, dotIndex - numberStartIndex).toInt(&ok);
- if (ok)
- m_projectVersion.patch= val;
- }
- }
-
- if (m_projectVersion.major == -1)
- m_projectVersion.major = 1;
- if (m_projectVersion.minor == -1)
- m_projectVersion.minor = 0;
- if (m_projectVersion.patch == -1)
- m_projectVersion.patch = 0;
-}
-
InstallsList Qt4ProFileNode::installsList() const
{
return m_installsList;
diff --git a/src/plugins/qt4projectmanager/qt4nodes.h b/src/plugins/qt4projectmanager/qt4nodes.h
index 609b8333d9..36ca6b4f18 100644
--- a/src/plugins/qt4projectmanager/qt4nodes.h
+++ b/src/plugins/qt4projectmanager/qt4nodes.h
@@ -381,7 +381,6 @@ public:
TargetInformation targetInformation() const;
InstallsList installsList() const;
- ProjectVersion projectVersion() const { return m_projectVersion; }
QString makefile() const;
QString objectExtension() const;
@@ -434,7 +433,6 @@ private:
TargetInformation targetInformation(QtSupport::ProFileReader *reader) const;
void setupInstallsList(const QtSupport::ProFileReader *reader);
- void setupProjectVersion(const QtSupport::ProFileReader *reader);
Qt4ProjectType m_projectType;
Qt4VariablesHash m_varValues;
@@ -445,7 +443,6 @@ private:
QString m_resolvedMkspecPath;
QStringList m_subProjectsNotToDeploy;
InstallsList m_installsList;
- ProjectVersion m_projectVersion;
friend class Qt4NodeHierarchy;
bool m_validParse;
diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp
index 0a7f01e5a3..9771a0dd98 100644
--- a/src/plugins/qt4projectmanager/qt4project.cpp
+++ b/src/plugins/qt4projectmanager/qt4project.cpp
@@ -937,7 +937,7 @@ void Qt4Project::proFileParseError(const QString &errorMessage)
QtSupport::ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4ProFileNode, Qt4BuildConfiguration *bc)
{
if (!m_qmakeGlobals) {
- m_qmakeGlobals = new QMakeGlobals;
+ m_qmakeGlobals = new ProFileGlobals;
m_qmakeGlobalsRefCnt = 0;
Kit *k;
@@ -949,12 +949,10 @@ QtSupport::ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4Pro
if (bc) {
k = bc->target()->kit();
env = bc->environment();
- if (bc->qmakeStep()) {
+ if (bc->qmakeStep())
qmakeArgs = bc->qmakeStep()->parserArguments();
- m_qmakeGlobals->qmakespec = m_qmakeGlobals->xqmakespec = bc->qmakeStep()->mkspec().toString();
- } else {
+ else
qmakeArgs = bc->configCommandLineArguments();
- }
} else {
k = KitManager::instance()->defaultKit();
}
@@ -974,7 +972,7 @@ QtSupport::ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4Pro
for (; eit != eend; ++eit)
m_qmakeGlobals->environment.insert(env.key(eit), env.value(eit));
- m_qmakeGlobals->setCommandLineArguments(qmakeArgs);
+ m_qmakeGlobals->setCommandLineArguments(m_rootProjectNode->buildDir(), qmakeArgs);
QtSupport::ProFileCacheManager::instance()->incRefCount();
}
@@ -987,7 +985,7 @@ QtSupport::ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4Pro
return reader;
}
-QMakeGlobals *Qt4Project::qmakeGlobals()
+ProFileGlobals *Qt4Project::qmakeGlobals()
{
return m_qmakeGlobals;
}
diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h
index a814cbce1d..3f642a13f7 100644
--- a/src/plugins/qt4projectmanager/qt4project.h
+++ b/src/plugins/qt4projectmanager/qt4project.h
@@ -42,7 +42,7 @@
#include <QFuture>
QT_BEGIN_NAMESPACE
-class QMakeGlobals;
+class ProFileGlobals;
QT_END_NAMESPACE
namespace ProjectExplorer { class DeploymentData; }
@@ -104,7 +104,7 @@ public:
/// \internal
QtSupport::ProFileReader *createProFileReader(Qt4ProFileNode *qt4ProFileNode, Qt4BuildConfiguration *bc = 0);
/// \internal
- QMakeGlobals *qmakeGlobals();
+ ProFileGlobals *qmakeGlobals();
/// \internal
void destroyProFileReader(QtSupport::ProFileReader *reader);
@@ -195,7 +195,7 @@ private:
Internal::Qt4ProjectFiles *m_projectFiles;
// cached data during project rescan
- QMakeGlobals *m_qmakeGlobals;
+ ProFileGlobals *m_qmakeGlobals;
int m_qmakeGlobalsRefCnt;
QTimer m_asyncUpdateTimer;
diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.qbs b/src/plugins/qt4projectmanager/qt4projectmanager.qbs
index e8421967b5..2a7584399f 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanager.qbs
+++ b/src/plugins/qt4projectmanager/qt4projectmanager.qbs
@@ -17,35 +17,30 @@ QtcPlugin {
Depends { name: "TextEditor" }
Depends { name: "cpp" }
- cpp.defines: {
- return base.concat([
- "PROPARSER_AS_LIBRARY",
- "PROPARSER_THREAD_SAFE",
- "PROEVALUATOR_THREAD_SAFE",
- "PROEVALUATOR_CUMULATIVE"
- ])
- }
- cpp.includePaths: [
- ".",
- "..",
- buildDirectory,
+ cpp.defines: base.concat([
+ "PROPARSER_AS_LIBRARY",
+ "PROPARSER_THREAD_SAFE",
+ "PROEVALUATOR_THREAD_SAFE",
+ "PROEVALUATOR_CUMULATIVE"
+ ])
+ cpp.includePaths: base.concat([
"customwidgetwizard",
- "../../libs",
"../../shared",
- ]
+ ])
files: [
"Qt4ProjectManager.mimetypes.xml",
- "librarydetailswidget.ui",
- "qt4projectmanager.qrc",
"addlibrarywizard.cpp",
"addlibrarywizard.h",
+ "buildconfigurationinfo.h",
"externaleditors.cpp",
"externaleditors.h",
"findqt4profiles.cpp",
"findqt4profiles.h",
"librarydetailscontroller.cpp",
"librarydetailscontroller.h",
+ "librarydetailswidget.ui",
+ "makestep.cpp",
"makestep.h",
"makestep.ui",
"profilecompletionassist.cpp",
@@ -60,12 +55,12 @@ QtcPlugin {
"profilehoverhandler.h",
"profilekeywords.cpp",
"profilekeywords.h",
- "qmakeparser.cpp",
- "qmakeparser.h",
"qmakekitconfigwidget.cpp",
"qmakekitconfigwidget.h",
"qmakekitinformation.cpp",
"qmakekitinformation.h",
+ "qmakeparser.cpp",
+ "qmakeparser.h",
"qmakerunconfigurationfactory.cpp",
"qmakerunconfigurationfactory.h",
"qmakestep.cpp",
@@ -73,12 +68,16 @@ QtcPlugin {
"qmakestep.ui",
"qt4buildconfiguration.cpp",
"qt4buildconfiguration.h",
+ "qt4nodes.cpp",
"qt4nodes.h",
"qt4project.cpp",
"qt4project.h",
"qt4projectconfigwidget.cpp",
"qt4projectconfigwidget.h",
"qt4projectconfigwidget.ui",
+ "qt4projectmanager.cpp",
+ "qt4projectmanager.h",
+ "qt4projectmanager.qrc",
"qt4projectmanager_global.h",
"qt4projectmanagerconstants.h",
"qt4projectmanagerplugin.cpp",
@@ -95,22 +94,17 @@ QtcPlugin {
"winceqtversion.h",
"winceqtversionfactory.cpp",
"winceqtversionfactory.h",
- "buildconfigurationinfo.h",
- "makestep.cpp",
- "qt4nodes.cpp",
- "qt4projectmanager.cpp",
- "qt4projectmanager.h",
- "customwidgetwizard/classdefinition.ui",
- "customwidgetwizard/customwidgetpluginwizardpage.ui",
- "customwidgetwizard/customwidgetwidgetswizardpage.ui",
"customwidgetwizard/classdefinition.cpp",
"customwidgetwizard/classdefinition.h",
+ "customwidgetwizard/classdefinition.ui",
"customwidgetwizard/classlist.cpp",
"customwidgetwizard/classlist.h",
"customwidgetwizard/customwidgetpluginwizardpage.cpp",
"customwidgetwizard/customwidgetpluginwizardpage.h",
+ "customwidgetwizard/customwidgetpluginwizardpage.ui",
"customwidgetwizard/customwidgetwidgetswizardpage.cpp",
"customwidgetwizard/customwidgetwidgetswizardpage.h",
+ "customwidgetwizard/customwidgetwidgetswizardpage.ui",
"customwidgetwizard/customwidgetwizard.cpp",
"customwidgetwizard/customwidgetwizard.h",
"customwidgetwizard/customwidgetwizarddialog.cpp",
@@ -137,8 +131,6 @@ QtcPlugin {
"qt-desktop/simulatorqtversion.h",
"qt-desktop/simulatorqtversionfactory.cpp",
"qt-desktop/simulatorqtversionfactory.h",
- "wizards/testwizardpage.ui",
- "wizards/wizards.qrc",
"wizards/abstractmobileapp.cpp",
"wizards/abstractmobileapp.h",
"wizards/abstractmobileappwizard.cpp",
@@ -164,6 +156,9 @@ QtcPlugin {
"wizards/html5appwizardpages.cpp",
"wizards/html5appwizardpages.h",
"wizards/html5appwizardsourcespage.ui",
+ "wizards/importwidget.cpp",
+ "wizards/importwidget.h",
+ "wizards/libraryparameters.cpp",
"wizards/libraryparameters.h",
"wizards/librarywizard.cpp",
"wizards/librarywizard.h",
@@ -202,19 +197,18 @@ QtcPlugin {
"wizards/subdirsprojectwizarddialog.h",
"wizards/targetsetuppage.cpp",
"wizards/targetsetuppage.h",
- "wizards/importwidget.cpp",
- "wizards/importwidget.h",
"wizards/testwizard.cpp",
"wizards/testwizard.h",
"wizards/testwizarddialog.cpp",
"wizards/testwizarddialog.h",
"wizards/testwizardpage.cpp",
"wizards/testwizardpage.h",
- "wizards/libraryparameters.cpp",
+ "wizards/testwizardpage.ui",
+ "wizards/wizards.qrc",
"wizards/images/console.png",
"wizards/images/gui.png",
"wizards/images/html5app.png",
"wizards/images/lib.png",
- "wizards/images/qtquickapp.png"
+ "wizards/images/qtquickapp.png",
]
}
diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
index 20cbcff62b..9605936575 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
+++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
@@ -77,6 +77,7 @@
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorconstants.h>
#include <texteditor/texteditorsettings.h>
+#include <utils/hostosinfo.h>
#include <utils/parameteraction.h>
#ifdef WITH_TESTS
@@ -152,11 +153,10 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
addAutoReleasedObject(new Qt4BuildConfigurationFactory);
addAutoReleasedObject(new Qt4RunConfigurationFactory);
-#ifdef Q_OS_MAC
- addAutoReleasedObject(new MacDesignerExternalEditor);
-#else
- addAutoReleasedObject(new DesignerExternalEditor);
-#endif
+ if (Utils::HostOsInfo::isMacHost())
+ addAutoReleasedObject(new MacDesignerExternalEditor);
+ else
+ addAutoReleasedObject(new DesignerExternalEditor);
addAutoReleasedObject(new LinguistExternalEditor);
addAutoReleasedObject(new DesktopQtVersionFactory);
diff --git a/src/plugins/qt4projectmanager/qt4targetsetupwidget.cpp b/src/plugins/qt4projectmanager/qt4targetsetupwidget.cpp
index e70200ca6d..13d3027c24 100644
--- a/src/plugins/qt4projectmanager/qt4targetsetupwidget.cpp
+++ b/src/plugins/qt4projectmanager/qt4targetsetupwidget.cpp
@@ -41,6 +41,7 @@
#include <utils/detailsbutton.h>
#include <utils/detailswidget.h>
+#include <utils/hostosinfo.h>
#include <utils/pathchooser.h>
#include <QCheckBox>
@@ -92,9 +93,8 @@ Qt4TargetSetupWidget::Qt4TargetSetupWidget(ProjectExplorer::Kit *k,
QWidget *w = new QWidget;
m_newBuildsLayout = new QGridLayout;
m_newBuildsLayout->setMargin(0);
-#ifdef Q_OS_MAC
- m_newBuildsLayout->setSpacing(0);
-#endif
+ if (Utils::HostOsInfo::isMacHost())
+ m_newBuildsLayout->setSpacing(0);
w->setLayout(m_newBuildsLayout);
layout->addWidget(w);
diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp b/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp
index 1e7185f8cd..5cb66b1d7a 100644
--- a/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp
+++ b/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp
@@ -279,8 +279,8 @@ QByteArray AbstractMobileApp::generateProFile(QString *errorMessage) const
out << line << endl;
};
- proFileContent.replace("../shared/" + DeploymentPriFileName.toAscii(),
- DeploymentPriFileName.toAscii());
+ proFileContent.replace("../shared/" + DeploymentPriFileName.toLatin1(),
+ DeploymentPriFileName.toLatin1());
return proFileContent;
}
@@ -437,7 +437,7 @@ QByteArray AbstractMobileApp::generateFile(int fileType,
const QString versionLine =
comment + sep + FileChecksum + sep + checkSumString
+ sep + FileStubVersion + sep + versionString + QLatin1Char('\x0A');
- return versionLine.toAscii() + data;
+ return versionLine.toLatin1() + data;
}
int AbstractMobileApp::makeStubVersion(int minor)
diff --git a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp
index 23eb04d381..d75461aad3 100644
--- a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp
+++ b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp
@@ -149,7 +149,7 @@ static inline bool generateFormClass(const GuiAppParameters &params,
}
}
if (headerContents.isEmpty() || sourceContents.isEmpty()) {
- *errorMessage = QString::fromAscii("Failed to obtain Designer plugin code generation service.");
+ *errorMessage = QString::fromLatin1("Failed to obtain Designer plugin code generation service.");
return false;
}
diff --git a/src/plugins/qt4projectmanager/wizards/mobileappwizardpages.cpp b/src/plugins/qt4projectmanager/wizards/mobileappwizardpages.cpp
index 2d3d164664..d523123ca0 100644
--- a/src/plugins/qt4projectmanager/wizards/mobileappwizardpages.cpp
+++ b/src/plugins/qt4projectmanager/wizards/mobileappwizardpages.cpp
@@ -153,7 +153,7 @@ public:
saver.setAutoRemove(false);
if (!saver.hasError())
saver.setResult(m_pixmap.save(
- saver.file(), QFileInfo(m_iconPath).suffix().toAscii().constData()));
+ saver.file(), QFileInfo(m_iconPath).suffix().toLatin1().constData()));
if (!saver.finalize()) {
QMessageBox::critical(QApplication::activeWindow(),
tr("File Error"),
diff --git a/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp b/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp
index ff60f2a076..9044a7f501 100644
--- a/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp
+++ b/src/plugins/qt4projectmanager/wizards/qtquickapp.cpp
@@ -42,53 +42,6 @@
namespace Qt4ProjectManager {
namespace Internal {
-const QString qmldir(QLatin1String("qmldir"));
-const QString qmldir_plugin(QLatin1String("plugin"));
-
-QmlModule::QmlModule(const QString &uri, const QFileInfo &rootDir, const QFileInfo &qmldir,
- bool isExternal, QtQuickApp *qtQuickApp)
- : uri(uri)
- , rootDir(rootDir)
- , qmldir(qmldir)
- , isExternal(isExternal)
- , qtQuickApp(qtQuickApp)
-{}
-
-QString QmlModule::path(Path path) const
-{
- switch (path) {
- case Root: {
- return rootDir.canonicalFilePath();
- }
- case ContentDir: {
- const QDir proFile(qtQuickApp->path(QtQuickApp::AppProPath));
- return proFile.relativeFilePath(qmldir.canonicalPath());
- }
- case ContentBase: {
- const QString localRoot = rootDir.canonicalFilePath() + QLatin1Char('/');
- QDir contentDir = qmldir.dir();
- contentDir.cdUp();
- const QString localContentDir = contentDir.canonicalPath();
- return localContentDir.right(localContentDir.length() - localRoot.length());
- }
- case DeployedContentBase: {
- const QString modulesDir = qtQuickApp->path(QtQuickApp::ModulesDir);
- return modulesDir + QLatin1Char('/') + this->path(ContentBase);
- }
- default: qFatal("QmlModule::path() needs more work");
- }
- return QString();
-}
-
-QmlCppPlugin::QmlCppPlugin(const QString &name, const QFileInfo &path,
- const QmlModule *module, const QFileInfo &proFile)
- : name(name)
- , path(path)
- , module(module)
- , proFile(proFile)
-{
-}
-
QtQuickApp::QtQuickApp()
: AbstractMobileApp()
, m_mainQmlMode(ModeGenerate)
@@ -97,11 +50,6 @@ QtQuickApp::QtQuickApp()
m_canSupportMeegoBooster = true;
}
-QtQuickApp::~QtQuickApp()
-{
- clearModulesAndPlugins();
-}
-
void QtQuickApp::setComponentSet(ComponentSet componentSet)
{
m_componentSet = componentSet;
@@ -124,47 +72,6 @@ QtQuickApp::Mode QtQuickApp::mainQmlMode() const
return m_mainQmlMode;
}
-bool QtQuickApp::setExternalModules(const QStringList &uris,
- const QStringList &importPaths)
-{
- clearModulesAndPlugins();
- m_importPaths.clear();
- foreach (const QFileInfo &importPath, importPaths) {
- if (!importPath.exists()) {
- m_error = QCoreApplication::translate(
- "Qt4ProjectManager::Internal::QtQuickApp",
- "The QML import path '%1' cannot be found.")
- .arg(QDir::toNativeSeparators(importPath.filePath()));
- return false;
- } else {
- m_importPaths.append(importPath.canonicalFilePath());
- }
- }
- foreach (const QString &uri, uris) {
- QString uriPath = uri;
- uriPath.replace(QLatin1Char('.'), QLatin1Char('/'));
- const int modulesCount = m_modules.count();
- foreach (const QFileInfo &importPath, m_importPaths) {
- const QFileInfo qmlDirFile(
- importPath.absoluteFilePath() + QLatin1Char('/')
- + uriPath + QLatin1Char('/') + qmldir);
- if (qmlDirFile.exists()) {
- if (!addExternalModule(uri, importPath, qmlDirFile))
- return false;
- break;
- }
- }
- if (modulesCount == m_modules.count()) { // no module was added
- m_error = QCoreApplication::translate(
- "Qt4ProjectManager::Internal::QtQuickApp",
- "The QML module '%1' cannot be found.").arg(uri);
- return false;
- }
- }
- m_error.clear();
- return true;
-}
-
QString QtQuickApp::pathExtended(int fileType) const
{
const bool importQmlFile = m_mainQmlMode == ModeImport;
@@ -199,7 +106,6 @@ QString QtQuickApp::pathExtended(int fileType) const
case QmlDir: return pathBase + qmlSubDir;
case QmlDirProFileRelative: return importQmlFile ? appProFilePath.relativeFilePath(m_mainQmlFile.canonicalPath())
: QString(qmlSubDir).remove(qmlSubDir.length() - 1, 1);
- case ModulesDir: return QLatin1String("modules");
default: qFatal("QtQuickApp::pathExtended() needs more work");
}
return QString();
@@ -220,14 +126,9 @@ bool QtQuickApp::adaptCurrentMainCppTemplateLine(QString &line) const
{
const QLatin1Char quote('"');
- if (line.contains(QLatin1String("// MAINQML"))) {
+ if (line.contains(QLatin1String("// MAINQML")))
insertParameter(line, quote + path(MainQmlDeployed) + quote);
- } else if (line.contains(QLatin1String("// ADDIMPORTPATH"))) {
- if (m_modules.isEmpty())
- return false;
- else
- insertParameter(line, quote + path(ModulesDir) + quote);
- }
+
return true;
}
@@ -240,17 +141,7 @@ void QtQuickApp::handleCurrentProFileTemplateLine(const QString &line,
QString nextLine = proFileTemplate.readLine(); // eats 'QML_IMPORT_PATH ='
if (!nextLine.startsWith(QLatin1String("QML_IMPORT_PATH =")))
return;
-
- proFile << nextLine;
-
- const QLatin1String separator(" \\\n ");
- const QDir proPath(path(AppProPath));
- foreach (const QString &importPath, m_importPaths) {
- const QString relativePath = proPath.relativeFilePath(importPath);
- proFile << separator << relativePath;
- }
-
- proFile << endl;
+ proFile << nextLine << endl;
} else if (line.contains(QLatin1String("# HARMATTAN_BOOSTABLE"))) {
QString nextLine = proFileTemplate.readLine(); // eats '# CONFIG += qdeclarative-boostable'
if (supportsMeegoBooster())
@@ -259,83 +150,6 @@ void QtQuickApp::handleCurrentProFileTemplateLine(const QString &line,
}
}
-void QtQuickApp::clearModulesAndPlugins()
-{
- qDeleteAll(m_modules);
- m_modules.clear();
- qDeleteAll(m_cppPlugins);
- m_cppPlugins.clear();
-}
-
-bool QtQuickApp::addCppPlugin(const QString &qmldirLine, QmlModule *module)
-{
- const QStringList qmldirLineElements =
- qmldirLine.split(QLatin1Char(' '), QString::SkipEmptyParts);
- if (qmldirLineElements.count() < 2) {
- m_error = QCoreApplication::translate(
- "Qt4ProjectManager::Internal::QtQuickApp",
- "Invalid '%1' entry in '%2' of module '%3'.")
- .arg(qmldir_plugin).arg(qmldir).arg(module->uri);
- return false;
- }
- const QString name = qmldirLineElements.at(1);
- const QFileInfo path(module->qmldir.dir(), qmldirLineElements.value(2, QString()));
-
- // TODO: Add more magic to find a good .pro file..
- const QString proFileName = name + QLatin1String(".pro");
- const QFileInfo proFile_guess1(module->qmldir.dir(), proFileName);
- const QFileInfo proFile_guess2(QString(module->qmldir.dir().absolutePath() + QLatin1String("/../")),
- proFileName);
- const QFileInfo proFile_guess3(module->qmldir.dir(),
- QFileInfo(module->qmldir.path()).fileName() + QLatin1String(".pro"));
- const QFileInfo proFile_guess4(proFile_guess3.absolutePath() + QLatin1String("/../")
- + proFile_guess3.fileName());
-
- QFileInfo foundProFile;
- if (proFile_guess1.exists()) {
- foundProFile = proFile_guess1.canonicalFilePath();
- } else if (proFile_guess2.exists()) {
- foundProFile = proFile_guess2.canonicalFilePath();
- } else if (proFile_guess3.exists()) {
- foundProFile = proFile_guess3.canonicalFilePath();
- } else if (proFile_guess4.exists()) {
- foundProFile = proFile_guess4.canonicalFilePath();
- } else {
- m_error = QCoreApplication::translate(
- "Qt4ProjectManager::Internal::QtQuickApp",
- "No .pro file for plugin '%1' can be found.").arg(name);
- return false;
- }
- QmlCppPlugin *plugin =
- new QmlCppPlugin(name, path, module, foundProFile);
- m_cppPlugins.append(plugin);
- module->cppPlugins.insert(name, plugin);
- return true;
-}
-
-bool QtQuickApp::addCppPlugins(QmlModule *module)
-{
- QFile qmlDirFile(module->qmldir.absoluteFilePath());
- if (qmlDirFile.open(QIODevice::ReadOnly)) {
- QTextStream in(&qmlDirFile);
- QString line;
- while (!(line = in.readLine()).isNull()) {
- line = line.trimmed();
- if (line.startsWith(qmldir_plugin) && !addCppPlugin(line, module))
- return false;
- };
- }
- return true;
-}
-
-bool QtQuickApp::addExternalModule(const QString &name, const QFileInfo &dir,
- const QFileInfo &contentDir)
-{
- QmlModule *module = new QmlModule(name, dir, contentDir, true, this);
- m_modules.append(module);
- return addCppPlugins(module);
-}
-
#ifndef CREATORLESSTEST
Core::GeneratedFiles QtQuickApp::generateFiles(QString *errorMessage) const
{
@@ -360,11 +174,6 @@ bool QtQuickApp::useExistingMainQml() const
return !m_mainQmlFile.filePath().isEmpty();
}
-const QList<QmlModule*> QtQuickApp::modules() const
-{
- return m_modules;
-}
-
QString QtQuickApp::appViewerBaseName() const
{
return QLatin1String(m_componentSet == QtQuick20Components ?
@@ -454,9 +263,6 @@ QList<DeploymentFolder> QtQuickApp::deploymentFolders() const
{
QList<DeploymentFolder> result;
result.append(DeploymentFolder(path(QmlDirProFileRelative), QLatin1String("qml")));
- foreach (const QmlModule *module, m_modules)
- if (module->isExternal)
- result.append(DeploymentFolder(module->path(QmlModule::ContentDir), module->path(QmlModule::DeployedContentBase)));
return result;
}
diff --git a/src/plugins/qt4projectmanager/wizards/qtquickapp.h b/src/plugins/qt4projectmanager/wizards/qtquickapp.h
index 98d9524807..33bd7a4a25 100644
--- a/src/plugins/qt4projectmanager/wizards/qtquickapp.h
+++ b/src/plugins/qt4projectmanager/wizards/qtquickapp.h
@@ -38,42 +38,6 @@
namespace Qt4ProjectManager {
namespace Internal {
-class QtQuickApp;
-struct QmlCppPlugin;
-
-struct QmlModule
-{
- enum Path {
- // Example: Module "com.foo.bar" in "c:/modules/".
- // "qmldir" file is in "c:/modules/com/foo/bar/".
- // Application .pro file is "c:/app/app.pro".
- Root, // "c:/modules/" (absolute)
- ContentDir, // "../modules/com/foo/bar" (relative form .pro file)
- ContentBase, // "com/foo/"
- DeployedContentBase // "<qmlmodules>/com/foo" (on deploy target)
- };
-
- QmlModule(const QString &name, const QFileInfo &rootDir, const QFileInfo &qmldir,
- bool isExternal, QtQuickApp *qtQuickApp);
- QString path(Path path) const;
- const QString uri; // "com.foo.bar"
- const QFileInfo rootDir; // Location of "com/"
- const QFileInfo qmldir; // 'qmldir' file.
- const bool isExternal; // Either external or inside a source paths
- const QtQuickApp *qtQuickApp;
- QHash<QString, QmlCppPlugin *> cppPlugins; // Just as info. No ownership.
-};
-
-struct QmlCppPlugin
-{
- QmlCppPlugin(const QString &name, const QFileInfo &path,
- const QmlModule *module, const QFileInfo &proFile);
- const QString name; // Original name
- const QFileInfo path; // Plugin path where qmldir points to
- const QmlModule *module;
- const QFileInfo proFile; // .pro file for the plugin
-};
-
struct QtQuickAppGeneratedFileInfo : public AbstractGeneratedFileInfo
{
enum ExtendedFileType {
@@ -102,7 +66,6 @@ public:
AppViewerHOrigin,
QmlDir,
QmlDirProFileRelative,
- ModulesDir,
MainPageQml,
MainPageQmlOrigin
};
@@ -119,14 +82,12 @@ public:
};
QtQuickApp();
- virtual ~QtQuickApp();
void setComponentSet(ComponentSet componentSet);
ComponentSet componentSet() const;
void setMainQml(Mode mode, const QString &file = QString());
Mode mainQmlMode() const;
- bool setExternalModules(const QStringList &uris, const QStringList &importPaths);
#ifndef CREATORLESSTEST
virtual Core::GeneratedFiles generateFiles(QString *errorMessage) const;
@@ -134,7 +95,6 @@ public:
bool generateFiles(QString *errorMessage) const;
#endif // CREATORLESSTEST
bool useExistingMainQml() const;
- const QList<QmlModule*> modules() const;
static const int StubVersion;
@@ -157,18 +117,10 @@ private:
QList<AbstractGeneratedFileInfo> updateableFiles(const QString &mainProFile) const;
QList<DeploymentFolder> deploymentFolders() const;
- bool addExternalModule(const QString &uri, const QFileInfo &dir,
- const QFileInfo &contentDir);
- bool addCppPlugins(QmlModule *module);
- bool addCppPlugin(const QString &qmldirLine, QmlModule *module);
- void clearModulesAndPlugins();
QString componentSetDir(ComponentSet componentSet) const;
QFileInfo m_mainQmlFile;
Mode m_mainQmlMode;
- QStringList m_importPaths;
- QList<QmlModule *> m_modules;
- QList<QmlCppPlugin *> m_cppPlugins;
ComponentSet m_componentSet;
};
diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp
index 07e34b2fa4..a2089fa4dd 100644
--- a/src/plugins/qtsupport/baseqtversion.cpp
+++ b/src/plugins/qtsupport/baseqtversion.cpp
@@ -47,6 +47,7 @@
#include <utils/persistentsettings.h>
#include <utils/environment.h>
+#include <utils/hostosinfo.h>
#include <utils/synchronousprocess.h>
#include <QDir>
@@ -57,6 +58,7 @@
using namespace QtSupport;
using namespace QtSupport::Internal;
+using namespace Utils;
static const char QTVERSIONID[] = "Id";
static const char QTVERSIONNAME[] = "Name";
@@ -163,7 +165,7 @@ int BaseQtVersion::getUniqueId()
return QtVersionManager::instance()->getUniqueId();
}
-BaseQtVersion::BaseQtVersion(const Utils::FileName &qmakeCommand, bool isAutodetected, const QString &autodetectionSource)
+BaseQtVersion::BaseQtVersion(const FileName &qmakeCommand, bool isAutodetected, const QString &autodetectionSource)
: m_id(getUniqueId()),
m_isAutodetected(isAutodetected),
m_autodetectionSource(autodetectionSource),
@@ -203,10 +205,10 @@ BaseQtVersion::BaseQtVersion()
m_hasDocumentation(false),
m_qmakeIsExecutable(true)
{
- ctor(Utils::FileName());
+ ctor(FileName());
}
-void BaseQtVersion::ctor(const Utils::FileName &qmakePath)
+void BaseQtVersion::ctor(const FileName &qmakePath)
{
m_qmakeCommand = qmakePath;
m_designerCommand.clear();
@@ -224,7 +226,7 @@ BaseQtVersion::~BaseQtVersion()
{
}
-QString BaseQtVersion::defaultDisplayName(const QString &versionString, const Utils::FileName &qmakePath,
+QString BaseQtVersion::defaultDisplayName(const QString &versionString, const FileName &qmakePath,
bool fromPath)
{
QString location;
@@ -304,7 +306,7 @@ QList<ProjectExplorer::Task> BaseQtVersion::validateKit(const ProjectExplorer::K
if (!tc)
result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
ProjectExplorer::ToolChainKitInformation::msgNoToolChainInTarget(),
- Utils::FileName(), -1,
+ FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
@@ -323,7 +325,7 @@ QList<ProjectExplorer::Task> BaseQtVersion::validateKit(const ProjectExplorer::K
version->displayName(),
qtAbiString);
result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
- message, Utils::FileName(), -1,
+ message, FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
} // Abi mismatch
return result;
@@ -346,7 +348,7 @@ void BaseQtVersion::fromMap(const QVariantMap &map)
QString string = map.value(QLatin1String(QTVERSIONQMAKEPATH)).toString();
if (string.startsWith(QLatin1Char('~')))
string.remove(0, 1).prepend(QDir::homePath());
- ctor(Utils::FileName::fromString(string));
+ ctor(FileName::fromString(string));
}
QVariantMap BaseQtVersion::toMap() const
@@ -405,9 +407,9 @@ QStringList BaseQtVersion::warningReason() const
return ret;
}
-ProjectExplorer::ToolChain *BaseQtVersion::preferredToolChain(const Utils::FileName &ms) const
+ProjectExplorer::ToolChain *BaseQtVersion::preferredToolChain(const FileName &ms) const
{
- const Utils::FileName spec = ms.isEmpty() ? mkspec() : ms;
+ const FileName spec = ms.isEmpty() ? mkspec() : ms;
QList<ProjectExplorer::ToolChain *> tcList = ProjectExplorer::ToolChainManager::instance()->toolChains();
ProjectExplorer::ToolChain *possibleTc = 0;
foreach (ProjectExplorer::ToolChain *tc, tcList) {
@@ -420,7 +422,7 @@ ProjectExplorer::ToolChain *BaseQtVersion::preferredToolChain(const Utils::FileN
return possibleTc;
}
-Utils::FileName BaseQtVersion::qmakeCommand() const
+FileName BaseQtVersion::qmakeCommand() const
{
return m_qmakeCommand;
}
@@ -575,10 +577,10 @@ void BaseQtVersion::updateSourcePath() const
}
}
}
- m_sourcePath = Utils::FileName::fromUserInput(sourcePath);
+ m_sourcePath = FileName::fromUserInput(sourcePath);
}
-Utils::FileName BaseQtVersion::sourcePath() const
+FileName BaseQtVersion::sourcePath() const
{
updateSourcePath();
return m_sourcePath;
@@ -655,46 +657,43 @@ QString BaseQtVersion::findQtBinary(Binaries binary) const
QStringList possibleCommands;
switch (binary) {
case QmlScene: {
-#if defined(Q_OS_WIN)
- possibleCommands << QLatin1String("qmlscene.exe");
-#else
- possibleCommands << QLatin1String("qmlscene");
-#endif
+ if (HostOsInfo::isWindowsHost())
+ possibleCommands << QLatin1String("qmlscene.exe");
+ else
+ possibleCommands << QLatin1String("qmlscene");
}
case QmlViewer: {
-#if defined(Q_OS_WIN)
- possibleCommands << QLatin1String("qmlviewer.exe");
-#elif defined(Q_OS_MAC)
- possibleCommands << QLatin1String("QMLViewer.app/Contents/MacOS/QMLViewer");
-#else
- possibleCommands << QLatin1String("qmlviewer");
-#endif
+ if (HostOsInfo::isWindowsHost())
+ possibleCommands << QLatin1String("qmlviewer.exe");
+ else if (HostOsInfo::isMacHost())
+ possibleCommands << QLatin1String("QMLViewer.app/Contents/MacOS/QMLViewer");
+ else
+ possibleCommands << QLatin1String("qmlviewer");
}
break;
case Designer:
-#if defined(Q_OS_WIN)
- possibleCommands << QLatin1String("designer.exe");
-#elif defined(Q_OS_MAC)
- possibleCommands << QLatin1String("Designer.app/Contents/MacOS/Designer");
-#else
- possibleCommands << QLatin1String("designer");
-#endif
+ if (HostOsInfo::isWindowsHost())
+ possibleCommands << QLatin1String("designer.exe");
+ else if (HostOsInfo::isMacHost())
+ possibleCommands << QLatin1String("Designer.app/Contents/MacOS/Designer");
+ else
+ possibleCommands << QLatin1String("designer");
break;
case Linguist:
-#if defined(Q_OS_WIN)
- possibleCommands << QLatin1String("linguist.exe");
-#elif defined(Q_OS_MAC)
- possibleCommands << QLatin1String("Linguist.app/Contents/MacOS/Linguist");
-#else
- possibleCommands << QLatin1String("linguist");
-#endif
+ if (HostOsInfo::isWindowsHost())
+ possibleCommands << QLatin1String("linguist.exe");
+ else if (HostOsInfo::isMacHost())
+ possibleCommands << QLatin1String("Linguist.app/Contents/MacOS/Linguist");
+ else
+ possibleCommands << QLatin1String("linguist");
break;
case Uic:
-#ifdef Q_OS_WIN
- possibleCommands << QLatin1String("uic.exe");
-#else
- possibleCommands << QLatin1String("uic-qt4") << QLatin1String("uic4") << QLatin1String("uic");
-#endif
+ if (HostOsInfo::isWindowsHost()) {
+ possibleCommands << QLatin1String("uic.exe");
+ } else {
+ possibleCommands << QLatin1String("uic-qt4") << QLatin1String("uic4")
+ << QLatin1String("uic");
+ }
break;
default:
Q_ASSERT(false);
@@ -729,13 +728,13 @@ void BaseQtVersion::updateMkspec() const
if (m_mkspecFullPath.isEmpty())
return;
- Utils::FileName baseMkspecDir = mkspecDirectoryFromVersionInfo(versionInfo());
+ FileName baseMkspecDir = mkspecDirectoryFromVersionInfo(versionInfo());
if (m_mkspec.isChildOf(baseMkspecDir)) {
m_mkspec = m_mkspec.relativeChildPath(baseMkspecDir);
// qDebug() << "Setting mkspec to"<<mkspec;
} else {
- Utils::FileName sourceMkSpecPath = sourcePath().appendPath(QLatin1String("mkspecs"));
+ FileName sourceMkSpecPath = sourcePath().appendPath(QLatin1String("mkspecs"));
if (m_mkspec.isChildOf(sourceMkSpecPath)) {
m_mkspec = m_mkspec.relativeChildPath(sourceMkSpecPath);
} else {
@@ -753,7 +752,7 @@ void BaseQtVersion::ensureMkSpecParsed() const
if (mkspecPath().isEmpty())
return;
- QMakeGlobals option;
+ ProFileGlobals option;
option.setProperties(versionInfo());
ProMessageHandler msgHandler(true);
ProFileCacheManager::instance()->incRefCount();
@@ -784,22 +783,22 @@ void BaseQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
m_mkspecValues.insert(declarativeBins, evaluator->value(declarativeBins));
}
-Utils::FileName BaseQtVersion::mkspec() const
+FileName BaseQtVersion::mkspec() const
{
updateMkspec();
return m_mkspec;
}
-Utils::FileName BaseQtVersion::mkspecFor(ProjectExplorer::ToolChain *tc) const
+FileName BaseQtVersion::mkspecFor(ProjectExplorer::ToolChain *tc) const
{
Utils::FileName versionSpec = mkspec();
if (!tc)
return versionSpec;
- const QList<Utils::FileName> tcSpecList = tc->suggestedMkspecList();
+ const QList<FileName> tcSpecList = tc->suggestedMkspecList();
if (tcSpecList.contains(versionSpec))
return versionSpec;
- foreach (const Utils::FileName &tcSpec, tcSpecList) {
+ foreach (const FileName &tcSpec, tcSpecList) {
if (hasMkspec(tcSpec))
return tcSpec;
}
@@ -807,13 +806,13 @@ Utils::FileName BaseQtVersion::mkspecFor(ProjectExplorer::ToolChain *tc) const
return versionSpec;
}
-Utils::FileName BaseQtVersion::mkspecPath() const
+FileName BaseQtVersion::mkspecPath() const
{
updateMkspec();
return m_mkspecFullPath;
}
-bool BaseQtVersion::hasMkspec(const Utils::FileName &spec) const
+bool BaseQtVersion::hasMkspec(const FileName &spec) const
{
updateVersionInfo();
QFileInfo fi;
@@ -967,12 +966,11 @@ QString BaseQtVersion::demosPath() const
QString BaseQtVersion::frameworkInstallPath() const
{
-#ifdef Q_OS_MAC
- updateVersionInfo();
- return m_versionInfo.value(QLatin1String("QT_INSTALL_LIBS"));
-#else
+ if (HostOsInfo::isMacHost()) {
+ updateVersionInfo();
+ return m_versionInfo.value(QLatin1String("QT_INSTALL_LIBS"));
+ }
return QString();
-#endif
}
bool BaseQtVersion::hasExamples() const
@@ -995,7 +993,7 @@ QList<ProjectExplorer::HeaderPath> BaseQtVersion::systemHeaderPathes(const Proje
return result;
}
-void BaseQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const
+void BaseQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Environment &env) const
{
Q_UNUSED(k);
env.set(QLatin1String("QTDIR"), QDir::toNativeSeparators(qmakeProperty("QT_HOST_DATA")));
@@ -1039,10 +1037,10 @@ bool BaseQtVersion::hasQmlObserver() const
return m_hasQmlObserver;
}
-Utils::Environment BaseQtVersion::qmlToolsEnvironment() const
+Environment BaseQtVersion::qmlToolsEnvironment() const
{
// FIXME: This seems broken!
- Utils::Environment environment = Utils::Environment::systemEnvironment();
+ Environment environment = Environment::systemEnvironment();
#if 0 // FIXME: Fix this!
addToEnvironment(environment);
#endif
@@ -1128,7 +1126,7 @@ QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proF
if (!isValid()) {
//: %1: Reason for being invalid
const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", "The Qt version is invalid: %1").arg(invalidReason());
- results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, Utils::FileName(), -1,
+ results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
}
@@ -1138,7 +1136,7 @@ QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proF
//: %1: Path to qmake executable
const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion",
"The qmake command \"%1\" was not found or is not executable.").arg(qmakeCommand().toUserOutput());
- results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, Utils::FileName(), -1,
+ results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
}
@@ -1149,13 +1147,13 @@ QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proF
if ((tmpBuildDir.startsWith(sourcePath)) && (tmpBuildDir != sourcePath)) {
const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion",
"Qmake does not support build directories below the source directory.");
- results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, Utils::FileName(), -1,
+ results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
} else if (tmpBuildDir.count(slash) != sourcePath.count(slash) && qtVersion() < QtVersionNumber(4,8, 0)) {
const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion",
"The build directory needs to be at the same level as the source directory.");
- results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, Utils::FileName(), -1,
+ results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
}
@@ -1180,13 +1178,13 @@ QtConfigWidget *BaseQtVersion::createConfigurationWidget() const
return 0;
}
-bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QString, QString> *versionInfo)
+bool BaseQtVersion::queryQMakeVariables(const FileName &binary, QHash<QString, QString> *versionInfo)
{
bool qmakeIsExecutable;
return BaseQtVersion::queryQMakeVariables(binary, versionInfo, &qmakeIsExecutable);
}
-bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QString, QString> *versionInfo,
+bool BaseQtVersion::queryQMakeVariables(const FileName &binary, QHash<QString, QString> *versionInfo,
bool *qmakeIsExecutable)
{
const int timeOutMS = 30000; // Might be slow on some machines.
@@ -1196,19 +1194,19 @@ bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QSt
return false;
QProcess process;
- Utils::Environment env = Utils::Environment::systemEnvironment();
-
-#ifdef Q_OS_WIN
- // Add tool chain environment. This is necessary for non-static qmakes e.g. using mingw on windows
- // We can not just add all the environments of all tool chains since that will make PATH too long
- // which in turn will trigger a crash when parsing the results of vcvars.bat of MSVC.
- QList<ProjectExplorer::Abi> abiList = ProjectExplorer::Abi::abisOfBinary(binary);
- QList<ProjectExplorer::ToolChain *> tcList = ProjectExplorer::ToolChainManager::instance()->toolChains();
- foreach (ProjectExplorer::ToolChain *tc, tcList) {
- if (abiList.contains(tc->targetAbi()))
- tc->addToEnvironment(env);
+ Environment env = Environment::systemEnvironment();
+
+ if (HostOsInfo::isWindowsHost()) {
+ // Add tool chain environment. This is necessary for non-static qmakes e.g. using mingw on windows
+ // We can not just add all the environments of all tool chains since that will make PATH too long
+ // which in turn will trigger a crash when parsing the results of vcvars.bat of MSVC.
+ QList<ProjectExplorer::Abi> abiList = ProjectExplorer::Abi::abisOfBinary(binary);
+ QList<ProjectExplorer::ToolChain *> tcList = ProjectExplorer::ToolChainManager::instance()->toolChains();
+ foreach (ProjectExplorer::ToolChain *tc, tcList) {
+ if (abiList.contains(tc->targetAbi()))
+ tc->addToEnvironment(env);
+ }
}
-#endif
process.setEnvironment(env.toStringList());
process.start(qmake.absoluteFilePath(), QStringList(QLatin1String("-query")), QIODevice::ReadOnly);
@@ -1219,7 +1217,7 @@ bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QSt
return false;
}
if (!process.waitForFinished(timeOutMS)) {
- Utils::SynchronousProcess::stopProcess(process);
+ SynchronousProcess::stopProcess(process);
qWarning("Timeout running '%s' (%dms).", qPrintable(binary.toUserOutput()), timeOutMS);
return false;
}
@@ -1259,73 +1257,79 @@ bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QSt
return true;
}
-Utils::FileName BaseQtVersion::mkspecDirectoryFromVersionInfo(const QHash<QString, QString> &versionInfo)
+FileName BaseQtVersion::mkspecDirectoryFromVersionInfo(const QHash<QString, QString> &versionInfo)
{
QString dataDir = qmakeProperty(versionInfo, "QT_HOST_DATA");
if (dataDir.isEmpty())
- return Utils::FileName();
- return Utils::FileName::fromUserInput(dataDir + QLatin1String("/mkspecs"));
+ return FileName();
+ return FileName::fromUserInput(dataDir + QLatin1String("/mkspecs"));
}
-Utils::FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QString> &versionInfo)
+FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QString> &versionInfo)
{
- Utils::FileName baseMkspecDir = mkspecDirectoryFromVersionInfo(versionInfo);
+ FileName baseMkspecDir = mkspecDirectoryFromVersionInfo(versionInfo);
if (baseMkspecDir.isEmpty())
- return Utils::FileName();
+ return FileName();
- Utils::FileName mkspecFullPath = Utils::FileName::fromString(baseMkspecDir.toString() + QLatin1String("/default"));
+ FileName mkspecFullPath = FileName::fromString(baseMkspecDir.toString() + QLatin1String("/default"));
// qDebug() << "default mkspec is located at" << mkspecFullPath;
-#ifdef Q_OS_WIN
- QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf"));
- if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
- while (!f2.atEnd()) {
- QByteArray line = f2.readLine();
- if (line.startsWith("QMAKESPEC_ORIGINAL")) {
- const QList<QByteArray> &temp = line.split('=');
- if (temp.size() == 2) {
- QString possibleFullPath = QString::fromLocal8Bit(temp.at(1).trimmed().constData());
- // We sometimes get a mix of different slash styles here...
- possibleFullPath = possibleFullPath.replace(QLatin1Char('\\'), QLatin1Char('/'));
- if (QFileInfo(possibleFullPath).exists()) // Only if the path exists
- mkspecFullPath = Utils::FileName::fromUserInput(possibleFullPath);
+ switch (HostOsInfo::hostOs()) {
+ case HostOsInfo::HostOsWindows: {
+ QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf"));
+ if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
+ while (!f2.atEnd()) {
+ QByteArray line = f2.readLine();
+ if (line.startsWith("QMAKESPEC_ORIGINAL")) {
+ const QList<QByteArray> &temp = line.split('=');
+ if (temp.size() == 2) {
+ QString possibleFullPath = QString::fromLocal8Bit(temp.at(1).trimmed().constData());
+ // We sometimes get a mix of different slash styles here...
+ possibleFullPath = possibleFullPath.replace(QLatin1Char('\\'), QLatin1Char('/'));
+ if (QFileInfo(possibleFullPath).exists()) // Only if the path exists
+ mkspecFullPath = FileName::fromUserInput(possibleFullPath);
+ }
+ break;
}
- break;
}
+ f2.close();
}
- f2.close();
+ break;
}
-#elif defined(Q_OS_MAC)
- QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf"));
- if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
- while (!f2.atEnd()) {
- QByteArray line = f2.readLine();
- if (line.startsWith("MAKEFILE_GENERATOR")) {
- const QList<QByteArray> &temp = line.split('=');
- if (temp.size() == 2) {
- const QByteArray &value = temp.at(1);
- if (value.contains("XCODE")) {
- // we don't want to generate xcode projects...
-// qDebug() << "default mkspec is xcode, falling back to g++";
- mkspecFullPath = baseMkspecDir.appendPath(QLatin1String("macx-g++"));
+ case HostOsInfo::HostOsMac: {
+ QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf"));
+ if (f2.exists() && f2.open(QIODevice::ReadOnly)) {
+ while (!f2.atEnd()) {
+ QByteArray line = f2.readLine();
+ if (line.startsWith("MAKEFILE_GENERATOR")) {
+ const QList<QByteArray> &temp = line.split('=');
+ if (temp.size() == 2) {
+ const QByteArray &value = temp.at(1);
+ if (value.contains("XCODE")) {
+ // we don't want to generate xcode projects...
+ // qDebug() << "default mkspec is xcode, falling back to g++";
+ mkspecFullPath = baseMkspecDir.appendPath(QLatin1String("macx-g++"));
+ }
+ //resolve mkspec link
+ mkspecFullPath = FileName::fromString(mkspecFullPath.toFileInfo().canonicalFilePath());
}
- //resolve mkspec link
- mkspecFullPath = Utils::FileName::fromString(mkspecFullPath.toFileInfo().canonicalFilePath());
+ break;
}
- break;
}
+ f2.close();
}
- f2.close();
+ break;
+ }
+ default:
+ mkspecFullPath = FileName::fromString(mkspecFullPath.toFileInfo().canonicalFilePath());
+ break;
}
-#else
- mkspecFullPath = Utils::FileName::fromString(mkspecFullPath.toFileInfo().canonicalFilePath());
-#endif
return mkspecFullPath;
}
-Utils::FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString)
+FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString)
{
QStringList dirs;
dirs << qmakeProperty(versionInfo, "QT_INSTALL_LIBS")
@@ -1343,7 +1347,7 @@ Utils::FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionI
&& file.startsWith(QLatin1String("QtCore"))
&& file.endsWith(QLatin1String(".framework"))) {
// handle Framework
- Utils::FileName lib(info);
+ FileName lib(info);
lib.appendPath(file.left(file.lastIndexOf(QLatin1Char('.'))));
return lib;
}
@@ -1357,18 +1361,18 @@ Utils::FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionI
|| file.endsWith(QString::fromLatin1(".so.") + versionString)
|| file.endsWith(QLatin1String(".so"))
|| file.endsWith(QLatin1Char('.') + versionString + QLatin1String(".dylib")))
- return Utils::FileName(info);
+ return FileName(info);
}
}
}
}
// Return path to first static library found:
if (!staticLibs.isEmpty())
- return Utils::FileName(staticLibs.at(0));
- return Utils::FileName();
+ return FileName(staticLibs.at(0));
+ return FileName();
}
-QList<ProjectExplorer::Abi> BaseQtVersion::qtAbisFromLibrary(const Utils::FileName &coreLibrary)
+QList<ProjectExplorer::Abi> BaseQtVersion::qtAbisFromLibrary(const FileName &coreLibrary)
{
return ProjectExplorer::Abi::abisOfBinary(coreLibrary);
}
diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
index fbc5a159dd..2d562ab065 100644
--- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
+++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
@@ -51,7 +51,7 @@
#include <QMutex>
#include <QThread>
#include <QMutexLocker>
-#include <QWeakPointer>
+#include <QPointer>
#include <QWaitCondition>
#include <QDir>
#include <QBuffer>
@@ -71,14 +71,16 @@
#include <QDeclarativeContext>
#include <QDesktopServices>
+using namespace Utils;
+
namespace QtSupport {
namespace Internal {
const char C_FALLBACK_ROOT[] = "ProjectsFallbackRoot";
-QWeakPointer<ExamplesListModel> &examplesModelStatic()
+QPointer<ExamplesListModel> &examplesModelStatic()
{
- static QWeakPointer<ExamplesListModel> s_examplesModel;
+ static QPointer<ExamplesListModel> s_examplesModel;
return s_examplesModel;
}
@@ -175,7 +177,7 @@ public:
Q_UNUSED(size)
QMutexLocker lock(&m_mutex);
- QUrl url = QUrl::fromEncoded(id.toAscii());
+ QUrl url = QUrl::fromEncoded(id.toLatin1());
if (!m_fetcher.asynchronousFetchData(url))
return QImage();
@@ -336,9 +338,9 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
.arg(nativeProjectDir));
lay->addWidget(descrLbl, 0, 0, 1, 2);
QLabel *txt = new QLabel(tr("&Location:"));
- Utils::PathChooser *chooser = new Utils::PathChooser;
+ PathChooser *chooser = new PathChooser;
txt->setBuddy(chooser);
- chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
+ chooser->setExpectedKind(PathChooser::ExistingDirectory);
QSettings *settings = Core::ICore::settings();
chooser->setPath(settings->value(QString::fromLatin1(C_FALLBACK_ROOT),
Core::DocumentManager::projectsDirectory()).toString());
@@ -367,15 +369,18 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
} else {
QString error;
QString targetDir = destBaseDir + QLatin1Char('/') + exampleDirName;
- if (Utils::FileUtils::copyRecursively(projectDir, targetDir, &error)) {
+ if (FileUtils::copyRecursively(FileName::fromString(projectDir),
+ FileName::fromString(targetDir), &error)) {
// set vars to new location
const QStringList::Iterator end = filesToOpen.end();
for (QStringList::Iterator it = filesToOpen.begin(); it != end; ++it)
it->replace(projectDir, targetDir);
foreach (const QString &dependency, dependencies) {
- QString dirName = QDir(dependency).dirName();
- if (!Utils::FileUtils::copyRecursively(dependency, targetDir + QDir::separator()+ dirName, &error)) {
+ FileName targetFile = FileName::fromString(targetDir);
+ targetFile.appendPath(QDir(dependency).dirName());
+ if (!FileUtils::copyRecursively(FileName::fromString(dependency), targetFile,
+ &error)) {
QMessageBox::warning(Core::ICore::mainWindow(), tr("Cannot Copy Project"), error);
// do not fail, just warn;
}
diff --git a/src/plugins/qtsupport/profilereader.cpp b/src/plugins/qtsupport/profilereader.cpp
index c37e629a1f..5b909d5882 100644
--- a/src/plugins/qtsupport/profilereader.cpp
+++ b/src/plugins/qtsupport/profilereader.cpp
@@ -39,8 +39,10 @@ using namespace QtSupport;
static QString format(const QString &fileName, int lineNo, const QString &msg)
{
- if (lineNo)
+ if (lineNo > 0)
return QString::fromLatin1("%1(%2): %3").arg(fileName, QString::number(lineNo), msg);
+ else if (lineNo)
+ return QString::fromLatin1("%1: %3").arg(fileName, msg);
else
return msg;
}
@@ -65,7 +67,7 @@ void ProMessageHandler::fileMessage(const QString &)
}
-ProFileReader::ProFileReader(QMakeGlobals *option)
+ProFileReader::ProFileReader(ProFileGlobals *option)
: QMakeParser(ProFileCacheManager::instance()->cache(), this)
, ProFileEvaluator(option, this, this)
, m_ignoreLevel(0)
diff --git a/src/plugins/qtsupport/profilereader.h b/src/plugins/qtsupport/profilereader.h
index 0e6ca9b098..f51b71e0fd 100644
--- a/src/plugins/qtsupport/profilereader.h
+++ b/src/plugins/qtsupport/profilereader.h
@@ -70,7 +70,7 @@ class QTSUPPORT_EXPORT ProFileReader : public ProMessageHandler, public QMakePar
Q_OBJECT
public:
- ProFileReader(QMakeGlobals *option);
+ ProFileReader(ProFileGlobals *option);
~ProFileReader();
QList<ProFile*> includeFiles() const;
diff --git a/src/plugins/qtsupport/qmldumptool.cpp b/src/plugins/qtsupport/qmldumptool.cpp
index 5d86596f8f..701862882e 100644
--- a/src/plugins/qtsupport/qmldumptool.cpp
+++ b/src/plugins/qtsupport/qmldumptool.cpp
@@ -41,6 +41,7 @@
#include <projectexplorer/runconfiguration.h>
#include <utils/runextensions.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QDesktopServices>
#include <QCoreApplication>
@@ -244,9 +245,8 @@ static QStringList sourceFileNames()
files << QLatin1String("main.cpp") << QLatin1String("qmldump.pro")
<< QLatin1String("qmlstreamwriter.cpp") << QLatin1String("qmlstreamwriter.h")
<< QLatin1String("LICENSE.LGPL") << QLatin1String("LGPL_EXCEPTION.TXT");
-#ifdef Q_OS_MAC
- files << QLatin1String("Info.plist");
-#endif
+ if (Utils::HostOsInfo::isMacHost())
+ files << QLatin1String("Info.plist");
return files;
}
diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp
index 764dc7dfce..6bdb044dd6 100644
--- a/src/plugins/qtsupport/qtoptionspage.cpp
+++ b/src/plugins/qtsupport/qtoptionspage.cpp
@@ -48,6 +48,7 @@
#include <projectexplorer/toolchainmanager.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <utils/hostosinfo.h>
#include <utils/runextensions.h>
#include <QDir>
@@ -616,16 +617,14 @@ static QString filterForQmakeFileDialog()
for (int i = 0; i < commands.size(); ++i) {
if (i)
filter += QLatin1Char(' ');
-#ifdef Q_OS_MAC
- // work around QTBUG-7739 that prohibits filters that don't start with *
- filter += QLatin1Char('*');
-#endif
+ if (Utils::HostOsInfo::isMacHost())
+ // work around QTBUG-7739 that prohibits filters that don't start with *
+ filter += QLatin1Char('*');
filter += commands.at(i);
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
- // kde bug, we need at least one wildcard character
- // see QTCREATORBUG-7771
- filter += QLatin1Char('*');
-#endif
+ if (Utils::HostOsInfo::isAnyUnixHost() && !Utils::HostOsInfo::isMacHost())
+ // kde bug, we need at least one wildcard character
+ // see QTCREATORBUG-7771
+ filter += QLatin1Char('*');
}
filter += QLatin1Char(')');
return filter;
diff --git a/src/plugins/qtsupport/qtoutputformatter.h b/src/plugins/qtsupport/qtoutputformatter.h
index 141c471b02..47665bd772 100644
--- a/src/plugins/qtsupport/qtoutputformatter.h
+++ b/src/plugins/qtsupport/qtoutputformatter.h
@@ -36,7 +36,7 @@
#include <utils/fileinprojectfinder.h>
#include <QRegExp>
-#include <QWeakPointer>
+#include <QPointer>
QT_FORWARD_DECLARE_CLASS(QTextCursor)
@@ -80,7 +80,7 @@ private:
mutable QRegExp m_qtAssert;
mutable QRegExp m_qtAssertX;
mutable QRegExp m_qtTestFail;
- QWeakPointer<ProjectExplorer::Project> m_project;
+ QPointer<ProjectExplorer::Project> m_project;
QString m_lastLine;
Utils::FileInProjectFinder m_projectFinder;
};
diff --git a/src/plugins/qtsupport/qtsupport.pri b/src/plugins/qtsupport/qtsupport.pri
index a419733faf..e4de26c4ca 100644
--- a/src/plugins/qtsupport/qtsupport.pri
+++ b/src/plugins/qtsupport/qtsupport.pri
@@ -5,3 +5,4 @@ DEFINES *= QMAKE_AS_LIBRARY
DEFINES *= PROPARSER_THREAD_SAFE
DEFINES *= PROEVALUATOR_THREAD_SAFE
DEFINES *= PROEVALUATOR_CUMULATIVE
+DEFINES *= PROEVALUATOR_SETENV
diff --git a/src/plugins/qtsupport/qtsupport.pro b/src/plugins/qtsupport/qtsupport.pro
index efaefe144c..72b6891269 100644
--- a/src/plugins/qtsupport/qtsupport.pro
+++ b/src/plugins/qtsupport/qtsupport.pro
@@ -12,7 +12,7 @@ include(../../qtcreatorplugin.pri)
include(qtsupport_dependencies.pri)
DEFINES += \
QMAKE_AS_LIBRARY QMAKE_LIBRARY \
- PROPARSER_THREAD_SAFE PROEVALUATOR_THREAD_SAFE PROEVALUATOR_CUMULATIVE
+ PROPARSER_THREAD_SAFE PROEVALUATOR_THREAD_SAFE PROEVALUATOR_CUMULATIVE PROEVALUATOR_SETENV
include(../../shared/proparser/proparser.pri)
HEADERS += \
diff --git a/src/plugins/qtsupport/qtsupport.qbs b/src/plugins/qtsupport/qtsupport.qbs
index 06f689ec67..5532bc253e 100644
--- a/src/plugins/qtsupport/qtsupport.qbs
+++ b/src/plugins/qtsupport/qtsupport.qbs
@@ -12,101 +12,104 @@ QtcPlugin {
Depends { name: "QmlJS" }
Depends { name: "cpp" }
- cpp.includePaths: [
- ".",
+ cpp.includePaths: base.concat([
"../../shared",
- "../../shared/proparser",
- "..",
- "../../libs",
- buildDirectory
- ]
- cpp.defines: {
- return base.concat([
- "QT_NO_CAST_FROM_ASCII",
- "QT_NO_CAST_TO_ASCII",
- "QMAKE_AS_LIBRARY",
- "QMAKE_LIBRARY",
- "PROPARSER_THREAD_SAFE",
- "PROEVALUATOR_THREAD_SAFE",
- "PROEVALUATOR_CUMULATIVE",
- "QMAKE_BUILTIN_PRFS"
- ])
+ "../../shared/proparser"
+ ])
+
+ cpp.defines: base.concat([
+ "QT_NO_CAST_FROM_ASCII",
+ "QT_NO_CAST_TO_ASCII",
+ "QMAKE_AS_LIBRARY",
+ "QMAKE_LIBRARY",
+ "PROPARSER_THREAD_SAFE",
+ "PROEVALUATOR_THREAD_SAFE",
+ "PROEVALUATOR_CUMULATIVE",
+ "QMAKE_BUILTIN_PRFS",
+ "PROEVALUATOR_SETENV"
+ ])
+
+ Group {
+ prefix: "../../shared/proparser/"
+ files: [
+ "ioutils.cpp",
+ "ioutils.h",
+ "profileevaluator.cpp",
+ "profileevaluator.h",
+ "proitems.cpp",
+ "proitems.h",
+ "proparser.qrc",
+ "prowriter.cpp",
+ "prowriter.h",
+ "qmake_global.h",
+ "qmakebuiltins.cpp",
+ "qmakeevaluator.cpp",
+ "qmakeevaluator.h",
+ "qmakeevaluator_p.h",
+ "qmakeglobals.cpp",
+ "qmakeglobals.h",
+ "qmakeparser.cpp",
+ "qmakeparser.h",
+ ]
}
files: [
- "../../shared/proparser/qmakebuiltins.cpp",
- "../../shared/proparser/qmakeevaluator.cpp",
- "../../shared/proparser/qmakeevaluator.h",
- "../../shared/proparser/qmakeevaluator_p.h",
- "../../shared/proparser/qmakeglobals.cpp",
- "../../shared/proparser/qmakeglobals.h",
- "../../shared/proparser/qmakeparser.cpp",
- "../../shared/proparser/qmakeparser.h",
- "../../shared/proparser/qmake_global.h",
- "../../shared/proparser/profileevaluator.cpp",
- "../../shared/proparser/profileevaluator.h",
- "../../shared/proparser/proitems.cpp",
- "../../shared/proparser/proitems.h",
- "../../shared/proparser/prowriter.cpp",
- "../../shared/proparser/prowriter.h",
- "../../shared/proparser/proparser.qrc",
- "../../shared/proparser/ioutils.h",
- "../../shared/proparser/ioutils.cpp",
- "qtversioninfo.ui",
- "qtversionmanager.ui",
+ "baseqtversion.cpp",
"baseqtversion.h",
+ "customexecutableconfigurationwidget.cpp",
+ "customexecutableconfigurationwidget.h",
+ "customexecutablerunconfiguration.cpp",
+ "customexecutablerunconfiguration.h",
"debugginghelper.cpp",
"debugginghelper.h",
"debugginghelper.ui",
+ "debugginghelperbuildtask.cpp",
"debugginghelperbuildtask.h",
+ "exampleslistmodel.cpp",
"exampleslistmodel.h",
+ "gettingstartedwelcomepage.cpp",
"gettingstartedwelcomepage.h",
"profilereader.cpp",
"profilereader.h",
+ "qmldebugginglibrary.cpp",
"qmldebugginglibrary.h",
+ "qmldumptool.cpp",
"qmldumptool.h",
+ "qmlobservertool.cpp",
"qmlobservertool.h",
- "qtoptionspage.h",
- "qtoutputformatter.cpp",
- "qtoutputformatter.h",
- "qtparser.h",
"qtkitconfigwidget.cpp",
"qtkitconfigwidget.h",
"qtkitinformation.cpp",
"qtkitinformation.h",
+ "qtoptionspage.cpp",
+ "qtoptionspage.h",
+ "qtoutputformatter.cpp",
+ "qtoutputformatter.h",
+ "qtparser.cpp",
+ "qtparser.h",
"qtsupport_global.h",
"qtsupportconstants.h",
"qtsupportplugin.cpp",
"qtsupportplugin.h",
+ "qtversionfactory.cpp",
"qtversionfactory.h",
+ "qtversioninfo.ui",
+ "qtversionmanager.cpp",
"qtversionmanager.h",
+ "qtversionmanager.ui",
"screenshotcropper.cpp",
"screenshotcropper.h",
"showbuildlog.ui",
- "baseqtversion.cpp",
- "customexecutableconfigurationwidget.cpp",
- "customexecutableconfigurationwidget.h",
- "customexecutablerunconfiguration.cpp",
- "customexecutablerunconfiguration.h",
- "debugginghelperbuildtask.cpp",
- "exampleslistmodel.cpp",
- "gettingstartedwelcomepage.cpp",
- "qmldebugginglibrary.cpp",
- "qmldumptool.cpp",
- "qmlobservertool.cpp",
- "qtoptionspage.cpp",
- "qtparser.cpp",
- "qtversionfactory.cpp",
- "qtversionmanager.cpp"
]
ProductModule {
Depends { name: "cpp" }
- cpp.includePaths: [ "../../shared" ]
+ cpp.includePaths: "../../shared"
cpp.defines: [
"QMAKE_AS_LIBRARY",
"PROEVALUATOR_THREAD_SAFE",
- "QMAKE_BUILTIN_PRFS"
+ "QMAKE_BUILTIN_PRFS",
+ "PROEVALUATOR_SETENV"
]
}
}
diff --git a/src/plugins/qtsupport/qtversionfactory.cpp b/src/plugins/qtsupport/qtversionfactory.cpp
index f5422d4b82..eb325be510 100644
--- a/src/plugins/qtsupport/qtversionfactory.cpp
+++ b/src/plugins/qtsupport/qtversionfactory.cpp
@@ -62,7 +62,7 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN
return 0;
Utils::FileName mkspec = BaseQtVersion::mkspecFromVersionInfo(versionInfo);
- QMakeGlobals globals;
+ ProFileGlobals globals;
globals.setProperties(versionInfo);
ProMessageHandler msgHandler(true);
ProFileCacheManager::instance()->incRefCount();
diff --git a/src/plugins/remotelinux/RemoteLinux.pluginspec.in b/src/plugins/remotelinux/RemoteLinux.pluginspec.in
index 26da958bd1..b0c21e145f 100644
--- a/src/plugins/remotelinux/RemoteLinux.pluginspec.in
+++ b/src/plugins/remotelinux/RemoteLinux.pluginspec.in
@@ -17,6 +17,6 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
<dependency name=\"Core\" version=\"$$QTCREATOR_VERSION\"/>
<dependency name=\"Debugger\" version=\"$$QTCREATOR_VERSION\"/>
<dependency name=\"ProjectExplorer\" version=\"$$QTCREATOR_VERSION\"/>
- <dependency name=\"Qt4ProjectManager\" version=\"$$QTCREATOR_VERSION\"/>
+ <dependency name=\"QtSupport\" version=\"$$QTCREATOR_VERSION\"/>
</dependencyList>
</plugin>
diff --git a/src/plugins/remotelinux/abstractpackagingstep.cpp b/src/plugins/remotelinux/abstractpackagingstep.cpp
index 46c77d6f09..ed59c5a506 100644
--- a/src/plugins/remotelinux/abstractpackagingstep.cpp
+++ b/src/plugins/remotelinux/abstractpackagingstep.cpp
@@ -28,12 +28,12 @@
****************************************************************************/
#include "abstractpackagingstep.h"
-#include "deployablefile.h"
-#include "deploymentinfo.h"
#include "remotelinuxdeployconfiguration.h"
#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <projectexplorer/task.h>
#include <utils/fileutils.h>
@@ -54,6 +54,7 @@ public:
BuildConfiguration *currentBuildConfiguration;
QString cachedPackageFilePath;
QString cachedPackageDirectory;
+ bool deploymentDataModified;
};
} // namespace Internal
@@ -77,8 +78,10 @@ void AbstractPackagingStep::ctor()
SLOT(handleBuildConfigurationChanged()));
handleBuildConfigurationChanged();
- connect(this, SIGNAL(unmodifyDeploymentInfo()),
- this, SLOT(setDeploymentInfoUnmodified()));
+ connect(target(), SIGNAL(deploymentDataChanged()), SLOT(setDeploymentDataModified()));
+ setDeploymentDataModified();
+
+ connect(this, SIGNAL(unmodifyDeploymentData()), this, SLOT(setDeploymentDataUnmodified()));
}
AbstractPackagingStep::~AbstractPackagingStep()
@@ -128,16 +131,16 @@ RemoteLinuxDeployConfiguration *AbstractPackagingStep::deployConfiguration() con
bool AbstractPackagingStep::isPackagingNeeded() const
{
- const DeploymentInfo * const deploymentInfo = deployConfiguration()->deploymentInfo();
QFileInfo packageInfo(packageFilePath());
- if (!packageInfo.exists() || deploymentInfo->isModified())
+ if (!packageInfo.exists() || d->deploymentDataModified)
return true;
- const int deployableCount = deploymentInfo->deployableCount();
- for (int i = 0; i < deployableCount; ++i) {
- if (Utils::FileUtils::isFileNewerThan(deploymentInfo->deployableAt(i).localFilePath,
- packageInfo.lastModified()))
+ const DeploymentData &dd = target()->deploymentData();
+ for (int i = 0; i < dd.fileCount(); ++i) {
+ if (Utils::FileUtils::isFileNewerThan(dd.fileAt(i).localFilePath(),
+ packageInfo.lastModified())) {
return true;
+ }
}
return false;
@@ -158,13 +161,18 @@ void AbstractPackagingStep::setPackagingStarted()
void AbstractPackagingStep::setPackagingFinished(bool success)
{
if (success)
- emit unmodifyDeploymentInfo();
+ emit unmodifyDeploymentData();
}
// called in gui thread
-void AbstractPackagingStep::setDeploymentInfoUnmodified()
+void AbstractPackagingStep::setDeploymentDataUnmodified()
+{
+ d->deploymentDataModified = false;
+}
+
+void AbstractPackagingStep::setDeploymentDataModified()
{
- deployConfiguration()->deploymentInfo()->setUnmodified();
+ d->deploymentDataModified = true;
}
void AbstractPackagingStep::raiseError(const QString &errorMessage)
diff --git a/src/plugins/remotelinux/abstractpackagingstep.h b/src/plugins/remotelinux/abstractpackagingstep.h
index dc0e7a7200..bde6a58351 100644
--- a/src/plugins/remotelinux/abstractpackagingstep.h
+++ b/src/plugins/remotelinux/abstractpackagingstep.h
@@ -35,11 +35,8 @@
namespace RemoteLinux {
class RemoteLinuxDeployConfiguration;
-class DeploymentInfo;
-namespace Internal {
-class AbstractPackagingStepPrivate;
-}
+namespace Internal { class AbstractPackagingStepPrivate; }
class REMOTELINUX_EXPORT AbstractPackagingStep : public ProjectExplorer::BuildStep
{
@@ -56,7 +53,7 @@ public:
signals:
void packageFilePathChanged();
- void unmodifyDeploymentInfo();
+ void unmodifyDeploymentData();
protected:
void setPackagingStarted();
@@ -71,7 +68,8 @@ protected:
private slots:
void handleBuildConfigurationChanged();
- void setDeploymentInfoUnmodified();
+ void setDeploymentDataUnmodified();
+ void setDeploymentDataModified();
private:
virtual QString packageFileName() const = 0;
diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp
index a0d2ad4521..60bde725db 100644
--- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp
+++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp
@@ -29,9 +29,8 @@
#include "abstractremotelinuxdeployservice.h"
-#include "deployablefile.h"
-
#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/deployablefile.h>
#include <projectexplorer/target.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/qtcassert.h>
@@ -159,7 +158,7 @@ bool AbstractRemoteLinuxDeployService::hasChangedSinceLastDeployment(const Deplo
const QDateTime &lastDeployed = d->lastDeployed.value(DeployParameters(deployableFile,
deviceConfiguration()->sshParameters().host, systemRoot));
return !lastDeployed.isValid()
- || QFileInfo(deployableFile.localFilePath).lastModified() > lastDeployed;
+ || deployableFile.localFilePath().toFileInfo().lastModified() > lastDeployed;
}
void AbstractRemoteLinuxDeployService::setBuildConfiguration(BuildConfiguration *bc)
@@ -235,8 +234,8 @@ QVariantMap AbstractRemoteLinuxDeployService::exportDeployTimes() const
QVariantList timeList;
typedef QHash<DeployParameters, QDateTime>::ConstIterator DepIt;
for (DepIt it = d->lastDeployed.begin(); it != d->lastDeployed.end(); ++it) {
- fileList << it.key().file.localFilePath;
- remotePathList << it.key().file.remoteDir;
+ fileList << it.key().file.localFilePath().toString();
+ remotePathList << it.key().file.remoteDirectory();
hostList << it.key().host;
sysrootList << it.key().sysroot;
timeList << it.value();
diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.h b/src/plugins/remotelinux/abstractremotelinuxdeployservice.h
index ee11338d2f..15c455680f 100644
--- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.h
+++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.h
@@ -41,16 +41,12 @@ namespace QSsh { class SshConnection; }
namespace ProjectExplorer {
class BuildConfiguration;
+class DeployableFile;
class Kit;
}
namespace RemoteLinux {
-class DeployableFile;
-class DeploymentInfo;
-
-namespace Internal {
-class AbstractRemoteLinuxDeployServicePrivate;
-}
+namespace Internal { class AbstractRemoteLinuxDeployServicePrivate; }
class REMOTELINUX_EXPORT AbstractRemoteLinuxDeployService : public QObject
{
@@ -82,8 +78,8 @@ protected:
ProjectExplorer::IDevice::ConstPtr deviceConfiguration() const;
QSsh::SshConnection *connection() const;
- void saveDeploymentTimeStamp(const DeployableFile &deployableFile);
- bool hasChangedSinceLastDeployment(const DeployableFile &deployableFile) const;
+ void saveDeploymentTimeStamp(const ProjectExplorer::DeployableFile &deployableFile);
+ bool hasChangedSinceLastDeployment(const ProjectExplorer::DeployableFile &deployableFile) const;
void handleDeviceSetupDone(bool success);
void handleDeploymentDone();
diff --git a/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp b/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp
index d0c4d867cb..52735354ef 100644
--- a/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp
+++ b/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp
@@ -29,16 +29,18 @@
#include "abstractuploadandinstallpackageservice.h"
-#include "deployablefile.h"
#include "packageuploader.h"
#include "remotelinuxpackageinstaller.h"
+#include <projectexplorer/deployablefile.h>
#include <utils/qtcassert.h>
#include <ssh/sshconnection.h>
#include <QFileInfo>
#include <QString>
+using namespace ProjectExplorer;
+
namespace RemoteLinux {
namespace Internal {
namespace {
diff --git a/src/plugins/remotelinux/deployablefile.h b/src/plugins/remotelinux/deployablefile.h
deleted file mode 100644
index 2e08884c6d..0000000000
--- a/src/plugins/remotelinux/deployablefile.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 DEPLOYABLEFILE_H
-#define DEPLOYABLEFILE_H
-
-#include "remotelinux_export.h"
-
-#include <QFileInfo>
-#include <QHash>
-#include <QString>
-
-namespace RemoteLinux {
-
-class REMOTELINUX_EXPORT DeployableFile
-{
-public:
- DeployableFile() {}
-
- DeployableFile(const QString &localFilePath, const QString &remoteDir)
- : localFilePath(localFilePath), remoteDir(remoteDir) {}
-
- bool operator==(const DeployableFile &other) const
- {
- return localFilePath == other.localFilePath
- && remoteDir == other.remoteDir;
- }
-
- QString remoteFilePath() const {
- return remoteDir + QLatin1Char('/') + QFileInfo(localFilePath).fileName();
- }
-
- QString localFilePath;
- QString remoteDir;
-};
-
-inline uint qHash(const DeployableFile &d)
-{
- return qHash(qMakePair(d.localFilePath, d.remoteDir));
-}
-
-} // namespace RemoteLinux
-
-#endif // DEPLOYABLEFILE_H
diff --git a/src/plugins/remotelinux/deployablefilesperprofile.cpp b/src/plugins/remotelinux/deployablefilesperprofile.cpp
deleted file mode 100644
index ee3cf3a184..0000000000
--- a/src/plugins/remotelinux/deployablefilesperprofile.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 "deployablefilesperprofile.h"
-
-#include "deployablefile.h"
-
-#include <utils/qtcassert.h>
-
-#include <QFileInfo>
-#include <QDir>
-#include <QBrush>
-
-using namespace Qt4ProjectManager;
-
-namespace RemoteLinux {
-namespace Internal {
-class DeployableFilesPerProFilePrivate
-{
-public:
- DeployableFilesPerProFilePrivate(const Qt4ProFileNode *proFileNode)
- : projectType(proFileNode->projectType()),
- proFilePath(proFileNode->path()),
- projectName(proFileNode->displayName()),
- targetInfo(proFileNode->targetInformation()),
- installsList(proFileNode->installsList()),
- projectVersion(proFileNode->projectVersion()),
- config(proFileNode->variableValue(ConfigVar)),
- modified(true)
- {
- }
-
- const Qt4ProjectType projectType;
- const QString proFilePath;
- const QString projectName;
- const Qt4ProjectManager::TargetInformation targetInfo;
- const Qt4ProjectManager::InstallsList installsList;
- const Qt4ProjectManager::ProjectVersion projectVersion;
- const QStringList config;
- QList<DeployableFile> deployables;
- bool modified;
-};
-
-} // namespace Internal
-
-using namespace Internal;
-
-DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4ProFileNode *proFileNode,
- const QString &installPrefix, QObject *parent)
- : QAbstractTableModel(parent), d(new DeployableFilesPerProFilePrivate(proFileNode))
-{
- if (hasTargetPath()) {
- if (d->projectType == ApplicationTemplate) {
- d->deployables.prepend(DeployableFile(localExecutableFilePath(),
- d->installsList.targetPath));
- } else if (d->projectType == LibraryTemplate) {
- foreach (const QString &filePath, localLibraryFilePaths()) {
- d->deployables.prepend(DeployableFile(filePath,
- d->installsList.targetPath));
- }
- }
- }
-
- foreach (const InstallsItem &elem, d->installsList.items) {
- foreach (const QString &file, elem.files)
- d->deployables << DeployableFile(file, elem.path);
- }
-
- if (!installPrefix.isEmpty()) {
- for (int i = 0; i < d->deployables.count(); ++i)
- d->deployables[i].remoteDir.prepend(installPrefix + QLatin1Char('/'));
- }
-}
-
-DeployableFilesPerProFile::~DeployableFilesPerProFile()
-{
- delete d;
-}
-
-DeployableFile DeployableFilesPerProFile::deployableAt(int row) const
-{
- Q_ASSERT(row >= 0 && row < rowCount());
- return d->deployables.at(row);
-}
-
-int DeployableFilesPerProFile::rowCount(const QModelIndex &parent) const
-{
- return parent.isValid() ? 0 : d->deployables.count();
-}
-
-int DeployableFilesPerProFile::columnCount(const QModelIndex &parent) const
-{
- return parent.isValid() ? 0 : 2;
-}
-
-QVariant DeployableFilesPerProFile::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid() || index.row() >= rowCount())
- return QVariant();
-
- const DeployableFile &d = deployableAt(index.row());
- if (index.column() == 0 && role == Qt::DisplayRole)
- return QDir::toNativeSeparators(d.localFilePath);
- if (role == Qt::DisplayRole)
- return QDir::cleanPath(d.remoteDir);
- return QVariant();
-}
-
-QVariant DeployableFilesPerProFile::headerData(int section,
- Qt::Orientation orientation, int role) const
-{
- if (orientation == Qt::Vertical || role != Qt::DisplayRole)
- return QVariant();
- return section == 0 ? tr("Local File Path") : tr("Remote Directory");
-}
-
-QString DeployableFilesPerProFile::localExecutableFilePath() const
-{
- if (!d->targetInfo.valid || d->projectType != ApplicationTemplate)
- return QString();
- return QDir::cleanPath(d->targetInfo.workingDir + '/' + d->targetInfo.target);
-}
-
-QStringList DeployableFilesPerProFile::localLibraryFilePaths() const
-{
- QStringList list;
-
- if (!d->targetInfo.valid || d->projectType != LibraryTemplate)
- return list;
- QString basePath = d->targetInfo.workingDir + QLatin1String("/lib");
- const bool isStatic = d->config.contains(QLatin1String("static"))
- || d->config.contains(QLatin1String("staticlib"));
- basePath += d->targetInfo.target + QLatin1String(isStatic ? ".a" : ".so");
- basePath = QDir::cleanPath(basePath);
- if (!isStatic && !d->config.contains(QLatin1String("plugin"))) {
- const QChar dot(QLatin1Char('.'));
- const QString filePathMajor = basePath + dot
- + QString::number(d->projectVersion.major);
- const QString filePathMinor = filePathMajor + dot
- + QString::number(d->projectVersion.minor);
- const QString filePathPatch = filePathMinor + dot
- + QString::number(d->projectVersion.patch);
- list << filePathPatch << filePathMinor << filePathMajor;
- }
- return list << basePath;
-}
-
-QString DeployableFilesPerProFile::remoteExecutableFilePath() const
-{
- return hasTargetPath() && d->projectType == ApplicationTemplate
- ? deployableAt(0).remoteDir + QLatin1Char('/')
- + QFileInfo(localExecutableFilePath()).fileName()
- : QString();
-}
-
-QString DeployableFilesPerProFile::projectDir() const
-{
- return QFileInfo(d->proFilePath).dir().path();
-}
-
-bool DeployableFilesPerProFile::hasTargetPath() const
-{
- return !d->installsList.targetPath.isEmpty();
-}
-
-bool DeployableFilesPerProFile::isModified() const { return d->modified; }
-void DeployableFilesPerProFile::setUnModified() { d->modified = false; }
-QString DeployableFilesPerProFile::projectName() const { return d->projectName; }
-QString DeployableFilesPerProFile::proFilePath() const { return d->proFilePath; }
-Qt4ProjectType DeployableFilesPerProFile::projectType() const { return d->projectType; }
-QString DeployableFilesPerProFile::applicationName() const { return d->targetInfo.target; }
-
-} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/deployablefilesperprofile.h b/src/plugins/remotelinux/deployablefilesperprofile.h
deleted file mode 100644
index 3d10eca359..0000000000
--- a/src/plugins/remotelinux/deployablefilesperprofile.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 DEPLOYABLEFILESPERPROFILE_H
-#define DEPLOYABLEFILESPERPROFILE_H
-
-#include "remotelinux_export.h"
-
-#include <qt4projectmanager/qt4nodes.h>
-
-#include <QAbstractTableModel>
-#include <QList>
-#include <QString>
-
-namespace RemoteLinux {
-class DeployableFile;
-
-namespace Internal {
-class DeployableFilesPerProFilePrivate;
-}
-
-class REMOTELINUX_EXPORT DeployableFilesPerProFile : public QAbstractTableModel
-{
- Q_OBJECT
-public:
- DeployableFilesPerProFile(const Qt4ProjectManager::Qt4ProFileNode *proFileNode,
- const QString &installPrefix, QObject *parent);
- ~DeployableFilesPerProFile();
-
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
- DeployableFile deployableAt(int row) const;
- bool isModified() const;
- void setUnModified();
- QString localExecutableFilePath() const;
- QString remoteExecutableFilePath() const;
- QString projectName() const;
- QString projectDir() const;
- QString proFilePath() const;
- Qt4ProjectManager::Qt4ProjectType projectType() const;
- bool isApplicationProject() const { return projectType() == Qt4ProjectManager::ApplicationTemplate; }
- QString applicationName() const;
- bool hasTargetPath() const;
-
-private:
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index,
- int role = Qt::DisplayRole) const;
- virtual QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const;
-
- QStringList localLibraryFilePaths() const;
-
- Internal::DeployableFilesPerProFilePrivate * const d;
-};
-
-} // namespace RemoteLinux
-
-#endif // DEPLOYABLEFILESPERPROFILE_H
diff --git a/src/plugins/remotelinux/deploymentinfo.cpp b/src/plugins/remotelinux/deploymentinfo.cpp
deleted file mode 100644
index c23219798a..0000000000
--- a/src/plugins/remotelinux/deploymentinfo.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 "deploymentinfo.h"
-
-#include "deployablefile.h"
-#include "deployablefilesperprofile.h"
-#include "remotelinuxdeployconfiguration.h"
-
-#include <projectexplorer/buildstep.h>
-#include <projectexplorer/target.h>
-#include <qt4projectmanager/qt4project.h>
-#include <qtsupport/qtkitinformation.h>
-
-#include <QList>
-#include <QTimer>
-
-using namespace Qt4ProjectManager;
-
-namespace RemoteLinux {
-namespace Internal {
-class DeploymentInfoPrivate
-{
-public:
- DeploymentInfoPrivate(const Qt4ProjectManager::Qt4Project *p) : project(p) {}
-
- QList<DeployableFilesPerProFile *> listModels;
- const Qt4ProjectManager::Qt4Project *const project;
- QString installPrefix;
-};
-} // namespace Internal
-
-using namespace Internal;
-
-DeploymentInfo::DeploymentInfo(Qt4ProjectManager::Qt4Project *project, const QString &installPrefix)
- : QAbstractListModel(project), d(new DeploymentInfoPrivate(project))
-{
- connect(project, SIGNAL(proFilesEvaluated()), SLOT(createModels()));
- setInstallPrefix(installPrefix);
-}
-
-DeploymentInfo::~DeploymentInfo()
-{
- delete d;
-}
-
-void DeploymentInfo::createModels()
-{
- ProjectExplorer::Target *target = d->project->activeTarget();
- if (!target
- || !target->activeDeployConfiguration()
- || !qobject_cast<RemoteLinuxDeployConfiguration *>(target->activeDeployConfiguration()))
- return;
-
- QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target->kit());
- if (!version || !version->isValid()) {
- beginResetModel();
- qDeleteAll(d->listModels);
- d->listModels.clear();
- endResetModel();
- return;
- }
- const Qt4ProFileNode *const rootNode = d->project->rootQt4ProjectNode();
- if (!rootNode || rootNode->parseInProgress()) // Can be null right after project creation by wizard.
- return;
- disconnect(d->project, SIGNAL(proFilesEvaluated()), this, SLOT(createModels()));
- beginResetModel();
- qDeleteAll(d->listModels);
- d->listModels.clear();
- createModels(rootNode);
- endResetModel();
- connect (d->project, SIGNAL(proFilesEvaluated()), SLOT(createModels()));
-}
-
-void DeploymentInfo::createModels(const Qt4ProFileNode *proFileNode)
-{
- switch (proFileNode->projectType()) {
- case ApplicationTemplate:
- case LibraryTemplate:
- case AuxTemplate:
- d->listModels << new DeployableFilesPerProFile(proFileNode, d->installPrefix, this);
- break;
- case SubDirsTemplate: {
- const QList<Qt4PriFileNode *> &subProjects = proFileNode->subProjectNodesExact();
- foreach (const ProjectExplorer::ProjectNode * const subProject, subProjects) {
- const Qt4ProFileNode * const qt4SubProject
- = qobject_cast<const Qt4ProFileNode *>(subProject);
- if (!qt4SubProject)
- continue;
- if (qt4SubProject->path().endsWith(QLatin1String(".pri")))
- continue;
- if (!proFileNode->isSubProjectDeployable(subProject->path()))
- continue;
- createModels(qt4SubProject);
- }
- }
- default:
- break;
- }
-}
-
-void DeploymentInfo::setUnmodified()
-{
- foreach (DeployableFilesPerProFile * const model, d->listModels)
- model->setUnModified();
-}
-
-bool DeploymentInfo::isModified() const
-{
- foreach (const DeployableFilesPerProFile * const model, d->listModels) {
- if (model->isModified())
- return true;
- }
- return false;
-}
-
-void DeploymentInfo::setInstallPrefix(const QString &installPrefix)
-{
- d->installPrefix = installPrefix;
- createModels();
-}
-
-int DeploymentInfo::deployableCount() const
-{
- int count = 0;
- foreach (const DeployableFilesPerProFile * const model, d->listModels)
- count += model->rowCount();
- return count;
-}
-
-DeployableFile DeploymentInfo::deployableAt(int i) const
-{
- foreach (const DeployableFilesPerProFile * const model, d->listModels) {
- Q_ASSERT(i >= 0);
- if (i < model->rowCount())
- return model->deployableAt(i);
- i -= model->rowCount();
- }
-
- Q_ASSERT(!"Invalid deployable number");
- return DeployableFile(QString(), QString());
-}
-
-QString DeploymentInfo::remoteExecutableFilePath(const QString &localExecutableFilePath) const
-{
- foreach (const DeployableFilesPerProFile * const model, d->listModels) {
- if (model->localExecutableFilePath() == localExecutableFilePath)
- return model->remoteExecutableFilePath();
- }
- return QString();
-}
-
-int DeploymentInfo::rowCount(const QModelIndex &parent) const
-{
- return parent.isValid() ? 0 : modelCount();
-}
-
-QVariant DeploymentInfo::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid() || index.row() < 0 || index.row() >= modelCount()
- || index.column() != 0)
- return QVariant();
- const DeployableFilesPerProFile * const model = d->listModels.at(index.row());
- if (role == Qt::ForegroundRole && model->projectType() != AuxTemplate
- && !model->hasTargetPath()) {
- QBrush brush;
- brush.setColor(Qt::red);
- return brush;
- }
- if (role == Qt::DisplayRole)
- return QFileInfo(model->proFilePath()).fileName();
- return QVariant();
-}
-
-int DeploymentInfo::modelCount() const { return d->listModels.count(); }
-DeployableFilesPerProFile *DeploymentInfo::modelAt(int i) const { return d->listModels.at(i); }
-
-} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/deploymentinfo.h b/src/plugins/remotelinux/deploymentinfo.h
deleted file mode 100644
index a97d11399d..0000000000
--- a/src/plugins/remotelinux/deploymentinfo.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 DEPLOYMENTINFO_H
-#define DEPLOYMENTINFO_H
-
-#include "remotelinux_export.h"
-
-#include <QAbstractListModel>
-
-namespace ProjectExplorer { class Target; }
-namespace Qt4ProjectManager {
-class Qt4ProFileNode;
-class Qt4Project;
-} // namespace Qt4ProjectManager
-
-namespace RemoteLinux {
-class DeployableFile;
-class DeployableFilesPerProFile;
-
-namespace Internal {
-class DeploymentInfoPrivate;
-}
-
-class REMOTELINUX_EXPORT DeploymentInfo : public QAbstractListModel
-{
- Q_OBJECT
-public:
- DeploymentInfo(Qt4ProjectManager::Qt4Project *project, const QString &installPrefix = QString());
- ~DeploymentInfo();
-
- void setUnmodified();
- bool isModified() const;
- void setInstallPrefix(const QString &installPrefix);
- int deployableCount() const;
- DeployableFile deployableAt(int i) const;
- QString remoteExecutableFilePath(const QString &localExecutableFilePath) const;
- int modelCount() const;
- DeployableFilesPerProFile *modelAt(int i) const;
-
-private slots:
- void createModels();
-
-private:
- virtual int rowCount(const QModelIndex &parent) const;
- virtual QVariant data(const QModelIndex &index, int role) const;
-
- void createModels(const Qt4ProjectManager::Qt4ProFileNode *proFileNode);
-
- Internal::DeploymentInfoPrivate * const d;
-};
-
-} // namespace RemoteLinux
-
-#endif // DEPLOYMENTINFO_H
diff --git a/src/plugins/remotelinux/deploymentsettingsassistant.cpp b/src/plugins/remotelinux/deploymentsettingsassistant.cpp
deleted file mode 100644
index 6f77c5e152..0000000000
--- a/src/plugins/remotelinux/deploymentsettingsassistant.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 "deploymentsettingsassistant.h"
-
-#include "deploymentinfo.h"
-#include "deployablefile.h"
-#include "deployablefilesperprofile.h"
-#include "profilesupdatedialog.h"
-#include "remotelinuxdeployconfiguration.h"
-
-#include <coreplugin/documentmanager.h>
-#include <coreplugin/icore.h>
-#include <projectexplorer/project.h>
-#include <projectexplorer/target.h>
-#include <qt4projectmanager/qt4nodes.h>
-#include <utils/fileutils.h>
-#include <utils/qtcassert.h>
-
-#include <QDir>
-#include <QHash>
-#include <QString>
-
-using namespace Qt4ProjectManager;
-
-namespace RemoteLinux {
-namespace Internal {
-namespace {
-
-enum ProFileUpdateSetting { UpdateProFile, DontUpdateProFile };
-typedef QHash<QString, ProFileUpdateSetting> UpdateSettingsMap;
-
-} // anonymous namespace
-
-class DeploymentSettingsAssistantInternal
-{
-public:
- DeploymentSettingsAssistantInternal(DeploymentInfo *deploymentInfo)
- : deploymentInfo(deploymentInfo)
- {
- }
-
- DeploymentInfo * const deploymentInfo;
- UpdateSettingsMap updateSettings;
-};
-
-} // namespace Internal
-
-using namespace Internal;
-
-DeploymentSettingsAssistant::DeploymentSettingsAssistant(DeploymentInfo *deploymentInfo,
- ProjectExplorer::Project *parent)
- : QObject(parent),
- d(new DeploymentSettingsAssistantInternal(deploymentInfo))
-{
- connect(d->deploymentInfo, SIGNAL(modelReset()), SLOT(handleDeploymentInfoUpdated()));
-}
-
-DeploymentSettingsAssistant::~DeploymentSettingsAssistant()
-{
- delete d;
-}
-
-bool DeploymentSettingsAssistant::addDeployableToProFile(const QString &qmakeScope,
- const DeployableFilesPerProFile *proFileInfo, const QString &variableName,
- const DeployableFile &deployable)
-{
- const QString filesLine = variableName + QLatin1String(".files = ")
- + QDir(proFileInfo->projectDir()).relativeFilePath(deployable.localFilePath);
- const QString pathLine = variableName + QLatin1String(".path = ") + deployable.remoteDir;
- const QString installsLine = QLatin1String("INSTALLS += ") + variableName;
- return addLinesToProFile(qmakeScope, proFileInfo,
- QStringList() << filesLine << pathLine << installsLine);
-}
-
-bool DeploymentSettingsAssistant::addLinesToProFile(const QString &qmakeScope,
- const DeployableFilesPerProFile *proFileInfo,
- const QStringList &lines)
-{
- Core::FileChangeBlocker update(proFileInfo->proFilePath());
-
- const QString separator = QLatin1String("\n ");
- const QString proFileString = QLatin1Char('\n') + qmakeScope + QLatin1String(" {")
- + separator + lines.join(separator) + QLatin1String("\n}\n");
- Utils::FileSaver saver(proFileInfo->proFilePath(), QIODevice::Append);
- saver.write(proFileString.toLocal8Bit());
- return saver.finalize(Core::ICore::mainWindow());
-}
-
-void DeploymentSettingsAssistant::handleDeploymentInfoUpdated()
-{
- ProjectExplorer::Project *project = static_cast<ProjectExplorer::Project *>(parent());
- QStringList scopes;
- QStringList pathes;
- foreach (ProjectExplorer::Target *target, project->targets()) {
- foreach (ProjectExplorer::DeployConfiguration *dc, target->deployConfigurations()) {
- RemoteLinuxDeployConfiguration *rldc = qobject_cast<RemoteLinuxDeployConfiguration *>(dc);
- if (!rldc)
- continue;
- const QString scope = rldc->qmakeScope();
- if (!scopes.contains(scope)) {
- scopes.append(scope);
- pathes.append(rldc->installPrefix());
- }
- }
- }
- if (scopes.isEmpty())
- return;
-
- QList<DeployableFilesPerProFile *> proFilesToAskAbout;
- QList<DeployableFilesPerProFile *> proFilesToUpdate;
- for (int i = 0; i < d->deploymentInfo->modelCount(); ++i) {
- DeployableFilesPerProFile * const proFileInfo = d->deploymentInfo->modelAt(i);
- if (proFileInfo->projectType() != AuxTemplate && !proFileInfo->hasTargetPath()) {
- const UpdateSettingsMap::ConstIterator it
- = d->updateSettings.find(proFileInfo->proFilePath());
- if (it == d->updateSettings.constEnd())
- proFilesToAskAbout << proFileInfo;
- else if (it.value() == UpdateProFile)
- proFilesToUpdate << proFileInfo;
- }
- }
-
- if (!proFilesToAskAbout.isEmpty()) {
- ProFilesUpdateDialog dialog(proFilesToAskAbout);
- dialog.exec();
- const QList<ProFilesUpdateDialog::UpdateSetting> &settings = dialog.getUpdateSettings();
- foreach (const ProFilesUpdateDialog::UpdateSetting &setting, settings) {
- const ProFileUpdateSetting updateSetting = setting.second
- ? UpdateProFile : DontUpdateProFile;
- d->updateSettings.insert(setting.first->proFilePath(), updateSetting);
- if (updateSetting == UpdateProFile)
- proFilesToUpdate << setting.first;
- }
- }
-
- foreach (const DeployableFilesPerProFile * const proFileInfo, proFilesToUpdate) {
- const QString remoteDirSuffix = QLatin1String(proFileInfo->projectType() == LibraryTemplate
- ? "/lib" : "/bin");
- for (int i = 0; i < scopes.count(); ++i) {
- const QString remoteDir = QLatin1String("target.path = ") + pathes.at(i)
- + QLatin1Char('/') + proFileInfo->projectName() + remoteDirSuffix;
- const QStringList deployInfo = QStringList() << remoteDir
- << QLatin1String("INSTALLS += target");
- addLinesToProFile(scopes.at(i), proFileInfo, deployInfo);
- }
- }
-}
-
-} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/deploymentsettingsassistant.h b/src/plugins/remotelinux/deploymentsettingsassistant.h
deleted file mode 100644
index 7bd12bff3d..0000000000
--- a/src/plugins/remotelinux/deploymentsettingsassistant.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 DEPLOYMENTSETTINGSASSISTANT_H
-#define DEPLOYMENTSETTINGSASSISTANT_H
-
-#include "remotelinux_export.h"
-
-#include <QObject>
-#include <QStringList>
-
-namespace ProjectExplorer { class Project; }
-
-namespace RemoteLinux {
-class DeployableFile;
-class DeployableFilesPerProFile;
-class DeploymentInfo;
-
-namespace Internal { class DeploymentSettingsAssistantInternal; }
-
-class REMOTELINUX_EXPORT DeploymentSettingsAssistant : public QObject
-{
- Q_OBJECT
-
-public:
- DeploymentSettingsAssistant(DeploymentInfo *deploymentInfo, ProjectExplorer::Project *parent);
- ~DeploymentSettingsAssistant();
-
- bool addDeployableToProFile(const QString &qmakeScope,
- const DeployableFilesPerProFile *proFileInfo,
- const QString &variableName, const DeployableFile &deployable);
-
-private slots:
- void handleDeploymentInfoUpdated();
-
-private:
- bool addLinesToProFile(const QString &qmakeScope, const DeployableFilesPerProFile *proFileInfo, const QStringList &lines);
-
- Internal::DeploymentSettingsAssistantInternal * const d;
-};
-
-} // namespace RemoteLinux
-
-#endif // DEPLOYMENTSETTINGSASSISTANT_H
diff --git a/src/plugins/remotelinux/genericdirectuploadservice.cpp b/src/plugins/remotelinux/genericdirectuploadservice.cpp
index 8e4a0ff11a..016b0233b3 100644
--- a/src/plugins/remotelinux/genericdirectuploadservice.cpp
+++ b/src/plugins/remotelinux/genericdirectuploadservice.cpp
@@ -28,8 +28,7 @@
****************************************************************************/
#include "genericdirectuploadservice.h"
-#include "deployablefile.h"
-
+#include <projectexplorer/deployablefile.h>
#include <utils/qtcassert.h>
#include <ssh/sftpchannel.h>
#include <ssh/sshconnection.h>
@@ -40,6 +39,7 @@
#include <QList>
#include <QString>
+using namespace ProjectExplorer;
using namespace QSsh;
namespace RemoteLinux {
@@ -162,8 +162,9 @@ void GenericDirectUploadService::handleUploadFinished(QSsh::SftpJobId jobId, con
const DeployableFile df = d->filesToUpload.takeFirst();
if (!errorMsg.isEmpty()) {
QString errorString = tr("Upload of file '%1' failed. The server said: '%2'.")
- .arg(QDir::toNativeSeparators(df.localFilePath), errorMsg);
- if (errorMsg == QLatin1String("Failure") && df.remoteDir.contains(QLatin1String("/bin"))) {
+ .arg(df.localFilePath().toUserOutput(), errorMsg);
+ if (errorMsg == QLatin1String("Failure")
+ && df.remoteDirectory().contains(QLatin1String("/bin"))) {
errorString += QLatin1Char(' ') + tr("If '%1' is currently running "
"on the remote host, you might need to stop it first.").arg(df.remoteFilePath());
}
@@ -174,7 +175,7 @@ void GenericDirectUploadService::handleUploadFinished(QSsh::SftpJobId jobId, con
saveDeploymentTimeStamp(df);
// Terrible hack for Windows.
- if (df.remoteDir.contains(QLatin1String("bin"))) {
+ if (df.remoteDirectory().contains(QLatin1String("bin"))) {
const QString command = QLatin1String("chmod a+x ") + df.remoteFilePath();
connection()->createRemoteProcess(command.toUtf8())->start();
}
@@ -193,7 +194,7 @@ void GenericDirectUploadService::handleLnFinished(int exitStatus)
}
const DeployableFile df = d->filesToUpload.takeFirst();
- const QString nativePath = QDir::toNativeSeparators(df.localFilePath);
+ const QString nativePath = df.localFilePath().toUserOutput();
if (exitStatus != SshRemoteProcess::NormalExit || d->lnProc->exitCode() != 0) {
emit errorMessage(tr("Failed to upload file '%1'.").arg(nativePath));
setFinished();
@@ -215,8 +216,8 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus)
}
const DeployableFile &df = d->filesToUpload.first();
- QFileInfo fi(df.localFilePath);
- const QString nativePath = QDir::toNativeSeparators(df.localFilePath);
+ QFileInfo fi = df.localFilePath().toFileInfo();
+ const QString nativePath = df.localFilePath().toUserOutput();
if (exitStatus != SshRemoteProcess::NormalExit || d->mkdirProc->exitCode() != 0) {
emit errorMessage(tr("Failed to upload file '%1'.").arg(nativePath));
setFinished();
@@ -226,7 +227,7 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus)
d->filesToUpload.removeFirst();
uploadNextFile();
} else {
- const QString remoteFilePath = df.remoteDir + QLatin1Char('/') + fi.fileName();
+ const QString remoteFilePath = df.remoteDirectory() + QLatin1Char('/') + fi.fileName();
if (fi.isSymLink()) {
const QString target = fi.dir().relativeFilePath(fi.symLinkTarget()); // see QTBUG-5817.
const QString command = QLatin1String("ln -sf ") + target + QLatin1Char(' ')
@@ -239,8 +240,8 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus)
connect(d->lnProc.data(), SIGNAL(readyReadStandardError()), SLOT(handleStdErrData()));
d->lnProc->start();
} else {
- const SftpJobId job = d->uploader->uploadFile(df.localFilePath, remoteFilePath,
- SftpOverwriteExisting);
+ const SftpJobId job = d->uploader->uploadFile(df.localFilePath().toString(),
+ remoteFilePath, SftpOverwriteExisting);
if (job == SftpInvalidJob) {
emit errorMessage(tr("Failed to upload file '%1': "
"Could not open for reading.").arg(nativePath));
@@ -275,16 +276,16 @@ void GenericDirectUploadService::stopDeployment()
void GenericDirectUploadService::checkDeploymentNeeded(const DeployableFile &deployable) const
{
- QFileInfo fileInfo(deployable.localFilePath);
+ QFileInfo fileInfo = deployable.localFilePath().toFileInfo();
if (fileInfo.isDir()) {
- const QStringList files = QDir(deployable.localFilePath)
+ const QStringList files = QDir(deployable.localFilePath().toString())
.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
if (files.isEmpty() && (!d->incremental || hasChangedSinceLastDeployment(deployable)))
d->filesToUpload << deployable;
foreach (const QString &fileName, files) {
- const QString localFilePath = deployable.localFilePath
+ const QString localFilePath = deployable.localFilePath().toString()
+ QLatin1Char('/') + fileName;
- const QString remoteDir = deployable.remoteDir + QLatin1Char('/')
+ const QString remoteDir = deployable.remoteDirectory() + QLatin1Char('/')
+ fileInfo.fileName();
checkDeploymentNeeded(DeployableFile(localFilePath, remoteDir));
}
@@ -317,16 +318,16 @@ void GenericDirectUploadService::uploadNextFile()
}
const DeployableFile &df = d->filesToUpload.first();
- QString dirToCreate = df.remoteDir;
+ QString dirToCreate = df.remoteDirectory();
if (dirToCreate.isEmpty()) {
emit warningMessage(tr("Warning: No remote path set for local file '%1'. Skipping upload.")
- .arg(QDir::toNativeSeparators(df.localFilePath)));
+ .arg(df.localFilePath().toUserOutput()));
d->filesToUpload.takeFirst();
uploadNextFile();
return;
}
- QFileInfo fi(df.localFilePath);
+ QFileInfo fi = df.localFilePath().toFileInfo();
if (fi.isDir())
dirToCreate += QLatin1Char('/') + fi.fileName();
const QString command = QLatin1String("mkdir -p ") + dirToCreate;
@@ -335,7 +336,7 @@ void GenericDirectUploadService::uploadNextFile()
connect(d->mkdirProc.data(), SIGNAL(readyReadStandardOutput()), SLOT(handleStdOutData()));
connect(d->mkdirProc.data(), SIGNAL(readyReadStandardError()), SLOT(handleStdErrData()));
emit progressMessage(tr("Uploading file '%1'...")
- .arg(QDir::toNativeSeparators(df.localFilePath)));
+ .arg(df.localFilePath().toUserOutput()));
d->mkdirProc->start();
}
diff --git a/src/plugins/remotelinux/genericdirectuploadservice.h b/src/plugins/remotelinux/genericdirectuploadservice.h
index a36ba3e07d..cb42e4fafb 100644
--- a/src/plugins/remotelinux/genericdirectuploadservice.h
+++ b/src/plugins/remotelinux/genericdirectuploadservice.h
@@ -38,8 +38,9 @@
QT_FORWARD_DECLARE_CLASS(QString)
+namespace ProjectExplorer { class DeployableFile; }
+
namespace RemoteLinux {
-class DeployableFile;
namespace Internal { class GenericDirectUploadServicePrivate; }
class REMOTELINUX_EXPORT GenericDirectUploadService : public AbstractRemoteLinuxDeployService
@@ -49,7 +50,7 @@ public:
GenericDirectUploadService(QObject *parent = 0);
~GenericDirectUploadService();
- void setDeployableFiles(const QList<DeployableFile> &deployableFiles);
+ void setDeployableFiles(const QList<ProjectExplorer::DeployableFile> &deployableFiles);
void setIncrementalDeployment(bool incremental);
protected:
@@ -71,7 +72,7 @@ private slots:
void handleStdErrData();
private:
- void checkDeploymentNeeded(const DeployableFile &file) const;
+ void checkDeploymentNeeded(const ProjectExplorer::DeployableFile &file) const;
void setFinished();
void uploadNextFile();
diff --git a/src/plugins/remotelinux/genericdirectuploadstep.cpp b/src/plugins/remotelinux/genericdirectuploadstep.cpp
index bfcc05337d..773fbf3fdc 100644
--- a/src/plugins/remotelinux/genericdirectuploadstep.cpp
+++ b/src/plugins/remotelinux/genericdirectuploadstep.cpp
@@ -28,11 +28,12 @@
****************************************************************************/
#include "genericdirectuploadstep.h"
-#include "deployablefile.h"
-#include "deploymentinfo.h"
#include "genericdirectuploadservice.h"
#include "remotelinuxdeployconfiguration.h"
+#include <projectexplorer/deploymentdata.h>
+#include <projectexplorer/target.h>
+
#include <QCheckBox>
#include <QVBoxLayout>
#include <QList>
@@ -108,12 +109,7 @@ BuildStepConfigWidget *GenericDirectUploadStep::createConfigWidget()
bool GenericDirectUploadStep::initInternal(QString *error)
{
- QList<DeployableFile> deployableFiles;
- const DeploymentInfo * const deploymentInfo = deployConfiguration()->deploymentInfo();
- const int deployableCount = deploymentInfo->deployableCount();
- for (int i = 0; i < deployableCount; ++i)
- deployableFiles << deploymentInfo->deployableAt(i);
- deployService()->setDeployableFiles(deployableFiles);
+ deployService()->setDeployableFiles(target()->deploymentData().allFiles());
deployService()->setIncrementalDeployment(incrementalDeployment());
return deployService()->isDeploymentPossible(error);
}
diff --git a/src/plugins/remotelinux/profilesupdatedialog.cpp b/src/plugins/remotelinux/profilesupdatedialog.cpp
deleted file mode 100644
index e04014814c..0000000000
--- a/src/plugins/remotelinux/profilesupdatedialog.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 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 "profilesupdatedialog.h"
-#include "ui_profilesupdatedialog.h"
-
-#include "deployablefilesperprofile.h"
-
-#include <qt4projectmanager/qt4nodes.h>
-
-#include <QDir>
-#include <QTableWidgetItem>
-
-namespace RemoteLinux {
-namespace Internal {
-
-ProFilesUpdateDialog::ProFilesUpdateDialog(const QList<DeployableFilesPerProFile *> &models,
- QWidget *parent)
- : QDialog(parent),
- m_models(models),
- ui(new Ui::ProFilesUpdateDialog)
-{
- ui->setupUi(this);
- ui->tableWidget->setRowCount(models.count());
- ui->tableWidget->setHorizontalHeaderItem(0,
- new QTableWidgetItem(tr("Updateable Project Files")));
- for (int row = 0; row < models.count(); ++row) {
- QTableWidgetItem *const item
- = new QTableWidgetItem(QDir::toNativeSeparators(models.at(row)->proFilePath()));
- item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
- item->setCheckState(Qt::Unchecked);
- ui->tableWidget->setItem(row, 0, item);
- }
- ui->tableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
- ui->tableWidget->resizeRowsToContents();
- connect(ui->checkAllButton, SIGNAL(clicked()), this, SLOT(checkAll()));
- connect(ui->uncheckAllButton, SIGNAL(clicked()), this, SLOT(uncheckAll()));
-}
-
-ProFilesUpdateDialog::~ProFilesUpdateDialog()
-{
- delete ui;
-}
-
-void ProFilesUpdateDialog::checkAll()
-{
- setCheckStateForAll(Qt::Checked);
-}
-
-void ProFilesUpdateDialog::uncheckAll()
-{
- setCheckStateForAll(Qt::Unchecked);
-}
-
-void ProFilesUpdateDialog::setCheckStateForAll(Qt::CheckState checkState)
-{
- for (int row = 0; row < ui->tableWidget->rowCount(); ++row) {
- ui->tableWidget->item(row, 0)->setCheckState(checkState);
- }
-}
-
-QList<ProFilesUpdateDialog::UpdateSetting> ProFilesUpdateDialog::getUpdateSettings() const
-{
- QList<UpdateSetting> settings;
- for (int row = 0; row < m_models.count(); ++row) {
- const bool doUpdate = result() != Rejected
- && ui->tableWidget->item(row, 0)->checkState() == Qt::Checked;
- settings << UpdateSetting(m_models.at(row), doUpdate);
- }
- return settings;
-}
-
-} // namespace RemoteLinux
-} // namespace Internal
diff --git a/src/plugins/remotelinux/profilesupdatedialog.ui b/src/plugins/remotelinux/profilesupdatedialog.ui
deleted file mode 100644
index 7885a3f418..0000000000
--- a/src/plugins/remotelinux/profilesupdatedialog.ui
+++ /dev/null
@@ -1,139 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>RemoteLinux::Internal::ProFilesUpdateDialog</class>
- <widget class="QDialog" name="RemoteLinux::Internal::ProFilesUpdateDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>659</width>
- <height>494</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Maemo Deployment Issue</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="infoLabel">
- <property name="text">
- <string>The project files listed below do not contain deployment information, which means the respective targets cannot be deployed to and/or run on a device. Qt Creator will add the missing information to these files if you check the respective rows below.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QPushButton" name="checkAllButton">
- <property name="text">
- <string>&amp;Check all</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="uncheckAllButton">
- <property name="text">
- <string>&amp;Uncheck All</string>
- </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>
- </layout>
- </item>
- <item>
- <widget class="Line" name="line_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTableWidget" name="tableWidget">
- <property name="showGrid">
- <bool>false</bool>
- </property>
- <property name="columnCount">
- <number>1</number>
- </property>
- <attribute name="horizontalHeaderDefaultSectionSize">
- <number>200</number>
- </attribute>
- <attribute name="horizontalHeaderStretchLastSection">
- <bool>true</bool>
- </attribute>
- <attribute name="verticalHeaderVisible">
- <bool>false</bool>
- </attribute>
- <column/>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>RemoteLinux::Internal::ProFilesUpdateDialog</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>RemoteLinux::Internal::ProFilesUpdateDialog</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/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro
index 6059ce60ab..aaa4162a03 100644
--- a/src/plugins/remotelinux/remotelinux.pro
+++ b/src/plugins/remotelinux/remotelinux.pro
@@ -21,9 +21,6 @@ HEADERS += \
remotelinuxruncontrolfactory.h \
remotelinuxdebugsupport.h \
genericlinuxdeviceconfigurationwizardpages.h \
- deployablefile.h \
- deployablefilesperprofile.h \
- deploymentinfo.h \
abstractremotelinuxdeploystep.h \
genericdirectuploadstep.h \
uploadandinstalltarpackagestep.h \
@@ -44,14 +41,13 @@ HEADERS += \
sshkeydeployer.h \
typespecificdeviceconfigurationlistmodel.h \
remotelinuxutils.h \
- deploymentsettingsassistant.h \
remotelinuxdeployconfigurationwidget.h \
- profilesupdatedialog.h \
remotelinuxcustomcommanddeployservice.h \
remotelinuxcustomcommanddeploymentstep.h \
genericlinuxdeviceconfigurationwidget.h \
remotelinuxcheckforfreediskspaceservice.h \
- remotelinuxcheckforfreediskspacestep.h
+ remotelinuxcheckforfreediskspacestep.h \
+ remotelinuxdeploymentdatamodel.h
SOURCES += \
embeddedlinuxqtversion.cpp \
@@ -68,8 +64,6 @@ SOURCES += \
remotelinuxruncontrolfactory.cpp \
remotelinuxdebugsupport.cpp \
genericlinuxdeviceconfigurationwizardpages.cpp \
- deployablefilesperprofile.cpp \
- deploymentinfo.cpp \
abstractremotelinuxdeploystep.cpp \
genericdirectuploadstep.cpp \
uploadandinstalltarpackagestep.cpp \
@@ -89,20 +83,18 @@ SOURCES += \
sshkeydeployer.cpp \
typespecificdeviceconfigurationlistmodel.cpp \
remotelinuxutils.cpp \
- deploymentsettingsassistant.cpp \
remotelinuxdeployconfigurationwidget.cpp \
- profilesupdatedialog.cpp \
remotelinuxcustomcommanddeployservice.cpp \
remotelinuxcustomcommanddeploymentstep.cpp \
genericlinuxdeviceconfigurationwidget.cpp \
remotelinuxcheckforfreediskspaceservice.cpp \
- remotelinuxcheckforfreediskspacestep.cpp
+ remotelinuxcheckforfreediskspacestep.cpp \
+ remotelinuxdeploymentdatamodel.cpp
FORMS += \
genericlinuxdeviceconfigurationwizardsetuppage.ui \
linuxdevicetestdialog.ui \
remotelinuxdeployconfigurationwidget.ui \
- profilesupdatedialog.ui \
genericlinuxdeviceconfigurationwidget.ui \
remotelinuxcheckforfreediskspacestepwidget.ui
diff --git a/src/plugins/remotelinux/remotelinux.qbs b/src/plugins/remotelinux/remotelinux.qbs
index 221172e322..8246f6b39d 100644
--- a/src/plugins/remotelinux/remotelinux.qbs
+++ b/src/plugins/remotelinux/remotelinux.qbs
@@ -9,61 +9,58 @@ QtcPlugin {
Depends { name: "Core" }
Depends { name: "Debugger" }
Depends { name: "ProjectExplorer" }
- Depends { name: "Qt4ProjectManager" }
Depends { name: "QtSupport" }
Depends { name: "QtcSsh" }
- Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
-
files: [
"abstractpackagingstep.cpp",
"abstractpackagingstep.h",
"abstractremotelinuxdeployservice.cpp",
"abstractremotelinuxdeployservice.h",
+ "abstractremotelinuxdeploystep.cpp",
"abstractremotelinuxdeploystep.h",
"abstractuploadandinstallpackageservice.cpp",
"abstractuploadandinstallpackageservice.h",
- "deployablefile.h",
- "deployablefilesperprofile.cpp",
- "deployablefilesperprofile.h",
- "deploymentinfo.cpp",
- "deploymentinfo.h",
- "deploymentsettingsassistant.cpp",
- "deploymentsettingsassistant.h",
"embeddedlinuxqtversion.cpp",
"embeddedlinuxqtversion.h",
"embeddedlinuxqtversionfactory.cpp",
"embeddedlinuxqtversionfactory.h",
"genericdirectuploadservice.cpp",
+ "genericdirectuploadservice.h",
+ "genericdirectuploadstep.cpp",
"genericdirectuploadstep.h",
"genericlinuxdeviceconfigurationfactory.cpp",
"genericlinuxdeviceconfigurationfactory.h",
+ "genericlinuxdeviceconfigurationwidget.cpp",
+ "genericlinuxdeviceconfigurationwidget.h",
+ "genericlinuxdeviceconfigurationwidget.ui",
"genericlinuxdeviceconfigurationwizard.cpp",
"genericlinuxdeviceconfigurationwizard.h",
"genericlinuxdeviceconfigurationwizardpages.cpp",
"genericlinuxdeviceconfigurationwizardpages.h",
"genericlinuxdeviceconfigurationwizardsetuppage.ui",
- "genericlinuxdeviceconfigurationwidget.cpp",
- "genericlinuxdeviceconfigurationwidget.h",
- "genericlinuxdeviceconfigurationwidget.ui",
"genericremotelinuxdeploystepfactory.cpp",
"genericremotelinuxdeploystepfactory.h",
"linuxdevice.cpp",
"linuxdevice.h",
"linuxdevicetestdialog.cpp",
"linuxdevicetestdialog.h",
+ "linuxdevicetestdialog.ui",
"linuxdevicetester.cpp",
"linuxdevicetester.h",
+ "packageuploader.cpp",
+ "packageuploader.h",
"publickeydeploymentdialog.cpp",
"publickeydeploymentdialog.h",
"remotelinux.qrc",
"remotelinux_constants.h",
"remotelinux_export.h",
+ "remotelinuxcheckforfreediskspaceservice.cpp",
+ "remotelinuxcheckforfreediskspaceservice.h",
+ "remotelinuxcheckforfreediskspacestep.cpp",
+ "remotelinuxcheckforfreediskspacestep.h",
+ "remotelinuxcheckforfreediskspacestepwidget.ui",
+ "remotelinuxcustomcommanddeploymentstep.cpp",
"remotelinuxcustomcommanddeploymentstep.h",
"remotelinuxcustomcommanddeployservice.cpp",
"remotelinuxcustomcommanddeployservice.h",
@@ -75,7 +72,13 @@ QtcPlugin {
"remotelinuxdeployconfigurationfactory.h",
"remotelinuxdeployconfigurationwidget.cpp",
"remotelinuxdeployconfigurationwidget.h",
+ "remotelinuxdeployconfigurationwidget.ui",
+ "remotelinuxdeploymentdatamodel.cpp",
+ "remotelinuxdeploymentdatamodel.h",
+ "remotelinuxenvironmentreader.cpp",
+ "remotelinuxenvironmentreader.h",
"remotelinuxpackageinstaller.cpp",
+ "remotelinuxpackageinstaller.h",
"remotelinuxplugin.cpp",
"remotelinuxplugin.h",
"remotelinuxrunconfiguration.cpp",
@@ -84,40 +87,21 @@ QtcPlugin {
"remotelinuxrunconfigurationfactory.h",
"remotelinuxrunconfigurationwidget.cpp",
"remotelinuxrunconfigurationwidget.h",
+ "remotelinuxruncontrol.cpp",
"remotelinuxruncontrol.h",
+ "remotelinuxruncontrolfactory.cpp",
+ "remotelinuxruncontrolfactory.h",
"remotelinuxutils.cpp",
"remotelinuxutils.h",
- "tarpackagecreationstep.h",
- "uploadandinstalltarpackagestep.h",
- "genericdirectuploadservice.h",
- "linuxdevicetestdialog.ui",
- "packageuploader.cpp",
- "packageuploader.h",
- "profilesupdatedialog.cpp",
- "profilesupdatedialog.h",
- "profilesupdatedialog.ui",
- "remotelinuxdeployconfigurationwidget.ui",
- "remotelinuxenvironmentreader.cpp",
- "remotelinuxenvironmentreader.h",
- "remotelinuxpackageinstaller.h",
"sshkeydeployer.cpp",
"sshkeydeployer.h",
+ "tarpackagecreationstep.cpp",
+ "tarpackagecreationstep.h",
"typespecificdeviceconfigurationlistmodel.cpp",
"typespecificdeviceconfigurationlistmodel.h",
- "abstractremotelinuxdeploystep.cpp",
- "genericdirectuploadstep.cpp",
- "remotelinuxcustomcommanddeploymentstep.cpp",
- "remotelinuxruncontrol.cpp",
- "remotelinuxruncontrolfactory.cpp",
- "remotelinuxruncontrolfactory.h",
- "tarpackagecreationstep.cpp",
"uploadandinstalltarpackagestep.cpp",
- "remotelinuxcheckforfreediskspaceservice.h",
- "remotelinuxcheckforfreediskspaceservice.cpp",
- "remotelinuxcheckforfreediskspacestep.h",
- "remotelinuxcheckforfreediskspacestep.cpp",
- "remotelinuxcheckforfreediskspacestepwidget.ui",
- "images/embeddedtarget.png"
+ "uploadandinstalltarpackagestep.h",
+ "images/embeddedtarget.png",
]
ProductModule {
diff --git a/src/plugins/remotelinux/remotelinux_dependencies.pri b/src/plugins/remotelinux/remotelinux_dependencies.pri
index c2940f9362..697ec645a1 100644
--- a/src/plugins/remotelinux/remotelinux_dependencies.pri
+++ b/src/plugins/remotelinux/remotelinux_dependencies.pri
@@ -1,4 +1,4 @@
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/debugger/debugger.pri)
include(../../plugins/projectexplorer/projectexplorer.pri)
-include(../../plugins/qt4projectmanager/qt4projectmanager.pri)
+include(../../plugins/qtsupport/qtsupport.pri)
diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp
index f54c84e6ed..19ec75e7ab 100644
--- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp
+++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp
@@ -28,21 +28,12 @@
****************************************************************************/
#include "remotelinuxdeployconfiguration.h"
-#include "deploymentinfo.h"
#include "remotelinuxdeployconfigurationwidget.h"
-#include "typespecificdeviceconfigurationlistmodel.h"
-#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
-#include <qt4projectmanager/qt4project.h>
using namespace ProjectExplorer;
-using namespace Qt4ProjectManager;
-
-namespace {
-const char DEPLOYMENT_INFO_SETTING[] = "RemoteLinux.DeploymentInfo";
-} // namespace
namespace RemoteLinux {
@@ -53,15 +44,6 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::
: DeployConfiguration(target, id)
{
setDefaultDisplayName(defaultDisplayName);
-
- // Make sure we have deploymentInfo, but create it only once:
- DeploymentInfo *info
- = qobject_cast<DeploymentInfo *>(target->project()->namedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING)).value<QObject *>());
- if (!info) {
- info = new DeploymentInfo(static_cast<Qt4ProjectManager::Qt4Project *>(target->project()));
- QVariant data = QVariant::fromValue(static_cast<QObject *>(info));
- target->project()->setNamedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING), data);
- }
}
RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
@@ -69,23 +51,6 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::
: DeployConfiguration(target, source)
{ }
-DeploymentInfo *RemoteLinuxDeployConfiguration::deploymentInfo() const
-{
- DeploymentInfo *info
- = qobject_cast<DeploymentInfo *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING)).value<QObject *>());
- return info;
-}
-
-QString RemoteLinuxDeployConfiguration::qmakeScope() const
-{
- return QLatin1String("unix");
-}
-
-QString RemoteLinuxDeployConfiguration::installPrefix() const
-{
- return QString();
-}
-
DeployConfigurationWidget *RemoteLinuxDeployConfiguration::configurationWidget() const
{
return new RemoteLinuxDeployConfigurationWidget;
diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.h b/src/plugins/remotelinux/remotelinuxdeployconfiguration.h
index 02512becd4..1e882f1df1 100644
--- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.h
+++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.h
@@ -38,9 +38,6 @@
#include <projectexplorer/devicesupport/idevice.h>
namespace RemoteLinux {
-class AbstractEmbeddedLinuxTarget;
-class DeploymentInfo;
-
namespace Internal { class RemoteLinuxDeployConfigurationFactory; }
class REMOTELINUX_EXPORT RemoteLinuxDeployConfiguration
@@ -56,8 +53,6 @@ public:
ProjectExplorer::DeployConfigurationWidget *configurationWidget() const;
- DeploymentInfo *deploymentInfo() const;
-
template<class T> T *earlierBuildStep(const ProjectExplorer::BuildStep *laterBuildStep) const
{
const QList<ProjectExplorer::BuildStep *> &buildSteps = stepList()->steps();
@@ -70,9 +65,6 @@ public:
return 0;
}
- virtual QString qmakeScope() const;
- virtual QString installPrefix() const;
-
signals:
void packagingChanged();
diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp b/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp
index e15dc56b89..94768e188a 100644
--- a/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp
+++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp
@@ -36,8 +36,8 @@
#include <projectexplorer/abi.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
-#include <qt4projectmanager/qt4project.h>
#include <QCoreApplication>
@@ -58,8 +58,6 @@ RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory(QOb
QList<Core::Id> RemoteLinuxDeployConfigurationFactory::availableCreationIds(Target *parent) const
{
QList<Core::Id> ids;
- if (!qobject_cast<Qt4ProjectManager::Qt4Project *>(parent->project()))
- return ids;
if (!parent->project()->supportsKit(parent->kit()))
return ids;
ProjectExplorer::ToolChain *tc
diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp
index e4a53a4dae..fb1169f142 100644
--- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp
+++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp
@@ -29,51 +29,24 @@
#include "remotelinuxdeployconfigurationwidget.h"
#include "ui_remotelinuxdeployconfigurationwidget.h"
-#include "deployablefilesperprofile.h"
-#include "deploymentinfo.h"
#include "remotelinuxdeployconfiguration.h"
-#include "typespecificdeviceconfigurationlistmodel.h"
+#include "remotelinuxdeploymentdatamodel.h"
-#include <coreplugin/editormanager/editormanager.h>
-#include <coreplugin/icore.h>
-#include <coreplugin/id.h>
-#include <projectexplorer/devicesupport/devicemanager.h>
-#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
-#include <QTreeView>
-
using namespace ProjectExplorer;
namespace RemoteLinux {
namespace Internal {
-namespace {
-class MyTreeView : public QTreeView
-{
- Q_OBJECT
-public:
- MyTreeView(QWidget *parent = 0) : QTreeView(parent) {}
-
-signals:
- void doubleClicked();
-
-private:
- void mouseDoubleClickEvent(QMouseEvent *event)
- {
- emit doubleClicked();
- QTreeView::mouseDoubleClickEvent(event);
- }
-};
-
-} // anonymous namespace
class RemoteLinuxDeployConfigurationWidgetPrivate
{
public:
Ui::RemoteLinuxDeployConfigurationWidget ui;
- MyTreeView treeView;
RemoteLinuxDeployConfiguration *deployConfiguration;
+ RemoteLinuxDeploymentDataModel deploymentDataModel;
};
} // namespace Internal
@@ -84,10 +57,10 @@ RemoteLinuxDeployConfigurationWidget::RemoteLinuxDeployConfigurationWidget(QWidg
DeployConfigurationWidget(parent), d(new RemoteLinuxDeployConfigurationWidgetPrivate)
{
d->ui.setupUi(this);
- d->treeView.setTextElideMode(Qt::ElideMiddle);
- d->treeView.setWordWrap(false);
- d->treeView.setUniformRowHeights(true);
- layout()->addWidget(&d->treeView);
+ d->ui.deploymentDataView->setTextElideMode(Qt::ElideMiddle);
+ d->ui.deploymentDataView->setWordWrap(false);
+ d->ui.deploymentDataView->setUniformRowHeights(true);
+ d->ui.deploymentDataView->setModel(&d->deploymentDataModel);
}
RemoteLinuxDeployConfigurationWidget::~RemoteLinuxDeployConfigurationWidget()
@@ -98,78 +71,16 @@ RemoteLinuxDeployConfigurationWidget::~RemoteLinuxDeployConfigurationWidget()
void RemoteLinuxDeployConfigurationWidget::init(DeployConfiguration *dc)
{
d->deployConfiguration = qobject_cast<RemoteLinuxDeployConfiguration *>(dc);
- Q_ASSERT(d->deployConfiguration);
+ QTC_ASSERT(d->deployConfiguration, return);
- connect(&d->treeView, SIGNAL(doubleClicked()), SLOT(openProjectFile()));
-
- d->ui.projectsComboBox->setModel(d->deployConfiguration->deploymentInfo());
- connect(d->deployConfiguration->deploymentInfo(), SIGNAL(modelAboutToBeReset()),
- SLOT(handleModelListToBeReset()));
-
- // Queued connection because of race condition with combo box's reaction
- // to modelReset().
- connect(d->deployConfiguration->deploymentInfo(), SIGNAL(modelReset()),
- SLOT(handleModelListReset()), Qt::QueuedConnection);
-
- connect(d->ui.projectsComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setModel(int)));
- handleModelListReset();
+ connect(dc->target(), SIGNAL(deploymentDataChanged()), SLOT(updateDeploymentDataModel()));
+ updateDeploymentDataModel();
}
-RemoteLinuxDeployConfiguration *RemoteLinuxDeployConfigurationWidget::deployConfiguration() const
+void RemoteLinuxDeployConfigurationWidget::updateDeploymentDataModel()
{
- return d->deployConfiguration;
-}
-
-DeployableFilesPerProFile *RemoteLinuxDeployConfigurationWidget::currentModel() const
-{
- const int modelRow = d->ui.projectsComboBox->currentIndex();
- if (modelRow == -1)
- return 0;
- return d->deployConfiguration->deploymentInfo()->modelAt(modelRow);
-}
-
-void RemoteLinuxDeployConfigurationWidget::handleModelListToBeReset()
-{
- d->treeView.setModel(0);
-}
-
-void RemoteLinuxDeployConfigurationWidget::handleModelListReset()
-{
- QTC_ASSERT(d->deployConfiguration->deploymentInfo()->modelCount()
- == d->ui.projectsComboBox->count(), return);
-
- if (d->deployConfiguration->deploymentInfo()->modelCount() > 0) {
- d->treeView.setToolTip(tr("Double-click to edit the project file"));
- if (d->ui.projectsComboBox->currentIndex() == -1)
- d->ui.projectsComboBox->setCurrentIndex(0);
- else
- setModel(d->ui.projectsComboBox->currentIndex());
- } else {
- d->treeView.setToolTip(QString());
- }
-}
-
-void RemoteLinuxDeployConfigurationWidget::setModel(int row)
-{
- DeployableFilesPerProFile * const proFileInfo = row == -1
- ? 0 : d->deployConfiguration->deploymentInfo()->modelAt(row);
- d->treeView.setModel(proFileInfo);
- if (proFileInfo)
- d->treeView.resizeColumnToContents(0);
- emit currentModelChanged(proFileInfo);
-}
-
-void RemoteLinuxDeployConfigurationWidget::openProjectFile()
-{
- const int row = d->ui.projectsComboBox->currentIndex();
- if (row == -1)
- return;
- const DeployableFilesPerProFile * const proFileInfo =
- d->deployConfiguration->deploymentInfo()->modelAt(row);
- Core::EditorManager::openEditor(proFileInfo->proFilePath(), Core::Id(),
- Core::EditorManager::ModeSwitch);
+ d->deploymentDataModel.setDeploymentData(d->deployConfiguration->target()->deploymentData());
+ d->ui.deploymentDataView->resizeColumnToContents(0);
}
} // namespace RemoteLinux
-
-#include "remotelinuxdeployconfigurationwidget.moc"
diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h
index 5528011636..0c032862ce 100644
--- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h
+++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h
@@ -34,9 +34,6 @@
#include <projectexplorer/deployconfiguration.h>
namespace RemoteLinux {
-class DeployableFilesPerProFile;
-class RemoteLinuxDeployConfiguration;
-
namespace Internal {
class RemoteLinuxDeployConfigurationWidgetPrivate;
} // namespace Internal
@@ -52,17 +49,8 @@ public:
void init(ProjectExplorer::DeployConfiguration *dc);
- RemoteLinuxDeployConfiguration *deployConfiguration() const;
- DeployableFilesPerProFile *currentModel() const;
-
-signals:
- void currentModelChanged(const RemoteLinux::DeployableFilesPerProFile *proFileInfo);
-
private slots:
- void handleModelListToBeReset();
- void handleModelListReset();
- void setModel(int row);
- void openProjectFile();
+ void updateDeploymentDataModel();
private:
Internal::RemoteLinuxDeployConfigurationWidgetPrivate * const d;
diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui
index 2bfa1bd8a6..fb765741e9 100644
--- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui
+++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui
@@ -15,45 +15,14 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Files to deploy:</string>
</property>
- <item row="0" column="0">
- <widget class="QLabel" name="installLabel">
- <property name="toolTip">
- <string>These show the INSTALLS settings from the project file(s).</string>
- </property>
- <property name="text">
- <string>Files to install for subproject:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QComboBox" name="projectsComboBox">
- <property name="sizeAdjustPolicy">
- <enum>QComboBox::AdjustToContents</enum>
- </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>
- </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTreeView" name="deploymentDataView"/>
</item>
</layout>
</widget>
diff --git a/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.cpp b/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.cpp
new file mode 100644
index 0000000000..ea78d795b7
--- /dev/null
+++ b/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.cpp
@@ -0,0 +1,81 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: http://www.qt-project.org/
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**************************************************************************/
+#include "remotelinuxdeploymentdatamodel.h"
+
+#include <QDir>
+
+using namespace ProjectExplorer;
+
+namespace RemoteLinux {
+
+RemoteLinuxDeploymentDataModel::RemoteLinuxDeploymentDataModel(QObject *parent)
+ : QAbstractTableModel(parent)
+{
+}
+
+void RemoteLinuxDeploymentDataModel::setDeploymentData(const DeploymentData &deploymentData)
+{
+ beginResetModel();
+ m_deploymentData = deploymentData;
+ endResetModel();
+}
+
+int RemoteLinuxDeploymentDataModel::rowCount(const QModelIndex &parent) const
+{
+ return parent.isValid() ? 0 : m_deploymentData.fileCount();
+}
+
+int RemoteLinuxDeploymentDataModel::columnCount(const QModelIndex &parent) const
+{
+ return parent.isValid() ? 0 : 2;
+}
+
+QVariant RemoteLinuxDeploymentDataModel::headerData(int section, Qt::Orientation orientation,
+ int role) const
+{
+ if (orientation == Qt::Vertical || role != Qt::DisplayRole)
+ return QVariant();
+ return section == 0 ? tr("Local File Path") : tr("Remote Directory");
+}
+
+QVariant RemoteLinuxDeploymentDataModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid() || index.row() >= rowCount() || index.column() >= columnCount())
+ return QVariant();
+
+ const DeployableFile &d = m_deploymentData.fileAt(index.row());
+ if (index.column() == 0 && role == Qt::DisplayRole)
+ return d.localFilePath().toUserOutput();
+ if (role == Qt::DisplayRole)
+ return d.remoteDirectory();
+ return QVariant();
+}
+
+} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/profilesupdatedialog.h b/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.h
index 42393bd605..cb4cf6de75 100644
--- a/src/plugins/remotelinux/profilesupdatedialog.h
+++ b/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.h
@@ -26,43 +26,32 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
+#ifndef REMOTELINUXDEPLOYMENTDATAMODEL_H
+#define REMOTELINUXDEPLOYMENTDATAMODEL_H
-#ifndef PROFILESUPDATEDIALOG_H
-#define PROFILESUPDATEDIALOG_H
+#include <projectexplorer/deploymentdata.h>
-#include <QList>
-#include <QPair>
-#include <QString>
-#include <QDialog>
+#include <QAbstractTableModel>
namespace RemoteLinux {
-class DeployableFilesPerProFile;
-namespace Internal {
-namespace Ui { class ProFilesUpdateDialog; }
-
-class ProFilesUpdateDialog : public QDialog
+class RemoteLinuxDeploymentDataModel : public QAbstractTableModel
{
Q_OBJECT
-
public:
- typedef QPair<DeployableFilesPerProFile *, bool> UpdateSetting;
+ explicit RemoteLinuxDeploymentDataModel(QObject *parent = 0);
- explicit ProFilesUpdateDialog(const QList<DeployableFilesPerProFile *> &models,
- QWidget *parent = 0);
- ~ProFilesUpdateDialog();
- QList<UpdateSetting> getUpdateSettings() const;
+ void setDeploymentData(const ProjectExplorer::DeploymentData &deploymentData);
private:
- Q_SLOT void checkAll();
- Q_SLOT void uncheckAll();
- void setCheckStateForAll(Qt::CheckState checkState);
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- const QList<DeployableFilesPerProFile *> m_models;
- Ui::ProFilesUpdateDialog *ui;
+ ProjectExplorer::DeploymentData m_deploymentData;
};
} // namespace RemoteLinux
-} // namespace Internal
-#endif // PROFILESUPDATEDIALOG_H
+#endif // REMOTELINUXDEPLOYMENTDATAMODEL_H
diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp
index 38b3f9679f..0044f92404 100644
--- a/src/plugins/remotelinux/remotelinuxplugin.cpp
+++ b/src/plugins/remotelinux/remotelinuxplugin.cpp
@@ -30,10 +30,8 @@
#include "remotelinuxplugin.h"
#include "embeddedlinuxqtversionfactory.h"
-#include "deployablefile.h"
#include "genericlinuxdeviceconfigurationfactory.h"
#include "genericremotelinuxdeploystepfactory.h"
-#include "qt4projectmanager/qt4projectmanagerconstants.h"
#include "remotelinuxdeployconfigurationfactory.h"
#include "remotelinuxrunconfigurationfactory.h"
#include "remotelinuxruncontrolfactory.h"
@@ -71,8 +69,6 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments,
addAutoReleasedObject(new EmbeddedLinuxQtVersionFactory);
- qRegisterMetaType<RemoteLinux::DeployableFile>("RemoteLinux::DeployableFile");
-
return true;
}
diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp
index f2fb2bcd10..9fce62be5a 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp
+++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp
@@ -29,23 +29,21 @@
#include "remotelinuxrunconfiguration.h"
-#include "deploymentinfo.h"
#include "remotelinuxdeployconfiguration.h"
#include "remotelinuxrunconfigurationwidget.h"
-#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/buildtargetinfo.h>
+#include <projectexplorer/deploymentdata.h>
+#include <projectexplorer/project.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <qtsupport/qtoutputformatter.h>
-#include <qt4projectmanager/qt4nodes.h>
-#include <qt4projectmanager/qt4project.h>
#include <utils/portlist.h>
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
-using namespace Qt4ProjectManager;
using namespace QSsh;
using namespace Utils;
@@ -65,38 +63,32 @@ const char WorkingDirectoryKey[] = "RemoteLinux.RunConfig.WorkingDirectory";
class RemoteLinuxRunConfigurationPrivate {
public:
- RemoteLinuxRunConfigurationPrivate(const QString &proFilePath, const ProjectExplorer::Target *target)
- : proFilePath(proFilePath),
+ RemoteLinuxRunConfigurationPrivate(const QString &projectFilePath)
+ : projectFilePath(projectFilePath),
baseEnvironmentType(RemoteLinuxRunConfiguration::RemoteBaseEnvironment),
- validParse(false),
- parseInProgress(true),
useAlternateRemoteExecutable(false)
{
- validParse = static_cast<Qt4Project *>(target->project())->validParse(proFilePath);
- parseInProgress = static_cast<Qt4Project *>(target->project())->parseInProgress(proFilePath);
}
RemoteLinuxRunConfigurationPrivate(const RemoteLinuxRunConfigurationPrivate *other)
- : proFilePath(other->proFilePath), gdbPath(other->gdbPath), arguments(other->arguments),
+ : projectFilePath(other->projectFilePath),
+ gdbPath(other->gdbPath),
+ arguments(other->arguments),
baseEnvironmentType(other->baseEnvironmentType),
remoteEnvironment(other->remoteEnvironment),
userEnvironmentChanges(other->userEnvironmentChanges),
- validParse(other->validParse),
- parseInProgress(other->parseInProgress),
useAlternateRemoteExecutable(other->useAlternateRemoteExecutable),
alternateRemoteExecutable(other->alternateRemoteExecutable),
workingDirectory(other->workingDirectory)
{
}
- QString proFilePath;
+ QString projectFilePath;
QString gdbPath;
QString arguments;
RemoteLinuxRunConfiguration::BaseEnvironmentType baseEnvironmentType;
Environment remoteEnvironment;
QList<EnvironmentItem> userEnvironmentChanges;
- bool validParse;
- bool parseInProgress;
QString disabledReason;
bool useAlternateRemoteExecutable;
QString alternateRemoteExecutable;
@@ -110,7 +102,7 @@ using namespace Internal;
RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, const Core::Id id,
const QString &proFilePath)
: RunConfiguration(parent, id),
- d(new RemoteLinuxRunConfigurationPrivate(proFilePath, parent))
+ d(new RemoteLinuxRunConfigurationPrivate(proFilePath))
{
init();
}
@@ -133,34 +125,14 @@ void RemoteLinuxRunConfiguration::init()
setDefaultDisplayName(defaultDisplayName());
debuggerAspect()->suppressQmlDebuggingSpinbox();
- connect(target(),
- SIGNAL(activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration*)),
- this, SLOT(handleDeployConfigChanged()));
- handleDeployConfigChanged();
-
- Project *pro = target()->project();
- connect(pro, SIGNAL(kitUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
- this, SLOT(proFileUpdate(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
+ connect(target(), SIGNAL(deploymentDataChanged()), SLOT(handleBuildSystemDataUpdated()));
+ connect(target(), SIGNAL(applicationTargetsChanged()), SLOT(handleBuildSystemDataUpdated()));
connect(target(), SIGNAL(kitChanged()),
- this, SLOT(handleDeployablesUpdated())); // Handles device changes, etc.
+ this, SLOT(handleBuildSystemDataUpdated())); // Handles device changes, etc.
}
bool RemoteLinuxRunConfiguration::isEnabled() const
{
- if (d->parseInProgress) {
- d->disabledReason = tr("The .pro file '%1' is being parsed.")
- .arg(QFileInfo(d->proFilePath).fileName());
- return false;
- }
- if (!d->validParse) {
- Qt4Project *project = static_cast<Qt4Project *>(target()->project());
- d->disabledReason = project->disabledReasonForRunConfiguration(d->proFilePath);
- return false;
- }
- if (!activeBuildConfiguration()) {
- d->disabledReason = tr("No active build configuration.");
- return false;
- }
if (remoteExecutableFilePath().isEmpty()) {
d->disabledReason = tr("Don't know what to run.");
return false;
@@ -184,26 +156,12 @@ OutputFormatter *RemoteLinuxRunConfiguration::createOutputFormatter() const
return new QtSupport::QtOutputFormatter(target()->project());
}
-void RemoteLinuxRunConfiguration::proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress)
-{
- if (d->proFilePath == pro->path()) {
- bool enabled = isEnabled();
- QString reason = disabledReason();
- d->validParse = success;
- d->parseInProgress = parseInProgress;
- if (enabled != isEnabled() || reason != disabledReason())
- updateEnabledState();
- if (!parseInProgress)
- emit targetInformationChanged();
- }
-}
-
QVariantMap RemoteLinuxRunConfiguration::toMap() const
{
QVariantMap map(RunConfiguration::toMap());
map.insert(QLatin1String(ArgumentsKey), d->arguments);
const QDir dir = QDir(target()->project()->projectDirectory());
- map.insert(QLatin1String(ProFileKey), dir.relativeFilePath(d->proFilePath));
+ map.insert(QLatin1String(ProFileKey), dir.relativeFilePath(d->projectFilePath));
map.insert(QLatin1String(BaseEnvironmentBaseKey), d->baseEnvironmentType);
map.insert(QLatin1String(UserEnvironmentChangesKey),
EnvironmentItem::toStringList(d->userEnvironmentChanges));
@@ -220,7 +178,8 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map)
d->arguments = map.value(QLatin1String(ArgumentsKey)).toString();
const QDir dir = QDir(target()->project()->projectDirectory());
- d->proFilePath = QDir::cleanPath(dir.filePath(map.value(QLatin1String(ProFileKey)).toString()));
+ d->projectFilePath
+ = QDir::cleanPath(dir.filePath(map.value(QLatin1String(ProFileKey)).toString()));
d->userEnvironmentChanges =
EnvironmentItem::fromStringList(map.value(QLatin1String(UserEnvironmentChangesKey))
.toStringList());
@@ -230,10 +189,6 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map)
d->alternateRemoteExecutable = map.value(QLatin1String(AlternateExeKey)).toString();
d->workingDirectory = map.value(QLatin1String(WorkingDirectoryKey)).toString();
- Qt4Project *project = static_cast<Qt4Project *>(target()->project());
- d->validParse = project->validParse(d->proFilePath);
- d->parseInProgress = project->parseInProgress(d->proFilePath);
-
setDefaultDisplayName(defaultDisplayName());
return true;
@@ -241,18 +196,13 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map)
QString RemoteLinuxRunConfiguration::defaultDisplayName()
{
- if (!d->proFilePath.isEmpty())
+ if (!d->projectFilePath.isEmpty())
//: %1 is the name of a project which is being run on remote Linux
- return tr("%1 (on Remote Device)").arg(QFileInfo(d->proFilePath).completeBaseName());
+ return tr("%1 (on Remote Device)").arg(QFileInfo(d->projectFilePath).completeBaseName());
//: Remote Linux run configuration default display name
return tr("Run on Remote Device");
}
-RemoteLinuxDeployConfiguration *RemoteLinuxRunConfiguration::deployConfig() const
-{
- return qobject_cast<RemoteLinuxDeployConfiguration *>(target()->activeDeployConfiguration());
-}
-
QString RemoteLinuxRunConfiguration::arguments() const
{
return d->arguments;
@@ -280,19 +230,14 @@ QString RemoteLinuxRunConfiguration::commandPrefix() const
QString RemoteLinuxRunConfiguration::localExecutableFilePath() const
{
- TargetInformation ti = static_cast<Qt4Project *>(target()->project())->rootQt4ProjectNode()
- ->targetInformation(d->proFilePath);
- if (!ti.valid)
- return QString();
-
- return QDir::cleanPath(ti.workingDir + QLatin1Char('/') + ti.target);
+ return target()->applicationTargets()
+ .targetForProject(Utils::FileName::fromString(d->projectFilePath)).toString();
}
QString RemoteLinuxRunConfiguration::defaultRemoteExecutableFilePath() const
{
- return deployConfig()
- ? deployConfig()->deploymentInfo()->remoteExecutableFilePath(localExecutableFilePath())
- : QString();
+ return target()->deploymentData().deployableForLocalFile(localExecutableFilePath())
+ .remoteFilePath();
}
QString RemoteLinuxRunConfiguration::remoteExecutableFilePath() const
@@ -347,17 +292,10 @@ int RemoteLinuxRunConfiguration::portsUsedByDebuggers() const
return ports;
}
-void RemoteLinuxRunConfiguration::handleDeployConfigChanged()
-{
- RemoteLinuxDeployConfiguration * const activeDeployConf = deployConfig();
- if (activeDeployConf)
- connect(activeDeployConf->deploymentInfo(), SIGNAL(modelReset()),
- SLOT(handleDeployablesUpdated()), Qt::UniqueConnection);
-}
-
-void RemoteLinuxRunConfiguration::handleDeployablesUpdated()
+void RemoteLinuxRunConfiguration::handleBuildSystemDataUpdated()
{
emit deploySpecsChanged();
+ emit targetInformationChanged();
updateEnabledState();
}
@@ -432,9 +370,9 @@ void RemoteLinuxRunConfiguration::setRemoteEnvironment(const Environment &enviro
}
}
-QString RemoteLinuxRunConfiguration::proFilePath() const
+QString RemoteLinuxRunConfiguration::projectFilePath() const
{
- return d->proFilePath;
+ return d->projectFilePath;
}
void RemoteLinuxRunConfiguration::setDisabledReason(const QString &reason) const
diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.h b/src/plugins/remotelinux/remotelinuxrunconfiguration.h
index 980224f4ea..afd91c955d 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfiguration.h
+++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.h
@@ -35,10 +35,6 @@
#include <projectexplorer/runconfiguration.h>
#include <utils/environment.h>
-namespace Qt4ProjectManager {
-class Qt4ProFileNode;
-} // namespace Qt4ProjectManager
-
namespace Utils { class PortList; }
namespace RemoteLinux {
@@ -66,7 +62,7 @@ public:
enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml };
RemoteLinuxRunConfiguration(ProjectExplorer::Target *parent, const Core::Id id,
- const QString &proFilePath);
+ const QString &projectFilePath);
~RemoteLinuxRunConfiguration();
bool isEnabled() const;
@@ -74,8 +70,6 @@ public:
QWidget *createConfigurationWidget();
Utils::OutputFormatter *createOutputFormatter() const;
- RemoteLinuxDeployConfiguration *deployConfig() const;
-
virtual QString environmentPreparationCommand() const;
virtual QString commandPrefix() const;
@@ -102,7 +96,7 @@ public:
int portsUsedByDebuggers() const;
- QString proFilePath() const;
+ QString projectFilePath() const;
static const QString IdPrefix;
@@ -125,9 +119,7 @@ protected slots:
void updateEnabledState() { emit enabledChanged(); }
private slots:
- void proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress);
- void handleDeployConfigChanged();
- void handleDeployablesUpdated();
+ void handleBuildSystemDataUpdated();
private:
void init();
diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp
index 89f0ac6819..6d48536bb5 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp
+++ b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp
@@ -29,14 +29,12 @@
#include "remotelinuxrunconfigurationfactory.h"
#include "remotelinux_constants.h"
-#include "remotelinuxdeployconfigurationfactory.h"
#include "remotelinuxrunconfiguration.h"
+#include <projectexplorer/buildtargetinfo.h>
#include <projectexplorer/kitinformation.h>
+#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
-#include <qt4projectmanager/qt4project.h>
-#include <qt4projectmanager/qt4nodes.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
#include <utils/qtcassert.h>
#include <QFileInfo>
@@ -44,7 +42,6 @@
#include <QStringList>
using namespace ProjectExplorer;
-using namespace Qt4ProjectManager;
namespace RemoteLinux {
namespace Internal {
@@ -61,8 +58,10 @@ QString pathFromId(Core::Id id)
} // namespace
RemoteLinuxRunConfigurationFactory::RemoteLinuxRunConfigurationFactory(QObject *parent)
- : Qt4ProjectManager::QmakeRunConfigurationFactory(parent)
-{ setObjectName(QLatin1String("RemoteLinuxRunConfigurationFactory")); }
+ : IRunConfigurationFactory(parent)
+{
+ setObjectName(QLatin1String("RemoteLinuxRunConfigurationFactory"));
+}
RemoteLinuxRunConfigurationFactory::~RemoteLinuxRunConfigurationFactory()
{
@@ -72,14 +71,14 @@ bool RemoteLinuxRunConfigurationFactory::canCreate(Target *parent, const Core::I
{
if (!canHandle(parent))
return false;
- return static_cast<Qt4Project *>(parent->project())->hasApplicationProFile(pathFromId(id));
+ return !parent->applicationTargets().targetForProject(pathFromId(id)).isEmpty();
}
bool RemoteLinuxRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
{
if (!canHandle(parent))
return false;
- return ProjectExplorer::idFromMap(map).toString().startsWith(RemoteLinuxRunConfiguration::IdPrefix);
+ return idFromMap(map).toString().startsWith(RemoteLinuxRunConfiguration::IdPrefix);
}
bool RemoteLinuxRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
@@ -95,10 +94,8 @@ QList<Core::Id> RemoteLinuxRunConfigurationFactory::availableCreationIds(Target
if (!canHandle(parent))
return result;
- QStringList proFiles = static_cast<Qt4Project *>(parent->project())
- ->applicationProFilePathes(RemoteLinuxRunConfiguration::IdPrefix);
- foreach (const QString &pf, proFiles)
- result << Core::Id(pf);
+ foreach (const BuildTargetInfo &bti, parent->applicationTargets().list)
+ result << (Core::Id(RemoteLinuxRunConfiguration::IdPrefix + bti.projectFilePath.toString()));
return result;
}
@@ -118,8 +115,8 @@ RunConfiguration *RemoteLinuxRunConfigurationFactory::restore(Target *parent,
const QVariantMap &map)
{
QTC_ASSERT(canRestore(parent, map), return 0);
- RemoteLinuxRunConfiguration *rc
- = new RemoteLinuxRunConfiguration(parent, Core::Id(RemoteLinuxRunConfiguration::IdPrefix), QString());
+ RemoteLinuxRunConfiguration *rc = new RemoteLinuxRunConfiguration(parent,
+ Core::Id(RemoteLinuxRunConfiguration::IdPrefix), QString());
if (rc->fromMap(map))
return rc;
@@ -135,26 +132,13 @@ RunConfiguration *RemoteLinuxRunConfigurationFactory::clone(Target *parent,
return new RemoteLinuxRunConfiguration(parent, old);
}
-bool RemoteLinuxRunConfigurationFactory::canHandle(Target *t) const
+bool RemoteLinuxRunConfigurationFactory::canHandle(const Target *target) const
{
- if (!t->project()->supportsKit(t->kit()))
+ if (!target->project()->supportsKit(target->kit()))
return false;
- if (!qobject_cast<Qt4Project *>(t->project()))
- return false;
-
- Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(t->kit());
+ const Core::Id deviceType = DeviceTypeKitInformation::deviceTypeId(target->kit());
return deviceType == RemoteLinux::Constants::GenericLinuxOsType;
}
-QList<RunConfiguration *> RemoteLinuxRunConfigurationFactory::runConfigurationsForNode(Target *t, ProjectExplorer::Node *n)
-{
- QList<ProjectExplorer::RunConfiguration *> result;
- foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations())
- if (RemoteLinuxRunConfiguration *qt4c = qobject_cast<RemoteLinuxRunConfiguration *>(rc))
- if (qt4c->proFilePath() == n->path())
- result << rc;
- return result;
-}
-
} // namespace Internal
} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h
index 4a281e775b..4cd8b85dc7 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h
+++ b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h
@@ -30,14 +30,11 @@
#define REMOTELINUXRUNCONFIGURATIONFACTORY_H
#include <projectexplorer/runconfiguration.h>
-#include <qt4projectmanager/qmakerunconfigurationfactory.h>
-
-namespace ProjectExplorer { class Node; }
namespace RemoteLinux {
namespace Internal {
-class RemoteLinuxRunConfigurationFactory : public Qt4ProjectManager::QmakeRunConfigurationFactory
+class RemoteLinuxRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
{
Q_OBJECT
@@ -59,9 +56,8 @@ public:
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent,
ProjectExplorer::RunConfiguration *source);
- bool canHandle(ProjectExplorer::Target *t) const;
- QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
- ProjectExplorer::Node *n);
+private:
+ bool canHandle(const ProjectExplorer::Target *target) const;
};
} // namespace Internal
diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp
index 08abe3ee1f..47e1f7ba41 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp
+++ b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp
@@ -229,13 +229,23 @@ void RemoteLinuxRunConfigurationWidget::argumentsEdited(const QString &text)
void RemoteLinuxRunConfigurationWidget::updateTargetInformation()
{
- d->localExecutableLabel
- .setText(QDir::toNativeSeparators(d->runConfiguration->localExecutableFilePath()));
+ setLabelText(d->localExecutableLabel,
+ QDir::toNativeSeparators(d->runConfiguration->localExecutableFilePath()),
+ tr("Unknown"));
}
void RemoteLinuxRunConfigurationWidget::handleDeploySpecsChanged()
{
- d->remoteExecutableLabel.setText(d->runConfiguration->defaultRemoteExecutableFilePath());
+ setLabelText(d->remoteExecutableLabel, d->runConfiguration->defaultRemoteExecutableFilePath(),
+ tr("Remote path not set"));
+}
+
+void RemoteLinuxRunConfigurationWidget::setLabelText(QLabel &label, const QString &regularText,
+ const QString &errorText)
+{
+ const QString errorMessage = QLatin1String("<font color=\"red\">") + errorText
+ + QLatin1String("</font>");
+ label.setText(regularText.isEmpty() ? errorMessage : regularText);
}
void RemoteLinuxRunConfigurationWidget::handleUseAlternateCommandChanged()
diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h
index bfe20ea023..be45305150 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h
+++ b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h
@@ -34,6 +34,7 @@
#include <QWidget>
QT_BEGIN_NAMESPACE
+class QLabel;
class QVBoxLayout;
QT_END_NAMESPACE
@@ -79,6 +80,7 @@ private slots:
private:
void addGenericWidgets(QVBoxLayout *mainLayout);
void addEnvironmentWidgets(QVBoxLayout *mainLayout);
+ void setLabelText(QLabel &label, const QString &regularText, const QString &errorText);
Internal::RemoteLinuxRunConfigurationWidgetPrivate * const d;
};
diff --git a/src/plugins/remotelinux/tarpackagecreationstep.cpp b/src/plugins/remotelinux/tarpackagecreationstep.cpp
index 4defbc848a..3f6fff6c19 100644
--- a/src/plugins/remotelinux/tarpackagecreationstep.cpp
+++ b/src/plugins/remotelinux/tarpackagecreationstep.cpp
@@ -28,10 +28,9 @@
****************************************************************************/
#include "tarpackagecreationstep.h"
-#include "deployablefile.h"
-#include "deploymentinfo.h"
#include "remotelinuxdeployconfiguration.h"
+#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
@@ -40,6 +39,8 @@
#include <QFile>
#include <QFileInfo>
+#include <cstring>
+
using namespace ProjectExplorer;
namespace RemoteLinux {
@@ -112,13 +113,8 @@ bool TarPackageCreationStep::init()
if (!AbstractPackagingStep::init())
return false;
m_packagingNeeded = isPackagingNeeded();
- if (!m_packagingNeeded)
- return true;
-
- const DeploymentInfo * const deploymentInfo = deployConfiguration()->deploymentInfo();
- for (int i = 0; i < deploymentInfo->deployableCount(); ++i)
- m_files.append(deploymentInfo->deployableAt(i));
-
+ if (m_packagingNeeded)
+ m_files = target()->deploymentData().allFiles();
return true;
}
@@ -152,13 +148,13 @@ bool TarPackageCreationStep::doPackage(QFutureInterface<bool> &fi)
}
foreach (const DeployableFile &d, m_files) {
- if (d.remoteDir.isEmpty()) {
+ if (d.remoteDirectory().isEmpty()) {
emit addOutput(tr("No remote path specified for file '%1', skipping.")
- .arg(QDir::toNativeSeparators(d.localFilePath)), ErrorMessageOutput);
+ .arg(d.localFilePath().toUserOutput()), ErrorMessageOutput);
continue;
}
- QFileInfo fileInfo(d.localFilePath);
- if (!appendFile(tarFile, fileInfo, d.remoteDir + QLatin1Char('/')
+ QFileInfo fileInfo = d.localFilePath().toFileInfo();
+ if (!appendFile(tarFile, fileInfo, d.remoteDirectory() + QLatin1Char('/')
+ fileInfo.fileName(), fi)) {
return false;
}
@@ -230,7 +226,7 @@ bool TarPackageCreationStep::writeHeader(QFile &tarFile, const QFileInfo &fileIn
const QString &remoteFilePath)
{
TarFileHeader header;
- qMemSet(&header, '\0', sizeof header);
+ std::memset(&header, '\0', sizeof header);
const QByteArray &filePath = remoteFilePath.toUtf8();
const int maxFilePathLength = sizeof header.fileNamePrefix + sizeof header.fileName;
if (filePath.count() > maxFilePathLength) {
@@ -241,9 +237,9 @@ bool TarPackageCreationStep::writeHeader(QFile &tarFile, const QFileInfo &fileIn
const int fileNameBytesToWrite = qMin<int>(filePath.length(), sizeof header.fileName);
const int fileNameOffset = filePath.length() - fileNameBytesToWrite;
- qMemCopy(&header.fileName, filePath.data() + fileNameOffset, fileNameBytesToWrite);
+ std::memcpy(&header.fileName, filePath.data() + fileNameOffset, fileNameBytesToWrite);
if (fileNameOffset > 0)
- qMemCopy(&header.fileNamePrefix, filePath.data(), fileNameOffset);
+ std::memcpy(&header.fileNamePrefix, filePath.data(), fileNameOffset);
int permissions = (0400 * fileInfo.permission(QFile::ReadOwner))
| (0200 * fileInfo.permission(QFile::WriteOwner))
| (0100 * fileInfo.permission(QFile::ExeOwner))
@@ -254,35 +250,35 @@ bool TarPackageCreationStep::writeHeader(QFile &tarFile, const QFileInfo &fileIn
| (02 * fileInfo.permission(QFile::WriteOther))
| (01 * fileInfo.permission(QFile::ExeOther));
const QByteArray permissionString = QString("%1").arg(permissions,
- sizeof header.fileMode - 1, 8, QLatin1Char('0')).toAscii();
- qMemCopy(&header.fileMode, permissionString.data(), permissionString.length());
+ sizeof header.fileMode - 1, 8, QLatin1Char('0')).toLatin1();
+ std::memcpy(&header.fileMode, permissionString.data(), permissionString.length());
const QByteArray uidString = QString("%1").arg(fileInfo.ownerId(),
- sizeof header.uid - 1, 8, QLatin1Char('0')).toAscii();
- qMemCopy(&header.uid, uidString.data(), uidString.length());
+ sizeof header.uid - 1, 8, QLatin1Char('0')).toLatin1();
+ std::memcpy(&header.uid, uidString.data(), uidString.length());
const QByteArray gidString = QString("%1").arg(fileInfo.groupId(),
- sizeof header.gid - 1, 8, QLatin1Char('0')).toAscii();
- qMemCopy(&header.gid, gidString.data(), gidString.length());
+ sizeof header.gid - 1, 8, QLatin1Char('0')).toLatin1();
+ std::memcpy(&header.gid, gidString.data(), gidString.length());
const QByteArray sizeString = QString("%1").arg(fileInfo.size(),
- sizeof header.length - 1, 8, QLatin1Char('0')).toAscii();
- qMemCopy(&header.length, sizeString.data(), sizeString.length());
+ sizeof header.length - 1, 8, QLatin1Char('0')).toLatin1();
+ std::memcpy(&header.length, sizeString.data(), sizeString.length());
const QByteArray mtimeString = QString("%1").arg(fileInfo.lastModified().toTime_t(),
- sizeof header.mtime - 1, 8, QLatin1Char('0')).toAscii();
- qMemCopy(&header.mtime, mtimeString.data(), mtimeString.length());
+ sizeof header.mtime - 1, 8, QLatin1Char('0')).toLatin1();
+ std::memcpy(&header.mtime, mtimeString.data(), mtimeString.length());
if (fileInfo.isDir())
header.typeflag = '5';
- qMemCopy(&header.magic, "ustar", sizeof "ustar");
- qMemCopy(&header.version, "00", 2);
+ std::memcpy(&header.magic, "ustar", sizeof "ustar");
+ std::memcpy(&header.version, "00", 2);
const QByteArray &owner = fileInfo.owner().toUtf8();
- qMemCopy(&header.uname, owner.data(), qMin<int>(owner.length(), sizeof header.uname - 1));
+ std::memcpy(&header.uname, owner.data(), qMin<int>(owner.length(), sizeof header.uname - 1));
const QByteArray &group = fileInfo.group().toUtf8();
- qMemCopy(&header.gname, group.data(), qMin<int>(group.length(), sizeof header.gname - 1));
- qMemSet(&header.chksum, ' ', sizeof header.chksum);
+ std::memcpy(&header.gname, group.data(), qMin<int>(group.length(), sizeof header.gname - 1));
+ std::memset(&header.chksum, ' ', sizeof header.chksum);
quint64 checksum = 0;
for (size_t i = 0; i < sizeof header; ++i)
checksum += reinterpret_cast<char *>(&header)[i];
const QByteArray checksumString = QString("%1").arg(checksum,
- sizeof header.chksum - 1, 8, QLatin1Char('0')).toAscii();
- qMemCopy(&header.chksum, checksumString.data(), checksumString.length());
+ sizeof header.chksum - 1, 8, QLatin1Char('0')).toLatin1();
+ std::memcpy(&header.chksum, checksumString.data(), checksumString.length());
header.chksum[sizeof header.chksum-1] = 0;
if (!tarFile.write(reinterpret_cast<char *>(&header), sizeof header)) {
raiseError(tr("Error writing tar file '%1': %2")
diff --git a/src/plugins/remotelinux/tarpackagecreationstep.h b/src/plugins/remotelinux/tarpackagecreationstep.h
index 335dc25e1e..29d5335d67 100644
--- a/src/plugins/remotelinux/tarpackagecreationstep.h
+++ b/src/plugins/remotelinux/tarpackagecreationstep.h
@@ -31,7 +31,8 @@
#include "abstractpackagingstep.h"
#include "remotelinux_export.h"
-#include "deployablefile.h"
+
+#include <projectexplorer/deployablefile.h>
QT_BEGIN_NAMESPACE
class QFile;
@@ -65,7 +66,7 @@ private:
const QString &remoteFilePath);
bool m_packagingNeeded;
- QList<DeployableFile> m_files;
+ QList<ProjectExplorer::DeployableFile> m_files;
};
} // namespace RemoteLinux
diff --git a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp
index deabeb28e2..e28c7fafb5 100644
--- a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp
+++ b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp
@@ -698,7 +698,7 @@ bool ResourceModel::iconFileExtension(const QString &path)
const QList<QByteArray> _ext_list = QImageReader::supportedImageFormats();
foreach (const QByteArray &ext, _ext_list) {
QString dotExt = QString(QLatin1Char('.'));
- dotExt += QString::fromAscii(ext);
+ dotExt += QString::fromLatin1(ext);
ext_list.append(dotExt);
}
}
@@ -1091,10 +1091,11 @@ QModelIndex ResourceModel::deleteItem(const QModelIndex &idx)
bool ResourceModel::reload()
{
+ beginResetModel();
const bool result = m_resource_file.load();
if (result)
setDirty(false);
- reset();
+ endResetModel();
return result;
}
diff --git a/src/plugins/resourceeditor/resourceeditor.qbs b/src/plugins/resourceeditor/resourceeditor.qbs
index 68dc1df8bc..889bd951f2 100644
--- a/src/plugins/resourceeditor/resourceeditor.qbs
+++ b/src/plugins/resourceeditor/resourceeditor.qbs
@@ -10,14 +10,7 @@ QtcPlugin {
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["widgets", "xml"] }
- cpp.includePaths: [
- "..",
- "../..",
- "../../libs",
- buildDirectory,
- "qrceditor",
- "../../tools/utils"
- ]
+ cpp.includePaths: base.concat("qrceditor")
files: [
"ResourceEditor.mimetypes.xml",
@@ -31,15 +24,14 @@ QtcPlugin {
"resourceeditorw.h",
"resourcewizard.cpp",
"resourcewizard.h",
- "qrceditor/resourcefile.cpp",
- "qrceditor/resourceview.cpp",
"qrceditor/qrceditor.cpp",
- "qrceditor/undocommands.cpp",
+ "qrceditor/qrceditor.h",
+ "qrceditor/qrceditor.ui",
+ "qrceditor/resourcefile.cpp",
"qrceditor/resourcefile_p.h",
+ "qrceditor/resourceview.cpp",
"qrceditor/resourceview.h",
- "qrceditor/qrceditor.h",
+ "qrceditor/undocommands.cpp",
"qrceditor/undocommands_p.h",
- "qrceditor/qrceditor.ui"
]
}
-
diff --git a/src/plugins/subversion/subversion.qbs b/src/plugins/subversion/subversion.qbs
index bed2a9aea3..ed5571e47c 100644
--- a/src/plugins/subversion/subversion.qbs
+++ b/src/plugins/subversion/subversion.qbs
@@ -12,35 +12,28 @@ QtcPlugin {
Depends { name: "VcsBase" }
Depends { name: "Locator" }
- Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
-
files: [
+ "annotationhighlighter.cpp",
"annotationhighlighter.h",
- "subversionplugin.h",
- "subversioncontrol.h",
- "settingspage.h",
- "subversioneditor.h",
- "subversionsubmiteditor.h",
- "subversionsettings.h",
+ "checkoutwizard.cpp",
"checkoutwizard.h",
+ "checkoutwizardpage.cpp",
"checkoutwizardpage.h",
+ "settingspage.cpp",
+ "settingspage.h",
+ "settingspage.ui",
+ "subversion.qrc",
"subversionconstants.h",
- "annotationhighlighter.cpp",
- "subversionplugin.cpp",
"subversioncontrol.cpp",
- "settingspage.cpp",
+ "subversioncontrol.h",
"subversioneditor.cpp",
- "subversionsubmiteditor.cpp",
+ "subversioneditor.h",
+ "subversionplugin.cpp",
+ "subversionplugin.h",
"subversionsettings.cpp",
- "checkoutwizard.cpp",
- "checkoutwizardpage.cpp",
- "settingspage.ui",
- "subversion.qrc"
+ "subversionsettings.h",
+ "subversionsubmiteditor.cpp",
+ "subversionsubmiteditor.h",
]
}
diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp
index cf2b7fcb2d..edae916419 100644
--- a/src/plugins/subversion/subversionplugin.cpp
+++ b/src/plugins/subversion/subversionplugin.cpp
@@ -45,6 +45,7 @@
#include <utils/synchronousprocess.h>
#include <utils/parameteraction.h>
#include <utils/fileutils.h>
+#include <utils/hostosinfo.h>
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
@@ -141,7 +142,7 @@ static inline const VcsBase::VcsBaseEditorParameters *findType(int ie)
static inline QString debugCodec(const QTextCodec *c)
{
- return c ? QString::fromAscii(c->name()) : QString::fromAscii("Null codec");
+ return c ? QString::fromLatin1(c->name()) : QString::fromLatin1("Null codec");
}
// Parse "svn status" output for added/modified/deleted files
@@ -171,10 +172,9 @@ StatusList parseStatusOutput(const QString &output)
static inline QStringList svnDirectories()
{
QStringList rc(QLatin1String(".svn"));
-#ifdef Q_OS_WIN
- // Option on Windows systems to avoid hassle with some IDEs
- rc.push_back(QLatin1String("_svn"));
-#endif
+ if (Utils::HostOsInfo::isWindowsHost())
+ // Option on Windows systems to avoid hassle with some IDEs
+ rc.push_back(QLatin1String("_svn"));
return rc;
}
@@ -1190,11 +1190,9 @@ SubversionPlugin *SubversionPlugin::instance()
bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName)
{
-#ifdef Q_OS_MAC // See below.
- return vcsAdd14(workingDir, rawFileName);
-#else
+ if (Utils::HostOsInfo::isMacHost()) // See below.
+ return vcsAdd14(workingDir, rawFileName);
return vcsAdd15(workingDir, rawFileName);
-#endif
}
// Post 1.4 add: Use "--parents" to add directories
diff --git a/src/plugins/subversion/subversionsettings.cpp b/src/plugins/subversion/subversionsettings.cpp
index 621ab52057..a323cbacef 100644
--- a/src/plugins/subversion/subversionsettings.cpp
+++ b/src/plugins/subversion/subversionsettings.cpp
@@ -30,6 +30,7 @@
#include "subversionsettings.h"
#include <utils/environment.h>
+#include <utils/hostosinfo.h>
#include <QSettings>
@@ -48,12 +49,7 @@ enum { defaultTimeOutS = 30, defaultLogCount = 1000 };
static QString defaultCommand()
{
- QString rc;
- rc = QLatin1String("svn");
-#if defined(Q_OS_WIN32)
- rc.append(QLatin1String(".exe"));
-#endif
- return rc;
+ return QLatin1String("svn" QTC_HOST_EXE_SUFFIX);
}
using namespace Subversion::Internal;
diff --git a/src/plugins/tasklist/tasklist.qbs b/src/plugins/tasklist/tasklist.qbs
index 8dc99abeae..9a92e0493e 100644
--- a/src/plugins/tasklist/tasklist.qbs
+++ b/src/plugins/tasklist/tasklist.qbs
@@ -12,26 +12,19 @@ QtcPlugin {
Depends { name: "Locator" }
Depends { name: "TextEditor" }
- Depends { name: "cpp" }
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
-
files: [
- "tasklistplugin.h",
- "tasklist_export.h",
- "tasklistconstants.h",
- "stopmonitoringhandler.h",
- "taskfile.h",
- "taskfilefactory.h",
- "tasklistplugin.cpp",
+ "TaskList.mimetypes.xml",
"stopmonitoringhandler.cpp",
+ "stopmonitoringhandler.h",
"taskfile.cpp",
+ "taskfile.h",
"taskfilefactory.cpp",
+ "taskfilefactory.h",
"tasklist.qrc",
- "TaskList.mimetypes.xml"
+ "tasklist_export.h",
+ "tasklistconstants.h",
+ "tasklistplugin.cpp",
+ "tasklistplugin.h",
]
}
diff --git a/src/plugins/texteditor/basetextdocumentlayout.cpp b/src/plugins/texteditor/basetextdocumentlayout.cpp
index e57acbc9af..4e4781bed7 100644
--- a/src/plugins/texteditor/basetextdocumentlayout.cpp
+++ b/src/plugins/texteditor/basetextdocumentlayout.cpp
@@ -29,6 +29,7 @@
#include "basetextdocumentlayout.h"
#include <utils/qtcassert.h>
+#include <QDebug>
using namespace TextEditor;
@@ -52,8 +53,6 @@ public:
void removeMarkFromMarksCache(TextEditor::ITextMark *mark);
private:
- double recalculateMaxMarkWidthFactor() const;
-
TextMarks m_marksCache; // not owned
QTextDocument *document;
};
@@ -86,24 +85,23 @@ bool DocumentMarker::addMark(TextEditor::ITextMark *mark)
mark->updateLineNumber(blockNumber + 1);
QTC_CHECK(mark->lineNumber() == blockNumber + 1); // Checks that the base class is called
mark->updateBlock(block);
- documentLayout->hasMarks = true;
- documentLayout->maxMarkWidthFactor = qMax(mark->widthFactor(),
- documentLayout->maxMarkWidthFactor);
- documentLayout->requestUpdate();
mark->setMarkableInterface(this);
+ if (!mark->visible())
+ return true;
+ // Update document layout
+ double newMaxWidthFactor = qMax(mark->widthFactor(), documentLayout->maxMarkWidthFactor);
+ bool fullUpdate = newMaxWidthFactor > documentLayout->maxMarkWidthFactor || !documentLayout->hasMarks;
+ documentLayout->hasMarks = true;
+ documentLayout->maxMarkWidthFactor = newMaxWidthFactor;
+ if (fullUpdate)
+ documentLayout->requestUpdate();
+ else
+ documentLayout->requestExtraAreaUpdate();
return true;
}
return false;
}
-double DocumentMarker::recalculateMaxMarkWidthFactor() const
-{
- double maxWidthFactor = 1.0;
- foreach (const ITextMark *mark, marks())
- maxWidthFactor = qMax(mark->widthFactor(), maxWidthFactor);
- return maxWidthFactor;
-}
-
TextEditor::TextMarks DocumentMarker::marksAt(int line) const
{
QTC_ASSERT(line >= 1, return TextMarks());
@@ -122,31 +120,50 @@ void DocumentMarker::removeMarkFromMarksCache(TextEditor::ITextMark *mark)
BaseTextDocumentLayout *documentLayout =
qobject_cast<BaseTextDocumentLayout*>(document->documentLayout());
QTC_ASSERT(documentLayout, return);
- bool needUpdate = m_marksCache.removeOne(mark);
+ m_marksCache.removeAll(mark);
+
if (m_marksCache.isEmpty()) {
documentLayout->hasMarks = false;
- needUpdate = true;
+ documentLayout->maxMarkWidthFactor = 1.0;
+ documentLayout->requestUpdate();
+ return;
}
- if (needUpdate) {
- documentLayout->maxMarkWidthFactor = recalculateMaxMarkWidthFactor();
- updateMark(0);
+ if (!mark->visible())
+ return;
+
+ if (documentLayout->maxMarkWidthFactor == 1.0
+ || mark->widthFactor() == 1.0
+ || mark->widthFactor() < documentLayout->maxMarkWidthFactor) {
+ // No change in width possible
+ documentLayout->requestExtraAreaUpdate();
+ } else {
+ double maxWidthFactor = 1.0;
+ foreach (const ITextMark *mark, marks()) {
+ if (!mark->visible())
+ continue;
+ maxWidthFactor = qMax(mark->widthFactor(), maxWidthFactor);
+ if (maxWidthFactor == documentLayout->maxMarkWidthFactor)
+ break; // Still a mark with the maxMarkWidthFactor
+ }
+
+ if (maxWidthFactor != documentLayout->maxMarkWidthFactor) {
+ documentLayout->maxMarkWidthFactor = maxWidthFactor;
+ documentLayout->requestUpdate();
+ } else {
+ documentLayout->requestExtraAreaUpdate();
+ }
}
}
void DocumentMarker::removeMark(TextEditor::ITextMark *mark)
{
- BaseTextDocumentLayout *documentLayout =
- qobject_cast<BaseTextDocumentLayout*>(document->documentLayout());
- QTC_ASSERT(documentLayout, return);
-
- QTextBlock block = document->begin();
- while (block.isValid()) {
- if (TextBlockUserData *data = static_cast<TextBlockUserData *>(block.userData())) {
- data->removeMark(mark);
- }
- block = block.next();
+ QTextBlock block = document->findBlockByNumber(mark->lineNumber() - 1);
+ if (TextBlockUserData *data = static_cast<TextBlockUserData *>(block.userData())) {
+ if (!data->removeMark(mark))
+ qDebug() << "Could not find mark" << mark << "on line" << mark->lineNumber();
}
+
removeMarkFromMarksCache(mark);
mark->setMarkableInterface(0);
}
@@ -169,9 +186,7 @@ CodeFormatterData::~CodeFormatterData()
TextBlockUserData::~TextBlockUserData()
{
- TextMarks marks = m_marks;
- m_marks.clear();
- foreach (ITextMark *mrk, marks) {
+ foreach (ITextMark *mrk, m_marks) {
TextEditor::Internal::DocumentMarker *documentMarker
= static_cast<TextEditor::Internal::DocumentMarker *>(mrk->markableInterface());
documentMarker->removeMarkFromMarksCache(mrk);
@@ -674,6 +689,11 @@ void BaseTextDocumentLayout::setFolded(const QTextBlock &block, bool folded)
}
}
+void BaseTextDocumentLayout::requestExtraAreaUpdate()
+{
+ emit updateExtraArea();
+}
+
ITextMarkable *BaseTextDocumentLayout::markableInterface()
{
return m_documentMarker;
@@ -747,6 +767,7 @@ void BaseTextDocumentLayout::documentReloaded(TextMarks marks)
= static_cast<TextEditor::Internal::DocumentMarker *>(m_documentMarker);
documentMarker->removeMarkFromMarksCache(mark);
mark->removedFromEditor();
+ mark->setMarkableInterface(0);
}
}
requestUpdate();
diff --git a/src/plugins/texteditor/basetextdocumentlayout.h b/src/plugins/texteditor/basetextdocumentlayout.h
index cc8ecc1525..0acf7e254c 100644
--- a/src/plugins/texteditor/basetextdocumentlayout.h
+++ b/src/plugins/texteditor/basetextdocumentlayout.h
@@ -202,6 +202,7 @@ public:
return data;
}
+ void requestExtraAreaUpdate();
void emitDocumentSizeChanged() { emit documentSizeChanged(documentSize()); }
ITextMarkable *markableInterface();
@@ -221,6 +222,9 @@ public:
void documentReloaded(TextMarks marks);
void updateMarksLineNumber();
void updateMarksBlock(const QTextBlock &block);
+
+signals:
+ void updateExtraArea();
};
} // namespace TextEditor
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index 4b5a4db859..3314e0b7a8 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -67,6 +67,7 @@
#include <extensionsystem/pluginmanager.h>
#include <find/basetextfind.h>
#include <utils/linecolumnlabel.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/stylehelper.h>
@@ -116,6 +117,7 @@
using namespace TextEditor;
using namespace TextEditor::Internal;
+using namespace Utils;
namespace TextEditor {
namespace Internal {
@@ -252,7 +254,7 @@ BaseTextEditorWidget::BaseTextEditorWidget(QWidget *parent)
// parentheses matcher
d->m_formatRange = true;
d->m_matchFormat.setForeground(Qt::red);
- d->m_rangeFormat.setBackground(QColor(0xb4, 0xee, 0xb4));
+ d->m_matchFormat.setBackground(QColor(0xb4, 0xee, 0xb4));
d->m_mismatchFormat.setBackground(Qt::magenta);
d->m_parenthesesMatchingTimer = new QTimer(this);
d->m_parenthesesMatchingTimer->setSingleShot(true);
@@ -1761,7 +1763,8 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
// fall through
case Qt::Key_Right:
case Qt::Key_Left:
-#ifndef Q_OS_MAC
+ if (HostOsInfo::isMacHost())
+ break;
if ((e->modifiers()
& (Qt::AltModifier | Qt::ShiftModifier)) == (Qt::AltModifier | Qt::ShiftModifier)) {
int diff_row = 0;
@@ -1785,7 +1788,6 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
viewport()->update();
}
}
-#endif
break;
case Qt::Key_PageUp:
case Qt::Key_PageDown:
@@ -1829,13 +1831,8 @@ void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
}
}
- if (e->key() == Qt::Key_H && e->modifiers() ==
-#ifdef Q_OS_DARWIN
- Qt::MetaModifier
-#else
- Qt::ControlModifier
-#endif
- ) {
+ if (e->key() == Qt::Key_H
+ && e->modifiers() == Qt::KeyboardModifiers(HostOsInfo::controlModifier())) {
universalHelper();
e->accept();
return;
@@ -2535,6 +2532,7 @@ void BaseTextEditorWidgetPrivate::setupDocumentSignals(BaseTextDocument *documen
q->setCursorWidth(2); // Applies to the document layout
QObject::connect(documentLayout, SIGNAL(updateBlock(QTextBlock)), q, SLOT(slotUpdateBlockNotify(QTextBlock)));
+ QObject::connect(documentLayout, SIGNAL(updateExtraArea()), q, SLOT(slotUpdateExtraArea()));
QObject::connect(q, SIGNAL(requestBlockUpdate(QTextBlock)), documentLayout, SIGNAL(updateBlock(QTextBlock)));
QObject::connect(doc, SIGNAL(modificationChanged(bool)), q, SIGNAL(changed()));
QObject::connect(doc, SIGNAL(contentsChange(int,int,int)), q,
@@ -3373,6 +3371,7 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
o.start = relativePos;
o.length = 1;
o.format.setForeground(palette().base());
+ o.format.setBackground(palette().text());
selections.append(o);
}
}
@@ -3395,11 +3394,8 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
cursor_pen = painter.pen();
}
-#ifndef Q_OS_MAC // no visible cursor on mac
- if (blockSelectionCursorRect.isValid())
+ if (!HostOsInfo::isMacHost() && blockSelectionCursorRect.isValid())
painter.fillRect(blockSelectionCursorRect, palette().text());
-#endif
-
}
offset.ry() += r.height();
@@ -4122,6 +4118,11 @@ void BaseTextEditorWidget::slotUpdateBlockNotify(const QTextBlock &block)
blockRecursion = false;
}
+void BaseTextEditorWidget::slotUpdateExtraArea()
+{
+ d->m_extraArea->update();
+}
+
void BaseTextEditorWidget::timerEvent(QTimerEvent *e)
{
if (e->timerId() == d->autoScrollTimer.timerId()) {
@@ -4252,10 +4253,8 @@ void BaseTextEditorWidget::mousePressEvent(QMouseEvent *e)
}
}
-#ifdef Q_OS_LINUX
- if (handleForwardBackwardMouseButtons(e))
+ if (HostOsInfo::isLinuxHost() && handleForwardBackwardMouseButtons(e))
return;
-#endif
QPlainTextEdit::mousePressEvent(e);
}
@@ -4275,10 +4274,8 @@ void BaseTextEditorWidget::mouseReleaseEvent(QMouseEvent *e)
}
}
-#ifndef Q_OS_LINUX
- if (handleForwardBackwardMouseButtons(e))
+ if (!HostOsInfo::isLinuxHost() && handleForwardBackwardMouseButtons(e))
return;
-#endif
QPlainTextEdit::mouseReleaseEvent(e);
}
@@ -4387,6 +4384,12 @@ void BaseTextEditorWidget::extraAreaMouseEvent(QMouseEvent *e)
// Set whether the mouse cursor is a hand or normal arrow
if (e->type() == QEvent::MouseMove) {
bool hand = (e->pos().x() <= markWidth);
+ if (hand) {
+ //Find line by cursor position
+ int line = cursor.blockNumber() + 1;
+ emit editor()->markTooltipRequested(editor(), mapToGlobal(e->pos()), line);
+ }
+
if (hand != (d->m_extraArea->cursor().shape() == Qt::PointingHandCursor))
d->m_extraArea->setCursor(hand ? Qt::PointingHandCursor : Qt::ArrowCursor);
}
@@ -5022,6 +5025,8 @@ void BaseTextEditorWidget::_q_matchParentheses()
QTextCursor backwardMatch = textCursor();
QTextCursor forwardMatch = textCursor();
+ if (overwriteMode())
+ backwardMatch.movePosition(QTextCursor::Right);
const TextBlockUserData::MatchType backwardMatchType = TextBlockUserData::matchCursorBackward(&backwardMatch);
const TextBlockUserData::MatchType forwardMatchType = TextBlockUserData::matchCursorForward(&forwardMatch);
@@ -5038,15 +5043,11 @@ void BaseTextEditorWidget::_q_matchParentheses()
if (backwardMatchType == TextBlockUserData::Mismatch) {
sel.cursor = backwardMatch;
sel.format = d->m_mismatchFormat;
+ extraSelections.append(sel);
} else {
- if (d->m_displaySettings.m_animateMatchingParentheses) {
+ if (d->m_displaySettings.m_animateMatchingParentheses)
animatePosition = backwardMatch.selectionStart();
- } else if (d->m_formatRange) {
- sel.cursor = backwardMatch;
- sel.format = d->m_rangeFormat;
- extraSelections.append(sel);
- }
sel.cursor = backwardMatch;
sel.format = d->m_matchFormat;
@@ -5057,8 +5058,8 @@ void BaseTextEditorWidget::_q_matchParentheses()
sel.cursor.setPosition(backwardMatch.selectionEnd());
sel.cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor);
+ extraSelections.append(sel);
}
- extraSelections.append(sel);
}
if (forwardMatch.hasSelection()) {
@@ -5066,15 +5067,11 @@ void BaseTextEditorWidget::_q_matchParentheses()
if (forwardMatchType == TextBlockUserData::Mismatch) {
sel.cursor = forwardMatch;
sel.format = d->m_mismatchFormat;
+ extraSelections.append(sel);
} else {
- if (d->m_displaySettings.m_animateMatchingParentheses) {
+ if (d->m_displaySettings.m_animateMatchingParentheses)
animatePosition = forwardMatch.selectionEnd()-1;
- } else if (d->m_formatRange) {
- sel.cursor = forwardMatch;
- sel.format = d->m_rangeFormat;
- extraSelections.append(sel);
- }
sel.cursor = forwardMatch;
sel.format = d->m_matchFormat;
@@ -5085,8 +5082,8 @@ void BaseTextEditorWidget::_q_matchParentheses()
sel.cursor.setPosition(forwardMatch.selectionEnd());
sel.cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor);
+ extraSelections.append(sel);
}
- extraSelections.append(sel);
}
@@ -5107,7 +5104,7 @@ void BaseTextEditorWidget::_q_matchParentheses()
d->m_animator->setPosition(animatePosition);
QPalette pal;
pal.setBrush(QPalette::Text, d->m_matchFormat.foreground());
- pal.setBrush(QPalette::Base, d->m_rangeFormat.background());
+ pal.setBrush(QPalette::Base, d->m_matchFormat.background());
d->m_animator->setData(font(), pal, characterAt(d->m_animator->position()));
connect(d->m_animator, SIGNAL(updateRequest(int,QPointF,QRectF)),
this, SLOT(_q_animateUpdate(int,QPointF,QRectF)));
@@ -5610,9 +5607,7 @@ void BaseTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
d->m_searchResultFormat.setBackground(searchResultFormat.background());
// Matching braces
- d->m_matchFormat.setForeground(parenthesesFormat.foreground());
- d->m_rangeFormat.setBackground(parenthesesFormat.background());
-
+ d->m_matchFormat = parenthesesFormat;
// snippests
d->m_occurrencesFormat = fs.toTextCharFormat(C_OCCURRENCES);
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index 01e4b08bb7..907671aee8 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -524,6 +524,7 @@ protected:
virtual QString foldReplacementText(const QTextBlock &block) const;
protected slots:
+ virtual void slotUpdateExtraArea();
virtual void slotUpdateExtraAreaWidth();
virtual void slotModificationChanged(bool);
virtual void slotUpdateRequest(const QRect &r, int dy);
diff --git a/src/plugins/texteditor/basetexteditor_p.h b/src/plugins/texteditor/basetexteditor_p.h
index 8728aef149..837cd47f65 100644
--- a/src/plugins/texteditor/basetexteditor_p.h
+++ b/src/plugins/texteditor/basetexteditor_p.h
@@ -197,7 +197,6 @@ public:
bool m_formatRange;
QTextCharFormat m_matchFormat;
QTextCharFormat m_mismatchFormat;
- QTextCharFormat m_rangeFormat;
QTimer *m_parenthesesMatchingTimer;
// end parentheses matcher
diff --git a/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp b/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp
index 0efafd3740..cc5a8a2b84 100644
--- a/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp
+++ b/src/plugins/texteditor/codeassist/functionhintproposalwidget.cpp
@@ -32,6 +32,7 @@
#include "codeassistant.h"
#include <utils/faketooltip.h>
+#include <utils/hostosinfo.h>
#include <QDebug>
#include <QApplication>
@@ -287,11 +288,9 @@ void FunctionHintProposalWidget::updateContent()
void FunctionHintProposalWidget::updatePosition()
{
const QDesktopWidget *desktop = QApplication::desktop();
-#ifdef Q_OS_MAC
- const QRect &screen = desktop->availableGeometry(desktop->screenNumber(d->m_underlyingWidget));
-#else
- const QRect &screen = desktop->screenGeometry(desktop->screenNumber(d->m_underlyingWidget));
-#endif
+ const QRect &screen = Utils::HostOsInfo::isMacHost()
+ ? desktop->availableGeometry(desktop->screenNumber(d->m_underlyingWidget))
+ : desktop->screenGeometry(desktop->screenNumber(d->m_underlyingWidget));
d->m_pager->setFixedWidth(d->m_pager->minimumSizeHint().width());
diff --git a/src/plugins/texteditor/codeassist/genericproposalwidget.cpp b/src/plugins/texteditor/codeassist/genericproposalwidget.cpp
index 73f56fe410..07c52597b6 100644
--- a/src/plugins/texteditor/codeassist/genericproposalwidget.cpp
+++ b/src/plugins/texteditor/codeassist/genericproposalwidget.cpp
@@ -39,6 +39,7 @@
#include <texteditor/texteditorconstants.h>
#include <utils/faketooltip.h>
+#include <utils/hostosinfo.h>
#include <QRect>
#include <QLatin1String>
@@ -55,6 +56,7 @@
#include <QDesktopWidget>
#include <QLabel>
+using namespace Utils;
namespace TextEditor {
@@ -311,15 +313,15 @@ void GenericProposalWidgetPrivate::maybeShowInfoTip()
GenericProposalWidget::GenericProposalWidget()
: d(new GenericProposalWidgetPrivate(this))
{
-#ifdef Q_OS_MAC
- if (d->m_completionListView->horizontalScrollBar())
- d->m_completionListView->horizontalScrollBar()->setAttribute(Qt::WA_MacMiniSize);
- if (d->m_completionListView->verticalScrollBar())
- d->m_completionListView->verticalScrollBar()->setAttribute(Qt::WA_MacMiniSize);
-#else
- // This improves the look with QGTKStyle.
- setFrameStyle(d->m_completionListView->frameStyle());
-#endif
+ if (HostOsInfo::isMacHost()) {
+ if (d->m_completionListView->horizontalScrollBar())
+ d->m_completionListView->horizontalScrollBar()->setAttribute(Qt::WA_MacMiniSize);
+ if (d->m_completionListView->verticalScrollBar())
+ d->m_completionListView->verticalScrollBar()->setAttribute(Qt::WA_MacMiniSize);
+ } else {
+ // This improves the look with QGTKStyle.
+ setFrameStyle(d->m_completionListView->frameStyle());
+ }
d->m_completionListView->setFrameStyle(QFrame::NoFrame);
d->m_completionListView->setAttribute(Qt::WA_MacShowFocusRect, false);
d->m_completionListView->setUniformItemSizes(true);
@@ -507,11 +509,9 @@ void GenericProposalWidget::updatePositionAndSize()
// Determine the position, keeping the popup on the screen
const QDesktopWidget *desktop = QApplication::desktop();
-#ifdef Q_OS_MAC
- const QRect screen = desktop->availableGeometry(desktop->screenNumber(d->m_underlyingWidget));
-#else
- const QRect screen = desktop->screenGeometry(desktop->screenNumber(d->m_underlyingWidget));
-#endif
+ const QRect screen = HostOsInfo::isMacHost()
+ ? desktop->availableGeometry(desktop->screenNumber(d->m_underlyingWidget))
+ : desktop->screenGeometry(desktop->screenNumber(d->m_underlyingWidget));
QPoint pos = d->m_displayRect.bottomLeft();
pos.rx() -= 16 + fw; // Space for the icons
@@ -555,11 +555,7 @@ bool GenericProposalWidget::eventFilter(QObject *o, QEvent *e)
switch (ke->key()) {
case Qt::Key_N:
case Qt::Key_P:
-#ifdef Q_OS_MAC
- if (ke->modifiers() == Qt::MetaModifier) {
-#else
- if (ke->modifiers() == Qt::ControlModifier) {
-#endif
+ if (ke->modifiers() == Qt::KeyboardModifiers(HostOsInfo::controlModifier())) {
e->accept();
return true;
}
@@ -575,11 +571,7 @@ bool GenericProposalWidget::eventFilter(QObject *o, QEvent *e)
case Qt::Key_P:
// select next/previous completion
d->m_explicitlySelected = true;
-#ifdef Q_OS_MAC
- if (ke->modifiers() == Qt::MetaModifier) {
-#else
- if (ke->modifiers() == Qt::ControlModifier) {
-#endif
+ if (ke->modifiers() == Qt::KeyboardModifiers(HostOsInfo::controlModifier())) {
int change = (ke->key() == Qt::Key_N) ? 1 : -1;
int nrows = d->m_model->size();
int row = d->m_completionListView->currentIndex().row();
diff --git a/src/plugins/texteditor/colorschemeedit.cpp b/src/plugins/texteditor/colorschemeedit.cpp
index 4b7bf7633b..7929cac17a 100644
--- a/src/plugins/texteditor/colorschemeedit.cpp
+++ b/src/plugins/texteditor/colorschemeedit.cpp
@@ -61,8 +61,9 @@ public:
void setFormatDescriptions(const FormatDescriptions *descriptions)
{
+ beginResetModel();
m_descriptions = descriptions;
- reset();
+ endResetModel();
}
void setBaseFont(const QFont &font)
diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp
index 74d413f9ab..8fca3108e0 100644
--- a/src/plugins/texteditor/fontsettingspage.cpp
+++ b/src/plugins/texteditor/fontsettingspage.cpp
@@ -100,8 +100,9 @@ public:
void setColorSchemes(const QList<ColorSchemeEntry> &colorSchemes)
{
+ beginResetModel();
m_colorSchemes = colorSchemes;
- reset();
+ endResetModel();
}
const ColorSchemeEntry &colorSchemeAt(int index) const
diff --git a/src/plugins/texteditor/generichighlighter/highlighter.h b/src/plugins/texteditor/generichighlighter/highlighter.h
index ffd608e5af..13a06d118b 100644
--- a/src/plugins/texteditor/generichighlighter/highlighter.h
+++ b/src/plugins/texteditor/generichighlighter/highlighter.h
@@ -30,8 +30,8 @@
#ifndef HIGHLIGHTER_H
#define HIGHLIGHTER_H
-#include "basetextdocumentlayout.h"
-#include "syntaxhighlighter.h"
+#include "../basetextdocumentlayout.h"
+#include "../syntaxhighlighter.h"
#include <QString>
#include <QVector>
diff --git a/src/plugins/texteditor/generichighlighter/highlightersettingspage.h b/src/plugins/texteditor/generichighlighter/highlightersettingspage.h
index 66fb1075b5..682a6bcd83 100644
--- a/src/plugins/texteditor/generichighlighter/highlightersettingspage.h
+++ b/src/plugins/texteditor/generichighlighter/highlightersettingspage.h
@@ -30,7 +30,7 @@
#ifndef HIGHLIGHTERSETTINGSPAGE_H
#define HIGHLIGHTERSETTINGSPAGE_H
-#include "texteditoroptionspage.h"
+#include "../texteditoroptionspage.h"
QT_BEGIN_NAMESPACE
template <class> class QList;
diff --git a/src/plugins/texteditor/itexteditor.h b/src/plugins/texteditor/itexteditor.h
index 66ef363a59..7c702093b9 100644
--- a/src/plugins/texteditor/itexteditor.h
+++ b/src/plugins/texteditor/itexteditor.h
@@ -116,6 +116,7 @@ signals:
void markContextMenuRequested(TextEditor::ITextEditor *editor, int line, QMenu *menu);
void tooltipOverrideRequested(TextEditor::ITextEditor *editor, const QPoint &globalPos, int position, bool *handled);
void tooltipRequested(TextEditor::ITextEditor *editor, const QPoint &globalPos, int position);
+ void markTooltipRequested(TextEditor::ITextEditor *editor, const QPoint &globalPos, int line);
void contextHelpIdRequested(TextEditor::ITextEditor *editor, int position);
};
diff --git a/src/plugins/texteditor/snippets/snippetssettingspage.cpp b/src/plugins/texteditor/snippets/snippetssettingspage.cpp
index 6404be97bf..f8ad8cdf2d 100644
--- a/src/plugins/texteditor/snippets/snippetssettingspage.cpp
+++ b/src/plugins/texteditor/snippets/snippetssettingspage.cpp
@@ -164,8 +164,9 @@ QVariant SnippetsTableModel::headerData(int section, Qt::Orientation orientation
void SnippetsTableModel::load(const QString &groupId)
{
+ beginResetModel();
m_activeGroupId = groupId;
- reset();
+ endResetModel();
}
QList<QString> SnippetsTableModel::groupIds() const
@@ -218,14 +219,16 @@ void SnippetsTableModel::revertBuitInSnippet(const QModelIndex &modelIndex)
void SnippetsTableModel::restoreRemovedBuiltInSnippets()
{
+ beginResetModel();
m_collection->restoreRemovedSnippets(m_activeGroupId);
- reset();
+ endResetModel();
}
void SnippetsTableModel::resetSnippets()
{
+ beginResetModel();
m_collection->reset(m_activeGroupId);
- reset();
+ endResetModel();
}
void SnippetsTableModel::replaceSnippet(const Snippet &snippet, const QModelIndex &modelIndex)
diff --git a/src/plugins/texteditor/snippets/snippetssettingspage.h b/src/plugins/texteditor/snippets/snippetssettingspage.h
index 4786a738cc..24667488d0 100644
--- a/src/plugins/texteditor/snippets/snippetssettingspage.h
+++ b/src/plugins/texteditor/snippets/snippetssettingspage.h
@@ -30,7 +30,7 @@
#ifndef SNIPPETSSETTINGSPAGE_H
#define SNIPPETSSETTINGSPAGE_H
-#include "texteditoroptionspage.h"
+#include "../texteditoroptionspage.h"
namespace TextEditor {
namespace Internal {
diff --git a/src/plugins/texteditor/texteditor.qbs b/src/plugins/texteditor/texteditor.qbs
index fc8d395779..3eaa4bb194 100644
--- a/src/plugins/texteditor/texteditor.qbs
+++ b/src/plugins/texteditor/texteditor.qbs
@@ -11,16 +11,12 @@ QtcPlugin {
Depends { name: "Find" }
Depends { name: "Locator" }
- cpp.includePaths: [
- ".",
- "..",
+ cpp.includePaths: base.concat([
"generichighlighter",
"tooltip",
"snippets",
- "codeassist",
- "../../libs",
- buildDirectory
- ]
+ "codeassist"
+ ])
files: [
"TextEditor.mimetypes.xml",
@@ -62,10 +58,10 @@ QtcPlugin {
"codestyleselectorwidget.h",
"codestyleselectorwidget.ui",
"colorscheme.cpp",
+ "colorscheme.h",
"colorschemeedit.cpp",
"colorschemeedit.h",
"colorschemeedit.ui",
- "colorscheme.h",
"completionsettings.cpp",
"completionsettings.h",
"convenience.cpp",
@@ -91,9 +87,9 @@ QtcPlugin {
"helpitem.cpp",
"helpitem.h",
"icodestylepreferences.cpp",
+ "icodestylepreferences.h",
"icodestylepreferencesfactory.cpp",
"icodestylepreferencesfactory.h",
- "icodestylepreferences.h",
"indenter.cpp",
"indenter.h",
"ioutlinewidget.h",
@@ -108,9 +104,9 @@ QtcPlugin {
"outlinefactory.cpp",
"outlinefactory.h",
"plaintexteditor.cpp",
+ "plaintexteditor.h",
"plaintexteditorfactory.cpp",
"plaintexteditorfactory.h",
- "plaintexteditor.h",
"quickfix.cpp",
"quickfix.h",
"refactoringchanges.cpp",
@@ -132,18 +128,18 @@ QtcPlugin {
"tabsettingswidget.cpp",
"tabsettingswidget.h",
"tabsettingswidget.ui",
+ "texteditor.qrc",
+ "texteditor_global.h",
"texteditoractionhandler.cpp",
"texteditoractionhandler.h",
"texteditorconstants.cpp",
"texteditorconstants.h",
- "texteditor_global.h",
"texteditoroptionspage.cpp",
"texteditoroptionspage.h",
"texteditoroverlay.cpp",
"texteditoroverlay.h",
"texteditorplugin.cpp",
"texteditorplugin.h",
- "texteditor.qrc",
"texteditorsettings.cpp",
"texteditorsettings.h",
"textfilewizard.cpp",
@@ -217,8 +213,8 @@ QtcPlugin {
"highlightdefinitionmetadata.cpp",
"highlightdefinitionmetadata.h",
"highlighter.cpp",
- "highlighterexception.h",
"highlighter.h",
+ "highlighterexception.h",
"highlightersettings.cpp",
"highlightersettings.h",
"highlightersettingspage.cpp",
@@ -253,12 +249,12 @@ QtcPlugin {
"plaintextsnippetprovider.cpp",
"plaintextsnippetprovider.h",
"reuse.h",
+ "snippet.cpp",
+ "snippet.h",
"snippetassistcollector.cpp",
"snippetassistcollector.h",
- "snippet.cpp",
"snippeteditor.cpp",
"snippeteditor.h",
- "snippet.h",
"snippetscollection.cpp",
"snippetscollection.h",
"snippetssettings.cpp",
@@ -281,7 +277,7 @@ QtcPlugin {
"tips.cpp",
"tips.h",
"tooltip.cpp",
- "tooltip.h"
+ "tooltip.h",
]
}
@@ -290,4 +286,3 @@ QtcPlugin {
Depends { name: "Locator" }
}
}
-
diff --git a/src/plugins/todo/todo.qbs b/src/plugins/todo/todo.qbs
index 8629356c0e..85d218de15 100644
--- a/src/plugins/todo/todo.qbs
+++ b/src/plugins/todo/todo.qbs
@@ -15,21 +15,16 @@ QtcPlugin {
Depends { name: "cpp" }
cpp.defines: base.concat(["QT_NO_CAST_FROM_ASCII"])
- cpp.includePaths: [
- "..",
- "../../libs",
- buildDirectory
- ]
files: [
"constants.h",
"cpptodoitemsscanner.cpp",
"cpptodoitemsscanner.h",
"keyword.cpp",
+ "keyword.h",
"keyworddialog.cpp",
"keyworddialog.h",
"keyworddialog.ui",
- "keyword.h",
"lineparser.cpp",
"lineparser.h",
"optionsdialog.cpp",
@@ -52,6 +47,6 @@ QtcPlugin {
"todooutputpane.h",
"todoplugin.cpp",
"todoplugin.h",
- "todoplugin.qrc"
+ "todoplugin.qrc",
]
}
diff --git a/src/plugins/updateinfo/updateinfo.qbs b/src/plugins/updateinfo/updateinfo.qbs
index 716ff5e686..de31720174 100644
--- a/src/plugins/updateinfo/updateinfo.qbs
+++ b/src/plugins/updateinfo/updateinfo.qbs
@@ -21,6 +21,6 @@ QtcPlugin {
"updateinfobutton.cpp",
"updateinfobutton.h",
"updateinfoplugin.cpp",
- "updateinfoplugin.h"
+ "updateinfoplugin.h",
]
}
diff --git a/src/plugins/valgrind/callgrind/callgrindcontroller.cpp b/src/plugins/valgrind/callgrind/callgrindcontroller.cpp
index 861252bee1..1d2f9b0e46 100644
--- a/src/plugins/valgrind/callgrind/callgrindcontroller.cpp
+++ b/src/plugins/valgrind/callgrind/callgrindcontroller.cpp
@@ -28,12 +28,12 @@
****************************************************************************/
#include "callgrindcontroller.h"
+#include "../valgrindprocess.h"
#include <QDebug>
#include <QDir>
-#include <valgrindprocess.h>
-
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <ssh/sftpchannel.h>
@@ -134,11 +134,7 @@ void CallgrindController::run(Option option)
#if CALLGRIND_CONTROL_DEBUG
m_process->setProcessChannelMode(QProcess::ForwardedChannels);
#endif
-#ifdef Q_OS_WIN
- int pid = 0;
-#else
- const int pid = m_valgrindProc->pid();
-#endif
+ const int pid = Utils::HostOsInfo::isWindowsHost() ? 0 : m_valgrindProc->pid();
m_process->run(CALLGRIND_CONTROL_BINARY,
QStringList() << optionString << QString::number(pid),
QString(), QString());
diff --git a/src/plugins/valgrind/callgrind/callgrindrunner.h b/src/plugins/valgrind/callgrind/callgrindrunner.h
index ff2f8efdb6..e42c821f80 100644
--- a/src/plugins/valgrind/callgrind/callgrindrunner.h
+++ b/src/plugins/valgrind/callgrind/callgrindrunner.h
@@ -30,7 +30,7 @@
#ifndef VALGRIND_CALLGRIND_CALLGRINDRUNNER_H
#define VALGRIND_CALLGRIND_CALLGRINDRUNNER_H
-#include <valgrindrunner.h>
+#include "../valgrindrunner.h"
#include "callgrindcontroller.h"
diff --git a/src/plugins/valgrind/memcheck/memcheckrunner.cpp b/src/plugins/valgrind/memcheck/memcheckrunner.cpp
index 17a600e240..48393113c9 100644
--- a/src/plugins/valgrind/memcheck/memcheckrunner.cpp
+++ b/src/plugins/valgrind/memcheck/memcheckrunner.cpp
@@ -30,9 +30,9 @@
#include "memcheckrunner.h"
-#include <xmlprotocol/error.h>
-#include <xmlprotocol/status.h>
-#include <xmlprotocol/threadedparser.h>
+#include "../xmlprotocol/error.h"
+#include "../xmlprotocol/status.h"
+#include "../xmlprotocol/threadedparser.h"
#include <utils/qtcassert.h>
diff --git a/src/plugins/valgrind/memcheck/memcheckrunner.h b/src/plugins/valgrind/memcheck/memcheckrunner.h
index 28bd93e76c..2dd1ccc4fd 100644
--- a/src/plugins/valgrind/memcheck/memcheckrunner.h
+++ b/src/plugins/valgrind/memcheck/memcheckrunner.h
@@ -31,7 +31,7 @@
#ifndef VALGRIND_PROTOCOL_MEMCHECKRUNNER_H
#define VALGRIND_PROTOCOL_MEMCHECKRUNNER_H
-#include <valgrindrunner.h>
+#include "../valgrindrunner.h"
namespace Valgrind {
diff --git a/src/plugins/valgrind/valgrind.qbs b/src/plugins/valgrind/valgrind.qbs
index dfdc6d6582..e3add86457 100644
--- a/src/plugins/valgrind/valgrind.qbs
+++ b/src/plugins/valgrind/valgrind.qbs
@@ -13,15 +13,6 @@ QtcPlugin {
Depends { name: "RemoteLinux" }
Depends { name: "CPlusPlus"}
- Depends { name: "cpp" }
- cpp.includePaths: [
- ".",
- "valgrind",
- "..",
- "../../libs",
- buildDirectory
- ]
-
files: [
"callgrindcostdelegate.cpp",
"callgrindcostdelegate.h",
@@ -54,16 +45,16 @@ QtcPlugin {
"valgrindengine.h",
"valgrindplugin.cpp",
"valgrindplugin.h",
+ "valgrindprocess.cpp",
+ "valgrindprocess.h",
+ "valgrindrunner.cpp",
+ "valgrindrunner.h",
"valgrindsettings.cpp",
"valgrindsettings.h",
"valgrindtool.cpp",
"valgrindtool.h",
"workarounds.cpp",
"workarounds.h",
- "valgrindprocess.cpp",
- "valgrindprocess.h",
- "valgrindrunner.cpp",
- "valgrindrunner.h",
"callgrind/callgrindabstractmodel.h",
"callgrind/callgrindcallmodel.cpp",
"callgrind/callgrindcallmodel.h",
@@ -115,7 +106,6 @@ QtcPlugin {
"xmlprotocol/suppression.cpp",
"xmlprotocol/suppression.h",
"xmlprotocol/threadedparser.cpp",
- "xmlprotocol/threadedparser.h"
+ "xmlprotocol/threadedparser.h",
]
}
-
diff --git a/src/plugins/valgrind/valgrindconfigwidget.cpp b/src/plugins/valgrind/valgrindconfigwidget.cpp
index e5e8e01141..7b63c68be8 100644
--- a/src/plugins/valgrind/valgrindconfigwidget.cpp
+++ b/src/plugins/valgrind/valgrindconfigwidget.cpp
@@ -33,6 +33,7 @@
#include "ui_valgrindconfigwidget.h"
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QDebug>
@@ -63,12 +64,12 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings,
connect(m_settings, SIGNAL(valgrindExecutableChanged(QString)),
m_ui->valgrindExeChooser, SLOT(setPath(QString)));
-#ifdef Q_OS_WIN
- // FIXME: On Window we know that we don't have a local valgrind
- // executable, so having the "Browse" button in the path chooser
- // (which is needed for the remote executable) is confusing.
- m_ui->valgrindExeChooser->buttonAtIndex(0)->hide();
-#endif
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ // FIXME: On Window we know that we don't have a local valgrind
+ // executable, so having the "Browse" button in the path chooser
+ // (which is needed for the remote executable) is confusing.
+ m_ui->valgrindExeChooser->buttonAtIndex(0)->hide();
+ }
//
// Callgrind
diff --git a/src/plugins/valgrind/valgrindplugin.cpp b/src/plugins/valgrind/valgrindplugin.cpp
index ee546e7de2..32f4b90be3 100644
--- a/src/plugins/valgrind/valgrindplugin.cpp
+++ b/src/plugins/valgrind/valgrindplugin.cpp
@@ -43,6 +43,7 @@
#include <projectexplorer/applicationrunconfiguration.h>
#include <projectexplorer/projectexplorer.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QDebug>
@@ -91,9 +92,8 @@ void ValgrindPlugin::startValgrindTool(IAnalyzerTool *tool, StartMode mode)
bool ValgrindPlugin::initialize(const QStringList &, QString *)
{
StartModes modes;
-#ifndef Q_OS_WIN
- modes.append(StartMode(StartLocal));
-#endif
+ if (!Utils::HostOsInfo::isWindowsHost())
+ modes.append(StartMode(StartLocal));
modes.append(StartMode(StartRemote));
AnalyzerManager::addTool(new MemcheckTool(this), modes);
diff --git a/src/plugins/valgrind/valgrindrunner.cpp b/src/plugins/valgrind/valgrindrunner.cpp
index fbb19174d7..71d38699ed 100644
--- a/src/plugins/valgrind/valgrindrunner.cpp
+++ b/src/plugins/valgrind/valgrindrunner.cpp
@@ -31,9 +31,10 @@
#include "valgrindrunner.h"
#include "valgrindprocess.h"
+#include <utils/environment.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
-#include <utils/environment.h>
#include <ssh/sshconnection.h>
#include <ssh/sshremoteprocess.h>
@@ -91,10 +92,9 @@ void ValgrindRunner::Private::run(ValgrindProcess *_process)
QStringList valgrindArgs = valgrindArguments;
valgrindArgs << QString("--tool=%1").arg(q->tool());
-#ifdef Q_OS_MAC
- // May be slower to start but without it we get no filenames for symbols.
- valgrindArgs << QLatin1String("--dsymutil=yes");
-#endif
+ if (Utils::HostOsInfo::isMacHost())
+ // May be slower to start but without it we get no filenames for symbols.
+ valgrindArgs << QLatin1String("--dsymutil=yes");
QObject::connect(process, SIGNAL(processOutput(QByteArray,Utils::OutputFormat)),
q, SIGNAL(processOutputReceived(QByteArray,Utils::OutputFormat)));
diff --git a/src/plugins/valgrind/valgrindsettings.cpp b/src/plugins/valgrind/valgrindsettings.cpp
index d00d5e88c9..ca417a48a3 100644
--- a/src/plugins/valgrind/valgrindsettings.cpp
+++ b/src/plugins/valgrind/valgrindsettings.cpp
@@ -324,6 +324,13 @@ void ValgrindGlobalSettings::fromMap(const QVariantMap &map)
setIfPresent(map, QLatin1String(callgrindShortenTemplates), &m_shortenTemplates);
}
+AbstractAnalyzerSubConfig *ValgrindGlobalSettings::clone()
+{
+ ValgrindGlobalSettings *other = new ValgrindGlobalSettings;
+ other->fromMap(toMap());
+ return other;
+}
+
QVariantMap ValgrindGlobalSettings::toMap() const
{
QVariantMap map = ValgrindBaseSettings::toMap();
@@ -457,6 +464,13 @@ void ValgrindProjectSettings::fromMap(const QVariantMap &map)
setIfPresent(map, removedSuppressionFilesC, &m_disabledGlobalSuppressionFiles);
}
+AbstractAnalyzerSubConfig *ValgrindProjectSettings::clone()
+{
+ ValgrindProjectSettings *other = new ValgrindProjectSettings;
+ other->fromMap(toMap());
+ return other;
+}
+
QVariantMap ValgrindProjectSettings::toMap() const
{
QVariantMap map = ValgrindBaseSettings::toMap();
diff --git a/src/plugins/valgrind/valgrindsettings.h b/src/plugins/valgrind/valgrindsettings.h
index 3f221d5299..feb1881fea 100644
--- a/src/plugins/valgrind/valgrindsettings.h
+++ b/src/plugins/valgrind/valgrindsettings.h
@@ -173,6 +173,7 @@ public:
QVariantMap toMap() const;
QVariantMap defaults() const;
void fromMap(const QVariantMap &map);
+ virtual AbstractAnalyzerSubConfig *clone();
/*
* Global memcheck settings
@@ -230,6 +231,7 @@ public:
QVariantMap toMap() const;
QVariantMap defaults() const;
void fromMap(const QVariantMap &map);
+ virtual AbstractAnalyzerSubConfig *clone();
/**
* Per-project memcheck settings, saves a diff to the global suppression files list
diff --git a/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp b/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp
index 6e12d51c1e..a7fc21211a 100644
--- a/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp
+++ b/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp
@@ -60,7 +60,7 @@ QString toolTipForFrame(const Frame &frame)
if (frame.instructionPointer())
lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol",
"Instruction pointer:"),
- QString::fromAscii("0x%1").arg(frame.instructionPointer(), 0, 16));
+ QString::fromLatin1("0x%1").arg(frame.instructionPointer(), 0, 16));
if (!frame.object().isEmpty())
lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Object:"), frame.object());
diff --git a/src/plugins/valgrind/xmlprotocol/stackmodel.cpp b/src/plugins/valgrind/xmlprotocol/stackmodel.cpp
index 4404acfe0c..0e9e16f31b 100644
--- a/src/plugins/valgrind/xmlprotocol/stackmodel.cpp
+++ b/src/plugins/valgrind/xmlprotocol/stackmodel.cpp
@@ -219,8 +219,9 @@ void StackModel::setError(const Error &error)
{
if (d->error == error)
return;
+ beginResetModel();
d->error = error;
- reset();
+ endResetModel();
}
void StackModel::clear()
diff --git a/src/plugins/valgrind/xmlprotocol/threadedparser.cpp b/src/plugins/valgrind/xmlprotocol/threadedparser.cpp
index 9784cd58f3..f8d7d0e9b9 100644
--- a/src/plugins/valgrind/xmlprotocol/threadedparser.cpp
+++ b/src/plugins/valgrind/xmlprotocol/threadedparser.cpp
@@ -39,7 +39,7 @@
#include <QIODevice>
#include <QMetaType>
#include <QThread>
-#include <QSharedPointer>
+#include <QPointer>
namespace {
@@ -74,7 +74,7 @@ public:
Private()
{}
- QWeakPointer<Thread> parserThread;
+ QPointer<Thread> parserThread;
QString errorString;
};
diff --git a/src/plugins/vcsbase/checkoutjobs.cpp b/src/plugins/vcsbase/checkoutjobs.cpp
index 5f27520593..778487e924 100644
--- a/src/plugins/vcsbase/checkoutjobs.cpp
+++ b/src/plugins/vcsbase/checkoutjobs.cpp
@@ -29,8 +29,8 @@
#include "checkoutjobs.h"
-#include <vcsbaseplugin.h>
-#include <vcsbaseoutputwindow.h>
+#include "vcsbaseplugin.h"
+#include "vcsbaseoutputwindow.h"
#include <QDebug>
#include <QQueue>
diff --git a/src/plugins/vcsbase/commonvcssettings.cpp b/src/plugins/vcsbase/commonvcssettings.cpp
index 1022dc4cd3..1eda0667ba 100644
--- a/src/plugins/vcsbase/commonvcssettings.cpp
+++ b/src/plugins/vcsbase/commonvcssettings.cpp
@@ -29,6 +29,8 @@
#include "commonvcssettings.h"
+#include <utils/hostosinfo.h>
+
#include <QSettings>
#include <QDebug>
@@ -51,11 +53,9 @@ static inline QString sshPasswordPromptDefault()
const QByteArray envSetting = qgetenv("SSH_ASKPASS");
if (!envSetting.isEmpty())
return QString::fromLocal8Bit(envSetting);
-#ifdef Q_OS_WIN
- return QLatin1String("win-ssh-askpass");
-#else
+ if (Utils::HostOsInfo::isWindowsHost())
+ return QLatin1String("win-ssh-askpass");
return QLatin1String("ssh-askpass");
-#endif
}
namespace VcsBase {
diff --git a/src/plugins/vcsbase/vcsbase.qbs b/src/plugins/vcsbase/vcsbase.qbs
index 91245e75d8..aefb0c04f9 100644
--- a/src/plugins/vcsbase/vcsbase.qbs
+++ b/src/plugins/vcsbase/vcsbase.qbs
@@ -14,18 +14,8 @@ QtcPlugin {
Depends { name: "CppTools" }
Depends { name: "CPlusPlus" }
- cpp.includePaths: [
- ".",
- "..",
- "../../libs",
- "../../libs/3rdparty",
- buildDirectory
- ]
-
files: [
"VcsBase.mimetypes.xml",
- "vcsbase.qrc",
- "vcsbase_global.h",
"baseannotationhighlighter.cpp",
"baseannotationhighlighter.h",
"basecheckoutwizard.cpp",
@@ -65,6 +55,8 @@ QtcPlugin {
"submiteditorfile.h",
"submitfilemodel.cpp",
"submitfilemodel.h",
+ "vcsbase.qrc",
+ "vcsbase_global.h",
"vcsbaseclient.cpp",
"vcsbaseclient.h",
"vcsbaseclientsettings.cpp",
@@ -87,7 +79,6 @@ QtcPlugin {
"vcsplugin.cpp",
"vcsplugin.h",
"images/diff.png",
- "images/submit.png"
+ "images/submit.png",
]
}
-
diff --git a/src/plugins/vcsbase/vcsbaseclientsettings.cpp b/src/plugins/vcsbase/vcsbaseclientsettings.cpp
index 445df7e663..01e03b9125 100644
--- a/src/plugins/vcsbase/vcsbaseclientsettings.cpp
+++ b/src/plugins/vcsbase/vcsbaseclientsettings.cpp
@@ -30,6 +30,7 @@
#include "vcsbaseclientsettings.h"
#include <utils/environment.h>
+#include <utils/hostosinfo.h>
#include <utils/synchronousprocess.h>
#include <QSettings>
@@ -350,7 +351,7 @@ QString VcsBaseClientSettings::binaryPath() const
if (d->m_binaryFullPath.isEmpty()) {
d->m_binaryFullPath = Utils::Environment::systemEnvironment().searchInPath(
stringValue(binaryPathKey), stringValue(pathKey).split(
- Utils::SynchronousProcess::pathSeparator()));
+ Utils::HostOsInfo::pathListSeparator()));
}
return d->m_binaryFullPath;
}
diff --git a/src/plugins/welcome/welcome.qbs b/src/plugins/welcome/welcome.qbs
index bb975867df..3f4182aedf 100644
--- a/src/plugins/welcome/welcome.qbs
+++ b/src/plugins/welcome/welcome.qbs
@@ -10,19 +10,11 @@ QtcPlugin {
Depends { name: "ProjectExplorer" }
Depends { name: "cpp" }
- cpp.defines: project.additionalCppDefines
- cpp.includePaths: [
- "..",
- "../../libs",
- "../../../src/shared/scriptwrapper",
- "../../Core/dynamiclibrary",
- buildDirectory
- ]
+ cpp.includePaths: base.concat("../../shared/scriptwrapper")
files: [
"welcome_global.h",
"welcomeplugin.cpp",
- "welcomeplugin.h"
+ "welcomeplugin.h",
]
}
-
diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp
index 75d80cf909..fc231d39f1 100644
--- a/src/plugins/welcome/welcomeplugin.cpp
+++ b/src/plugins/welcome/welcomeplugin.cpp
@@ -40,6 +40,7 @@
#include <projectexplorer/projectexplorer.h>
+#include <utils/hostosinfo.h>
#include <utils/styledbar.h>
#include <utils/iwelcomepage.h>
#include <utils/networkaccessmanager.h>
@@ -64,6 +65,7 @@
enum { debug = 0 };
using namespace ExtensionSystem;
+using namespace Utils;
static const char currentPageSettingsKeyC[] = "WelcomeTab";
@@ -238,11 +240,10 @@ void WelcomeMode::initPlugins()
engine->setOutputWarningsToStandardError(false);
engine->setNetworkAccessManagerFactory(m_networkAccessManagerFactory);
QString pluginPath = QCoreApplication::applicationDirPath();
-#ifdef Q_OS_MAC
- pluginPath += QLatin1String("/../PlugIns");
-#else
- pluginPath += QLatin1String("/../" IDE_LIBRARY_BASENAME "/qtcreator");
-#endif
+ if (HostOsInfo::isMacHost())
+ pluginPath += QLatin1String("/../PlugIns");
+ else
+ pluginPath += QLatin1String("/../" IDE_LIBRARY_BASENAME "/qtcreator");
engine->addImportPath(QDir::cleanPath(pluginPath));
facilitateQml(engine);
foreach (Utils::IWelcomePage *plugin, plugins) {
@@ -259,17 +260,13 @@ void WelcomeMode::initPlugins()
QString WelcomeMode::platform() const
{
-#if defined(Q_OS_WIN)
- return QLatin1String("windows");
-#elif defined(Q_OS_MAC)
- return QLatin1String("mac");
-#elif defined(Q_OS_LINUX)
- return QLatin1String("linux");
-#elif defined(Q_OS_UNIX)
- return QLatin1String("unix");
-#else
- return QLatin1String("other")
-#endif
+ switch (HostOsInfo::hostOs()) {
+ case HostOsInfo::HostOsWindows: return QLatin1String("windows");
+ case HostOsInfo::HostOsMac: return QLatin1String("mac");
+ case HostOsInfo::HostOsLinux: return QLatin1String("linux");
+ case HostOsInfo::HostOsOtherUnix: return QLatin1String("unix");
+ default: return QLatin1String("other");
+ }
}
void WelcomeMode::welcomePluginAdded(QObject *obj)