summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@nokia.com>2012-04-24 15:49:09 +0200
committerTobias Hunger <tobias.hunger@nokia.com>2012-06-21 12:08:12 +0200
commit24314562165588b56a318b3b8a846bf5deda7c41 (patch)
treeb5dcf951e76d003c2623011b0e91994e06e7e061 /src
parent8c77b8c9d7b25d0c89003c8c4a54e8da5bfb7edd (diff)
downloadqt-creator-24314562165588b56a318b3b8a846bf5deda7c41.tar.gz
Profile introduction
Introduce Profiles to store sets of values that describe a system/device. These profiles are held by a target, getting rid of much of the information stored in the Build-/Run-/DeployConfigurations, greatly simplifying those. This is a squash of the wip/profile branch which has been on gerrit for a while, rebased to current master. Change-Id: I25956c8dd4d1962b2134bfaa8a8076ae3909460f Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/libs/utils/detailsbutton.cpp33
-rw-r--r--src/libs/utils/detailsbutton.h16
-rw-r--r--src/libs/utils/persistentsettings.cpp11
-rw-r--r--src/plugins/android/android.pro6
-rw-r--r--src/plugins/android/android.qbs6
-rw-r--r--src/plugins/android/androidconfigurations.cpp181
-rw-r--r--src/plugins/android/androidconfigurations.h46
-rw-r--r--src/plugins/android/androidconstants.h12
-rw-r--r--src/plugins/android/androidcreatekeystorecertificate.cpp14
-rw-r--r--src/plugins/android/androidcreatekeystorecertificate.h6
-rw-r--r--src/plugins/android/androiddebugsupport.cpp23
-rw-r--r--src/plugins/android/androiddeployconfiguration.cpp34
-rw-r--r--src/plugins/android/androiddeployconfiguration.h1
-rw-r--r--src/plugins/android/androiddeploystep.cpp54
-rw-r--r--src/plugins/android/androiddeploystep.h4
-rw-r--r--src/plugins/android/androiddeploystepfactory.cpp24
-rw-r--r--src/plugins/android/androiddeploystepwidget.cpp2
-rw-r--r--src/plugins/android/androidmanager.cpp (renamed from src/plugins/android/androidtarget.cpp)1144
-rw-r--r--src/plugins/android/androidmanager.h177
-rw-r--r--src/plugins/android/androidpackagecreationfactory.cpp20
-rw-r--r--src/plugins/android/androidpackagecreationstep.cpp122
-rw-r--r--src/plugins/android/androidpackagecreationstep.h29
-rw-r--r--src/plugins/android/androidpackagecreationwidget.cpp129
-rw-r--r--src/plugins/android/androidpackagecreationwidget.h5
-rw-r--r--src/plugins/android/androidpackageinstallationfactory.cpp21
-rw-r--r--src/plugins/android/androidpackageinstallationstep.cpp20
-rw-r--r--src/plugins/android/androidplugin.cpp45
-rw-r--r--src/plugins/android/androidplugin.h10
-rw-r--r--src/plugins/android/androidqtversion.cpp14
-rw-r--r--src/plugins/android/androidqtversion.h3
-rw-r--r--src/plugins/android/androidrunconfiguration.cpp36
-rw-r--r--src/plugins/android/androidrunconfiguration.h8
-rw-r--r--src/plugins/android/androidrunfactories.cpp86
-rw-r--r--src/plugins/android/androidrunfactories.h12
-rw-r--r--src/plugins/android/androidrunner.cpp24
-rw-r--r--src/plugins/android/androidsettingswidget.cpp134
-rw-r--r--src/plugins/android/androidsettingswidget.h5
-rw-r--r--src/plugins/android/androidtarget.h204
-rw-r--r--src/plugins/android/androidtargetfactory.cpp185
-rw-r--r--src/plugins/android/androidtargetfactory.h70
-rw-r--r--src/plugins/android/androidtoolchain.cpp21
-rw-r--r--src/plugins/android/androidtoolchain.h2
-rw-r--r--src/plugins/autotoolsprojectmanager/autogenstep.cpp23
-rw-r--r--src/plugins/autotoolsprojectmanager/autogenstep.h2
-rw-r--r--src/plugins/autotoolsprojectmanager/autoreconfstep.cpp23
-rw-r--r--src/plugins/autotoolsprojectmanager/autoreconfstep.h2
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp95
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h29
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.cpp59
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.h11
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsproject.cpp120
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsproject.h18
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsprojectconstants.h3
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro2
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs2
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp3
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolstarget.cpp175
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolstarget.h99
-rw-r--r--src/plugins/autotoolsprojectmanager/configurestep.cpp36
-rw-r--r--src/plugins/autotoolsprojectmanager/configurestep.h4
-rw-r--r--src/plugins/autotoolsprojectmanager/makestep.cpp21
-rw-r--r--src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp127
-rw-r--r--src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h23
-rw-r--r--src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp57
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h3
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.cpp153
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.h14
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp16
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp4
-rw-r--r--src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp63
-rw-r--r--src/plugins/cmakeprojectmanager/cmakerunconfiguration.h9
-rw-r--r--src/plugins/cmakeprojectmanager/cmaketarget.cpp242
-rw-r--r--src/plugins/cmakeprojectmanager/cmaketarget.h100
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeuicodemodelsupport.cpp15
-rw-r--r--src/plugins/cmakeprojectmanager/makestep.cpp27
-rw-r--r--src/plugins/debugger/debugger.pro4
-rw-r--r--src/plugins/debugger/debugger.qbs4
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp58
-rw-r--r--src/plugins/debugger/debuggerprofileconfigwidget.cpp148
-rw-r--r--src/plugins/debugger/debuggerprofileconfigwidget.h81
-rw-r--r--src/plugins/debugger/debuggerprofileinformation.cpp208
-rw-r--r--src/plugins/debugger/debuggerprofileinformation.h67
-rw-r--r--src/plugins/debugger/debuggerrunner.cpp11
-rw-r--r--src/plugins/debugger/debuggertoolchaincombobox.cpp34
-rw-r--r--src/plugins/genericprojectmanager/genericbuildconfiguration.cpp104
-rw-r--r--src/plugins/genericprojectmanager/genericbuildconfiguration.h46
-rw-r--r--src/plugins/genericprojectmanager/genericmakestep.cpp20
-rw-r--r--src/plugins/genericprojectmanager/genericproject.cpp172
-rw-r--r--src/plugins/genericprojectmanager/genericproject.h47
-rw-r--r--src/plugins/genericprojectmanager/genericprojectmanager.pro2
-rw-r--r--src/plugins/genericprojectmanager/genericprojectmanager.qbs2
-rw-r--r--src/plugins/genericprojectmanager/genericprojectplugin.cpp5
-rw-r--r--src/plugins/genericprojectmanager/generictarget.cpp176
-rw-r--r--src/plugins/genericprojectmanager/generictarget.h100
-rw-r--r--src/plugins/madde/debianmanager.cpp728
-rw-r--r--src/plugins/madde/debianmanager.h114
-rw-r--r--src/plugins/madde/madde.pro14
-rw-r--r--src/plugins/madde/madde.qbs13
-rw-r--r--src/plugins/madde/maddedevice.cpp29
-rw-r--r--src/plugins/madde/maddedevice.h7
-rw-r--r--src/plugins/madde/maddeplugin.cpp9
-rw-r--r--src/plugins/madde/maddeuploadandinstallpackagesteps.cpp10
-rw-r--r--src/plugins/madde/maemoconstants.h1
-rw-r--r--src/plugins/madde/maemodeploybymountsteps.cpp5
-rw-r--r--src/plugins/madde/maemodeployconfigurationwidget.cpp22
-rw-r--r--src/plugins/madde/maemodeploymentmounter.cpp4
-rw-r--r--src/plugins/madde/maemodeploystepfactory.cpp49
-rw-r--r--src/plugins/madde/maemoglobal.cpp33
-rw-r--r--src/plugins/madde/maemoglobal.h11
-rw-r--r--src/plugins/madde/maemoinstalltosysrootstep.cpp37
-rw-r--r--src/plugins/madde/maemopackagecreationfactory.cpp19
-rw-r--r--src/plugins/madde/maemopackagecreationstep.cpp81
-rw-r--r--src/plugins/madde/maemopackagecreationstep.h14
-rw-r--r--src/plugins/madde/maemopackagecreationwidget.cpp92
-rw-r--r--src/plugins/madde/maemopackagecreationwidget.h7
-rw-r--r--src/plugins/madde/maemopublisherfremantlefree.cpp30
-rw-r--r--src/plugins/madde/maemopublishingbuildsettingspagefremantlefree.cpp27
-rw-r--r--src/plugins/madde/maemopublishingbuildsettingspagefremantlefree.h3
-rw-r--r--src/plugins/madde/maemopublishinguploadsettingspagefremantlefree.h6
-rw-r--r--src/plugins/madde/maemopublishingwizardfactories.cpp21
-rw-r--r--src/plugins/madde/maemopublishingwizardfactories.h8
-rw-r--r--src/plugins/madde/maemopublishingwizardfremantlefree.cpp6
-rw-r--r--src/plugins/madde/maemoqemumanager.cpp128
-rw-r--r--src/plugins/madde/maemoqemumanager.h10
-rw-r--r--src/plugins/madde/maemoqtversion.cpp65
-rw-r--r--src/plugins/madde/maemoqtversion.h7
-rw-r--r--src/plugins/madde/maemoremotemounter.cpp19
-rw-r--r--src/plugins/madde/maemoremotemounter.h6
-rw-r--r--src/plugins/madde/maemorunconfiguration.cpp41
-rw-r--r--src/plugins/madde/maemorunconfiguration.h8
-rw-r--r--src/plugins/madde/maemorunconfigurationwidget.cpp13
-rw-r--r--src/plugins/madde/maemorunfactories.cpp67
-rw-r--r--src/plugins/madde/maemorunfactories.h16
-rw-r--r--src/plugins/madde/maemosshrunner.cpp4
-rw-r--r--src/plugins/madde/maemotoolchain.cpp323
-rw-r--r--src/plugins/madde/maemotoolchain.h127
-rw-r--r--src/plugins/madde/qt4maemodeployconfiguration.cpp207
-rw-r--r--src/plugins/madde/qt4maemodeployconfiguration.h17
-rw-r--r--src/plugins/madde/qt4maemotarget.cpp1271
-rw-r--r--src/plugins/madde/qt4maemotarget.h302
-rw-r--r--src/plugins/madde/qt4maemotargetfactory.cpp225
-rw-r--r--src/plugins/madde/qt4maemotargetfactory.h71
-rw-r--r--src/plugins/madde/rpmmanager.cpp243
-rw-r--r--src/plugins/madde/rpmmanager.h92
-rw-r--r--src/plugins/projectexplorer/abstractmsvctoolchain.cpp15
-rw-r--r--src/plugins/projectexplorer/abstractmsvctoolchain.h3
-rw-r--r--src/plugins/projectexplorer/buildconfiguration.cpp91
-rw-r--r--src/plugins/projectexplorer/buildconfiguration.h31
-rw-r--r--src/plugins/projectexplorer/buildenvironmentwidget.cpp9
-rw-r--r--src/plugins/projectexplorer/buildsettingspropertiespage.cpp50
-rw-r--r--src/plugins/projectexplorer/buildsteplist.cpp2
-rw-r--r--src/plugins/projectexplorer/buildstepspage.cpp38
-rw-r--r--src/plugins/projectexplorer/buildstepspage.h15
-rw-r--r--src/plugins/projectexplorer/deployconfiguration.cpp43
-rw-r--r--src/plugins/projectexplorer/deployconfiguration.h9
-rw-r--r--src/plugins/projectexplorer/devicesupport/devicemanager.cpp12
-rw-r--r--src/plugins/projectexplorer/devicesupport/devicemanager.h2
-rw-r--r--src/plugins/projectexplorer/devicesupport/devicemanagermodel.cpp12
-rw-r--r--src/plugins/projectexplorer/devicesupport/devicemanagermodel.h4
-rw-r--r--src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp4
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.cpp94
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.h5
-rw-r--r--src/plugins/projectexplorer/gcctoolchainfactories.h2
-rw-r--r--src/plugins/projectexplorer/miniprojecttargetselector.cpp15
-rw-r--r--src/plugins/projectexplorer/miniprojecttargetselector.h2
-rw-r--r--src/plugins/projectexplorer/msvctoolchain.cpp169
-rw-r--r--src/plugins/projectexplorer/msvctoolchain.h23
-rw-r--r--src/plugins/projectexplorer/profile.cpp307
-rw-r--r--src/plugins/projectexplorer/profile.h109
-rw-r--r--src/plugins/projectexplorer/profileconfigwidget.h (renamed from src/plugins/remotelinux/abstractembeddedlinuxtarget.cpp)46
-rw-r--r--src/plugins/projectexplorer/profileinformation.cpp355
-rw-r--r--src/plugins/projectexplorer/profileinformation.h224
-rw-r--r--src/plugins/projectexplorer/profileinformationconfigwidget.cpp353
-rw-r--r--src/plugins/projectexplorer/profileinformationconfigwidget.h160
-rw-r--r--src/plugins/projectexplorer/profilemanager.cpp471
-rw-r--r--src/plugins/projectexplorer/profilemanager.h171
-rw-r--r--src/plugins/projectexplorer/profilemanagerconfigwidget.cpp132
-rw-r--r--src/plugins/projectexplorer/profilemanagerconfigwidget.h (renamed from src/plugins/remotelinux/genericembeddedlinuxtarget.h)46
-rw-r--r--src/plugins/projectexplorer/profilemodel.cpp521
-rw-r--r--src/plugins/projectexplorer/profilemodel.h124
-rw-r--r--src/plugins/projectexplorer/profileoptionspage.cpp253
-rw-r--r--src/plugins/projectexplorer/profileoptionspage.h104
-rw-r--r--src/plugins/projectexplorer/project.cpp138
-rw-r--r--src/plugins/projectexplorer/project.h28
-rw-r--r--src/plugins/projectexplorer/projectconfiguration.cpp2
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp30
-rw-r--r--src/plugins/projectexplorer/projectexplorer.h1
-rw-r--r--src/plugins/projectexplorer/projectexplorer.pro16
-rw-r--r--src/plugins/projectexplorer/projectexplorer.qbs16
-rw-r--r--src/plugins/projectexplorer/projectexplorerconstants.h1
-rw-r--r--src/plugins/projectexplorer/projectwindow.cpp22
-rw-r--r--src/plugins/projectexplorer/projectwindow.h2
-rw-r--r--src/plugins/projectexplorer/runconfiguration.cpp122
-rw-r--r--src/plugins/projectexplorer/runconfiguration.h12
-rw-r--r--src/plugins/projectexplorer/runconfigurationmodel.cpp3
-rw-r--r--src/plugins/projectexplorer/runsettingspropertiespage.cpp19
-rw-r--r--src/plugins/projectexplorer/settingsaccessor.cpp334
-rw-r--r--src/plugins/projectexplorer/target.cpp354
-rw-r--r--src/plugins/projectexplorer/target.h68
-rw-r--r--src/plugins/projectexplorer/targetselector.cpp6
-rw-r--r--src/plugins/projectexplorer/targetselector.h1
-rw-r--r--src/plugins/projectexplorer/targetsettingspanel.cpp77
-rw-r--r--src/plugins/projectexplorer/targetsettingspanel.h1
-rw-r--r--src/plugins/projectexplorer/targetsettingswidget.cpp6
-rw-r--r--src/plugins/projectexplorer/targetsettingswidget.h1
-rw-r--r--src/plugins/projectexplorer/toolchain.cpp54
-rw-r--r--src/plugins/projectexplorer/toolchain.h12
-rw-r--r--src/plugins/projectexplorer/toolchainconfigwidget.cpp177
-rw-r--r--src/plugins/projectexplorer/toolchainconfigwidget.h19
-rw-r--r--src/plugins/projectexplorer/toolchainmanager.cpp31
-rw-r--r--src/plugins/projectexplorer/toolchainoptionspage.cpp83
-rw-r--r--src/plugins/projectexplorer/toolchainoptionspage.h16
-rw-r--r--src/plugins/projectexplorer/toolchainoptionspage.ui112
-rw-r--r--src/plugins/projectexplorer/wincetoolchain.cpp21
-rw-r--r--src/plugins/projectexplorer/wincetoolchain.h3
-rw-r--r--src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp27
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.cpp21
-rw-r--r--src/plugins/qmlprojectmanager/qmlproject.cpp38
-rw-r--r--src/plugins/qmlprojectmanager/qmlproject.h13
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectmanager.pro2
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectmanager.qbs2
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectmanagerconstants.h2
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectplugin.cpp2
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp121
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h18
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.cpp30
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.h3
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.cpp75
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.h4
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojecttarget.cpp158
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojecttarget.h89
-rw-r--r--src/plugins/qt4projectmanager/buildconfigurationinfo.h35
-rw-r--r--src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.cpp29
-rw-r--r--src/plugins/qt4projectmanager/externaleditors.cpp13
-rw-r--r--src/plugins/qt4projectmanager/makestep.cpp109
-rw-r--r--src/plugins/qt4projectmanager/makestep.h4
-rw-r--r--src/plugins/qt4projectmanager/qmakeprofileconfigwidget.cpp89
-rw-r--r--src/plugins/qt4projectmanager/qmakeprofileconfigwidget.h (renamed from src/plugins/qt4projectmanager/qt-desktop/qt4simulatortarget.h)39
-rw-r--r--src/plugins/qt4projectmanager/qmakeprofileinformation.cpp123
-rw-r--r--src/plugins/qt4projectmanager/qmakeprofileinformation.h67
-rw-r--r--src/plugins/qt4projectmanager/qmakerunconfigurationfactory.cpp73
-rw-r--r--src/plugins/qt4projectmanager/qmakerunconfigurationfactory.h (renamed from src/plugins/qt4projectmanager/qt-s60/qt4symbiantarget.h)43
-rw-r--r--src/plugins/qt4projectmanager/qmakestep.cpp102
-rw-r--r--src/plugins/qt4projectmanager/qmakestep.h2
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp23
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.h3
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/qt-desktop.pri8
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/qt4desktoptarget.cpp110
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp116
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.h71
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp161
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.h32
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/qt4simulatortarget.cpp106
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp173
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.h69
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.cpp10
-rw-r--r--src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.h3
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp3
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp2
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/qt-s60.pri4
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/qt4symbiantarget.cpp130
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp223
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.h77
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp42
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.h6
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.cpp44
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.h2
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.cpp88
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h4
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp26
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60deploystep.h2
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp4
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp139
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h24
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60manager.cpp6
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60manager.h3
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60publisherovi.cpp19
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60publishingbuildsettingspageovi.cpp10
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.cpp7
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.h11
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60runcontrolbase.cpp15
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60runcontrolfactory.cpp2
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/symbianqtversion.cpp105
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/symbianqtversion.h19
-rw-r--r--src/plugins/qt4projectmanager/qt4basetargetfactory.h106
-rw-r--r--src/plugins/qt4projectmanager/qt4buildconfiguration.cpp500
-rw-r--r--src/plugins/qt4projectmanager/qt4buildconfiguration.h77
-rw-r--r--src/plugins/qt4projectmanager/qt4nodes.cpp30
-rw-r--r--src/plugins/qt4projectmanager/qt4project.cpp300
-rw-r--r--src/plugins/qt4projectmanager/qt4project.h53
-rw-r--r--src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp476
-rw-r--r--src/plugins/qt4projectmanager/qt4projectconfigwidget.h16
-rw-r--r--src/plugins/qt4projectmanager/qt4projectconfigwidget.ui130
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanager.cpp88
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanager.h27
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanager.pro17
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanager.qbs32
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanagerconstants.h13
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp24
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanagerplugin.h12
-rw-r--r--src/plugins/qt4projectmanager/qt4target.cpp1493
-rw-r--r--src/plugins/qt4projectmanager/qt4target.h225
-rw-r--r--src/plugins/qt4projectmanager/qt4targetsetupwidget.cpp358
-rw-r--r--src/plugins/qt4projectmanager/qt4targetsetupwidget.h70
-rw-r--r--src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp34
-rw-r--r--src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp50
-rw-r--r--src/plugins/qt4projectmanager/unconfiguredprojectpanel.h3
-rw-r--r--src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.h77
-rw-r--r--src/plugins/qt4projectmanager/winceqtversion.cpp10
-rw-r--r--src/plugins/qt4projectmanager/winceqtversion.h3
-rw-r--r--src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp67
-rw-r--r--src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.h5
-rw-r--r--src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp16
-rw-r--r--src/plugins/qt4projectmanager/wizards/importwidget.cpp93
-rw-r--r--src/plugins/qt4projectmanager/wizards/importwidget.h (renamed from src/plugins/qt4projectmanager/qt-desktop/qt4desktoptarget.h)35
-rw-r--r--src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp4
-rw-r--r--src/plugins/qt4projectmanager/wizards/qtwizard.cpp38
-rw-r--r--src/plugins/qt4projectmanager/wizards/qtwizard.h9
-rw-r--r--src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp598
-rw-r--r--src/plugins/qt4projectmanager/wizards/targetsetuppage.h91
-rw-r--r--src/plugins/qt4projectmanager/wizards/targetsetuppage.ui59
-rw-r--r--src/plugins/qtsupport/baseqtversion.cpp65
-rw-r--r--src/plugins/qtsupport/baseqtversion.h17
-rw-r--r--src/plugins/qtsupport/customexecutablerunconfiguration.cpp21
-rw-r--r--src/plugins/qtsupport/customexecutablerunconfiguration.h2
-rw-r--r--src/plugins/qtsupport/debugginghelperbuildtask.cpp2
-rw-r--r--src/plugins/qtsupport/qtprofileconfigwidget.cpp173
-rw-r--r--src/plugins/qtsupport/qtprofileconfigwidget.h79
-rw-r--r--src/plugins/qtsupport/qtprofileinformation.cpp179
-rw-r--r--src/plugins/qtsupport/qtprofileinformation.h112
-rw-r--r--src/plugins/qtsupport/qtsupport.pro4
-rw-r--r--src/plugins/qtsupport/qtsupport.qbs4
-rw-r--r--src/plugins/qtsupport/qtsupportconstants.h9
-rw-r--r--src/plugins/qtsupport/qtsupportplugin.cpp3
-rw-r--r--src/plugins/qtsupport/qtsupportplugin.h1
-rw-r--r--src/plugins/qtsupport/qtversionmanager.cpp57
-rw-r--r--src/plugins/qtsupport/qtversionmanager.h11
-rw-r--r--src/plugins/qtsupport/qtversionmanager.ui148
-rw-r--r--src/plugins/remotelinux/abstractembeddedlinuxtarget.h77
-rw-r--r--src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp21
-rw-r--r--src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp6
-rw-r--r--src/plugins/remotelinux/deploymentinfo.cpp31
-rw-r--r--src/plugins/remotelinux/deploymentinfo.h9
-rw-r--r--src/plugins/remotelinux/deploymentsettingsassistant.cpp61
-rw-r--r--src/plugins/remotelinux/deploymentsettingsassistant.h18
-rw-r--r--src/plugins/remotelinux/embeddedlinuxqtversion.cpp10
-rw-r--r--src/plugins/remotelinux/embeddedlinuxqtversion.h3
-rw-r--r--src/plugins/remotelinux/embeddedlinuxtargetfactory.cpp176
-rw-r--r--src/plugins/remotelinux/embeddedlinuxtargetfactory.h71
-rw-r--r--src/plugins/remotelinux/genericembeddedlinuxtarget.cpp109
-rw-r--r--src/plugins/remotelinux/genericremotelinuxdeploystepfactory.cpp7
-rw-r--r--src/plugins/remotelinux/linuxdeviceconfiguration.cpp4
-rw-r--r--src/plugins/remotelinux/remotelinux.pro6
-rw-r--r--src/plugins/remotelinux/remotelinux.qbs6
-rw-r--r--src/plugins/remotelinux/remotelinux_constants.h1
-rw-r--r--src/plugins/remotelinux/remotelinuxapplicationrunner.cpp11
-rw-r--r--src/plugins/remotelinux/remotelinuxdebugsupport.cpp29
-rw-r--r--src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp100
-rw-r--r--src/plugins/remotelinux/remotelinuxdeployconfiguration.h29
-rw-r--r--src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp23
-rw-r--r--src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp37
-rw-r--r--src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h3
-rw-r--r--src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui39
-rw-r--r--src/plugins/remotelinux/remotelinuxenvironmentreader.cpp8
-rw-r--r--src/plugins/remotelinux/remotelinuxenvironmentreader.h5
-rw-r--r--src/plugins/remotelinux/remotelinuxplugin.cpp2
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfiguration.cpp68
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfiguration.h15
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp74
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h9
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp40
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h2
-rw-r--r--src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp18
-rw-r--r--src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.cpp32
-rw-r--r--src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.h8
-rw-r--r--src/plugins/valgrind/valgrindtool.cpp4
379 files changed, 12568 insertions, 14315 deletions
diff --git a/src/libs/utils/detailsbutton.cpp b/src/libs/utils/detailsbutton.cpp
index 15cabc42fd..4bdeeec231 100644
--- a/src/libs/utils/detailsbutton.cpp
+++ b/src/libs/utils/detailsbutton.cpp
@@ -41,6 +41,39 @@
using namespace Utils;
+FadingWidget::FadingWidget(QWidget *parent) :
+ FadingPanel(parent),
+ m_opacityEffect(new QGraphicsOpacityEffect)
+{
+ m_opacityEffect->setOpacity(0);
+ setGraphicsEffect(m_opacityEffect);
+
+ // Workaround for issue with QGraphicsEffect. GraphicsEffect
+ // currently clears with Window color. Remove if flickering
+ // no longer occurs on fade-in
+ QPalette pal;
+ pal.setBrush(QPalette::All, QPalette::Window, Qt::transparent);
+ setPalette(pal);
+}
+
+void FadingWidget::setOpacity(qreal value)
+{
+ m_opacityEffect->setOpacity(value);
+}
+
+void FadingWidget::fadeTo(qreal value)
+{
+ QPropertyAnimation *animation = new QPropertyAnimation(m_opacityEffect, "opacity");
+ animation->setDuration(200);
+ animation->setEndValue(value);
+ animation->start(QAbstractAnimation::DeleteWhenStopped);
+}
+
+qreal FadingWidget::opacity()
+{
+ return m_opacityEffect->opacity();
+}
+
DetailsButton::DetailsButton(QWidget *parent) : QAbstractButton(parent), m_fader(0)
{
setCheckable(true);
diff --git a/src/libs/utils/detailsbutton.h b/src/libs/utils/detailsbutton.h
index 428bec5c8d..d58d718ad6 100644
--- a/src/libs/utils/detailsbutton.h
+++ b/src/libs/utils/detailsbutton.h
@@ -38,11 +38,15 @@
#include <QAbstractButton>
#include <QPixmap>
+#include <QGraphicsOpacityEffect>
+
QT_FORWARD_DECLARE_CLASS(QGraphicsOpacityEffect)
namespace Utils {
class QTCREATOR_UTILS_EXPORT FadingPanel : public QWidget
{
+ Q_OBJECT
+
public:
FadingPanel(QWidget *parent = 0)
: QWidget(parent)
@@ -51,6 +55,18 @@ public:
virtual void setOpacity(qreal value) = 0;
};
+class QTCREATOR_UTILS_EXPORT FadingWidget : public FadingPanel
+{
+ Q_OBJECT
+public:
+ FadingWidget(QWidget *parent = 0);
+ void fadeTo(qreal value);
+ qreal opacity();
+ void setOpacity(qreal value);
+protected:
+ QGraphicsOpacityEffect *m_opacityEffect;
+};
+
class QTCREATOR_UTILS_EXPORT DetailsButton : public QAbstractButton
{
Q_OBJECT
diff --git a/src/libs/utils/persistentsettings.cpp b/src/libs/utils/persistentsettings.cpp
index 3c8da84510..6a9fdfddd8 100644
--- a/src/libs/utils/persistentsettings.cpp
+++ b/src/libs/utils/persistentsettings.cpp
@@ -340,9 +340,9 @@ PersistentSettingsWriter::PersistentSettingsWriter()
static void writeVariantValue(QXmlStreamWriter &w, const Context &ctx,
const QVariant &variant, const QString &key = QString())
{
- switch (variant.type()) {
- case QVariant::StringList:
- case QVariant::List:
+ switch (static_cast<int>(variant.type())) {
+ case static_cast<int>(QVariant::StringList):
+ case static_cast<int>(QVariant::List):
w.writeStartElement(ctx.valueListElement);
w.writeAttribute(ctx.typeAttribute, QLatin1String(QVariant::typeToName(QVariant::List)));
if (!key.isEmpty())
@@ -351,7 +351,7 @@ static void writeVariantValue(QXmlStreamWriter &w, const Context &ctx,
writeVariantValue(w, ctx, var);
w.writeEndElement();
break;
- case QVariant::Map: {
+ case static_cast<int>(QVariant::Map): {
w.writeStartElement(ctx.valueMapElement);
w.writeAttribute(ctx.typeAttribute, QLatin1String(QVariant::typeToName(QVariant::Map)));
if (!key.isEmpty())
@@ -363,6 +363,9 @@ static void writeVariantValue(QXmlStreamWriter &w, const Context &ctx,
w.writeEndElement();
}
break;
+ case static_cast<int>(QMetaType::QObjectStar): // ignore QObjects!
+ case static_cast<int>(QMetaType::VoidStar): // ignore void pointers!
+ break;
default:
w.writeStartElement(ctx.valueElement);
w.writeAttribute(ctx.typeAttribute, QLatin1String(variant.typeName()));
diff --git a/src/plugins/android/android.pro b/src/plugins/android/android.pro
index c841fdbae0..2ebfd680bd 100644
--- a/src/plugins/android/android.pro
+++ b/src/plugins/android/android.pro
@@ -12,6 +12,7 @@ QT += xml network
HEADERS += \
androidconstants.h \
androidconfigurations.h \
+ androidmanager.h \
androidrunconfiguration.h \
androidruncontrol.h \
androidrunfactories.h \
@@ -32,14 +33,13 @@ HEADERS += \
androidqtversionfactory.h \
androidqtversion.h \
androiddeployconfiguration.h \
- androidtarget.h \
- androidtargetfactory.h \
androidcreatekeystorecertificate.h \
javaparser.h \
androidplugin.h
SOURCES += \
androidconfigurations.cpp \
+ androidmanager.cpp \
androidrunconfiguration.cpp \
androidruncontrol.cpp \
androidrunfactories.cpp \
@@ -59,8 +59,6 @@ SOURCES += \
androidqtversionfactory.cpp \
androidqtversion.cpp \
androiddeployconfiguration.cpp \
- androidtarget.cpp \
- androidtargetfactory.cpp \
androidcreatekeystorecertificate.cpp \
javaparser.cpp \
androidplugin.cpp
diff --git a/src/plugins/android/android.qbs b/src/plugins/android/android.qbs
index f4b43ad719..397648e792 100644
--- a/src/plugins/android/android.qbs
+++ b/src/plugins/android/android.qbs
@@ -42,6 +42,8 @@ QtcPlugin {
"androiddeploystepwidget.h",
"androiddeploystepwidget.ui",
"androidglobal.h",
+ "androidmanager.h",
+ "androidmanager.cpp",
"androidpackagecreationfactory.cpp",
"androidpackagecreationfactory.h",
"androidpackagecreationstep.cpp",
@@ -73,10 +75,6 @@ QtcPlugin {
"androidsettingswidget.cpp",
"androidsettingswidget.h",
"androidsettingswidget.ui",
- "androidtarget.cpp",
- "androidtargetfactory.cpp",
- "androidtargetfactory.h",
- "androidtarget.h",
"androidtoolchain.cpp",
"androidtoolchain.h",
"javaparser.cpp",
diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp
index 88ee1144bf..1873728735 100644
--- a/src/plugins/android/androidconfigurations.cpp
+++ b/src/plugins/android/androidconfigurations.cpp
@@ -124,16 +124,16 @@ QLatin1String AndroidConfigurations::toolsPrefix(ProjectExplorer::Abi::Architect
AndroidConfig::AndroidConfig(const QSettings &settings)
{
// user settings
- armGdbLocation = settings.value(ArmGdbLocationKey).toString();
- armGdbserverLocation = settings.value(ArmGdbserverLocationKey).toString();
- x86GdbLocation = settings.value(X86GdbLocationKey).toString();
- x86GdbserverLocation = settings.value(X86GdbserverLocationKey).toString();
+ armGdbLocation = Utils::FileName::fromString(settings.value(ArmGdbLocationKey).toString());
+ armGdbserverLocation = Utils::FileName::fromString(settings.value(ArmGdbserverLocationKey).toString());
+ x86GdbLocation = Utils::FileName::fromString(settings.value(X86GdbLocationKey).toString());
+ x86GdbserverLocation = Utils::FileName::fromString(settings.value(X86GdbserverLocationKey).toString());
partitionSize = settings.value(PartitionSizeKey, 1024).toInt();
- sdkLocation = settings.value(SDKLocationKey).toString();
- ndkLocation = settings.value(NDKLocationKey).toString();
- antLocation = settings.value(AntLocationKey).toString();
- openJDKLocation = settings.value(OpenJDKLocationKey).toString();
- keystoreLocation = settings.value(KeystoreLocationKey).toString();
+ sdkLocation = Utils::FileName::fromString(settings.value(SDKLocationKey).toString());
+ ndkLocation = Utils::FileName::fromString(settings.value(NDKLocationKey).toString());
+ antLocation = Utils::FileName::fromString(settings.value(AntLocationKey).toString());
+ openJDKLocation = Utils::FileName::fromString(settings.value(OpenJDKLocationKey).toString());
+ keystoreLocation = Utils::FileName::fromString(settings.value(KeystoreLocationKey).toString());
QRegExp versionRegExp(NDKGccVersionRegExp);
const QString &value = settings.value(NDKToolchainVersionKey).toString();
@@ -147,11 +147,11 @@ AndroidConfig::AndroidConfig(const QSettings &settings)
if (reader.load(settingsFileName())
&& settings.value(changeTimeStamp).toInt() != QFileInfo(settingsFileName()).lastModified().toMSecsSinceEpoch() / 1000) {
// persisten settings
- sdkLocation = reader.restoreValue(SDKLocationKey).toString();
- ndkLocation = reader.restoreValue(NDKLocationKey).toString();
- antLocation = reader.restoreValue(AntLocationKey).toString();
- openJDKLocation = reader.restoreValue(OpenJDKLocationKey).toString();
- keystoreLocation = reader.restoreValue(KeystoreLocationKey).toString();
+ sdkLocation = Utils::FileName::fromString(reader.restoreValue(SDKLocationKey).toString());
+ ndkLocation = Utils::FileName::fromString(reader.restoreValue(NDKLocationKey).toString());
+ antLocation = Utils::FileName::fromString(reader.restoreValue(AntLocationKey).toString());
+ openJDKLocation = Utils::FileName::fromString(reader.restoreValue(OpenJDKLocationKey).toString());
+ keystoreLocation = Utils::FileName::fromString(reader.restoreValue(KeystoreLocationKey).toString());
QRegExp versionRegExp(NDKGccVersionRegExp);
const QString &value = reader.restoreValue(NDKToolchainVersionKey).toString();
@@ -160,17 +160,17 @@ AndroidConfig::AndroidConfig(const QSettings &settings)
else
ndkToolchainVersion = value.mid(versionRegExp.indexIn(value));
- if (!armGdbLocation.length())
- armGdbLocation = reader.restoreValue(ArmGdbLocationKey).toString();
+ if (armGdbLocation.isEmpty())
+ armGdbLocation = Utils::FileName::fromString(reader.restoreValue(ArmGdbLocationKey).toString());
- if (!armGdbserverLocation.length())
- armGdbserverLocation = reader.restoreValue(ArmGdbserverLocationKey).toString();
+ if (armGdbserverLocation.isEmpty())
+ armGdbserverLocation = Utils::FileName::fromString(reader.restoreValue(ArmGdbserverLocationKey).toString());
- if (!x86GdbLocation.length())
- x86GdbLocation = reader.restoreValue(X86GdbLocationKey).toString();
+ if (x86GdbLocation.isEmpty())
+ x86GdbLocation = Utils::FileName::fromString(reader.restoreValue(X86GdbLocationKey).toString());
- if (!x86GdbserverLocation.length())
- x86GdbserverLocation = reader.restoreValue(X86GdbserverLocationKey).toString();
+ if (x86GdbserverLocation.isEmpty())
+ x86GdbserverLocation = Utils::FileName::fromString(reader.restoreValue(X86GdbserverLocationKey).toString());
// persistent settings
}
@@ -188,16 +188,16 @@ void AndroidConfig::save(QSettings &settings) const
settings.setValue(changeTimeStamp, fileInfo.lastModified().toMSecsSinceEpoch() / 1000);
// user settings
- settings.setValue(SDKLocationKey, sdkLocation);
- settings.setValue(NDKLocationKey, ndkLocation);
+ settings.setValue(SDKLocationKey, sdkLocation.toString());
+ settings.setValue(NDKLocationKey, ndkLocation.toString());
settings.setValue(NDKToolchainVersionKey, ndkToolchainVersion);
- settings.setValue(AntLocationKey, antLocation);
- settings.setValue(OpenJDKLocationKey, openJDKLocation);
- settings.setValue(KeystoreLocationKey, keystoreLocation);
- settings.setValue(ArmGdbLocationKey, armGdbLocation);
- settings.setValue(ArmGdbserverLocationKey, armGdbserverLocation);
- settings.setValue(X86GdbLocationKey, x86GdbLocation);
- settings.setValue(X86GdbserverLocationKey, x86GdbserverLocation);
+ settings.setValue(AntLocationKey, antLocation.toString());
+ settings.setValue(OpenJDKLocationKey, openJDKLocation.toString());
+ settings.setValue(KeystoreLocationKey, keystoreLocation.toString());
+ settings.setValue(ArmGdbLocationKey, armGdbLocation.toString());
+ settings.setValue(ArmGdbserverLocationKey, armGdbserverLocation.toString());
+ settings.setValue(X86GdbLocationKey, x86GdbLocation.toString());
+ settings.setValue(X86GdbserverLocationKey, x86GdbserverLocation.toString());
settings.setValue(PartitionSizeKey, partitionSize);
// user settings
@@ -214,7 +214,7 @@ void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs)
void AndroidConfigurations::updateAvailablePlatforms()
{
m_availablePlatforms.clear();
- QDirIterator it(m_config.ndkLocation + QLatin1String("/platforms"), QStringList() << QLatin1String("android-*"), QDir::Dirs);
+ QDirIterator it(m_config.ndkLocation.appendPath(QLatin1String("platforms")).toString(), QStringList() << QLatin1String("android-*"), QDir::Dirs);
while (it.hasNext()) {
const QString &fileName = it.next();
m_availablePlatforms.push_back(fileName.mid(fileName.lastIndexOf(QLatin1Char('-')) + 1).toInt());
@@ -226,7 +226,7 @@ QStringList AndroidConfigurations::sdkTargets(int minApiLevel) const
{
QStringList targets;
QProcess proc;
- proc.start(androidToolPath(), QStringList() << QLatin1String("list") << QLatin1String("target")); // list avaialbe AVDs
+ proc.start(androidToolPath().toString(), QStringList() << QLatin1String("list") << QLatin1String("target")); // list avaialbe AVDs
if (!proc.waitForFinished(-1)) {
proc.terminate();
return targets;
@@ -248,7 +248,8 @@ QStringList AndroidConfigurations::ndkToolchainVersions() const
{
QRegExp versionRegExp(NDKGccVersionRegExp);
QStringList result;
- QDirIterator it(m_config.ndkLocation + QLatin1String("/toolchains"),
+ Utils::FileName path = m_config.ndkLocation;
+ QDirIterator it(path.appendPath(QLatin1String("toolchains")).toString(),
QStringList() << QLatin1String("*"), QDir::Dirs);
while (it.hasNext()) {
const QString &fileName = it.next();
@@ -262,66 +263,71 @@ QStringList AndroidConfigurations::ndkToolchainVersions() const
return result;
}
-QString AndroidConfigurations::adbToolPath() const
+Utils::FileName AndroidConfigurations::adbToolPath() const
{
- return m_config.sdkLocation + QLatin1String("/platform-tools/adb" ANDROID_EXE_SUFFIX);
+ Utils::FileName path = m_config.sdkLocation;
+ return path.appendPath(QLatin1String("platform-tools/adb"ANDROID_EXE_SUFFIX));
}
-QString AndroidConfigurations::androidToolPath() const
+Utils::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.
- QFileInfo fi(m_config.sdkLocation + QLatin1String("/tools/android" ANDROID_EXE_SUFFIX));
- if (fi.exists())
- return m_config.sdkLocation + QString("/tools/android" ANDROID_EXE_SUFFIX);
- else
- return m_config.sdkLocation + QLatin1String("/tools/android" ANDROID_BAT_SUFFIX);
+ Utils::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
- return m_config.sdkLocation + QLatin1String("/tools/android" ANDROID_EXE_SUFFIX);
+ Utils::FileName path = m_config.sdkLocation;
+ return path.appendPath(QLatin1String("tools/android"ANDROID_EXE_SUFFIX));
#endif
}
-QString AndroidConfigurations::antToolPath() const
+Utils::FileName AndroidConfigurations::antToolPath() const
{
- if (m_config.antLocation.length())
+ if (!m_config.antLocation.isEmpty())
return m_config.antLocation;
else
- return QLatin1String("ant");
+ return Utils::FileName::fromString(QLatin1String("ant"));
}
-QString AndroidConfigurations::emulatorToolPath() const
+Utils::FileName AndroidConfigurations::emulatorToolPath() const
{
- return m_config.sdkLocation + QLatin1String("/tools/emulator" ANDROID_EXE_SUFFIX);
+ Utils::FileName path = m_config.sdkLocation;
+ return path.appendPath(QLatin1String("tools/emulator"ANDROID_EXE_SUFFIX));
}
-QString AndroidConfigurations::toolPath(ProjectExplorer::Abi::Architecture architecture) const
+Utils::FileName AndroidConfigurations::toolPath(ProjectExplorer::Abi::Architecture architecture) const
{
- return m_config.ndkLocation + QString::fromLatin1("/toolchains/%1-%2/prebuilt/%3/bin/%4")
+ Utils::FileName path = m_config.ndkLocation;
+ return path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/%3/bin/%4")
.arg(toolchainPrefix(architecture))
.arg(m_config.ndkToolchainVersion)
.arg(ToolchainHost)
- .arg(toolsPrefix(architecture));
+ .arg(toolsPrefix(architecture)));
}
-QString AndroidConfigurations::stripPath(ProjectExplorer::Abi::Architecture architecture) const
+Utils::FileName AndroidConfigurations::stripPath(ProjectExplorer::Abi::Architecture architecture) const
{
- return toolPath(architecture) + QLatin1String("-strip" ANDROID_EXE_SUFFIX);
+ return toolPath(architecture).append(QLatin1String("-strip"ANDROID_EXE_SUFFIX));
}
-QString AndroidConfigurations::readelfPath(ProjectExplorer::Abi::Architecture architecture) const
+Utils::FileName AndroidConfigurations::readelfPath(ProjectExplorer::Abi::Architecture architecture) const
{
- return toolPath(architecture) + QLatin1String("-readelf" ANDROID_EXE_SUFFIX);
+ return toolPath(architecture).append(QLatin1String("-readelf"ANDROID_EXE_SUFFIX));
}
-QString AndroidConfigurations::gccPath(ProjectExplorer::Abi::Architecture architecture) const
+Utils::FileName AndroidConfigurations::gccPath(ProjectExplorer::Abi::Architecture architecture) const
{
- return toolPath(architecture) + QLatin1String("-gcc" ANDROID_EXE_SUFFIX);
+ return toolPath(architecture).append(QLatin1String("-gcc"ANDROID_EXE_SUFFIX));
}
-QString AndroidConfigurations::gdbServerPath(ProjectExplorer::Abi::Architecture architecture) const
+Utils::FileName AndroidConfigurations::gdbServerPath(ProjectExplorer::Abi::Architecture architecture) const
{
- QString gdbServerPath;
+ Utils::FileName gdbServerPath;
switch (architecture) {
case ProjectExplorer::Abi::ArmArchitecture:
gdbServerPath = m_config.armGdbserverLocation;
@@ -330,20 +336,21 @@ QString AndroidConfigurations::gdbServerPath(ProjectExplorer::Abi::Architecture
gdbServerPath = m_config.x86GdbserverLocation;
break;
default:
- gdbServerPath = Unknown;
+ gdbServerPath = Utils::FileName::fromString(Unknown);
break;
}
- if (gdbServerPath.length())
+ if (!gdbServerPath.isEmpty())
return gdbServerPath;
- return m_config.ndkLocation + QString::fromLatin1("/toolchains/%1-%2/prebuilt/gdbserver")
- .arg(toolchainPrefix(architecture))
- .arg(m_config.ndkToolchainVersion);
+ Utils::FileName path = m_config.ndkLocation;
+ return path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/gdbserver")
+ .arg(toolchainPrefix(architecture))
+ .arg(m_config.ndkToolchainVersion));
}
-QString AndroidConfigurations::gdbPath(ProjectExplorer::Abi::Architecture architecture) const
+Utils::FileName AndroidConfigurations::gdbPath(ProjectExplorer::Abi::Architecture architecture) const
{
- QString gdbPath;
+ Utils::FileName gdbPath;
switch (architecture) {
case ProjectExplorer::Abi::ArmArchitecture:
gdbPath = m_config.armGdbLocation;
@@ -352,45 +359,47 @@ QString AndroidConfigurations::gdbPath(ProjectExplorer::Abi::Architecture archit
gdbPath = m_config.x86GdbLocation;
break;
default:
- gdbPath = Unknown;
+ gdbPath = Utils::FileName::fromString(Unknown);
break;
}
if (!gdbPath.isEmpty())
return gdbPath;
- return toolPath(architecture) + QLatin1String("-gdb" ANDROID_EXE_SUFFIX);
+ return toolPath(architecture).append(QLatin1String("-gdb"ANDROID_EXE_SUFFIX));
}
-QString AndroidConfigurations::openJDKPath() const
+Utils::FileName AndroidConfigurations::openJDKPath() const
{
return m_config.openJDKLocation;
}
-QString AndroidConfigurations::openJDKBinPath() const
+Utils::FileName AndroidConfigurations::openJDKBinPath() const
{
- if (m_config.openJDKLocation.length())
- return m_config.openJDKLocation + QLatin1String("/bin/");
- return QString();
+ Utils::FileName path = m_config.openJDKLocation;
+ if (!path.isEmpty())
+ return path.appendPath(QLatin1String("bin"));
+ return path;
}
-QString AndroidConfigurations::keytoolPath() const
+Utils::FileName AndroidConfigurations::keytoolPath() const
{
- return openJDKBinPath() + keytoolName;
+ return openJDKBinPath().appendPath(keytoolName);
}
-QString AndroidConfigurations::jarsignerPath() const
+Utils::FileName AndroidConfigurations::jarsignerPath() const
{
- return openJDKBinPath() + jarsignerName;
+ return openJDKBinPath().appendPath(jarsignerName);
}
QString AndroidConfigurations::getDeployDeviceSerialNumber(int *apiLevel) const
{
QVector<AndroidDevice> devices = connectedDevices();
- foreach (AndroidDevice device, devices)
+ foreach (AndroidDevice device, devices) {
if (device.sdk >= *apiLevel) {
*apiLevel = device.sdk;
return device.serialNumber;
}
+ }
return startAVD(apiLevel);
}
@@ -398,7 +407,7 @@ QVector<AndroidDevice> AndroidConfigurations::connectedDevices(int apiLevel) con
{
QVector<AndroidDevice> devices;
QProcess adbProc;
- adbProc.start(adbToolPath(), QStringList() << QLatin1String("devices"));
+ adbProc.start(adbToolPath().toString(), QStringList() << QLatin1String("devices"));
if (!adbProc.waitForFinished(-1)) {
adbProc.terminate();
return devices;
@@ -443,7 +452,7 @@ bool AndroidConfigurations::createAVD(int minApiLevel) const
bool AndroidConfigurations::createAVD(const QString &target, const QString &name, int sdcardSize ) const
{
QProcess proc;
- proc.start(androidToolPath(),
+ proc.start(androidToolPath().toString(),
QStringList() << QLatin1String("create") << QLatin1String("avd")
<< QLatin1String("-a") << QLatin1String("-t") << target
<< QLatin1String("-n") << name
@@ -461,7 +470,7 @@ bool AndroidConfigurations::createAVD(const QString &target, const QString &name
bool AndroidConfigurations::removeAVD(const QString &name) const
{
QProcess proc;
- proc.start(androidToolPath(),
+ proc.start(androidToolPath().toString(),
QStringList() << QLatin1String("delete") << QLatin1String("avd")
<< QLatin1String("-n") << name);
if (!proc.waitForFinished(-1)) {
@@ -475,7 +484,7 @@ QVector<AndroidDevice> AndroidConfigurations::androidVirtualDevices() const
{
QVector<AndroidDevice> devices;
QProcess proc;
- proc.start(androidToolPath(),
+ proc.start(androidToolPath().toString(),
QStringList() << QLatin1String("list") << QLatin1String("avd")); // list available AVDs
if (!proc.waitForFinished(-1)) {
proc.terminate();
@@ -540,7 +549,7 @@ QString AndroidConfigurations::startAVD(int *apiLevel, const QString &name) cons
return avdName;
// start the emulator
- m_avdProcess->start(emulatorToolPath(),
+ m_avdProcess->start(emulatorToolPath().toString(),
QStringList() << QLatin1String("-partition-size") << QString::number(config().partitionSize)
<< QLatin1String("-avd") << avdName);
if (!m_avdProcess->waitForStarted(-1)) {
@@ -550,7 +559,7 @@ QString AndroidConfigurations::startAVD(int *apiLevel, const QString &name) cons
// wait until the emulator is online
QProcess proc;
- proc.start(adbToolPath(), QStringList() << QLatin1String("-e") << QLatin1String("wait-for-device"));
+ proc.start(adbToolPath().toString(), QStringList() << QLatin1String("-e") << QLatin1String("wait-for-device"));
if (!proc.waitForFinished(-1)) {
proc.terminate();
return QString();
@@ -558,7 +567,7 @@ QString AndroidConfigurations::startAVD(int *apiLevel, const QString &name) cons
sleep(5);// wait for pm to start
// workaround for stupid adb bug
- proc.start(adbToolPath(), QStringList() << QLatin1String("devices"));
+ proc.start(adbToolPath().toString(), QStringList() << QLatin1String("devices"));
if (!proc.waitForFinished(-1)) {
proc.terminate();
return QString();
@@ -577,7 +586,7 @@ int AndroidConfigurations::getSDKVersion(const QString &device) const
{
QProcess adbProc;
- adbProc.start(adbToolPath(),
+ adbProc.start(adbToolPath().toString(),
QStringList() << QLatin1String("-s") << device
<< QLatin1String("shell") << QLatin1String("getprop")
<< QLatin1String("ro.build.version.sdk"));
diff --git a/src/plugins/android/androidconfigurations.h b/src/plugins/android/androidconfigurations.h
index 6fc01f0796..31eedb4573 100644
--- a/src/plugins/android/androidconfigurations.h
+++ b/src/plugins/android/androidconfigurations.h
@@ -67,16 +67,16 @@ public:
AndroidConfig(const QSettings &settings);
void save(QSettings &settings) const;
- QString sdkLocation;
- QString ndkLocation;
+ Utils::FileName sdkLocation;
+ Utils::FileName ndkLocation;
QString ndkToolchainVersion;
- QString antLocation;
- QString armGdbLocation;
- QString armGdbserverLocation;
- QString x86GdbLocation;
- QString x86GdbserverLocation;
- QString openJDKLocation;
- QString keystoreLocation;
+ Utils::FileName antLocation;
+ Utils::FileName armGdbLocation;
+ Utils::FileName armGdbserverLocation;
+ Utils::FileName x86GdbLocation;
+ Utils::FileName x86GdbserverLocation;
+ Utils::FileName openJDKLocation;
+ Utils::FileName keystoreLocation;
unsigned partitionSize;
};
@@ -97,18 +97,18 @@ public:
void setConfig(const AndroidConfig &config);
QStringList sdkTargets(int minApiLevel = 0) const;
QStringList ndkToolchainVersions() const;
- QString adbToolPath() const;
- QString androidToolPath() const;
- QString antToolPath() const;
- QString emulatorToolPath() const;
- QString gccPath(ProjectExplorer::Abi::Architecture architecture) const;
- QString gdbServerPath(ProjectExplorer::Abi::Architecture architecture) const;
- QString gdbPath(ProjectExplorer::Abi::Architecture architecture) const;
- QString openJDKPath() const;
- QString keytoolPath() const;
- QString jarsignerPath() const;
- QString stripPath(ProjectExplorer::Abi::Architecture architecture) const;
- QString readelfPath(ProjectExplorer::Abi::Architecture architecture) const;
+ Utils::FileName adbToolPath() const;
+ Utils::FileName androidToolPath() const;
+ Utils::FileName antToolPath() const;
+ Utils::FileName emulatorToolPath() const;
+ Utils::FileName gccPath(ProjectExplorer::Abi::Architecture architecture) const;
+ Utils::FileName gdbServerPath(ProjectExplorer::Abi::Architecture architecture) const;
+ Utils::FileName gdbPath(ProjectExplorer::Abi::Architecture architecture) const;
+ Utils::FileName openJDKPath() const;
+ Utils::FileName keytoolPath() const;
+ Utils::FileName jarsignerPath() const;
+ Utils::FileName stripPath(ProjectExplorer::Abi::Architecture architecture) const;
+ Utils::FileName readelfPath(ProjectExplorer::Abi::Architecture architecture) const;
QString getDeployDeviceSerialNumber(int *apiLevel) const;
bool createAVD(const QString &target, const QString &name, int sdcardSize) const;
bool removeAVD(const QString &name) const;
@@ -127,8 +127,8 @@ public slots:
bool createAVD(int minApiLevel = 0) const;
private:
- QString toolPath(ProjectExplorer::Abi::Architecture architecture) const;
- QString openJDKBinPath() const;
+ Utils::FileName toolPath(ProjectExplorer::Abi::Architecture architecture) const;
+ Utils::FileName openJDKBinPath() const;
AndroidConfigurations(QObject *parent);
void load();
diff --git a/src/plugins/android/androidconstants.h b/src/plugins/android/androidconstants.h
index c7a0b9ae89..ab31c92b08 100644
--- a/src/plugins/android/androidconstants.h
+++ b/src/plugins/android/androidconstants.h
@@ -56,18 +56,8 @@ enum AndroidQemuStatus {
#define ANDROID_BAT_SUFFIX ""
#endif
-static const char ANDROID_RC_ID[] = ANDROID_PREFIX;
static const QLatin1String ANDROID_RC_ID_PREFIX(ANDROID_PREFIX ".");
-static const QLatin1String AndroidArgumentsKey(ANDROID_PREFIX ".Arguments");
-static const QLatin1String AndroidSimulatorPathKey(ANDROID_PREFIX ".Simulator");
-static const QLatin1String AndroidDeviceIdKey(ANDROID_PREFIX ".DeviceId");
-static const QLatin1String AndroidProFileKey(ANDROID_PREFIX ".ProFile");
-static const QLatin1String AndroidExportedLocalDirsKey(ANDROID_PREFIX ".ExportedLocalDirs");
-static const QLatin1String AndroidBaseEnvironmentBaseKey(ANDROID_PREFIX ".BaseEnvironmentBase");
-static const QLatin1String AndroidUserEnvironmentChangesKey(ANDROID_PREFIX ".UserEnvironmentChanges");
-static const QLatin1String AndroidUseRemoteGdbKey(ANDROID_PREFIX ".UseRemoteGdb");
-
} // namespace Internal
namespace Constants {
@@ -77,8 +67,6 @@ const char ANDROID_SETTINGS_TR_CATEGORY[] = QT_TRANSLATE_NOOP("Android", "Androi
const char ANDROID_SETTINGS_CATEGORY_ICON[] = ":/android/images/QtAndroid.png";
const char ANDROID_TOOLCHAIN_ID[] = "Qt4ProjectManager.ToolChain.Android";
const char ANDROIDQT[] = "Qt4ProjectManager.QtVersion.Android";
-const char ANDROID_PLATFORM[] = "Android";
-const char ANDROID_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Android");
}
} // namespace Android
diff --git a/src/plugins/android/androidcreatekeystorecertificate.cpp b/src/plugins/android/androidcreatekeystorecertificate.cpp
index 8a326c3b59..a542f7f4d0 100644
--- a/src/plugins/android/androidcreatekeystorecertificate.cpp
+++ b/src/plugins/android/androidcreatekeystorecertificate.cpp
@@ -56,7 +56,7 @@ AndroidCreateKeystoreCertificate::~AndroidCreateKeystoreCertificate()
delete ui;
}
-QString AndroidCreateKeystoreCertificate::keystoreFilePath()
+Utils::FileName AndroidCreateKeystoreCertificate::keystoreFilePath()
{
return m_keystoreFilePath;
}
@@ -155,10 +155,10 @@ void AndroidCreateKeystoreCertificate::on_buttonBox_accepted()
if (!ui->countryLineEdit->text().length())
ui->countryLineEdit->setFocus();
- m_keystoreFilePath = QFileDialog::getSaveFileName(this, tr("Keystore file name"),
- QDir::homePath() + QLatin1String("/android_release.keystore"),
- tr("Keystore files (*.keystore *.jks)"));
- if (!m_keystoreFilePath.length())
+ m_keystoreFilePath = Utils::FileName::fromString(QFileDialog::getSaveFileName(this, tr("Keystore file name"),
+ QDir::homePath() + QLatin1String("/android_release.keystore"),
+ tr("Keystore files (*.keystore *.jks)")));
+ if (m_keystoreFilePath.isEmpty())
return;
QString distinguishedNames(QString::fromLatin1("CN=%1, O=%2, L=%3, C=%4")
.arg(ui->commonNameLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,")))
@@ -174,7 +174,7 @@ void AndroidCreateKeystoreCertificate::on_buttonBox_accepted()
QStringList params;
params << QLatin1String("-genkey") << QLatin1String("-keyalg") << QLatin1String("RSA")
- << QLatin1String("-keystore") << m_keystoreFilePath
+ << QLatin1String("-keystore") << m_keystoreFilePath.toString()
<< QLatin1String("-storepass") << ui->keystorePassLineEdit->text()
<< QLatin1String("-alias") << ui->aliasNameLineEdit->text()
<< QLatin1String("-keysize") << ui->keySizeSpinBox->text()
@@ -183,7 +183,7 @@ void AndroidCreateKeystoreCertificate::on_buttonBox_accepted()
<< QLatin1String("-dname") << distinguishedNames;
QProcess genKeyCertProc;
- genKeyCertProc.start(AndroidConfigurations::instance().keytoolPath(), params );
+ genKeyCertProc.start(AndroidConfigurations::instance().keytoolPath().toString(), params );
if (!genKeyCertProc.waitForStarted() || !genKeyCertProc.waitForFinished())
return;
diff --git a/src/plugins/android/androidcreatekeystorecertificate.h b/src/plugins/android/androidcreatekeystorecertificate.h
index 9bc89a6916..2a3edb9093 100644
--- a/src/plugins/android/androidcreatekeystorecertificate.h
+++ b/src/plugins/android/androidcreatekeystorecertificate.h
@@ -33,6 +33,8 @@
#ifndef ANDROIDCREATEKEYSTORECERTIFICATE_H
#define ANDROIDCREATEKEYSTORECERTIFICATE_H
+#include <utils/fileutils.h>
+
#include <QDialog>
QT_BEGIN_NAMESPACE
@@ -54,7 +56,7 @@ class AndroidCreateKeystoreCertificate : public QDialog
public:
explicit AndroidCreateKeystoreCertificate(QWidget *parent = 0);
~AndroidCreateKeystoreCertificate();
- QString keystoreFilePath();
+ Utils::FileName keystoreFilePath();
QString keystorePassword();
QString certificateAlias();
QString certificatePassword();
@@ -68,7 +70,7 @@ private slots:
private:
Ui::AndroidCreateKeystoreCertificate *ui;
- QString m_keystoreFilePath;
+ Utils::FileName m_keystoreFilePath;
};
} // namespace Internal
diff --git a/src/plugins/android/androiddebugsupport.cpp b/src/plugins/android/androiddebugsupport.cpp
index 704ce67c6b..5eb5150f34 100644
--- a/src/plugins/android/androiddebugsupport.cpp
+++ b/src/plugins/android/androiddebugsupport.cpp
@@ -35,17 +35,18 @@
#include "androiddeploystep.h"
#include "androidglobal.h"
#include "androidrunner.h"
-#include "androidtarget.h"
+#include "androidmanager.h"
#include <debugger/debuggerplugin.h>
#include <debugger/debuggerrunner.h>
#include <debugger/debuggerengine.h>
#include <debugger/debuggerstartparameters.h>
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
-#include <qt4projectmanager/qt4target.h>
-#include <qt4projectmanager/qt4project.h>
#include <qt4projectmanager/qt4nodes.h>
+#include <qt4projectmanager/qt4project.h>
+#include <qtsupport/qtprofileinformation.h>
#include <QDir>
@@ -62,6 +63,8 @@ static const char * const qMakeVariables[] = {
"QT_INSTALL_IMPORTS"
};
+static Qt4Project *project(AndroidRunConfiguration *rc)
+{ return static_cast<Qt4Project *>(rc->target()->project()); }
RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *runConfig)
{
@@ -69,19 +72,20 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
params.toolChainAbi = runConfig->abi();
params.dumperLibrary = runConfig->dumperLib();
params.startMode = AttachToRemoteServer;
- params.executable = runConfig->androidTarget()->qt4Project()->rootQt4ProjectNode()->buildDir() + QLatin1String("/app_process");
- params.debuggerCommand = runConfig->gdbCmd();
+ params.executable = project(runConfig)->rootQt4ProjectNode()->buildDir() + QLatin1String("/app_process");
+ params.debuggerCommand = runConfig->gdbCmd().toString();
params.remoteChannel = runConfig->remoteChannel();
- params.displayName = runConfig->androidTarget()->packageName();
+ params.displayName = AndroidManager::packageName(runConfig->target());
params.solibSearchPath.clear();
- QList<Qt4ProFileNode *> nodes = runConfig->androidTarget()->qt4Project()->allProFiles();
+ QList<Qt4ProFileNode *> nodes = project(runConfig)->allProFiles();
foreach (Qt4ProFileNode *node, nodes)
if (node->projectType() == ApplicationTemplate)
params.solibSearchPath.append(node->targetInformation().buildDir);
- params.solibSearchPath.append(qtSoPaths(runConfig->activeQt4BuildConfiguration()->qtVersion()));
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(runConfig->target()->profile());
+ params.solibSearchPath.append(qtSoPaths(version));
params.useServerStartScript = true;
params.remoteSetupNeeded = true;
@@ -148,6 +152,9 @@ void AndroidDebugSupport::handleRemoteErrorOutput(const QByteArray &output)
QStringList AndroidDebugSupport::qtSoPaths(QtSupport::BaseQtVersion *qtVersion)
{
+ if (!qtVersion)
+ return QStringList();
+
QSet<QString> paths;
for (uint i = 0; i < sizeof qMakeVariables / sizeof qMakeVariables[0]; ++i) {
if (!qtVersion->versionInfo().contains(QLatin1String(qMakeVariables[i])))
diff --git a/src/plugins/android/androiddeployconfiguration.cpp b/src/plugins/android/androiddeployconfiguration.cpp
index 0efd9a46c0..c07219b793 100644
--- a/src/plugins/android/androiddeployconfiguration.cpp
+++ b/src/plugins/android/androiddeployconfiguration.cpp
@@ -34,13 +34,14 @@
#include "androidpackageinstallationstep.h"
#include "androidpackagecreationstep.h"
#include "androiddeployconfiguration.h"
-#include "androidtarget.h"
+#include "androidmanager.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/target.h>
-#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qt4projectmanager/qt4project.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
using namespace Android::Internal;
@@ -64,15 +65,11 @@ AndroidDeployConfiguration::AndroidDeployConfiguration(ProjectExplorer::Target *
AndroidDeployConfigurationFactory::AndroidDeployConfigurationFactory(QObject *parent) :
ProjectExplorer::DeployConfigurationFactory(parent)
-{ }
+{ setObjectName(QLatin1String("AndroidDeployConfigurationFactory"));}
bool AndroidDeployConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
{
- AndroidTarget *t = qobject_cast<AndroidTarget *>(parent);
- if (!t || t->id() != Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)
- || !id.toString().startsWith(QLatin1String(ANDROID_DEPLOYCONFIGURATION_ID)))
- return false;
- return true;
+ return availableCreationIds(parent).contains(id);
}
ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
@@ -96,8 +93,7 @@ ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::restore
{
if (!canRestore(parent, map))
return 0;
- AndroidTarget *t = static_cast<AndroidTarget *>(parent);
- AndroidDeployConfiguration *dc = new AndroidDeployConfiguration(t);
+ AndroidDeployConfiguration *dc = new AndroidDeployConfiguration(parent);
if (dc->fromMap(map))
return dc;
@@ -107,7 +103,7 @@ ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::restore
bool AndroidDeployConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *source) const
{
- if (!qobject_cast<AndroidTarget *>(parent))
+ if (!AndroidManager::supportsAndroid(parent))
return false;
return source->id() == Core::Id(ANDROID_DEPLOYCONFIGURATION_ID);
}
@@ -116,24 +112,24 @@ ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::clone(P
{
if (!canClone(parent, source))
return 0;
- AndroidTarget *t = static_cast<AndroidTarget *>(parent);
- return new AndroidDeployConfiguration(t, source);
+ return new AndroidDeployConfiguration(parent, source);
}
QList<Core::Id> AndroidDeployConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
{
- AndroidTarget *target = qobject_cast<AndroidTarget *>(parent);
- if (!target ||
- target->id() != Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID))
+ if (!AndroidManager::supportsAndroid(parent))
return QList<Core::Id>();
QList<Core::Id> result;
- foreach (const QString &id, target->qt4Project()->applicationProFilePathes(QLatin1String(ANDROID_DC_PREFIX)))
+ Qt4ProjectManager::Qt4Project *project = static_cast<Qt4ProjectManager::Qt4Project *>(parent->project());
+ foreach (const QString &id, project->applicationProFilePathes(QLatin1String(ANDROID_DC_PREFIX)))
result << Core::Id(id.toUtf8().constData());
return result;
}
-QString AndroidDeployConfigurationFactory::displayNameForId(const Core::Id/*id*/) const
+QString AndroidDeployConfigurationFactory::displayNameForId(const Core::Id id) const
{
- return tr("Deploy on Android");
+ if (id.toString().startsWith(ANDROID_DC_PREFIX))
+ return tr("Deploy on Android");
+ return QString();
}
diff --git a/src/plugins/android/androiddeployconfiguration.h b/src/plugins/android/androiddeployconfiguration.h
index 5a08c4f8ee..546470076c 100644
--- a/src/plugins/android/androiddeployconfiguration.h
+++ b/src/plugins/android/androiddeployconfiguration.h
@@ -72,7 +72,6 @@ public:
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
// used to translate the ids to names to display to the user
QString displayNameForId(const Core::Id id) const;
-
};
} // namespace Internal
diff --git a/src/plugins/android/androiddeploystep.cpp b/src/plugins/android/androiddeploystep.cpp
index 57b6d9d1c8..3cbd1cbea3 100644
--- a/src/plugins/android/androiddeploystep.cpp
+++ b/src/plugins/android/androiddeploystep.cpp
@@ -37,16 +37,16 @@
#include "androidglobal.h"
#include "androidpackagecreationstep.h"
#include "androidrunconfiguration.h"
-#include "androidtarget.h"
+#include "androidmanager.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
+#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4project.h>
-#include <qt4projectmanager/qt4target.h>
#include <qt4projectmanager/qt4nodes.h>
-#include <qt4projectmanager/qt4buildconfiguration.h>
+#include <qtsupport/qtprofileinformation.h>
#include <QDir>
@@ -85,14 +85,8 @@ void AndroidDeployStep::ctor()
bool AndroidDeployStep::init()
{
- AndroidTarget *androidTarget = qobject_cast<AndroidTarget *>(target());
- if (!androidTarget) {
- raiseError(tr("Cannot deploy: current target is not android."));
- return false;
- }
- const Qt4BuildConfiguration *const bc = androidTarget->activeQt4BuildConfiguration();
- m_packageName = androidTarget->packageName();
- const QString targetSDK = androidTarget->targetSDK();
+ m_packageName = AndroidManager::packageName(target());
+ const QString targetSDK = AndroidManager::targetSDK(target());
writeOutput(tr("Please wait, searching for a suitable device for target:%1.").arg(targetSDK));
m_deviceAPILevel = targetSDK.mid(targetSDK.indexOf(QLatin1Char('-')) + 1).toInt();
@@ -103,14 +97,15 @@ bool AndroidDeployStep::init()
return false;
}
- if (!bc->qtVersion())
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
+ if (!version)
return false;
- m_qtVersionSourcePath = bc->qtVersion()->sourcePath().toString();
- m_qtVersionQMakeBuildConfig = bc->qtVersion()->defaultBuildConfig();
- m_androidDirPath = androidTarget->androidDirPath();
- m_apkPathDebug = androidTarget->apkPath(AndroidTarget::DebugBuild);
- m_apkPathRelease = androidTarget->apkPath(AndroidTarget::ReleaseBuildSigned);
- m_buildDirectory = androidTarget->qt4Project()->rootQt4ProjectNode()->buildDir();
+ m_qtVersionSourcePath = version->sourcePath().toString();
+ m_qtVersionQMakeBuildConfig = version->defaultBuildConfig();
+ m_androidDirPath = AndroidManager::dirPath(target());
+ m_apkPathDebug = AndroidManager::apkPath(target(), AndroidManager::DebugBuild).toString();
+ m_apkPathRelease = AndroidManager::apkPath(target(), AndroidManager::ReleaseBuildSigned).toString();
+ m_buildDirectory = static_cast<Qt4Project *>(target()->project())->rootQt4ProjectNode()->buildDir();
m_runQASIPackagePath = m_QASIPackagePath;
m_runDeployAction = m_deployAction;
return true;
@@ -205,12 +200,9 @@ int AndroidDeployStep::deviceAPILevel()
return m_deviceAPILevel;
}
-QString AndroidDeployStep::localLibsRulesFilePath()
+Utils::FileName AndroidDeployStep::localLibsRulesFilePath()
{
- AndroidTarget *androidTarget = qobject_cast<AndroidTarget *>(target());
- if (!androidTarget)
- return QString();
- return androidTarget->localLibsRulesFilePath();
+ return AndroidManager::localLibsRulesFilePath(target());
}
void AndroidDeployStep::copyLibs(const QString &srcPath, const QString &destPath, QStringList &copiedLibs, const QStringList &filter)
@@ -241,7 +233,7 @@ bool AndroidDeployStep::deployPackage()
if (m_runDeployAction == DeployLocal) {
writeOutput(tr("Clean old qt libs"));
- runCommand(deployProc, AndroidConfigurations::instance().adbToolPath(),
+ runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
<< QLatin1String("shell") << QLatin1String("rm") << QLatin1String("-r") << QLatin1String("/data/local/qt"));
@@ -258,7 +250,7 @@ bool AndroidDeployStep::deployPackage()
copyLibs(m_qtVersionSourcePath + QLatin1String("/jar"),
tempPath + QLatin1String("/jar"), stripFiles);
AndroidPackageCreationStep::stripAndroidLibs(stripFiles, target()->activeRunConfiguration()->abi().architecture());
- runCommand(deployProc, AndroidConfigurations::instance().adbToolPath(),
+ runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
<< QLatin1String("push") << tempPath << QLatin1String("/data/local/qt"));
AndroidPackageCreationStep::removeDirectory(tempPath);
@@ -266,7 +258,7 @@ bool AndroidDeployStep::deployPackage()
}
if (m_runDeployAction == InstallQASI) {
- if (!runCommand(deployProc, AndroidConfigurations::instance().adbToolPath(),
+ if (!runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
<< QLatin1String("install") << QLatin1String("-r ") << m_runQASIPackagePath)) {
raiseError(tr("Qt Android smart installer instalation failed"));
@@ -276,10 +268,10 @@ bool AndroidDeployStep::deployPackage()
}
emit resetDelopyAction();
}
- deployProc->setWorkingDirectory(m_androidDirPath);
+ deployProc->setWorkingDirectory(m_androidDirPath.toString());
writeOutput(tr("Installing package onto %1.").arg(m_deviceSerialNumber));
- runCommand(deployProc, AndroidConfigurations::instance().adbToolPath(),
+ runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
QStringList() << QLatin1String("-s") << m_deviceSerialNumber << QLatin1String("uninstall") << m_packageName);
QString package = m_apkPathDebug;
@@ -287,7 +279,7 @@ bool AndroidDeployStep::deployPackage()
&& QFile::exists(m_apkPathRelease))
package = m_apkPathRelease;
- if (!runCommand(deployProc, AndroidConfigurations::instance().adbToolPath(),
+ if (!runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
QStringList() << QLatin1String("-s") << m_deviceSerialNumber << QLatin1String("install") << package)) {
raiseError(tr("Package instalation failed"));
disconnect(deployProc, 0, this, 0);
@@ -296,11 +288,11 @@ bool AndroidDeployStep::deployPackage()
}
writeOutput(tr("Pulling files necessary for debugging"));
- runCommand(deployProc, AndroidConfigurations::instance().adbToolPath(),
+ runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
<< QLatin1String("pull") << QLatin1String("/system/bin/app_process")
<< QString::fromLatin1("%1/app_process").arg(m_buildDirectory));
- runCommand(deployProc, AndroidConfigurations::instance().adbToolPath(),
+ runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
QStringList() << QLatin1String("-s") << m_deviceSerialNumber << QLatin1String("pull")
<< QLatin1String("/system/lib/libc.so")
<< QString::fromLatin1("%1/libc.so").arg(m_buildDirectory));
diff --git a/src/plugins/android/androiddeploystep.h b/src/plugins/android/androiddeploystep.h
index 73553baf84..f76e248c28 100644
--- a/src/plugins/android/androiddeploystep.h
+++ b/src/plugins/android/androiddeploystep.h
@@ -70,7 +70,7 @@ public:
QString deviceSerialNumber();
int deviceAPILevel();
- QString localLibsRulesFilePath();
+ Utils::FileName localLibsRulesFilePath();
AndroidDeployAction deployAction();
bool useLocalQtLibs();
@@ -116,7 +116,7 @@ private:
QString m_packageName;
QString m_qtVersionSourcePath;
QtSupport::BaseQtVersion::QmakeBuildConfigs m_qtVersionQMakeBuildConfig;
- QString m_androidDirPath;
+ Utils::FileName m_androidDirPath;
QString m_apkPathDebug;
QString m_apkPathRelease;
QString m_buildDirectory;
diff --git a/src/plugins/android/androiddeploystepfactory.cpp b/src/plugins/android/androiddeploystepfactory.cpp
index 4344b69208..09ffb190c2 100644
--- a/src/plugins/android/androiddeploystepfactory.cpp
+++ b/src/plugins/android/androiddeploystepfactory.cpp
@@ -33,11 +33,13 @@
#include "androiddeploystepfactory.h"
#include "androiddeploystep.h"
+#include "androidmanager.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
-#include <qt4projectmanager/qt4projectmanagerconstants.h>
+#include <qtsupport/qtsupportconstants.h>
+#include <qtsupport/qtprofileinformation.h>
#include <QCoreApplication>
@@ -53,27 +55,25 @@ AndroidDeployStepFactory::AndroidDeployStepFactory(QObject *parent)
QList<Core::Id> AndroidDeployStepFactory::availableCreationIds(BuildStepList *parent) const
{
- if (parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
- && parent->target()->id() == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)
- && !parent->contains(AndroidDeployStep::Id))
- return QList<Core::Id>() << AndroidDeployStep::Id;
- return QList<Core::Id>();
+ if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY))
+ return QList<Core::Id>();
+ if (!AndroidManager::supportsAndroid(parent->target()))
+ return QList<Core::Id>();
+ if (parent->contains(AndroidDeployStep::Id))
+ return QList<Core::Id>();
+ return QList<Core::Id>() << AndroidDeployStep::Id;
}
QString AndroidDeployStepFactory::displayNameForId(const Core::Id id) const
{
if (id == AndroidDeployStep::Id)
- return QCoreApplication::translate("Qt4ProjectManager::Internal::AndroidDeployStepFactory",
- "Deploy to Android device/emulator");
+ return tr("Deploy to Android device/emulator");
return QString();
}
bool AndroidDeployStepFactory::canCreate(BuildStepList *parent, const Core::Id id) const
{
- return parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
- && id == Core::Id(AndroidDeployStep::Id)
- && parent->target()->id() == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)
- && !parent->contains(AndroidDeployStep::Id);
+ return availableCreationIds(parent).contains(id);
}
BuildStep *AndroidDeployStepFactory::create(BuildStepList *parent, const Core::Id id)
diff --git a/src/plugins/android/androiddeploystepwidget.cpp b/src/plugins/android/androiddeploystepwidget.cpp
index 9dce27ce61..cd8616ed8c 100644
--- a/src/plugins/android/androiddeploystepwidget.cpp
+++ b/src/plugins/android/androiddeploystepwidget.cpp
@@ -110,7 +110,7 @@ void AndroidDeployStepWidget::useLocalQtLibsStateChanged(int state)
void AndroidDeployStepWidget::editRulesFile()
{
- Core::ICore::instance()->openFiles(QStringList() << m_step->localLibsRulesFilePath(), Core::ICore::SwitchMode);
+ Core::ICore::instance()->openFiles(QStringList() << m_step->localLibsRulesFilePath().toString(), Core::ICore::SwitchMode);
}
} // namespace Internal
diff --git a/src/plugins/android/androidtarget.cpp b/src/plugins/android/androidmanager.cpp
index 7367c9645c..b95c2bdb3f 100644
--- a/src/plugins/android/androidtarget.cpp
+++ b/src/plugins/android/androidmanager.cpp
@@ -30,7 +30,7 @@
**
**************************************************************************/
-#include "androidtarget.h"
+#include "androidmanager.h"
#include "androiddeployconfiguration.h"
#include "androidconfigurations.h"
#include "androidrunconfiguration.h"
@@ -38,12 +38,16 @@
#include "androidglobal.h"
#include "androidpackagecreationstep.h"
+#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/session.h>
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4nodes.h>
#include <qt4projectmanager/qt4project.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
-#include <qt4projectmanager/qt4target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qtsupport/customexecutablerunconfiguration.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
#include <QDir>
#include <QFileSystemWatcher>
@@ -53,9 +57,6 @@
#include <QApplication>
#include <QDomDocument>
-using namespace ProjectExplorer;
-using namespace Qt4ProjectManager;
-
namespace {
const QLatin1String AndroidDirName("android");
const QLatin1String AndroidManifestName("AndroidManifest.xml");
@@ -78,499 +79,263 @@ namespace {
namespace Android {
namespace Internal {
-AndroidTarget::AndroidTarget(Qt4Project *parent, const Core::Id id) :
- Qt4BaseTarget(parent, id)
- , m_androidFilesWatcher(new QFileSystemWatcher(this))
- , m_buildConfigurationFactory(new Qt4BuildConfigurationFactory(this))
-{
- setDisplayName(defaultDisplayName());
- setDefaultDisplayName(defaultDisplayName());
- setIcon(QIcon(QLatin1String(Constants::ANDROID_SETTINGS_CATEGORY_ICON)));
- connect(parent, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
- this, SLOT(handleTargetChanged(ProjectExplorer::Target*)));
-}
+AndroidManager *AndroidManager::m_instance = 0;
-AndroidTarget::~AndroidTarget()
+AndroidManager *AndroidManager::instance()
{
-
+ return m_instance;
}
-Qt4BuildConfigurationFactory *AndroidTarget::buildConfigurationFactory() const
+AndroidManager::~AndroidManager()
{
- return m_buildConfigurationFactory;
}
-void AndroidTarget::createApplicationProFiles(bool reparse)
+bool AndroidManager::supportsAndroid(ProjectExplorer::Target *target)
{
- if (!reparse)
- removeUnconfiguredCustomExectutableRunConfigurations();
-
- QList<Qt4ProFileNode *> profiles = qt4Project()->applicationProFiles();
- QSet<QString> paths;
- foreach (Qt4ProFileNode *pro, profiles)
- paths << pro->path();
-
- foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
- if (AndroidRunConfiguration *qt4rc = qobject_cast<AndroidRunConfiguration *>(rc))
- paths.remove(qt4rc->proFilePath());
-
- // Only add new runconfigurations if there are none.
- foreach (const QString &path, paths)
- addRunConfiguration(new AndroidRunConfiguration(this, path));
-
- // Oh still none? Add a custom executable runconfiguration
- if (runConfigurations().isEmpty()) {
- addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(this));
- }
-}
-
-QList<ProjectExplorer::RunConfiguration *> AndroidTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
-{
- QList<ProjectExplorer::RunConfiguration *> result;
- foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
- if (AndroidRunConfiguration *qt4c = qobject_cast<AndroidRunConfiguration *>(rc))
- if (qt4c->proFilePath() == n->path())
- result << rc;
- return result;
+ if (!qobject_cast<Qt4ProjectManager::Qt4Project *>(target->project()))
+ return false;
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
+ return version && version->platformName() == QtSupport::Constants::ANDROID_PLATFORM;
}
-QString AndroidTarget::defaultDisplayName()
+QString AndroidManager::packageName(ProjectExplorer::Target *target)
{
- return QApplication::translate("Qt4ProjectManager::Qt4Target", "Android", "Qt4 Android target display name");
+ QDomDocument doc;
+ if (!openManifest(target, doc))
+ return QString();
+ QDomElement manifestElem = doc.documentElement();
+ return manifestElem.attribute(QLatin1String("package"));
}
-void AndroidTarget::handleTargetChanged(ProjectExplorer::Target *target)
+bool AndroidManager::setPackageName(ProjectExplorer::Target *target, const QString &name)
{
- if (target != this)
- return;
-
- disconnect(project(), SIGNAL(addedTarget(ProjectExplorer::Target*)),
- this, SLOT(handleTargetChanged(ProjectExplorer::Target*)));
- connect(project(), SIGNAL(aboutToRemoveTarget(ProjectExplorer::Target*)),
- SLOT(handleTargetToBeRemoved(ProjectExplorer::Target*)));
-
- if (!createAndroidTemplatesIfNecessary())
- return;
-
- m_androidFilesWatcher->addPath(androidDirPath());
- m_androidFilesWatcher->addPath(androidManifestPath());
- m_androidFilesWatcher->addPath(androidSrcPath());
- connect(m_androidFilesWatcher, SIGNAL(directoryChanged(QString)), this,
- SIGNAL(androidDirContentsChanged()));
- connect(m_androidFilesWatcher, SIGNAL(fileChanged(QString)), this,
- SIGNAL(androidDirContentsChanged()));
+ QDomDocument doc;
+ if (!openManifest(target, doc))
+ return false;
+ QDomElement manifestElem = doc.documentElement();
+ manifestElem.setAttribute(QLatin1String("package"), cleanPackageName(name));
+ return saveManifest(target, doc);
}
-void AndroidTarget::handleTargetToBeRemoved(ProjectExplorer::Target *target)
+QString AndroidManager::applicationName(ProjectExplorer::Target *target)
{
- if (target != this)
- return;
-
-// I don't think is a good idea to remove android directory
-
-// const QString debianPath = debianDirPath();
-// if (!QFileInfo(debianPath).exists())
-// return;
-// const int answer = QMessageBox::warning(0, tr("Qt Creator"),
-// tr("Do you want to remove the packaging directory\n"
-// "associated with the target '%1'?").arg(displayName()),
-// QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
-// if (answer == QMessageBox::No)
-// return;
-// QString error;
-// if (!MaemoGlobal::removeRecursively(debianPath, error))
-// qDebug("%s", qPrintable(error));
-// const QString packagingPath = project()->projectDirectory()
-// + QLatin1Char('/') + PackagingDirName;
-// const QStringList otherContents = QDir(packagingPath).entryList(QDir::Dirs
-// | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot);
-// if (otherContents.isEmpty()) {
-// if (!MaemoGlobal::removeRecursively(packagingPath, error))
-// qDebug("%s", qPrintable(error));
-// }
+ QDomDocument doc;
+ if (!openXmlFile(target, doc, stringsPath(target)))
+ return QString();
+ QDomElement metadataElem = doc.documentElement().firstChildElement(QLatin1String("string"));
+ while (!metadataElem.isNull()) {
+ if (metadataElem.attribute(QLatin1String("name")) == QLatin1String("app_name"))
+ return metadataElem.text();
+ metadataElem = metadataElem.nextSiblingElement(QLatin1String("string"));
+ }
+ return QString();
}
-QString AndroidTarget::androidDirPath() const
+bool AndroidManager::setApplicationName(ProjectExplorer::Target *target, const QString &name)
{
- return project()->projectDirectory() + QLatin1Char('/') + AndroidDirName;
+ QDomDocument doc;
+ Utils::FileName path = stringsPath(target);
+ if (!openXmlFile(target, doc, path))
+ return false;
+ QDomElement metadataElem = doc.documentElement().firstChildElement(QLatin1String("string"));
+ while (!metadataElem.isNull()) {
+ if (metadataElem.attribute(QLatin1String("name")) == QLatin1String("app_name")) {
+ metadataElem.removeChild(metadataElem.firstChild());
+ metadataElem.appendChild(doc.createTextNode(name));
+ break;
+ }
+ metadataElem = metadataElem.nextSiblingElement(QLatin1String("string"));
+ }
+ return saveXmlFile(target, doc, path);
}
-QString AndroidTarget::androidManifestPath() const
+QStringList AndroidManager::permissions(ProjectExplorer::Target *target)
{
- return androidDirPath() + QLatin1Char('/') + AndroidManifestName;
+ QStringList per;
+ QDomDocument doc;
+ if (!openManifest(target, doc))
+ return per;
+ QDomElement permissionElem = doc.documentElement().firstChildElement(QLatin1String("uses-permission"));
+ while (!permissionElem.isNull()) {
+ per << permissionElem.attribute(QLatin1String("android:name"));
+ permissionElem = permissionElem.nextSiblingElement(QLatin1String("uses-permission"));
+ }
+ return per;
}
-QString AndroidTarget::androidLibsPath() const
+bool AndroidManager::setPermissions(ProjectExplorer::Target *target, const QStringList &permissions)
{
- return androidDirPath() + AndroidLibsFileName;
-}
+ QDomDocument doc;
+ if (!openManifest(target, doc))
+ return false;
+ QDomElement docElement = doc.documentElement();
+ QDomElement permissionElem = docElement.firstChildElement(QLatin1String("uses-permission"));
+ while (!permissionElem.isNull()) {
+ docElement.removeChild(permissionElem);
+ permissionElem = docElement.firstChildElement(QLatin1String("uses-permission"));
+ }
-QString AndroidTarget::androidStringsPath() const
-{
- return androidDirPath() + AndroidStringsFileName;
-}
+ foreach (const QString &permission, permissions ) {
+ permissionElem = doc.createElement(QLatin1String("uses-permission"));
+ permissionElem.setAttribute(QLatin1String("android:name"), permission);
+ docElement.appendChild(permissionElem);
+ }
-QString AndroidTarget::androidDefaultPropertiesPath() const
-{
- return androidDirPath() + QLatin1Char('/') + AndroidDefaultPropertiesName;
+ return saveManifest(target, doc);
}
-QString AndroidTarget::androidSrcPath() const
+QString AndroidManager::intentName(ProjectExplorer::Target *target)
{
- return androidDirPath() + QLatin1String("/src");
+ return packageName(target) + QLatin1Char('/') + activityName(target);
}
-QString AndroidTarget::apkPath(BuildType buildType) const
+QString AndroidManager::activityName(ProjectExplorer::Target *target)
{
- return project()->projectDirectory() + QLatin1Char('/')
- + AndroidDirName
- + QString::fromLatin1("/bin/%1-%2.apk")
- .arg(applicationName())
- .arg(buildType == DebugBuild ? QLatin1String("debug")
- : (buildType == ReleaseBuildUnsigned) ? QLatin1String("release-unsigned")
- : QLatin1String("signed"));
+ QDomDocument doc;
+ if (!openManifest(target, doc))
+ return QString();
+ QDomElement activityElem = doc.documentElement().firstChildElement(QLatin1String("application")).firstChildElement(QLatin1String("activity"));
+ return activityElem.attribute(QLatin1String("android:name"));
}
-QString AndroidTarget::localLibsRulesFilePath() const
+int AndroidManager::versionCode(ProjectExplorer::Target *target)
{
- const Qt4Project *const qt4Project = qobject_cast<const Qt4Project *>(project());
- if (!qt4Project || !qt4Project->activeTarget()->activeQt4BuildConfiguration()->qtVersion())
- return QLatin1String("");
-
- return qt4Project->activeTarget()->activeQt4BuildConfiguration()
- ->qtVersion()->versionInfo()[QLatin1String("QT_INSTALL_LIBS")] + QLatin1String("/rules.xml");
+ QDomDocument doc;
+ if (!openManifest(target, doc))
+ return 0;
+ QDomElement manifestElem = doc.documentElement();
+ return manifestElem.attribute(QLatin1String("android:versionCode")).toInt();
}
-QString AndroidTarget::loadLocal(int apiLevel, ItemType item) const
+bool AndroidManager::setVersionCode(ProjectExplorer::Target *target, int version)
{
- QString itemType;
- if (item == Lib)
- itemType = QLatin1String("lib");
- else
- itemType = QLatin1String("jar");
-
- QString localLibs;
-
QDomDocument doc;
- if (!openXmlFile(doc, localLibsRulesFilePath()))
- return localLibs;
-
- QStringList libs;
- libs << qtLibs() << prebundledLibs();
- QDomElement element = doc.documentElement().firstChildElement(QLatin1String("platforms")).firstChildElement(itemType + QLatin1Char('s')).firstChildElement(QLatin1String("version"));
- while (!element.isNull()) {
- if (element.attribute(QLatin1String("value")).toInt() == apiLevel) {
- if (element.hasAttribute(QLatin1String("symlink")))
- apiLevel = element.attribute(QLatin1String("symlink")).toInt();
- break;
- }
- element = element.nextSiblingElement(QLatin1String("version"));
- }
-
- element = doc.documentElement().firstChildElement(QLatin1String("dependencies")).firstChildElement(QLatin1String("lib"));
- while (!element.isNull()) {
- if (libs.contains(element.attribute(QLatin1String("name")))) {
- QDomElement libElement = element.firstChildElement(QLatin1String("depends")).firstChildElement(itemType);
- while (!libElement.isNull()) {
- localLibs += libElement.attribute(QLatin1String("file")).arg(apiLevel) + QLatin1Char(':');
- libElement = libElement.nextSiblingElement(itemType);
- }
-
- libElement = element.firstChildElement(QLatin1String("replaces")).firstChildElement(itemType);
- while (!libElement.isNull()) {
- localLibs.replace(libElement.attribute(QLatin1String("file")).arg(apiLevel) + QLatin1Char(':'), QString());
- libElement = libElement.nextSiblingElement(itemType);
- }
- }
- element = element.nextSiblingElement(QLatin1String("lib"));
- }
- return localLibs;
+ if (!openManifest(target, doc))
+ return false;
+ QDomElement manifestElem = doc.documentElement();
+ manifestElem.setAttribute(QLatin1String("android:versionCode"), version);
+ return saveManifest(target, doc);
}
-QString AndroidTarget::loadLocalLibs(int apiLevel) const
+QString AndroidManager::versionName(ProjectExplorer::Target *target)
{
- return loadLocal(apiLevel, Lib);
+ QDomDocument doc;
+ if (!openManifest(target, doc))
+ return QString();
+ QDomElement manifestElem = doc.documentElement();
+ return manifestElem.attribute(QLatin1String("android:versionName"));
}
-QString AndroidTarget::loadLocalJars(int apiLevel) const
+bool AndroidManager::setVersionName(ProjectExplorer::Target *target, const QString &version)
{
- return loadLocal(apiLevel, Jar);
+ QDomDocument doc;
+ if (!openManifest(target, doc))
+ return false;
+ QDomElement manifestElem = doc.documentElement();
+ manifestElem.setAttribute(QLatin1String("android:versionName"), version);
+ return saveManifest(target, doc);
}
-void AndroidTarget::updateProject(const QString &targetSDK, const QString &name) const
+QString AndroidManager::targetSDK(ProjectExplorer::Target *target)
{
- QString androidDir = androidDirPath();
-
- // clean previous build
- QProcess androidProc;
- androidProc.setWorkingDirectory(androidDir);
- androidProc.start(AndroidConfigurations::instance().antToolPath(), QStringList() << QLatin1String("clean"));
- if (!androidProc.waitForFinished(-1))
- androidProc.terminate();
- // clean previous build
-
- int targetSDKNumber = targetSDK.mid(targetSDK.lastIndexOf(QLatin1Char('-')) + 1).toInt();
- bool commentLines = false;
- QDirIterator it(androidDir, QStringList() << QLatin1String("*.java"), QDir::Files, QDirIterator::Subdirectories);
- while (it.hasNext()) {
- it.next();
- QFile file(it.filePath());
- if (!file.open(QIODevice::ReadWrite))
- continue;
- QList<QByteArray> lines = file.readAll().trimmed().split('\n');
-
- bool modified = false;
- bool comment = false;
- for (int i = 0; i < lines.size(); i++) {
- if (lines[i].contains("@ANDROID-")) {
- commentLines = targetSDKNumber < lines[i].mid(lines[i].lastIndexOf('-') + 1).toInt();
- comment = !comment;
- continue;
- }
- if (!comment)
- continue;
- if (commentLines) {
- if (!lines[i].trimmed().startsWith("//QtCreator")) {
- lines[i] = "//QtCreator " + lines[i];
- modified = true;
- }
- } else { if (lines[i].trimmed().startsWith("//QtCreator")) {
- lines[i] = lines[i].mid(12);
- modified = true;
- }
- }
- }
- if (modified) {
- file.resize(0);
- foreach (const QByteArray &line, lines) {
- file.write(line);
- file.write("\n");
- }
- }
- file.close();
+ if (!createAndroidTemplatesIfNecessary(target))
+ return AndroidConfigurations::instance().bestMatch(QLatin1String("android-8"));
+ QFile file(defaultPropertiesPath(target).toString());
+ if (!file.open(QIODevice::ReadOnly))
+ return AndroidConfigurations::instance().bestMatch(QLatin1String("android-8"));
+ while (!file.atEnd()) {
+ QByteArray line = file.readLine();
+ if (line.startsWith("target="))
+ return QString::fromLatin1(line.trimmed().mid(7));
}
-
- QStringList params;
- params << QLatin1String("update") << QLatin1String("project") << QLatin1String("-p") << androidDir;
- if (!targetSDK.isEmpty())
- params << QLatin1String("-t") << targetSDK;
- if (!name.isEmpty())
- params << QLatin1String("-n") << name;
- androidProc.start(AndroidConfigurations::instance().androidToolPath(), params);
- if (!androidProc.waitForFinished(-1))
- androidProc.terminate();
+ return AndroidConfigurations::instance().bestMatch(QLatin1String("android-8"));
}
-bool AndroidTarget::createAndroidTemplatesIfNecessary() const
+bool AndroidManager::setTargetSDK(ProjectExplorer::Target *target, const QString &sdk)
{
- const Qt4Project *qt4Project = qobject_cast<Qt4Project*>(project());
- if (!qt4Project || !qt4Project->rootProjectNode() || !qt4Project->activeTarget() || !qt4Project->activeTarget()->activeQt4BuildConfiguration()
- || !qt4Project->activeTarget()->activeQt4BuildConfiguration()->qtVersion())
- return false;
- QString javaSrcPath = qt4Project->activeTarget()->activeQt4BuildConfiguration()->qtVersion()->versionInfo()[QLatin1String("QT_INSTALL_PREFIX")] + QLatin1String("/src/android/java");
- QDir projectDir(project()->projectDirectory());
- QString androidPath = androidDirPath();
-
- QStringList m_ignoreFiles;
- bool forceUpdate = false;
- QDomDocument srcVersionDoc;
- if (openXmlFile(srcVersionDoc, javaSrcPath + QLatin1String("/version.xml"), false)) {
- QDomDocument dstVersionDoc;
- if (openXmlFile(dstVersionDoc, androidPath + QLatin1String("/version.xml"), false))
- forceUpdate = (srcVersionDoc.documentElement().attribute(QLatin1String("value")).toDouble()
- > dstVersionDoc.documentElement().attribute(QLatin1String("value")).toDouble());
-
- else
- forceUpdate = true;
-
- if (forceUpdate && QFileInfo(androidPath).exists()) {
- QDomElement ignoreFile = srcVersionDoc.documentElement().firstChildElement(QLatin1String("ignore")).firstChildElement(QLatin1String("file"));
- while (!ignoreFile.isNull()) {
- m_ignoreFiles << ignoreFile.text();
- ignoreFile = ignoreFile.nextSiblingElement();
- }
- }
- }
-
- if (!forceUpdate && QFileInfo(androidPath).exists()
- && QFileInfo(androidManifestPath()).exists()
- && QFileInfo(androidPath + QLatin1String("/src")).exists()
- && QFileInfo(androidPath + QLatin1String("/res")).exists())
- return true;
-
- forceUpdate &= QFileInfo(androidPath).exists();
-
- if (!QFileInfo(androidDirPath()).exists() && !projectDir.mkdir(AndroidDirName)) {
- raiseError(tr("Error creating Android directory '%1'.")
- .arg(AndroidDirName));
- return false;
- }
-
- QStringList androidFiles;
- QDirIterator it(javaSrcPath, QDirIterator::Subdirectories);
- int pos = it.path().size();
- while (it.hasNext()) {
- it.next();
- if (it.fileInfo().isDir()) {
- projectDir.mkpath(AndroidDirName + it.filePath().mid(pos));
- } else {
- const QString dstFile(androidPath + it.filePath().mid(pos));
- if (m_ignoreFiles.contains(it.fileName()))
- continue;
- else
- {
- if (QFile::exists(dstFile))
- QFile::remove(dstFile);
- else
- androidFiles << dstFile;
- }
- QFile::copy(it.filePath(), dstFile);
- }
- }
- if (androidFiles.size())
- qt4Project->rootProjectNode()->addFiles(UnknownFileType, androidFiles);
-
- QStringList sdks = AndroidConfigurations::instance().sdkTargets();
- if (sdks.isEmpty()) {
- raiseError(tr("No Qt for Android SDKs were found.\nPlease install at least one SDK."));
- return false;
- }
- updateProject(AndroidConfigurations::instance().sdkTargets().at(0));
- if (availableTargetApplications().length())
- setTargetApplication(availableTargetApplications()[0]);
-
- QString applicationName = project()->displayName();
- if (applicationName.length()) {
- setPackageName(packageName() + QLatin1Char('.') + applicationName);
- applicationName[0] = applicationName[0].toUpper();
- setApplicationName(applicationName);
- }
-
- if (forceUpdate)
- QMessageBox::warning(0, tr("Warning"), tr("Android files have been updated automatically"));
-
+ updateTarget(target, sdk, applicationName(target));
return true;
}
-bool AndroidTarget::openXmlFile(QDomDocument &doc, const QString &fileName, bool createAndroidTemplates) const
+QIcon AndroidManager::highDpiIcon(ProjectExplorer::Target *target)
{
- if (createAndroidTemplates && !createAndroidTemplatesIfNecessary())
- return false;
-
- QFile f(fileName);
- if (!f.open(QIODevice::ReadOnly))
- return false;
-
- if (!doc.setContent(f.readAll())) {
- raiseError(tr("Cannot parse '%1'").arg(fileName));
- return false;
- }
- return true;
+ return icon(target, HighDPI);
}
-bool AndroidTarget::saveXmlFile(QDomDocument &doc, const QString &fileName) const
+bool AndroidManager::setHighDpiIcon(ProjectExplorer::Target *target, const QString &iconFilePath)
{
- if (!createAndroidTemplatesIfNecessary())
- return false;
+ return setIcon(target, HighDPI, iconFilePath);
+}
- QFile f(fileName);
- if (!f.open(QIODevice::WriteOnly)) {
- raiseError(tr("Cannot open '%1'").arg(fileName));
- return false;
- }
- return f.write(doc.toByteArray(4)) >= 0;
+QIcon AndroidManager::mediumDpiIcon(ProjectExplorer::Target *target)
+{
+ return icon(target, MediumDPI);
}
-bool AndroidTarget::openAndroidManifest(QDomDocument &doc) const
+bool AndroidManager::setMediumDpiIcon(ProjectExplorer::Target *target, const QString &iconFilePath)
{
- return openXmlFile(doc, androidManifestPath());
+ return setIcon(target, MediumDPI, iconFilePath);
}
-bool AndroidTarget::saveAndroidManifest(QDomDocument &doc) const
+QIcon AndroidManager::lowDpiIcon(ProjectExplorer::Target *target)
{
- return saveXmlFile(doc, androidManifestPath());
+ return icon(target, LowDPI);
}
-bool AndroidTarget::openLibsXml(QDomDocument &doc) const
+bool AndroidManager::setLowDpiIcon(ProjectExplorer::Target *target, const QString &iconFilePath)
{
- return openXmlFile(doc, androidLibsPath());
+ return setIcon(target, LowDPI, iconFilePath);
}
-bool AndroidTarget::saveLibsXml(QDomDocument &doc) const
+Utils::FileName AndroidManager::dirPath(ProjectExplorer::Target *target)
{
- return saveXmlFile(doc, androidLibsPath());
+ return Utils::FileName::fromString(target->project()->projectDirectory()).appendPath(AndroidDirName);
}
-QString AndroidTarget::activityName() const
+Utils::FileName AndroidManager::manifestPath(ProjectExplorer::Target *target)
{
- QDomDocument doc;
- if (!openAndroidManifest(doc))
- return QString();
- QDomElement activityElem = doc.documentElement().firstChildElement(QLatin1String("application")).firstChildElement(QLatin1String("activity"));
- return activityElem.attribute(QLatin1String("android:name"));
+ return dirPath(target).appendPath(AndroidManifestName);
}
-QString AndroidTarget::intentName() const
+Utils::FileName AndroidManager::libsPath(ProjectExplorer::Target *target)
{
- return packageName() + QLatin1Char('/') + activityName();
+ return dirPath(target).appendPath(AndroidLibsFileName);
}
-QString AndroidTarget::packageName() const
+Utils::FileName AndroidManager::stringsPath(ProjectExplorer::Target *target)
{
- QDomDocument doc;
- if (!openAndroidManifest(doc))
- return QString();
- QDomElement manifestElem = doc.documentElement();
- return manifestElem.attribute(QLatin1String("package"));
+ return dirPath(target).append(AndroidStringsFileName);
}
-bool AndroidTarget::setPackageName(const QString &name) const
+Utils::FileName AndroidManager::defaultPropertiesPath(ProjectExplorer::Target *target)
{
- QDomDocument doc;
- if (!openAndroidManifest(doc))
- return false;
- QDomElement manifestElem = doc.documentElement();
- manifestElem.setAttribute(QLatin1String("package"), cleanPackageName(name));
- return saveAndroidManifest(doc);
+ return dirPath(target).appendPath(AndroidDefaultPropertiesName);
}
-QString AndroidTarget::applicationName() const
+Utils::FileName AndroidManager::srcPath(ProjectExplorer::Target *target)
{
- QDomDocument doc;
- if (!openXmlFile(doc, androidStringsPath()))
- return QString();
- QDomElement metadataElem = doc.documentElement().firstChildElement(QLatin1String("string"));
- while (!metadataElem.isNull()) {
- if (metadataElem.attribute(QLatin1String("name")) == QLatin1String("app_name"))
- return metadataElem.text();
- metadataElem = metadataElem.nextSiblingElement(QLatin1String("string"));
- }
- return QString();
+ return dirPath(target).appendPath(QLatin1String("/src"));
}
-bool AndroidTarget::setApplicationName(const QString &name) const
+Utils::FileName AndroidManager::apkPath(ProjectExplorer::Target *target, BuildType buildType)
{
- QDomDocument doc;
- if (!openXmlFile(doc, androidStringsPath()))
- return false;
- QDomElement metadataElem =doc.documentElement().firstChildElement(QLatin1String("string"));
- while (!metadataElem.isNull()) {
- if (metadataElem.attribute(QLatin1String("name")) == QLatin1String("app_name")) {
- metadataElem.removeChild(metadataElem.firstChild());
- metadataElem.appendChild(doc.createTextNode(name));
- break;
- }
- metadataElem = metadataElem.nextSiblingElement(QLatin1String("string"));
- }
- return saveXmlFile(doc, androidStringsPath());
+ return dirPath(target)
+ .appendPath(QLatin1String("bin"))
+ .appendPath(QString::fromLatin1("%1-%2.apk")
+ .arg(applicationName(target))
+ .arg(buildType == DebugBuild
+ ? QLatin1String("debug")
+ : (buildType == ReleaseBuildUnsigned)
+ ? QLatin1String("release-unsigned")
+ : QLatin1String("signed")));
}
-QStringList AndroidTarget::availableTargetApplications() const
+QStringList AndroidManager::availableTargetApplications(ProjectExplorer::Target *target)
{
QStringList apps;
- Qt4Project *qt4Project = qobject_cast<Qt4Project *>(project());
- foreach (Qt4ProFileNode *proFile, qt4Project->applicationProFiles()) {
- if (proFile->projectType() == ApplicationTemplate) {
+ Qt4ProjectManager::Qt4Project *qt4Project = qobject_cast<Qt4ProjectManager::Qt4Project *>(target->project());
+ foreach (Qt4ProjectManager::Qt4ProFileNode *proFile, qt4Project->applicationProFiles()) {
+ if (proFile->projectType() == Qt4ProjectManager::ApplicationTemplate) {
if (proFile->targetInformation().target.startsWith(QLatin1String("lib"))
&& proFile->targetInformation().target.endsWith(QLatin1String(".so")))
apps << proFile->targetInformation().target.mid(3, proFile->targetInformation().target.lastIndexOf(QLatin1Char('.')) - 3);
@@ -582,10 +347,10 @@ QStringList AndroidTarget::availableTargetApplications() const
return apps;
}
-QString AndroidTarget::targetApplication() const
+QString AndroidManager::targetApplication(ProjectExplorer::Target *target)
{
QDomDocument doc;
- if (!openAndroidManifest(doc))
+ if (!openManifest(target, doc))
return QString();
QDomElement metadataElem = doc.documentElement().firstChildElement(QLatin1String("application")).firstChildElement(QLatin1String("activity")).firstChildElement(QLatin1String("meta-data"));
while (!metadataElem.isNull()) {
@@ -596,30 +361,30 @@ QString AndroidTarget::targetApplication() const
return QString();
}
-bool AndroidTarget::setTargetApplication(const QString &name) const
+bool AndroidManager::setTargetApplication(ProjectExplorer::Target *target, const QString &name)
{
QDomDocument doc;
- if (!openAndroidManifest(doc))
+ if (!openManifest(target, doc))
return false;
QDomElement metadataElem = doc.documentElement().firstChildElement(QLatin1String("application")).firstChildElement(QLatin1String("activity")).firstChildElement(QLatin1String("meta-data"));
while (!metadataElem.isNull()) {
if (metadataElem.attribute(QLatin1String("android:name")) == QLatin1String("android.app.lib_name")) {
metadataElem.setAttribute(QLatin1String("android:value"), name);
- return saveAndroidManifest(doc);
+ return saveManifest(target, doc);
}
metadataElem = metadataElem.nextSiblingElement(QLatin1String("meta-data"));
}
return false;
}
-QString AndroidTarget::targetApplicationPath() const
+QString AndroidManager::targetApplicationPath(ProjectExplorer::Target *target)
{
- QString selectedApp = targetApplication();
- if (!selectedApp.length())
+ QString selectedApp = targetApplication(target);
+ if (selectedApp.isEmpty())
return QString();
- Qt4Project *qt4Project = qobject_cast<Qt4Project *>(project());
- foreach (Qt4ProFileNode *proFile, qt4Project->applicationProFiles()) {
- if (proFile->projectType() == ApplicationTemplate) {
+ Qt4ProjectManager::Qt4Project *qt4Project = qobject_cast<Qt4ProjectManager::Qt4Project *>(target->project());
+ foreach (Qt4ProjectManager::Qt4ProFileNode *proFile, qt4Project->applicationProFiles()) {
+ if (proFile->projectType() == Qt4ProjectManager::ApplicationTemplate) {
if (proFile->targetInformation().target.startsWith(QLatin1String("lib"))
&& proFile->targetInformation().target.endsWith(QLatin1String(".so"))) {
if (proFile->targetInformation().target.mid(3, proFile->targetInformation().target.lastIndexOf(QLatin1Char('.')) - 3)
@@ -634,145 +399,195 @@ QString AndroidTarget::targetApplicationPath() const
return QString();
}
-int AndroidTarget::versionCode() const
+bool AndroidManager::createAndroidTemplatesIfNecessary(ProjectExplorer::Target *target)
{
- QDomDocument doc;
- if (!openAndroidManifest(doc))
- return 0;
- QDomElement manifestElem = doc.documentElement();
- return manifestElem.attribute(QLatin1String("android:versionCode")).toInt();
-}
-
-bool AndroidTarget::setVersionCode(int version) const
-{
- QDomDocument doc;
- if (!openAndroidManifest(doc))
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
+ Qt4ProjectManager::Qt4Project *qt4Project = qobject_cast<Qt4ProjectManager::Qt4Project*>(target->project());
+ if (!qt4Project || !qt4Project->rootProjectNode() || !version)
return false;
- QDomElement manifestElem = doc.documentElement();
- manifestElem.setAttribute(QLatin1String("android:versionCode"), version);
- return saveAndroidManifest(doc);
-}
+ Utils::FileName javaSrcPath
+ = Utils::FileName::fromString(version->versionInfo()[QLatin1String("QT_INSTALL_PREFIX")])
+ .append(QLatin1String("src/android/java"));
+ QDir projectDir(qt4Project->projectDirectory());
+ Utils::FileName androidPath = dirPath(target);
-QString AndroidTarget::versionName() const
-{
- QDomDocument doc;
- if (!openAndroidManifest(doc))
- return QString();
- QDomElement manifestElem = doc.documentElement();
- return manifestElem.attribute(QLatin1String("android:versionName"));
-}
+ QStringList m_ignoreFiles;
+ bool forceUpdate = false;
+ QDomDocument srcVersionDoc;
+ if (openXmlFile(target, srcVersionDoc, javaSrcPath.append(QLatin1String("version.xml")), false)) {
+ QDomDocument dstVersionDoc;
+ if (openXmlFile(target, dstVersionDoc, androidPath.append(QLatin1String("version.xml")), false))
+ forceUpdate = (srcVersionDoc.documentElement().attribute(QLatin1String("value")).toDouble()
+ > dstVersionDoc.documentElement().attribute(QLatin1String("value")).toDouble());
+ else
+ forceUpdate = true;
-bool AndroidTarget::setVersionName(const QString &version) const
-{
- QDomDocument doc;
- if (!openAndroidManifest(doc))
+ if (forceUpdate && androidPath.toFileInfo().exists()) {
+ QDomElement ignoreFile = srcVersionDoc.documentElement().firstChildElement(QLatin1String("ignore")).firstChildElement(QLatin1String("file"));
+ while (!ignoreFile.isNull()) {
+ m_ignoreFiles << ignoreFile.text();
+ ignoreFile = ignoreFile.nextSiblingElement();
+ }
+ }
+ }
+
+ if (!forceUpdate && androidPath.toFileInfo().exists()
+ && manifestPath(target).toFileInfo().exists()
+ && androidPath.append(QLatin1String("/src")).toFileInfo().exists()
+ && androidPath.append(QLatin1String("/res")).toFileInfo().exists())
+ return true;
+
+ forceUpdate &= androidPath.toFileInfo().exists();
+
+ if (!dirPath(target).toFileInfo().exists() && !projectDir.mkdir(AndroidDirName)) {
+ raiseError(tr("Error creating Android directory '%1'.").arg(AndroidDirName));
return false;
- QDomElement manifestElem = doc.documentElement();
- manifestElem.setAttribute(QLatin1String("android:versionName"), version);
- return saveAndroidManifest(doc);
-}
+ }
-QStringList AndroidTarget::permissions() const
-{
- QStringList per;
- QDomDocument doc;
- if (!openAndroidManifest(doc))
- return per;
- QDomElement permissionElem = doc.documentElement().firstChildElement(QLatin1String("uses-permission"));
- while (!permissionElem.isNull()) {
- per << permissionElem.attribute(QLatin1String("android:name"));
- permissionElem = permissionElem.nextSiblingElement(QLatin1String("uses-permission"));
+ QStringList androidFiles;
+ QDirIterator it(javaSrcPath.toString(), QDirIterator::Subdirectories);
+ int pos = it.path().size();
+ while (it.hasNext()) {
+ it.next();
+ if (it.fileInfo().isDir()) {
+ projectDir.mkpath(AndroidDirName + it.filePath().mid(pos));
+ } else {
+ const Utils::FileName dstFile = androidPath.append(it.filePath().mid(pos));
+ if (m_ignoreFiles.contains(it.fileName())) {
+ continue;
+ } else {
+ if (dstFile.toFileInfo().exists())
+ QFile::remove(dstFile.toString());
+ else
+ androidFiles << dstFile.toString();
+ }
+ QFile::copy(it.filePath(), dstFile.toString());
+ }
}
- return per;
-}
+ if (!androidFiles.isEmpty())
+ qt4Project->rootProjectNode()->addFiles(ProjectExplorer::UnknownFileType, androidFiles);
-bool AndroidTarget::setPermissions(const QStringList &permissions) const
-{
- QDomDocument doc;
- if (!openAndroidManifest(doc))
+ QStringList sdks = AndroidConfigurations::instance().sdkTargets();
+ if (sdks.isEmpty()) {
+ raiseError(tr("No Qt for Android SDKs were found.\nPlease install at least one SDK."));
return false;
- QDomElement docElement = doc.documentElement();
- QDomElement permissionElem = docElement.firstChildElement(QLatin1String("uses-permission"));
- while (!permissionElem.isNull()) {
- docElement.removeChild(permissionElem);
- permissionElem = docElement.firstChildElement(QLatin1String("uses-permission"));
}
+ updateTarget(target, AndroidConfigurations::instance().sdkTargets().at(0));
+ QStringList apps = availableTargetApplications(target);
+ if (!apps.isEmpty())
+ setTargetApplication(target, apps.at(0));
- foreach (const QString &permission, permissions ) {
- permissionElem = doc.createElement(QLatin1String("uses-permission"));
- permissionElem.setAttribute(QLatin1String("android:name"), permission);
- docElement.appendChild(permissionElem);
+ QString applicationName = target->project()->displayName();
+ if (!applicationName.isEmpty()) {
+ setPackageName(target, packageName(target) + QLatin1Char('.') + applicationName);
+ applicationName[0] = applicationName[0].toUpper();
+ setApplicationName(target, applicationName);
}
- return saveAndroidManifest(doc);
-}
+ if (forceUpdate)
+ QMessageBox::warning(0, tr("Warning"), tr("Android files have been updated automatically"));
+ return true;
+}
-QStringList AndroidTarget::getDependencies(const QString &readelfPath, const QString &lib) const
+void AndroidManager::updateTarget(ProjectExplorer::Target *target, const QString &targetSDK, const QString &name)
{
- QStringList libs;
+ QString androidDir = dirPath(target).toString();
- QProcess readelfProc;
- readelfProc.start(readelfPath, QStringList() << QLatin1String("-d") << QLatin1String("-W") << lib);
+ // clean previous build
+ QProcess androidProc;
+ androidProc.setWorkingDirectory(androidDir);
+ androidProc.start(AndroidConfigurations::instance().antToolPath().toString(),
+ QStringList() << QLatin1String("clean"));
+ if (!androidProc.waitForFinished(-1))
+ androidProc.terminate();
+ // clean previous build
- if (!readelfProc.waitForFinished(-1)) {
- readelfProc.terminate();
- return libs;
- }
+ int targetSDKNumber = targetSDK.mid(targetSDK.lastIndexOf(QLatin1Char('-')) + 1).toInt();
+ bool commentLines = false;
+ QDirIterator it(androidDir, QStringList() << QLatin1String("*.java"), QDir::Files, QDirIterator::Subdirectories);
+ while (it.hasNext()) {
+ it.next();
+ QFile file(it.filePath());
+ if (!file.open(QIODevice::ReadWrite))
+ continue;
+ QList<QByteArray> lines = file.readAll().trimmed().split('\n');
- QList<QByteArray> lines = readelfProc.readAll().trimmed().split('\n');
- foreach (const QByteArray &line, lines) {
- if (line.contains("(NEEDED)") && line.contains("Shared library:") ) {
- const int pos = line.lastIndexOf('[') + 1;
- libs << QString::fromLatin1(line.mid(pos, line.lastIndexOf(']') - pos));
+ bool modified = false;
+ bool comment = false;
+ for (int i = 0; i < lines.size(); i++) {
+ if (lines[i].contains("@ANDROID-")) {
+ commentLines = targetSDKNumber < lines[i].mid(lines[i].lastIndexOf('-') + 1).toInt();
+ comment = !comment;
+ continue;
+ }
+ if (!comment)
+ continue;
+ if (commentLines) {
+ if (!lines[i].trimmed().startsWith("//QtCreator")) {
+ lines[i] = "//QtCreator " + lines[i];
+ modified = true;
+ }
+ } else { if (lines[i].trimmed().startsWith("//QtCreator")) {
+ lines[i] = lines[i].mid(12);
+ modified = true;
+ }
+ }
}
+ if (modified) {
+ file.resize(0);
+ foreach (const QByteArray &line, lines) {
+ file.write(line);
+ file.write("\n");
+ }
+ }
+ file.close();
}
- return libs;
+
+ QStringList params;
+ params << QLatin1String("update") << QLatin1String("project") << QLatin1String("-p") << androidDir;
+ if (!targetSDK.isEmpty())
+ params << QLatin1String("-t") << targetSDK;
+ if (!name.isEmpty())
+ params << QLatin1String("-n") << name;
+ androidProc.start(AndroidConfigurations::instance().androidToolPath().toString(), params);
+ if (!androidProc.waitForFinished(-1))
+ androidProc.terminate();
}
-int AndroidTarget::setLibraryLevel(const QString &library, LibrariesMap &mapLibs) const
+Utils::FileName AndroidManager::localLibsRulesFilePath(ProjectExplorer::Target *target)
{
- int maxlevel = mapLibs[library].level;
- if (maxlevel > 0)
- return maxlevel;
- foreach (QString lib, mapLibs[library].dependencies) {
- foreach (const QString &key, mapLibs.keys()) {
- if (library == key)
- continue;
- if (key == lib) {
- int libLevel = mapLibs[key].level;
-
- if (libLevel < 0)
- libLevel = setLibraryLevel(key, mapLibs);
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
+ if (!version)
+ return Utils::FileName();
+ return Utils::FileName::fromString(version->versionInfo()[QLatin1String("QT_INSTALL_LIBS")] + QLatin1String("/rules.xml"));
+}
- if (libLevel > maxlevel)
- maxlevel = libLevel;
- break;
- }
- }
- }
- if (mapLibs[library].level < 0)
- mapLibs[library].level = maxlevel + 1;
- return maxlevel + 1;
+QString AndroidManager::loadLocalLibs(ProjectExplorer::Target *target, int apiLevel)
+{
+ return loadLocal(target, apiLevel, Lib);
}
-bool AndroidTarget::qtLibrariesLessThan(const Library &a, const Library &b)
+QString AndroidManager::loadLocalJars(ProjectExplorer::Target *target, int apiLevel)
{
- if (a.level == b.level)
- return a.name < b.name;
- return a.level < b.level;
+ return loadLocal(target, apiLevel, Jar);
}
-QStringList AndroidTarget::availableQtLibs() const
+QStringList AndroidManager::availableQtLibs(ProjectExplorer::Target *target)
{
- const QString readelfPath = AndroidConfigurations::instance().readelfPath(activeRunConfiguration()->abi().architecture());
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
+ if (!target->activeRunConfiguration())
+ return QStringList();
+
+ Utils::FileName readelfPath = AndroidConfigurations::instance().readelfPath(target->activeRunConfiguration()->abi().architecture());
QStringList libs;
- const Qt4Project *const qt4Project = qobject_cast<const Qt4Project *>(project());
- if (!qt4Project || !qt4Project->activeTarget()->activeQt4BuildConfiguration()->qtVersion())
+ const Qt4ProjectManager::Qt4Project *const qt4Project
+ = qobject_cast<const Qt4ProjectManager::Qt4Project *>(target->project());
+ if (!qt4Project || !version)
return libs;
- QString qtLibsPath = qt4Project->activeTarget()->activeQt4BuildConfiguration()->qtVersion()->versionInfo()[QLatin1String("QT_INSTALL_LIBS")];
- if (!QFile::exists(readelfPath)) {
+ QString qtLibsPath = version->versionInfo()[QLatin1String("QT_INSTALL_LIBS")];
+ if (!readelfPath.toFileInfo().exists()) {
QDirIterator libsIt(qtLibsPath, QStringList() << QLatin1String("libQt*.so"));
while (libsIt.hasNext()) {
libsIt.next();
@@ -787,7 +602,7 @@ QStringList AndroidTarget::availableQtLibs() const
while (it.hasNext()) {
libPath = it.next();
const QString library = libPath.absolutePath().mid(libPath.absolutePath().lastIndexOf(QLatin1Char('/')) + 1);
- mapLibs[library].dependencies = getDependencies(readelfPath, libPath.absolutePath());
+ mapLibs[library].dependencies = dependencies(readelfPath, libPath.absolutePath());
}
// clean dependencies
@@ -828,40 +643,169 @@ QStringList AndroidTarget::availableQtLibs() const
return libs;
}
-QIcon AndroidTarget::androidIcon(AndroidIconType type) const
+QStringList AndroidManager::qtLibs(ProjectExplorer::Target *target)
{
- switch (type) {
- case HighDPI:
- return QIcon(androidDirPath() + QLatin1String("/res/drawable-hdpi/icon.png"));
- case MediumDPI:
- return QIcon(androidDirPath() + QLatin1String("/res/drawable-mdpi/icon.png"));
- case LowDPI:
- return QIcon(androidDirPath() + QLatin1String("/res/drawable-ldpi/icon.png"));
+ return libsXml(target, QLatin1String("qt_libs"));
+}
+
+bool AndroidManager::setQtLibs(ProjectExplorer::Target *target, const QStringList &libs)
+{
+ return setLibsXml(target, libs, QLatin1String("qt_libs"));
+}
+
+QStringList AndroidManager::availablePrebundledLibs(ProjectExplorer::Target *target)
+{
+ QStringList libs;
+ Qt4ProjectManager::Qt4Project *qt4Project = qobject_cast<Qt4ProjectManager::Qt4Project *>(target->project());
+ if (!qt4Project)
+ return libs;
+
+ foreach (Qt4ProjectManager::Qt4ProFileNode *node, qt4Project->allProFiles())
+ if (node->projectType() == Qt4ProjectManager::LibraryTemplate)
+ libs << QLatin1String("lib") + node->targetInformation().target + QLatin1String(".so");
+ return libs;
+}
+
+QStringList AndroidManager::prebundledLibs(ProjectExplorer::Target *target)
+{
+ return libsXml(target, QLatin1String("bundled_libs"));
+}
+
+bool AndroidManager::setPrebundledLibs(ProjectExplorer::Target *target, const QStringList &libs)
+{
+ return setLibsXml(target, libs, QLatin1String("bundled_libs"));
+}
+
+bool AndroidManager::openLibsXml(ProjectExplorer::Target *target, QDomDocument &doc)
+{
+ return openXmlFile(target, doc, libsPath(target));
+}
+
+bool AndroidManager::saveLibsXml(ProjectExplorer::Target *target, QDomDocument &doc)
+{
+ return saveXmlFile(target, doc, libsPath(target));
+}
+
+AndroidManager::AndroidManager(QObject *parent) :
+ QObject(parent)
+{
+ m_instance = this;
+
+// ProjectExplorer::SessionManager *sm = ProjectExplorerPlugin::instance()->session();
+// connect(sm, SIGNAL(projectAdded(ProjectExplorer::Project*)),
+// this, SLOT(handleProjectAdditions(ProjectExplorer::Project*)));
+}
+
+void AndroidManager::raiseError(const QString &reason)
+{
+ QMessageBox::critical(0, tr("Error creating Android templates"), reason);
+}
+
+QString AndroidManager::loadLocal(ProjectExplorer::Target *target, int apiLevel, ItemType item)
+{
+ QString itemType;
+ if (item == Lib)
+ itemType = QLatin1String("lib");
+ else
+ itemType = QLatin1String("jar");
+
+ QString localLibs;
+
+ QDomDocument doc;
+ if (!openXmlFile(target, doc, localLibsRulesFilePath(target)))
+ return localLibs;
+
+ QStringList libs;
+ libs << qtLibs(target) << prebundledLibs(target);
+ QDomElement element = doc.documentElement().firstChildElement(QLatin1String("platforms")).firstChildElement(itemType + QLatin1Char('s')).firstChildElement(QLatin1String("version"));
+ while (!element.isNull()) {
+ if (element.attribute(QLatin1String("value")).toInt() == apiLevel) {
+ if (element.hasAttribute(QLatin1String("symlink")))
+ apiLevel = element.attribute(QLatin1String("symlink")).toInt();
+ break;
+ }
+ element = element.nextSiblingElement(QLatin1String("version"));
}
- return QIcon();
+
+ element = doc.documentElement().firstChildElement(QLatin1String("dependencies")).firstChildElement(QLatin1String("lib"));
+ while (!element.isNull()) {
+ if (libs.contains(element.attribute(QLatin1String("name")))) {
+ QDomElement libElement = element.firstChildElement(QLatin1String("depends")).firstChildElement(itemType);
+ while (!libElement.isNull()) {
+ localLibs += libElement.attribute(QLatin1String("file")).arg(apiLevel) + QLatin1Char(':');
+ libElement = libElement.nextSiblingElement(itemType);
+ }
+
+ libElement = element.firstChildElement(QLatin1String("replaces")).firstChildElement(itemType);
+ while (!libElement.isNull()) {
+ localLibs.replace(libElement.attribute(QLatin1String("file")).arg(apiLevel) + QLatin1Char(':'), QString());
+ libElement = libElement.nextSiblingElement(itemType);
+ }
+ }
+ element = element.nextSiblingElement(QLatin1String("lib"));
+ }
+ return localLibs;
+}
+
+bool AndroidManager::openXmlFile(ProjectExplorer::Target *target, QDomDocument &doc,
+ const Utils::FileName &fileName, bool createAndroidTemplates)
+{
+ if (createAndroidTemplates && !createAndroidTemplatesIfNecessary(target))
+ return false;
+
+ QFile f(fileName.toString());
+ if (!f.open(QIODevice::ReadOnly))
+ return false;
+
+ if (!doc.setContent(f.readAll())) {
+ raiseError(tr("Can't parse '%1'").arg(fileName.toUserOutput()));
+ return false;
+ }
+ return true;
}
-bool AndroidTarget::setAndroidIcon(AndroidIconType type, const QString &iconFileName) const
+bool AndroidManager::saveXmlFile(ProjectExplorer::Target *target, QDomDocument &doc, const Utils::FileName &fileName)
+{
+ if (!createAndroidTemplatesIfNecessary(target))
+ return false;
+
+ QFile f(fileName.toString());
+ if (!f.open(QIODevice::WriteOnly)) {
+ raiseError(tr("Can't open '%1'").arg(fileName.toUserOutput()));
+ return false;
+ }
+ return f.write(doc.toByteArray(4)) >= 0;
+}
+
+bool AndroidManager::openManifest(ProjectExplorer::Target *target, QDomDocument &doc)
+{
+ return openXmlFile(target, doc, manifestPath(target));
+}
+
+bool AndroidManager::saveManifest(ProjectExplorer::Target *target, QDomDocument &doc)
+{
+ return saveXmlFile(target, doc, manifestPath(target));
+}
+
+QString AndroidManager::iconPath(ProjectExplorer::Target *target, AndroidManager::IconType type)
{
switch (type) {
case HighDPI:
- QFile::remove(androidDirPath() + QLatin1String("/res/drawable-hdpi/icon.png"));
- return QFile::copy(iconFileName, androidDirPath() + QLatin1String("/res/drawable-hdpi/icon.png"));
+ return dirPath(target).appendPath(QLatin1String("res/drawable-hdpi/icon.png")).toString();
case MediumDPI:
- QFile::remove(androidDirPath() + QLatin1String("/res/drawable-mdpi/icon.png"));
- return QFile::copy(iconFileName, androidDirPath() + QLatin1String("/res/drawable-mdpi/icon.png"));
+ return dirPath(target).appendPath(QLatin1String("res/drawable-mdpi/icon.png")).toString();
case LowDPI:
- QFile::remove(androidDirPath() + QLatin1String("/res/drawable-ldpi/icon.png"));
- return QFile::copy(iconFileName, androidDirPath() + QLatin1String("/res/drawable-ldpi/icon.png"));
+ return dirPath(target).appendPath(QLatin1String("res/drawable-ldpi/icon.png")).toString();
+ default:
+ return QString();
}
- return false;
}
-QStringList AndroidTarget::libsXml(const QString &tag) const
+QStringList AndroidManager::libsXml(ProjectExplorer::Target *target, const QString &tag)
{
QStringList libs;
QDomDocument doc;
- if (!openLibsXml(doc))
+ if (!openLibsXml(target, doc))
return libs;
QDomElement arrayElem = doc.documentElement().firstChildElement(QLatin1String("array"));
while (!arrayElem.isNull()) {
@@ -878,10 +822,10 @@ QStringList AndroidTarget::libsXml(const QString &tag) const
return libs;
}
-bool AndroidTarget::setLibsXml(const QStringList &libs, const QString &tag) const
+bool AndroidManager::setLibsXml(ProjectExplorer::Target *target, const QStringList &libs, const QString &tag)
{
QDomDocument doc;
- if (!openLibsXml(doc))
+ if (!openLibsXml(target, doc))
return false;
QDomElement arrayElem = doc.documentElement().firstChildElement(QLatin1String("array"));
while (!arrayElem.isNull()) {
@@ -895,105 +839,83 @@ bool AndroidTarget::setLibsXml(const QStringList &libs, const QString &tag) cons
arrayElem.appendChild(item);
}
doc.documentElement().appendChild(arrayElem);
- return saveLibsXml(doc);
+ return saveLibsXml(target, doc);
}
arrayElem = arrayElem.nextSiblingElement(QLatin1String("array"));
}
return false;
}
-QStringList AndroidTarget::qtLibs() const
-{
- return libsXml(QLatin1String("qt_libs"));
-}
-
-bool AndroidTarget::setQtLibs(const QStringList &libs) const
-{
- return setLibsXml(libs, QLatin1String("qt_libs"));
-}
-
-QStringList AndroidTarget::availablePrebundledLibs() const
-{
- QStringList libs;
- Qt4Project *qt4Project = qobject_cast<Qt4Project *>(project());
- QList<Qt4Project *> qt4Projects;
- qt4Projects << qt4Project;
- foreach (Qt4Project *qt4Project, qt4Projects)
- foreach (Qt4ProFileNode *node, qt4Project->allProFiles())
- if (node->projectType() == LibraryTemplate)
- libs << QLatin1String("lib") + node->targetInformation().target + QLatin1String(".so");
-
- return libs;
-}
-
-QStringList AndroidTarget::prebundledLibs() const
+QIcon AndroidManager::icon(ProjectExplorer::Target *target, IconType type)
{
- return libsXml(QLatin1String("bundled_libs"));
+ return QIcon(iconPath(target, type));
}
-bool AndroidTarget::setPrebundledLibs(const QStringList &libs) const
+bool AndroidManager::setIcon(ProjectExplorer::Target *target, IconType type, const QString &iconFileName)
{
+ if (!QFileInfo(iconFileName).exists())
+ return false;
- return setLibsXml(libs, QLatin1String("bundled_libs"));
+ const QString path = iconPath(target, type);
+ QFile::remove(path);
+ return QFile::copy(iconFileName, path);
}
-QIcon AndroidTarget::highDpiIcon() const
+QStringList AndroidManager::dependencies(const Utils::FileName &readelfPath, const QString &lib)
{
- return androidIcon(HighDPI);
-}
+ QStringList libs;
-bool AndroidTarget::setHighDpiIcon(const QString &iconFilePath) const
-{
- return setAndroidIcon(HighDPI, iconFilePath);
-}
+ QProcess readelfProc;
+ readelfProc.start(readelfPath.toString(), QStringList() << QLatin1String("-d") << QLatin1String("-W") << lib);
-QIcon AndroidTarget::mediumDpiIcon() const
-{
- return androidIcon(MediumDPI);
-}
+ if (!readelfProc.waitForFinished(-1)) {
+ readelfProc.terminate();
+ return libs;
+ }
-bool AndroidTarget::setMediumDpiIcon(const QString &iconFilePath) const
-{
- return setAndroidIcon(MediumDPI, iconFilePath);
+ QList<QByteArray> lines = readelfProc.readAll().trimmed().split('\n');
+ foreach (const QByteArray &line, lines) {
+ if (line.contains("(NEEDED)") && line.contains("Shared library:") ) {
+ const int pos = line.lastIndexOf('[') + 1;
+ libs << QString::fromLatin1(line.mid(pos, line.lastIndexOf(']') - pos));
+ }
+ }
+ return libs;
}
-QIcon AndroidTarget::lowDpiIcon() const
+int AndroidManager::setLibraryLevel(const QString &library, LibrariesMap &mapLibs)
{
- return androidIcon(LowDPI);
-}
+ int maxlevel = mapLibs[library].level;
+ if (maxlevel > 0)
+ return maxlevel;
+ foreach (QString lib, mapLibs[library].dependencies) {
+ foreach (const QString &key, mapLibs.keys()) {
+ if (library == key)
+ continue;
+ if (key == lib) {
+ int libLevel = mapLibs[key].level;
-bool AndroidTarget::setLowDpiIcon(const QString &iconFilePath) const
-{
- return setAndroidIcon(LowDPI, iconFilePath);
-}
+ if (libLevel < 0)
+ libLevel = setLibraryLevel(key, mapLibs);
-QString AndroidTarget::targetSDK() const
-{
- if (!createAndroidTemplatesIfNecessary())
- return AndroidConfigurations::instance().bestMatch(QLatin1String("android-8"));
- QFile file(androidDefaultPropertiesPath());
- if (!file.open(QIODevice::ReadOnly))
- return AndroidConfigurations::instance().bestMatch(QLatin1String("android-8"));
- while (!file.atEnd()) {
- QByteArray line = file.readLine();
- if (line.startsWith("target="))
- return QString::fromLatin1(line.trimmed().mid(7));
+ if (libLevel > maxlevel)
+ maxlevel = libLevel;
+ break;
+ }
+ }
}
- return AndroidConfigurations::instance().bestMatch(QLatin1String("android-8"));
-}
-
-bool AndroidTarget::setTargetSDK(const QString &target) const
-{
- updateProject(target, applicationName());
- return true;
+ if (mapLibs[library].level < 0)
+ mapLibs[library].level = maxlevel + 1;
+ return maxlevel + 1;
}
-void AndroidTarget::raiseError(const QString &reason) const
+bool AndroidManager::qtLibrariesLessThan(const Library &a, const Library &b)
{
- QMessageBox::critical(0, tr("Error creating Android templates"), reason);
+ if (a.level == b.level)
+ return a.name < b.name;
+ return a.level < b.level;
}
-
} // namespace Internal
} // namespace Qt4ProjectManager
diff --git a/src/plugins/android/androidmanager.h b/src/plugins/android/androidmanager.h
new file mode 100644
index 0000000000..6c99b32563
--- /dev/null
+++ b/src/plugins/android/androidmanager.h
@@ -0,0 +1,177 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 BogDan Vatra <bog_dan_ro@yahoo.com>
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef ANDROIDMANAGER_H
+#define ANDROIDMANAGER_H
+
+#include <utils/fileutils.h>
+
+#include <QDomDocument>
+#include <QObject>
+#include <QStringList>
+
+namespace ProjectExplorer { class Target; }
+
+namespace Android {
+class AndroidPlugin;
+
+namespace Internal {
+
+class AndroidManager : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum BuildType
+ {
+ DebugBuild,
+ ReleaseBuildUnsigned,
+ ReleaseBuildSigned
+ };
+
+ static AndroidManager *instance();
+
+ ~AndroidManager();
+
+ static bool supportsAndroid(ProjectExplorer::Target *target);
+
+ static QString packageName(ProjectExplorer::Target *target);
+ static bool setPackageName(ProjectExplorer::Target *target, const QString &name);
+
+ static QString applicationName(ProjectExplorer::Target *target);
+ static bool setApplicationName(ProjectExplorer::Target *target, const QString &name);
+
+ static QStringList permissions(ProjectExplorer::Target *target);
+ static bool setPermissions(ProjectExplorer::Target *target, const QStringList &permissions);
+
+ static QString intentName(ProjectExplorer::Target *target);
+ static QString activityName(ProjectExplorer::Target *target);
+
+ static int versionCode(ProjectExplorer::Target *target);
+ static bool setVersionCode(ProjectExplorer::Target *target, int version);
+ static QString versionName(ProjectExplorer::Target *target);
+ static bool setVersionName(ProjectExplorer::Target *target, const QString &version);
+
+ static QIcon highDpiIcon(ProjectExplorer::Target *target);
+ static bool setHighDpiIcon(ProjectExplorer::Target *target, const QString &iconFilePath);
+ static QIcon mediumDpiIcon(ProjectExplorer::Target *target);
+ static bool setMediumDpiIcon(ProjectExplorer::Target *target, const QString &iconFilePath);
+ static QIcon lowDpiIcon(ProjectExplorer::Target *target);
+ static bool setLowDpiIcon(ProjectExplorer::Target *target, const QString &iconFilePath);
+
+ static QStringList availableTargetApplications(ProjectExplorer::Target *target);
+ static QString targetApplication(ProjectExplorer::Target *target);
+ static bool setTargetApplication(ProjectExplorer::Target *target, const QString &name);
+ static QString targetApplicationPath(ProjectExplorer::Target *target);
+
+ static QString targetSDK(ProjectExplorer::Target *target);
+ static bool setTargetSDK(ProjectExplorer::Target *target, const QString &sdk);
+
+ static Utils::FileName dirPath(ProjectExplorer::Target *target);
+ static Utils::FileName manifestPath(ProjectExplorer::Target *target);
+ static Utils::FileName libsPath(ProjectExplorer::Target *target);
+ static Utils::FileName stringsPath(ProjectExplorer::Target *target);
+ static Utils::FileName defaultPropertiesPath(ProjectExplorer::Target *target);
+ static Utils::FileName srcPath(ProjectExplorer::Target *target);
+ static Utils::FileName apkPath(ProjectExplorer::Target *target, BuildType buildType);
+
+ static bool createAndroidTemplatesIfNecessary(ProjectExplorer::Target *target);
+ static void updateTarget(ProjectExplorer::Target *target, const QString &targetSDK,
+ const QString &name = QString());
+
+ static Utils::FileName localLibsRulesFilePath(ProjectExplorer::Target *target);
+ static QString loadLocalLibs(ProjectExplorer::Target *target, int apiLevel);
+ static QString loadLocalJars(ProjectExplorer::Target *target, int apiLevel);
+
+ static QStringList availableQtLibs(ProjectExplorer::Target *target);
+ static QStringList qtLibs(ProjectExplorer::Target *target);
+ static bool setQtLibs(ProjectExplorer::Target *target, const QStringList &libs);
+
+ static QStringList availablePrebundledLibs(ProjectExplorer::Target *target);
+ static QStringList prebundledLibs(ProjectExplorer::Target *target);
+ static bool setPrebundledLibs(ProjectExplorer::Target *target, const QStringList &libs);
+
+private:
+ explicit AndroidManager(QObject *parent = 0);
+
+ static void raiseError(const QString &reason);
+ static bool openXmlFile(ProjectExplorer::Target *target, QDomDocument &doc,
+ const Utils::FileName &fileName, bool createAndroidTemplates = false);
+ static bool saveXmlFile(ProjectExplorer::Target *target, QDomDocument &doc, const Utils::FileName &fileName);
+ static bool openManifest(ProjectExplorer::Target *target, QDomDocument &doc);
+ static bool saveManifest(ProjectExplorer::Target *target, QDomDocument &doc);
+ static bool openLibsXml(ProjectExplorer::Target *target, QDomDocument &doc);
+ static bool saveLibsXml(ProjectExplorer::Target *target, QDomDocument &doc);
+ static QStringList libsXml(ProjectExplorer::Target *target, const QString &tag);
+ static bool setLibsXml(ProjectExplorer::Target *target, const QStringList &libs, const QString &tag);
+
+ enum ItemType
+ {
+ Lib,
+ Jar
+ };
+ static QString loadLocal(ProjectExplorer::Target *target, int apiLevel, ItemType item);
+
+ class Library
+ {
+ public:
+ Library()
+ { level = -1; }
+ int level;
+ QStringList dependencies;
+ QString name;
+ };
+ typedef QMap<QString, Library> LibrariesMap;
+
+ enum IconType
+ {
+ HighDPI,
+ MediumDPI,
+ LowDPI
+ };
+ static QString iconPath(ProjectExplorer::Target *target, IconType type);
+ static QIcon icon(ProjectExplorer::Target *target, IconType type);
+ static bool setIcon(ProjectExplorer::Target *target, IconType type, const QString &iconFileName);
+
+ static QStringList dependencies(const Utils::FileName &readelfPath, const QString &lib);
+ static int setLibraryLevel(const QString &library, LibrariesMap &mapLibs);
+ static bool qtLibrariesLessThan(const Library &a, const Library &b);
+
+ static AndroidManager *m_instance;
+
+ friend class Android::AndroidPlugin;
+};
+
+} // namespace Internal
+} // namespace Android
+
+#endif // ANDROIDMANAGER_H
diff --git a/src/plugins/android/androidpackagecreationfactory.cpp b/src/plugins/android/androidpackagecreationfactory.cpp
index 7b3429cf72..019b258243 100644
--- a/src/plugins/android/androidpackagecreationfactory.cpp
+++ b/src/plugins/android/androidpackagecreationfactory.cpp
@@ -33,11 +33,14 @@
#include "androidpackagecreationfactory.h"
#include "androidpackagecreationstep.h"
+#include "androidmanager.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
#include <QCoreApplication>
@@ -54,11 +57,13 @@ AndroidPackageCreationFactory::AndroidPackageCreationFactory(QObject *parent)
QList<Core::Id> AndroidPackageCreationFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
{
- if (parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
- && parent->target()->id() == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)
- && !parent->contains(AndroidPackageCreationStep::CreatePackageId))
- return QList<Core::Id>() << AndroidPackageCreationStep::CreatePackageId;
- return QList<Core::Id>();
+ if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY))
+ return QList<Core::Id>();
+ if (!AndroidManager::supportsAndroid(parent->target()))
+ return QList<Core::Id>();
+ if (parent->contains(AndroidPackageCreationStep::CreatePackageId))
+ return QList<Core::Id>();
+ return QList<Core::Id>() << AndroidPackageCreationStep::CreatePackageId;
}
QString AndroidPackageCreationFactory::displayNameForId(const Core::Id id) const
@@ -71,10 +76,7 @@ QString AndroidPackageCreationFactory::displayNameForId(const Core::Id id) const
bool AndroidPackageCreationFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
{
- return parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
- && id == Core::Id(AndroidPackageCreationStep::CreatePackageId)
- && parent->target()->id() == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)
- && !parent->contains(AndroidPackageCreationStep::CreatePackageId);
+ return availableCreationIds(parent).contains(id);
}
BuildStep *AndroidPackageCreationFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
diff --git a/src/plugins/android/androidpackagecreationstep.cpp b/src/plugins/android/androidpackagecreationstep.cpp
index f42a4e834f..dccfe9423b 100644
--- a/src/plugins/android/androidpackagecreationstep.cpp
+++ b/src/plugins/android/androidpackagecreationstep.cpp
@@ -36,15 +36,15 @@
#include "androiddeploystep.h"
#include "androidglobal.h"
#include "androidpackagecreationwidget.h"
-#include "androidtarget.h"
+#include "androidmanager.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfiguration.h>
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4project.h>
#include <qt4projectmanager/qt4nodes.h>
-#include <qt4projectmanager/qt4target.h>
#include <coreplugin/icore.h>
#include <coreplugin/fileutils.h>
@@ -142,35 +142,35 @@ void AndroidPackageCreationStep::ctor()
bool AndroidPackageCreationStep::init()
{
- AndroidTarget *target = androidTarget();
- const Qt4BuildConfiguration *bc = target->activeQt4BuildConfiguration();
- if (!target) {
- raiseError(tr("Cannot create android package: current target is not android."));
+ const Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(target()->activeBuildConfiguration());
+ if (!bc) {
+ raiseError(tr("Cannot create android package: current build configuration is not Qt4."));
return false;
}
- m_outputParser.setProjectFileList(target->qt4Project()->files(Project::AllFiles));
+ Qt4Project *project = static_cast<Qt4Project *>(target()->project());
+ m_outputParser.setProjectFileList(project->files(Project::AllFiles));
// Copying
- m_androidDir = target->androidDirPath();
- QString androidLibPath;
- if (target->qt4Project()->rootQt4ProjectNode()->variableValue(Qt4ProjectManager::ConfigVar).contains(QLatin1String("x86")))
- androidLibPath = m_androidDir + QLatin1String("/libs/x86");
- else if (target->qt4Project()->rootQt4ProjectNode()
+ m_androidDir = AndroidManager::dirPath(target());
+ Utils::FileName androidLibPath;
+ if (project->rootQt4ProjectNode()->variableValue(Qt4ProjectManager::ConfigVar).contains(QLatin1String("x86")))
+ androidLibPath = m_androidDir.appendPath(QLatin1String("libs/x86"));
+ else if (project->rootQt4ProjectNode()
->variableValue(Qt4ProjectManager::ConfigVar).contains(QLatin1String("armeabi-v7a")))
- androidLibPath = m_androidDir + QLatin1String("/libs/armeabi-v7a");
+ androidLibPath = m_androidDir.appendPath(QLatin1String("libs/armeabi-v7a"));
else
- androidLibPath = m_androidDir + QLatin1String("/libs/armeabi");
- m_gdbServerDestination = androidLibPath + QLatin1String("/gdbserver");
- m_gdbServerSource = AndroidConfigurations::instance().gdbServerPath(target->activeRunConfiguration()->abi().architecture());
+ androidLibPath = m_androidDir.appendPath(QLatin1String("libs/armeabi"));
+ m_gdbServerDestination = androidLibPath.appendPath(QLatin1String("gdbserver"));
+ m_gdbServerSource = AndroidConfigurations::instance().gdbServerPath(target()->activeRunConfiguration()->abi().architecture());
m_debugBuild = bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild;
- if (!target->createAndroidTemplatesIfNecessary())
+ if (!AndroidManager::createAndroidTemplatesIfNecessary(target()))
return false;
- target->updateProject(target->targetSDK(), target->applicationName());
+ AndroidManager::updateTarget(target(), AndroidManager::targetSDK(target()), AndroidManager::applicationName(target()));
m_antToolPath = AndroidConfigurations::instance().antToolPath();
- m_apkPathUnsigned = target->apkPath(AndroidTarget::ReleaseBuildUnsigned);
- m_apkPathSigned = target->apkPath(AndroidTarget::ReleaseBuildSigned);
+ m_apkPathUnsigned = AndroidManager::apkPath(target(), AndroidManager::ReleaseBuildUnsigned);
+ m_apkPathSigned = AndroidManager::apkPath(target(), AndroidManager::ReleaseBuildSigned);
m_keystorePathForRun = m_keystorePath;
m_certificatePasswdForRun = m_certificatePasswd;
m_jarSigner = AndroidConfigurations::instance().jarsignerPath();
@@ -188,15 +188,10 @@ BuildStepConfigWidget *AndroidPackageCreationStep::createConfigWidget()
return new AndroidPackageCreationWidget(this);
}
-AndroidTarget *AndroidPackageCreationStep::androidTarget() const
-{
- return qobject_cast<AndroidTarget *>(target());
-}
-
void AndroidPackageCreationStep::checkRequiredLibraries()
{
QProcess readelfProc;
- QString appPath = androidTarget()->targetApplicationPath();
+ QString appPath = AndroidManager::targetApplicationPath(target());
if (!QFile::exists(appPath)) {
raiseError(tr("Cannot find read elf information"),
tr("Cannot find '%1'.\n"
@@ -204,7 +199,7 @@ void AndroidPackageCreationStep::checkRequiredLibraries()
"built successfully and is selected in Application tab ('Run option') ").arg(appPath));
return;
}
- readelfProc.start(AndroidConfigurations::instance().readelfPath(androidTarget()->activeRunConfiguration()->abi().architecture()),
+ readelfProc.start(AndroidConfigurations::instance().readelfPath(target()->activeRunConfiguration()->abi().architecture()).toString(),
QStringList() << QLatin1String("-d") << QLatin1String("-W") << appPath);
if (!readelfProc.waitForFinished(-1)) {
readelfProc.terminate();
@@ -218,44 +213,44 @@ void AndroidPackageCreationStep::checkRequiredLibraries()
libs << QString::fromLatin1(line.mid(pos, line.length() - pos - 1));
}
}
- QStringList checkedLibs = androidTarget()->qtLibs();
+ QStringList checkedLibs = AndroidManager::qtLibs(target());
QStringList requiredLibraries;
- foreach (const QString &qtLib, androidTarget()->availableQtLibs()) {
+ foreach (const QString &qtLib, AndroidManager::availableQtLibs(target())) {
if (libs.contains(QLatin1String("lib") + qtLib + QLatin1String(".so")) || checkedLibs.contains(qtLib))
requiredLibraries << qtLib;
}
- androidTarget()->setQtLibs(requiredLibraries);
+ AndroidManager::setQtLibs(target(), requiredLibraries);
- checkedLibs = androidTarget()->prebundledLibs();
+ checkedLibs = AndroidManager::prebundledLibs(target());
requiredLibraries.clear();
- foreach (const QString &qtLib, androidTarget()->availableQtLibs()) {
+ foreach (const QString &qtLib, AndroidManager::availableQtLibs(target())) {
if (libs.contains(qtLib) || checkedLibs.contains(qtLib))
requiredLibraries << qtLib;
}
- androidTarget()->setPrebundledLibs(requiredLibraries);
+ AndroidManager::setPrebundledLibs(target(), requiredLibraries);
emit updateRequiredLibrariesModels();
}
void AndroidPackageCreationStep::initCheckRequiredLibrariesForRun()
{
- m_appPath = androidTarget()->targetApplicationPath();
- m_readElf = AndroidConfigurations::instance().readelfPath(androidTarget()->activeRunConfiguration()->abi().architecture());
- m_qtLibs = androidTarget()->qtLibs();
- m_availableQtLibs = androidTarget()->availableQtLibs();
- m_prebundledLibs = androidTarget()->prebundledLibs();
+ m_appPath = Utils::FileName::fromString(AndroidManager::targetApplicationPath(target()));
+ m_readElf = AndroidConfigurations::instance().readelfPath(target()->activeRunConfiguration()->abi().architecture());
+ m_qtLibs = AndroidManager::qtLibs(target());
+ m_availableQtLibs = AndroidManager::availableQtLibs(target());
+ m_prebundledLibs = AndroidManager::prebundledLibs(target());
}
void AndroidPackageCreationStep::checkRequiredLibrariesForRun()
{
QProcess readelfProc;
- if (!QFile::exists(m_appPath)) {
- raiseError(tr("Cannot find read elf information"),
+ if (!m_appPath.toFileInfo().exists()) {
+ raiseError(tr("Can't find read elf information"),
tr("Can't find '%1'.\n"
"Please make sure your application is "
- "built successfully and is selected in Application tab ('Run option') ").arg(m_appPath));
+ "built successfully and is selected in Application tab ('Run option') ").arg(m_appPath.toUserOutput()));
return;
}
- readelfProc.start(m_readElf, QStringList() << QLatin1String("-d") << QLatin1String("-W") << m_appPath);
+ readelfProc.start(m_readElf.toString(), QStringList() << QLatin1String("-d") << QLatin1String("-W") << m_appPath.toUserOutput());
if (!readelfProc.waitForFinished(-1)) {
readelfProc.terminate();
return;
@@ -290,20 +285,20 @@ void AndroidPackageCreationStep::checkRequiredLibrariesForRun()
void AndroidPackageCreationStep::setQtLibs(const QStringList &qtLibs)
{
- androidTarget()->setQtLibs(qtLibs);
+ AndroidManager::setQtLibs(target(), qtLibs);
}
void AndroidPackageCreationStep::setPrebundledLibs(const QStringList &prebundledLibs)
{
- androidTarget()->setPrebundledLibs(prebundledLibs);
+ AndroidManager::setPrebundledLibs(target(), prebundledLibs);
}
-QString AndroidPackageCreationStep::keystorePath()
+Utils::FileName AndroidPackageCreationStep::keystorePath()
{
return m_keystorePath;
}
-void AndroidPackageCreationStep::setKeystorePath(const QString &path)
+void AndroidPackageCreationStep::setKeystorePath(const Utils::FileName &path)
{
m_keystorePath = path;
m_certificatePasswd.clear();
@@ -336,13 +331,13 @@ QAbstractItemModel *AndroidPackageCreationStep::keystoreCertificates()
QProcess keytoolProc;
while (!rawCerts.length() || !m_keystorePasswd.length()) {
QStringList params;
- params << QLatin1String("-list") << QLatin1String("-v") << QLatin1String("-keystore") << m_keystorePathForRun << QLatin1String("-storepass");
+ params << QLatin1String("-list") << QLatin1String("-v") << QLatin1String("-keystore") << m_keystorePathForRun.toUserOutput() << QLatin1String("-storepass");
if (!m_keystorePasswd.length())
keystorePassword();
if (!m_keystorePasswd.length())
return 0;
params << m_keystorePasswd;
- keytoolProc.start(AndroidConfigurations::instance().keytoolPath(), params);
+ keytoolProc.start(AndroidConfigurations::instance().keytoolPath().toString(), params);
if (!keytoolProc.waitForStarted() || !keytoolProc.waitForFinished()) {
QMessageBox::critical(0, tr("Error"),
tr("Failed to run keytool"));
@@ -363,14 +358,14 @@ bool AndroidPackageCreationStep::fromMap(const QVariantMap &map)
{
if (!BuildStep::fromMap(map))
return false;
- m_keystorePath = map.value(KeystoreLocationKey).toString();
+ m_keystorePath = Utils::FileName::fromString(map.value(KeystoreLocationKey).toString());
return true;
}
QVariantMap AndroidPackageCreationStep::toMap() const
{
QVariantMap map(BuildStep::toMap());
- map.insert(KeystoreLocationKey, m_keystorePath);
+ map.insert(KeystoreLocationKey, m_keystorePath.toString());
return map;
}
@@ -382,12 +377,12 @@ bool AndroidPackageCreationStep::createPackage()
QStringList build;
build << QLatin1String("clean");
- QFile::remove(m_gdbServerDestination);
+ QFile::remove(m_gdbServerDestination.toString());
if (m_debugBuild || !m_certificateAlias.length()) {
build << QLatin1String("debug");
- if (!QFile::copy(m_gdbServerSource, m_gdbServerDestination)) {
- raiseError(tr("Cannot copy gdbserver from '%1' to '%2'").arg(m_gdbServerSource)
- .arg(m_gdbServerDestination));
+ if (!QFile::copy(m_gdbServerSource.toString(), m_gdbServerDestination.toString())) {
+ raiseError(tr("Can't copy gdbserver from '%1' to '%2'").arg(m_gdbServerSource.toUserOutput())
+ .arg(m_gdbServerDestination.toUserOutput()));
return false;
}
} else {
@@ -403,9 +398,9 @@ bool AndroidPackageCreationStep::createPackage()
connect(buildProc, SIGNAL(readyReadStandardError()), this,
SLOT(handleBuildStdErrOutput()));
- buildProc->setWorkingDirectory(m_androidDir);
+ buildProc->setWorkingDirectory(m_androidDir.toString());
- if (!runCommand(buildProc, m_antToolPath, build)) {
+ if (!runCommand(buildProc, m_antToolPath.toString(), build)) {
disconnect(buildProc, 0, this, 0);
buildProc->deleteLater();
return false;
@@ -425,11 +420,11 @@ bool AndroidPackageCreationStep::createPackage()
QByteArray keyPass = m_certificatePasswdForRun.toUtf8();
build.clear();
- build << QLatin1String("-verbose") << QLatin1String("-keystore") << m_keystorePathForRun
+ build << QLatin1String("-verbose") << QLatin1String("-keystore") << m_keystorePathForRun.toUserOutput()
<< QLatin1String("-storepass") << m_keystorePasswd
- << m_apkPathUnsigned
+ << m_apkPathUnsigned.toUserOutput()
<< m_certificateAlias;
- buildProc->start(m_jarSigner, build); //TODO
+ buildProc->start(m_jarSigner.toString(), build); //TODO
if (!buildProc->waitForStarted()) {
disconnect(buildProc, 0, this, 0);
buildProc->deleteLater();
@@ -446,9 +441,9 @@ bool AndroidPackageCreationStep::createPackage()
emit addOutput(tr("Failed, try again"), ErrorMessageOutput);
m_certificatePasswdForRun.clear();
}
- if (QFile::rename(m_apkPathUnsigned, m_apkPathSigned)) {
+ if (QFile::rename(m_apkPathUnsigned.toString(), m_apkPathSigned.toString())) {
emit addOutput(tr("Release signed package created to %1")
- .arg(m_apkPathSigned)
+ .arg(m_apkPathSigned.toUserOutput())
, MessageOutput);
if (m_openPackageLocation)
@@ -465,7 +460,8 @@ void AndroidPackageCreationStep::stripAndroidLibs(const QStringList & files, Abi
{
QProcess stripProcess;
foreach (const QString &file, files) {
- stripProcess.start(AndroidConfigurations::instance().stripPath(architecture), QStringList()<<QLatin1String("--strip-unneeded") << file);
+ stripProcess.start(AndroidConfigurations::instance().stripPath(architecture).toString(),
+ QStringList()<<QLatin1String("--strip-unneeded") << file);
stripProcess.waitForStarted();
if (!stripProcess.waitForFinished())
stripProcess.terminate();
@@ -573,7 +569,7 @@ void AndroidPackageCreationStep::certificatePassword()
void AndroidPackageCreationStep::showInGraphicalShell()
{
- Core::FileUtils::showInGraphicalShell(Core::ICore::instance()->mainWindow(), m_apkPathSigned);
+ Core::FileUtils::showInGraphicalShell(Core::ICore::instance()->mainWindow(), m_apkPathSigned.toString());
}
void AndroidPackageCreationStep::raiseError(const QString &shortMsg,
diff --git a/src/plugins/android/androidpackagecreationstep.h b/src/plugins/android/androidpackagecreationstep.h
index 9815d0be13..4c530c53af 100644
--- a/src/plugins/android/androidpackagecreationstep.h
+++ b/src/plugins/android/androidpackagecreationstep.h
@@ -50,7 +50,6 @@ class Qt4BuildConfiguration;
namespace Android {
namespace Internal {
-class AndroidTarget;
class AndroidPackageCreationStep : public ProjectExplorer::BuildStep
{
@@ -66,14 +65,12 @@ public:
static const QLatin1String DefaultVersionNumber;
- AndroidTarget *androidTarget() const;
-
void checkRequiredLibraries();
void initCheckRequiredLibrariesForRun();
void checkRequiredLibrariesForRun();
- QString keystorePath();
- void setKeystorePath(const QString &path);
+ Utils::FileName keystorePath();
+ void setKeystorePath(const Utils::FileName &path);
void setKeystorePassword(const QString &pwd);
void setCertificateAlias(const QString &alias);
void setCertificatePassword(const QString &pwd);
@@ -110,7 +107,7 @@ private:
static const Core::Id CreatePackageId;
private:
- QString m_keystorePath;
+ Utils::FileName m_keystorePath;
QString m_keystorePasswd;
QString m_certificateAlias;
QString m_certificatePasswd;
@@ -118,19 +115,19 @@ private:
JavaParser m_outputParser;
// members to pass data from init() to run()
- QString m_androidDir;
- QString m_gdbServerSource;
- QString m_gdbServerDestination;
+ Utils::FileName m_androidDir;
+ Utils::FileName m_gdbServerSource;
+ Utils::FileName m_gdbServerDestination;
bool m_debugBuild;
- QString m_antToolPath;
- QString m_apkPathUnsigned;
- QString m_apkPathSigned;
- QString m_keystorePathForRun;
+ Utils::FileName m_antToolPath;
+ Utils::FileName m_apkPathUnsigned;
+ Utils::FileName m_apkPathSigned;
+ Utils::FileName m_keystorePathForRun;
QString m_certificatePasswdForRun;
- QString m_jarSigner;
+ Utils::FileName m_jarSigner;
// more for checkLibraries
- QString m_appPath;
- QString m_readElf;
+ Utils::FileName m_appPath;
+ Utils::FileName m_readElf;
QStringList m_qtLibs;
QStringList m_availableQtLibs;
QStringList m_prebundledLibs;
diff --git a/src/plugins/android/androidpackagecreationwidget.cpp b/src/plugins/android/androidpackagecreationwidget.cpp
index e1d62e0fe6..046ec769f0 100644
--- a/src/plugins/android/androidpackagecreationwidget.cpp
+++ b/src/plugins/android/androidpackagecreationwidget.cpp
@@ -34,7 +34,7 @@
#include "androidpackagecreationstep.h"
#include "androidconfigurations.h"
#include "androidcreatekeystorecertificate.h"
-#include "androidtarget.h"
+#include "androidmanager.h"
#include "ui_androidpackagecreationwidget.h"
#include <projectexplorer/project.h>
@@ -49,6 +49,7 @@
#include <QTimer>
#include <QFileDialog>
+#include <QFileSystemWatcher>
#include <QMessageBox>
namespace Android {
@@ -203,7 +204,8 @@ int PermissionsModel::rowCount(const QModelIndex &parent) const
AndroidPackageCreationWidget::AndroidPackageCreationWidget(AndroidPackageCreationStep *step)
: ProjectExplorer::BuildStepConfigWidget(),
m_step(step),
- m_ui(new Ui::AndroidPackageCreationWidget)
+ m_ui(new Ui::AndroidPackageCreationWidget),
+ m_fileSystemWatcher(new QFileSystemWatcher(this))
{
m_qtLibsModel = new CheckModel(this);
m_prebundledLibs = new CheckModel(this);
@@ -219,10 +221,16 @@ AndroidPackageCreationWidget::AndroidPackageCreationWidget(AndroidPackageCreatio
void AndroidPackageCreationWidget::initGui()
{
updateAndroidProjectInfo();
- AndroidTarget *target = m_step->androidTarget();
- connect(target,
- SIGNAL(androidDirContentsChanged()),
- this, SLOT(updateAndroidProjectInfo()));
+ ProjectExplorer::Target *target = m_step->target();
+
+ m_fileSystemWatcher->addPath(AndroidManager::dirPath(target).toString());
+ m_fileSystemWatcher->addPath(AndroidManager::manifestPath(target).toString());
+ m_fileSystemWatcher->addPath(AndroidManager::srcPath(target).toString());
+ connect(m_fileSystemWatcher, SIGNAL(directoryChanged(QString)),
+ this, SIGNAL(updateAndroidProjectInfo()));
+ connect(m_fileSystemWatcher, SIGNAL(fileChanged(QString)), this,
+ SIGNAL(updateAndroidProjectInfo()));
+
m_ui->packageNameLineEdit->setValidator(new QRegExpValidator(QRegExp(packageNameRegExp), this));
connect(m_ui->packageNameLineEdit, SIGNAL(editingFinished()), SLOT(setPackageName()));
connect(m_ui->appNameLineEdit, SIGNAL(editingFinished()), SLOT(setApplicationName()));
@@ -251,49 +259,50 @@ void AndroidPackageCreationWidget::initGui()
m_ui->qtLibsListView->setModel(m_qtLibsModel);
m_ui->prebundledLibsListView->setModel(m_prebundledLibs);
m_ui->permissionsListView->setModel(m_permissionsModel);
- m_ui->KeystoreLocationLineEdit->setText(m_step->keystorePath());
+ m_ui->KeystoreLocationLineEdit->setText(m_step->keystorePath().toUserOutput());
}
void AndroidPackageCreationWidget::updateAndroidProjectInfo()
{
- AndroidTarget *target = m_step->androidTarget();
+ ProjectExplorer::Target *target = m_step->target();
+ const QString packageName = AndroidManager::packageName(target);
m_ui->targetSDKComboBox->clear();
QStringList targets = AndroidConfigurations::instance().sdkTargets();
m_ui->targetSDKComboBox->addItems(targets);
- m_ui->targetSDKComboBox->setCurrentIndex(targets.indexOf(target->targetSDK()));
- m_ui->packageNameLineEdit->setText(target->packageName());
- m_ui->appNameLineEdit->setText(target->applicationName());
+ m_ui->targetSDKComboBox->setCurrentIndex(targets.indexOf(AndroidManager::targetSDK(target)));
+ m_ui->packageNameLineEdit->setText(packageName);
+ m_ui->appNameLineEdit->setText(AndroidManager::applicationName(target));
if (!m_ui->appNameLineEdit->text().length()) {
QString applicationName = target->project()->displayName();
- target->setPackageName(target->packageName() + QLatin1Char('.') + applicationName);
- m_ui->packageNameLineEdit->setText(target->packageName());
- if (applicationName.length())
+ AndroidManager::setPackageName(target, packageName + QLatin1Char('.') + applicationName);
+ m_ui->packageNameLineEdit->setText(packageName);
+ if (!applicationName.isEmpty())
applicationName[0] = applicationName[0].toUpper();
m_ui->appNameLineEdit->setText(applicationName);
- target->setApplicationName(applicationName);
+ AndroidManager::setApplicationName(target, applicationName);
}
- m_ui->versionCode->setValue(target->versionCode());
- m_ui->versionNameLinedit->setText(target->versionName());
+ m_ui->versionCode->setValue(AndroidManager::versionCode(target));
+ m_ui->versionNameLinedit->setText(AndroidManager::versionName(target));
- m_qtLibsModel->setAvailableItems(target->availableQtLibs());
- m_qtLibsModel->setCheckedItems(target->qtLibs());
- m_prebundledLibs->setAvailableItems(target->availablePrebundledLibs());
- m_prebundledLibs->setCheckedItems(target->prebundledLibs());
+ m_qtLibsModel->setAvailableItems(AndroidManager::availableQtLibs(target));
+ m_qtLibsModel->setCheckedItems(AndroidManager::qtLibs(target));
+ m_prebundledLibs->setAvailableItems(AndroidManager::availablePrebundledLibs(target));
+ m_prebundledLibs->setCheckedItems(AndroidManager::prebundledLibs(target));
- m_permissionsModel->setPermissions(target->permissions());
+ m_permissionsModel->setPermissions(AndroidManager::permissions(target));
m_ui->removePermissionButton->setEnabled(m_permissionsModel->permissions().size());
- targets = target->availableTargetApplications();
+ targets = AndroidManager::availableTargetApplications(target);
m_ui->targetComboBox->clear();
m_ui->targetComboBox->addItems(targets);
- m_ui->targetComboBox->setCurrentIndex(targets.indexOf(target->targetApplication()));
+ m_ui->targetComboBox->setCurrentIndex(targets.indexOf(AndroidManager::targetApplication(target)));
if (m_ui->targetComboBox->currentIndex() == -1 && targets.count()) {
m_ui->targetComboBox->setCurrentIndex(0);
- target->setTargetApplication(m_ui->targetComboBox->currentText());
+ AndroidManager::setTargetApplication(target, m_ui->targetComboBox->currentText());
}
- m_ui->hIconButton->setIcon(target->highDpiIcon());
- m_ui->mIconButton->setIcon(target->mediumDpiIcon());
- m_ui->lIconButton->setIcon(target->lowDpiIcon());
+ m_ui->hIconButton->setIcon(AndroidManager::highDpiIcon(target));
+ m_ui->mIconButton->setIcon(AndroidManager::mediumDpiIcon(target));
+ m_ui->lIconButton->setIcon(AndroidManager::lowDpiIcon(target));
}
void AndroidPackageCreationWidget::setPackageName()
@@ -308,26 +317,27 @@ void AndroidPackageCreationWidget::setPackageName()
m_ui->packageNameLineEdit->setFocus();
return;
}
- m_step->androidTarget()->setPackageName(packageName);
+ AndroidManager::setPackageName(m_step->target(), packageName);
}
void AndroidPackageCreationWidget::setApplicationName()
{
- m_step->androidTarget()->setApplicationName(m_ui->appNameLineEdit->text());
+ AndroidManager::setApplicationName(m_step->target(), m_ui->appNameLineEdit->text());
}
-void AndroidPackageCreationWidget::setTargetSDK(const QString &target)
+void AndroidPackageCreationWidget::setTargetSDK(const QString &sdk)
{
- m_step->androidTarget()->setTargetSDK(target);
- Qt4BuildConfiguration *bc = m_step->androidTarget()->activeQt4BuildConfiguration();
- ProjectExplorer::BuildManager *bm = ProjectExplorer::ProjectExplorerPlugin::instance()->buildManager();
+ AndroidManager::setTargetSDK(m_step->target(), sdk);
+ Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(m_step->target()->activeBuildConfiguration());
+ if (!bc)
+ return;
QMakeStep *qs = bc->qmakeStep();
-
if (!qs)
return;
qs->setForced(true);
+ ProjectExplorer::BuildManager *bm = ProjectExplorer::ProjectExplorerPlugin::instance()->buildManager();
bm->buildList(bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_CLEAN)),
ProjectExplorer::ProjectExplorerPlugin::displayNameForStepId(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_CLEAN)));
bm->appendStep(qs, ProjectExplorer::ProjectExplorerPlugin::displayNameForStepId(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_CLEAN)));
@@ -341,27 +351,27 @@ void AndroidPackageCreationWidget::setTargetSDK(const QString &target)
void AndroidPackageCreationWidget::setVersionCode()
{
- m_step->androidTarget()->setVersionCode(m_ui->versionCode->value());
+ AndroidManager::setVersionCode(m_step->target(), m_ui->versionCode->value());
}
void AndroidPackageCreationWidget::setVersionName()
{
- m_step->androidTarget()->setVersionName(m_ui->versionNameLinedit->text());
+ AndroidManager::setVersionName(m_step->target(), m_ui->versionNameLinedit->text());
}
void AndroidPackageCreationWidget::setTarget(const QString &target)
{
- m_step->androidTarget()->setTargetApplication(target);
+ AndroidManager::setTargetApplication(m_step->target(), target);
}
void AndroidPackageCreationWidget::setQtLibs(QModelIndex, QModelIndex)
{
- m_step->androidTarget()->setQtLibs(m_qtLibsModel->checkedItems());
+ AndroidManager::setQtLibs(m_step->target(), m_qtLibsModel->checkedItems());
}
void AndroidPackageCreationWidget::setPrebundledLibs(QModelIndex, QModelIndex)
{
- m_step->androidTarget()->setPrebundledLibs(m_prebundledLibs->checkedItems());
+ AndroidManager::setPrebundledLibs(m_step->target(), m_prebundledLibs->checkedItems());
}
void AndroidPackageCreationWidget::prebundledLibSelected(const QModelIndex &index)
@@ -395,8 +405,8 @@ void AndroidPackageCreationWidget::setHDPIIcon()
QString file = QFileDialog::getOpenFileName(this, tr("Choose High DPI Icon"), QDir::homePath(), tr("png images (*.png)"));
if (!file.length())
return;
- m_step->androidTarget()->setHighDpiIcon(file);
- m_ui->hIconButton->setIcon(m_step->androidTarget()->highDpiIcon());
+ AndroidManager::setHighDpiIcon(m_step->target(), file);
+ m_ui->hIconButton->setIcon(AndroidManager::highDpiIcon(m_step->target()));
}
void AndroidPackageCreationWidget::setMDPIIcon()
@@ -404,8 +414,8 @@ void AndroidPackageCreationWidget::setMDPIIcon()
QString file = QFileDialog::getOpenFileName(this, tr("Choose Medium DPI Icon"), QDir::homePath(), tr("png images (*.png)"));
if (!file.length())
return;
- m_step->androidTarget()->setMediumDpiIcon(file);
- m_ui->mIconButton->setIcon(m_step->androidTarget()->mediumDpiIcon());
+ AndroidManager::setMediumDpiIcon(m_step->target(), file);
+ m_ui->mIconButton->setIcon(AndroidManager::mediumDpiIcon(m_step->target()));
}
void AndroidPackageCreationWidget::setLDPIIcon()
@@ -413,8 +423,8 @@ void AndroidPackageCreationWidget::setLDPIIcon()
QString file = QFileDialog::getOpenFileName(this, tr("Choose Low DPI Icon"), QDir::homePath(), tr("png images (*.png)"));
if (!file.length())
return;
- m_step->androidTarget()->setLowDpiIcon(file);
- m_ui->lIconButton->setIcon(m_step->androidTarget()->lowDpiIcon());
+ AndroidManager::setLowDpiIcon(m_step->target(), file);
+ m_ui->lIconButton->setIcon(AndroidManager::lowDpiIcon(m_step->target()));
}
void AndroidPackageCreationWidget::permissionActivated(QModelIndex index)
@@ -451,21 +461,21 @@ void AndroidPackageCreationWidget::removePermission()
void AndroidPackageCreationWidget::savePermissionsButton()
{
setEnabledSaveDiscardButtons(false);
- m_step->androidTarget()->setPermissions(m_permissionsModel->permissions());
+ AndroidManager::setPermissions(m_step->target(), m_permissionsModel->permissions());
}
void AndroidPackageCreationWidget::discardPermissionsButton()
{
setEnabledSaveDiscardButtons(false);
- m_permissionsModel->setPermissions(m_step->androidTarget()->permissions());
+ m_permissionsModel->setPermissions(AndroidManager::permissions(m_step->target()));
m_ui->permissionsComboBox->setCurrentIndex(-1);
m_ui->removePermissionButton->setEnabled(m_permissionsModel->permissions().size());
}
void AndroidPackageCreationWidget::updateRequiredLibrariesModels()
{
- m_qtLibsModel->setCheckedItems(m_step->androidTarget()->qtLibs());
- m_prebundledLibs->setCheckedItems(m_step->androidTarget()->prebundledLibs());
+ m_qtLibsModel->setCheckedItems(AndroidManager::qtLibs(m_step->target()));
+ m_prebundledLibs->setCheckedItems(AndroidManager::prebundledLibs(m_step->target()));
}
void AndroidPackageCreationWidget::readElfInfo()
@@ -502,7 +512,7 @@ void AndroidPackageCreationWidget::on_signPackageCheckBox_toggled(bool checked)
{
if (!checked)
return;
- if (m_step->keystorePath().length())
+ if (!m_step->keystorePath().isEmpty())
setCertificates();
}
@@ -511,7 +521,7 @@ void AndroidPackageCreationWidget::on_KeystoreCreatePushButton_clicked()
AndroidCreateKeystoreCertificate d;
if (d.exec() != QDialog::Accepted)
return;
- m_ui->KeystoreLocationLineEdit->setText(d.keystoreFilePath());
+ m_ui->KeystoreLocationLineEdit->setText(d.keystoreFilePath().toUserOutput());
m_step->setKeystorePath(d.keystoreFilePath());
m_step->setKeystorePassword(d.keystorePassword());
m_step->setCertificateAlias(d.certificateAlias());
@@ -521,13 +531,13 @@ void AndroidPackageCreationWidget::on_KeystoreCreatePushButton_clicked()
void AndroidPackageCreationWidget::on_KeystoreLocationPushButton_clicked()
{
- QString keystorePath = m_step->keystorePath();
- if (!keystorePath.length())
- keystorePath = QDir::homePath();
- QString file = QFileDialog::getOpenFileName(this, tr("Select Keystore File"), keystorePath, tr("Keystore files (*.keystore *.jks)"));
- if (!file.length())
+ Utils::FileName keystorePath = m_step->keystorePath();
+ if (keystorePath.isEmpty())
+ keystorePath = Utils::FileName::fromString(QDir::homePath());
+ Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select keystore file"), keystorePath.toString(), tr("Keystore files (*.keystore *.jks)")));
+ if (file.isEmpty())
return;
- m_ui->KeystoreLocationLineEdit->setText(file);
+ m_ui->KeystoreLocationLineEdit->setText(file.toUserOutput());
m_step->setKeystorePath(file);
m_ui->signPackageCheckBox->setChecked(false);
}
@@ -551,6 +561,3 @@ void AndroidPackageCreationWidget::on_openPackageLocationCheckBox_toggled(bool c
} // namespace Internal
} // namespace Android
-
-
-
diff --git a/src/plugins/android/androidpackagecreationwidget.h b/src/plugins/android/androidpackagecreationwidget.h
index 59ca55ce86..971f36383c 100644
--- a/src/plugins/android/androidpackagecreationwidget.h
+++ b/src/plugins/android/androidpackagecreationwidget.h
@@ -38,6 +38,8 @@
#include <QStringList>
QT_BEGIN_NAMESPACE
+class QFileSystemWatcher;
+
namespace Ui { class AndroidPackageCreationWidget; }
QT_END_NAMESPACE
@@ -106,7 +108,7 @@ private slots:
void setPackageName();
void setApplicationName();
- void setTargetSDK(const QString &target);
+ void setTargetSDK(const QString &sdk);
void setVersionCode();
void setVersionName();
void setTarget(const QString &target);
@@ -142,6 +144,7 @@ private:
CheckModel *m_qtLibsModel;
CheckModel *m_prebundledLibs;
PermissionsModel *m_permissionsModel;
+ QFileSystemWatcher *m_fileSystemWatcher;
};
} // namespace Internal
diff --git a/src/plugins/android/androidpackageinstallationfactory.cpp b/src/plugins/android/androidpackageinstallationfactory.cpp
index 448746e5b7..641252f248 100644
--- a/src/plugins/android/androidpackageinstallationfactory.cpp
+++ b/src/plugins/android/androidpackageinstallationfactory.cpp
@@ -33,11 +33,13 @@
#include "androidpackageinstallationfactory.h"
#include "androidpackageinstallationstep.h"
+#include "androidmanager.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
-#include <qt4projectmanager/qt4projectmanagerconstants.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
#include <QCoreApplication>
@@ -53,11 +55,13 @@ AndroidPackageInstallationFactory::AndroidPackageInstallationFactory(QObject *pa
QList<Core::Id> AndroidPackageInstallationFactory::availableCreationIds(BuildStepList *parent) const
{
- if (parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
- && parent->target()->id() == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)
- && !parent->contains(Core::Id(AndroidPackageInstallationStep::Id)))
- return QList<Core::Id>() << Core::Id(AndroidPackageInstallationStep::Id);
- return QList<Core::Id>();
+ if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY))
+ return QList<Core::Id>();
+ if (!AndroidManager::supportsAndroid(parent->target()))
+ return QList<Core::Id>();
+ if (parent->contains(AndroidPackageInstallationStep::Id))
+ return QList<Core::Id>();
+ return QList<Core::Id>() << AndroidPackageInstallationStep::Id;
}
QString AndroidPackageInstallationFactory::displayNameForId(const Core::Id id) const
@@ -70,10 +74,7 @@ QString AndroidPackageInstallationFactory::displayNameForId(const Core::Id id) c
bool AndroidPackageInstallationFactory::canCreate(BuildStepList *parent, const Core::Id id) const
{
- return parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
- && id == Core::Id(AndroidPackageInstallationStep::Id)
- && parent->target()->id() == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)
- && !parent->contains(AndroidPackageInstallationStep::Id);
+ return availableCreationIds(parent).contains(id);
}
BuildStep *AndroidPackageInstallationFactory::create(BuildStepList *parent, const Core::Id id)
diff --git a/src/plugins/android/androidpackageinstallationstep.cpp b/src/plugins/android/androidpackageinstallationstep.cpp
index f1a1efc4ca..b3029a29b2 100644
--- a/src/plugins/android/androidpackageinstallationstep.cpp
+++ b/src/plugins/android/androidpackageinstallationstep.cpp
@@ -31,7 +31,7 @@
**************************************************************************/
#include "androidpackageinstallationstep.h"
-#include "androidtarget.h"
+#include "androidmanager.h"
#include <QFileInfo>
#include <QDir>
@@ -54,25 +54,13 @@ AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::
}
AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bc, AndroidPackageInstallationStep *other): MakeStep(bc, other)
-{
- const QString name = stepDisplayName();
- setDefaultDisplayName(name);
- setDisplayName(name);
-}
+{ }
AndroidPackageInstallationStep::~AndroidPackageInstallationStep()
-{
-}
+{ }
bool AndroidPackageInstallationStep::init()
{
- AndroidTarget *androidTarget = qobject_cast<AndroidTarget *>(target());
- if (!androidTarget) {
- emit addOutput(tr("Current target is not an Android target"), BuildStep::MessageOutput);
- return false;
- }
-
- setUserArguments(QString::fromLatin1("INSTALL_ROOT=\"%1\" install").arg(QDir::toNativeSeparators(androidTarget->androidDirPath())));
-
+ setUserArguments(QString::fromLatin1("INSTALL_ROOT=\"%1\" install").arg(AndroidManager::dirPath(target()).toUserOutput()));
return MakeStep::init();
}
diff --git a/src/plugins/android/androidplugin.cpp b/src/plugins/android/androidplugin.cpp
index 6f27c8c8cf..37703f8558 100644
--- a/src/plugins/android/androidplugin.cpp
+++ b/src/plugins/android/androidplugin.cpp
@@ -36,51 +36,50 @@
#include "androidconfigurations.h"
#include "androiddeploystepfactory.h"
#include "androidconfigurations.h"
+#include "androidmanager.h"
#include "androidpackagecreationfactory.h"
#include "androidpackageinstallationfactory.h"
#include "androidrunfactories.h"
#include "androidsettingspage.h"
#include "androidtoolchain.h"
#include "androidqtversionfactory.h"
-#include "androidtargetfactory.h"
#include "androiddeployconfiguration.h"
#include <QtPlugin>
-using namespace Android;
-using namespace Android::Internal;
+namespace Android {
AndroidPlugin::AndroidPlugin()
-{
-}
+{ }
AndroidPlugin::~AndroidPlugin()
-{
-}
+{ }
bool AndroidPlugin::initialize(const QStringList &arguments,
- QString *error_message)
+ QString *error_message)
{
- Q_UNUSED(arguments)
- Q_UNUSED(error_message)
+ Q_UNUSED(arguments);
+ Q_UNUSED(error_message);
- AndroidConfigurations::instance(this);
+ Internal::AndroidConfigurations::instance(this);
- addAutoReleasedObject(new AndroidRunControlFactory);
- addAutoReleasedObject(new AndroidRunConfigurationFactory);
- addAutoReleasedObject(new AndroidPackageInstallationFactory);
- addAutoReleasedObject(new AndroidPackageCreationFactory);
- addAutoReleasedObject(new AndroidDeployStepFactory);
- addAutoReleasedObject(new AndroidSettingsPage);
- addAutoReleasedObject(new AndroidTargetFactory);
- addAutoReleasedObject(new AndroidQtVersionFactory);
- addAutoReleasedObject(new AndroidToolChainFactory);
- addAutoReleasedObject(new AndroidDeployConfigurationFactory);
+ new Internal::AndroidManager(this);
+
+ addAutoReleasedObject(new Internal::AndroidRunControlFactory);
+ addAutoReleasedObject(new Internal::AndroidRunConfigurationFactory);
+ addAutoReleasedObject(new Internal::AndroidPackageInstallationFactory);
+ addAutoReleasedObject(new Internal::AndroidPackageCreationFactory);
+ addAutoReleasedObject(new Internal::AndroidDeployStepFactory);
+ addAutoReleasedObject(new Internal::AndroidSettingsPage);
+ addAutoReleasedObject(new Internal::AndroidQtVersionFactory);
+ addAutoReleasedObject(new Internal::AndroidToolChainFactory);
+ addAutoReleasedObject(new Internal::AndroidDeployConfigurationFactory);
return true;
}
void AndroidPlugin::extensionsInitialized()
-{
-}
+{ }
+
+} // namespace Android
Q_EXPORT_PLUGIN(Android::AndroidPlugin)
diff --git a/src/plugins/android/androidplugin.h b/src/plugins/android/androidplugin.h
index c8ad7c4a9c..e9a049f74c 100644
--- a/src/plugins/android/androidplugin.h
+++ b/src/plugins/android/androidplugin.h
@@ -30,8 +30,8 @@
**
**************************************************************************/
-#ifndef ANDROIDMANAGER_H
-#define ANDROIDMANAGER_H
+#ifndef ANDROIDPLUGIN_H
+#define ANDROIDPLUGIN_H
#include <extensionsystem/iplugin.h>
@@ -47,8 +47,8 @@ public:
bool initialize(const QStringList &arguments, QString *error_message);
void extensionsInitialized();
-
};
-} // namespace Qt4ProjectManager
-#endif // ANDROIDMANAGER_H
+} // namespace Android
+
+#endif // ANDROIDPLUGIN_H
diff --git a/src/plugins/android/androidqtversion.cpp b/src/plugins/android/androidqtversion.cpp
index 9fa3f795c4..6571faa10d 100644
--- a/src/plugins/android/androidqtversion.cpp
+++ b/src/plugins/android/androidqtversion.cpp
@@ -90,16 +90,6 @@ QList<ProjectExplorer::Abi> AndroidQtVersion::detectQtAbis() const
32);
}
-bool AndroidQtVersion::supportsTargetId(const Core::Id id) const
-{
- return id == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID);
-}
-
-QSet<Core::Id> AndroidQtVersion::supportedTargetIds() const
-{
- return QSet<Core::Id>() << Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID);
-}
-
QString AndroidQtVersion::description() const
{
return QCoreApplication::translate("QtVersion", "Android", "Qt Version is meant for Android");
@@ -114,10 +104,10 @@ Core::FeatureSet AndroidQtVersion::availableFeatures() const
QString AndroidQtVersion::platformName() const
{
- return QLatin1String(Constants::ANDROID_PLATFORM);
+ return QLatin1String(QtSupport::Constants::ANDROID_PLATFORM);
}
QString AndroidQtVersion::platformDisplayName() const
{
- return QLatin1String(Constants::ANDROID_PLATFORM_TR);
+ return QLatin1String(QtSupport::Constants::ANDROID_PLATFORM_TR);
}
diff --git a/src/plugins/android/androidqtversion.h b/src/plugins/android/androidqtversion.h
index be6f6800fa..486cacd647 100644
--- a/src/plugins/android/androidqtversion.h
+++ b/src/plugins/android/androidqtversion.h
@@ -52,9 +52,6 @@ public:
QList<ProjectExplorer::Abi> detectQtAbis() const;
- bool supportsTargetId(const Core::Id id) const;
- QSet<Core::Id> supportedTargetIds() const;
-
Core::FeatureSet availableFeatures() const;
QString platformName() const;
QString platformDisplayName() const;
diff --git a/src/plugins/android/androidrunconfiguration.cpp b/src/plugins/android/androidrunconfiguration.cpp
index 0b33498543..db27ab8736 100644
--- a/src/plugins/android/androidrunconfiguration.cpp
+++ b/src/plugins/android/androidrunconfiguration.cpp
@@ -34,14 +34,19 @@
#include "androiddeploystep.h"
#include "androidglobal.h"
#include "androidtoolchain.h"
-#include "androidtarget.h"
+#include "androidmanager.h"
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4project.h>
+#include <qtsupport/qtprofileinformation.h>
+
#include <utils/qtcassert.h>
#include <qtsupport/qtoutputformatter.h>
+#include <qtsupport/qtprofileinformation.h>
using namespace Qt4ProjectManager;
@@ -50,15 +55,14 @@ namespace Internal {
using namespace ProjectExplorer;
-AndroidRunConfiguration::AndroidRunConfiguration(AndroidTarget *parent,
- const QString &proFilePath)
- : RunConfiguration(parent, Core::Id(ANDROID_RC_ID))
- , m_proFilePath(proFilePath)
+AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, Core::Id id, const QString &path)
+ : RunConfiguration(parent, id)
+ , m_proFilePath(path)
{
init();
}
-AndroidRunConfiguration::AndroidRunConfiguration(AndroidTarget *parent,
+AndroidRunConfiguration::AndroidRunConfiguration(ProjectExplorer::Target *parent,
AndroidRunConfiguration *source)
: RunConfiguration(parent, source)
, m_proFilePath(source->m_proFilePath)
@@ -75,11 +79,6 @@ AndroidRunConfiguration::~AndroidRunConfiguration()
{
}
-AndroidTarget *AndroidRunConfiguration::androidTarget() const
-{
- return static_cast<AndroidTarget *>(target());
-}
-
Qt4BuildConfiguration *AndroidRunConfiguration::activeQt4BuildConfiguration() const
{
return static_cast<Qt4BuildConfiguration *>(activeBuildConfiguration());
@@ -92,7 +91,7 @@ QWidget *AndroidRunConfiguration::createConfigurationWidget()
Utils::OutputFormatter *AndroidRunConfiguration::createOutputFormatter() const
{
- return new QtSupport::QtOutputFormatter(androidTarget()->qt4Project());
+ return new QtSupport::QtOutputFormatter(target()->project());
}
QString AndroidRunConfiguration::defaultDisplayName()
@@ -105,9 +104,12 @@ AndroidConfig AndroidRunConfiguration::config() const
return AndroidConfigurations::instance().config();
}
-const QString AndroidRunConfiguration::gdbCmd() const
+const Utils::FileName AndroidRunConfiguration::gdbCmd() const
{
- return AndroidConfigurations::instance().gdbPath(activeQt4BuildConfiguration()->toolChain()->targetAbi().architecture());
+ ToolChain *tc = ToolChainProfileInformation::toolChain(target()->profile());
+ if (!tc)
+ return Utils::FileName();
+ return AndroidConfigurations::instance().gdbPath(tc->targetAbi().architecture());
}
AndroidDeployStep *AndroidRunConfiguration::deployStep() const
@@ -127,8 +129,10 @@ const QString AndroidRunConfiguration::remoteChannel() const
const QString AndroidRunConfiguration::dumperLib() const
{
- Qt4BuildConfiguration *qt4bc(activeQt4BuildConfiguration());
- return qt4bc->qtVersion()->gdbDebuggingHelperLibrary();
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
+ if (!version)
+ return QString();
+ return version->gdbDebuggingHelperLibrary();
}
QString AndroidRunConfiguration::proFilePath() const
diff --git a/src/plugins/android/androidrunconfiguration.h b/src/plugins/android/androidrunconfiguration.h
index 1e34fac457..b62ee11ef2 100644
--- a/src/plugins/android/androidrunconfiguration.h
+++ b/src/plugins/android/androidrunconfiguration.h
@@ -56,7 +56,6 @@ class AndroidDeviceConfigListModel;
class AndroidDeployStep;
class AndroidRunConfigurationFactory;
class AndroidToolChain;
-class AndroidTarget;
class AndroidRunConfiguration : public ProjectExplorer::RunConfiguration
{
@@ -71,12 +70,11 @@ public:
enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml };
- AndroidRunConfiguration(AndroidTarget *parent, const QString &proFilePath);
+ AndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &path);
virtual ~AndroidRunConfiguration();
QWidget *createConfigurationWidget();
Utils::OutputFormatter *createOutputFormatter() const;
- AndroidTarget *androidTarget() const;
Qt4ProjectManager::Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
AndroidDeployStep *deployStep() const;
@@ -87,12 +85,12 @@ public:
DebuggingType debuggingType() const;
- const QString gdbCmd() const;
+ const Utils::FileName gdbCmd() const;
const QString remoteChannel() const;
const QString dumperLib() const;
protected:
- AndroidRunConfiguration(AndroidTarget *parent, AndroidRunConfiguration *source);
+ AndroidRunConfiguration(ProjectExplorer::Target *parent, AndroidRunConfiguration *source);
QString defaultDisplayName();
private:
diff --git a/src/plugins/android/androidrunfactories.cpp b/src/plugins/android/androidrunfactories.cpp
index 1feeb410c7..d576466979 100644
--- a/src/plugins/android/androidrunfactories.cpp
+++ b/src/plugins/android/androidrunfactories.cpp
@@ -36,13 +36,17 @@
#include "androiddebugsupport.h"
#include "androidrunconfiguration.h"
#include "androidruncontrol.h"
-#include "androidtarget.h"
+#include "androidmanager.h"
+#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
#include <debugger/debuggerconstants.h>
#include <qt4projectmanager/qt4project.h>
#include <qt4projectmanager/qt4nodes.h>
-#include <qt4projectmanager/qt4projectmanagerconstants.h>
+#include <qtsupport/customexecutablerunconfiguration.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
namespace Android {
@@ -55,7 +59,7 @@ namespace {
QString pathFromId(const Core::Id id)
{
- QString pathStr = QString::fromUtf8(id.name());
+ QString pathStr = id.toString();
const QString prefix = QLatin1String(ANDROID_RC_ID_PREFIX);
if (!pathStr.startsWith(prefix))
return QString();
@@ -65,34 +69,25 @@ QString pathFromId(const Core::Id id)
} // namespace
AndroidRunConfigurationFactory::AndroidRunConfigurationFactory(QObject *parent)
- : IRunConfigurationFactory(parent)
-{
-}
+ : QmakeRunConfigurationFactory(parent)
+{ setObjectName(QLatin1String("AndroidRunConfigurationFactory")); }
AndroidRunConfigurationFactory::~AndroidRunConfigurationFactory()
-{
-}
+{ }
-bool AndroidRunConfigurationFactory::canCreate(Target *parent,
- const Core::Id/*id*/) const
+bool AndroidRunConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
{
- AndroidTarget *target = qobject_cast<AndroidTarget *>(parent);
- if (!target
- || target->id() != Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)) {
+ if (!canHandle(parent))
return false;
- }
- return true;
+ return availableCreationIds(parent).contains(id);
}
-bool AndroidRunConfigurationFactory::canRestore(Target *parent,
- const QVariantMap &map) const
+bool AndroidRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
{
- Q_UNUSED(parent)
- Q_UNUSED(map)
- if (!qobject_cast<AndroidTarget *>(parent))
+ if (!canHandle(parent))
return false;
- QString id = QString::fromUtf8(ProjectExplorer::idFromMap(map).name());
- return id.startsWith(QLatin1String(ANDROID_RC_ID));
+ QString id = ProjectExplorer::idFromMap(map).toString();
+ return id.startsWith(QLatin1String(ANDROID_RC_ID_PREFIX));
}
bool AndroidRunConfigurationFactory::canClone(Target *parent,
@@ -104,14 +99,12 @@ bool AndroidRunConfigurationFactory::canClone(Target *parent,
QList<Core::Id> AndroidRunConfigurationFactory::availableCreationIds(Target *parent) const
{
QList<Core::Id> ids;
- if (AndroidTarget *t = qobject_cast<AndroidTarget *>(parent)) {
- if (t->id() == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID)) {
- QList<Qt4ProFileNode *> nodes = t->qt4Project()->allProFiles();
- foreach (Qt4ProFileNode *node, nodes)
- if (node->projectType() == ApplicationTemplate || node->projectType() == LibraryTemplate)
- ids << Core::Id(node->targetInformation().target);
- }
- }
+ if (!AndroidManager::supportsAndroid(parent))
+ return ids;
+ QList<Qt4ProFileNode *> nodes = static_cast<Qt4Project *>(parent->project())->allProFiles();
+ foreach (Qt4ProFileNode *node, nodes)
+ if (node->projectType() == ApplicationTemplate || node->projectType() == LibraryTemplate)
+ ids << Core::Id(node->targetInformation().target);
return ids;
}
@@ -120,14 +113,11 @@ QString AndroidRunConfigurationFactory::displayNameForId(const Core::Id id) cons
return QFileInfo(pathFromId(id)).completeBaseName();
}
-RunConfiguration *AndroidRunConfigurationFactory::create(Target *parent,
- const Core::Id id)
+RunConfiguration *AndroidRunConfigurationFactory::create(Target *parent, const Core::Id id)
{
if (!canCreate(parent, id))
return 0;
- AndroidTarget *pqt4parent = static_cast<AndroidTarget *>(parent);
- return new AndroidRunConfiguration(pqt4parent, pathFromId(id));
-
+ return new AndroidRunConfiguration(parent, id, pathFromId(id));
}
RunConfiguration *AndroidRunConfigurationFactory::restore(Target *parent,
@@ -135,8 +125,8 @@ RunConfiguration *AndroidRunConfigurationFactory::restore(Target *parent,
{
if (!canRestore(parent, map))
return 0;
- AndroidTarget *target = static_cast<AndroidTarget *>(parent);
- AndroidRunConfiguration *rc = new AndroidRunConfiguration(target, QString());
+ Core::Id id = ProjectExplorer::idFromMap(map);
+ AndroidRunConfiguration *rc = new AndroidRunConfiguration(parent, id, pathFromId(id));
if (rc->fromMap(map))
return rc;
@@ -144,14 +134,30 @@ RunConfiguration *AndroidRunConfigurationFactory::restore(Target *parent,
return 0;
}
-RunConfiguration *AndroidRunConfigurationFactory::clone(Target *parent,
- RunConfiguration *source)
+RunConfiguration *AndroidRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
{
if (!canClone(parent, source))
return 0;
AndroidRunConfiguration *old = static_cast<AndroidRunConfiguration *>(source);
- return new AndroidRunConfiguration(static_cast<AndroidTarget *>(parent), old);
+ return new AndroidRunConfiguration(parent, old);
+}
+
+bool AndroidRunConfigurationFactory::canHandle(Target *t) const
+{
+ if (!t->project()->supportsProfile(t->profile()))
+ return false;
+ return AndroidManager::supportsAndroid(t);
+}
+
+QList<RunConfiguration *> AndroidRunConfigurationFactory::runConfigurationsForNode(Target *t, ProjectExplorer::Node *n)
+{
+ QList<ProjectExplorer::RunConfiguration *> result;
+ foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations())
+ if (AndroidRunConfiguration *qt4c = qobject_cast<AndroidRunConfiguration *>(rc))
+ if (qt4c->proFilePath() == n->path())
+ result << rc;
+ return result;
}
// #pragma mark -- AndroidRunControlFactory
diff --git a/src/plugins/android/androidrunfactories.h b/src/plugins/android/androidrunfactories.h
index fb4ffd40a2..04dc9df80e 100644
--- a/src/plugins/android/androidrunfactories.h
+++ b/src/plugins/android/androidrunfactories.h
@@ -34,24 +34,26 @@
#define ANDROIDRUNFACTORIES_H
#include <projectexplorer/runconfiguration.h>
+#include <qt4projectmanager/qmakerunconfigurationfactory.h>
namespace ProjectExplorer {
- class RunConfiguration;
class RunControl;
class RunConfigWidget;
class Target;
}
-using ProjectExplorer::IRunConfigurationFactory;
+
using ProjectExplorer::IRunControlFactory;
using ProjectExplorer::RunConfiguration;
using ProjectExplorer::RunControl;
using ProjectExplorer::RunConfigWidget;
using ProjectExplorer::Target;
+namespace ProjectExplorer { class Node; }
+
namespace Android {
namespace Internal {
-class AndroidRunConfigurationFactory : public IRunConfigurationFactory
+class AndroidRunConfigurationFactory : public Qt4ProjectManager::QmakeRunConfigurationFactory
{
Q_OBJECT
@@ -70,6 +72,10 @@ public:
bool canClone(Target *parent, RunConfiguration *source) const;
RunConfiguration *clone(Target *parent, RunConfiguration *source);
+
+ bool canHandle(ProjectExplorer::Target *t) const;
+ QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
+ ProjectExplorer::Node *n);
};
class AndroidRunControlFactory : public IRunControlFactory
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp
index fe578c4ff8..1a15344705 100644
--- a/src/plugins/android/androidrunner.cpp
+++ b/src/plugins/android/androidrunner.cpp
@@ -36,7 +36,9 @@
#include "androidconfigurations.h"
#include "androidglobal.h"
#include "androidrunconfiguration.h"
-#include "androidtarget.h"
+#include "androidmanager.h"
+
+#include <projectexplorer/target.h>
#include <QTime>
#include <QtConcurrentRun>
@@ -49,13 +51,13 @@ AndroidRunner::AndroidRunner(QObject *parent,
: QThread(parent)
{
m_remoteChannel = runConfig->remoteChannel();
- AndroidTarget * at = runConfig->androidTarget();
- AndroidDeployStep * ds = runConfig->deployStep();
+ ProjectExplorer::Target *target = runConfig->target();
+ AndroidDeployStep *ds = runConfig->deployStep();
if ((m_useLocalQtLibs = ds->useLocalQtLibs())) {
- m_localLibs = at->loadLocalLibs(ds->deviceAPILevel());
- m_localJars = at->loadLocalJars(ds->deviceAPILevel());
+ m_localLibs = AndroidManager::loadLocalLibs(target, ds->deviceAPILevel());
+ m_localJars = AndroidManager::loadLocalJars(target, ds->deviceAPILevel());
}
- m_intentName = at->intentName();
+ m_intentName = AndroidManager::intentName(target);
m_debugingMode = debugging;
m_packageName = m_intentName.left(m_intentName.indexOf(QLatin1Char('/')));
m_deviceSerialNumber = ds->deviceSerialNumber();
@@ -74,7 +76,7 @@ AndroidRunner::~AndroidRunner()
void AndroidRunner::checkPID()
{
QProcess psProc;
- psProc.start(AndroidConfigurations::instance().adbToolPath(),
+ psProc.start(AndroidConfigurations::instance().adbToolPath().toString(),
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
<< QLatin1String("shell") << QLatin1String("ps"));
if (!psProc.waitForFinished(-1)) {
@@ -148,7 +150,7 @@ void AndroidRunner::asyncStart()
arguments << QLatin1String("-s") << m_deviceSerialNumber
<< QLatin1String("forward") << QString::fromLatin1("tcp%1").arg(m_remoteChannel)
<< QString::fromLatin1("localfilesystem:/data/data/%1/debug-socket").arg(m_packageName);
- adbStarProc.start(AndroidConfigurations::instance().adbToolPath(), arguments);
+ adbStarProc.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
if (!adbStarProc.waitForStarted()) {
emit remoteProcessFinished(tr("Failed to forward debugging ports. Reason: $1").arg(adbStarProc.errorString()));
return;
@@ -176,7 +178,7 @@ void AndroidRunner::asyncStart()
if (extraParams.length())
arguments << extraParams.split(QLatin1Char(' '));
- adbStarProc.start(AndroidConfigurations::instance().adbToolPath(), arguments);
+ adbStarProc.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
if (!adbStarProc.waitForStarted()) {
emit remoteProcessFinished(tr("Failed to start the activity. Reason: $1").arg(adbStarProc.errorString()));
return;
@@ -209,7 +211,7 @@ void AndroidRunner::asyncStart()
void AndroidRunner::startLogcat()
{
m_checkPIDTimer.start(1000); // check if the application is alive every 1 seconds
- m_adbLogcatProcess.start(AndroidConfigurations::instance().adbToolPath(),
+ m_adbLogcatProcess.start(AndroidConfigurations::instance().adbToolPath().toString(),
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
<< QLatin1String("logcat"));
emit remoteProcessStarted(5039);
@@ -267,7 +269,7 @@ void AndroidRunner::adbKill(qint64 pid, const QString &device, int timeout, cons
arguments << QLatin1String("kill") << QLatin1String("-9");
arguments << QString::number(pid);
- process.start(AndroidConfigurations::instance().adbToolPath(), arguments);
+ process.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
if (!process.waitForFinished(timeout))
process.terminate();
}
diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp
index 48fa82af5e..0c9b86338d 100644
--- a/src/plugins/android/androidsettingswidget.cpp
+++ b/src/plugins/android/androidsettingswidget.cpp
@@ -149,19 +149,19 @@ void AndroidSettingsWidget::initGui()
m_ui->setupUi(this);
m_ui->toolchainVersionComboBox->clear();
if (checkSDK(m_androidConfig.sdkLocation))
- m_ui->SDKLocationLineEdit->setText(m_androidConfig.sdkLocation);
+ m_ui->SDKLocationLineEdit->setText(m_androidConfig.sdkLocation.toUserOutput());
else
m_androidConfig.sdkLocation.clear();
if (checkNDK(m_androidConfig.ndkLocation))
- m_ui->NDKLocationLineEdit->setText(m_androidConfig.ndkLocation);
+ m_ui->NDKLocationLineEdit->setText(m_androidConfig.ndkLocation.toUserOutput());
else
m_androidConfig.ndkLocation.clear();
- m_ui->AntLocationLineEdit->setText(m_androidConfig.antLocation);
- m_ui->GdbLocationLineEdit->setText(m_androidConfig.armGdbLocation);
- m_ui->GdbserverLocationLineEdit->setText(m_androidConfig.armGdbserverLocation);
- m_ui->GdbLocationLineEditx86->setText(m_androidConfig.x86GdbLocation);
- m_ui->GdbserverLocationLineEditx86->setText(m_androidConfig.x86GdbserverLocation);
- m_ui->OpenJDKLocationLineEdit->setText(m_androidConfig.openJDKLocation);
+ m_ui->AntLocationLineEdit->setText(m_androidConfig.antLocation.toUserOutput());
+ m_ui->GdbLocationLineEdit->setText(m_androidConfig.armGdbLocation.toUserOutput());
+ m_ui->GdbserverLocationLineEdit->setText(m_androidConfig.armGdbserverLocation.toUserOutput());
+ m_ui->GdbLocationLineEditx86->setText(m_androidConfig.x86GdbLocation.toUserOutput());
+ m_ui->GdbserverLocationLineEditx86->setText(m_androidConfig.x86GdbserverLocation.toUserOutput());
+ m_ui->OpenJDKLocationLineEdit->setText(m_androidConfig.openJDKLocation.toUserOutput());
m_ui->DataPartitionSizeSpinBox->setValue(m_androidConfig.partitionSize);
m_ui->AVDTableView->setModel(&m_AVDModel);
m_AVDModel.setAvdList(AndroidConfigurations::instance().androidVirtualDevices());
@@ -181,33 +181,40 @@ void AndroidSettingsWidget::saveSettings(bool saveNow)
}
-bool AndroidSettingsWidget::checkSDK(const QString &location)
+bool AndroidSettingsWidget::checkSDK(const Utils::FileName &location)
{
- if (!location.length())
+ if (location.isEmpty())
return false;
- if (!QFile::exists(location + QLatin1String("/platform-tools/adb" ANDROID_EXE_SUFFIX))
- || (!QFile::exists(location + QLatin1String("/tools/android" ANDROID_EXE_SUFFIX))
- && !QFile::exists(location + QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)))
- || !QFile::exists(location + QLatin1String("/tools/emulator" ANDROID_EXE_SUFFIX))) {
- QMessageBox::critical(this, tr("Android SDK Folder"), tr("\"%1\" doesn't seem to be an Android SDK top folder").arg(location));
+ Utils::FileName adb = 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()
+ && !androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).toFileInfo().exists())
+ || !emulator.appendPath(QLatin1String("/tools/emulator" ANDROID_EXE_SUFFIX)).toFileInfo().exists()) {
+ QMessageBox::critical(this, tr("Android SDK Folder"), tr("\"%1\" doesn't seem to be an Android SDK top folder").arg(location.toUserOutput()));
return false;
}
return true;
}
-bool AndroidSettingsWidget::checkNDK(const QString &location)
+bool AndroidSettingsWidget::checkNDK(const Utils::FileName &location)
{
m_ui->toolchainVersionComboBox->setEnabled(false);
m_ui->GdbLocationLineEdit->setEnabled(false);
m_ui->GdbLocationPushButton->setEnabled(false);
m_ui->GdbserverLocationLineEdit->setEnabled(false);
m_ui->GdbserverLocationPushButton->setEnabled(false);
- if (!location.length())
+ if (location.isEmpty())
return false;
- if (!QFile::exists(location + QLatin1String("/platforms"))
- || !QFile::exists(location + QLatin1String("/toolchains"))
- || !QFile::exists(location + QLatin1String("/sources/cxx-stl"))) {
- QMessageBox::critical(this, tr("Android SDK Folder"), tr("\"%1\" doesn't seem to be an Android NDK top folder").arg(location));
+ Utils::FileName platformPath = location;
+ Utils::FileName toolChainPath = location;
+ Utils::FileName sourcesPath = location;
+ if (!platformPath.appendPath(QLatin1String("platforms")).toFileInfo().exists()
+ || !toolChainPath.appendPath(QLatin1String("toolchains")).toFileInfo().exists()
+ || !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).toFileInfo().exists()) {
+ QMessageBox::critical(this, tr("Android SDK Folder"), tr("\"%1\" doesn't seem to be an Android NDK top folder").arg(location.toUserOutput()));
return false;
}
m_ui->toolchainVersionComboBox->setEnabled(true);
@@ -222,7 +229,7 @@ bool AndroidSettingsWidget::checkNDK(const QString &location)
void AndroidSettingsWidget::sdkLocationEditingFinished()
{
- QString location = m_ui->SDKLocationLineEdit->text();
+ Utils::FileName location = Utils::FileName::fromUserInput(m_ui->SDKLocationLineEdit->text());
if (!checkSDK(location)) {
m_ui->AVDManagerFrame->setEnabled(false);
return;
@@ -235,8 +242,8 @@ void AndroidSettingsWidget::sdkLocationEditingFinished()
void AndroidSettingsWidget::ndkLocationEditingFinished()
{
- QString location = m_ui->NDKLocationLineEdit->text();
- if (!checkNDK(location))
+ Utils::FileName location = Utils::FileName::fromUserInput(m_ui->NDKLocationLineEdit->text());
+ if (checkNDK(location))
return;
m_androidConfig.ndkLocation = location;
saveSettings(true);
@@ -264,67 +271,67 @@ void AndroidSettingsWidget::toolchainVersionIndexChanged(QString version)
void AndroidSettingsWidget::antLocationEditingFinished()
{
- QString location = m_ui->AntLocationLineEdit->text();
- if (!location.length() || !QFile::exists(location))
+ Utils::FileName location = Utils::FileName::fromUserInput(m_ui->AntLocationLineEdit->text());
+ if (location.isEmpty() || !location.toFileInfo().exists())
return;
m_androidConfig.antLocation = location;
}
void AndroidSettingsWidget::gdbLocationEditingFinished()
{
- QString location = m_ui->GdbLocationLineEdit->text();
- if (!location.length() || !QFile::exists(location))
+ Utils::FileName location = Utils::FileName::fromUserInput(m_ui->GdbLocationLineEdit->text());
+ if (location.isEmpty() || !location.toFileInfo().exists())
return;
m_androidConfig.armGdbLocation = location;
}
void AndroidSettingsWidget::gdbserverLocationEditingFinished()
{
- QString location = m_ui->GdbserverLocationLineEdit->text();
- if (!location.length() || !QFile::exists(location))
+ Utils::FileName location = Utils::FileName::fromUserInput(m_ui->GdbserverLocationLineEdit->text());
+ if (location.isEmpty() || !location.toFileInfo().exists())
return;
m_androidConfig.armGdbserverLocation = location;
}
void AndroidSettingsWidget::gdbLocationX86EditingFinished()
{
- QString location = m_ui->GdbLocationLineEditx86->text();
- if (!location.length() || !QFile::exists(location))
+ Utils::FileName location = Utils::FileName::fromUserInput(m_ui->GdbLocationLineEditx86->text());
+ if (location.isEmpty() || !location.toFileInfo().exists())
return;
m_androidConfig.x86GdbLocation = location;
}
void AndroidSettingsWidget::gdbserverLocationX86EditingFinished()
{
- QString location = m_ui->GdbserverLocationLineEditx86->text();
- if (!location.length() || !QFile::exists(location))
+ Utils::FileName location = Utils::FileName::fromUserInput(m_ui->GdbserverLocationLineEditx86->text());
+ if (location.isEmpty() || !location.toFileInfo().exists())
return;
m_androidConfig.x86GdbserverLocation = location;
}
void AndroidSettingsWidget::openJDKLocationEditingFinished()
{
- QString location = m_ui->OpenJDKLocationLineEdit->text();
- if (!location.length() || !QFile::exists(location))
+ Utils::FileName location = Utils::FileName::fromUserInput(m_ui->OpenJDKLocationLineEdit->text());
+ if (location.isEmpty() || !location.toFileInfo().exists())
return;
m_androidConfig.openJDKLocation = location;
}
void AndroidSettingsWidget::browseSDKLocation()
{
- QString dir = QFileDialog::getExistingDirectory(this, tr("Select Android SDK Folder"));
+ Utils::FileName dir = Utils::FileName::fromString(QFileDialog::getExistingDirectory(this, tr("Select Android SDK folder")));
if (!checkSDK(dir))
return;
- m_ui->SDKLocationLineEdit->setText(dir);
+ m_ui->SDKLocationLineEdit->setText(dir.toUserOutput());
sdkLocationEditingFinished();
}
void AndroidSettingsWidget::browseNDKLocation()
{
- QString dir = QFileDialog::getExistingDirectory(this, tr("Select Android NDK Folder"));
+ Utils::FileName dir = Utils::FileName::fromString(QFileDialog::getExistingDirectory(this, tr("Select Android NDK folder")));
if (!checkNDK(dir))
return;
- m_ui->NDKLocationLineEdit->setText(dir);
+ m_ui->NDKLocationLineEdit->setText(dir.toUserOutput());
ndkLocationEditingFinished();
}
@@ -350,55 +357,51 @@ void AndroidSettingsWidget::browseAntLocation()
void AndroidSettingsWidget::browseGdbLocation()
{
- QString gdbPath = AndroidConfigurations::instance().gdbPath(ProjectExplorer::Abi::ArmArchitecture);
- QString file = QFileDialog::getOpenFileName(this, tr("Select gdb Executable"),gdbPath);
- if (!file.length())
+ Utils::FileName gdbPath = AndroidConfigurations::instance().gdbPath(ProjectExplorer::Abi::ArmArchitecture);
+ Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select gdb executable"), gdbPath.toString()));
+ if (file.isEmpty())
return;
- m_ui->GdbLocationLineEdit->setText(file);
+ m_ui->GdbLocationLineEdit->setText(file.toUserOutput());
gdbLocationEditingFinished();
}
void AndroidSettingsWidget::browseGdbserverLocation()
{
- QString gdbserverPath = AndroidConfigurations::instance().gdbServerPath(ProjectExplorer::Abi::ArmArchitecture);
- const QString file =
- QFileDialog::getOpenFileName(this, tr("Select gdbserver Android Executable"),gdbserverPath);
- if (!file.length())
+ Utils::FileName gdbserverPath = AndroidConfigurations::instance().gdbServerPath(ProjectExplorer::Abi::ArmArchitecture);
+ Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select gdbserver android executable"), gdbserverPath.toString()));
+ if (file.isEmpty())
return;
- m_ui->GdbserverLocationLineEdit->setText(file);
+ m_ui->GdbserverLocationLineEdit->setText(file.toUserOutput());
gdbserverLocationEditingFinished();
}
void AndroidSettingsWidget::browseGdbLocationX86()
{
- QString gdbPath = AndroidConfigurations::instance().gdbPath(ProjectExplorer::Abi::X86Architecture);
- const QString file =
- QFileDialog::getOpenFileName(this, tr("Select gdb Executable"),gdbPath);
- if (!file.length())
+ Utils::FileName gdbPath = AndroidConfigurations::instance().gdbPath(ProjectExplorer::Abi::X86Architecture);
+ Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select gdb executable"), gdbPath.toString()));
+ if (file.isEmpty())
return;
- m_ui->GdbLocationLineEditx86->setText(file);
+ m_ui->GdbLocationLineEditx86->setText(file.toUserOutput());
gdbLocationX86EditingFinished();
}
void AndroidSettingsWidget::browseGdbserverLocationX86()
{
- QString gdbserverPath = AndroidConfigurations::instance().gdbServerPath(ProjectExplorer::Abi::X86Architecture);
- const QString file =
- QFileDialog::getOpenFileName(this, tr("Select gdbserver Android Executable"), gdbserverPath);
- if (!file.length())
+ Utils::FileName gdbserverPath = AndroidConfigurations::instance().gdbServerPath(ProjectExplorer::Abi::X86Architecture);
+ Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select gdbserver android executable"), gdbserverPath.toString()));
+ if (file.isEmpty())
return;
- m_ui->GdbserverLocationLineEditx86->setText(file);
+ m_ui->GdbserverLocationLineEditx86->setText(file.toUserOutput());
gdbserverLocationX86EditingFinished();
}
void AndroidSettingsWidget::browseOpenJDKLocation()
{
- QString openJDKPath = AndroidConfigurations::instance().openJDKPath();
- const QString file =
- QFileDialog::getOpenFileName(this, tr("Select OpenJDK Path"), openJDKPath);
- if (!file.length())
+ Utils::FileName openJDKPath = AndroidConfigurations::instance().openJDKPath();
+ Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select OpenJDK path"), openJDKPath.toString()));
+ if (file.isEmpty())
return;
- m_ui->OpenJDKLocationLineEdit->setText(file);
+ m_ui->OpenJDKLocationLineEdit->setText(file.toUserOutput());
openJDKLocationEditingFinished();
}
@@ -436,7 +439,8 @@ void AndroidSettingsWidget::manageAVD()
QProcess *avdProcess = new QProcess();
connect(this, SIGNAL(destroyed()), avdProcess, SLOT(deleteLater()));
connect(avdProcess, SIGNAL(finished(int)), avdProcess, SLOT(deleteLater()));
- avdProcess->start(AndroidConfigurations::instance().androidToolPath(), QStringList() << QLatin1String("avd"));
+ avdProcess->start(AndroidConfigurations::instance().androidToolPath().toString(),
+ QStringList() << QLatin1String("avd"));
}
diff --git a/src/plugins/android/androidsettingswidget.h b/src/plugins/android/androidsettingswidget.h
index fa985a6cb7..8de720593d 100644
--- a/src/plugins/android/androidsettingswidget.h
+++ b/src/plugins/android/androidsettingswidget.h
@@ -72,6 +72,7 @@ class AndroidSettingsWidget : public QWidget
{
Q_OBJECT
public:
+ // Todo: This would be so much simpler if it just used Utils::PathChooser!!!
AndroidSettingsWidget(QWidget *parent);
~AndroidSettingsWidget();
@@ -105,8 +106,8 @@ private slots:
private:
void initGui();
- bool checkSDK(const QString &location);
- bool checkNDK(const QString &location);
+ bool checkSDK(const Utils::FileName &location);
+ bool checkNDK(const Utils::FileName &location);
void fillToolchainVersions();
Ui_AndroidSettingsWidget *m_ui;
diff --git a/src/plugins/android/androidtarget.h b/src/plugins/android/androidtarget.h
deleted file mode 100644
index dbbd13273d..0000000000
--- a/src/plugins/android/androidtarget.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 BogDan Vatra <bog_dan_ro@yahoo.com>
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef ANDROIDTEMPLATESCREATOR_H
-#define ANDROIDTEMPLATESCREATOR_H
-
-#include "qt4projectmanager/qt4target.h"
-#include "qt4projectmanager/qt4buildconfiguration.h"
-
-#include <QMap>
-#include <QIcon>
-#include <QDomDocument>
-
-QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher);
-
-namespace ProjectExplorer {
-class Project;
-class ProjectNode;
-class Target;
-}
-
-namespace Qt4ProjectManager {
-class Qt4Project;
-class Qt4Target;
-class Qt4ProFileNode;
-}
-
-
-namespace Android {
-namespace Internal {
-class AndroidTargetFactory;
-
-class AndroidTarget : public Qt4ProjectManager::Qt4BaseTarget
-{
- friend class AndroidTargetFactory;
- Q_OBJECT
- enum AndroidIconType
- {
- HighDPI,
- MediumDPI,
- LowDPI
- };
-
- struct Library
- {
- Library()
- {
- level = -1;
- }
- int level;
- QStringList dependencies;
- QString name;
- };
- typedef QMap<QString, Library> LibrariesMap;
-public:
- enum BuildType
- {
- DebugBuild,
- ReleaseBuildUnsigned,
- ReleaseBuildSigned
- };
-
- explicit AndroidTarget(Qt4ProjectManager::Qt4Project *parent, const Core::Id id);
- virtual ~AndroidTarget();
-
- Qt4ProjectManager::Qt4BuildConfigurationFactory *buildConfigurationFactory() const;
-
- void createApplicationProFiles(bool reparse);
-
- QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
-
- static QString defaultDisplayName();
-
-
- QString packageName() const;
- bool setPackageName(const QString &name) const;
-
- QString intentName() const;
- QString activityName() const;
-
- QString applicationName() const;
- bool setApplicationName(const QString &name) const;
-
- QStringList availableTargetApplications() const;
- QString targetApplication() const;
- bool setTargetApplication(const QString &name) const;
- QString targetApplicationPath() const;
-
- QString targetSDK() const;
- bool setTargetSDK(const QString &target) const;
-
- int versionCode() const;
- bool setVersionCode(int version) const;
-
- QString versionName() const;
- bool setVersionName(const QString &version) const;
-
- QStringList permissions() const;
- bool setPermissions(const QStringList &permissions) const;
-
- QStringList availableQtLibs() const;
- QStringList qtLibs() const;
- bool setQtLibs(const QStringList &qtLibs) const;
-
- QStringList availablePrebundledLibs() const;
- QStringList prebundledLibs() const;
- bool setPrebundledLibs(const QStringList &qtLibs) const;
-
- QIcon highDpiIcon() const;
- bool setHighDpiIcon(const QString &iconFilePath) const;
-
- QIcon mediumDpiIcon() const;
- bool setMediumDpiIcon(const QString &iconFilePath) const;
-
- QIcon lowDpiIcon() const;
- bool setLowDpiIcon(const QString &iconFilePath) const;
-
- QString androidDirPath() const;
- QString androidManifestPath() const;
- QString androidLibsPath() const;
- QString androidStringsPath() const;
- QString androidDefaultPropertiesPath() const;
- QString androidSrcPath() const;
- QString apkPath(BuildType buildType) const;
- QString localLibsRulesFilePath() const;
- QString loadLocalLibs(int apiLevel) const;
- QString loadLocalJars(int apiLevel) const;
-
-public slots:
- bool createAndroidTemplatesIfNecessary() const;
- void updateProject(const QString &targetSDK, const QString &name = QString()) const;
-
-signals:
- void androidDirContentsChanged();
-
-private slots:
- void handleTargetChanged(ProjectExplorer::Target *target);
- void handleTargetToBeRemoved(ProjectExplorer::Target *target);
-
-private:
- enum ItemType
- {
- Lib,
- Jar
- };
-
- QString loadLocal(int apiLevel, ItemType item) const;
- void raiseError(const QString &reason) const;
- bool openXmlFile(QDomDocument &doc, const QString &fileName, bool createAndroidTemplates = true) const;
- bool saveXmlFile(QDomDocument &doc, const QString &fileName) const;
- bool openAndroidManifest(QDomDocument &doc) const;
- bool saveAndroidManifest(QDomDocument &doc) const;
- bool openLibsXml(QDomDocument &doc) const;
- bool saveLibsXml(QDomDocument &doc) const;
-
- QIcon androidIcon(AndroidIconType type) const;
- bool setAndroidIcon(AndroidIconType type, const QString &iconFileName) const;
-
- QStringList libsXml(const QString &tag) const;
- bool setLibsXml(const QStringList &qtLibs, const QString &tag) const;
-
- static bool qtLibrariesLessThan(const AndroidTarget::Library &a, const AndroidTarget::Library &b);
- QStringList getDependencies(const QString &readelfPath, const QString &lib) const;
- int setLibraryLevel(const QString &library, LibrariesMap &mapLibs) const;
-
-
- QFileSystemWatcher *const m_androidFilesWatcher;
-
- Qt4ProjectManager::Qt4BuildConfigurationFactory *m_buildConfigurationFactory;
-};
-
-} // namespace Internal
-} // namespace Android
-
-#endif // ANDROIDTEMPLATESCREATOR_H
diff --git a/src/plugins/android/androidtargetfactory.cpp b/src/plugins/android/androidtargetfactory.cpp
deleted file mode 100644
index 180aa851ba..0000000000
--- a/src/plugins/android/androidtargetfactory.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 BogDan Vatra <bog_dan_ro@yahoo.com>
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "androidtargetfactory.h"
-#include "qt4projectmanager/qt4project.h"
-#include "qt4projectmanager/qt4projectmanagerconstants.h"
-#include "androiddeploystep.h"
-#include "androidglobal.h"
-#include "androidpackagecreationstep.h"
-#include "androidrunconfiguration.h"
-#include "androidtarget.h"
-#include "androiddeployconfiguration.h"
-
-#include <projectexplorer/deployconfiguration.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <qt4projectmanager/buildconfigurationinfo.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
-
-#include <qtsupport/qtversionmanager.h>
-
-using namespace Qt4ProjectManager;
-using namespace Android::Internal;
-using ProjectExplorer::idFromMap;
-
-// -------------------------------------------------------------------------
-// Qt4AndroidTargetFactory
-// -------------------------------------------------------------------------
-AndroidTargetFactory::AndroidTargetFactory(QObject *parent) :
- Qt4BaseTargetFactory(parent)
-{
- connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
- this, SIGNAL(canCreateTargetIdsChanged()));
-}
-
-AndroidTargetFactory::~AndroidTargetFactory()
-{
-}
-
-bool AndroidTargetFactory::supportsTargetId(const Core::Id id) const
-{
- return id == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID);
-}
-
-QSet<QString> AndroidTargetFactory::targetFeatures(const Core::Id id) const
-{
- Q_UNUSED(id);
- QSet<QString> features;
- features << QLatin1String(Qt4ProjectManager::Constants::MOBILE_TARGETFEATURE_ID);
- features << QLatin1String(Qt4ProjectManager::Constants::SHADOWBUILD_TARGETFEATURE_ID);
- return features;
-}
-
-QList<Core::Id> AndroidTargetFactory::supportedTargetIds() const
-{
- return QList<Core::Id>() << Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID);
-}
-
-QString AndroidTargetFactory::displayNameForId(const Core::Id id) const
-{
- if (id == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID))
- return AndroidTarget::defaultDisplayName();
- return QString();
-}
-
-QIcon AndroidTargetFactory::iconForId(const Core::Id id) const
-{
- Q_UNUSED(id)
- return QIcon(QLatin1String(Constants::ANDROID_SETTINGS_CATEGORY_ICON));
-}
-
-bool AndroidTargetFactory::canCreate(ProjectExplorer::Project *parent, const Core::Id id) const
-{
- if (!qobject_cast<Qt4Project *>(parent))
- return false;
- if (!supportsTargetId(id))
- return false;
- return QtSupport::QtVersionManager::instance()->supportsTargetId(id);
-}
-
-bool AndroidTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const
-{
- return canCreate(parent, idFromMap(map));
-}
-
-Qt4BaseTarget *AndroidTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map)
-{
- if (!canRestore(parent, map))
- return 0;
-
- const Core::Id id = idFromMap(map);
- AndroidTarget *target = 0;
- Qt4Project *qt4project = static_cast<Qt4Project *>(parent);
- if (id == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID))
- target = new AndroidTarget(qt4project, id);
- if (target && target->fromMap(map))
- return target;
- delete target;
- return 0;
-}
-
-Qt4BaseTarget *AndroidTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id)
-{
- if (!canCreate(parent, id))
- return 0;
-
- QList<QtSupport::BaseQtVersion *> knownVersions = QtSupport::QtVersionManager::instance()->versionsForTargetId(id);
- if (knownVersions.isEmpty())
- return 0;
-
- QtSupport::BaseQtVersion *qtVersion = knownVersions.first();
- bool buildAll = qtVersion->isValid() && (qtVersion->defaultBuildConfig() & QtSupport::BaseQtVersion::BuildAll);
- QtSupport::BaseQtVersion::QmakeBuildConfigs config = buildAll ? QtSupport::BaseQtVersion::BuildAll : QtSupport::BaseQtVersion::QmakeBuildConfig(0);
-
- QList<Qt4ProjectManager::BuildConfigurationInfo> infos;
- infos.append(Qt4ProjectManager::BuildConfigurationInfo(qtVersion->uniqueId(), config, QString(), QString()));
- infos.append(Qt4ProjectManager::BuildConfigurationInfo(qtVersion->uniqueId(), config ^ QtSupport::BaseQtVersion::DebugBuild, QString(), QString()));
-
- return create(parent, id, infos);
-}
-
-Qt4BaseTarget *AndroidTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id,
- const QList<Qt4ProjectManager::BuildConfigurationInfo> &infos)
-{
- if (!canCreate(parent, id))
- return 0;
-
- AndroidTarget *target = 0;
- if (id == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID))
- target = new AndroidTarget(static_cast<Qt4Project *>(parent), id);
- Q_ASSERT(target);
-
- foreach (const Qt4ProjectManager::BuildConfigurationInfo &info, infos) {
- QString displayName = info.version()->displayName() + QLatin1Char(' ');
- displayName += (info.buildConfig & QtSupport::BaseQtVersion::DebugBuild) ? tr("Debug") : tr("Release");
- target->addQt4BuildConfiguration(displayName, QString(),
- info.version(),
- info.buildConfig,
- info.additionalArguments,
- info.directory,
- info.importing);
- }
-
- target->addDeployConfiguration(target->createDeployConfiguration(Core::Id(ANDROID_DEPLOYCONFIGURATION_ID)));
-
- target->createApplicationProFiles(false);
- if (target->runConfigurations().isEmpty())
- target->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(target));
- return target;
-}
-
-QString AndroidTargetFactory::buildNameForId(const Core::Id id) const
-{
- if (id == Core::Id(Qt4ProjectManager::Constants::ANDROID_DEVICE_TARGET_ID))
- return QLatin1String("android");
- return QString();
-}
diff --git a/src/plugins/android/androidtargetfactory.h b/src/plugins/android/androidtargetfactory.h
deleted file mode 100644
index c0f77f390d..0000000000
--- a/src/plugins/android/androidtargetfactory.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 BogDan Vatra <bog_dan_ro@yahoo.com>
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef QT4ANDROIDTARGETFACTORY_H
-#define QT4ANDROIDTARGETFACTORY_H
-
-#include "qt4projectmanager/qt4basetargetfactory.h"
-#include "qt4projectmanager/qt4target.h"
-
-namespace Android {
-namespace Internal {
-
-class AndroidTargetFactory : public Qt4ProjectManager::Qt4BaseTargetFactory
-{
- Q_OBJECT
-public:
- AndroidTargetFactory(QObject *parent = 0);
- ~AndroidTargetFactory();
-
- QList<Core::Id> supportedTargetIds() const;
- QString displayNameForId(const Core::Id id) const;
- QIcon iconForId(const Core::Id id) const;
-
- bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
- bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
- Qt4ProjectManager::Qt4BaseTarget *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
-
- bool supportsTargetId(const Core::Id id) const;
- virtual QSet<QString> targetFeatures(const Core::Id id) const;
-
- Qt4ProjectManager::Qt4BaseTarget *create(ProjectExplorer::Project *parent, const Core::Id id);
- Qt4ProjectManager::Qt4BaseTarget *create(ProjectExplorer::Project *parent, const Core::Id id,
- const QList<Qt4ProjectManager::BuildConfigurationInfo> &infos);
-
- QString buildNameForId(const Core::Id id) const;
-};
-
-} // namespace Internal
-} // namespace Android
-
-#endif // QT4ANDROIDTARGETFACTORY_H
diff --git a/src/plugins/android/androidtoolchain.cpp b/src/plugins/android/androidtoolchain.cpp
index 1c6c9c1a3a..d9955c805b 100644
--- a/src/plugins/android/androidtoolchain.cpp
+++ b/src/plugins/android/androidtoolchain.cpp
@@ -33,7 +33,7 @@
#include "androidtoolchain.h"
#include "androidconstants.h"
#include "androidconfigurations.h"
-#include "androidtarget.h"
+#include "androidmanager.h"
#include "androidqtversion.h"
#include "qt4projectmanager/qt4projectmanagerconstants.h"
@@ -103,21 +103,17 @@ void AndroidToolChain::addToEnvironment(Utils::Environment &env) const
// 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_ROOT"),
- QDir::toNativeSeparators(AndroidConfigurations::instance().config().ndkLocation));
+ 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()));
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_VERSION"), AndroidConfigurations::instance().config().ndkToolchainVersion);
// TODO that is very ugly and likely to be wrong...
Qt4Project *qt4pro = qobject_cast<Qt4Project *>(ProjectExplorer::ProjectExplorerPlugin::instance()->currentProject());
- if (!qt4pro)
- return;
- AndroidTarget *at = qobject_cast<AndroidTarget *>(qt4pro->activeTarget());
- if (!at)
+ if (!qt4pro || !qt4pro->activeTarget())
return;
env.set(QLatin1String("ANDROID_NDK_PLATFORM"),
- AndroidConfigurations::instance().bestMatch(at->targetSDK()));
+ AndroidConfigurations::instance().bestMatch(AndroidManager::targetSDK(qt4pro->activeTarget())));
}
bool AndroidToolChain::operator ==(const ProjectExplorer::ToolChain &tc) const
@@ -202,11 +198,6 @@ QList<ProjectExplorer::Abi> AndroidToolChain::detectSupportedAbis() const
return aqv->qtAbis();
}
-QString AndroidToolChain::legacyId() const
-{
- return QString::fromLatin1("%1:%2").arg(QLatin1String(Constants::ANDROID_TOOLCHAIN_ID)).arg(m_qtVersionId);
-}
-
// --------------------------------------------------------------------------
// ToolChainConfigWidget
// --------------------------------------------------------------------------
@@ -218,7 +209,7 @@ AndroidToolChainConfigWidget::AndroidToolChainConfigWidget(AndroidToolChain *tc)
QLabel *label = new QLabel;
QtSupport::BaseQtVersion *v = QtSupport::QtVersionManager::instance()->version(tc->qtVersionId());
Q_ASSERT(v);
- label->setText(tr("NDK Root: %1").arg(AndroidConfigurations::instance().config().ndkLocation));
+ label->setText(tr("NDK Root: %1").arg(AndroidConfigurations::instance().config().ndkLocation.toUserOutput()));
layout->addWidget(label);
}
@@ -323,7 +314,7 @@ QList<ProjectExplorer::ToolChain *> AndroidToolChainFactory::createToolChainList
aTc->setDisplayName(tr("Android GCC (%1-%2)")
.arg(ProjectExplorer::Abi::toString(aTc->targetAbi().architecture()))
.arg(AndroidConfigurations::instance().config().ndkToolchainVersion));
- aTc->setCompilerCommand(Utils::FileName::fromString(AndroidConfigurations::instance().gccPath(aTc->targetAbi().architecture())));
+ aTc->setCompilerCommand(AndroidConfigurations::instance().gccPath(aTc->targetAbi().architecture()));
result.append(aTc);
}
return result;
diff --git a/src/plugins/android/androidtoolchain.h b/src/plugins/android/androidtoolchain.h
index e38cbaf9c5..7563a2e6af 100644
--- a/src/plugins/android/androidtoolchain.h
+++ b/src/plugins/android/androidtoolchain.h
@@ -67,7 +67,7 @@ public:
void setQtVersionId(int);
int qtVersionId() const;
- QString legacyId() const;
+
protected:
virtual QList<ProjectExplorer::Abi> detectSupportedAbis() const;
diff --git a/src/plugins/autotoolsprojectmanager/autogenstep.cpp b/src/plugins/autotoolsprojectmanager/autogenstep.cpp
index b3c3176784..c19f8a241a 100644
--- a/src/plugins/autotoolsprojectmanager/autogenstep.cpp
+++ b/src/plugins/autotoolsprojectmanager/autogenstep.cpp
@@ -34,11 +34,11 @@
#include "autogenstep.h"
#include "autotoolsproject.h"
-#include "autotoolstarget.h"
#include "autotoolsbuildconfiguration.h"
#include "autotoolsprojectconstants.h"
#include <projectexplorer/buildsteplist.h>
+#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/gnumakeparser.h>
#include <projectexplorer/projectexplorer.h>
@@ -67,9 +67,9 @@ AutogenStepFactory::AutogenStepFactory(QObject *parent) :
QList<Core::Id> AutogenStepFactory::availableCreationIds(BuildStepList *parent) const
{
- if (parent->target()->project()->id() == Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
- return QList<Core::Id>() << Core::Id(AUTOGEN_STEP_ID);
- return QList<Core::Id>();
+ if (!canHandle(parent))
+ return QList<Core::Id>();
+ return QList<Core::Id>() << Core::Id(AUTOGEN_STEP_ID);
}
QString AutogenStepFactory::displayNameForId(const Core::Id id) const
@@ -81,13 +81,7 @@ QString AutogenStepFactory::displayNameForId(const Core::Id id) const
bool AutogenStepFactory::canCreate(BuildStepList *parent, const Core::Id id) const
{
- if (parent->target()->project()->id() != Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
- return false;
-
- if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD))
- return false;
-
- return Core::Id(AUTOGEN_STEP_ID) == id;
+ return canHandle(parent) && Core::Id(AUTOGEN_STEP_ID) == id;
}
BuildStep *AutogenStepFactory::create(BuildStepList *parent, const Core::Id id)
@@ -125,6 +119,13 @@ BuildStep *AutogenStepFactory::restore(BuildStepList *parent, const QVariantMap
return 0;
}
+bool AutogenStepFactory::canHandle(BuildStepList *parent) const
+{
+ if (parent->target()->project()->id() != Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
+ return false;
+ return parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
+}
+
////////////////////////
// AutogenStep class
////////////////////////
diff --git a/src/plugins/autotoolsprojectmanager/autogenstep.h b/src/plugins/autotoolsprojectmanager/autogenstep.h
index e000b322c7..e3d719c8e3 100644
--- a/src/plugins/autotoolsprojectmanager/autogenstep.h
+++ b/src/plugins/autotoolsprojectmanager/autogenstep.h
@@ -72,6 +72,8 @@ public:
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source);
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);
+
+ bool canHandle(ProjectExplorer::BuildStepList *parent) const;
};
///////////////////////
diff --git a/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp b/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp
index 9b43fe8f2c..cba3fd3aa8 100644
--- a/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp
+++ b/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp
@@ -34,11 +34,11 @@
#include "autoreconfstep.h"
#include "autotoolsproject.h"
-#include "autotoolstarget.h"
#include "autotoolsbuildconfiguration.h"
#include "autotoolsprojectconstants.h"
#include <projectexplorer/buildsteplist.h>
+#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/gnumakeparser.h>
#include <projectexplorer/projectexplorer.h>
@@ -66,9 +66,9 @@ AutoreconfStepFactory::AutoreconfStepFactory(QObject *parent) :
QList<Core::Id> AutoreconfStepFactory::availableCreationIds(BuildStepList *parent) const
{
- if (parent->target()->project()->id() == Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
- return QList<Core::Id>() << Core::Id(AUTORECONF_STEP_ID);
- return QList<Core::Id>();
+ if (!canHandle(parent))
+ return QList<Core::Id>();
+ return QList<Core::Id>() << Core::Id(AUTORECONF_STEP_ID);
}
QString AutoreconfStepFactory::displayNameForId(const Core::Id id) const
@@ -80,13 +80,7 @@ QString AutoreconfStepFactory::displayNameForId(const Core::Id id) const
bool AutoreconfStepFactory::canCreate(BuildStepList *parent, const Core::Id id) const
{
- if (parent->target()->project()->id() != Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
- return false;
-
- if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD))
- return false;
-
- return Core::Id(AUTORECONF_STEP_ID) == id;
+ return canHandle(parent) && Core::Id(AUTORECONF_STEP_ID) == id;
}
BuildStep *AutoreconfStepFactory::create(BuildStepList *parent, const Core::Id id)
@@ -124,6 +118,13 @@ BuildStep *AutoreconfStepFactory::restore(BuildStepList *parent, const QVariantM
return 0;
}
+bool AutoreconfStepFactory::canHandle(BuildStepList *parent) const
+{
+ if (parent->target()->project()->id() != Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
+ return false;
+ return parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
+}
+
/////////////////////////
// AutoreconfStep class
/////////////////////////
diff --git a/src/plugins/autotoolsprojectmanager/autoreconfstep.h b/src/plugins/autotoolsprojectmanager/autoreconfstep.h
index c5c5b82980..7cbae99ec0 100644
--- a/src/plugins/autotoolsprojectmanager/autoreconfstep.h
+++ b/src/plugins/autotoolsprojectmanager/autoreconfstep.h
@@ -72,6 +72,8 @@ public:
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source);
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);
+
+ bool canHandle(ProjectExplorer::BuildStepList *parent) const;
};
/////////////////////////
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp
index d4a4fb2adb..1a003558f8 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp
+++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp
@@ -35,15 +35,16 @@
#include "autotoolsbuildconfiguration.h"
#include "makestep.h"
#include "autotoolsproject.h"
-#include "autotoolstarget.h"
#include "autotoolsprojectconstants.h"
#include "autogenstep.h"
#include "autoreconfstep.h"
#include "configurestep.h"
#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/toolchain.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
+#include <projectexplorer/toolchain.h>
#include <qtsupport/customexecutablerunconfiguration.h>
#include <utils/qtcassert.h>
@@ -58,18 +59,26 @@ using namespace ProjectExplorer::Constants;
//////////////////////////////////////
// AutotoolsBuildConfiguration class
//////////////////////////////////////
-AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(AutotoolsTarget *parent)
+AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(ProjectExplorer::Target *parent)
: BuildConfiguration(parent, Core::Id(AUTOTOOLS_BC_ID))
{
- m_buildDirectory = autotoolsTarget()->defaultBuildDirectory();
+ AutotoolsProject *project = qobject_cast<AutotoolsProject *>(parent->project());
+ if (project)
+ m_buildDirectory = project->defaultBuildDirectory();
+}
+
+BuildConfigWidget *AutotoolsBuildConfiguration::createConfigWidget()
+{
+ return new AutotoolsBuildSettingsWidget;
}
-AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(AutotoolsTarget *parent, const Core::Id id)
+AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(ProjectExplorer::Target *parent, const Core::Id id)
: BuildConfiguration(parent, id)
{
}
-AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(AutotoolsTarget *parent, AutotoolsBuildConfiguration *source)
+AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(ProjectExplorer::Target *parent,
+ AutotoolsBuildConfiguration *source)
: BuildConfiguration(parent, source),
m_buildDirectory(source->m_buildDirectory)
{
@@ -88,7 +97,7 @@ bool AutotoolsBuildConfiguration::fromMap(const QVariantMap &map)
if (!BuildConfiguration::fromMap(map))
return false;
- m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY), autotoolsTarget()->defaultBuildDirectory()).toString();
+ m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY)).toString();
return true;
}
@@ -105,14 +114,9 @@ void AutotoolsBuildConfiguration::setBuildDirectory(const QString &buildDirector
emit buildDirectoryChanged();
}
-AutotoolsTarget *AutotoolsBuildConfiguration::autotoolsTarget() const
-{
- return static_cast<AutotoolsTarget *>(target());
-}
-
IOutputParser *AutotoolsBuildConfiguration::createOutputParser() const
{
- ToolChain *tc = autotoolsTarget()->autotoolsProject()->toolChain();
+ ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
if (tc)
return tc->outputParser();
return 0;
@@ -126,9 +130,9 @@ AutotoolsBuildConfigurationFactory::AutotoolsBuildConfigurationFactory(QObject *
{
}
-QList<Core::Id> AutotoolsBuildConfigurationFactory::availableCreationIds(Target *parent) const
+QList<Core::Id> AutotoolsBuildConfigurationFactory::availableCreationIds(const Target *parent) const
{
- if (!qobject_cast<AutotoolsTarget *>(parent))
+ if (!canHandle(parent))
return QList<Core::Id>();
return QList<Core::Id>() << Core::Id(AUTOTOOLS_BC_ID);
}
@@ -140,52 +144,45 @@ QString AutotoolsBuildConfigurationFactory::displayNameForId(const Core::Id id)
return QString();
}
-bool AutotoolsBuildConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
+bool AutotoolsBuildConfigurationFactory::canCreate(const Target *parent, const Core::Id id) const
{
- if (!qobject_cast<AutotoolsTarget *>(parent))
+ if (!canHandle(parent))
return false;
if (id == Core::Id(AUTOTOOLS_BC_ID))
return true;
return false;
}
-AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::create(Target *parent, const Core::Id id)
+AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::create(Target *parent, const Core::Id id, const QString &name)
{
if (!canCreate(parent, id))
return 0;
- AutotoolsTarget *t = static_cast<AutotoolsTarget *>(parent);
- AutotoolsBuildConfiguration *bc = createDefaultConfiguration(t);
-
- bool ok;
- QString buildConfigurationName = QInputDialog::getText(0,
- tr("New Configuration"),
- tr("New configuration name:"),
- QLineEdit::Normal,
- QString(),
- &ok);
-
+ bool ok = true;
+ QString buildConfigurationName = name;
+ if (buildConfigurationName.isEmpty())
+ buildConfigurationName = QInputDialog::getText(0,
+ tr("New Configuration"),
+ tr("New configuration name:"),
+ QLineEdit::Normal,
+ QString(), &ok);
+ buildConfigurationName = buildConfigurationName.trimmed();
if (!ok || buildConfigurationName.isEmpty())
return 0;
- bc->setDisplayName(buildConfigurationName);
-
- t->addBuildConfiguration(bc);
- t->addDeployConfiguration(t->createDeployConfiguration(Core::Id(DEFAULT_DEPLOYCONFIGURATION_ID)));
- // User needs to choose where the executable file is.
- // TODO: Parse the file in *Anjuta style* to be able to add custom RunConfigurations.
- t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
+ AutotoolsBuildConfiguration *bc = createDefaultConfiguration(parent);
+ bc->setDisplayName(buildConfigurationName);
return bc;
}
-AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::createDefaultConfiguration(AutotoolsTarget *target) const
+AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::createDefaultConfiguration(ProjectExplorer::Target *target)
{
AutotoolsBuildConfiguration *bc = new AutotoolsBuildConfiguration(target);
BuildStepList *buildSteps = bc->stepList(Core::Id(BUILDSTEPS_BUILD));
// ### Build Steps Build ###
// autogen.sh or autoreconf
- QFile autogenFile(target->autotoolsProject()->projectDirectory() + QLatin1String("/autogen.sh"));
+ QFile autogenFile(target->project()->projectDirectory() + QLatin1String("/autogen.sh"));
if (autogenFile.exists()) {
AutogenStep *autogenStep = new AutogenStep(buildSteps);
buildSteps->insertStep(0, autogenStep);
@@ -214,7 +211,14 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::createDefaultCo
return bc;
}
-bool AutotoolsBuildConfigurationFactory::canClone(Target *parent, BuildConfiguration *source) const
+bool AutotoolsBuildConfigurationFactory::canHandle(const Target *t) const
+{
+ if (!t->project()->supportsProfile(t->profile()))
+ return false;
+ return t->project()->id() == Core::Id(Constants::AUTOTOOLS_PROJECT_ID);
+}
+
+bool AutotoolsBuildConfigurationFactory::canClone(const Target *parent, BuildConfiguration *source) const
{
return canCreate(parent, source->id());
}
@@ -225,11 +229,10 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::clone(Target *p
return 0;
AutotoolsBuildConfiguration *origin = static_cast<AutotoolsBuildConfiguration *>(source);
- AutotoolsTarget *target(static_cast<AutotoolsTarget *>(parent));
- return new AutotoolsBuildConfiguration(target, origin);
+ return new AutotoolsBuildConfiguration(parent, origin);
}
-bool AutotoolsBuildConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
+bool AutotoolsBuildConfigurationFactory::canRestore(const Target *parent, const QVariantMap &map) const
{
return canCreate(parent, idFromMap(map));
}
@@ -238,8 +241,7 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::restore(Target
{
if (!canRestore(parent, map))
return 0;
- AutotoolsTarget *target(static_cast<AutotoolsTarget *>(parent));
- AutotoolsBuildConfiguration *bc = new AutotoolsBuildConfiguration(target);
+ AutotoolsBuildConfiguration *bc = new AutotoolsBuildConfiguration(parent);
if (bc->fromMap(map))
return bc;
delete bc;
@@ -251,3 +253,8 @@ BuildConfiguration::BuildType AutotoolsBuildConfiguration::buildType() const
// TODO: Should I return something different from Unknown?
return Unknown;
}
+
+void AutotoolsBuildConfiguration::emitBuildDirectoryInitialized()
+{
+ emit buildDirectoryInitialized();
+}
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h
index b4880f17fc..d6f712b044 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h
+++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h
@@ -35,6 +35,8 @@
#ifndef AUTOTOOLSBUILDCONFIGURATION_H
#define AUTOTOOLSBUILDCONFIGURATION_H
+#include "autotoolsbuildsettingswidget.h"
+
#include <projectexplorer/buildconfiguration.h>
namespace AutotoolsProjectManager {
@@ -49,18 +51,21 @@ class AutotoolsBuildConfiguration : public ProjectExplorer::BuildConfiguration
friend class AutotoolsBuildConfigurationFactory;
public:
- explicit AutotoolsBuildConfiguration(AutotoolsTarget *parent);
+ explicit AutotoolsBuildConfiguration(ProjectExplorer::Target *parent);
+
+ ProjectExplorer::BuildConfigWidget *createConfigWidget();
- AutotoolsTarget *autotoolsTarget() const;
QString buildDirectory() const;
void setBuildDirectory(const QString &buildDirectory);
QVariantMap toMap() const;
ProjectExplorer::IOutputParser *createOutputParser() const;
BuildType buildType() const;
+ void emitBuildDirectoryInitialized();
+
protected:
- AutotoolsBuildConfiguration(AutotoolsTarget *parent, const Core::Id id);
- AutotoolsBuildConfiguration(AutotoolsTarget *parent, AutotoolsBuildConfiguration *source);
+ AutotoolsBuildConfiguration(ProjectExplorer::Target *parent, const Core::Id id);
+ AutotoolsBuildConfiguration(ProjectExplorer::Target *parent, AutotoolsBuildConfiguration *source);
bool fromMap(const QVariantMap &map);
@@ -75,16 +80,20 @@ class AutotoolsBuildConfigurationFactory : public ProjectExplorer::IBuildConfigu
public:
explicit AutotoolsBuildConfigurationFactory(QObject *parent = 0);
- QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
+ QList<Core::Id> availableCreationIds(const ProjectExplorer::Target *parent) const;
QString displayNameForId(const Core::Id id) const;
- bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
- AutotoolsBuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
- AutotoolsBuildConfiguration *createDefaultConfiguration(AutotoolsTarget *target) const;
- bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
+ bool canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const;
+ AutotoolsBuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name = QString());
+ bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
AutotoolsBuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source);
- bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
+ bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
AutotoolsBuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
+
+ static AutotoolsBuildConfiguration *createDefaultConfiguration(ProjectExplorer::Target *target);
+
+private:
+ bool canHandle(const ProjectExplorer::Target *t) const;
};
} // namespace Internal
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.cpp b/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.cpp
index 72ed2dc159..9f8315c4cd 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.cpp
+++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.cpp
@@ -37,7 +37,7 @@
#include "autotoolsbuildconfiguration.h"
#include <projectexplorer/projectexplorer.h>
-#include <projectexplorer/toolchainmanager.h>
+#include <projectexplorer/target.h>
#include <QGridLayout>
#include <QLabel>
@@ -50,10 +50,7 @@ using namespace AutotoolsProjectManager;
using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer;
-AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget(AutotoolsTarget *target) :
- m_target(target),
- m_pathChooser(0),
- m_toolChainChooser(0),
+AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget() :
m_buildConfiguration(0)
{
QFormLayout *fl = new QFormLayout(this);
@@ -63,23 +60,8 @@ AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget(AutotoolsTarget *targ
m_pathChooser = new Utils::PathChooser(this);
m_pathChooser->setEnabled(true);
m_pathChooser->setExpectedKind(Utils::PathChooser::Directory);
- m_pathChooser->setBaseDirectory(m_target->autotoolsProject()->projectDirectory());
fl->addRow(tr("Build directory:"), m_pathChooser);
connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
-
- // tool chain
- m_toolChainChooser = new QComboBox;
- m_toolChainChooser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- updateToolChainList();
-
- fl->addRow(tr("Tool chain:"), m_toolChainChooser);
- connect(m_toolChainChooser, SIGNAL(activated(int)), this, SLOT(toolChainSelected(int)));
- connect(m_target->autotoolsProject(), SIGNAL(toolChainChanged(ProjectExplorer::ToolChain*)),
- this, SLOT(toolChainChanged(ProjectExplorer::ToolChain*)));
- connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
- this, SLOT(updateToolChainList()));
- connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainRemoved(ProjectExplorer::ToolChain*)),
- this, SLOT(updateToolChainList()));
}
QString AutotoolsBuildSettingsWidget::displayName() const
@@ -90,6 +72,7 @@ QString AutotoolsBuildSettingsWidget::displayName() const
void AutotoolsBuildSettingsWidget::init(BuildConfiguration *bc)
{
m_buildConfiguration = static_cast<AutotoolsBuildConfiguration *>(bc);
+ m_pathChooser->setBaseDirectory(bc->target()->project()->projectDirectory());
m_pathChooser->setPath(m_buildConfiguration->buildDirectory());
}
@@ -97,39 +80,3 @@ void AutotoolsBuildSettingsWidget::buildDirectoryChanged()
{
m_buildConfiguration->setBuildDirectory(m_pathChooser->rawPath());
}
-
-void AutotoolsBuildSettingsWidget::toolChainSelected(int index)
-{
- using namespace ProjectExplorer;
-
- ToolChain *tc = static_cast<ToolChain *>(m_toolChainChooser->itemData(index).value<void *>());
- m_target->autotoolsProject()->setToolChain(tc);
-}
-
-void AutotoolsBuildSettingsWidget::toolChainChanged(ProjectExplorer::ToolChain *tc)
-{
- for (int i = 0; i < m_toolChainChooser->count(); ++i) {
- ToolChain *currentTc = static_cast<ToolChain *>(m_toolChainChooser->itemData(i).value<void *>());
- if (currentTc != tc)
- continue;
- m_toolChainChooser->setCurrentIndex(i);
- return;
- }
-}
-
-void AutotoolsBuildSettingsWidget::updateToolChainList()
-{
- m_toolChainChooser->clear();
-
- QList<ToolChain *> tcs = ToolChainManager::instance()->toolChains();
- if (!m_target->autotoolsProject()->toolChain()) {
- m_toolChainChooser->addItem(tr("<Invalid tool chain>"), qVariantFromValue(static_cast<void *>(0)));
- m_toolChainChooser->setCurrentIndex(0);
- }
- foreach (ToolChain *tc, tcs) {
- m_toolChainChooser->addItem(tc->displayName(), qVariantFromValue(static_cast<void *>(tc)));
- if (m_target->autotoolsProject()->toolChain()
- && m_target->autotoolsProject()->toolChain()->id() == tc->id())
- m_toolChainChooser->setCurrentIndex(m_toolChainChooser->count() - 1);
- }
-}
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.h b/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.h
index 2cf39a5c11..4550c4906c 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.h
+++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.h
@@ -35,12 +35,10 @@
#ifndef AUTOTOOLSBUILDSETTINGSWIDGET_H
#define AUTOTOOLSBUILDSETTINGSWIDGET_H
-#include "autotoolstarget.h"
#include "autotoolsbuildconfiguration.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/project.h>
-#include <projectexplorer/toolchain.h>
#include <projectexplorer/buildstep.h>
#include <utils/pathchooser.h>
@@ -51,7 +49,7 @@ QT_END_NAMESPACE
namespace AutotoolsProjectManager {
namespace Internal {
-class AutotoolsProject;
+class AutotoolsBuildConfiguration;
/**
* @brief Implementation of ProjectExplorer::BuildConfigWidget interface.
@@ -63,21 +61,16 @@ class AutotoolsBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
Q_OBJECT
public:
- explicit AutotoolsBuildSettingsWidget(AutotoolsTarget *target);
+ AutotoolsBuildSettingsWidget();
QString displayName() const;
void init(ProjectExplorer::BuildConfiguration *bc);
private slots:
void buildDirectoryChanged();
- void toolChainSelected(int index);
- void toolChainChanged(ProjectExplorer::ToolChain *tc);
- void updateToolChainList();
private:
- AutotoolsTarget *m_target;
Utils::PathChooser *m_pathChooser;
- QComboBox *m_toolChainChooser;
AutotoolsBuildConfiguration *m_buildConfiguration;
};
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
index 190792f830..7f293b6141 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
+++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
@@ -33,6 +33,7 @@
**************************************************************************/
#include "autotoolsproject.h"
+#include "autotoolsbuildconfiguration.h"
#include "autotoolsprojectconstants.h"
#include "autotoolsmanager.h"
#include "autotoolsprojectnode.h"
@@ -43,10 +44,12 @@
#include <projectexplorer/abi.h>
#include <projectexplorer/buildenvironmentwidget.h>
-#include <projectexplorer/toolchainmanager.h>
+#include <projectexplorer/profilemanager.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
#include <extensionsystem/pluginmanager.h>
#include <cpptools/ModelManagerInterface.h>
#include <coreplugin/icore.h>
@@ -65,8 +68,6 @@ using namespace AutotoolsProjectManager;
using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer;
-const char TOOLCHAIN_KEY[] = "AutotoolsProjectManager.AutotoolsProject.Toolchain";
-
AutotoolsProject::AutotoolsProject(AutotoolsManager *manager, const QString &fileName) :
m_manager(manager),
m_fileName(fileName),
@@ -75,8 +76,7 @@ AutotoolsProject::AutotoolsProject(AutotoolsManager *manager, const QString &fil
m_rootNode(new AutotoolsProjectNode(this, m_file)),
m_fileWatcher(new Utils::FileSystemWatcher(this)),
m_watchedFiles(),
- m_makefileParserThread(0),
- m_toolChain(0)
+ m_makefileParserThread(0)
{
setProjectContext(Core::Context(Constants::PROJECT_CONTEXT));
setProjectLanguage(Core::Context(ProjectExplorer::Constants::LANG_CXX));
@@ -103,26 +103,6 @@ AutotoolsProject::~AutotoolsProject()
}
}
-void AutotoolsProject::setToolChain(ToolChain *tc)
-{
- if (m_toolChain == tc)
- return;
-
- m_toolChain = tc;
-
- foreach (Target *t, targets()) {
- foreach (BuildConfiguration *bc, t->buildConfigurations())
- bc->setToolChain(tc);
- }
-
- emit toolChainChanged(m_toolChain);
-}
-
-ToolChain *AutotoolsProject::toolChain() const
-{
- return m_toolChain;
-}
-
QString AutotoolsProject::displayName() const
{
return m_projectName;
@@ -143,11 +123,6 @@ IProjectManager *AutotoolsProject::projectManager() const
return m_manager;
}
-AutotoolsTarget *AutotoolsProject::activeTarget() const
-{
- return static_cast<AutotoolsTarget *>(Project::activeTarget());
-}
-
QString AutotoolsProject::defaultBuildDirectory() const
{
return projectDirectory();
@@ -169,13 +144,6 @@ QStringList AutotoolsProject::files(FilesMode fileMode) const
return m_files;
}
-QVariantMap AutotoolsProject::toMap() const
-{
- QVariantMap map = Project::toMap();
- map.insert(QLatin1String(TOOLCHAIN_KEY), m_toolChain ? m_toolChain->id() : QString());
- return map;
-}
-
// This function, is called at the very beginning, to
// restore the settings if there are some stored.
bool AutotoolsProject::fromMap(const QVariantMap &map)
@@ -183,57 +151,19 @@ bool AutotoolsProject::fromMap(const QVariantMap &map)
if (!Project::fromMap(map))
return false;
- // Check if this project was already loaded by checking
- // if there already exists a .user file.
- bool hasUserFile = activeTarget();
- if (!hasUserFile) {
- AutotoolsTargetFactory *factory =
- ExtensionSystem::PluginManager::getObject<AutotoolsTargetFactory>();
- AutotoolsTarget *t = factory->create(this, Core::Id(Constants::DEFAULT_AUTOTOOLS_TARGET_ID));
-
- QTC_ASSERT(t, return false);
- QTC_ASSERT(t->activeBuildConfiguration(), return false);
-
- // Ask the user for where he/she wants to build it.
- QPointer<AutotoolsOpenProjectWizard> wizard = new AutotoolsOpenProjectWizard(m_manager, projectDirectory());
- if (!wizard->exec() == QDialog::Accepted)
- return false;
-
- AutotoolsBuildConfiguration *bc =
- static_cast<AutotoolsBuildConfiguration *>(t->buildConfigurations().at(0));
- if (!wizard->buildDirectory().isEmpty())
- bc->setBuildDirectory(wizard->buildDirectory());
-
- addTarget(t);
- }
-
- // Toolchain
- QString id = map.value(QLatin1String(TOOLCHAIN_KEY)).toString();
- const ToolChainManager *toolChainManager = ToolChainManager::instance();
-
- if (!id.isNull()) {
- setToolChain(toolChainManager->findToolChain(id));
- } else {
- Abi abi = Abi::hostAbi();
- abi = Abi(abi.architecture(), abi.os(), Abi::UnknownFlavor,
- abi.binaryFormat(), abi.wordWidth() == 32 ? 32 : 0);
- QList<ToolChain *> tcs = toolChainManager->findToolChains(abi);
- if (tcs.isEmpty())
- tcs = toolChainManager->toolChains();
- if (!tcs.isEmpty())
- setToolChain(tcs.at(0));
- }
-
connect(m_fileWatcher, SIGNAL(fileChanged(QString)),
this, SLOT(onFileChanged(QString)));
// Load the project tree structure.
- loadProjectTree();
+ evaluateBuildSystem();
+
+ if (!activeTarget())
+ addTarget(createTarget(ProfileManager::instance()->defaultProfile()));
return true;
}
-void AutotoolsProject::loadProjectTree()
+void AutotoolsProject::evaluateBuildSystem()
{
if (m_makefileParserThread != 0) {
// The thread is still busy parsing a previus configuration.
@@ -325,12 +255,14 @@ void AutotoolsProject::makefileParsingFinished()
m_makefileParserThread->deleteLater();
m_makefileParserThread = 0;
+
+ buildSystemEvaluationFinished(true);
}
void AutotoolsProject::onFileChanged(const QString &file)
{
Q_UNUSED(file);
- loadProjectTree();
+ evaluateBuildSystem();
}
QStringList AutotoolsProject::buildTargets() const
@@ -483,15 +415,20 @@ void AutotoolsProject::updateCppCodeModel()
QStringList allIncludePaths = m_makefileParserThread->includePaths();
QStringList allFrameworkPaths;
-
- if (m_toolChain) {
- const QList<HeaderPath> allHeaderPaths = m_toolChain->systemHeaderPaths();
- foreach (const HeaderPath &headerPath, allHeaderPaths) {
- if (headerPath.kind() == HeaderPath::FrameworkHeaderPath) {
- allFrameworkPaths.append(headerPath.path());
- } else {
- allIncludePaths.append(headerPath.path());
+ QByteArray macros;
+
+ if (activeTarget()) {
+ ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(activeTarget()->profile());
+ if (tc) {
+ const QList<HeaderPath> allHeaderPaths = tc->systemHeaderPaths();
+ foreach (const HeaderPath &headerPath, allHeaderPaths) {
+ if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
+ allFrameworkPaths.append(headerPath.path());
+ else
+ allIncludePaths.append(headerPath.path());
}
+ macros = tc->predefinedMacros(QStringList());
+ macros += '\n';
}
}
@@ -499,7 +436,7 @@ void AutotoolsProject::updateCppCodeModel()
const bool update = (pinfo.includePaths() != allIncludePaths)
|| (pinfo.sourceFiles() != m_files)
- || (pinfo.defines() != m_toolChain->predefinedMacros(QStringList()))
+ || (pinfo.defines() != macros)
|| (pinfo.frameworkPaths() != allFrameworkPaths);
if (update) {
pinfo.clearProjectParts();
@@ -507,8 +444,7 @@ void AutotoolsProject::updateCppCodeModel()
new CPlusPlus::CppModelManagerInterface::ProjectPart);
part->includePaths = allIncludePaths;
part->sourceFiles = m_files;
- if (m_toolChain)
- part->defines = m_toolChain->predefinedMacros(QStringList());
+ part->defines = macros;
part->frameworkPaths = allFrameworkPaths;
part->language = CPlusPlus::CppModelManagerInterface::CXX;
pinfo.appendProjectPart(part);
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.h b/src/plugins/autotoolsprojectmanager/autotoolsproject.h
index e253ecc5fa..55612306bb 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsproject.h
+++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.h
@@ -35,10 +35,7 @@
#ifndef AUTOTOOLSPROJECT_H
#define AUTOTOOLSPROJECT_H
-#include "autotoolstarget.h"
-
#include <coreplugin/editormanager/ieditor.h>
-#include <projectexplorer/toolchain.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectnodes.h>
@@ -47,10 +44,6 @@
#include <QPointer>
#include <QDir>
-namespace ProjectExplorer {
-class ToolChain;
-}
-
namespace AutotoolsProjectManager {
namespace Internal {
class AutotoolsConfigurationFactory;
@@ -80,18 +73,11 @@ public:
Core::Id id() const;
Core::IDocument *document() const;
ProjectExplorer::IProjectManager *projectManager() const;
- AutotoolsTarget *activeTarget() const;
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
ProjectExplorer::ProjectNode *rootProjectNode() const;
QStringList files(FilesMode fileMode) const;
QString defaultBuildDirectory() const;
QStringList buildTargets() const;
- ProjectExplorer::ToolChain *toolChain() const;
- void setToolChain(ProjectExplorer::ToolChain *tc);
- QVariantMap toMap() const;
-
-signals:
- void toolChainChanged(ProjectExplorer::ToolChain *tc);
protected:
bool fromMap(const QVariantMap &map);
@@ -100,7 +86,7 @@ private slots:
/**
* Loads the project tree by parsing the makefiles.
*/
- void loadProjectTree();
+ void evaluateBuildSystem();
/**
* Is invoked when the makefile parsing by m_makefileParserThread has
@@ -171,8 +157,6 @@ private:
/// Responsible for parsing the makefiles asynchronously in a thread
MakefileParserThread *m_makefileParserThread;
-
- ProjectExplorer::ToolChain *m_toolChain;
};
} // namespace Internal
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectconstants.h b/src/plugins/autotoolsprojectmanager/autotoolsprojectconstants.h
index cbc442ec60..a3b3c358b2 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsprojectconstants.h
+++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectconstants.h
@@ -46,9 +46,6 @@ namespace Constants {
const char AUTOTOOLS_BC_ID[] = "AutotoolsProjectManager.AutotoolsBuildConfiguration";
const char BUILD_DIRECTORY_KEY[] = "AutotoolsProjectManager.AutotoolsBuildConfiguration.BuildDirectory";
-//Target
- const char DEFAULT_AUTOTOOLS_TARGET_ID[] = "AutotoolsProjectManager.DefaultAutotoolsTarget";
-
//Project
const char AUTOTOOLS_PROJECT_ID[] = "AutotoolsProjectManager.AutotoolsProject";
const char PROJECT_CONTEXT[] = "AutotoolsProject.ProjectContext";
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro
index b428d54a28..92cc4bc09c 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro
+++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro
@@ -12,7 +12,6 @@ HEADERS = autotoolsprojectplugin.h\
autotoolsprojectfile.h\
autotoolsprojectnode.h\
autotoolsproject.h\
- autotoolstarget.h\
autotoolsbuildsettingswidget.h\
autotoolsbuildconfiguration.h\
autotoolsprojectconstants.h\
@@ -28,7 +27,6 @@ SOURCES = autotoolsprojectplugin.cpp\
autotoolsprojectfile.cpp\
autotoolsprojectnode.cpp\
autotoolsproject.cpp\
- autotoolstarget.cpp\
autotoolsbuildsettingswidget.cpp\
autotoolsbuildconfiguration.cpp\
makestep.cpp\
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs
index c4925be4a1..78d4a6ab53 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs
+++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs
@@ -43,8 +43,6 @@ QtcPlugin {
"autotoolsprojectnode.h",
"autotoolsprojectplugin.cpp",
"autotoolsprojectplugin.h",
- "autotoolstarget.cpp",
- "autotoolstarget.h",
"configurestep.cpp",
"configurestep.h",
"makefileparser.cpp",
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp b/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp
index f8389b6c37..364594f669 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp
+++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp
@@ -34,7 +34,6 @@
#include "autotoolsprojectplugin.h"
#include "autotoolsmanager.h"
-#include "autotoolstarget.h"
#include "autotoolsbuildconfiguration.h"
#include "makestep.h"
#include "autogenstep.h"
@@ -66,7 +65,7 @@ bool AutotoolsProjectPlugin::initialize(const QStringList &arguments,
if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":autotoolsproject/AutotoolsProject.mimetypes.xml"), errorString))
return false;
- addAutoReleasedObject(new AutotoolsTargetFactory);
+ addAutoReleasedObject(new AutotoolsBuildConfigurationFactory);
addAutoReleasedObject(new MakeStepFactory);
addAutoReleasedObject(new AutogenStepFactory);
addAutoReleasedObject(new ConfigureStepFactory);
diff --git a/src/plugins/autotoolsprojectmanager/autotoolstarget.cpp b/src/plugins/autotoolsprojectmanager/autotoolstarget.cpp
deleted file mode 100644
index c7917e50b1..0000000000
--- a/src/plugins/autotoolsprojectmanager/autotoolstarget.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2010-2011 Openismus GmbH.
-** Authors: Peter Penz (ppenz@openismus.com)
-** Patricia Santana Cruz (patriciasantanacruz@gmail.com)
-**
-** Contact: Nokia Corporation (info@qt.nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at info@qt.nokia.com.
-**
-**************************************************************************/
-
-#include "autotoolstarget.h"
-#include "autotoolsproject.h"
-#include "autotoolsprojectconstants.h"
-#include "autotoolsbuildsettingswidget.h"
-#include "autotoolsbuildconfiguration.h"
-#include "makestep.h"
-#include "autogenstep.h"
-#include "autoreconfstep.h"
-#include "configurestep.h"
-
-#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
-#include <extensionsystem/pluginmanager.h>
-
-#include <QApplication>
-#include <QStyle>
-
-using namespace AutotoolsProjectManager;
-using namespace AutotoolsProjectManager::Internal;
-using namespace ProjectExplorer;
-
-static QString displayNameForId(const Core::Id id)
-{
- if (id == Core::Id(AutotoolsProjectManager::Constants::DEFAULT_AUTOTOOLS_TARGET_ID))
- return QApplication::translate("AutotoolsProjectManager::Internal::AutotoolsTarget",
- "Desktop", "Autotools Default target display name");
- return QString();
-}
-
-//////////////////////////
-// AutotoolsTarget class
-//////////////////////////
-
-AutotoolsTarget::AutotoolsTarget(AutotoolsProject *parent) :
- Target(parent, Core::Id(Constants::DEFAULT_AUTOTOOLS_TARGET_ID)),
- m_buildConfigurationFactory(new AutotoolsBuildConfigurationFactory(this))
-{
- setDefaultDisplayName(displayNameForId(id()));
- setIcon(qApp->style()->standardIcon(QStyle::SP_ComputerIcon));
-}
-
-BuildConfigWidget *AutotoolsTarget::createConfigWidget()
-{
- return new AutotoolsBuildSettingsWidget(this);
-}
-
-
-AutotoolsProject *AutotoolsTarget::autotoolsProject() const
-{
- return static_cast<AutotoolsProject *>(project());
-}
-
-AutotoolsBuildConfiguration *AutotoolsTarget::activeBuildConfiguration() const
-{
- return static_cast<AutotoolsBuildConfiguration *>(Target::activeBuildConfiguration());
-}
-
-AutotoolsBuildConfigurationFactory *AutotoolsTarget::buildConfigurationFactory() const
-{
- return m_buildConfigurationFactory;
-}
-
-QString AutotoolsTarget::defaultBuildDirectory() const
-{
- return autotoolsProject()->defaultBuildDirectory();
-}
-
-bool AutotoolsTarget::fromMap(const QVariantMap &map)
-{
- return Target::fromMap(map);
-}
-
-/////////////////////////////////
-// AutotoolsTargetFactory class
-/////////////////////////////////
-AutotoolsTargetFactory::AutotoolsTargetFactory(QObject *parent) :
- ITargetFactory(parent)
-{
-}
-
-bool AutotoolsTargetFactory::supportsTargetId(const Core::Id id) const
-{
- return id == Core::Id(Constants::DEFAULT_AUTOTOOLS_TARGET_ID);
-}
-
-QList<Core::Id> AutotoolsTargetFactory::supportedTargetIds() const
-{
- return QList<Core::Id>() << Core::Id(Constants::DEFAULT_AUTOTOOLS_TARGET_ID);
-}
-
-QString AutotoolsTargetFactory::displayNameForId(const Core::Id id) const
-{
- return ::displayNameForId(id);
-}
-
-bool AutotoolsTargetFactory::canCreate(Project *parent, const Core::Id id) const
-{
- if (!qobject_cast<AutotoolsProject *>(parent))
- return false;
- return id == Core::Id(Constants::DEFAULT_AUTOTOOLS_TARGET_ID);
-}
-
-AutotoolsTarget *AutotoolsTargetFactory::create(Project *parent, const Core::Id id)
-{
- if (!canCreate(parent, id))
- return 0;
-
- AutotoolsProject *project(static_cast<AutotoolsProject *>(parent));
- AutotoolsTarget *t = new AutotoolsTarget(project);
-
- // Add default build configuration:
- AutotoolsBuildConfigurationFactory *bcf = t->buildConfigurationFactory();
- AutotoolsBuildConfiguration *bc = bcf->createDefaultConfiguration(t);
- bc->setDisplayName(tr("Default Build"));
-
- t->addBuildConfiguration(bc);
- t->addDeployConfiguration(t->createDeployConfiguration(Core::Id(ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID)));
- // User needs to choose where the executable file is.
- // TODO: Parse the file in *Anjuta style* to be able to add custom RunConfigurations.
- t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
-
- return t;
-}
-
-bool AutotoolsTargetFactory::canRestore(Project *parent, const QVariantMap &map) const
-{
- return canCreate(parent, idFromMap(map));
-}
-
-AutotoolsTarget *AutotoolsTargetFactory::restore(Project *parent, const QVariantMap &map)
-{
- if (!canRestore(parent, map))
- return 0;
- AutotoolsProject *autotoolsproject(static_cast<AutotoolsProject *>(parent));
- AutotoolsTarget *target = new AutotoolsTarget(autotoolsproject);
- if (target->fromMap(map))
- return target;
- delete target;
- return 0;
-}
diff --git a/src/plugins/autotoolsprojectmanager/autotoolstarget.h b/src/plugins/autotoolsprojectmanager/autotoolstarget.h
deleted file mode 100644
index 64589805a3..0000000000
--- a/src/plugins/autotoolsprojectmanager/autotoolstarget.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2010-2011 Openismus GmbH.
-** Authors: Peter Penz (ppenz@openismus.com)
-** Patricia Santana Cruz (patriciasantanacruz@gmail.com)
-**
-** Contact: Nokia Corporation (info@qt.nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at info@qt.nokia.com.
-**
-**************************************************************************/
-
-#ifndef AUTOTOOLSTARGET_H
-#define AUTOTOOLSTARGET_H
-
-#include "autotoolsbuildconfiguration.h"
-
-#include <projectexplorer/target.h>
-
-namespace AutotoolsProjectManager {
-namespace Internal {
-
-class AutotoolsTargetFactory;
-class AutotoolsBuildConfiguration;
-class AutotoolsBuildConfigurationFactory;
-class AutotoolsProject;
-
-///////////////////////////
-//// AutotoolsTarget class
-///////////////////////////
-class AutotoolsTarget : public ProjectExplorer::Target
-{
- Q_OBJECT
- friend class AutotoolsTargetFactory;
-
-public:
- explicit AutotoolsTarget(AutotoolsProject *parent);
-
- ProjectExplorer::BuildConfigWidget *createConfigWidget();
- AutotoolsProject *autotoolsProject() const;
- AutotoolsBuildConfigurationFactory *buildConfigurationFactory() const;
- AutotoolsBuildConfiguration *activeBuildConfiguration() const;
- QString defaultBuildDirectory() const;
-
-protected:
- bool fromMap(const QVariantMap &map);
-
-private:
- AutotoolsBuildConfigurationFactory *m_buildConfigurationFactory;
-};
-
-
-//////////////////////////////////
-//// AutotoolsTargetFactory class
-//////////////////////////////////
-class AutotoolsTargetFactory : public ProjectExplorer::ITargetFactory
-{
- Q_OBJECT
-
-public:
- explicit AutotoolsTargetFactory(QObject *parent = 0);
-
- bool supportsTargetId(const Core::Id id) const;
-
- QList<Core::Id> supportedTargetIds() const;
- QString displayNameForId(const Core::Id id) const;
-
- bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
- AutotoolsTarget *create(ProjectExplorer::Project *parent, const Core::Id id);
- bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
- AutotoolsTarget *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
-};
-
-} // namespace Internal
-} // namespace AutotoolsProjectManager
-
-#endif // AUTOTOOLSTARGET_H
diff --git a/src/plugins/autotoolsprojectmanager/configurestep.cpp b/src/plugins/autotoolsprojectmanager/configurestep.cpp
index e1af40dd17..b6bdbef72b 100644
--- a/src/plugins/autotoolsprojectmanager/configurestep.cpp
+++ b/src/plugins/autotoolsprojectmanager/configurestep.cpp
@@ -34,11 +34,11 @@
#include "configurestep.h"
#include "autotoolsproject.h"
-#include "autotoolstarget.h"
#include "autotoolsbuildconfiguration.h"
#include "autotoolsprojectconstants.h"
#include <projectexplorer/buildsteplist.h>
+#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/gnumakeparser.h>
#include <projectexplorer/projectexplorer.h>
@@ -67,9 +67,9 @@ ConfigureStepFactory::ConfigureStepFactory(QObject *parent) :
QList<Core::Id> ConfigureStepFactory::availableCreationIds(BuildStepList *parent) const
{
- if (parent->target()->project()->id() == Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
- return QList<Core::Id>() << Core::Id(CONFIGURE_STEP_ID);
- return QList<Core::Id>();
+ if (!canHandle(parent))
+ return QList<Core::Id>();
+ return QList<Core::Id>() << Core::Id(CONFIGURE_STEP_ID);
}
QString ConfigureStepFactory::displayNameForId(const Core::Id id) const
@@ -81,13 +81,7 @@ QString ConfigureStepFactory::displayNameForId(const Core::Id id) const
bool ConfigureStepFactory::canCreate(BuildStepList *parent, const Core::Id id) const
{
- if (parent->target()->project()->id() != Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
- return false;
-
- if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD))
- return false;
-
- return Core::Id(CONFIGURE_STEP_ID) == id;
+ return canHandle(parent) && Core::Id(CONFIGURE_STEP_ID) == id;
}
BuildStep *ConfigureStepFactory::create(BuildStepList *parent, const Core::Id id)
@@ -125,6 +119,13 @@ BuildStep *ConfigureStepFactory::restore(BuildStepList *parent, const QVariantMa
return 0;
}
+bool ConfigureStepFactory::canHandle(BuildStepList *parent) const
+{
+ if (parent->target()->project()->id() != Core::Id(Constants::AUTOTOOLS_PROJECT_ID))
+ return false;
+ return parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
+}
+
////////////////////////
// ConfigureStep class
////////////////////////
@@ -229,6 +230,19 @@ QVariantMap ConfigureStep::toMap() const
return map;
}
+bool ConfigureStep::processSucceeded(int exitCode, QProcess::ExitStatus status)
+{
+ if (exitCode != 0 || status != QProcess::NormalExit)
+ return false;
+ AutotoolsBuildConfiguration *bc = qobject_cast<AutotoolsBuildConfiguration *>(buildConfiguration());
+ if (!bc)
+ bc = qobject_cast<AutotoolsBuildConfiguration *>(target()->activeBuildConfiguration());
+ if (!bc)
+ return true;
+ bc->emitBuildDirectoryInitialized();
+ return true;
+}
+
bool ConfigureStep::fromMap(const QVariantMap &map)
{
m_additionalArguments = map.value(QLatin1String(CONFIGURE_ADDITIONAL_ARGUMENTS_KEY)).toString();
diff --git a/src/plugins/autotoolsprojectmanager/configurestep.h b/src/plugins/autotoolsprojectmanager/configurestep.h
index 884384427b..eb749385f6 100644
--- a/src/plugins/autotoolsprojectmanager/configurestep.h
+++ b/src/plugins/autotoolsprojectmanager/configurestep.h
@@ -72,6 +72,8 @@ public:
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source);
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);
+
+ bool canHandle(ProjectExplorer::BuildStepList *parent) const;
};
//////////////////////////
@@ -104,6 +106,8 @@ public:
QString additionalArguments() const;
QVariantMap toMap() const;
+ bool processSucceeded(int exitCode, QProcess::ExitStatus status);
+
public slots:
void setAdditionalArguments(const QString &list);
diff --git a/src/plugins/autotoolsprojectmanager/makestep.cpp b/src/plugins/autotoolsprojectmanager/makestep.cpp
index d01a13a8ce..508ab16371 100644
--- a/src/plugins/autotoolsprojectmanager/makestep.cpp
+++ b/src/plugins/autotoolsprojectmanager/makestep.cpp
@@ -36,11 +36,12 @@
#include "autotoolsproject.h"
#include "autotoolsprojectconstants.h"
#include "autotoolsbuildconfiguration.h"
-#include "autotoolstarget.h"
#include <projectexplorer/buildsteplist.h>
+#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/gnumakeparser.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/qtcprocess.h>
@@ -65,8 +66,7 @@ const char MAKE_STEP_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.MakeS
//////////////////////////
MakeStepFactory::MakeStepFactory(QObject *parent) :
IBuildStepFactory(parent)
-{
-}
+{ setObjectName(QLatin1String("Autotools::MakeStepFactory")); }
QList<Core::Id> MakeStepFactory::availableCreationIds(BuildStepList *parent) const
{
@@ -87,9 +87,6 @@ bool MakeStepFactory::canCreate(BuildStepList *parent, const Core::Id id) const
if (parent->target()->project()->id() != Core::Id(AUTOTOOLS_PROJECT_ID))
return false;
- if (parent->id() != Core::Id(BUILDSTEPS_BUILD))
- return false;
-
return Core::Id(MAKE_STEP_ID) == id;
}
@@ -178,16 +175,18 @@ bool MakeStep::init()
setIgnoreReturnValue(m_clean);
+ ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(bc->target()->profile());
+
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
pp->setEnvironment(bc->environment());
pp->setWorkingDirectory(bc->buildDirectory());
- pp->setCommand(bc->toolChain()->makeCommand());
+ pp->setCommand(tc ? tc->makeCommand() : QLatin1String("make"));
pp->setArguments(arguments);
setOutputParser(new GnuMakeParser());
- if (bc->autotoolsTarget()->autotoolsProject()->toolChain())
- appendOutputParser(bc->autotoolsTarget()->autotoolsProject()->toolChain()->outputParser());
+ if (tc)
+ appendOutputParser(tc->outputParser());
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
@@ -291,7 +290,7 @@ QString MakeStepConfigWidget::summaryText() const
void MakeStepConfigWidget::updateDetails()
{
AutotoolsBuildConfiguration *bc = m_makeStep->autotoolsBuildConfiguration();
- ToolChain *tc = bc->toolChain();
+ ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(m_makeStep->target()->profile());
if (tc) {
QString arguments = Utils::QtcProcess::joinArgs(m_makeStep->m_buildTargets);
@@ -305,7 +304,7 @@ void MakeStepConfigWidget::updateDetails()
param.setArguments(arguments);
m_summaryText = param.summary(displayName());
} else {
- m_summaryText = tr("<b>Unknown tool chain</b>");
+ m_summaryText = tr("<b>No tool chain set up for this profile</b>");
}
emit updateSummary();
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
index 38ba67a582..5597225e4a 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
@@ -34,12 +34,11 @@
#include "cmakeopenprojectwizard.h"
#include "cmakeproject.h"
-#include "cmaketarget.h"
-#include <projectexplorer/projectexplorerconstants.h>
-#include <projectexplorer/toolchainmanager.h>
-#include <projectexplorer/toolchain.h>
#include <projectexplorer/buildsteplist.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
#include <QInputDialog>
@@ -49,17 +48,19 @@ using namespace Internal;
namespace {
const char CMAKE_BC_ID[] = "CMakeProjectManager.CMakeBuildConfiguration";
-const char TOOLCHAIN_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.ToolChain";
const char BUILD_DIRECTORY_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.BuildDirectory";
} // namespace
-CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeTarget *parent) :
+CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent) :
BuildConfiguration(parent, Core::Id(CMAKE_BC_ID))
{
- m_buildDirectory = cmakeTarget()->defaultBuildDirectory();
+ CMakeProject *project = qobject_cast<CMakeProject *>(parent->project());
+ if (project)
+ m_buildDirectory = project->defaultBuildDirectory();
}
-CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeTarget *parent, CMakeBuildConfiguration *source) :
+CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent,
+ CMakeBuildConfiguration *source) :
BuildConfiguration(parent, source),
m_buildDirectory(source->m_buildDirectory),
m_msvcVersion(source->m_msvcVersion)
@@ -71,7 +72,6 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeTarget *parent, CMakeBuild
QVariantMap CMakeBuildConfiguration::toMap() const
{
QVariantMap map(ProjectExplorer::BuildConfiguration::toMap());
- map.insert(QLatin1String(TOOLCHAIN_KEY), toolChain() ? toolChain()->id() : QString());
map.insert(QLatin1String(BUILD_DIRECTORY_KEY), m_buildDirectory);
return map;
}
@@ -81,46 +81,17 @@ bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
if (!BuildConfiguration::fromMap(map))
return false;
- setToolChain(ProjectExplorer::ToolChainManager::instance()->
- findToolChain(map.value(QLatin1String(TOOLCHAIN_KEY)).toString()));
-
- if (!toolChain()) {
- // restoring from older versions?
- QList<ProjectExplorer::ToolChain *> list = ProjectExplorer::ToolChainManager::instance()->toolChains();
- if (!map.value("CMakeProjectManager.CMakeBuildConfiguration.MsvcVersion").toString().isEmpty()) {
- foreach (ProjectExplorer::ToolChain *tc, list) {
- if (tc->id().startsWith(ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID)) {
- setToolChain(tc);
- break;
- }
- }
- } else {
-#ifdef Q_OS_WIN
- QString toolChainId = ProjectExplorer::Constants::MINGW_TOOLCHAIN_ID;
-#else
- QString toolChainId = ProjectExplorer::Constants::GCC_TOOLCHAIN_ID;
-#endif
- foreach (ProjectExplorer::ToolChain *tc, list) {
- if (tc->id().startsWith(toolChainId)) {
- setToolChain(tc);
- break;
- }
- }
- }
- }
-
- m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY), cmakeTarget()->defaultBuildDirectory()).toString();
+ m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY)).toString();
return true;
}
CMakeBuildConfiguration::~CMakeBuildConfiguration()
-{
-}
+{ }
-CMakeTarget *CMakeBuildConfiguration::cmakeTarget() const
+ProjectExplorer::BuildConfigWidget *CMakeBuildConfiguration::createConfigWidget()
{
- return static_cast<CMakeTarget *>(target());
+ return new CMakeBuildSettingsWidget;
}
QString CMakeBuildConfiguration::buildDirectory() const
@@ -139,16 +110,16 @@ void CMakeBuildConfiguration::setBuildDirectory(const QString &buildDirectory)
ProjectExplorer::IOutputParser *CMakeBuildConfiguration::createOutputParser() const
{
- if (toolChain())
- return toolChain()->outputParser();
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
+ if (tc)
+ return tc->outputParser();
return 0;
}
Utils::Environment CMakeBuildConfiguration::baseEnvironment() const
{
Utils::Environment env = BuildConfiguration::baseEnvironment();
- if (toolChain())
- toolChain()->addToEnvironment(env);
+ target()->profile()->addToEnvironment(env);
return env;
}
@@ -165,9 +136,9 @@ CMakeBuildConfigurationFactory::~CMakeBuildConfigurationFactory()
{
}
-QList<Core::Id> CMakeBuildConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
+QList<Core::Id> CMakeBuildConfigurationFactory::availableCreationIds(const ProjectExplorer::Target *parent) const
{
- if (!qobject_cast<CMakeTarget *>(parent))
+ if (!canHandle(parent))
return QList<Core::Id>();
return QList<Core::Id>() << Core::Id(CMAKE_BC_ID);
}
@@ -179,34 +150,37 @@ QString CMakeBuildConfigurationFactory::displayNameForId(const Core::Id id) cons
return QString();
}
-bool CMakeBuildConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
+bool CMakeBuildConfigurationFactory::canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const
{
- if (!qobject_cast<CMakeTarget *>(parent))
+ if (!canHandle(parent))
return false;
if (id == Core::Id(CMAKE_BC_ID))
return true;
return false;
}
-CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
+CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name)
{
if (!canCreate(parent, id))
return 0;
- CMakeTarget *cmtarget = static_cast<CMakeTarget *>(parent);
- Q_ASSERT(cmtarget);
-
- //TODO configuration name should be part of the cmakeopenprojectwizard
- bool ok;
- QString buildConfigurationName = QInputDialog::getText(0,
- tr("New Configuration"),
- tr("New configuration name:"),
- QLineEdit::Normal,
- QString(),
- &ok);
+ CMakeProject *project = qobject_cast<CMakeProject *>(parent->project());
+ if (!project)
+ return 0;
+
+ bool ok = true;
+ QString buildConfigurationName = name;
+ if (buildConfigurationName.isEmpty())
+ buildConfigurationName = QInputDialog::getText(0,
+ tr("New Configuration"),
+ tr("New configuration name:"),
+ QLineEdit::Normal,
+ QString(), &ok);
+ buildConfigurationName = buildConfigurationName.trimmed();
if (!ok || buildConfigurationName.isEmpty())
return 0;
- CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(cmtarget);
+
+ CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent);
bc->setDisplayName(buildConfigurationName);
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
@@ -220,28 +194,25 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer:
cleanMakeStep->setAdditionalArguments("clean");
cleanMakeStep->setClean(true);
- CMakeOpenProjectWizard copw(cmtarget->cmakeProject()->projectManager(),
- cmtarget->project()->projectDirectory(),
+ CMakeOpenProjectWizard copw(project->projectManager(),
+ project->projectDirectory(),
bc->buildDirectory(),
bc->environment());
if (copw.exec() != QDialog::Accepted) {
delete bc;
return 0;
}
- bc->setToolChain(copw.toolChain());
- cmtarget->addBuildConfiguration(bc); // this also makes the name unique
bc->setBuildDirectory(copw.buildDirectory());
- cmtarget->cmakeProject()->parseCMakeLists();
// Default to all
- if (cmtarget->cmakeProject()->hasBuildTarget("all"))
+ if (project->hasBuildTarget("all"))
makeStep->setBuildTarget("all", true);
return bc;
}
-bool CMakeBuildConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const
+bool CMakeBuildConfigurationFactory::canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const
{
return canCreate(parent, source->id());
}
@@ -251,11 +222,10 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::clone(ProjectExplorer::
if (!canClone(parent, source))
return 0;
CMakeBuildConfiguration *old = static_cast<CMakeBuildConfiguration *>(source);
- CMakeTarget *cmtarget(static_cast<CMakeTarget *>(parent));
- return new CMakeBuildConfiguration(cmtarget, old);
+ return new CMakeBuildConfiguration(parent, old);
}
-bool CMakeBuildConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
+bool CMakeBuildConfigurationFactory::canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
}
@@ -264,14 +234,20 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::restore(ProjectExplorer
{
if (!canRestore(parent, map))
return 0;
- CMakeTarget *cmtarget(static_cast<CMakeTarget *>(parent));
- CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(cmtarget);
+ CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent);
if (bc->fromMap(map))
return bc;
delete bc;
return 0;
}
+bool CMakeBuildConfigurationFactory::canHandle(const ProjectExplorer::Target *t) const
+{
+ if (!t->project()->supportsProfile(t->profile()))
+ return false;
+ return qobject_cast<CMakeProject *>(t->project());
+}
+
ProjectExplorer::BuildConfiguration::BuildType CMakeBuildConfiguration::buildType() const
{
QString cmakeBuildType;
@@ -303,4 +279,3 @@ ProjectExplorer::BuildConfiguration::BuildType CMakeBuildConfiguration::buildTyp
return Unknown;
}
-
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
index b0f7bb33dd..01be5dab51 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
+++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
@@ -43,7 +43,6 @@ class ToolChain;
namespace CMakeProjectManager {
namespace Internal {
-class CMakeTarget;
class CMakeBuildConfigurationFactory;
class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
@@ -52,12 +51,11 @@ class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
friend class CMakeBuildConfigurationFactory;
public:
- CMakeBuildConfiguration(CMakeTarget *parent);
+ CMakeBuildConfiguration(ProjectExplorer::Target *parent);
~CMakeBuildConfiguration();
- CMakeTarget *cmakeTarget() const;
-
- virtual QString buildDirectory() const;
+ ProjectExplorer::BuildConfigWidget *createConfigWidget();
+ QString buildDirectory() const;
void setBuildDirectory(const QString &buildDirectory);
@@ -70,7 +68,7 @@ public:
BuildType buildType() const;
protected:
- CMakeBuildConfiguration(CMakeTarget *parent, CMakeBuildConfiguration *source);
+ CMakeBuildConfiguration(ProjectExplorer::Target *parent, CMakeBuildConfiguration *source);
virtual bool fromMap(const QVariantMap &map);
private:
@@ -86,15 +84,18 @@ public:
CMakeBuildConfigurationFactory(QObject *parent = 0);
~CMakeBuildConfigurationFactory();
- QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
+ QList<Core::Id> availableCreationIds(const ProjectExplorer::Target *parent) const;
QString displayNameForId(const Core::Id id) const;
- bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
- CMakeBuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
- bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
+ bool canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const;
+ CMakeBuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name = QString());
+ bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
CMakeBuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source);
- bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
+ bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
CMakeBuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
+
+private:
+ bool canHandle(const ProjectExplorer::Target *t) const;
};
} // namespace Internal
diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp
index 50cdf33bf3..03f2a90cc2 100644
--- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp
@@ -31,12 +31,12 @@
**************************************************************************/
#include "cmakelocatorfilter.h"
-#include "cmaketarget.h"
#include "cmakeproject.h"
#include "makestep.h"
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
+#include <projectexplorer/target.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/buildsteplist.h>
diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
index c21b5a4559..d4461b54e5 100644
--- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
@@ -34,7 +34,8 @@
#include "cmakeprojectmanager.h"
#include <utils/pathchooser.h>
-#include <projectexplorer/toolchainmanager.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/profilemanager.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/abi.h>
#include <texteditor/fontsettings.h>
@@ -65,8 +66,7 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const
: m_cmakeManager(cmakeManager),
m_sourceDirectory(sourceDirectory),
m_creatingCbpFiles(false),
- m_environment(env),
- m_toolChain(0)
+ m_environment(env)
{
int startid;
if (hasInSourceBuild()) {
@@ -98,8 +98,7 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const
: m_cmakeManager(cmakeManager),
m_sourceDirectory(sourceDirectory),
m_creatingCbpFiles(true),
- m_environment(env),
- m_toolChain(0)
+ m_environment(env)
{
CMakeRunPage::Mode rmode;
@@ -119,8 +118,7 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const
: m_cmakeManager(cmakeManager),
m_sourceDirectory(sourceDirectory),
m_creatingCbpFiles(true),
- m_environment(env),
- m_toolChain(0)
+ m_environment(env)
{
m_buildDirectory = oldBuildDirectory;
addPage(new ShadowBuildPage(this, true));
@@ -200,17 +198,6 @@ void CMakeOpenProjectWizard::setArguments(const QString &args)
m_arguments = args;
}
-ProjectExplorer::ToolChain *CMakeOpenProjectWizard::toolChain() const
-{
- return m_toolChain;
-}
-
-void CMakeOpenProjectWizard::setToolChain(ProjectExplorer::ToolChain *tc)
-{
- m_toolChain = tc;
-}
-
-
Utils::Environment CMakeOpenProjectWizard::environment() const
{
return m_environment;
@@ -414,51 +401,50 @@ void CMakeRunPage::initializePage()
Q_UNUSED(cmakeCxxCompiler);
m_generatorComboBox->clear();
bool hasCodeBlocksGenerator = m_cmakeWizard->cmakeManager()->hasCodeBlocksMsvcGenerator();
- ProjectExplorer::Abi abi = ProjectExplorer::Abi::hostAbi();
- abi = ProjectExplorer::Abi(abi.architecture(), abi.os(), ProjectExplorer::Abi::UnknownFlavor,
- abi.binaryFormat(), 0);
- QList<ProjectExplorer::ToolChain *> tcs =
- ProjectExplorer::ToolChainManager::instance()->findToolChains(abi);
- foreach (ProjectExplorer::ToolChain *tc, tcs) {
+ QList<ProjectExplorer::Profile *> profileList =
+ ProjectExplorer::ProfileManager::instance()->profiles();
+
+ foreach (ProjectExplorer::Profile *p, profileList) {
+ QVariant profileVariant = qVariantFromValue(static_cast<void *>(p));
+
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
ProjectExplorer::Abi targetAbi = tc->targetAbi();
- QVariant tcVariant = qVariantFromValue(static_cast<void *>(tc));
if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor) {
if (hasCodeBlocksGenerator && (cachedGenerator.isEmpty() || cachedGenerator == "NMake Makefiles"))
- m_generatorComboBox->addItem(tr("NMake Generator (%1)").arg(tc->displayName()), tcVariant);
+ m_generatorComboBox->addItem(tr("NMake Generator (%1)").arg(p->displayName()), profileVariant);
} else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) {
if (cachedGenerator.isEmpty() || cachedGenerator == "MinGW Makefiles")
- m_generatorComboBox->addItem(tr("MinGW Generator (%1)").arg(tc->displayName()), tcVariant);
+ m_generatorComboBox->addItem(tr("MinGW Generator (%1)").arg(p->displayName()), profileVariant);
}
} else {
// Non windows
if (cachedGenerator.isEmpty() || cachedGenerator == "Unix Makefiles")
- m_generatorComboBox->addItem(tr("Unix Generator (%1)").arg(tc->displayName()), tcVariant);
+ m_generatorComboBox->addItem(tr("Unix Generator (%1)").arg(p->displayName()), profileVariant);
}
}
}
void CMakeRunPage::runCMake()
{
- if (m_cmakeExecutable) {
+ if (m_cmakeExecutable)
// We asked the user for the cmake executable
m_cmakeWizard->cmakeManager()->setCMakeExecutable(m_cmakeExecutable->path());
- }
int index = m_generatorComboBox->currentIndex();
- ProjectExplorer::ToolChain *tc = 0;
+ ProjectExplorer::Profile *p = 0;
if (index >= 0)
- tc = static_cast<ProjectExplorer::ToolChain *>(m_generatorComboBox->itemData(index).value<void *>());
- if (!tc) {
+ p = static_cast<ProjectExplorer::Profile *>(m_generatorComboBox->itemData(index).value<void *>());
+ if (!p) {
m_output->appendPlainText(tr("No generator selected."));
return;
}
- m_cmakeWizard->setToolChain(tc);
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
m_runCMake->setEnabled(false);
m_argumentsLineEdit->setEnabled(false);
@@ -473,12 +459,9 @@ void CMakeRunPage::runCMake()
generator = QLatin1String("-GCodeBlocks - NMake Makefiles");
}
-
Utils::Environment env = m_cmakeWizard->environment();
tc->addToEnvironment(env);
-
-
m_output->clear();
if (m_cmakeWizard->cmakeManager()->isCMakeExecutableValid()) {
diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h
index 5a0984de77..2118649e15 100644
--- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h
+++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h
@@ -90,8 +90,6 @@ public:
CMakeManager *cmakeManager() const;
QString arguments() const;
void setArguments(const QString &args);
- ProjectExplorer::ToolChain *toolChain() const;
- void setToolChain(ProjectExplorer::ToolChain *);
Utils::Environment environment() const;
bool existsUpToDateXmlFile() const;
@@ -104,7 +102,6 @@ private:
QString m_arguments;
bool m_creatingCbpFiles;
Utils::Environment m_environment;
- ProjectExplorer::ToolChain *m_toolChain;
};
class InSourceBuildPage : public QWizardPage
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index 1e2b642a40..8423f85d33 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -31,10 +31,11 @@
**************************************************************************/
#include "cmakeproject.h"
+
+#include "cmakebuildconfiguration.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectnodes.h"
#include "cmakerunconfiguration.h"
-#include "cmaketarget.h"
#include "makestep.h"
#include "cmakeopenprojectwizard.h"
#include "cmakebuildconfiguration.h"
@@ -46,7 +47,11 @@
#include <projectexplorer/buildenvironmentwidget.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/buildmanager.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/profilemanager.h>
#include <projectexplorer/toolchain.h>
+#include <projectexplorer/target.h>
+#include <qtsupport/customexecutablerunconfiguration.h>
#include <cpptools/ModelManagerInterface.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
@@ -107,6 +112,8 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
connect(this, SIGNAL(addedTarget(ProjectExplorer::Target*)),
SLOT(targetAdded(ProjectExplorer::Target*)));
+ connect(this, SIGNAL(buildDirectoryChanged()),
+ this, SLOT(triggerBuildSystemEvaluation()));
}
CMakeProject::~CMakeProject()
@@ -130,7 +137,7 @@ void CMakeProject::fileChanged(const QString &fileName)
{
Q_UNUSED(fileName)
- parseCMakeLists();
+ evaluateBuildSystem();
}
void CMakeProject::changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration *bc)
@@ -168,7 +175,7 @@ void CMakeProject::changeActiveBuildConfiguration(ProjectExplorer::BuildConfigur
copw.exec();
}
// reparse
- parseCMakeLists();
+ evaluateBuildSystem();
}
void CMakeProject::targetAdded(ProjectExplorer::Target *t)
@@ -183,7 +190,7 @@ void CMakeProject::targetAdded(ProjectExplorer::Target *t)
void CMakeProject::changeBuildDirectory(CMakeBuildConfiguration *bc, const QString &newBuildDirectory)
{
bc->setBuildDirectory(newBuildDirectory);
- parseCMakeLists();
+ evaluateBuildSystem();
}
QString CMakeProject::defaultBuildDirectory() const
@@ -191,23 +198,31 @@ QString CMakeProject::defaultBuildDirectory() const
return projectDirectory() + QLatin1String("/qtcreator-build");
}
-bool CMakeProject::parseCMakeLists()
+void CMakeProject::evaluateBuildSystem()
{
if (!activeTarget() ||
- !activeTarget()->activeBuildConfiguration())
- return false;
+ !activeTarget()->activeBuildConfiguration()) {
+ buildSystemEvaluationFinished(false);
+ return;
+ }
+
+ CMakeBuildConfiguration *activeBC = qobject_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
+ if (!activeBC) {
+ buildSystemEvaluationFinished(false);
+ return;
+ }
foreach (Core::IEditor *editor, Core::EditorManager::instance()->openedEditors())
if (isProjectFile(editor->document()->fileName()))
editor->document()->infoBar()->removeInfo(QLatin1String("CMakeEditor.RunCMake"));
// Find cbp file
- CMakeBuildConfiguration *activeBC = activeTarget()->activeBuildConfiguration();
QString cbpFile = CMakeManager::findCbpFile(activeBC->buildDirectory());
if (cbpFile.isEmpty()) {
emit buildTargetsChanged();
- return false;
+ buildSystemEvaluationFinished(true);
+ return;
}
// setFolderName
@@ -218,7 +233,8 @@ bool CMakeProject::parseCMakeLists()
if (!cbpparser.parseCbpFile(cbpFile)) {
// TODO report error
emit buildTargetsChanged();
- return false;
+ buildSystemEvaluationFinished(true);
+ return;
}
foreach (const QString &file, m_watcher->files())
@@ -228,8 +244,6 @@ bool CMakeProject::parseCMakeLists()
// how can we ensure that it is completely written?
m_watcher->addPath(cbpFile);
- // ToolChain
- // activeBC->updateToolChain(cbpparser.compilerName());
m_projectName = cbpparser.projectName();
m_rootNode->setDisplayName(cbpparser.projectName());
@@ -285,22 +299,24 @@ bool CMakeProject::parseCMakeLists()
createUiCodeModelSupport();
- if (!activeBC->toolChain())
- return true;
+ ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(activeTarget()->profile());
+ if (!tc) {
+ buildSystemEvaluationFinished(true);
+ return;
+ }
QStringList allIncludePaths;
// This explicitly adds -I. to the include paths
allIncludePaths.append(projectDirectory());
allIncludePaths.append(cbpparser.includeFiles());
- QByteArray allDefines;
- allDefines.append(activeBC->toolChain()->predefinedMacros(QStringList()));
- allDefines.append(cbpparser.defines());
+ QByteArray allDefines;
+ allDefines.append(tc->predefinedMacros(QStringList()));
+ allDefines.append(cbpparser.defines());
QStringList allFrameworkPaths;
QList<ProjectExplorer::HeaderPath> allHeaderPaths;
- if (activeBC->toolChain())
- allHeaderPaths = activeBC->toolChain()->systemHeaderPaths();
+ allHeaderPaths = tc->systemHeaderPaths();
foreach (const ProjectExplorer::HeaderPath &headerPath, allHeaderPaths) {
if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath)
allFrameworkPaths.append(headerPath.path());
@@ -333,7 +349,8 @@ bool CMakeProject::parseCMakeLists()
}
emit buildTargetsChanged();
emit fileListChanged();
- return true;
+
+ buildSystemEvaluationFinished(true);
}
bool CMakeProject::isProjectFile(const QString &fileName)
@@ -501,11 +518,6 @@ CMakeManager *CMakeProject::projectManager() const
return m_manager;
}
-CMakeTarget *CMakeProject::activeTarget() const
-{
- return static_cast<CMakeTarget *>(Project::activeTarget());
-}
-
QList<ProjectExplorer::BuildConfigWidget*> CMakeProject::subConfigWidgets()
{
QList<ProjectExplorer::BuildConfigWidget*> list;
@@ -530,74 +542,49 @@ bool CMakeProject::fromMap(const QVariantMap &map)
if (!Project::fromMap(map))
return false;
- bool hasUserFile = activeTarget();
- if (!hasUserFile) {
- CMakeTargetFactory *factory =
- ExtensionSystem::PluginManager::getObject<CMakeTargetFactory>();
- CMakeTarget *t = factory->create(this, Core::Id(DEFAULT_CMAKE_TARGET_ID));
+ if (!activeTarget())
+ addTarget(createTarget(ProfileManager::instance()->defaultProfile()));
- Q_ASSERT(t);
- Q_ASSERT(t->activeBuildConfiguration());
+ // We have a user file, but we could still be missing the cbp file
+ // or simply run createXml with the saved settings
+ QFileInfo sourceFileInfo(m_fileName);
+ CMakeBuildConfiguration *activeBC = qobject_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
+ if (!activeBC)
+ return false;
+ QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
+ QFileInfo cbpFileFi(cbpFile);
- // Ask the user for where he wants to build it
- // and the cmake command line
+ CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
+ if (!cbpFileFi.exists())
+ mode = CMakeOpenProjectWizard::NeedToCreate;
+ else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified())
+ mode = CMakeOpenProjectWizard::NeedToUpdate;
- CMakeOpenProjectWizard copw(m_manager, projectDirectory(), Utils::Environment::systemEnvironment());
+ if (mode != CMakeOpenProjectWizard::Nothing) {
+ CMakeOpenProjectWizard copw(m_manager,
+ sourceFileInfo.absolutePath(),
+ activeBC->buildDirectory(),
+ mode,
+ activeBC->environment());
if (copw.exec() != QDialog::Accepted)
return false;
-
- CMakeBuildConfiguration *bc =
- static_cast<CMakeBuildConfiguration *>(t->buildConfigurations().at(0));
- if (!copw.buildDirectory().isEmpty())
- bc->setBuildDirectory(copw.buildDirectory());
- bc->setToolChain(copw.toolChain());
-
- addTarget(t);
- } else {
- // We have a user file, but we could still be missing the cbp file
- // or simply run createXml with the saved settings
- QFileInfo sourceFileInfo(m_fileName);
- CMakeBuildConfiguration *activeBC = activeTarget()->activeBuildConfiguration();
- QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
- QFileInfo cbpFileFi(cbpFile);
-
- CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
- if (!cbpFileFi.exists())
- mode = CMakeOpenProjectWizard::NeedToCreate;
- else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified())
- mode = CMakeOpenProjectWizard::NeedToUpdate;
-
- if (mode != CMakeOpenProjectWizard::Nothing) {
- CMakeOpenProjectWizard copw(m_manager,
- sourceFileInfo.absolutePath(),
- activeBC->buildDirectory(),
- mode,
- activeBC->environment());
- if (copw.exec() != QDialog::Accepted)
- return false;
- activeBC->setToolChain(copw.toolChain());
- }
}
m_watcher = new QFileSystemWatcher(this);
connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChanged(QString)));
- if (!parseCMakeLists()) // Gets the directory from the active buildconfiguration
- return false;
+ triggerBuildSystemEvaluation();
- if (!hasUserFile && hasBuildTarget("all")) {
+ if (hasBuildTarget("all")) {
MakeStep *makeStep = qobject_cast<MakeStep *>(
activeTarget()->activeBuildConfiguration()->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)->at(0));
Q_ASSERT(makeStep);
makeStep->setBuildTarget("all", true);
}
- foreach (Target *t, targets()) {
+ foreach (Target *t, targets())
connect(t, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
this, SLOT(changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
- connect(t, SIGNAL(environmentChanged()),
- this, SLOT(changeEnvironment()));
- }
connect(Core::EditorManager::instance(), SIGNAL(editorAboutToClose(Core::IEditor*)),
this, SLOT(editorAboutToClose(Core::IEditor*)));
@@ -817,8 +804,7 @@ bool CMakeFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
return true;
}
-CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeTarget *target)
- : m_target(target), m_buildConfiguration(0)
+CMakeBuildSettingsWidget::CMakeBuildSettingsWidget() : m_buildConfiguration(0)
{
QFormLayout *fl = new QFormLayout(this);
fl->setContentsMargins(20, -1, 0, -1);
@@ -853,7 +839,7 @@ void CMakeBuildSettingsWidget::init(BuildConfiguration *bc)
{
m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
- if (m_buildConfiguration->buildDirectory() == m_target->cmakeProject()->projectDirectory())
+ if (m_buildConfiguration->buildDirectory() == bc->target()->project()->projectDirectory())
m_changeButton->setEnabled(false);
else
m_changeButton->setEnabled(true);
@@ -861,7 +847,9 @@ void CMakeBuildSettingsWidget::init(BuildConfiguration *bc)
void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
{
- CMakeProject *project = m_target->cmakeProject();
+ CMakeProject *project = qobject_cast<CMakeProject *>(m_buildConfiguration->target()->project());
+ if (!project)
+ return;
CMakeOpenProjectWizard copw(project->projectManager(),
project->projectDirectory(),
m_buildConfiguration->buildDirectory(),
@@ -875,15 +863,16 @@ void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
void CMakeBuildSettingsWidget::runCMake()
{
// TODO skip build directory
- CMakeProject *project = m_target->cmakeProject();
+ CMakeProject *project = qobject_cast<CMakeProject *>(m_buildConfiguration->target()->project());
+ if (!project)
+ return;
CMakeOpenProjectWizard copw(project->projectManager(),
project->projectDirectory(),
m_buildConfiguration->buildDirectory(),
CMakeOpenProjectWizard::WantToUpdate,
m_buildConfiguration->environment());
- if (copw.exec() == QDialog::Accepted) {
- project->parseCMakeLists();
- }
+ if (copw.exec() == QDialog::Accepted)
+ project->evaluateBuildSystem();
}
/////
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h
index 6166a348b2..88f8933fd8 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.h
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.h
@@ -36,7 +36,6 @@
#include "cmakeprojectmanager.h"
#include "cmakeprojectnodes.h"
#include "cmakebuildconfiguration.h"
-#include "cmaketarget.h"
#include "makestep.h"
#include <projectexplorer/project.h>
@@ -87,8 +86,6 @@ public:
Core::IDocument *document() const;
CMakeManager *projectManager() const;
- CMakeTarget *activeTarget() const;
-
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
ProjectExplorer::ProjectNode *rootProjectNode() const;
@@ -102,12 +99,12 @@ public:
QString defaultBuildDirectory() const;
- bool parseCMakeLists();
QString uicCommand() const;
bool isProjectFile(const QString &fileName);
+
signals:
/// emitted after parsing
void buildTargetsChanged();
@@ -128,12 +125,15 @@ private slots:
void uiEditorContentsChanged();
void buildStateChanged(ProjectExplorer::Project *project);
private:
+ void evaluateBuildSystem();
+
void buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list);
void gatherFileNodes(ProjectExplorer::FolderNode *parent, QList<ProjectExplorer::FileNode *> &list);
ProjectExplorer::FolderNode *findOrCreateFolder(CMakeProjectNode *rootNode, QString directory);
void updateCodeModelSupportFromEditor(const QString &uiFileName, const QString &contents);
void createUiCodeModelSupport();
QString uiHeaderFile(const QString &uiFile);
+ void updateRunConfigurations(ProjectExplorer::Target *t);
CMakeManager *m_manager;
QString m_fileName;
@@ -228,16 +228,16 @@ class CMakeBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
{
Q_OBJECT
public:
- explicit CMakeBuildSettingsWidget(CMakeTarget *target);
+ CMakeBuildSettingsWidget();
QString displayName() const;
// This is called to set up the config widget before showing it
- virtual void init(ProjectExplorer::BuildConfiguration *bc);
+ void init(ProjectExplorer::BuildConfiguration *bc);
+
private slots:
void openChangeBuildDirectoryDialog();
void runCMake();
private:
- CMakeTarget *m_target;
QLineEdit *m_pathLineEdit;
QPushButton *m_changeButton;
CMakeBuildConfiguration *m_buildConfiguration;
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
index e6b81c209b..7384153647 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
@@ -45,6 +45,7 @@
#include <coreplugin/actionmanager/actioncontainer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/target.h>
#include <utils/QtConcurrentTools>
#include <QtConcurrentRun>
#include <QCoreApplication>
@@ -114,22 +115,21 @@ void CMakeManager::runCMake(ProjectExplorer::Project *project)
if (!project)
return;
CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(project);
- if (!cmakeProject)
+ if (!cmakeProject || !cmakeProject->activeTarget() || !cmakeProject->activeTarget()->activeBuildConfiguration())
return;
- if (!cmakeProject->activeTarget())
+ CMakeBuildConfiguration *bc
+ = qobject_cast<CMakeBuildConfiguration *>(cmakeProject->activeTarget()->activeBuildConfiguration());
+ if (!bc)
return;
- if (!cmakeProject->activeTarget()->activeBuildConfiguration())
- return;
- CMakeBuildConfiguration *bc = cmakeProject->activeTarget()->activeBuildConfiguration();
+
CMakeOpenProjectWizard copw(this,
cmakeProject->projectDirectory(),
bc->buildDirectory(),
CMakeOpenProjectWizard::WantToUpdate,
bc->environment());
- if (copw.exec() == QDialog::Accepted) {
- cmakeProject->parseCMakeLists();
- }
+ if (copw.exec() == QDialog::Accepted)
+ cmakeProject->triggerBuildSystemEvaluation();
}
ProjectExplorer::Project *CMakeManager::openProject(const QString &fileName, QString *errorString)
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro
index d1c2914899..b0b516944d 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro
@@ -9,7 +9,6 @@ HEADERS = cmakeproject.h \
cmakeprojectmanager.h \
cmakeprojectconstants.h \
cmakeprojectnodes.h \
- cmaketarget.h \
makestep.h \
cmakerunconfiguration.h \
cmakeopenprojectwizard.h \
@@ -24,7 +23,6 @@ SOURCES = cmakeproject.cpp \
cmakeprojectplugin.cpp \
cmakeprojectmanager.cpp \
cmakeprojectnodes.cpp \
- cmaketarget.cpp \
makestep.cpp \
cmakerunconfiguration.cpp \
cmakeopenprojectwizard.cpp \
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs
index e0e8b6c0e7..541176d66a 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs
@@ -48,8 +48,6 @@ QtcPlugin {
"cmakeprojectplugin.h",
"cmakerunconfiguration.cpp",
"cmakerunconfiguration.h",
- "cmaketarget.cpp",
- "cmaketarget.h",
"cmakeuicodemodelsupport.cpp",
"cmakeuicodemodelsupport.h",
"makestep.cpp",
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp
index 46b1db69d9..1d9614a9a8 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp
@@ -32,11 +32,11 @@
#include "cmakeprojectplugin.h"
#include "cmakeprojectmanager.h"
+#include "cmakebuildconfiguration.h"
#include "cmakerunconfiguration.h"
#include "cmakeeditorfactory.h"
#include "makestep.h"
#include "cmakeprojectconstants.h"
-#include "cmaketarget.h"
#include "cmakelocatorfilter.h"
#include <coreplugin/icore.h>
@@ -67,9 +67,9 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
addAutoReleasedObject(manager);
addAutoReleasedObject(new MakeStepFactory);
addAutoReleasedObject(new CMakeRunConfigurationFactory);
+ addAutoReleasedObject(new CMakeBuildConfigurationFactory);
addAutoReleasedObject(new CMakeEditorFactory(manager));
- addAutoReleasedObject(new CMakeTargetFactory);
addAutoReleasedObject(new CMakeLocatorFilter);
return true;
diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
index 1f3f2f1c8d..6fdd343cb0 100644
--- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
@@ -35,12 +35,12 @@
#include "cmakebuildconfiguration.h"
#include "cmakeproject.h"
#include "cmakeprojectconstants.h"
-#include "cmaketarget.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/helpmanager.h>
#include <qtsupport/debugginghelper.h>
#include <projectexplorer/environmentwidget.h>
+#include <projectexplorer/target.h>
#include <utils/pathchooser.h>
#include <utils/detailswidget.h>
@@ -60,7 +60,6 @@ using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal;
namespace {
-const char CMAKE_RC_ID[] = "CMakeProjectManager.CMakeRunConfiguration";
const char CMAKE_RC_PREFIX[] = "CMakeProjectManager.CMakeRunConfiguration.";
const char USER_WORKING_DIRECTORY_KEY[] = "CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory";
@@ -86,8 +85,9 @@ Core::Id idFromBuildTarget(const QString &target)
} // namespace
-CMakeRunConfiguration::CMakeRunConfiguration(CMakeTarget *parent, const QString &target, const QString &workingDirectory, const QString &title) :
- ProjectExplorer::LocalApplicationRunConfiguration(parent, Core::Id(CMAKE_RC_PREFIX)),
+CMakeRunConfiguration::CMakeRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &target,
+ const QString &workingDirectory, const QString &title) :
+ ProjectExplorer::LocalApplicationRunConfiguration(parent, id),
m_runMode(Gui),
m_buildTarget(target),
m_workingDirectory(workingDirectory),
@@ -98,7 +98,7 @@ CMakeRunConfiguration::CMakeRunConfiguration(CMakeTarget *parent, const QString
ctor();
}
-CMakeRunConfiguration::CMakeRunConfiguration(CMakeTarget *parent, CMakeRunConfiguration *source) :
+CMakeRunConfiguration::CMakeRunConfiguration(ProjectExplorer::Target *parent, CMakeRunConfiguration *source) :
ProjectExplorer::LocalApplicationRunConfiguration(parent, source),
m_runMode(source->m_runMode),
m_buildTarget(source->m_buildTarget),
@@ -122,14 +122,9 @@ void CMakeRunConfiguration::ctor()
setDefaultDisplayName(defaultDisplayName());
}
-CMakeTarget *CMakeRunConfiguration::cmakeTarget() const
+ProjectExplorer::BuildConfiguration *CMakeRunConfiguration::activeBuildConfiguration() const
{
- return static_cast<CMakeTarget *>(target());
-}
-
-CMakeBuildConfiguration *CMakeRunConfiguration::activeBuildConfiguration() const
-{
- return cmakeTarget()->activeBuildConfiguration();
+ return target()->activeBuildConfiguration();
}
QString CMakeRunConfiguration::executable() const
@@ -496,8 +491,7 @@ void CMakeRunConfigurationWidget::setArguments(const QString &args)
// Factory
CMakeRunConfigurationFactory::CMakeRunConfigurationFactory(QObject *parent) :
ProjectExplorer::IRunConfigurationFactory(parent)
-{
-}
+{ setObjectName(QLatin1String("CMakeRunConfigurationFactory")); }
CMakeRunConfigurationFactory::~CMakeRunConfigurationFactory()
{
@@ -506,11 +500,11 @@ CMakeRunConfigurationFactory::~CMakeRunConfigurationFactory()
// used to show the list of possible additons to a project, returns a list of ids
QList<Core::Id> CMakeRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
{
- CMakeTarget *t(qobject_cast<CMakeTarget *>(parent));
- if (!t)
+ CMakeProject *project = qobject_cast<CMakeProject *>(parent->project());
+ if (!canHandle(parent))
return QList<Core::Id>();
QList<Core::Id> allIds;
- foreach (const QString &buildTarget, t->cmakeProject()->buildTargetTitles())
+ foreach (const QString &buildTarget, project->buildTargetTitles())
allIds << idFromBuildTarget(buildTarget);
return allIds;
}
@@ -521,12 +515,19 @@ QString CMakeRunConfigurationFactory::displayNameForId(const Core::Id id) const
return buildTargetFromId(id);
}
+bool CMakeRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const
+{
+ if (!parent->project()->supportsProfile(parent->profile()))
+ return false;
+ return qobject_cast<CMakeProject *>(parent->project());
+}
+
bool CMakeRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
{
- CMakeTarget *t(qobject_cast<CMakeTarget *>(parent));
- if (!t)
+ if (!canHandle(parent))
return false;
- return t->cmakeProject()->hasBuildTarget(buildTargetFromId(id));
+ CMakeProject *project = static_cast<CMakeProject *>(parent->project());
+ return project->hasBuildTarget(buildTargetFromId(id));
}
ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::create(ProjectExplorer::Target *parent,
@@ -534,43 +535,41 @@ ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::create(ProjectE
{
if (!canCreate(parent, id))
return 0;
- CMakeTarget *t(static_cast<CMakeTarget *>(parent));
-
+ CMakeProject *project = static_cast<CMakeProject *>(parent->project());
const QString title(buildTargetFromId(id));
- const CMakeBuildTarget &ct = t->cmakeProject()->buildTargetForTitle(title);
- return new CMakeRunConfiguration(t, ct.executable, ct.workingDirectory, ct.title);
+ const CMakeBuildTarget &ct = project->buildTargetForTitle(title);
+ return new CMakeRunConfiguration(parent, id, ct.executable, ct.workingDirectory, ct.title);
}
bool CMakeRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const
{
- if (!qobject_cast<CMakeTarget *>(parent))
+ if (!canHandle(parent))
return false;
- return source->id() == Core::Id(CMAKE_RC_ID);
+ return source->id().toString().startsWith(QLatin1String(CMAKE_RC_PREFIX));
}
ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration * source)
{
if (!canClone(parent, source))
return 0;
- CMakeTarget *t(static_cast<CMakeTarget *>(parent));
CMakeRunConfiguration *crc(static_cast<CMakeRunConfiguration *>(source));
- return new CMakeRunConfiguration(t, crc);
+ return new CMakeRunConfiguration(parent, crc);
}
bool CMakeRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
{
- if (!qobject_cast<CMakeTarget *>(parent))
+ if (!qobject_cast<CMakeProject *>(parent->project()))
return false;
QString id = QString::fromUtf8(ProjectExplorer::idFromMap(map).name());
- return id.startsWith(QLatin1String(CMAKE_RC_ID));
+ return id.startsWith(QLatin1String(CMAKE_RC_PREFIX));
}
ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
- CMakeTarget *t(static_cast<CMakeTarget *>(parent));
- CMakeRunConfiguration *rc(new CMakeRunConfiguration(t, QString(), QString(), QString()));
+ CMakeRunConfiguration *rc(new CMakeRunConfiguration(parent, ProjectExplorer::idFromMap(map),
+ QString(), QString(), QString()));
if (rc->fromMap(map))
return rc;
delete rc;
diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h
index bf64aa3691..5d5d81816f 100644
--- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h
+++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h
@@ -62,12 +62,11 @@ class CMakeRunConfiguration : public ProjectExplorer::LocalApplicationRunConfigu
friend class CMakeRunConfigurationFactory;
public:
- CMakeRunConfiguration(CMakeTarget *parent, const QString &target,
+ CMakeRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &target,
const QString &workingDirectory, const QString &title);
~CMakeRunConfiguration();
- CMakeTarget *cmakeTarget() const;
- CMakeBuildConfiguration *activeBuildConfiguration() const;
+ ProjectExplorer::BuildConfiguration *activeBuildConfiguration() const;
QString executable() const;
RunMode runMode() const;
@@ -101,7 +100,7 @@ private slots:
void setCommandLineArguments(const QString &newText);
protected:
- CMakeRunConfiguration(CMakeTarget *parent, CMakeRunConfiguration *source);
+ CMakeRunConfiguration(ProjectExplorer::Target *parent, CMakeRunConfiguration *source);
virtual bool fromMap(const QVariantMap &map);
QString defaultDisplayName() const;
@@ -177,6 +176,8 @@ public:
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
QString displayNameForId(const Core::Id id) const;
+
+ bool canHandle(ProjectExplorer::Target *parent) const;
};
}
diff --git a/src/plugins/cmakeprojectmanager/cmaketarget.cpp b/src/plugins/cmakeprojectmanager/cmaketarget.cpp
deleted file mode 100644
index 97aee20fb4..0000000000
--- a/src/plugins/cmakeprojectmanager/cmaketarget.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "cmaketarget.h"
-
-#include "cmakeproject.h"
-#include "cmakerunconfiguration.h"
-#include "cmakebuildconfiguration.h"
-
-#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/deployconfiguration.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
-
-#include <QApplication>
-#include <QStyle>
-
-using namespace CMakeProjectManager;
-using namespace CMakeProjectManager::Internal;
-
-namespace {
-
-QString displayNameForId(const Core::Id id) {
- if (id == Core::Id(DEFAULT_CMAKE_TARGET_ID))
- return QApplication::translate("CMakeProjectManager::Internal::CMakeTarget", "Desktop", "CMake Default target display name");
- return QString();
-}
-
-} // namespace
-
-// -------------------------------------------------------------------------
-// CMakeTarget
-// -------------------------------------------------------------------------
-
-CMakeTarget::CMakeTarget(CMakeProject *parent) :
- ProjectExplorer::Target(parent, Core::Id(DEFAULT_CMAKE_TARGET_ID)),
- m_buildConfigurationFactory(new CMakeBuildConfigurationFactory(this))
-{
- setDefaultDisplayName(displayNameForId(id()));
- setIcon(qApp->style()->standardIcon(QStyle::SP_ComputerIcon));
- connect(parent, SIGNAL(buildTargetsChanged()), SLOT(updateRunConfigurations()));
-}
-
-CMakeTarget::~CMakeTarget()
-{
-}
-
-CMakeProject *CMakeTarget::cmakeProject() const
-{
- return static_cast<CMakeProject *>(project());
-}
-
-ProjectExplorer::BuildConfigWidget *CMakeTarget::createConfigWidget()
-{
- return new CMakeBuildSettingsWidget(this);
-}
-
-bool CMakeTargetFactory::supportsTargetId(const Core::Id id) const
-{
- return id == Core::Id(DEFAULT_CMAKE_TARGET_ID);
-}
-
-CMakeBuildConfiguration *CMakeTarget::activeBuildConfiguration() const
-{
- return static_cast<CMakeBuildConfiguration *>(Target::activeBuildConfiguration());
-}
-
-CMakeBuildConfigurationFactory *CMakeTarget::buildConfigurationFactory() const
-{
- return m_buildConfigurationFactory;
-}
-
-QString CMakeTarget::defaultBuildDirectory() const
-{
- return cmakeProject()->defaultBuildDirectory();
-}
-
-bool CMakeTarget::fromMap(const QVariantMap &map)
-{
- return Target::fromMap(map);
-}
-
-void CMakeTarget::updateRunConfigurations()
-{
- // *Update* runconfigurations:
- QMultiMap<QString, CMakeRunConfiguration*> existingRunConfigurations;
- QList<ProjectExplorer::RunConfiguration *> toRemove;
- foreach (ProjectExplorer::RunConfiguration* rc, runConfigurations()) {
- if (CMakeRunConfiguration* cmakeRC = qobject_cast<CMakeRunConfiguration *>(rc))
- existingRunConfigurations.insert(cmakeRC->title(), cmakeRC);
- QtSupport::CustomExecutableRunConfiguration *ceRC =
- qobject_cast<QtSupport::CustomExecutableRunConfiguration *>(rc);
- if (ceRC && !ceRC->isConfigured())
- toRemove << rc;
- }
-
- foreach (const CMakeBuildTarget &ct, cmakeProject()->buildTargets()) {
- if (ct.library)
- continue;
- if (ct.executable.isEmpty())
- continue;
- if (ct.title.endsWith("/fast"))
- continue;
- QList<CMakeRunConfiguration *> list = existingRunConfigurations.values(ct.title);
- if (!list.isEmpty()) {
- // Already exists, so override the settings...
- foreach (CMakeRunConfiguration *rc, list) {
- rc->setExecutable(ct.executable);
- rc->setBaseWorkingDirectory(ct.workingDirectory);
- rc->setEnabled(true);
- }
- existingRunConfigurations.remove(ct.title);
- } else {
- // Does not exist yet
- addRunConfiguration(new CMakeRunConfiguration(this, ct.executable, ct.workingDirectory, ct.title));
- }
- }
- QMultiMap<QString, CMakeRunConfiguration *>::const_iterator it =
- existingRunConfigurations.constBegin();
- for ( ; it != existingRunConfigurations.constEnd(); ++it) {
- CMakeRunConfiguration *rc = it.value();
- // The executables for those runconfigurations aren't build by the current buildconfiguration
- // We just set a disable flag and show that in the display name
- rc->setEnabled(false);
- // removeRunConfiguration(rc);
- }
-
- foreach (ProjectExplorer::RunConfiguration *rc, toRemove)
- removeRunConfiguration(rc);
-
- if (runConfigurations().isEmpty()) {
- // Oh no, no run configuration,
- // create a custom executable run configuration
- addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(this));
- }
-}
-
-// -------------------------------------------------------------------------
-// CMakeTargetFactory
-// -------------------------------------------------------------------------
-
-CMakeTargetFactory::CMakeTargetFactory(QObject *parent) :
- ITargetFactory(parent)
-{
-}
-
-CMakeTargetFactory::~CMakeTargetFactory()
-{
-}
-
-QList<Core::Id> CMakeTargetFactory::supportedTargetIds() const
-{
- return QList<Core::Id>() << Core::Id(DEFAULT_CMAKE_TARGET_ID);
-}
-QString CMakeTargetFactory::displayNameForId(const Core::Id id) const
-{
- return ::displayNameForId(id);
-}
-
-bool CMakeTargetFactory::canCreate(ProjectExplorer::Project *parent, const Core::Id id) const
-{
- if (!qobject_cast<CMakeProject *>(parent))
- return false;
- return id == Core::Id(DEFAULT_CMAKE_TARGET_ID);
-}
-
-CMakeTarget *CMakeTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id)
-{
- if (!canCreate(parent, id))
- return 0;
- CMakeProject *cmakeparent(static_cast<CMakeProject *>(parent));
- CMakeTarget *t(new CMakeTarget(cmakeparent));
-
- // Add default build configuration:
- CMakeBuildConfiguration *bc(new CMakeBuildConfiguration(t));
- bc->setDefaultDisplayName("all");
-
- ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
- ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
-
- // Now create a standard build configuration
- buildSteps->insertStep(0, new MakeStep(buildSteps));
-
- MakeStep *cleanMakeStep = new MakeStep(cleanSteps);
- cleanSteps->insertStep(0, cleanMakeStep);
- cleanMakeStep->setAdditionalArguments("clean");
- cleanMakeStep->setClean(true);
-
- t->addBuildConfiguration(bc);
-
- t->addDeployConfiguration(t->createDeployConfiguration(ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID));
-
- t->updateRunConfigurations();
-
- return t;
-}
-
-bool CMakeTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const
-{
- return canCreate(parent, ProjectExplorer::idFromMap(map));
-}
-
-CMakeTarget *CMakeTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map)
-{
- if (!canRestore(parent, map))
- return 0;
- CMakeProject *cmakeparent(static_cast<CMakeProject *>(parent));
- CMakeTarget *t(new CMakeTarget(cmakeparent));
- if (t->fromMap(map))
- return t;
- delete t;
- return 0;
-}
diff --git a/src/plugins/cmakeprojectmanager/cmaketarget.h b/src/plugins/cmakeprojectmanager/cmaketarget.h
deleted file mode 100644
index d9e44487d9..0000000000
--- a/src/plugins/cmakeprojectmanager/cmaketarget.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef CMAKETARGET_H
-#define CMAKETARGET_H
-
-#include "cmakebuildconfiguration.h"
-
-#include <projectexplorer/target.h>
-
-namespace CMakeProjectManager {
-namespace Internal {
-
-const char DEFAULT_CMAKE_TARGET_ID[] = "CMakeProjectManager.DefaultCMakeTarget";
-
-class CMakeBuildConfiguration;
-class CMakeBuildConfigurationFactory;
-class CMakeProject;
-class CMakeTargetFactory;
-
-class CMakeTarget : public ProjectExplorer::Target
-{
- Q_OBJECT
- friend class CMakeTargetFactory;
-
-public:
- CMakeTarget(CMakeProject *parent);
- ~CMakeTarget();
-
- ProjectExplorer::BuildConfigWidget *createConfigWidget();
-
- CMakeProject *cmakeProject() const;
- CMakeBuildConfiguration *activeBuildConfiguration() const;
-
- CMakeBuildConfigurationFactory *buildConfigurationFactory() const;
-
- QString defaultBuildDirectory() const;
-
-protected:
- bool fromMap(const QVariantMap &map);
-
-private slots:
- void updateRunConfigurations();
-
-private:
- CMakeBuildConfigurationFactory *m_buildConfigurationFactory;
-};
-
-class CMakeTargetFactory : public ProjectExplorer::ITargetFactory
-{
- Q_OBJECT
-
-public:
- CMakeTargetFactory(QObject *parent = 0);
- ~CMakeTargetFactory();
-
- bool supportsTargetId(const Core::Id id) const;
-
- QList<Core::Id> supportedTargetIds() const;
- QString displayNameForId(const Core::Id id) const;
-
- bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
- CMakeTarget *create(ProjectExplorer::Project *parent, const Core::Id id);
- bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
- CMakeTarget *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
-};
-
-} // namespace Internal
-} // namespace CMakeProjectManager
-
-#endif // CMAKETARGET_H
diff --git a/src/plugins/cmakeprojectmanager/cmakeuicodemodelsupport.cpp b/src/plugins/cmakeprojectmanager/cmakeuicodemodelsupport.cpp
index 1a4e427cf9..b41ab0254d 100644
--- a/src/plugins/cmakeprojectmanager/cmakeuicodemodelsupport.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeuicodemodelsupport.cpp
@@ -32,10 +32,10 @@
#include "cmakeuicodemodelsupport.h"
#include "cmakeproject.h"
-#include "cmaketarget.h"
#include "cmakebuildconfiguration.h"
#include <cpptools/ModelManagerInterface.h>
+#include <projectexplorer/target.h>
#include <QProcess>
@@ -48,14 +48,10 @@ CMakeUiCodeModelSupport::CMakeUiCodeModelSupport(CPlusPlus::CppModelManagerInter
const QString &uiHeaderFile)
: CppTools::UiCodeModelSupport(modelmanager, source, uiHeaderFile),
m_project(project)
-{
-
-}
+{ }
CMakeUiCodeModelSupport::~CMakeUiCodeModelSupport()
-{
-
-}
+{ }
QString CMakeUiCodeModelSupport::uicCommand() const
{
@@ -64,6 +60,7 @@ QString CMakeUiCodeModelSupport::uicCommand() const
QStringList CMakeUiCodeModelSupport::environment() const
{
- CMakeBuildConfiguration *bc = m_project->activeTarget()->activeBuildConfiguration();
- return bc->environment().toStringList();
+ if (!m_project || !m_project->activeTarget() || !m_project->activeTarget()->activeBuildConfiguration())
+ return QStringList();
+ return m_project->activeTarget()->activeBuildConfiguration()->environment().toStringList();
}
diff --git a/src/plugins/cmakeprojectmanager/makestep.cpp b/src/plugins/cmakeprojectmanager/makestep.cpp
index a28afbd02e..fc8f885b54 100644
--- a/src/plugins/cmakeprojectmanager/makestep.cpp
+++ b/src/plugins/cmakeprojectmanager/makestep.cpp
@@ -34,14 +34,16 @@
#include "cmakeprojectconstants.h"
#include "cmakeproject.h"
-#include "cmaketarget.h"
#include "cmakebuildconfiguration.h"
#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/toolchain.h>
-#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/gnumakeparser.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
+#include <projectexplorer/toolchain.h>
#include <utils/qtcprocess.h>
@@ -138,19 +140,20 @@ bool MakeStep::init()
setIgnoreReturnValue(m_clean);
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
pp->setEnvironment(bc->environment());
pp->setWorkingDirectory(bc->buildDirectory());
- if (bc->toolChain())
- pp->setCommand(bc->toolChain()->makeCommand());
+ if (tc)
+ pp->setCommand(tc->makeCommand());
else
pp->setCommand(QLatin1String("make"));
pp->setArguments(arguments);
setOutputParser(new ProjectExplorer::GnuMakeParser());
- if (bc->toolChain())
- appendOutputParser(bc->toolChain()->outputParser());
+ if (tc)
+ appendOutputParser(tc->outputParser());
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
@@ -302,7 +305,13 @@ void MakeStepConfigWidget::updateDetails()
CMakeBuildConfiguration *bc = m_makeStep->cmakeBuildConfiguration();
if (!bc)
bc = static_cast<CMakeBuildConfiguration *>(m_makeStep->target()->activeBuildConfiguration());
- ProjectExplorer::ToolChain *tc = bc->toolChain();
+ if (!bc) {
+ m_summaryText = tr("<b>No build configuration found on this target.</b>");
+ updateSummary();
+ return;
+ }
+
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(m_makeStep->target()->profile());
if (tc) {
QString arguments = Utils::QtcProcess::joinArgs(m_makeStep->buildTargets());
Utils::QtcProcess::addArgs(&arguments, m_makeStep->additionalArguments());
@@ -315,7 +324,7 @@ void MakeStepConfigWidget::updateDetails()
param.setArguments(arguments);
m_summaryText = param.summary(displayName());
} else {
- m_summaryText = tr("<b>Unknown tool chain</b>");
+ m_summaryText = tr("<b>No tool chain set for this target</b>");
}
emit updateSummary();
}
diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro
index afe40429e6..e633c50ab4 100644
--- a/src/plugins/debugger/debugger.pro
+++ b/src/plugins/debugger/debugger.pro
@@ -38,6 +38,8 @@ HEADERS += \
debuggerstartparameters.h \
debuggerstreamops.h \
debuggerstringutils.h \
+ debuggerprofileconfigwidget.h \
+ debuggerprofileinformation.h \
disassembleragent.h \
disassemblerlines.h \
loadremotecoredialog.h \
@@ -92,6 +94,8 @@ SOURCES += \
debuggerplugin.cpp \
debuggerrunner.cpp \
debuggerstreamops.cpp \
+ debuggerprofileconfigwidget.cpp \
+ debuggerprofileinformation.cpp \
disassembleragent.cpp \
disassemblerlines.cpp \
loadremotecoredialog.cpp \
diff --git a/src/plugins/debugger/debugger.qbs b/src/plugins/debugger/debugger.qbs
index ca68ebc7b6..a2de81509e 100644
--- a/src/plugins/debugger/debugger.qbs
+++ b/src/plugins/debugger/debugger.qbs
@@ -36,6 +36,10 @@ QtcPlugin {
"breakcondition.ui",
"breakpoint.ui",
"debugger.qrc",
+ "debuggerprofileconfigwidget.cpp",
+ "debuggerprofileconfigwidget.h",
+ "debuggerprofileinformation.cpp",
+ "debuggerprofileinformation.h",
"attachcoredialog.ui",
"attachexternaldialog.ui",
"attachtoqmlportdialog.ui",
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 01846f3bf7..fecdfa25e7 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -43,6 +43,7 @@
#include "debuggerrunner.h"
#include "debuggerruncontrolfactory.h"
#include "debuggerstringutils.h"
+#include "debuggerprofileinformation.h"
#include "memoryagent.h"
#include "breakpoint.h"
#include "breakhandler.h"
@@ -99,6 +100,8 @@
#include <projectexplorer/projectexplorersettings.h>
#include <projectexplorer/project.h>
#include <projectexplorer/session.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/profilemanager.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/toolchainmanager.h>
@@ -2839,18 +2842,27 @@ QString DebuggerPluginPrivate::debuggerForAbi(const Abi &abi, DebuggerEngineType
qDebug() << "debuggerForAbi" << abi.toString() << searchAbis.size()
<< searchAbis.front().toString() << et;
- foreach (const Abi &searchAbi, searchAbis) {
- const QList<ToolChain *> toolchains =
- ToolChainManager::instance()->findToolChains(searchAbi);
- // Find manually configured ones first
- for (int i = toolchains.size() - 1; i >= 0; i--) {
- const QString debugger = toolchains.at(i)->debuggerCommand().toString();
- if (debug)
- qDebug() << i << toolchains.at(i)->displayName() << debugger;
- if (!debugger.isEmpty())
- return debugger;
+ QList<Profile *> profileList = ProfileManager::instance()->profiles();
+ // Note: stList is not sorted with autodected first!
+ QStringList debuggerList;
+ foreach (Profile *p, profileList) {
+ if (!p->isValid())
+ continue;
+ ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
+ if (!tc)
+ continue;
+ if (searchAbis.contains(tc->targetAbi())) {
+ const QString debugger = DebuggerProfileInformation::debuggerCommand(p).toString();
+ if (!debugger.isEmpty()) {
+ if (p->isAutoDetected())
+ debuggerList.append(debugger);
+ else
+ debuggerList.prepend(debugger);
+ }
}
}
+ if (!debuggerList.isEmpty())
+ return debuggerList.at(0);
return QString();
}
@@ -3620,6 +3632,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
mstart->addSeparator(globalcontext, Constants::G_MANUAL_REMOTE);
mstart->addSeparator(globalcontext, Constants::G_AUTOMATIC_REMOTE);
+ ProfileManager::instance()->registerProfileInformation(new DebuggerProfileInformation);
+
return theDebuggerCore->initialize(arguments, errorMessage);
}
@@ -3711,35 +3725,23 @@ void DebuggerPluginPrivate::testUnloadProject()
invoke<void>(pe, "unloadProject");
}
-static Project *currentProject()
-{
- return ProjectExplorerPlugin::instance()->currentProject();
-}
-
static Target *activeTarget()
{
- Project *project = currentProject();
+ Project *project = ProjectExplorerPlugin::instance()->currentProject();
return project->activeTarget();
}
-static BuildConfiguration *activeBuildConfiguration()
-{
- return activeTarget()->activeBuildConfiguration();
-}
-
-static RunConfiguration *activeRunConfiguration()
-{
- return activeTarget()->activeRunConfiguration();
-}
-
static ToolChain *currentToolChain()
{
- return activeBuildConfiguration()->toolChain();
+ Target *t = activeTarget();
+ if (!t || !t->isEnabled())
+ return 0;
+ return ToolChainProfileInformation::toolChain(activeTarget()->profile());
}
static LocalApplicationRunConfiguration *activeLocalRunConfiguration()
{
- return qobject_cast<LocalApplicationRunConfiguration *>(activeRunConfiguration());
+ return qobject_cast<LocalApplicationRunConfiguration *>(activeTarget()->activeRunConfiguration());
}
void DebuggerPluginPrivate::testRunProject(const DebuggerStartParameters &sp, const TestCallBack &cb)
diff --git a/src/plugins/debugger/debuggerprofileconfigwidget.cpp b/src/plugins/debugger/debuggerprofileconfigwidget.cpp
new file mode 100644
index 0000000000..735a2584a7
--- /dev/null
+++ b/src/plugins/debugger/debuggerprofileconfigwidget.cpp
@@ -0,0 +1,148 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "debuggerprofileconfigwidget.h"
+
+#include "debuggerprofileinformation.h"
+
+#include <projectexplorer/abi.h>
+#include <projectexplorer/profileinformation.h>
+
+#include <utils/pathchooser.h>
+#include <utils/qtcassert.h>
+
+#ifdef Q_OS_WIN
+#include <utils/winutils.h>
+#endif
+
+#include <QUrl>
+
+#include <QDesktopServices>
+#include <QHBoxLayout>
+#include <QPushButton>
+#include <QVBoxLayout>
+
+namespace Debugger {
+namespace Internal {
+
+
+static const char dgbToolsDownloadLink32C[] = "http://www.microsoft.com/whdc/devtools/debugging/installx86.Mspx";
+static const char dgbToolsDownloadLink64C[] = "http://www.microsoft.com/whdc/devtools/debugging/install64bit.Mspx";
+// -----------------------------------------------------------------------
+// DebuggerProfileConfigWidget:
+// -----------------------------------------------------------------------
+
+DebuggerProfileConfigWidget::DebuggerProfileConfigWidget(ProjectExplorer::Profile *p,
+ const DebuggerProfileInformation *pi,
+ QWidget *parent) :
+ ProjectExplorer::ProfileConfigWidget(parent),
+ m_profile(p),
+ m_info(pi),
+ m_chooser(new Utils::PathChooser)
+{
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ layout->setMargin(0);
+
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
+ if (tc && tc->targetAbi().os() == ProjectExplorer::Abi::WindowsOS
+ && tc->targetAbi().osFlavor() != ProjectExplorer::Abi::WindowsMSysFlavor) {
+ QLabel *msvcDebuggerConfigLabel = new QLabel;
+#ifdef Q_OS_WIN
+ const bool is64bit = Utils::winIs64BitSystem();
+#else
+ const bool is64bit = false;
+#endif
+ const QString link = is64bit ? QLatin1String(dgbToolsDownloadLink64C) : QLatin1String(dgbToolsDownloadLink32C);
+ //: Label text for path configuration. %2 is "x-bit version".
+ msvcDebuggerConfigLabel->setText(tr("<html><body><p>Specify the path to the "
+ "<a href=\"%1\">Windows Console Debugger executable</a>"
+ " (%2) here.</p>"
+ "</body></html>").arg(link, (is64bit ? tr("64-bit version")
+ : tr("32-bit version"))));
+ msvcDebuggerConfigLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
+ msvcDebuggerConfigLabel->setOpenExternalLinks(true);
+ layout->addWidget(msvcDebuggerConfigLabel);
+
+ }
+
+ m_chooser->setContentsMargins(0, 0, 0, 0);
+ m_chooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
+
+ QPushButton *button = new QPushButton(tr("Auto detect"));
+ button->setContentsMargins(0, 0, 0, 0);
+ connect(button, SIGNAL(clicked()), this, SLOT(autoDetectDebugger()));
+
+ QHBoxLayout *box = dynamic_cast<QHBoxLayout *>(m_chooser->layout());
+ QTC_CHECK(box);
+ if (box)
+ box->insertWidget(1, button);
+ layout->addWidget(m_chooser);
+
+ discard();
+ connect(m_chooser, SIGNAL(changed(QString)), this, SIGNAL(dirty()));
+}
+
+QString DebuggerProfileConfigWidget::displayName() const
+{
+ return tr("Debugger command:");
+}
+
+void DebuggerProfileConfigWidget::makeReadOnly()
+{
+ m_chooser->setEnabled(false);
+}
+
+void DebuggerProfileConfigWidget::apply()
+{
+ Utils::FileName fn = m_chooser->fileName();
+ DebuggerProfileInformation::setDebuggerCommand(m_profile, fn);
+}
+
+void DebuggerProfileConfigWidget::discard()
+{
+ m_chooser->setFileName(DebuggerProfileInformation::debuggerCommand(m_profile));
+}
+
+bool DebuggerProfileConfigWidget::isDirty() const
+{
+ return m_chooser->fileName() != DebuggerProfileInformation::debuggerCommand(m_profile);
+}
+
+void DebuggerProfileConfigWidget::autoDetectDebugger()
+{
+ QVariant v = m_info->defaultValue(m_profile);
+ m_chooser->setFileName(Utils::FileName::fromString(v.toString()));
+}
+
+} // namespace Internal
+
+} // namespace Debugger
diff --git a/src/plugins/debugger/debuggerprofileconfigwidget.h b/src/plugins/debugger/debuggerprofileconfigwidget.h
new file mode 100644
index 0000000000..f0bc7e329d
--- /dev/null
+++ b/src/plugins/debugger/debuggerprofileconfigwidget.h
@@ -0,0 +1,81 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef DEBUGGER_DEBUGGERPROFILECONFIGWIDGET_H
+#define DEBUGGER_DEBUGGERPROFILECONFIGWIDGET_H
+
+#include <projectexplorer/profileconfigwidget.h>
+
+#include <QLabel>
+#include <debuggerprofileinformation.h>
+
+namespace ProjectExplorer { class Profile; }
+namespace Utils { class PathChooser; }
+
+namespace Debugger {
+class DebuggerProfileInformation;
+
+namespace Internal {
+// -----------------------------------------------------------------------
+// DebuggerProfileConfigWidget:
+// -----------------------------------------------------------------------
+
+class DebuggerProfileConfigWidget : public ProjectExplorer::ProfileConfigWidget
+{
+ Q_OBJECT
+
+public:
+ DebuggerProfileConfigWidget(ProjectExplorer::Profile *p,
+ const DebuggerProfileInformation *pi,
+ QWidget *parent = 0);
+
+ QString displayName() const;
+
+ void makeReadOnly();
+
+ void apply();
+ void discard();
+ bool isDirty() const;
+
+private slots:
+ void autoDetectDebugger();
+
+private:
+ ProjectExplorer::Profile *m_profile;
+ const DebuggerProfileInformation *m_info;
+ Utils::PathChooser *m_chooser;
+};
+
+} // namespace Internal
+} // namespace Debugger
+
+#endif // DEBUGGER_DEBUGGERPROFILEINFORMATION_H
diff --git a/src/plugins/debugger/debuggerprofileinformation.cpp b/src/plugins/debugger/debuggerprofileinformation.cpp
new file mode 100644
index 0000000000..e644978fa9
--- /dev/null
+++ b/src/plugins/debugger/debuggerprofileinformation.cpp
@@ -0,0 +1,208 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "debuggerprofileinformation.h"
+
+#include "debuggerprofileconfigwidget.h"
+
+#include <projectexplorer/abi.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/toolchain.h>
+
+#include <utils/environment.h>
+
+#include <QDir>
+#include <QPair>
+
+// --------------------------------------------------------------------------
+// Helpers:
+// --------------------------------------------------------------------------
+
+static QPair<QString, QString> autoDetectCdbDebugger()
+{
+ QPair<QString, QString> result;
+ QList<Utils::FileName> cdbs;
+
+ QStringList programDirs;
+ programDirs.append(QString::fromLocal8Bit(qgetenv("ProgramFiles")));
+ programDirs.append(QString::fromLocal8Bit(qgetenv("ProgramFiles(x86)")));
+ programDirs.append(QString::fromLocal8Bit(qgetenv("ProgramW6432")));
+
+ foreach (const QString &dirName, programDirs) {
+ if (dirName.isEmpty())
+ continue;
+ QDir dir(dirName);
+ // Windows SDK's starting from version 8 live in
+ // "ProgramDir\Windows Kits\<version>"
+ const QString windowsKitsFolderName = QLatin1String("Windows Kits");
+ if (dir.exists(windowsKitsFolderName)) {
+ QDir windowKitsFolder = dir;
+ if (windowKitsFolder.cd(windowsKitsFolderName)) {
+ // Check in reverse order (latest first)
+ const QFileInfoList kitFolders =
+ windowKitsFolder.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot,
+ QDir::Time | QDir::Reversed);
+ foreach (const QFileInfo &kitFolderFi, kitFolders) {
+ const QString path = kitFolderFi.absoluteFilePath();
+ const QFileInfo cdb32(path + QLatin1String("/Debuggers/x86/cdb.exe"));
+ if (cdb32.isExecutable())
+ cdbs.push_back(Utils::FileName::fromString(cdb32.absoluteFilePath()));
+ const QFileInfo cdb64(path + QLatin1String("/Debuggers/x64/cdb.exe"));
+ if (cdb64.isExecutable())
+ cdbs.push_back(Utils::FileName::fromString(cdb64.absoluteFilePath()));
+ } // for Kits
+ } // can cd to "Windows Kits"
+ } // "Windows Kits" exists
+
+ // Pre Windows SDK 8: Check 'Debugging Tools for Windows'
+ foreach (const QFileInfo &fi, dir.entryInfoList(QStringList(QLatin1String("Debugging Tools for Windows*")),
+ QDir::Dirs | QDir::NoDotAndDotDot)) {
+ Utils::FileName filePath(fi);
+ filePath.appendPath(QLatin1String("cdb.exe"));
+ if (!cdbs.contains(filePath))
+ cdbs.append(filePath);
+ }
+ }
+
+ foreach (const Utils::FileName &cdb, cdbs) {
+ QList<ProjectExplorer::Abi> abis = ProjectExplorer::Abi::abisOfBinary(cdb);
+ if (abis.isEmpty())
+ continue;
+ if (abis.first().wordWidth() == 32)
+ result.first = cdb.toString();
+ else if (abis.first().wordWidth() == 64)
+ result.second = cdb.toString();
+ }
+
+ // prefer 64bit debugger, even for 32bit binaries:
+ if (!result.second.isEmpty())
+ result.first = result.second;
+
+ return result;
+}
+
+namespace Debugger {
+
+// --------------------------------------------------------------------------
+// DebuggerProfileInformation:
+// --------------------------------------------------------------------------
+
+static const char DEBUGGER_INFORMATION[] = "Debugger.Information";
+
+DebuggerProfileInformation::DebuggerProfileInformation()
+{
+ setObjectName(QLatin1String("DebuggerProfileInformation"));
+}
+
+Core::Id DebuggerProfileInformation::dataId() const
+{
+ static Core::Id id = Core::Id(DEBUGGER_INFORMATION);
+ return id;
+}
+
+unsigned int DebuggerProfileInformation::priority() const
+{
+ return 28000;
+}
+
+QVariant DebuggerProfileInformation::defaultValue(ProjectExplorer::Profile *p) const
+{
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
+ ProjectExplorer::Abi abi = ProjectExplorer::Abi::hostAbi();
+ if (tc)
+ abi = tc->targetAbi();
+
+ // CDB for windows:
+ if (abi.os() == ProjectExplorer::Abi::WindowsOS
+ && abi.osFlavor() != ProjectExplorer::Abi::WindowsMSysFlavor) {
+ QPair<QString, QString> cdbs = autoDetectCdbDebugger();
+ return (abi.wordWidth() == 32) ? cdbs.first : cdbs.second;
+ }
+
+ // Check suggestions from the SDK:
+ if (tc) {
+ const QString path = tc->suggestedDebugger().toString();
+ if (!path.isEmpty())
+ return path;
+ }
+
+ // fall back to system GDB:
+ Utils::Environment env = Utils::Environment::systemEnvironment();
+ return env.searchInPath(QLatin1String("gdb"));
+}
+
+QList<ProjectExplorer::Task> DebuggerProfileInformation::validate(ProjectExplorer::Profile *p) const
+{
+ QList<ProjectExplorer::Task> result;
+ Utils::FileName dbg = debuggerCommand(p);
+ if (dbg.isEmpty()) {
+ result << ProjectExplorer::Task(ProjectExplorer::Task::Warning,
+ tr("No debugger set up."), Utils::FileName(), -1,
+ Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
+ return result;
+ }
+
+ QFileInfo fi = dbg.toFileInfo();
+ if (!fi.exists() || fi.isDir())
+ result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
+ tr("Debugger not found."), Utils::FileName(), -1,
+ Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
+ else if (!fi.isExecutable())
+ result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
+ tr("Debugger not exectutable."), Utils::FileName(), -1,
+ Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
+
+ return result;
+}
+
+ProjectExplorer::ProfileConfigWidget *
+DebuggerProfileInformation::createConfigWidget(ProjectExplorer::Profile *p) const
+{
+ return new Internal::DebuggerProfileConfigWidget(p, this);
+}
+
+ProjectExplorer::ProfileInformation::ItemList DebuggerProfileInformation::toUserOutput(ProjectExplorer::Profile *p) const
+{
+ return ItemList() << qMakePair(tr("Debugger"), debuggerCommand(p).toUserOutput());
+}
+
+Utils::FileName DebuggerProfileInformation::debuggerCommand(const ProjectExplorer::Profile *p)
+{
+ return Utils::FileName::fromString(p->value(Core::Id(DEBUGGER_INFORMATION)).toString());
+}
+
+void DebuggerProfileInformation::setDebuggerCommand(ProjectExplorer::Profile *p, Utils::FileName &command)
+{
+ p->setValue(Core::Id(DEBUGGER_INFORMATION), command.toString());
+}
+
+} // namespace Debugger
diff --git a/src/plugins/debugger/debuggerprofileinformation.h b/src/plugins/debugger/debuggerprofileinformation.h
new file mode 100644
index 0000000000..aaf990e79b
--- /dev/null
+++ b/src/plugins/debugger/debuggerprofileinformation.h
@@ -0,0 +1,67 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef DEBUGGER_DEBUGGERPROFILEINFORMATION_H
+#define DEBUGGER_DEBUGGERPROFILEINFORMATION_H
+
+#include "debugger_global.h"
+
+#include <projectexplorer/profileinformation.h>
+
+namespace Debugger {
+
+class DEBUGGER_EXPORT DebuggerProfileInformation : public ProjectExplorer::ProfileInformation
+{
+ Q_OBJECT
+
+public:
+ DebuggerProfileInformation();
+
+ Core::Id dataId() const;
+
+ unsigned int priority() const; // the higher the closer to the top.
+
+ QVariant defaultValue(ProjectExplorer::Profile *p) const;
+
+ QList<ProjectExplorer::Task> validate(ProjectExplorer::Profile *p) const;
+
+ ProjectExplorer::ProfileConfigWidget *createConfigWidget(ProjectExplorer::Profile *p) const;
+
+ ItemList toUserOutput(ProjectExplorer::Profile *p) const;
+
+ static Utils::FileName debuggerCommand(const ProjectExplorer::Profile *p);
+ static void setDebuggerCommand(ProjectExplorer::Profile *p, Utils::FileName &command);
+};
+
+} // namespace Debugger
+
+#endif // DEBUGGER_DEBUGGERPROFILEINFORMATION_H
diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp
index b6ab4e1404..9d95678f8e 100644
--- a/src/plugins/debugger/debuggerrunner.cpp
+++ b/src/plugins/debugger/debuggerrunner.cpp
@@ -41,6 +41,7 @@
#include "debuggerplugin.h"
#include "debuggerstringutils.h"
#include "debuggerstartparameters.h"
+#include "debuggerprofileinformation.h"
#include "lldb/lldbenginehost.h"
#include "debuggertooltipmanager.h"
#include "qml/qmlengine.h"
@@ -905,6 +906,12 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
if (const ProjectExplorer::Target *target = runConfiguration->target()) {
if (QByteArray(target->metaObject()->className()).contains("Qt4")) {
+ // FIXME: Get this from the profile?
+ // We could query the QtVersion for this information directly, but then we
+ // will need to add a dependency on QtSupport to the debugger.
+ //
+ // The profile could also get a method to extract the required information from
+ // its information to avoid this dependecy (as we do for the environment).
const Utils::FileName qmake = Utils::BuildableHelperLibrary::findSystemQt(sp.environment);
if (!qmake.isEmpty())
sp.qtInstallPath = findQtInstallPath(qmake);
@@ -913,8 +920,8 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
sp.projectSourceDirectory = project->projectDirectory();
if (const ProjectExplorer::BuildConfiguration *buildConfig = target->activeBuildConfiguration()) {
sp.projectBuildDirectory = buildConfig->buildDirectory();
- if (const ProjectExplorer::ToolChain *tc = buildConfig->toolChain())
- sp.debuggerCommand = tc->debuggerCommand().toString();
+ const ProjectExplorer::Profile *p = runConfiguration->target()->profile();
+ sp.debuggerCommand = DebuggerProfileInformation::debuggerCommand(p).toString();
}
sp.projectSourceFiles = project->files(Project::ExcludeGeneratedFiles);
}
diff --git a/src/plugins/debugger/debuggertoolchaincombobox.cpp b/src/plugins/debugger/debuggertoolchaincombobox.cpp
index 32a0eeb5bb..0148a8807a 100644
--- a/src/plugins/debugger/debuggertoolchaincombobox.cpp
+++ b/src/plugins/debugger/debuggertoolchaincombobox.cpp
@@ -32,8 +32,10 @@
#include "debuggertoolchaincombobox.h"
-#include <projectexplorer/toolchainmanager.h>
-#include <projectexplorer/toolchain.h>
+#include "debuggerprofileinformation.h"
+
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/profilemanager.h>
#include <projectexplorer/abi.h>
#include <utils/qtcassert.h>
@@ -58,17 +60,25 @@ DebuggerToolChainComboBox::DebuggerToolChainComboBox(QWidget *parent) :
void DebuggerToolChainComboBox::init(bool hostAbiOnly)
{
const ProjectExplorer::Abi hostAbi = ProjectExplorer::Abi::hostAbi();
- foreach (const ProjectExplorer::ToolChain *tc, ProjectExplorer::ToolChainManager::instance()->toolChains()) {
+ foreach (const ProjectExplorer::Profile *st,
+ ProjectExplorer::ProfileManager::instance()->profiles()) {
+ if (!st->isValid())
+ continue;
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(st);
+ if (!tc)
+ continue;
const ProjectExplorer::Abi abi = tc->targetAbi();
- if (!hostAbiOnly || hostAbi.isCompatibleWith(abi)) {
- const QString debuggerCommand = tc->debuggerCommand().toString();
- if (!debuggerCommand.isEmpty()) {
- const AbiDebuggerCommandPair data(abi, debuggerCommand);
- const QString completeBase = QFileInfo(debuggerCommand).completeBaseName();
- const QString name = tr("%1 (%2)").arg(tc->displayName(), completeBase);
- addItem(name, qVariantFromValue(data));
- }
- }
+ if (hostAbiOnly && hostAbi.os() != abi.os())
+ continue;
+
+ const QString debuggerCommand = DebuggerProfileInformation::debuggerCommand(st).toString();
+ if (debuggerCommand.isEmpty())
+ continue;
+
+ const AbiDebuggerCommandPair data(abi, debuggerCommand);
+ const QString completeBase = QFileInfo(debuggerCommand).completeBaseName();
+ const QString name = tr("%1 (%2)").arg(st->displayName(), completeBase);
+ addItem(name, qVariantFromValue(data));
}
setEnabled(count() > 1);
}
diff --git a/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp b/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp
index 56fde6ba6b..d48728b809 100644
--- a/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp
+++ b/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp
@@ -34,13 +34,15 @@
#include "genericmakestep.h"
#include "genericproject.h"
-#include "generictarget.h"
#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/toolchain.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/toolchain.h>
+#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
+#include <QFormLayout>
#include <QInputDialog>
using namespace GenericProjectManager;
@@ -53,17 +55,17 @@ const char * const GENERIC_BC_ID("GenericProjectManager.GenericBuildConfiguratio
const char * const BUILD_DIRECTORY_KEY("GenericProjectManager.GenericBuildConfiguration.BuildDirectory");
}
-GenericBuildConfiguration::GenericBuildConfiguration(GenericTarget *parent)
+GenericBuildConfiguration::GenericBuildConfiguration(ProjectExplorer::Target *parent)
: BuildConfiguration(parent, Core::Id(GENERIC_BC_ID))
{
}
-GenericBuildConfiguration::GenericBuildConfiguration(GenericTarget *parent, const Core::Id id)
+GenericBuildConfiguration::GenericBuildConfiguration(ProjectExplorer::Target *parent, const Core::Id id)
: BuildConfiguration(parent, id)
{
}
-GenericBuildConfiguration::GenericBuildConfiguration(GenericTarget *parent, GenericBuildConfiguration *source) :
+GenericBuildConfiguration::GenericBuildConfiguration(ProjectExplorer::Target *parent, GenericBuildConfiguration *source) :
BuildConfiguration(parent, source),
m_buildDirectory(source->m_buildDirectory)
{
@@ -112,17 +114,16 @@ void GenericBuildConfiguration::setBuildDirectory(const QString &buildDirectory)
emit buildDirectoryChanged();
}
-GenericTarget *GenericBuildConfiguration::genericTarget() const
+ProjectExplorer::BuildConfigWidget *GenericBuildConfiguration::createConfigWidget()
{
- return static_cast<GenericTarget *>(target());
+ return new GenericBuildSettingsWidget;
}
ProjectExplorer::IOutputParser *GenericBuildConfiguration::createOutputParser() const
{
- ProjectExplorer::ToolChain *tc = genericTarget()->genericProject()->toolChain();
- if (tc)
- return tc->outputParser();
- return 0;
+ ProjectExplorer::ToolChain *tc =
+ ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
+ return tc ? tc->outputParser() : 0;
}
@@ -139,9 +140,9 @@ GenericBuildConfigurationFactory::~GenericBuildConfigurationFactory()
{
}
-QList<Core::Id> GenericBuildConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
+QList<Core::Id> GenericBuildConfigurationFactory::availableCreationIds(const ProjectExplorer::Target *parent) const
{
- if (!qobject_cast<GenericTarget *>(parent))
+ if (!canHandle(parent))
return QList<Core::Id>();
return QList<Core::Id>() << Core::Id(GENERIC_BC_ID);
}
@@ -153,33 +154,35 @@ QString GenericBuildConfigurationFactory::displayNameForId(const Core::Id id) co
return QString();
}
-bool GenericBuildConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
+bool GenericBuildConfigurationFactory::canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const
{
- if (!qobject_cast<GenericTarget *>(parent))
+ if (!canHandle(parent))
return false;
if (id == Core::Id(GENERIC_BC_ID))
return true;
return false;
}
-BuildConfiguration *GenericBuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
+BuildConfiguration *GenericBuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name)
{
if (!canCreate(parent, id))
return 0;
- GenericTarget *target(static_cast<GenericTarget *>(parent));
//TODO asking for name is duplicated everywhere, but maybe more
- // wizards will show up, that incorporate choosing the name
- bool ok;
- QString buildConfigurationName = QInputDialog::getText(0,
- tr("New Configuration"),
- tr("New configuration name:"),
- QLineEdit::Normal,
- QString(),
- &ok);
+ // wizards will show up, that incorporate choosing the nam
+ bool ok = true;
+ QString buildConfigurationName = name;
+ if (buildConfigurationName.isEmpty())
+ buildConfigurationName = QInputDialog::getText(0,
+ tr("New Configuration"),
+ tr("New configuration name:"),
+ QLineEdit::Normal,
+ QString(), &ok);
+ buildConfigurationName = buildConfigurationName.trimmed();
if (!ok || buildConfigurationName.isEmpty())
return 0;
- GenericBuildConfiguration *bc = new GenericBuildConfiguration(target);
+
+ GenericBuildConfiguration *bc = new GenericBuildConfiguration(parent);
bc->setDisplayName(buildConfigurationName);
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
@@ -196,11 +199,10 @@ BuildConfiguration *GenericBuildConfigurationFactory::create(ProjectExplorer::Ta
cleanMakeStep->setBuildTarget(QLatin1String("clean"), /* on = */ true);
cleanMakeStep->setClean(true);
- target->addBuildConfiguration(bc); // also makes the name unique...
return bc;
}
-bool GenericBuildConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const
+bool GenericBuildConfigurationFactory::canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const
{
return canCreate(parent, source->id());
}
@@ -209,11 +211,10 @@ BuildConfiguration *GenericBuildConfigurationFactory::clone(ProjectExplorer::Tar
{
if (!canClone(parent, source))
return 0;
- GenericTarget *target(static_cast<GenericTarget *>(parent));
- return new GenericBuildConfiguration(target, qobject_cast<GenericBuildConfiguration *>(source));
+ return new GenericBuildConfiguration(parent, qobject_cast<GenericBuildConfiguration *>(source));
}
-bool GenericBuildConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
+bool GenericBuildConfigurationFactory::canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
}
@@ -222,16 +223,53 @@ BuildConfiguration *GenericBuildConfigurationFactory::restore(ProjectExplorer::T
{
if (!canRestore(parent, map))
return 0;
- GenericTarget *target(static_cast<GenericTarget *>(parent));
- GenericBuildConfiguration *bc(new GenericBuildConfiguration(target));
+ GenericBuildConfiguration *bc(new GenericBuildConfiguration(parent));
if (bc->fromMap(map))
return bc;
delete bc;
return 0;
}
+bool GenericBuildConfigurationFactory::canHandle(const ProjectExplorer::Target *t) const
+{
+ if (!t->project()->supportsProfile(t->profile()))
+ return false;
+ return qobject_cast<GenericProject *>(t->project());
+}
+
BuildConfiguration::BuildType GenericBuildConfiguration::buildType() const
{
return Unknown;
}
+////////////////////////////////////////////////////////////////////////////////////
+// GenericBuildSettingsWidget
+////////////////////////////////////////////////////////////////////////////////////
+
+GenericBuildSettingsWidget::GenericBuildSettingsWidget() : m_buildConfiguration(0)
+{
+ QFormLayout *fl = new QFormLayout(this);
+ fl->setContentsMargins(0, -1, 0, -1);
+ fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
+
+ // build directory
+ m_pathChooser = new Utils::PathChooser(this);
+ m_pathChooser->setEnabled(true);
+ fl->addRow(tr("Build directory:"), m_pathChooser);
+ connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
+}
+
+QString GenericBuildSettingsWidget::displayName() const
+{ return tr("Generic Manager"); }
+
+void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
+{
+ m_buildConfiguration = static_cast<GenericBuildConfiguration *>(bc);
+ m_pathChooser->setBaseDirectory(bc->target()->project()->projectDirectory());
+ m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory());
+}
+
+void GenericBuildSettingsWidget::buildDirectoryChanged()
+{
+ m_buildConfiguration->setBuildDirectory(m_pathChooser->rawPath());
+}
diff --git a/src/plugins/genericprojectmanager/genericbuildconfiguration.h b/src/plugins/genericprojectmanager/genericbuildconfiguration.h
index 6a2058861a..0f34074485 100644
--- a/src/plugins/genericprojectmanager/genericbuildconfiguration.h
+++ b/src/plugins/genericprojectmanager/genericbuildconfiguration.h
@@ -34,6 +34,9 @@
#define GENERICBUILDCONFIGURATION_H
#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/buildstep.h> // for BuildConfigWidget
+
+namespace Utils { class PathChooser; }
namespace GenericProjectManager {
namespace Internal {
@@ -47,11 +50,10 @@ class GenericBuildConfiguration : public ProjectExplorer::BuildConfiguration
friend class GenericBuildConfigurationFactory;
public:
- explicit GenericBuildConfiguration(GenericTarget *parent);
+ explicit GenericBuildConfiguration(ProjectExplorer::Target *parent);
virtual ~GenericBuildConfiguration();
- GenericTarget *genericTarget() const;
-
+ ProjectExplorer::BuildConfigWidget *createConfigWidget();
virtual QString buildDirectory() const;
QString rawBuildDirectory() const;
@@ -64,8 +66,8 @@ public:
BuildType buildType() const;
protected:
- GenericBuildConfiguration(GenericTarget *parent, GenericBuildConfiguration *source);
- GenericBuildConfiguration(GenericTarget *parent, const Core::Id id);
+ GenericBuildConfiguration(ProjectExplorer::Target *parent, GenericBuildConfiguration *source);
+ GenericBuildConfiguration(ProjectExplorer::Target *parent, const Core::Id id);
virtual bool fromMap(const QVariantMap &map);
private:
@@ -80,17 +82,39 @@ public:
explicit GenericBuildConfigurationFactory(QObject *parent = 0);
~GenericBuildConfigurationFactory();
- QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
+ QList<Core::Id> availableCreationIds(const ProjectExplorer::Target *parent) const;
QString displayNameForId(const Core::Id id) const;
- bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
- ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
- bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
+ bool canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const;
+ ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name = QString());
+ bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source);
- bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
+ bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
+
+private:
+ bool canHandle(const ProjectExplorer::Target *t) const;
+};
+
+class GenericBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
+{
+ Q_OBJECT
+
+public:
+ GenericBuildSettingsWidget();
+
+ QString displayName() const;
+
+ void init(ProjectExplorer::BuildConfiguration *bc);
+
+private slots:
+ void buildDirectoryChanged();
+
+private:
+ Utils::PathChooser *m_pathChooser;
+ GenericBuildConfiguration *m_buildConfiguration;
};
-} // namespace GenericProjectManager
} // namespace Internal
+} // namespace GenericProjectManager
#endif // GENERICBUILDCONFIGURATION_H
diff --git a/src/plugins/genericprojectmanager/genericmakestep.cpp b/src/plugins/genericprojectmanager/genericmakestep.cpp
index 37dcc2566d..d6d176667e 100644
--- a/src/plugins/genericprojectmanager/genericmakestep.cpp
+++ b/src/plugins/genericprojectmanager/genericmakestep.cpp
@@ -33,16 +33,16 @@
#include "genericmakestep.h"
#include "genericprojectconstants.h"
#include "genericproject.h"
-#include "generictarget.h"
#include "ui_genericmakestep.h"
#include "genericbuildconfiguration.h"
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/toolchain.h>
-#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/gnumakeparser.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/toolchain.h>
#include <coreplugin/variablemanager.h>
#include <utils/stringutils.h>
#include <utils/qtcassert.h>
@@ -126,8 +126,10 @@ bool GenericMakeStep::init()
setIgnoreReturnValue(m_clean);
setOutputParser(new ProjectExplorer::GnuMakeParser());
- if (bc->genericTarget()->genericProject()->toolChain())
- appendOutputParser(bc->genericTarget()->genericProject()->toolChain()->outputParser());
+ ProjectExplorer::ToolChain *tc =
+ ProjectExplorer::ToolChainProfileInformation::toolChain(bc->target()->profile());
+ if (tc)
+ appendOutputParser(tc->outputParser());
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
@@ -175,9 +177,9 @@ QString GenericMakeStep::makeCommand() const
{
QString command = m_makeCommand;
if (command.isEmpty()) {
- GenericProject *pro = static_cast<GenericProject *>(target()->project());
- if (ProjectExplorer::ToolChain *toolChain = pro->toolChain())
- command = toolChain->makeCommand();
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
+ if (tc)
+ command = tc->makeCommand();
else
command = QLatin1String("make");
}
@@ -249,7 +251,7 @@ GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeSt
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
this, SLOT(updateDetails()));
- connect(pro, SIGNAL(toolChainChanged(ProjectExplorer::ToolChain*)),
+ connect(m_makeStep->target(), SIGNAL(profileChanged()),
this, SLOT(updateMakeOverrrideLabel()));
}
diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp
index c63ab87f00..01fb99ae39 100644
--- a/src/plugins/genericprojectmanager/genericproject.cpp
+++ b/src/plugins/genericprojectmanager/genericproject.cpp
@@ -34,17 +34,19 @@
#include "genericbuildconfiguration.h"
#include "genericprojectconstants.h"
-#include "generictarget.h"
+
+#include "genericmakestep.h"
#include <projectexplorer/abi.h>
#include <projectexplorer/buildenvironmentwidget.h>
+#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/headerpath.h>
-#include <projectexplorer/toolchainmanager.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/profilemanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <qtsupport/customexecutablerunconfiguration.h>
#include <cpptools/ModelManagerInterface.h>
#include <extensionsystem/pluginmanager.h>
-#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
#include <utils/fileutils.h>
#include <coreplugin/icore.h>
@@ -54,7 +56,6 @@
#include <QDir>
#include <QProcessEnvironment>
-#include <QFormLayout>
#include <QMainWindow>
#include <QComboBox>
@@ -62,18 +63,13 @@ using namespace GenericProjectManager;
using namespace GenericProjectManager::Internal;
using namespace ProjectExplorer;
-namespace {
-const char * const TOOLCHAIN_KEY("GenericProjectManager.GenericProject.Toolchain");
-} // end of anonymous namespace
-
////////////////////////////////////////////////////////////////////////////////////
// GenericProject
////////////////////////////////////////////////////////////////////////////////////
GenericProject::GenericProject(Manager *manager, const QString &fileName)
: m_manager(manager),
- m_fileName(fileName),
- m_toolChain(0)
+ m_fileName(fileName)
{
setProjectContext(Core::Context(GenericProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguage(Core::Context(ProjectExplorer::Constants::LANG_CXX));
@@ -107,12 +103,6 @@ GenericProject::~GenericProject()
m_manager->unregisterProject(this);
delete m_rootNode;
- // do not delete m_toolChain
-}
-
-GenericTarget *GenericProject::activeTarget() const
-{
- return static_cast<GenericTarget *>(Project::activeTarget());
}
QString GenericProject::filesFileName() const
@@ -261,11 +251,13 @@ void GenericProject::refresh(RefreshOptions options)
CPlusPlus::CppModelManagerInterface::ProjectPart::Ptr part(
new CPlusPlus::CppModelManagerInterface::ProjectPart);
- if (m_toolChain) {
- part->defines = m_toolChain->predefinedMacros(QStringList());
+ ToolChain *tc = activeTarget() ?
+ ProjectExplorer::ToolChainProfileInformation::toolChain(activeTarget()->profile()) : 0;
+ if (tc) {
+ part->defines = tc->predefinedMacros(QStringList());
part->defines += '\n';
- foreach (const HeaderPath &headerPath, m_toolChain->systemHeaderPaths()) {
+ foreach (const HeaderPath &headerPath, tc->systemHeaderPaths()) {
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
part->frameworkPaths.append(headerPath.path());
else
@@ -389,27 +381,6 @@ QByteArray GenericProject::defines() const
return m_defines;
}
-void GenericProject::setToolChain(ToolChain *tc)
-{
- if (m_toolChain == tc)
- return;
-
- m_toolChain = tc;
- refresh(Configuration);
-
- foreach (Target *t, targets()) {
- foreach (BuildConfiguration *bc, t->buildConfigurations())
- bc->setToolChain(tc);
- }
-
- emit toolChainChanged(m_toolChain);
-}
-
-ToolChain *GenericProject::toolChain() const
-{
- return m_toolChain;
-}
-
QString GenericProject::displayName() const
{
return m_projectName;
@@ -456,18 +427,14 @@ QStringList GenericProject::buildTargets() const
return targets;
}
-QVariantMap GenericProject::toMap() const
-{
- QVariantMap map(Project::toMap());
- map.insert(QLatin1String(TOOLCHAIN_KEY), m_toolChain ? m_toolChain->id() : QString());
- return map;
-}
-
bool GenericProject::fromMap(const QVariantMap &map)
{
if (!Project::fromMap(map))
return false;
+ if (!activeTarget())
+ addTarget(createTarget(ProfileManager::instance()->defaultProfile()));
+
// Sanity check: We need both a buildconfiguration and a runconfiguration!
QList<Target *> targetList = targets();
foreach (Target *t, targetList) {
@@ -480,119 +447,16 @@ bool GenericProject::fromMap(const QVariantMap &map)
t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
}
- // Add default setup:
- if (targets().isEmpty()) {
- GenericTargetFactory *factory =
- ExtensionSystem::PluginManager::getObject<GenericTargetFactory>();
- addTarget(factory->create(this, Core::Id(GENERIC_DESKTOP_TARGET_ID)));
- }
-
- QString id = map.value(QLatin1String(TOOLCHAIN_KEY)).toString();
- const ToolChainManager *toolChainManager = ToolChainManager::instance();
-
- if (!id.isNull()) {
- setToolChain(toolChainManager->findToolChain(id));
- } else {
- ProjectExplorer::Abi abi = ProjectExplorer::Abi::hostAbi();
- abi = ProjectExplorer::Abi(abi.architecture(), abi.os(), ProjectExplorer::Abi::UnknownFlavor,
- abi.binaryFormat(), abi.wordWidth() == 32 ? 32 : 0);
- QList<ToolChain *> tcs = toolChainManager->findToolChains(abi);
- if (tcs.isEmpty())
- tcs = toolChainManager->toolChains();
- if (!tcs.isEmpty())
- setToolChain(tcs.at(0));
- }
-
setIncludePaths(allIncludePaths());
- refresh(Everything);
+ evaluateBuildSystem();
return true;
}
-////////////////////////////////////////////////////////////////////////////////////
-// GenericBuildSettingsWidget
-////////////////////////////////////////////////////////////////////////////////////
-
-GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericTarget *target)
- : m_target(target), m_toolChainChooser(0), m_buildConfiguration(0)
-{
- QFormLayout *fl = new QFormLayout(this);
- fl->setContentsMargins(0, -1, 0, -1);
- fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
-
- // build directory
- m_pathChooser = new Utils::PathChooser(this);
- m_pathChooser->setEnabled(true);
- m_pathChooser->setBaseDirectory(m_target->genericProject()->projectDirectory());
- fl->addRow(tr("Build directory:"), m_pathChooser);
- connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
-
- // tool chain
- m_toolChainChooser = new QComboBox;
- m_toolChainChooser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- updateToolChainList();
-
- fl->addRow(tr("Tool chain:"), m_toolChainChooser);
- connect(m_toolChainChooser, SIGNAL(activated(int)), this, SLOT(toolChainSelected(int)));
- connect(m_target->genericProject(), SIGNAL(toolChainChanged(ProjectExplorer::ToolChain*)),
- this, SLOT(toolChainChanged(ProjectExplorer::ToolChain*)));
- connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
- this, SLOT(updateToolChainList()));
- connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainRemoved(ProjectExplorer::ToolChain*)),
- this, SLOT(updateToolChainList()));
-}
-
-GenericBuildSettingsWidget::~GenericBuildSettingsWidget()
-{ }
-
-QString GenericBuildSettingsWidget::displayName() const
-{ return tr("Generic Manager"); }
-
-void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
-{
- m_buildConfiguration = static_cast<GenericBuildConfiguration *>(bc);
- m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory());
-}
-
-void GenericBuildSettingsWidget::buildDirectoryChanged()
-{
- m_buildConfiguration->setBuildDirectory(m_pathChooser->rawPath());
-}
-
-void GenericBuildSettingsWidget::toolChainSelected(int index)
-{
- using namespace ProjectExplorer;
-
- ToolChain *tc = static_cast<ToolChain *>(m_toolChainChooser->itemData(index).value<void *>());
- m_target->genericProject()->setToolChain(tc);
-}
-
-void GenericBuildSettingsWidget::toolChainChanged(ProjectExplorer::ToolChain *tc)
-{
- for (int i = 0; i < m_toolChainChooser->count(); ++i) {
- ToolChain * currentTc = static_cast<ToolChain *>(m_toolChainChooser->itemData(i).value<void *>());
- if (currentTc != tc)
- continue;
- m_toolChainChooser->setCurrentIndex(i);
- return;
- }
-}
-
-void GenericBuildSettingsWidget::updateToolChainList()
+void GenericProject::evaluateBuildSystem()
{
- m_toolChainChooser->clear();
-
- QList<ToolChain *> tcs = ToolChainManager::instance()->toolChains();
- if (!m_target->genericProject()->toolChain()) {
- m_toolChainChooser->addItem(tr("<Invalid tool chain>"), qVariantFromValue(static_cast<void *>(0)));
- m_toolChainChooser->setCurrentIndex(0);
- }
- foreach (ToolChain *tc, tcs) {
- m_toolChainChooser->addItem(tc->displayName(), qVariantFromValue(static_cast<void *>(tc)));
- if (m_target->genericProject()->toolChain()
- && m_target->genericProject()->toolChain()->id() == tc->id())
- m_toolChainChooser->setCurrentIndex(m_toolChainChooser->count() - 1);
- }
+ refresh(Everything);
+ buildSystemEvaluationFinished(true);
}
////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/plugins/genericprojectmanager/genericproject.h b/src/plugins/genericprojectmanager/genericproject.h
index a36f2323c4..17c5791677 100644
--- a/src/plugins/genericprojectmanager/genericproject.h
+++ b/src/plugins/genericprojectmanager/genericproject.h
@@ -35,13 +35,11 @@
#include "genericprojectmanager.h"
#include "genericprojectnodes.h"
-#include "generictarget.h"
#include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
-#include <projectexplorer/buildstep.h>
#include <projectexplorer/buildconfiguration.h>
#include <coreplugin/idocument.h>
@@ -51,13 +49,7 @@ QT_BEGIN_NAMESPACE
class QComboBox;
QT_END_NAMESPACE
-namespace Utils {
-class PathChooser;
-}
-
-namespace ProjectExplorer {
-class ToolChain;
-}
+namespace ProjectExplorer { class ToolChain; }
namespace GenericProjectManager {
namespace Internal {
@@ -84,7 +76,6 @@ public:
Core::Id id() const;
Core::IDocument *document() const;
ProjectExplorer::IProjectManager *projectManager() const;
- GenericTarget *activeTarget() const;
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
@@ -114,18 +105,12 @@ public:
QStringList projectIncludePaths() const;
QStringList files() const;
QStringList generated() const;
- ProjectExplorer::ToolChain *toolChain() const;
- void setToolChain(ProjectExplorer::ToolChain *tc);
-
- QVariantMap toMap() const;
-
-signals:
- void toolChainChanged(ProjectExplorer::ToolChain *);
protected:
- virtual bool fromMap(const QVariantMap &map);
+ bool fromMap(const QVariantMap &map);
private:
+ void evaluateBuildSystem();
bool saveRawFileList(const QStringList &rawFileList);
void parseProject(RefreshOptions options);
QStringList processEntries(const QStringList &paths,
@@ -150,7 +135,6 @@ private:
QByteArray m_defines;
GenericProjectNode *m_rootNode;
- ProjectExplorer::ToolChain *m_toolChain;
QFuture<void> m_codeModelFuture;
};
@@ -182,31 +166,6 @@ private:
GenericProject::RefreshOptions m_options;
};
-class GenericBuildSettingsWidget : public ProjectExplorer::BuildConfigWidget
-{
- Q_OBJECT
-
-public:
- GenericBuildSettingsWidget(GenericTarget *target);
- virtual ~GenericBuildSettingsWidget();
-
- virtual QString displayName() const;
-
- virtual void init(ProjectExplorer::BuildConfiguration *bc);
-
-private Q_SLOTS:
- void buildDirectoryChanged();
- void toolChainSelected(int index);
- void toolChainChanged(ProjectExplorer::ToolChain *);
- void updateToolChainList();
-
-private:
- GenericTarget *m_target;
- Utils::PathChooser *m_pathChooser;
- QComboBox *m_toolChainChooser;
- GenericBuildConfiguration *m_buildConfiguration;
-};
-
} // namespace Internal
} // namespace GenericProjectManager
diff --git a/src/plugins/genericprojectmanager/genericprojectmanager.pro b/src/plugins/genericprojectmanager/genericprojectmanager.pro
index 5c57d8a4d0..02c60f9540 100644
--- a/src/plugins/genericprojectmanager/genericprojectmanager.pro
+++ b/src/plugins/genericprojectmanager/genericprojectmanager.pro
@@ -4,7 +4,6 @@ include(../../qtcreatorplugin.pri)
include(genericprojectmanager_dependencies.pri)
HEADERS = genericproject.h \
genericprojectplugin.h \
- generictarget.h \
genericprojectmanager.h \
genericprojectconstants.h \
genericprojectnodes.h \
@@ -17,7 +16,6 @@ HEADERS = genericproject.h \
filesselectionwizardpage.h
SOURCES = genericproject.cpp \
genericprojectplugin.cpp \
- generictarget.cpp \
genericprojectmanager.cpp \
genericprojectnodes.cpp \
genericprojectwizard.cpp \
diff --git a/src/plugins/genericprojectmanager/genericprojectmanager.qbs b/src/plugins/genericprojectmanager/genericprojectmanager.qbs
index e4070e88e6..9b47c6767b 100644
--- a/src/plugins/genericprojectmanager/genericprojectmanager.qbs
+++ b/src/plugins/genericprojectmanager/genericprojectmanager.qbs
@@ -25,7 +25,6 @@ QtcPlugin {
files: [
"genericproject.h",
"genericprojectplugin.h",
- "generictarget.h",
"genericprojectmanager.h",
"genericprojectconstants.h",
"genericprojectnodes.h",
@@ -38,7 +37,6 @@ QtcPlugin {
"filesselectionwizardpage.h",
"genericproject.cpp",
"genericprojectplugin.cpp",
- "generictarget.cpp",
"genericprojectmanager.cpp",
"genericprojectnodes.cpp",
"genericprojectwizard.cpp",
diff --git a/src/plugins/genericprojectmanager/genericprojectplugin.cpp b/src/plugins/genericprojectmanager/genericprojectplugin.cpp
index da87b4e91f..bf49f107a9 100644
--- a/src/plugins/genericprojectmanager/genericprojectplugin.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectplugin.cpp
@@ -31,12 +31,13 @@
**************************************************************************/
#include "genericprojectplugin.h"
+
+#include "genericbuildconfiguration.h"
#include "genericprojectmanager.h"
#include "genericprojectwizard.h"
#include "genericprojectconstants.h"
#include "genericprojectfileseditor.h"
#include "genericmakestep.h"
-#include "generictarget.h"
#include "genericproject.h"
#include "selectablefilesmodel.h"
@@ -92,7 +93,7 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage
addAutoReleasedObject(manager);
addAutoReleasedObject(new GenericMakeStepFactory);
addAutoReleasedObject(new GenericProjectWizard);
- addAutoReleasedObject(new GenericTargetFactory);
+ addAutoReleasedObject(new GenericBuildConfigurationFactory);
const Core::Context projectContext(Constants::PROJECTCONTEXT);
Core::ActionContainer *mproject =
diff --git a/src/plugins/genericprojectmanager/generictarget.cpp b/src/plugins/genericprojectmanager/generictarget.cpp
deleted file mode 100644
index 8255a8b5b3..0000000000
--- a/src/plugins/genericprojectmanager/generictarget.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "generictarget.h"
-
-#include "genericbuildconfiguration.h"
-#include "genericproject.h"
-#include "genericmakestep.h"
-
-#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/deployconfiguration.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
-
-#include <QApplication>
-#include <QStyle>
-
-const char GENERIC_DESKTOP_TARGET_DISPLAY_NAME[] = "Desktop";
-
-using namespace GenericProjectManager;
-using namespace GenericProjectManager::Internal;
-
-////////////////////////////////////////////////////////////////////////////////////
-// GenericTarget
-////////////////////////////////////////////////////////////////////////////////////
-
-GenericTarget::GenericTarget(GenericProject *parent) :
- ProjectExplorer::Target(parent, Core::Id(GENERIC_DESKTOP_TARGET_ID)),
- m_buildConfigurationFactory(new GenericBuildConfigurationFactory(this))
-{
- setDefaultDisplayName(QApplication::translate("GenericProjectManager::GenericTarget",
- GENERIC_DESKTOP_TARGET_DISPLAY_NAME));
- setIcon(qApp->style()->standardIcon(QStyle::SP_ComputerIcon));
-}
-
-ProjectExplorer::BuildConfigWidget *GenericTarget::createConfigWidget()
-{
- return new GenericBuildSettingsWidget(this);
-}
-
-GenericProject *GenericTarget::genericProject() const
-{
- return static_cast<GenericProject *>(project());
-}
-
-GenericBuildConfigurationFactory *GenericTarget::buildConfigurationFactory() const
-{
- return m_buildConfigurationFactory;
-}
-
-GenericBuildConfiguration *GenericTarget::activeBuildConfiguration() const
-{
- return static_cast<GenericBuildConfiguration *>(Target::activeBuildConfiguration());
-}
-
-bool GenericTarget::fromMap(const QVariantMap &map)
-{
- return Target::fromMap(map);
-}
-
-////////////////////////////////////////////////////////////////////////////////////
-// GenericTargetFactory
-////////////////////////////////////////////////////////////////////////////////////
-
-GenericTargetFactory::GenericTargetFactory(QObject *parent) :
- ITargetFactory(parent)
-{
-}
-
-bool GenericTargetFactory::supportsTargetId(const Core::Id id) const
-{
- return id == Core::Id(GENERIC_DESKTOP_TARGET_ID);
-}
-
-QList<Core::Id> GenericTargetFactory::supportedTargetIds() const
-{
- return QList<Core::Id>() << Core::Id(GENERIC_DESKTOP_TARGET_ID);
-}
-
-QString GenericTargetFactory::displayNameForId(const Core::Id id) const
-{
- if (id == Core::Id(GENERIC_DESKTOP_TARGET_ID))
- return QCoreApplication::translate("GenericProjectManager::GenericTarget",
- GENERIC_DESKTOP_TARGET_DISPLAY_NAME,
- "Generic desktop target display name");
- return QString();
-}
-
-bool GenericTargetFactory::canCreate(ProjectExplorer::Project *parent, const Core::Id id) const
-{
- if (!qobject_cast<GenericProject *>(parent))
- return false;
- return id == Core::Id(GENERIC_DESKTOP_TARGET_ID);
-}
-
-GenericTarget *GenericTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id)
-{
- if (!canCreate(parent, id))
- return 0;
- GenericProject *genericproject = static_cast<GenericProject *>(parent);
- GenericTarget *t = new GenericTarget(genericproject);
-
- // Set up BuildConfiguration:
- GenericBuildConfiguration *bc = new GenericBuildConfiguration(t);
- bc->setDisplayName(QLatin1String("all"));
-
- ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
- ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
-
- GenericMakeStep *makeStep = new GenericMakeStep(buildSteps);
- buildSteps->insertStep(0, makeStep);
- makeStep->setBuildTarget(QLatin1String("all"), /* on = */ true);
-
- GenericMakeStep *cleanMakeStep = new GenericMakeStep(cleanSteps);
- cleanSteps->insertStep(0, cleanMakeStep);
- cleanMakeStep->setBuildTarget(QLatin1String("clean"), /* on = */ true);
- cleanMakeStep->setClean(true);
-
- bc->setBuildDirectory(genericproject->projectDirectory());
-
- t->addBuildConfiguration(bc);
-
- t->addDeployConfiguration(t->createDeployConfiguration(ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID));
-
- // Add a runconfiguration. The CustomExecutableRC one will query the user
- // for its settings, so it is a good choice here.
- t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
-
- return t;
-}
-
-bool GenericTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const
-{
- return canCreate(parent, ProjectExplorer::idFromMap(map));
-}
-
-GenericTarget *GenericTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map)
-{
- if (!canRestore(parent, map))
- return 0;
- GenericProject *genericproject = static_cast<GenericProject *>(parent);
- GenericTarget *target = new GenericTarget(genericproject);
- if (target->fromMap(map))
- return target;
- delete target;
- return 0;
-}
diff --git a/src/plugins/genericprojectmanager/generictarget.h b/src/plugins/genericprojectmanager/generictarget.h
deleted file mode 100644
index 48eef3e9f5..0000000000
--- a/src/plugins/genericprojectmanager/generictarget.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef GENERICTARGET_H
-#define GENERICTARGET_H
-
-#include <projectexplorer/target.h>
-
-#include "genericbuildconfiguration.h"
-
-#include <QStringList>
-#include <QVariantMap>
-
-namespace ProjectExplorer {
-class IBuildConfigurationFactory;
-} // namespace ProjectExplorer
-
-namespace GenericProjectManager {
-namespace Internal {
-
-const char GENERIC_DESKTOP_TARGET_ID[] = "GenericProjectManager.GenericTarget";
-
-class GenericProject;
-class GenericRunConfiguration;
-
-class GenericTargetFactory;
-
-class GenericTarget : public ProjectExplorer::Target
-{
- Q_OBJECT
- friend class GenericTargetFactory;
-
-public:
- explicit GenericTarget(GenericProject *parent);
-
- ProjectExplorer::BuildConfigWidget *createConfigWidget();
-
- GenericProject *genericProject() const;
-
- GenericBuildConfigurationFactory *buildConfigurationFactory() const;
- GenericBuildConfiguration *activeBuildConfiguration() const;
-
-protected:
- bool fromMap(const QVariantMap &map);
-
-private:
- GenericBuildConfigurationFactory *m_buildConfigurationFactory;
-};
-
-class GenericTargetFactory : public ProjectExplorer::ITargetFactory
-{
- Q_OBJECT
-
-public:
- explicit GenericTargetFactory(QObject *parent = 0);
-
- bool supportsTargetId(const Core::Id id) const;
-
- QList<Core::Id> supportedTargetIds() const;
- QString displayNameForId(const Core::Id id) const;
-
- bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
- GenericTarget *create(ProjectExplorer::Project *parent, const Core::Id id);
- bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
- GenericTarget *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
-};
-
-} // namespace Internal
-} // namespace GenericProjectManager
-
-#endif // GENERICTARGET_H
diff --git a/src/plugins/madde/debianmanager.cpp b/src/plugins/madde/debianmanager.cpp
new file mode 100644
index 0000000000..944372fcdf
--- /dev/null
+++ b/src/plugins/madde/debianmanager.cpp
@@ -0,0 +1,728 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "debianmanager.h"
+
+#include "maddedevice.h"
+#include "maemoconstants.h"
+#include "maemoglobal.h"
+#include "maemopackagecreationstep.h"
+
+#include <coreplugin/documentmanager.h>
+#include <projectexplorer/project.h>
+#include <projectexplorer/target.h>
+#include <qt4projectmanager/qt4buildconfiguration.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <utils/filesystemwatcher.h>
+#include <utils/qtcassert.h>
+
+#include <QBuffer>
+#include <QByteArray>
+#include <QDateTime>
+#include <QDir>
+#include <QProcess>
+
+#include <QMessageBox>
+
+// -----------------------------------------------------------------------
+// Helpers:
+// -----------------------------------------------------------------------
+
+namespace {
+
+const QByteArray IconFieldName("XB-Maemo-Icon-26");
+const QByteArray NameFieldName("Package");
+const QByteArray ShortDescriptionFieldName("Description");
+
+const QLatin1String PackagingDirName("qtc_packaging");
+
+// The QDateTime API can only deliver these in localized form...
+QString shortMonthName(const QDateTime &dt)
+{
+ switch (dt.date().month()) {
+ case 1: return QLatin1String("Jan");
+ case 2: return QLatin1String("Feb");
+ case 3: return QLatin1String("Mar");
+ case 4: return QLatin1String("Apr");
+ case 5: return QLatin1String("May");
+ case 6: return QLatin1String("Jun");
+ case 7: return QLatin1String("Jul");
+ case 8: return QLatin1String("Aug");
+ case 9: return QLatin1String("Sep");
+ case 10: return QLatin1String("Oct");
+ case 11: return QLatin1String("Nov");
+ case 12: return QLatin1String("Dec");
+ default: QTC_ASSERT(false, return QString());
+ }
+}
+
+QString shortDayOfWeekName(const QDateTime &dt)
+{
+ switch (dt.date().dayOfWeek()) {
+ case Qt::Monday: return QLatin1String("Mon");
+ case Qt::Tuesday: return QLatin1String("Tue");
+ case Qt::Wednesday: return QLatin1String("Wed");
+ case Qt::Thursday: return QLatin1String("Thu");
+ case Qt::Friday: return QLatin1String("Fri");
+ case Qt::Saturday: return QLatin1String("Sat");
+ case Qt::Sunday: return QLatin1String("Sun");
+ default: QTC_ASSERT(false, return QString());
+ }
+}
+
+QByteArray packageManagerNameFieldName(Core::Id deviceType)
+{
+ if (deviceType == Core::Id(Madde::Internal::Maemo5OsType))
+ return QByteArray("XB-Maemo-Display-Name");
+ return QByteArray("XSBC-Maemo-Display-Name");
+}
+
+QList<QPair<QByteArray, QByteArray> > additionalFields(Core::Id deviceType, const QString &projectName)
+{
+ QList<QPair<QByteArray, QByteArray> > fields;
+ if (deviceType == Core::Id(Madde::Internal::HarmattanOsType))
+ fields << qMakePair(QByteArray("XB-Maemo-Flags"), QByteArray("visible"))
+ << qMakePair(QByteArray("XB-MeeGo-Desktop-Entry-Filename"),
+ QString::fromLatin1("%1_harmattan").arg(projectName).toUtf8())
+ << qMakePair(QByteArray("XB-MeeGo-Desktop-Entry"),
+ QString::fromLatin1("\n [Desktop Entry]\n Type=Application\n Name=%1\n Icon=/usr/share/icons/hicolor/80x80/apps/%1%2.png")
+ .arg(projectName).arg(80).toUtf8());
+ return fields;
+}
+
+QByteArray section(Core::Id deviceType) {
+ if (deviceType == Core::Id(Madde::Internal::Maemo5OsType))
+ return "user/hidden";
+ else if (deviceType == Core::Id(Madde::Internal::HarmattanOsType))
+ return "user/other";
+ return QByteArray();
+}
+
+void raiseError(const QString &reason)
+{
+ QMessageBox::critical(0, QCoreApplication::translate("Madde::DebianManager",
+ "Error creating debian project templates"), reason);
+}
+
+QString defaultPackageFileName(ProjectExplorer::Project *project)
+{
+ QString packageName = project->displayName().toLower();
+
+ // We also replace dots later, because OVI store chokes on them (for the N900).
+ QRegExp illegalLetter(QLatin1String("[^a-z0-9+-]"), Qt::CaseSensitive, QRegExp::WildcardUnix);
+
+ return packageName.replace(illegalLetter, QLatin1String("-"));
+}
+
+bool adaptTagValue(QByteArray &document, const QByteArray &fieldName,
+ const QByteArray &newFieldValue, bool caseSensitive)
+{
+ QByteArray adaptedLine = fieldName + ": " + newFieldValue;
+ const QByteArray completeTag = fieldName + ':';
+ const int lineOffset = caseSensitive ? document.indexOf(completeTag)
+ : document.toLower().indexOf(completeTag.toLower());
+ if (lineOffset == -1) {
+ document.append(adaptedLine).append('\n');
+ return true;
+ }
+
+ int newlineOffset = document.indexOf('\n', lineOffset);
+ bool updated = false;
+ if (newlineOffset == -1) {
+ newlineOffset = document.length();
+ adaptedLine += '\n';
+ updated = true;
+ }
+ const int replaceCount = newlineOffset - lineOffset;
+ if (!updated && document.mid(lineOffset, replaceCount) != adaptedLine)
+ updated = true;
+ if (updated)
+ document.replace(lineOffset, replaceCount, adaptedLine);
+ return updated;
+}
+
+QByteArray controlFileFieldValue(const Utils::FileName &control, const QString &key, bool multiLine)
+{
+ QByteArray value;
+ Utils::FileReader reader;
+ if (!reader.fetch(control.toString()))
+ return value;
+ const QByteArray &contents = reader.data();
+ const int keyPos = contents.indexOf(key.toUtf8() + ':');
+ if (keyPos == -1)
+ return value;
+ int valueStartPos = keyPos + key.length() + 1;
+ int valueEndPos = contents.indexOf('\n', keyPos);
+ if (valueEndPos == -1)
+ valueEndPos = contents.count();
+ value = contents.mid(valueStartPos, valueEndPos - valueStartPos).trimmed();
+ if (multiLine) {
+ Q_FOREVER {
+ valueStartPos = valueEndPos + 1;
+ if (valueStartPos >= contents.count())
+ break;
+ const char firstChar = contents.at(valueStartPos);
+ if (firstChar == '#' || isspace(firstChar)) {
+ valueEndPos = contents.indexOf('\n', valueStartPos);
+ if (valueEndPos == -1)
+ valueEndPos = contents.count();
+ if (firstChar != '#') {
+ value += contents.mid(valueStartPos,
+ valueEndPos - valueStartPos).trimmed();
+ }
+ } else {
+ break;
+ }
+ }
+ }
+ return value;
+}
+
+bool setControlFieldValue(const Utils::FileName &control, const QByteArray &fieldName,
+ const QByteArray &fieldValue)
+{
+ Utils::FileReader reader;
+ if (!reader.fetch(control.toString()))
+ return false;
+ QByteArray contents = reader.data();
+ if (!adaptTagValue(contents, fieldName, fieldValue, true))
+ return false;
+ Core::FileChangeBlocker update(control.toString());
+ Utils::FileSaver saver(control.toString());
+ saver.write(contents);
+ return saver.finalize();
+}
+
+bool adaptRulesFile(const Utils::FileName &rulesPath)
+{
+ Utils::FileReader reader;
+ if (!reader.fetch(rulesPath.toString())) {
+ raiseError(reader.errorString());
+ return false;
+ }
+ QByteArray rulesContents = reader.data();
+ const QByteArray comment("# Uncomment this line for use without Qt Creator");
+ rulesContents.replace("DESTDIR", "INSTALL_ROOT");
+ rulesContents.replace("dh_shlibdeps", "# dh_shlibdeps " + comment);
+ rulesContents.replace("# Add here commands to configure the package.",
+ "# qmake PREFIX=/usr" + comment);
+ rulesContents.replace("$(MAKE)\n", "# $(MAKE) " + comment + '\n');
+
+ // Would be the right solution, but does not work (on Windows),
+ // because dpkg-genchanges doesn't know about it (and can't be told).
+ // rulesContents.replace("dh_builddeb", "dh_builddeb --destdir=.");
+
+ Utils::FileSaver saver(rulesPath.toString());
+ saver.write(rulesContents);
+ if (!saver.finalize()) {
+ raiseError(saver.errorString());
+ return false;
+ }
+ return true;
+}
+
+bool adaptControlFile(const Utils::FileName &controlPath, Qt4ProjectManager::Qt4BuildConfiguration *bc,
+ const QByteArray &section, const QByteArray &packageManagerNameField,
+ QList<QPair<QByteArray, QByteArray> > additionalFields)
+{
+ Utils::FileReader reader;
+ if (!reader.fetch(controlPath.toString())) {
+ raiseError(reader.errorString());
+ return false;
+ }
+ QByteArray controlContents = reader.data();
+
+ adaptTagValue(controlContents, "Section", section, true);
+ adaptTagValue(controlContents, "Priority", "optional", true);
+ adaptTagValue(controlContents, packageManagerNameField,
+ bc->target()->project()->displayName().toUtf8(), true);
+ const int buildDependsOffset = controlContents.indexOf("Build-Depends:");
+ if (buildDependsOffset == -1) {
+ qDebug("Unexpected: no Build-Depends field in debian control file.");
+ } else {
+ int buildDependsNewlineOffset
+ = controlContents.indexOf('\n', buildDependsOffset);
+ if (buildDependsNewlineOffset == -1) {
+ controlContents += '\n';
+ buildDependsNewlineOffset = controlContents.length() - 1;
+ }
+ controlContents.insert(buildDependsNewlineOffset,
+ ", libqt4-dev");
+ }
+
+ for (int i = 0; i < additionalFields.count(); ++i)
+ adaptTagValue(controlContents, additionalFields.at(i).first, additionalFields.at(i).second, true);
+
+ Utils::FileSaver saver(controlPath.toString());
+ saver.write(controlContents);
+ if (!saver.finalize()) {
+ raiseError(saver.errorString());
+ return false;
+ }
+ return true;
+}
+
+} // namespace
+
+namespace Madde {
+namespace Internal {
+
+// -----------------------------------------------------------------------
+// DebianManager:
+// -----------------------------------------------------------------------
+
+DebianManager *DebianManager::m_instance = 0;
+
+DebianManager::DebianManager(QObject *parent) :
+ QObject(parent),
+ m_watcher(new Utils::FileSystemWatcher(this))
+{
+ m_instance = this;
+
+ m_watcher->setObjectName("Madde::DebianManager");
+ connect(m_watcher, SIGNAL(directoryChanged(QString)),
+ this, SLOT(directoryWasChanged(QString)));
+}
+
+DebianManager::~DebianManager()
+{ }
+
+DebianManager *DebianManager::instance()
+{
+ return m_instance;
+}
+
+void DebianManager::monitor(const Utils::FileName &debianDir)
+{
+ QFileInfo fi = debianDir.toFileInfo();
+ if (!fi.isDir())
+ return;
+
+ if (!m_watches.contains(debianDir)) {
+ m_watches.insert(debianDir, 1);
+ m_watcher->addDirectory(debianDir.toString(), Utils::FileSystemWatcher::WatchAllChanges);
+
+ WatchableFile *controlFile = new WatchableFile(controlFilePath(debianDir).toString(), this);
+ connect(controlFile, SIGNAL(modified()), this, SLOT(controlWasChanged()));
+ WatchableFile *changelogFile = new WatchableFile(changelogFilePath(debianDir).toString(), this);
+ connect(changelogFile, SIGNAL(modified()), SLOT(changelogWasChanged()));
+ Core::DocumentManager::addDocuments(QList<Core::IDocument *>() << controlFile << changelogFile);
+ }
+}
+
+bool DebianManager::isMonitoring(const Utils::FileName &debianDir)
+{
+ return m_watches.contains(debianDir);
+}
+
+void DebianManager::ignore(const Utils::FileName &debianDir)
+{
+ int count = m_watches.value(debianDir, 0) - 1;
+ if (count < 0)
+ return;
+ if (count > 0) {
+ m_watches[debianDir] = 0;
+ } else {
+ m_watches.remove(debianDir);
+ m_watcher->removeDirectory(debianDir.toString());
+ }
+}
+
+QString DebianManager::projectVersion(const Utils::FileName &debianDir, QString *error)
+{
+ Utils::FileName path = changelogFilePath(debianDir);
+ QFile changelog(path.toString());
+ if (!changelog.open(QIODevice::ReadOnly)) {
+ if (error)
+ *error = tr("Failed to open debian changelog \"%1\" file for reading.").arg(path.toUserOutput());
+ return QString();
+ }
+
+ const QByteArray &firstLine = changelog.readLine();
+ const int openParenPos = firstLine.indexOf('(');
+ if (openParenPos == -1) {
+ if (error)
+ *error = tr("Debian changelog file '%1' has unexpected format.").arg(path.toUserOutput());
+ return QString();
+ }
+ const int closeParenPos = firstLine.indexOf(')', openParenPos);
+ if (closeParenPos == -1) {
+ if (error)
+ *error = tr("Debian changelog file '%1' has unexpected format.").arg(path.toUserOutput());
+ return QString();
+ }
+ return QString::fromUtf8(firstLine.mid(openParenPos + 1, closeParenPos - openParenPos - 1).data());
+}
+
+bool DebianManager::setProjectVersion(const Utils::FileName &debianDir, const QString &version, QString *error)
+{
+ const Utils::FileName filePath = changelogFilePath(debianDir);
+ Utils::FileReader reader;
+ if (!reader.fetch(filePath.toString(), error))
+ return false;
+ QString content = QString::fromUtf8(reader.data());
+ if (content.contains(QLatin1Char('(') + version + QLatin1Char(')'))) {
+ if (error)
+ *error = tr("Refusing to update changelog file: Already contains version '%1'.").arg(version);
+ return false;
+ }
+
+ int maintainerOffset = content.indexOf(QLatin1String("\n -- "));
+ const int eolOffset = content.indexOf(QLatin1Char('\n'), maintainerOffset + 1);
+ if (maintainerOffset == -1 || eolOffset == -1) {
+ if (error)
+ *error = tr("Cannot update changelog: Invalid format (no maintainer entry found).");
+ return false;
+ }
+
+ ++maintainerOffset;
+ const QDateTime currentDateTime = QDateTime::currentDateTime();
+ QDateTime utcDateTime = QDateTime(currentDateTime);
+ utcDateTime.setTimeSpec(Qt::UTC);
+ int utcOffsetSeconds = currentDateTime.secsTo(utcDateTime);
+ QChar sign;
+ if (utcOffsetSeconds < 0) {
+ utcOffsetSeconds = -utcOffsetSeconds;
+ sign = QLatin1Char('-');
+ } else {
+ sign = QLatin1Char('+');
+ }
+ const int utcOffsetMinutes = (utcOffsetSeconds / 60) % 60;
+ const int utcOffsetHours = utcOffsetSeconds / 3600;
+ const QString dateString = QString::fromLatin1("%1, %2 %3 %4 %5%6%7")
+ .arg(shortDayOfWeekName(currentDateTime))
+ .arg(currentDateTime.toString(QLatin1String("dd")))
+ .arg(shortMonthName(currentDateTime))
+ .arg(currentDateTime.toString(QLatin1String("yyyy hh:mm:ss"))).arg(sign)
+ .arg(utcOffsetHours, 2, 10, QLatin1Char('0'))
+ .arg(utcOffsetMinutes, 2, 10, QLatin1Char('0'));
+ const QString maintainerLine = content.mid(maintainerOffset, eolOffset - maintainerOffset + 1)
+ .replace(QRegExp(QLatin1String("> [^\\n]*\n")),
+ QString::fromLatin1("> %1").arg(dateString));
+ QString versionLine = content.left(content.indexOf(QLatin1Char('\n')))
+ .replace(QRegExp(QLatin1String("\\([a-zA-Z0-9_\\.]+\\)")),
+ QLatin1Char('(') + version + QLatin1Char(')'));
+ const QString newEntry = versionLine + QLatin1String("\n * <Add change description here>\n\n")
+ + maintainerLine + QLatin1String("\n\n");
+ content.prepend(newEntry);
+ Core::FileChangeBlocker update(filePath.toString());
+ Utils::FileSaver saver(filePath.toString());
+ saver.write(content.toUtf8());
+ return saver.finalize(error);
+}
+
+QString DebianManager::packageName(const Utils::FileName &debianDir)
+{
+ return QString::fromUtf8(controlFileFieldValue(controlFilePath(debianDir), NameFieldName, false));
+}
+
+bool DebianManager::setPackageName(const Utils::FileName &debianDir, const QString &newName)
+{
+ const QString oldPackageName = packageName(debianDir);
+
+ Utils::FileName controlPath = controlFilePath(debianDir);
+ if (!setControlFieldValue(controlPath, NameFieldName, newName.toUtf8()))
+ return false;
+ if (!setControlFieldValue(controlPath, "Source", newName.toUtf8()))
+ return false;
+
+ Utils::FileName changelogPath = changelogFilePath(debianDir);
+ Utils::FileReader reader;
+ if (!reader.fetch(changelogPath.toString()))
+ return false;
+ QString changelogContents = QString::fromUtf8(reader.data());
+ QRegExp pattern(QLatin1String("[^\\s]+( \\(\\d\\.\\d\\.\\d\\))"));
+ changelogContents.replace(pattern, newName + QLatin1String("\\1"));
+ Core::FileChangeBlocker updateChangelog(changelogPath.toString());
+ Utils::FileSaver saver(changelogPath.toString());
+ saver.write(changelogContents.toUtf8());
+ if (!saver.finalize())
+ return false;
+
+ Utils::FileName rulesPath = rulesFilePath(debianDir);
+ if (!reader.fetch(rulesPath.toString()))
+ return false;
+
+ QByteArray rulesContents = reader.data();
+ const QString oldString = QLatin1String("debian/") + oldPackageName;
+ const QString newString = QLatin1String("debian/") + newName;
+ rulesContents.replace(oldString.toUtf8(), newString.toUtf8());
+
+ Core::FileChangeBlocker updateRules(rulesPath.toString());
+ Utils::FileSaver rulesSaver(rulesPath.toString());
+ rulesSaver.write(rulesContents);
+ return rulesSaver.finalize();
+}
+
+QString DebianManager::shortDescription(const Utils::FileName &debianDir)
+{
+ return QString::fromUtf8(controlFileFieldValue(controlFilePath(debianDir), ShortDescriptionFieldName, false));
+}
+
+bool DebianManager::setShortDescription(const Utils::FileName &debianDir, const QString &description)
+{
+ return setControlFieldValue(controlFilePath(debianDir), ShortDescriptionFieldName, description.toUtf8());
+}
+
+QString DebianManager::packageManagerName(const Utils::FileName &debianDir, Core::Id deviceType)
+{
+ return QString::fromUtf8(controlFileFieldValue(controlFilePath(debianDir),
+ packageManagerNameFieldName(deviceType), false));
+}
+
+bool DebianManager::setPackageManagerName(const Utils::FileName &debianDir, Core::Id deviceType, const QString &name)
+{
+ return setControlFieldValue(controlFilePath(debianDir), packageManagerNameFieldName(deviceType),
+ name.toUtf8());
+}
+
+QIcon DebianManager::packageManagerIcon(const Utils::FileName &debianDir, QString *error)
+{
+ const QByteArray &base64Icon = controlFileFieldValue(debianDir, IconFieldName, true);
+ if (base64Icon.isEmpty())
+ return QIcon();
+ QPixmap pixmap;
+ if (!pixmap.loadFromData(QByteArray::fromBase64(base64Icon))) {
+ if (error)
+ *error = tr("Invalid icon data in Debian control file.");
+ return QIcon();
+ }
+ return QIcon(pixmap);
+}
+
+bool DebianManager::setPackageManagerIcon(const Utils::FileName &debianDir, Core::Id deviceType,
+ const Utils::FileName &iconPath, QString *error)
+{
+ const Utils::FileName filePath = controlFilePath(debianDir);
+ Utils::FileReader reader;
+ if (!reader.fetch(filePath.toString(), error))
+ return false;
+ const QPixmap pixmap(iconPath.toString());
+ if (pixmap.isNull()) {
+ if (error)
+ *error = tr("Could not read image file '%1'.").arg(iconPath.toUserOutput());
+ return false;
+ }
+
+ QByteArray iconAsBase64;
+ QBuffer buffer(&iconAsBase64);
+ buffer.open(QIODevice::WriteOnly);
+ if (!pixmap.scaled(MaddeDevice::packageManagerIconSize(deviceType))
+ .save(&buffer, iconPath.toFileInfo().suffix().toAscii())) {
+ if (error)
+ *error = tr("Could not export image file '%1'.").arg(iconPath.toUserOutput());
+ return false;
+ }
+ buffer.close();
+ iconAsBase64 = iconAsBase64.toBase64();
+ QByteArray contents = reader.data();
+ const QByteArray iconFieldNameWithColon = IconFieldName + ':';
+ const int iconFieldPos = contents.startsWith(iconFieldNameWithColon)
+ ? 0 : contents.indexOf('\n' + iconFieldNameWithColon);
+ if (iconFieldPos == -1) {
+ if (!contents.endsWith('\n'))
+ contents += '\n';
+ contents.append(iconFieldNameWithColon).append(' ').append(iconAsBase64)
+ .append('\n');
+ } else {
+ const int oldIconStartPos = (iconFieldPos != 0) + iconFieldPos
+ + iconFieldNameWithColon.length();
+ int nextEolPos = contents.indexOf('\n', oldIconStartPos);
+ while (nextEolPos != -1 && nextEolPos != contents.length() - 1
+ && contents.at(nextEolPos + 1) != '\n'
+ && (contents.at(nextEolPos + 1) == '#'
+ || std::isspace(contents.at(nextEolPos + 1))))
+ nextEolPos = contents.indexOf('\n', nextEolPos + 1);
+ if (nextEolPos == -1)
+ nextEolPos = contents.length();
+ contents.replace(oldIconStartPos, nextEolPos - oldIconStartPos,
+ ' ' + iconAsBase64);
+ }
+ Core::FileChangeBlocker update(filePath.toString());
+ Utils::FileSaver saver(filePath.toString());
+ saver.write(contents);
+ return saver.finalize(error);
+}
+
+bool DebianManager::hasPackageManagerIcon(const Utils::FileName &debianDir)
+{
+ return !packageManagerIcon(debianDir).isNull();
+}
+
+Utils::FileName DebianManager::packageFileName(const Utils::FileName &debianDir)
+{
+ return Utils::FileName::fromString(packageName(debianDir)
+ + QLatin1Char('_') + projectVersion(debianDir)
+ + QLatin1String("_armel.deb"));
+}
+
+DebianManager::ActionStatus DebianManager::createTemplate(Qt4ProjectManager::Qt4BuildConfiguration *bc,
+ const Utils::FileName &debianDir)
+{
+ if (debianDir.toFileInfo().exists())
+ return NoActionRequired;
+
+ Utils::FileName location = debianDir.parentDir();
+ if (!location.toFileInfo().isDir()) {
+ if (!QDir::home().mkpath(location.toString())) {
+ raiseError(tr("Failed to create directory \"%1\".")
+ .arg(location.toUserOutput()));
+ return ActionFailed;
+ }
+ }
+
+ QProcess dh_makeProc;
+ QString error;
+ AbstractMaemoPackageCreationStep::preparePackagingProcess(&dh_makeProc, bc, location.toString());
+ const QString packageName = defaultPackageFileName(bc->target()->project());
+
+ const QStringList dh_makeArgs =
+ QStringList() << QLatin1String("dh_make")
+ << QLatin1String("-s") << QLatin1String("-n") << QLatin1String("-p")
+ << (packageName + QLatin1Char('_')
+ + AbstractMaemoPackageCreationStep::DefaultVersionNumber);
+
+ QtSupport::BaseQtVersion *lqt = QtSupport::QtProfileInformation::qtVersion(bc->target()->profile());
+ if (!lqt) {
+ raiseError(tr("Unable to create Debian templates: No Qt version set."));
+ return ActionFailed;
+ }
+
+ if (!MaemoGlobal::callMad(dh_makeProc, dh_makeArgs, lqt->qmakeCommand().toString(), true)
+ || !dh_makeProc.waitForStarted()) {
+ raiseError(tr("Unable to create Debian templates: dh_make failed (%1).")
+ .arg(dh_makeProc.errorString()));
+ return ActionFailed;
+ }
+
+ dh_makeProc.write("\n"); // Needs user input.
+ dh_makeProc.waitForFinished(-1);
+ if (dh_makeProc.error() != QProcess::UnknownError
+ || dh_makeProc.exitCode() != 0) {
+ raiseError(tr("Unable to create debian templates: dh_make failed (%1).")
+ .arg(dh_makeProc.errorString()));
+ return ActionFailed;
+ }
+
+ 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);
+ return ActionFailed;
+ }
+
+ QDir debian(debianDir.toString());
+ const QStringList &files = debian.entryList(QDir::Files);
+ foreach (const QString &fileName, files) {
+ if (fileName.endsWith(QLatin1String(".ex"), Qt::CaseInsensitive)
+ || fileName.compare(QLatin1String("README.debian"), Qt::CaseInsensitive) == 0
+ || fileName.compare(QLatin1String("dirs"), Qt::CaseInsensitive) == 0
+ || fileName.compare(QLatin1String("docs"), Qt::CaseInsensitive) == 0) {
+ debian.remove(fileName);
+ }
+ }
+
+ setPackageName(debianDir, packageName);
+
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(bc->target()->profile());
+
+ const QByteArray sec = section(deviceType);
+ const QByteArray nameField = packageManagerNameFieldName(deviceType);
+ QList<QPair<QByteArray, QByteArray> > fields
+ = additionalFields(deviceType, bc->target()->project()->displayName());
+
+ return adaptRulesFile(rulesFilePath(debianDir))
+ && adaptControlFile(controlFilePath(debianDir), bc, sec, nameField, fields)
+ ? ActionSuccessful : ActionFailed;
+}
+
+QStringList DebianManager::debianFiles(const Utils::FileName &debianDir)
+{
+ return QDir(debianDir.toString()).entryList(QDir::Files, QDir::Name | QDir::IgnoreCase);
+}
+
+Utils::FileName DebianManager::debianDirectory(ProjectExplorer::Target *target)
+{
+ Utils::FileName path = Utils::FileName::fromString(target->project()->projectDirectory());
+ path.appendPath(PackagingDirName);
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target->profile());
+ if (deviceType == Core::Id(HarmattanOsType))
+ path.appendPath(QLatin1String("debian_harmattan"));
+ else if (deviceType == Core::Id(Maemo5OsType))
+ path.appendPath(QLatin1String("debian_fremantle"));
+ else
+ path.clear();
+ return path;
+}
+
+void DebianManager::directoryWasChanged(const QString &path)
+{
+ Utils::FileName fn = Utils::FileName::fromString(path);
+ QTC_ASSERT(m_watches.contains(fn), return);
+ emit debianDirectoryChanged(fn);
+}
+
+void DebianManager::controlWasChanged()
+{
+ WatchableFile *file = qobject_cast<WatchableFile *>(sender());
+ if (!file)
+ return;
+ emit controlChanged(Utils::FileName::fromString(file->fileName()));
+}
+
+void DebianManager::changelogWasChanged()
+{
+ WatchableFile *file = qobject_cast<WatchableFile *>(sender());
+ if (!file)
+ return;
+ emit changelogChanged(Utils::FileName::fromString(file->fileName()));
+}
+
+Utils::FileName DebianManager::changelogFilePath(const Utils::FileName &debianDir)
+{
+ Utils::FileName result = debianDir;
+ return result.appendPath("changelog");
+}
+
+Utils::FileName DebianManager::controlFilePath(const Utils::FileName &debianDir)
+{
+ Utils::FileName result = debianDir;
+ return result.appendPath("control");
+}
+
+Utils::FileName DebianManager::rulesFilePath(const Utils::FileName &debianDir)
+{
+ Utils::FileName result = debianDir;
+ return result.appendPath("rules");
+}
+
+} // namespace Internal
+} // namespace Madde
diff --git a/src/plugins/madde/debianmanager.h b/src/plugins/madde/debianmanager.h
new file mode 100644
index 0000000000..e84f62626a
--- /dev/null
+++ b/src/plugins/madde/debianmanager.h
@@ -0,0 +1,114 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef DEBIANMANAGER_H
+#define DEBIANMANAGER_H
+
+#include <coreplugin/id.h>
+#include <utils/fileutils.h>
+
+#include <QObject>
+#include <QHash>
+
+namespace Utils { class FileSystemWatcher; }
+namespace ProjectExplorer { class Target; }
+namespace Qt4ProjectManager { class Qt4BuildConfiguration; }
+
+namespace Madde {
+namespace Internal {
+class MaddePlugin;
+
+class DebianManager : public QObject
+{
+ Q_OBJECT
+public:
+ ~DebianManager();
+
+ static DebianManager *instance();
+
+ // ref counted:
+ void monitor(const Utils::FileName &debianDir);
+ bool isMonitoring(const Utils::FileName &debianDir);
+ void ignore(const Utils::FileName &debianDir);
+
+ static QString projectVersion(const Utils::FileName &debianDir, QString *error = 0);
+ static bool setProjectVersion(const Utils::FileName &debianDir, const QString &version, QString *error = 0);
+ static QString packageName(const Utils::FileName &debianDir);
+ static bool setPackageName(const Utils::FileName &debianDir, const QString &packageName);
+ static QString shortDescription(const Utils::FileName &debianDir);
+ static bool setShortDescription(const Utils::FileName &debianDir, const QString &description);
+ static QString packageManagerName(const Utils::FileName &debianDir, Core::Id deviceType);
+ static bool setPackageManagerName(const Utils::FileName &debianDir, Core::Id deviceType, const QString &name);
+ static QIcon packageManagerIcon(const Utils::FileName &debianDir, QString *error = 0);
+ static bool setPackageManagerIcon(const Utils::FileName &debianDir, Core::Id deviceType,
+ const Utils::FileName &iconPath, QString *error = 0);
+ static bool hasPackageManagerIcon(const Utils::FileName &debianDir);
+
+ static Utils::FileName packageFileName(const Utils::FileName &debianDir);
+
+ enum ActionStatus { NoActionRequired, ActionSuccessful, ActionFailed };
+ // will not start to monitor this new dir!
+ static ActionStatus createTemplate(Qt4ProjectManager::Qt4BuildConfiguration *bc,
+ const Utils::FileName &debianDir);
+
+ static QStringList debianFiles(const Utils::FileName &debianDir);
+
+ static Utils::FileName debianDirectory(ProjectExplorer::Target *target);
+
+signals:
+ void debianDirectoryChanged(const Utils::FileName &dir);
+ void changelogChanged(const Utils::FileName &dir);
+ void controlChanged(const Utils::FileName &dir);
+
+private slots:
+ void directoryWasChanged(const QString &path);
+ void controlWasChanged();
+ void changelogWasChanged();
+
+private:
+ explicit DebianManager(QObject *parent = 0);
+
+ static Utils::FileName changelogFilePath(const Utils::FileName &debianDir);
+ static Utils::FileName controlFilePath(const Utils::FileName &debianDir);
+ static Utils::FileName rulesFilePath(const Utils::FileName &debianDir);
+
+ Utils::FileSystemWatcher *m_watcher;
+ QHash<Utils::FileName, int> m_watches;
+ static DebianManager *m_instance;
+
+ friend class MaddePlugin;
+};
+
+} // namespace Internal
+} // namespace Madde
+
+#endif // DEBIANMANAGER_H
diff --git a/src/plugins/madde/madde.pro b/src/plugins/madde/madde.pro
index 7e1d9cd8b5..f545b98ac9 100644
--- a/src/plugins/madde/madde.pro
+++ b/src/plugins/madde/madde.pro
@@ -8,12 +8,12 @@ include(madde_dependencies.pri)
HEADERS += \
madde_exports.h \
maddeplugin.h \
+ debianmanager.h \
maemoconstants.h \
maemorunconfigurationwidget.h \
maemoruncontrol.h \
maemorunfactories.h \
maemosettingspages.h \
- maemotoolchain.h \
maemopackagecreationstep.h \
maemopackagecreationfactory.h \
maemopackagecreationwidget.h \
@@ -37,8 +37,6 @@ HEADERS += \
maemoqemuruntimeparser.h \
maemoqemusettingswidget.h \
maemoqemusettings.h \
- qt4maemotargetfactory.h \
- qt4maemotarget.h \
qt4maemodeployconfiguration.h \
maemodeviceconfigwizard.h \
maemodeployconfigurationwidget.h \
@@ -53,15 +51,16 @@ HEADERS += \
maemodeploybymountsteps.h \
maddedevicetester.h \
maddedeviceconfigurationfactory.h \
- maddedevice.h
+ maddedevice.h \
+ rpmmanager.h
SOURCES += \
maddeplugin.cpp \
+ debianmanager.cpp \
maemorunconfigurationwidget.cpp \
maemoruncontrol.cpp \
maemorunfactories.cpp \
maemosettingspages.cpp \
- maemotoolchain.cpp \
maemopackagecreationstep.cpp \
maemopackagecreationfactory.cpp \
maemopackagecreationwidget.cpp \
@@ -84,8 +83,6 @@ SOURCES += \
maemoqemuruntimeparser.cpp \
maemoqemusettingswidget.cpp \
maemoqemusettings.cpp \
- qt4maemotargetfactory.cpp \
- qt4maemotarget.cpp \
qt4maemodeployconfiguration.cpp \
maemodeviceconfigwizard.cpp \
maemodeployconfigurationwidget.cpp \
@@ -100,7 +97,8 @@ SOURCES += \
maemodeploybymountsteps.cpp \
maddedevicetester.cpp \
maemorunconfiguration.cpp \
- maddedevice.cpp
+ maddedevice.cpp \
+ rpmmanager.cpp
FORMS += \
maemopackagecreationwidget.ui \
diff --git a/src/plugins/madde/madde.qbs b/src/plugins/madde/madde.qbs
index 6d69c3e7de..4bf5ad8c0d 100644
--- a/src/plugins/madde/madde.qbs
+++ b/src/plugins/madde/madde.qbs
@@ -116,17 +116,14 @@ QtcPlugin {
"maemosettingspages.h",
"maemosshrunner.cpp",
"maemosshrunner.h",
- "maemotoolchain.cpp",
- "maemotoolchain.h",
"qt-maemo.qrc",
"qt4maemodeployconfiguration.cpp",
"qt4maemodeployconfiguration.h",
- "qt4maemotarget.cpp",
- "qt4maemotarget.h",
- "qt4maemotargetfactory.cpp",
- "qt4maemotargetfactory.h",
"maddedevice.cpp",
- "maddedevice.h"
+ "maddedevice.h",
+ "debianmanager.h",
+ "debianmanager.cpp",
+ "rpmmanager.h",
+ "rpmmanager.cpp"
]
}
-
diff --git a/src/plugins/madde/maddedevice.cpp b/src/plugins/madde/maddedevice.cpp
index 3bc04cf924..80e4a07468 100644
--- a/src/plugins/madde/maddedevice.cpp
+++ b/src/plugins/madde/maddedevice.cpp
@@ -129,5 +129,34 @@ QString MaddeDevice::maddeDisplayType(Core::Id type)
return tr("Other MeeGo OS");
}
+bool MaddeDevice::allowsRemoteMounts(Core::Id type)
+{
+ return type == Core::Id(Maemo5OsType);
+}
+
+bool MaddeDevice::allowsPackagingDisabling(Core::Id type)
+{
+ return type == Core::Id(Maemo5OsType);
+}
+
+bool MaddeDevice::allowsQmlDebugging(Core::Id type)
+{
+ return type == Core::Id(HarmattanOsType);
+}
+
+bool MaddeDevice::isDebianBased(Core::Id type)
+{
+ return type != Core::Id(MeeGoOsType);
+}
+
+QSize MaddeDevice::packageManagerIconSize(Core::Id type)
+{
+ if (type == Core::Id(Maemo5OsType))
+ return QSize(48, 48);
+ if (type == Core::Id(HarmattanOsType))
+ return QSize(64, 64);
+ return QSize();
+}
+
} // namespace Internal
} // namespace Madde
diff --git a/src/plugins/madde/maddedevice.h b/src/plugins/madde/maddedevice.h
index c508cc641d..eb8a418a49 100644
--- a/src/plugins/madde/maddedevice.h
+++ b/src/plugins/madde/maddedevice.h
@@ -57,6 +57,13 @@ public:
ProjectExplorer::IDevice::Ptr clone() const;
static QString maddeDisplayType(Core::Id type);
+ static bool allowsRemoteMounts(Core::Id type);
+ static bool allowsPackagingDisabling(Core::Id type);
+ static bool allowsQmlDebugging(Core::Id type);
+
+ static bool isDebianBased(Core::Id type);
+ static QSize packageManagerIconSize(Core::Id type);
+
private:
MaddeDevice();
MaddeDevice(const QString &name, Core::Id type, MachineType machineType,
diff --git a/src/plugins/madde/maddeplugin.cpp b/src/plugins/madde/maddeplugin.cpp
index 6e5713486e..e1505f6f4e 100644
--- a/src/plugins/madde/maddeplugin.cpp
+++ b/src/plugins/madde/maddeplugin.cpp
@@ -32,6 +32,7 @@
#include "maddeplugin.h"
+#include "debianmanager.h"
#include "maddedeviceconfigurationfactory.h"
#include "maemoconstants.h"
#include "maemodeploystepfactory.h"
@@ -40,10 +41,9 @@
#include "maemoqemumanager.h"
#include "maemorunfactories.h"
#include "maemosettingspages.h"
-#include "maemotoolchain.h"
#include "qt4maemodeployconfiguration.h"
+#include "rpmmanager.h"
#include "maemoqtversionfactory.h"
-#include "qt4maemotargetfactory.h"
#include <QtPlugin>
@@ -67,16 +67,17 @@ bool MaddePlugin::initialize(const QStringList &arguments, QString *error_messag
addAutoReleasedObject(new MaemoRunControlFactory);
addAutoReleasedObject(new MaemoRunConfigurationFactory);
- addAutoReleasedObject(new MaemoToolChainFactory);
addAutoReleasedObject(new Qt4MaemoDeployConfigurationFactory);
addAutoReleasedObject(new MaemoPackageCreationFactory);
addAutoReleasedObject(new MaemoDeployStepFactory);
addAutoReleasedObject(new MaemoQemuSettingsPage);
addAutoReleasedObject(new MaemoPublishingWizardFactoryFremantleFree);
- addAutoReleasedObject(new Qt4MaemoTargetFactory);
addAutoReleasedObject(new MaemoQtVersionFactory);
addAutoReleasedObject(new MaddeDeviceConfigurationFactory);
+ new DebianManager(this);
+ new RpmManager(this);
+
return true;
}
diff --git a/src/plugins/madde/maddeuploadandinstallpackagesteps.cpp b/src/plugins/madde/maddeuploadandinstallpackagesteps.cpp
index 348fb58f31..3832fd4efd 100644
--- a/src/plugins/madde/maddeuploadandinstallpackagesteps.cpp
+++ b/src/plugins/madde/maddeuploadandinstallpackagesteps.cpp
@@ -36,10 +36,11 @@
#include "maemopackageinstaller.h"
#include "maemoqemumanager.h"
#include "qt4maemodeployconfiguration.h"
-#include "qt4maemotarget.h"
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtprofileinformation.h>
#include <remotelinux/abstractuploadandinstallpackageservice.h>
#include <remotelinux/linuxdeviceconfiguration.h>
#include <ssh/sshconnection.h>
@@ -72,8 +73,8 @@ protected:
}
MaemoQemuRuntime rt;
- const int qtId = qt4BuildConfiguration() && qt4BuildConfiguration()->qtVersion()
- ? qt4BuildConfiguration()->qtVersion()->uniqueId() : -1;
+ const int qtId = qt4BuildConfiguration()
+ ? QtSupport::QtProfileInformation::qtVersionId(qt4BuildConfiguration()->target()->profile()) : -1;
if (MaemoQemuManager::instance().runtimeForQtVersion(qtId, &rt)) {
MaemoQemuManager::instance().startRuntime();
emit errorMessage(tr("Cannot deploy: Qemu was not running. "
@@ -164,7 +165,8 @@ MaemoUploadAndInstallPackageStep::MaemoUploadAndInstallPackageStep(ProjectExplor
void MaemoUploadAndInstallPackageStep::ctor()
{
setDefaultDisplayName(displayName());
- if (qobject_cast<Qt4HarmattanTarget *>(target()))
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target()->profile());
+ if (deviceType == Core::Id(HarmattanOsType))
m_deployService = new HarmattanUploadAndInstallPackageAction(this);
else
m_deployService = new MaemoUploadAndInstallPackageAction(this);
diff --git a/src/plugins/madde/maemoconstants.h b/src/plugins/madde/maemoconstants.h
index ea27711b13..32a7edc78e 100644
--- a/src/plugins/madde/maemoconstants.h
+++ b/src/plugins/madde/maemoconstants.h
@@ -49,7 +49,6 @@ const char MeeGoOsType[] = "MeeGoOsType";
#define EXEC_SUFFIX ""
#endif
-static const char MAEMO_RC_ID[] = PREFIX;
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 35469614ad..b41cd9e5fd 100644
--- a/src/plugins/madde/maemodeploybymountsteps.cpp
+++ b/src/plugins/madde/maemodeploybymountsteps.cpp
@@ -43,6 +43,7 @@
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtprofileinformation.h>
#include <remotelinux/abstractremotelinuxdeployservice.h>
#include <remotelinux/deployablefile.h>
#include <remotelinux/deploymentinfo.h>
@@ -168,8 +169,8 @@ void AbstractMaemoDeployByMountService::doDeviceSetup()
}
MaemoQemuRuntime rt;
- const int qtId = qt4BuildConfiguration() && qt4BuildConfiguration()->qtVersion()
- ? qt4BuildConfiguration()->qtVersion()->uniqueId() : -1;
+ const int qtId = qt4BuildConfiguration()
+ ? QtSupport::QtProfileInformation::qtVersionId(qt4BuildConfiguration()->target()->profile()) : -1;
if (MaemoQemuManager::instance().runtimeForQtVersion(qtId, &rt)) {
MaemoQemuManager::instance().startRuntime();
emit errorMessage(tr("Cannot deploy: Qemu was not running. "
diff --git a/src/plugins/madde/maemodeployconfigurationwidget.cpp b/src/plugins/madde/maemodeployconfigurationwidget.cpp
index fc73329d1a..09564a2c42 100644
--- a/src/plugins/madde/maemodeployconfigurationwidget.cpp
+++ b/src/plugins/madde/maemodeployconfigurationwidget.cpp
@@ -33,9 +33,11 @@
#include "ui_maemodeployconfigurationwidget.h"
#include "maemoglobal.h"
+#include "maemoconstants.h"
#include "qt4maemodeployconfiguration.h"
-#include "qt4maemotarget.h"
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4nodes.h>
#include <remotelinux/deployablefile.h>
#include <remotelinux/deployablefilesperprofile.h>
@@ -129,13 +131,14 @@ void MaemoDeployConfigurationWidget::addDesktopFile()
DeployableFile d;
d.remoteDir = QLatin1String("/usr/share/applications");
- if (qobject_cast<Qt4Maemo5Target *>(deployConfiguration()->target()))
+ Core::Id deviceType
+ = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(deployConfiguration()->target()->profile());
+ if (deviceType == Core::Id(Maemo5OsType))
d.remoteDir += QLatin1String("/hildon");
d.localFilePath = desktopFilePath;
- const AbstractQt4MaemoTarget * const target
- = qobject_cast<AbstractQt4MaemoTarget *>(deployConfiguration()->target());
- if (!target->deploymentSettingsAssistant()->addDeployableToProFile(proFileInfo,
- QLatin1String("desktopfile"), d)) {
+ 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 {
@@ -171,10 +174,9 @@ void MaemoDeployConfigurationWidget::addIcon()
return;
}
- const AbstractQt4MaemoTarget * const target
- = qobject_cast<AbstractQt4MaemoTarget *>(deployConfiguration()->target());
- if (!target->deploymentSettingsAssistant()->addDeployableToProFile(proFileInfo,
- QLatin1String("icon"), DeployableFile(newFilePath, remoteIconDir()))) {
+ 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 {
diff --git a/src/plugins/madde/maemodeploymentmounter.cpp b/src/plugins/madde/maemodeploymentmounter.cpp
index 139bac76bc..8a3263aaf1 100644
--- a/src/plugins/madde/maemodeploymentmounter.cpp
+++ b/src/plugins/madde/maemodeploymentmounter.cpp
@@ -35,7 +35,9 @@
#include "maemoglobal.h"
#include "maemoremotemounter.h"
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
+#include <qtsupport/qtprofileinformation.h>
#include <remotelinux/linuxdeviceconfiguration.h>
#include <remotelinux/remotelinuxusedportsgatherer.h>
#include <utils/qtcassert.h>
@@ -173,7 +175,7 @@ void MaemoDeploymentMounter::handlePortListReady()
return;
setState(Mounting);
- m_freePorts = MaemoGlobal::freePorts(m_devConf, m_buildConfig->qtVersion());
+ m_freePorts = MaemoGlobal::freePorts(m_devConf, QtSupport::QtProfileInformation::qtVersion(m_buildConfig->target()->profile()));
m_mounter->mount(&m_freePorts, m_portsGatherer);
}
diff --git a/src/plugins/madde/maemodeploystepfactory.cpp b/src/plugins/madde/maemodeploystepfactory.cpp
index 420532b5bb..6b068ece5a 100644
--- a/src/plugins/madde/maemodeploystepfactory.cpp
+++ b/src/plugins/madde/maemodeploystepfactory.cpp
@@ -32,16 +32,18 @@
#include "maemodeploystepfactory.h"
+#include "maemoconstants.h"
#include "maddeuploadandinstallpackagesteps.h"
#include "maemodeploybymountsteps.h"
#include "maemoinstalltosysrootstep.h"
-#include "qt4maemotarget.h"
#include "qt4maemodeployconfiguration.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
#include <remotelinux/genericdirectuploadstep.h>
#include <remotelinux/remotelinuxcheckforfreediskspacestep.h>
#include <remotelinux/uploadandinstalltarpackagestep.h>
@@ -68,23 +70,27 @@ QList<Core::Id> MaemoDeployStepFactory::availableCreationIds(BuildStepList *pare
if (!qobject_cast<Qt4MaemoDeployConfiguration *>(parent->parent()))
return ids;
- AbstractQt4MaemoTarget * const maemoTarget
- = qobject_cast<AbstractQt4MaemoTarget *>(parent->target());
- if (maemoTarget)
- ids << MaemoMakeInstallToSysrootStep::Id;
- if (qobject_cast<AbstractDebBasedQt4MaemoTarget *>(parent->target())) {
- ids << MaemoInstallDebianPackageToSysrootStep::Id;
- ids << MaemoUploadAndInstallPackageStep::stepId();
- } else if (qobject_cast<AbstractRpmBasedQt4MaemoTarget *>(parent->target())) {
- ids << MaemoInstallRpmPackageToSysrootStep::Id;
- ids << MeegoUploadAndInstallPackageStep::stepId();
+ QString platform;
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(parent->target()->profile());
+ if (version)
+ platform = version->platformName();
+
+ if (platform == QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM) {
+ ids << Core::Id(MaemoMakeInstallToSysrootStep::Id)
+ << Core::Id(MaemoInstallDebianPackageToSysrootStep::Id)
+ << Core::Id(MaemoUploadAndInstallPackageStep::stepId())
+ << Core::Id(MaemoInstallPackageViaMountStep::stepId())
+ << Core::Id(MaemoCopyFilesViaMountStep::stepId());
+ } else if (platform == QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM) {
+ ids << Core::Id(MaemoMakeInstallToSysrootStep::Id)
+ << Core::Id(MaemoInstallDebianPackageToSysrootStep::Id)
+ << Core::Id(MaemoUploadAndInstallPackageStep::stepId())
+ << Core::Id(GenericDirectUploadStep::stepId());
+ } else if (platform == QtSupport::Constants::MEEGO_PLATFORM) {
+ ids << Core::Id(MaemoMakeInstallToSysrootStep::Id)
+ << Core::Id(MaemoInstallRpmPackageToSysrootStep::Id)
+ << Core::Id(MeegoUploadAndInstallPackageStep::stepId());
}
- if (qobject_cast<Qt4HarmattanTarget *>(parent->target()))
- ids << GenericDirectUploadStep::stepId();
- if (qobject_cast<Qt4Maemo5Target *>(parent->target()))
- ids << MaemoInstallPackageViaMountStep::stepId()
- << MaemoCopyFilesViaMountStep::stepId();
- ids << RemoteLinuxCheckForFreeDiskSpaceStep::stepId();
return ids;
}
@@ -121,7 +127,8 @@ bool MaemoDeployStepFactory::canCreate(BuildStepList *parent, const Core::Id id)
BuildStep *MaemoDeployStepFactory::create(BuildStepList *parent, const Core::Id id)
{
- const Target * const t = parent->target();
+ Core::Id deviceType
+ = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->target()->profile());
if (id == MaemoInstallDebianPackageToSysrootStep::Id) {
return new MaemoInstallDebianPackageToSysrootStep(parent);
@@ -132,15 +139,15 @@ BuildStep *MaemoDeployStepFactory::create(BuildStepList *parent, const Core::Id
} else if (id == MaemoMakeInstallToSysrootStep::Id) {
return new MaemoMakeInstallToSysrootStep(parent);
} else if (id == MaemoInstallPackageViaMountStep::stepId()
- || (id == Core::Id(OldMaemoDeployStepId) && qobject_cast< const Qt4Maemo5Target *>(t))) {
+ || (id == Core::Id(OldMaemoDeployStepId) && deviceType == Core::Id(Maemo5OsType))) {
return new MaemoInstallPackageViaMountStep(parent);
} else if (id == MaemoCopyFilesViaMountStep::stepId()) {
return new MaemoCopyFilesViaMountStep(parent);
} else if (id == MaemoUploadAndInstallPackageStep::stepId()
- || (id == Core::Id(OldMaemoDeployStepId) && (qobject_cast<const Qt4HarmattanTarget *>(t)))) {
+ || (id == Core::Id(OldMaemoDeployStepId) && deviceType == Core::Id(HarmattanOsType))) {
return new MaemoUploadAndInstallPackageStep(parent);
} else if (id == MeegoUploadAndInstallPackageStep::stepId()
- || (id == Core::Id(OldMaemoDeployStepId) && (qobject_cast<const Qt4MeegoTarget *>(t)))) {
+ || (id == Core::Id(OldMaemoDeployStepId) && deviceType == Core::Id(MeeGoOsType))) {
return new MeegoUploadAndInstallPackageStep(parent);
} else if (id == GenericDirectUploadStep::stepId()) {
return new GenericDirectUploadStep(parent, id);
diff --git a/src/plugins/madde/maemoglobal.cpp b/src/plugins/madde/maemoglobal.cpp
index ae1f73f34f..c5f281f801 100644
--- a/src/plugins/madde/maemoglobal.cpp
+++ b/src/plugins/madde/maemoglobal.cpp
@@ -33,8 +33,9 @@
#include "maemoconstants.h"
#include "maemoqemumanager.h"
-#include "qt4maemotarget.h"
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qtsupport/baseqtversion.h>
#include <remotelinux/linuxdeviceconfiguration.h>
@@ -55,27 +56,24 @@ namespace Madde {
namespace Internal {
namespace {
static const QLatin1String binQmake("/bin/qmake" EXEC_SUFFIX);
-}
-
-bool MaemoGlobal::isMaemoTargetId(const Core::Id id)
-{
- return isFremantleTargetId(id) || isHarmattanTargetId(id)
- || isMeegoTargetId(id);
-}
+} // namespace
-bool MaemoGlobal::isFremantleTargetId(const Core::Id id)
+bool MaemoGlobal::hasMaemoDevice(const ProjectExplorer::Profile *p)
{
- return id == Core::Id(MAEMO5_DEVICE_TARGET_ID);
-}
+ ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceProfileInformation::device(p);
+ if (dev.isNull())
+ return false;
-bool MaemoGlobal::isHarmattanTargetId(const Core::Id id)
-{
- return id == Core::Id(HARMATTAN_DEVICE_TARGET_ID);
+ const Core::Id type = dev->type();
+ return type == Core::Id(Maemo5OsType) || type == Core::Id(HarmattanOsType)
+ || type == Core::Id(MeeGoOsType);
}
-bool MaemoGlobal::isMeegoTargetId(const Core::Id id)
+bool MaemoGlobal::supportsMaemoDevice(const ProjectExplorer::Profile *p)
{
- return id == Core::Id(MEEGO_DEVICE_TARGET_ID);
+ const Core::Id type = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(p);
+ return type == Core::Id(Maemo5OsType) || type == Core::Id(HarmattanOsType)
+ || type == Core::Id(MeeGoOsType);
}
bool MaemoGlobal::isValidMaemo5QtVersion(const QString &qmakePath)
@@ -130,7 +128,8 @@ QString MaemoGlobal::devrootshPath()
int MaemoGlobal::applicationIconSize(const ProjectExplorer::Target *target)
{
- return qobject_cast<const Qt4HarmattanTarget *>(target) ? 80 : 64;
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target->profile());
+ return deviceType == Core::Id(HarmattanOsType) ? 80 : 64;
}
QString MaemoGlobal::remoteSudo(Core::Id deviceType, const QString &uname)
diff --git a/src/plugins/madde/maemoglobal.h b/src/plugins/madde/maemoglobal.h
index 2e519b54f6..c83dc2881f 100644
--- a/src/plugins/madde/maemoglobal.h
+++ b/src/plugins/madde/maemoglobal.h
@@ -48,7 +48,10 @@ QT_END_NAMESPACE
namespace QtSupport { class BaseQtVersion; }
namespace RemoteLinux { class LinuxDeviceConfiguration; }
-namespace ProjectExplorer { class Target; }
+namespace ProjectExplorer {
+class Profile;
+class Target;
+} // namespace ProjectExplorer
namespace Madde {
namespace Internal {
@@ -84,10 +87,8 @@ class MaemoGlobal
public:
enum PackagingSystem { Dpkg, Rpm, Tar };
- static bool isMaemoTargetId(const Core::Id id);
- static bool isFremantleTargetId(const Core::Id id);
- static bool isHarmattanTargetId(const Core::Id id);
- static bool isMeegoTargetId(const Core::Id id);
+ static bool hasMaemoDevice(const ProjectExplorer::Profile *p);
+ static bool supportsMaemoDevice(const ProjectExplorer::Profile *p);
static bool isValidMaemo5QtVersion(const QString &qmakePath);
static bool isValidHarmattanQtVersion(const QString &qmakePath);
static bool isValidMeegoQtVersion(const QString &qmakePath);
diff --git a/src/plugins/madde/maemoinstalltosysrootstep.cpp b/src/plugins/madde/maemoinstalltosysrootstep.cpp
index 381e057196..45cc4b5d4b 100644
--- a/src/plugins/madde/maemoinstalltosysrootstep.cpp
+++ b/src/plugins/madde/maemoinstalltosysrootstep.cpp
@@ -33,15 +33,15 @@
#include "maemoinstalltosysrootstep.h"
#include "maemoglobal.h"
+#include "maemoconstants.h"
#include "maemopackagecreationstep.h"
#include "maemoqtversion.h"
-#include "qt4maemotarget.h"
#include <utils/fileutils.h>
-
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
-#include <qt4projectmanager/qt4target.h>
#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtprofileinformation.h>
#include <remotelinux/deploymentinfo.h>
#include <remotelinux/remotelinuxdeployconfiguration.h>
@@ -160,14 +160,6 @@ RemoteLinuxDeployConfiguration *AbstractMaemoInstallPackageToSysrootStep::deploy
bool AbstractMaemoInstallPackageToSysrootStep::init()
{
- const Qt4BuildConfiguration * const bc
- = qobject_cast<Qt4BaseTarget *>(target())->activeQt4BuildConfiguration();
- if (!bc) {
- addOutput(tr("Cannot install to sysroot without build configuration."),
- ErrorMessageOutput);
- return false;
- }
-
const AbstractMaemoPackageCreationStep * const pStep
= deployConfiguration()->earlierBuildStep<AbstractMaemoPackageCreationStep>(this);
if (!pStep) {
@@ -176,13 +168,14 @@ bool AbstractMaemoInstallPackageToSysrootStep::init()
return false;
}
- if (!bc->qtVersion()) {
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
+ if (!version) {
addOutput(tr("Cannot install package to sysroot without a Qt version."),
ErrorMessageOutput);
return false;
}
- m_qmakeCommand = bc->qtVersion()->qmakeCommand().toString();
+ m_qmakeCommand = version->qmakeCommand().toString();
m_packageFilePath = pStep->packageFilePath();
return true;
}
@@ -253,7 +246,8 @@ QStringList MaemoInstallDebianPackageToSysrootStep::madArguments() const
{
QStringList args;
args << QLatin1String("xdpkg");
- if (qobject_cast<Qt4HarmattanTarget *>(target()))
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target()->profile());
+ if (deviceType == Core::Id(HarmattanOsType))
args << QLatin1String("--no-force-downgrade");
args << QLatin1String("-i");
return args;
@@ -314,20 +308,21 @@ MaemoCopyToSysrootStep::MaemoCopyToSysrootStep(BuildStepList *bsl,
bool MaemoCopyToSysrootStep::init()
{
const Qt4BuildConfiguration * const bc
- = qobject_cast<Qt4BaseTarget *>(target())->activeQt4BuildConfiguration();
+ = qobject_cast<Qt4BuildConfiguration *>(target()->activeBuildConfiguration());
if (!bc) {
addOutput(tr("Cannot copy to sysroot without build configuration."),
ErrorMessageOutput);
return false;
}
- const MaemoQtVersion * const qtVersion = dynamic_cast<MaemoQtVersion *>(bc->qtVersion());
+ const MaemoQtVersion *const qtVersion
+ = dynamic_cast<MaemoQtVersion *>(QtSupport::QtProfileInformation::qtVersion(target()->profile()));
if (!qtVersion) {
addOutput(tr("Cannot copy to sysroot without valid Qt version."),
ErrorMessageOutput);
return false;
}
- m_systemRoot = qtVersion->systemRoot();
+ m_systemRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(target()->profile()).toString();
const DeploymentInfo * const deploymentInfo
= static_cast<RemoteLinuxDeployConfiguration *>(deployConfiguration())->deploymentInfo();
@@ -398,7 +393,8 @@ bool MaemoMakeInstallToSysrootStep::init()
ErrorMessageOutput);
return false;
}
- const QtSupport::BaseQtVersion * const qtVersion = bc->qtVersion();
+ const QtSupport::BaseQtVersion *const qtVersion
+ = QtSupport::QtProfileInformation::qtVersion(target()->profile());
if (!qtVersion) {
addOutput("Cannot deploy: Unusable build configuration.",
ErrorMessageOutput);
@@ -408,9 +404,12 @@ bool MaemoMakeInstallToSysrootStep::init()
Utils::Environment env = bc->environment();
MaemoGlobal::addMaddeEnvironment(env, qtVersion->qmakeCommand().toString());
QString command = MaemoGlobal::madCommand(qtVersion->qmakeCommand().toString());
+ QString systemRoot;
+ if (ProjectExplorer::SysRootProfileInformation::hasSysRoot(target()->profile()))
+ systemRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(target()->profile()).toString();
QStringList args = QStringList() << QLatin1String("-t")
<< MaemoGlobal::targetName(qtVersion->qmakeCommand().toString()) << QLatin1String("make")
- << QLatin1String("install") << (QLatin1String("INSTALL_ROOT=") + qtVersion->systemRoot());
+ << QLatin1String("install") << (QLatin1String("INSTALL_ROOT=") + systemRoot);
MaemoGlobal::transformMaddeCall(command, args, qtVersion->qmakeCommand().toString());
processParameters()->setCommand(command);
processParameters()->setArguments(args.join(QLatin1String(" ")));
diff --git a/src/plugins/madde/maemopackagecreationfactory.cpp b/src/plugins/madde/maemopackagecreationfactory.cpp
index 59e8274b44..3f0061270b 100644
--- a/src/plugins/madde/maemopackagecreationfactory.cpp
+++ b/src/plugins/madde/maemopackagecreationfactory.cpp
@@ -32,12 +32,13 @@
#include "maemopackagecreationfactory.h"
#include "maemopackagecreationstep.h"
-#include "qt4maemotarget.h"
+#include "maddedevice.h"
#include "qt4maemodeployconfiguration.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/deployconfiguration.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
@@ -62,13 +63,13 @@ QList<Core::Id> MaemoPackageCreationFactory::availableCreationIds(ProjectExplore
QList<Core::Id> ids;
if (!qobject_cast<Qt4MaemoDeployConfiguration *>(parent->parent()))
return ids;
- if (qobject_cast<AbstractDebBasedQt4MaemoTarget *>(parent->target())
- && !parent->contains(MaemoDebianPackageCreationStep::CreatePackageId)) {
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->target()->profile());
+ if (MaddeDevice::isDebianBased(deviceType)
+ && !parent->contains(MaemoDebianPackageCreationStep::CreatePackageId))
ids << MaemoDebianPackageCreationStep::CreatePackageId;
- } else if (qobject_cast<AbstractRpmBasedQt4MaemoTarget *>(parent->target())
- && !parent->contains(MaemoRpmPackageCreationStep::CreatePackageId)) {
+ else if (!MaddeDevice::isDebianBased(deviceType)
+ && !parent->contains(MaemoRpmPackageCreationStep::CreatePackageId))
ids << MaemoRpmPackageCreationStep::CreatePackageId;
- }
return ids;
}
@@ -111,14 +112,16 @@ BuildStep *MaemoPackageCreationFactory::restore(ProjectExplorer::BuildStepList *
{
Q_ASSERT(canRestore(parent, map));
BuildStep * step = 0;
+ Core::Id deviceType
+ = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->target()->profile());
const Core::Id id = ProjectExplorer::idFromMap(map);
if (id == MaemoDebianPackageCreationStep::CreatePackageId
|| (id == Core::Id(OldCreatePackageId)
- && qobject_cast<AbstractDebBasedQt4MaemoTarget *>(parent->target()))) {
+ && MaddeDevice::isDebianBased(deviceType))) {
step = new MaemoDebianPackageCreationStep(parent);
} else if (id == MaemoRpmPackageCreationStep::CreatePackageId
|| (id == Core::Id(OldCreatePackageId)
- && qobject_cast<AbstractRpmBasedQt4MaemoTarget *>(parent->target()))) {
+ && !MaddeDevice::isDebianBased(deviceType))) {
step = new MaemoRpmPackageCreationStep(parent);
}
Q_ASSERT(step);
diff --git a/src/plugins/madde/maemopackagecreationstep.cpp b/src/plugins/madde/maemopackagecreationstep.cpp
index 89b3a4e770..397ff696e6 100644
--- a/src/plugins/madde/maemopackagecreationstep.cpp
+++ b/src/plugins/madde/maemopackagecreationstep.cpp
@@ -33,24 +33,27 @@
#include "maemoconstants.h"
#include "maemoglobal.h"
+#include "debianmanager.h"
+#include "rpmmanager.h"
#include "maemopackagecreationwidget.h"
-#include "qt4maemotarget.h"
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4project.h>
-#include <qt4projectmanager/qt4target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
+#include <qtsupport/qtprofileinformation.h>
#include <utils/environment.h>
#include <utils/fileutils.h>
+#include <utils/qtcassert.h>
#include <QDateTime>
#include <QProcess>
#include <QRegExp>
namespace {
- const QLatin1String MagicFileName(".qtcreator");
-}
+const QLatin1String MagicFileName(".qtcreator");
+} // namespace
using namespace ProjectExplorer::Constants;
using ProjectExplorer::BuildStepList;
@@ -96,12 +99,13 @@ bool AbstractMaemoPackageCreationStep::init()
QLatin1String("nostrip"), QLatin1String(" "));
}
- if (!qt4BuildConfiguration()->qtVersion()) {
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
+ if (!version) {
raiseError(tr("Packaging failed: No Qt version."));
return false;
}
- m_qmakeCommand = qt4BuildConfiguration()->qtVersion()->qmakeCommand().toString();
+ m_qmakeCommand = version->qmakeCommand().toString();
return true;
}
@@ -159,21 +163,6 @@ const Qt4BuildConfiguration *AbstractMaemoPackageCreationStep::qt4BuildConfigura
return static_cast<Qt4BuildConfiguration *>(target()->activeBuildConfiguration());
}
-AbstractQt4MaemoTarget *AbstractMaemoPackageCreationStep::maemoTarget() const
-{
- return qobject_cast<AbstractQt4MaemoTarget *>(target());
-}
-
-AbstractDebBasedQt4MaemoTarget *AbstractMaemoPackageCreationStep::debBasedMaemoTarget() const
-{
- return qobject_cast<AbstractDebBasedQt4MaemoTarget*>(target());
-}
-
-AbstractRpmBasedQt4MaemoTarget *AbstractMaemoPackageCreationStep::rpmBasedMaemoTarget() const
-{
- return qobject_cast<AbstractRpmBasedQt4MaemoTarget*>(target());
-}
-
bool AbstractMaemoPackageCreationStep::isPackagingNeeded() const
{
if (AbstractPackagingStep::isPackagingNeeded())
@@ -187,29 +176,24 @@ QString AbstractMaemoPackageCreationStep::packageFileName() const
const QString &version = versionString(&error);
if (version.isEmpty())
return QString();
- QFileInfo fi(maemoTarget()->packageFileName());
+ QFileInfo fi = DebianManager::packageFileName(DebianManager::debianDirectory(target())).toFileInfo();
const QString baseName = replaceDots(fi.completeBaseName());
return baseName + QLatin1Char('.') + fi.suffix();
}
QString AbstractMaemoPackageCreationStep::versionString(QString *error) const
{
- return maemoTarget()->projectVersion(error);
+ return DebianManager::projectVersion(DebianManager::debianDirectory(target()), error);
}
bool AbstractMaemoPackageCreationStep::setVersionString(const QString &version, QString *error)
{
- const bool success = maemoTarget()->setProjectVersion(version, error);
+ const bool success = DebianManager::setProjectVersion(DebianManager::debianDirectory(target()), version, error);
if (success)
emit packageFilePathChanged();
return success;
}
-QString AbstractMaemoPackageCreationStep::nativePath(const QFile &file)
-{
- return QDir::toNativeSeparators(QFileInfo(file).filePath());
-}
-
bool AbstractMaemoPackageCreationStep::callPackagingCommand(QProcess *proc,
const QStringList &arguments)
{
@@ -255,8 +239,9 @@ void AbstractMaemoPackageCreationStep::preparePackagingProcess(QProcess *proc,
QString AbstractMaemoPackageCreationStep::replaceDots(const QString &name) const
{
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target()->profile());
// Idiotic OVI store requirement for N900 (but not allowed for N9 ...).
- if (qobject_cast<Qt4Maemo5Target *>(target())) {
+ if (deviceType == Core::Id(Maemo5OsType)) {
QString adaptedName = name;
return adaptedName.replace(QLatin1Char('.'), QLatin1Char('_'));
}
@@ -292,11 +277,12 @@ bool MaemoDebianPackageCreationStep::init()
{
if (!AbstractMaemoPackageCreationStep::init())
return false;
- m_maddeRoot = MaemoGlobal::maddeRoot(qt4BuildConfiguration()->qtVersion()->qmakeCommand().toString());
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
+ m_maddeRoot = MaemoGlobal::maddeRoot(version->qmakeCommand().toString());
m_projectDirectory = project()->projectDirectory();
- m_pkgFileName = maemoTarget()->packageFileName();
- m_packageName = maemoTarget()->packageName();
- m_templatesDirPath = debBasedMaemoTarget()->debianDirPath();
+ m_pkgFileName = DebianManager::packageFileName(DebianManager::debianDirectory(target())).toString();
+ m_packageName = DebianManager::packageName(DebianManager::debianDirectory(target()));
+ m_templatesDirPath = DebianManager::debianDirectory(target()).toString();
m_debugBuild = qt4BuildConfiguration()->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild;
checkProjectName();
return true;
@@ -346,13 +332,14 @@ bool MaemoDebianPackageCreationStep::createPackage(QProcess *buildProc,
bool MaemoDebianPackageCreationStep::isMetaDataNewerThan(const QDateTime &packageDate) const
{
- const QString debianPath = debBasedMaemoTarget()->debianDirPath();
- if (packageDate <= QFileInfo(debianPath).lastModified())
+ const Utils::FileName debianPath = DebianManager::debianDirectory(target());
+ if (packageDate <= debianPath.toFileInfo().lastModified())
return true;
- const QStringList debianFiles = debBasedMaemoTarget()->debianFiles();
+ const QStringList debianFiles = DebianManager::debianFiles(debianPath);
foreach (const QString &debianFile, debianFiles) {
- const QString absFilePath = debianPath + QLatin1Char('/') + debianFile;
- if (packageDate <= QFileInfo(absFilePath).lastModified())
+ Utils::FileName absFilePath = debianPath;
+ absFilePath.appendPath(debianFile);
+ if (packageDate <= absFilePath.toFileInfo().lastModified())
return true;
}
return false;
@@ -401,7 +388,7 @@ bool MaemoDebianPackageCreationStep::copyDebianFiles(bool inSourceBuild)
foreach (const QString &fileName, files) {
const QString srcFile = m_templatesDirPath + QLatin1Char('/') + fileName;
QString newFileName = fileName;
- if (newFileName == Qt4HarmattanTarget::aegisManifestFileName())
+ if (newFileName == QLatin1String("manifest.aegis"))
newFileName = m_packageName + QLatin1String(".aegis");
const QString destFile = debianDirPath + QLatin1Char('/') + newFileName;
@@ -411,7 +398,7 @@ bool MaemoDebianPackageCreationStep::copyDebianFiles(bool inSourceBuild)
continue;
}
- if (newFileName == maemoTarget()->packageName() + QLatin1String(".aegis")) {
+ if (newFileName == DebianManager::packageName(DebianManager::debianDirectory(target())) + QLatin1String(".aegis")) {
Utils::FileReader reader;
if (!reader.fetch(srcFile)) {
raiseError(tr("Could not read manifest file '%1': %2.")
@@ -518,8 +505,8 @@ void MaemoRpmPackageCreationStep::ctor()
bool MaemoRpmPackageCreationStep::init()
{
- m_specFile = rpmBasedMaemoTarget()->specFilePath();
- m_packageFileName = rpmBasedMaemoTarget()->packageFileName();
+ m_specFile = RpmManager::specFile(target());
+ m_packageFileName = RpmManager::packageFileName(m_specFile, target());
return AbstractMaemoPackageCreationStep::init();
}
@@ -528,12 +515,12 @@ bool MaemoRpmPackageCreationStep::createPackage(QProcess *buildProc,
{
Q_UNUSED(fi);
const QStringList args = QStringList() << QLatin1String("rrpmbuild")
- << QLatin1String("-bb") << m_specFile;
+ << QLatin1String("-bb") << m_specFile.toUserOutput();
if (!callPackagingCommand(buildProc, args))
return false;
QFile::remove(cachedPackageFilePath());
const QString packageSourceFilePath = rpmBuildDir() + QLatin1Char('/')
- + m_packageFileName;
+ + m_packageFileName.toUserOutput();
if (!QFile::rename(packageSourceFilePath, cachedPackageFilePath())) {
raiseError(tr("Packaging failed: Could not move package file from %1 to %2.")
.arg(packageSourceFilePath, cachedPackageFilePath()));
@@ -545,8 +532,8 @@ bool MaemoRpmPackageCreationStep::createPackage(QProcess *buildProc,
bool MaemoRpmPackageCreationStep::isMetaDataNewerThan(const QDateTime &packageDate) const
{
- const QDateTime specFileChangeDate
- = QFileInfo(rpmBasedMaemoTarget()->specFilePath()).lastModified();
+ QTC_ASSERT(!m_specFile.isEmpty(), return false);
+ const QDateTime specFileChangeDate = m_specFile.toFileInfo().lastModified();
return packageDate <= specFileChangeDate;
}
diff --git a/src/plugins/madde/maemopackagecreationstep.h b/src/plugins/madde/maemopackagecreationstep.h
index bf8e9eaf5e..26b6d4158b 100644
--- a/src/plugins/madde/maemopackagecreationstep.h
+++ b/src/plugins/madde/maemopackagecreationstep.h
@@ -34,6 +34,7 @@
#include <remotelinux/abstractpackagingstep.h>
#include <utils/environment.h>
+#include <utils/fileutils.h>
QT_BEGIN_NAMESPACE
class QDateTime;
@@ -42,10 +43,7 @@ class QProcess;
QT_END_NAMESPACE
namespace Qt4ProjectManager { class Qt4BuildConfiguration; }
-
-namespace RemoteLinux {
-class RemoteLinuxDeployConfiguration;
-}
+namespace RemoteLinux { class RemoteLinuxDeployConfiguration; }
namespace Madde {
namespace Internal {
@@ -67,9 +65,6 @@ public:
const QString &workingDir);
const Qt4ProjectManager::Qt4BuildConfiguration *qt4BuildConfiguration() const;
- AbstractQt4MaemoTarget *maemoTarget() const;
- AbstractDebBasedQt4MaemoTarget *debBasedMaemoTarget() const;
- AbstractRpmBasedQt4MaemoTarget *rpmBasedMaemoTarget() const;
static const QLatin1String DefaultVersionNumber;
@@ -95,7 +90,6 @@ private:
virtual bool createPackage(QProcess *buildProc, const QFutureInterface<bool> &fi) = 0;
virtual bool isMetaDataNewerThan(const QDateTime &packageDate) const = 0;
- static QString nativePath(const QFile &file);
bool isPackagingNeeded() const;
const Qt4ProjectManager::Qt4BuildConfiguration *m_lastBuildConfig;
@@ -156,8 +150,8 @@ private:
void ctor();
QString rpmBuildDir() const;
- QString m_specFile;
- QString m_packageFileName;
+ Utils::FileName m_specFile;
+ Utils::FileName m_packageFileName;
static const Core::Id CreatePackageId;
};
diff --git a/src/plugins/madde/maemopackagecreationwidget.cpp b/src/plugins/madde/maemopackagecreationwidget.cpp
index 4cdc563cb0..26150869ed 100644
--- a/src/plugins/madde/maemopackagecreationwidget.cpp
+++ b/src/plugins/madde/maemopackagecreationwidget.cpp
@@ -32,11 +32,14 @@
#include "maemopackagecreationwidget.h"
#include "ui_maemopackagecreationwidget.h"
+#include "debianmanager.h"
+#include "maddedevice.h"
#include "maemoglobal.h"
#include "maemopackagecreationstep.h"
-#include "qt4maemotarget.h"
+#include "rpmmanager.h"
#include <coreplugin/editormanager/editormanager.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
@@ -72,25 +75,27 @@ void MaemoPackageCreationWidget::initGui()
{
m_ui->shortDescriptionLineEdit->setMaxLength(60);
updateVersionInfo();
- const AbstractDebBasedQt4MaemoTarget * const debBasedMaemoTarget
- = m_step->debBasedMaemoTarget();
- if (debBasedMaemoTarget) {
- const QSize iconSize = debBasedMaemoTarget->packageManagerIconSize();
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(m_step->target()->profile());
+ if (MaddeDevice::isDebianBased(deviceType)) {
+ const Utils::FileName path = DebianManager::debianDirectory(m_step->target());
+ const QSize iconSize = MaddeDevice::packageManagerIconSize(deviceType);
m_ui->packageManagerIconButton->setFixedSize(iconSize);
m_ui->packageManagerIconButton->setToolTip(tr("Size should be %1x%2 pixels")
.arg(iconSize.width()).arg(iconSize.height()));
m_ui->editSpecFileButton->setVisible(false);
- updateDebianFileList();
- handleControlFileUpdate();
+ updateDebianFileList(path);
+ handleControlFileUpdate(path);
+ DebianManager *dm = DebianManager::instance();
connect(m_ui->packageManagerNameLineEdit, SIGNAL(editingFinished()),
SLOT(setPackageManagerName()));
- connect(debBasedMaemoTarget, SIGNAL(debianDirContentsChanged()),
- SLOT(updateDebianFileList()));
- connect(debBasedMaemoTarget, SIGNAL(changeLogChanged()),
+ connect(dm, SIGNAL(debianDirectoryChanged(Utils::FileName)),
+ SLOT(updateDebianFileList(Utils::FileName)));
+ connect(dm, SIGNAL(changelogChanged(Utils::FileName)),
SLOT(updateVersionInfo()));
- connect(debBasedMaemoTarget, SIGNAL(controlChanged()),
- SLOT(handleControlFileUpdate()));
+ connect(dm, SIGNAL(controlChanged(Utils::FileName)),
+ SLOT(handleControlFileUpdate(Utils::FileName)));
} else {
+ const Utils::FileName path = RpmManager::specFile(m_step->target());
m_ui->packageManagerNameLabel->hide();
m_ui->packageManagerNameLineEdit->hide();
m_ui->packageManagerIconLabel->hide();
@@ -106,9 +111,9 @@ void MaemoPackageCreationWidget::initGui()
m_ui->formLayout->removeItem(m_ui->formLayout->itemAt(5, QFormLayout::FieldRole));
m_ui->formLayout->removeItem(m_ui->formLayout->itemAt(6, QFormLayout::LabelRole));
m_ui->formLayout->removeItem(m_ui->formLayout->itemAt(6, QFormLayout::FieldRole));
- handleSpecFileUpdate();
- connect(m_step->rpmBasedMaemoTarget(), SIGNAL(specFileChanged()),
- SLOT(handleSpecFileUpdate()));
+ handleSpecFileUpdate(path);
+ connect(RpmManager::instance(), SIGNAL(specFileChanged(Utils::FileName)),
+ SLOT(handleSpecFileUpdate(Utils::FileName)));
connect(m_ui->editSpecFileButton, SIGNAL(clicked()),
SLOT(editSpecFile()));
}
@@ -120,10 +125,13 @@ void MaemoPackageCreationWidget::initGui()
SLOT(setShortDescription()));
}
-void MaemoPackageCreationWidget::updateDebianFileList()
+void MaemoPackageCreationWidget::updateDebianFileList(const Utils::FileName &debianDir)
{
+ if (debianDir != DebianManager::debianDirectory(m_step->target()))
+ return;
+
m_ui->debianFilesComboBox->clear();
- const QStringList &debianFiles = m_step->debBasedMaemoTarget()->debianFiles();
+ const QStringList &debianFiles = DebianManager::debianFiles(debianDir);
foreach (const QString &fileName, debianFiles) {
if (fileName != QLatin1String("compat")
&& !fileName.endsWith(QLatin1Char('~')))
@@ -154,8 +162,11 @@ void MaemoPackageCreationWidget::updateVersionInfo()
updateSummary();
}
-void MaemoPackageCreationWidget::handleControlFileUpdate()
+void MaemoPackageCreationWidget::handleControlFileUpdate(const Utils::FileName &debianDir)
{
+ if (debianDir != DebianManager::debianDirectory(m_step->target()))
+ return;
+
updatePackageName();
updateShortDescription();
updatePackageManagerName();
@@ -163,8 +174,11 @@ void MaemoPackageCreationWidget::handleControlFileUpdate()
updateSummary();
}
-void MaemoPackageCreationWidget::handleSpecFileUpdate()
+void MaemoPackageCreationWidget::handleSpecFileUpdate(const Utils::FileName &spec)
{
+ if (spec != RpmManager::specFile(m_step->target()))
+ return;
+
updatePackageName();
updateShortDescription();
updateVersionInfo();
@@ -173,8 +187,9 @@ void MaemoPackageCreationWidget::handleSpecFileUpdate()
void MaemoPackageCreationWidget::updatePackageManagerIcon()
{
+ const Utils::FileName path = DebianManager::debianDirectory(m_step->target());
QString error;
- const QIcon &icon = m_step->debBasedMaemoTarget()->packageManagerIcon(&error);
+ const QIcon &icon = DebianManager::packageManagerIcon(path, &error);
if (!error.isEmpty()) {
QMessageBox::critical(this, tr("Could not read icon"), error);
} else {
@@ -185,40 +200,50 @@ void MaemoPackageCreationWidget::updatePackageManagerIcon()
void MaemoPackageCreationWidget::updatePackageName()
{
- m_ui->packageNameLineEdit->setText(m_step->maemoTarget()->packageName());
+ const Utils::FileName path = DebianManager::debianDirectory(m_step->target());
+ m_ui->packageNameLineEdit->setText(DebianManager::packageName(path));
}
void MaemoPackageCreationWidget::updatePackageManagerName()
{
- m_ui->packageManagerNameLineEdit->setText(m_step->debBasedMaemoTarget()->packageManagerName());
+ const Utils::FileName path = DebianManager::debianDirectory(m_step->target());
+ Core::Id deviceType
+ = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(m_step->target()->profile());
+ m_ui->packageManagerNameLineEdit->setText(DebianManager::packageManagerName(path, deviceType));
}
void MaemoPackageCreationWidget::updateShortDescription()
{
- m_ui->shortDescriptionLineEdit->setText(m_step->maemoTarget()->shortDescription());
+ const Utils::FileName path = DebianManager::debianDirectory(m_step->target());
+ m_ui->shortDescriptionLineEdit->setText(DebianManager::shortDescription(path));
}
void MaemoPackageCreationWidget::setPackageManagerIcon()
{
+ const Utils::FileName path = DebianManager::debianDirectory(m_step->target());
+ Core::Id deviceType
+ = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(m_step->target()->profile());
QString imageFilter = tr("Images") + QLatin1String("( ");
const QList<QByteArray> &imageTypes = QImageReader::supportedImageFormats();
foreach (const QByteArray &imageType, imageTypes)
imageFilter += "*." + QString::fromAscii(imageType) + QLatin1Char(' ');
imageFilter += QLatin1Char(')');
- const QSize iconSize = m_step->debBasedMaemoTarget()->packageManagerIconSize();
+ const QSize iconSize = MaddeDevice::packageManagerIconSize(deviceType);
const QString iconFileName = QFileDialog::getOpenFileName(this,
tr("Choose Image (will be scaled to %1x%2 pixels if necessary)")
.arg(iconSize.width()).arg(iconSize.height()), QString(), imageFilter);
if (!iconFileName.isEmpty()) {
QString error;
- if (!m_step->debBasedMaemoTarget()->setPackageManagerIcon(iconFileName, &error))
+ if (!DebianManager::setPackageManagerIcon(path, deviceType,
+ Utils::FileName::fromString(iconFileName), &error))
QMessageBox::critical(this, tr("Could Not Set New Icon"), error);
}
}
void MaemoPackageCreationWidget::setPackageName()
{
- if (!m_step->maemoTarget()->setPackageName(m_ui->packageNameLineEdit->text())) {
+ const Utils::FileName path = DebianManager::debianDirectory(m_step->target());
+ if (!DebianManager::setPackageName(path, m_ui->packageNameLineEdit->text())) {
QMessageBox::critical(this, tr("File Error"),
tr("Could not set project name."));
}
@@ -226,7 +251,10 @@ void MaemoPackageCreationWidget::setPackageName()
void MaemoPackageCreationWidget::setPackageManagerName()
{
- if (!m_step->debBasedMaemoTarget()->setPackageManagerName(m_ui->packageManagerNameLineEdit->text())) {
+ const Utils::FileName path = DebianManager::debianDirectory(m_step->target());
+ Core::Id deviceType
+ = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(m_step->target()->profile());
+ if (!DebianManager::setPackageManagerName(path, deviceType, m_ui->packageManagerNameLineEdit->text())) {
QMessageBox::critical(this, tr("File Error"),
tr("Could not set package name for project manager."));
}
@@ -234,7 +262,8 @@ void MaemoPackageCreationWidget::setPackageManagerName()
void MaemoPackageCreationWidget::setShortDescription()
{
- if (!m_step->maemoTarget()->setShortDescription(m_ui->shortDescriptionLineEdit->text())) {
+ const Utils::FileName path = DebianManager::debianDirectory(m_step->target());
+ if (!DebianManager::setShortDescription(path, m_ui->shortDescriptionLineEdit->text())) {
QMessageBox::critical(this, tr("File Error"),
tr("Could not set project description."));
}
@@ -265,13 +294,14 @@ void MaemoPackageCreationWidget::versionInfoChanged()
void MaemoPackageCreationWidget::editDebianFile()
{
- editFile(m_step->debBasedMaemoTarget()->debianDirPath()
- + QLatin1Char('/') + m_ui->debianFilesComboBox->currentText());
+ Utils::FileName path = DebianManager::debianDirectory(m_step->target());
+ path.appendPath(m_ui->debianFilesComboBox->currentText());
+ editFile(path.toString());
}
void MaemoPackageCreationWidget::editSpecFile()
{
- editFile(m_step->rpmBasedMaemoTarget()->specFilePath());
+ editFile(RpmManager::specFile(m_step->target()).toString());
}
void MaemoPackageCreationWidget::editFile(const QString &filePath)
diff --git a/src/plugins/madde/maemopackagecreationwidget.h b/src/plugins/madde/maemopackagecreationwidget.h
index 80a75ae750..b986646f22 100644
--- a/src/plugins/madde/maemopackagecreationwidget.h
+++ b/src/plugins/madde/maemopackagecreationwidget.h
@@ -33,6 +33,7 @@
#define MAEMOPACKAGECREATIONWIDGET_H
#include <projectexplorer/buildstep.h>
+#include <utils/fileutils.h>
namespace Madde {
namespace Internal {
@@ -56,10 +57,10 @@ private slots:
void editSpecFile();
void versionInfoChanged();
void initGui();
- void updateDebianFileList();
+ void updateDebianFileList(const Utils::FileName &debianDir);
void updateVersionInfo();
- void handleControlFileUpdate();
- void handleSpecFileUpdate();
+ void handleControlFileUpdate(const Utils::FileName &debianDir);
+ void handleSpecFileUpdate(const Utils::FileName &spec);
void setPackageManagerIcon();
void setPackageManagerName();
void setPackageName();
diff --git a/src/plugins/madde/maemopublisherfremantlefree.cpp b/src/plugins/madde/maemopublisherfremantlefree.cpp
index dfab66adb9..eefab25bd9 100644
--- a/src/plugins/madde/maemopublisherfremantlefree.cpp
+++ b/src/plugins/madde/maemopublisherfremantlefree.cpp
@@ -32,10 +32,11 @@
#include "maemopublisherfremantlefree.h"
#include "maemoglobal.h"
+#include "maemoconstants.h"
+#include "debianmanager.h"
#include "maemopackagecreationstep.h"
#include "maemopublishingfileselectiondialog.h"
#include "qt4maemodeployconfiguration.h"
-#include "qt4maemotarget.h"
#include <coreplugin/idocument.h>
#include <projectexplorer/project.h>
@@ -43,6 +44,7 @@
#include <qt4projectmanager/qmakestep.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtprofileinformation.h>
#include <remotelinux/deployablefilesperprofile.h>
#include <remotelinux/deploymentinfo.h>
#include <utils/fileutils.h>
@@ -309,8 +311,12 @@ void MaemoPublisherFremantleFree::handleProcessFinished(bool failedToStart)
runDpkgBuildPackage();
} else {
setState(RunningMakeDistclean);
- m_process->start(m_buildConfig->makeCommand(),
- QStringList() << QLatin1String("distclean"));
+ // Toolchain might be null! (yes because this sucks)
+ ProjectExplorer::ToolChain *tc
+ = ProjectExplorer::ToolChainProfileInformation::toolChain(m_buildConfig->target()->profile());
+ if (!tc)
+ finishWithFailure(QString(), tr("Make distclean failed. No toolchain in profile."));
+ m_process->start(tc->makeCommand(), QStringList() << QLatin1String("distclean"));
}
break;
case RunningMakeDistclean:
@@ -374,7 +380,7 @@ void MaemoPublisherFremantleFree::runDpkgBuildPackage()
}
}
- QtSupport::BaseQtVersion *lqt = m_buildConfig->qtVersion();
+ QtSupport::BaseQtVersion *lqt = QtSupport::QtProfileInformation::qtVersion(m_buildConfig->target()->profile());
if (!lqt)
finishWithFailure(QString(), tr("No Qt version set."));
@@ -541,7 +547,8 @@ bool MaemoPublisherFremantleFree::updateDesktopFiles(QString *error) const
bool success = true;
const Qt4MaemoDeployConfiguration * const deployConfig
= qobject_cast<Qt4MaemoDeployConfiguration *>(m_buildConfig->target()->activeDeployConfiguration());
- const DeploymentInfo * const deploymentInfo = deployConfig->deploymentInfo();
+ 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);
@@ -597,9 +604,13 @@ bool MaemoPublisherFremantleFree::addOrReplaceDesktopFileValue(QByteArray &fileC
QStringList MaemoPublisherFremantleFree::findProblems() const
{
QStringList problems;
- const Qt4Maemo5Target * const target
- = qobject_cast<Qt4Maemo5Target *>(m_buildConfig->target());
- const QString &description = target->shortDescription();
+ ProjectExplorer::Target *target = m_buildConfig->target();
+ Core::Id deviceType
+ = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target->profile());
+ if (deviceType != Core::Id(Maemo5OsType))
+ return QStringList();
+
+ const QString &description = DebianManager::shortDescription(DebianManager::debianDirectory(target));
if (description.trimmed().isEmpty()) {
problems << tr("The package description is empty. You must set one "
"in Projects -> Run -> Create Package -> Details.");
@@ -608,8 +619,9 @@ QStringList MaemoPublisherFremantleFree::findProblems() const
"not what you want. Please change it in "
"Projects -> Run -> Create Package -> Details.").arg(description);
}
+
QString dummy;
- if (target->packageManagerIcon(&dummy).isNull())
+ if (DebianManager::packageManagerIcon(DebianManager::debianDirectory(target), &dummy).isNull())
problems << tr("You have not set an icon for the package manager. "
"The icon must be set in Projects -> Run -> Create Package -> Details.");
return problems;
diff --git a/src/plugins/madde/maemopublishingbuildsettingspagefremantlefree.cpp b/src/plugins/madde/maemopublishingbuildsettingspagefremantlefree.cpp
index 5c04ae126e..61160b409a 100644
--- a/src/plugins/madde/maemopublishingbuildsettingspagefremantlefree.cpp
+++ b/src/plugins/madde/maemopublishingbuildsettingspagefremantlefree.cpp
@@ -41,6 +41,8 @@
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
@@ -56,11 +58,13 @@ MaemoPublishingBuildSettingsPageFremantleFree::MaemoPublishingBuildSettingsPageF
ui(new Ui::MaemoPublishingWizardPageFremantleFree)
{
ui->setupUi(this);
+
collectBuildConfigurations(project);
QTC_ASSERT(!m_buildConfigs.isEmpty(), return);
- foreach (const Qt4BuildConfiguration * const bc, m_buildConfigs) {
+
+ foreach (const Qt4BuildConfiguration *const bc, m_buildConfigs)
ui->buildConfigComboBox->addItem(bc->displayName());
- }
+
ui->buildConfigComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
ui->buildConfigComboBox->setCurrentIndex(0);
connect(ui->skipUploadCheckBox, SIGNAL(toggled(bool)),
@@ -74,22 +78,17 @@ MaemoPublishingBuildSettingsPageFremantleFree::~MaemoPublishingBuildSettingsPage
void MaemoPublishingBuildSettingsPageFremantleFree::collectBuildConfigurations(const Project *project)
{
+ m_buildConfigs.clear();
+
foreach (const Target *const target, project->targets()) {
- if (target->id() != Core::Id(Constants::MAEMO5_DEVICE_TARGET_ID))
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
+ if (!version || version->platformName() != QLatin1String(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM))
continue;
- foreach (BuildConfiguration * const bc, target->buildConfigurations()) {
- Qt4BuildConfiguration * const qt4Bc
- = qobject_cast<Qt4BuildConfiguration *>(bc);
- if (!qt4Bc)
- continue;
-
- QtSupport::BaseQtVersion *lqt = qt4Bc->qtVersion();
- if (!lqt)
- continue;
- if (MaemoGlobal::deviceType(lqt->qmakeCommand().toString()) == Core::Id(Maemo5OsType))
+ foreach (BuildConfiguration *const bc, target->buildConfigurations()) {
+ Qt4BuildConfiguration *const qt4Bc = qobject_cast<Qt4BuildConfiguration *>(bc);
+ if (qt4Bc)
m_buildConfigs << qt4Bc;
}
- break;
}
}
diff --git a/src/plugins/madde/maemopublishingbuildsettingspagefremantlefree.h b/src/plugins/madde/maemopublishingbuildsettingspagefremantlefree.h
index 28a433b32f..ce84c9e22a 100644
--- a/src/plugins/madde/maemopublishingbuildsettingspagefremantlefree.h
+++ b/src/plugins/madde/maemopublishingbuildsettingspagefremantlefree.h
@@ -51,7 +51,8 @@ class MaemoPublishingBuildSettingsPageFremantleFree : public QWizardPage
public:
explicit MaemoPublishingBuildSettingsPageFremantleFree(const ProjectExplorer::Project *project,
- MaemoPublisherFremantleFree *publisher, QWidget *parent = 0);
+ MaemoPublisherFremantleFree *publisher,
+ QWidget *parent = 0);
~MaemoPublishingBuildSettingsPageFremantleFree();
private:
diff --git a/src/plugins/madde/maemopublishinguploadsettingspagefremantlefree.h b/src/plugins/madde/maemopublishinguploadsettingspagefremantlefree.h
index 154a085bab..f8b3dc064a 100644
--- a/src/plugins/madde/maemopublishinguploadsettingspagefremantlefree.h
+++ b/src/plugins/madde/maemopublishinguploadsettingspagefremantlefree.h
@@ -51,9 +51,9 @@ public:
~MaemoPublishingUploadSettingsPageFremantleFree();
private:
- virtual void initializePage();
- virtual bool isComplete() const;
- virtual bool validatePage();
+ void initializePage();
+ bool isComplete() const;
+ bool validatePage();
QString garageAccountName() const;
QString privateKeyFilePath() const;
diff --git a/src/plugins/madde/maemopublishingwizardfactories.cpp b/src/plugins/madde/maemopublishingwizardfactories.cpp
index 5749314963..5e1eee6be1 100644
--- a/src/plugins/madde/maemopublishingwizardfactories.cpp
+++ b/src/plugins/madde/maemopublishingwizardfactories.cpp
@@ -41,6 +41,8 @@
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
@@ -73,21 +75,10 @@ bool MaemoPublishingWizardFactoryFremantleFree::canCreateWizard(const Project *p
if (!qobject_cast<const Qt4Project *>(project))
return false;
foreach (const Target *const target, project->targets()) {
- if (target->id() != Core::Id(Constants::MAEMO5_DEVICE_TARGET_ID))
- continue;
- foreach (const BuildConfiguration *const bc, target->buildConfigurations()) {
- const Qt4BuildConfiguration *const qt4Bc
- = qobject_cast<const Qt4BuildConfiguration *>(bc);
- if (!qt4Bc)
- continue;
-
- QtSupport::BaseQtVersion *qt = qt4Bc->qtVersion();
- if (!qt)
- continue;
- if (MaemoGlobal::deviceType(qt->qmakeCommand().toString()) == Core::Id(Maemo5OsType))
- return true;
- }
- break;
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
+ const QString &platform = version ? version->platformName() : QString();
+ if (platform == QLatin1String(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM))
+ return true;
}
return false;
}
diff --git a/src/plugins/madde/maemopublishingwizardfactories.h b/src/plugins/madde/maemopublishingwizardfactories.h
index fa0eb33f5c..208bfa9095 100644
--- a/src/plugins/madde/maemopublishingwizardfactories.h
+++ b/src/plugins/madde/maemopublishingwizardfactories.h
@@ -48,10 +48,10 @@ class MaemoPublishingWizardFactoryFremantleFree
public:
explicit MaemoPublishingWizardFactoryFremantleFree(QObject *parent =0);
private:
- virtual QString displayName() const;
- virtual QString description() const;
- virtual bool canCreateWizard(const ProjectExplorer::Project *project) const;
- virtual QWizard *createWizard(const ProjectExplorer::Project *project) const;
+ QString displayName() const;
+ QString description() const;
+ bool canCreateWizard(const ProjectExplorer::Project *project) const;
+ QWizard *createWizard(const ProjectExplorer::Project *project) const;
};
} // namespace Internal
diff --git a/src/plugins/madde/maemopublishingwizardfremantlefree.cpp b/src/plugins/madde/maemopublishingwizardfremantlefree.cpp
index b17caf960b..000d055a01 100644
--- a/src/plugins/madde/maemopublishingwizardfremantlefree.cpp
+++ b/src/plugins/madde/maemopublishingwizardfremantlefree.cpp
@@ -53,13 +53,11 @@ MaemoPublishingWizardFremantleFree::MaemoPublishingWizardFremantleFree(const Pro
setOption(NoCancelButton, false);
setWindowTitle(tr("Publishing to Fremantle's \"Extras-devel free\" Repository"));
- m_buildSettingsPage
- = new MaemoPublishingBuildSettingsPageFremantleFree(project, m_publisher);
+ m_buildSettingsPage = new MaemoPublishingBuildSettingsPageFremantleFree(project, m_publisher);
m_buildSettingsPage->setTitle(tr("Build Settings"));
setPage(BuildSettingsPageId, m_buildSettingsPage);
- m_uploadSettingsPage
- = new MaemoPublishingUploadSettingsPageFremantleFree(m_publisher);
+ m_uploadSettingsPage = new MaemoPublishingUploadSettingsPageFremantleFree(m_publisher);
m_uploadSettingsPage->setTitle(tr("Upload Settings"));
m_uploadSettingsPage->setCommitPage(true);
setPage(UploadSettingsPageId, m_uploadSettingsPage);
diff --git a/src/plugins/madde/maemoqemumanager.cpp b/src/plugins/madde/maemoqemumanager.cpp
index 4911de3c60..48893a2ea7 100644
--- a/src/plugins/madde/maemoqemumanager.cpp
+++ b/src/plugins/madde/maemoqemumanager.cpp
@@ -35,7 +35,6 @@
#include "maemoglobal.h"
#include "maemoqemuruntimeparser.h"
#include "maemosettingspages.h"
-#include "qt4maemotarget.h"
#include "maemoqtversion.h"
#include <coreplugin/actionmanager/actionmanager.h>
@@ -46,10 +45,12 @@
#include <coreplugin/icontext.h>
#include <coreplugin/modemanager.h>
+#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/project.h>
#include <projectexplorer/session.h>
-#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/target.h>
+#include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtversionmanager.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <remotelinux/linuxdeviceconfiguration.h>
@@ -250,56 +251,24 @@ void MaemoQemuManager::projectChanged(ProjectExplorer::Project *project)
void MaemoQemuManager::targetAdded(ProjectExplorer::Target *target)
{
- if (!target || !MaemoGlobal::isMaemoTargetId(target->id()))
+ if (!target || !MaemoGlobal::hasMaemoDevice(target->profile()))
return;
- // handle all run configuration changes, add, remove, etc...
- connect(target, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)),
- this, SLOT(runConfigurationAdded(ProjectExplorer::RunConfiguration*)));
- connect(target, SIGNAL(removedRunConfiguration(ProjectExplorer::RunConfiguration*)),
- this, SLOT(runConfigurationRemoved(ProjectExplorer::RunConfiguration*)));
- connect(target, SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
- this, SLOT(runConfigurationChanged(ProjectExplorer::RunConfiguration*)));
-
- // handle all build configuration changes, add, remove, etc...
- connect(target, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
- this, SLOT(buildConfigurationAdded(ProjectExplorer::BuildConfiguration*)));
- connect(target, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
- this, SLOT(buildConfigurationRemoved(ProjectExplorer::BuildConfiguration*)));
- connect(target, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
- this, SLOT(buildConfigurationChanged(ProjectExplorer::BuildConfiguration*)));
-
// handle the qt version changes the build configuration uses
connect(target, SIGNAL(environmentChanged()), this, SLOT(environmentChanged()));
+ connect(target, SIGNAL(profileChanged()), this, SLOT(systemChanged()));
- foreach (RunConfiguration *rc, target->runConfigurations())
- toggleDeviceConnections(qobject_cast<RemoteLinuxRunConfiguration*> (rc), true);
toggleStarterButton(target);
}
void MaemoQemuManager::targetRemoved(ProjectExplorer::Target *target)
{
- if (!target || !MaemoGlobal::isMaemoTargetId(target->id()))
+ if (!target || !MaemoGlobal::hasMaemoDevice(target->profile()))
return;
- disconnect(target, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)),
- this, SLOT(runConfigurationAdded(ProjectExplorer::RunConfiguration*)));
- disconnect(target, SIGNAL(removedRunConfiguration(ProjectExplorer::RunConfiguration*)),
- this, SLOT(runConfigurationRemoved(ProjectExplorer::RunConfiguration*)));
- disconnect(target, SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
- this, SLOT(runConfigurationChanged(ProjectExplorer::RunConfiguration*)));
-
- disconnect(target, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
- this, SLOT(buildConfigurationAdded(ProjectExplorer::BuildConfiguration*)));
- disconnect(target, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
- this, SLOT(buildConfigurationRemoved(ProjectExplorer::BuildConfiguration*)));
- disconnect(target, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
- this, SLOT(buildConfigurationChanged(ProjectExplorer::BuildConfiguration*)));
-
disconnect(target, SIGNAL(environmentChanged()), this, SLOT(environmentChanged()));
+ disconnect(target, SIGNAL(profileChanged()), this, SLOT(systemChanged()));
- foreach (RunConfiguration *rc, target->runConfigurations())
- toggleDeviceConnections(qobject_cast<RemoteLinuxRunConfiguration*> (rc), false);
showOrHideQemuButton();
}
@@ -311,46 +280,10 @@ void MaemoQemuManager::targetChanged(ProjectExplorer::Target *target)
}
}
-void MaemoQemuManager::runConfigurationAdded(ProjectExplorer::RunConfiguration *rc)
-{
- if (!rc || !MaemoGlobal::isMaemoTargetId(rc->target()->id()))
- return;
- toggleDeviceConnections(qobject_cast<RemoteLinuxRunConfiguration*> (rc), true);
-}
-
-void MaemoQemuManager::runConfigurationRemoved(ProjectExplorer::RunConfiguration *rc)
-{
- if (!rc || !MaemoGlobal::isMaemoTargetId(rc->target()->id()))
- return;
- toggleDeviceConnections(qobject_cast<RemoteLinuxRunConfiguration*> (rc), false);
-}
-
-void MaemoQemuManager::runConfigurationChanged(ProjectExplorer::RunConfiguration *rc)
-{
- if (rc)
- m_qemuAction->setEnabled(targetUsesMatchingRuntimeConfig(rc->target()));
-}
-
-void MaemoQemuManager::buildConfigurationAdded(ProjectExplorer::BuildConfiguration *bc)
-{
- if (!bc || !MaemoGlobal::isMaemoTargetId(bc->target()->id()))
- return;
-
- connect(bc, SIGNAL(environmentChanged()), this, SLOT(environmentChanged()));
-}
-
-void MaemoQemuManager::buildConfigurationRemoved(ProjectExplorer::BuildConfiguration *bc)
-{
- if (!bc || !MaemoGlobal::isMaemoTargetId(bc->target()->id()))
- return;
-
- disconnect(bc, SIGNAL(environmentChanged()), this, SLOT(environmentChanged()));
-}
-
-void MaemoQemuManager::buildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc)
+void MaemoQemuManager::systemChanged()
{
- if (bc)
- toggleStarterButton(bc->target());
+ Target *t = qobject_cast<Target *>(sender());
+ targetChanged(t);
}
void MaemoQemuManager::environmentChanged()
@@ -531,12 +464,9 @@ void MaemoQemuManager::toggleStarterButton(Target *target)
{
int uniqueId = -1;
if (target) {
- if (AbstractQt4MaemoTarget *qt4Target = qobject_cast<AbstractQt4MaemoTarget*>(target)) {
- if (Qt4BuildConfiguration *bc = qt4Target->activeQt4BuildConfiguration()) {
- if (QtSupport::BaseQtVersion *version = bc->qtVersion())
- uniqueId = version->uniqueId();
- }
- }
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
+ if (version)
+ uniqueId = version->uniqueId();
}
if (uniqueId >= 0 && (m_runtimes.isEmpty() || !m_runtimes.contains(uniqueId)))
@@ -549,7 +479,7 @@ void MaemoQemuManager::toggleStarterButton(Target *target)
const Project * const p
= ProjectExplorerPlugin::instance()->session()->startupProject();
const bool qemuButtonEnabled
- = p && p->activeTarget() && MaemoGlobal::isMaemoTargetId(p->activeTarget()->id())
+ = p && p->activeTarget() && MaemoGlobal::hasMaemoDevice(target->profile())
&& m_runtimes.value(uniqueId, MaemoQemuRuntime()).isValid()
&& targetUsesMatchingRuntimeConfig(target) && !isRunning;
m_qemuAction->setEnabled(qemuButtonEnabled);
@@ -562,7 +492,7 @@ bool MaemoQemuManager::sessionHasMaemoTarget() const
const QList<Project*> &projects = explorer->session()->projects();
foreach (const Project *p, projects) {
foreach (const Target * const target, p->targets()) {
- if (MaemoGlobal::isMaemoTargetId(target->id()))
+ if (MaemoGlobal::hasMaemoDevice(target->profile()))
return true;
}
}
@@ -581,18 +511,17 @@ bool MaemoQemuManager::targetUsesMatchingRuntimeConfig(Target *target,
qobject_cast<RemoteLinuxRunConfiguration *> (target->activeRunConfiguration());
if (!mrc)
return false;
- Qt4BuildConfiguration *bc
- = qobject_cast<Qt4BuildConfiguration *>(target->activeBuildConfiguration());
- if (!bc)
- return false;
- QtSupport::BaseQtVersion *version = bc->qtVersion();
+
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
if (!version || !m_runtimes.value(version->uniqueId(), MaemoQemuRuntime()).isValid())
return false;
if (qtVersion)
*qtVersion = version;
- const LinuxDeviceConfiguration::ConstPtr &config = mrc->deviceConfig();
- return config && config->machineType() == LinuxDeviceConfiguration::Emulator;
+ const LinuxDeviceConfiguration::ConstPtr &config
+ = ProjectExplorer::DeviceProfileInformation::device(target->profile())
+ .dynamicCast<const LinuxDeviceConfiguration>();
+ return !config.isNull() && config->machineType() == LinuxDeviceConfiguration::Emulator;
}
void MaemoQemuManager::notify(const QList<int> uniqueIds)
@@ -601,21 +530,6 @@ void MaemoQemuManager::notify(const QList<int> uniqueIds)
environmentChanged(); // to toggle the start button
}
-void MaemoQemuManager::toggleDeviceConnections(RemoteLinuxRunConfiguration *mrc,
- bool _connect)
-{
- if (!mrc)
- return;
-
- if (_connect) { // handle device configuration changes
- connect(mrc, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
- this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
- } else {
- disconnect(mrc, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
- this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
- }
-}
-
void MaemoQemuManager::showOrHideQemuButton()
{
const bool showButton = !m_runtimes.isEmpty() && sessionHasMaemoTarget();
diff --git a/src/plugins/madde/maemoqemumanager.h b/src/plugins/madde/maemoqemumanager.h
index 1c6c635a79..9f99a31445 100644
--- a/src/plugins/madde/maemoqemumanager.h
+++ b/src/plugins/madde/maemoqemumanager.h
@@ -83,14 +83,7 @@ private slots:
void targetAdded(ProjectExplorer::Target *target);
void targetRemoved(ProjectExplorer::Target *target);
void targetChanged(ProjectExplorer::Target *target);
-
- void runConfigurationAdded(ProjectExplorer::RunConfiguration *rc);
- void runConfigurationRemoved(ProjectExplorer::RunConfiguration *rc);
- void runConfigurationChanged(ProjectExplorer::RunConfiguration *rc);
-
- void buildConfigurationAdded(ProjectExplorer::BuildConfiguration *bc);
- void buildConfigurationRemoved(ProjectExplorer::BuildConfiguration *bc);
- void buildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc);
+ void systemChanged();
void environmentChanged(); // needed to check for qt version
void deviceConfigurationChanged(ProjectExplorer::Target *target);
@@ -117,7 +110,6 @@ private:
QtSupport::BaseQtVersion **qtVersion = 0);
void notify(const QList<int> uniqueIds);
- void toggleDeviceConnections(RemoteLinux::RemoteLinuxRunConfiguration *mrc, bool connect);
void showOrHideQemuButton();
private:
diff --git a/src/plugins/madde/maemoqtversion.cpp b/src/plugins/madde/maemoqtversion.cpp
index 074dfac6fb..255bee8911 100644
--- a/src/plugins/madde/maemoqtversion.cpp
+++ b/src/plugins/madde/maemoqtversion.cpp
@@ -34,6 +34,7 @@
#include "maemoconstants.h"
#include "maemoglobal.h"
+#include <projectexplorer/profileinformation.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qtsupport/qtsupportconstants.h>
@@ -97,28 +98,6 @@ MaemoQtVersion *MaemoQtVersion::clone() const
return new MaemoQtVersion(*this);
}
-QString MaemoQtVersion::systemRoot() const
-{
- if (m_systemRoot.isNull()) {
- QFile file(QDir::cleanPath(MaemoGlobal::targetRoot(qmakeCommand().toString()))
- + QLatin1String("/information"));
- if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- QTextStream stream(&file);
- while (!stream.atEnd()) {
- const QString &line = stream.readLine().trimmed();
- const QStringList &list = line.split(QLatin1Char(' '));
- if (list.count() <= 1)
- continue;
- if (list.at(0) == QLatin1String("sysroot")) {
- m_systemRoot = MaemoGlobal::maddeRoot(qmakeCommand().toString())
- + QLatin1String("/sysroots/") + list.at(1);
- }
- }
- }
- }
- return m_systemRoot;
-}
-
QList<ProjectExplorer::Abi> MaemoQtVersion::detectQtAbis() const
{
QList<ProjectExplorer::Abi> result;
@@ -141,26 +120,6 @@ QList<ProjectExplorer::Abi> MaemoQtVersion::detectQtAbis() const
return result;
}
-bool MaemoQtVersion::supportsTargetId(const Core::Id id) const
-{
- return supportedTargetIds().contains(id);
-}
-
-QSet<Core::Id> MaemoQtVersion::supportedTargetIds() const
-{
- QSet<Core::Id> result;
- if (!isValid())
- return result;
- if (m_deviceType == Core::Id(Maemo5OsType)) {
- result.insert(Core::Id(Constants::MAEMO5_DEVICE_TARGET_ID));
- } else if (m_deviceType == Core::Id(HarmattanOsType)) {
- result.insert(Core::Id(Constants::HARMATTAN_DEVICE_TARGET_ID));
- } else if (m_deviceType == Core::Id(MeeGoOsType)) {
- result.insert(Core::Id(Constants::MEEGO_DEVICE_TARGET_ID));
- }
- return result;
-}
-
QString MaemoQtVersion::description() const
{
if (m_deviceType == Core::Id(Maemo5OsType))
@@ -200,20 +159,30 @@ Core::FeatureSet MaemoQtVersion::availableFeatures() const
QString MaemoQtVersion::platformName() const
{
+ if (m_deviceType == Maemo5OsType)
+ return QLatin1String(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM);
+ if (m_deviceType == MeeGoOsType)
+ return QLatin1String(QtSupport::Constants::MEEGO_PLATFORM);
return QLatin1String(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM);
}
QString MaemoQtVersion::platformDisplayName() const
{
+ if (m_deviceType == Maemo5OsType)
+ return QLatin1String(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM_TR);
+ if (m_deviceType == MeeGoOsType)
+ return QLatin1String(QtSupport::Constants::MEEGO_PLATFORM_TR);
return QLatin1String(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM_TR);
}
-void MaemoQtVersion::addToEnvironment(Utils::Environment &env) const
+void MaemoQtVersion::addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const
{
+ Q_UNUSED(p);
const QString maddeRoot = MaemoGlobal::maddeRoot(qmakeCommand().toString());
// Needed to make pkg-config stuff work.
- env.prependOrSet(QLatin1String("SYSROOT_DIR"), QDir::toNativeSeparators(systemRoot()));
+ Utils::FileName sysRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(p);
+ env.prependOrSet(QLatin1String("SYSROOT_DIR"), sysRoot.toUserOutput());
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/madbin")
.arg(maddeRoot)));
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/madlib")
@@ -224,6 +193,14 @@ void MaemoQtVersion::addToEnvironment(Utils::Environment &env) const
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/bin").arg(maddeRoot)));
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/bin")
.arg(MaemoGlobal::targetRoot(qmakeCommand().toString()))));
+
+ // Actually this is tool chain related, but since we no longer have a tool chain...
+ const QString manglePathsKey = QLatin1String("GCCWRAPPER_PATHMANGLE");
+ if (!env.hasKey(manglePathsKey)) {
+ const QStringList pathsToMangle = QStringList() << QLatin1String("/lib")
+ << QLatin1String("/opt") << QLatin1String("/usr");
+ env.set(manglePathsKey, pathsToMangle.join(QLatin1String(":")));
+ }
}
} // namespace Internal
diff --git a/src/plugins/madde/maemoqtversion.h b/src/plugins/madde/maemoqtversion.h
index 6dca217891..d78b47114e 100644
--- a/src/plugins/madde/maemoqtversion.h
+++ b/src/plugins/madde/maemoqtversion.h
@@ -49,12 +49,9 @@ public:
QString type() const;
bool isValid() const;
- QString systemRoot() const;
- QList<ProjectExplorer::Abi> detectQtAbis() const;
- void addToEnvironment(Utils::Environment &env) const;
- bool supportsTargetId(const Core::Id id) const;
- QSet<Core::Id> supportedTargetIds() const;
+ QList<ProjectExplorer::Abi> detectQtAbis() const;
+ void addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const;
QString description() const;
diff --git a/src/plugins/madde/maemoremotemounter.cpp b/src/plugins/madde/maemoremotemounter.cpp
index acc313a046..9aa09fc7c9 100644
--- a/src/plugins/madde/maemoremotemounter.cpp
+++ b/src/plugins/madde/maemoremotemounter.cpp
@@ -33,8 +33,10 @@
#include "maemoremotemounter.h"
#include "maemoglobal.h"
-#include "qt4maemotarget.h"
+#include "maddedevice.h"
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/target.h>
#include <ssh/sshconnection.h>
#include <ssh/sshremoteprocess.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
@@ -79,11 +81,9 @@ void MaemoRemoteMounter::setBuildConfiguration(const Qt4BuildConfiguration *bc)
{
QTC_ASSERT(m_state == Inactive, return);
- const QtSupport::BaseQtVersion * const qtVersion = bc->qtVersion();
- const AbstractQt4MaemoTarget * const maemoTarget
- = qobject_cast<AbstractQt4MaemoTarget *>(bc->target());
- m_remoteMountsAllowed = maemoTarget && maemoTarget->allowsRemoteMounts();
- m_maddeRoot = qtVersion ? MaemoGlobal::maddeRoot(qtVersion->qmakeCommand().toString()) : QString();
+ Core::Id typeId = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(bc->target()->profile());
+ m_remoteMountsAllowed = MaddeDevice::allowsRemoteMounts(typeId);
+ m_maddeRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(bc->target()->profile());
}
void MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mountSpec,
@@ -297,7 +297,7 @@ void MaemoRemoteMounter::startUtfsServers()
connect(utfsServerProc.data(), SIGNAL(readyReadStandardError()), this,
SLOT(handleUtfsServerStderr()));
m_utfsServers << utfsServerProc;
- utfsServerProc->start(utfsServer(), utfsServerArgs);
+ utfsServerProc->start(utfsServer().toString(), utfsServerArgs);
}
setState(UtfsServersStarted);
@@ -342,9 +342,10 @@ QString MaemoRemoteMounter::utfsClientOnDevice() const
return QLatin1String("/usr/lib/mad-developer/utfs-client");
}
-QString MaemoRemoteMounter::utfsServer() const
+Utils::FileName MaemoRemoteMounter::utfsServer() const
{
- return m_maddeRoot + QLatin1String("/madlib/utfs-server");
+ Utils::FileName result = m_maddeRoot;
+ return result.appendPath(QLatin1String("madlib/utfs-server"));
}
void MaemoRemoteMounter::killAllUtfsServers()
diff --git a/src/plugins/madde/maemoremotemounter.h b/src/plugins/madde/maemoremotemounter.h
index 111e1fb60c..2f5524d3ef 100644
--- a/src/plugins/madde/maemoremotemounter.h
+++ b/src/plugins/madde/maemoremotemounter.h
@@ -35,6 +35,8 @@
#include "maemomountspecification.h"
+#include <utils/fileutils.h>
+
#include <QList>
#include <QObject>
#include <QProcess>
@@ -111,7 +113,7 @@ private:
void killUtfsServer(QProcess *proc);
void killAllUtfsServers();
QString utfsClientOnDevice() const;
- QString utfsServer() const;
+ Utils::FileName utfsServer() const;
QTimer * const m_utfsServerTimer;
@@ -135,7 +137,7 @@ private:
Utils::PortList *m_freePorts;
const RemoteLinux::RemoteLinuxUsedPortsGatherer *m_portsGatherer;
bool m_remoteMountsAllowed;
- QString m_maddeRoot;
+ Utils::FileName m_maddeRoot;
State m_state;
};
diff --git a/src/plugins/madde/maemorunconfiguration.cpp b/src/plugins/madde/maemorunconfiguration.cpp
index d548b49735..a90df58b61 100644
--- a/src/plugins/madde/maemorunconfiguration.cpp
+++ b/src/plugins/madde/maemorunconfiguration.cpp
@@ -30,7 +30,7 @@
**************************************************************************/
#include "maemorunconfiguration.h"
-#include "qt4maemotarget.h"
+#include "maddedevice.h"
#include "maemoconstants.h"
#include "maemoglobal.h"
#include "maemoremotemountsmodel.h"
@@ -40,7 +40,9 @@
#include <debugger/debuggerconstants.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
+#include <qtsupport/qtprofileinformation.h>
#include <utils/portlist.h>
#include <ssh/sshconnection.h>
@@ -54,14 +56,14 @@ using namespace RemoteLinux;
namespace Madde {
namespace Internal {
-MaemoRunConfiguration::MaemoRunConfiguration(AbstractQt4MaemoTarget *parent,
+MaemoRunConfiguration::MaemoRunConfiguration(Target *parent, Core::Id id,
const QString &proFilePath)
- : RemoteLinuxRunConfiguration(parent, Id, proFilePath)
+ : RemoteLinuxRunConfiguration(parent, id, proFilePath)
{
init();
}
-MaemoRunConfiguration::MaemoRunConfiguration(AbstractQt4MaemoTarget *parent,
+MaemoRunConfiguration::MaemoRunConfiguration(Target *parent,
MaemoRunConfiguration *source)
: RemoteLinuxRunConfiguration(parent, source)
{
@@ -79,7 +81,7 @@ void MaemoRunConfiguration::init()
SLOT(handleRemoteMountsChanged()));
connect(m_remoteMounts, SIGNAL(modelReset()), SLOT(handleRemoteMountsChanged()));
- if (!maemoTarget()->allowsQmlDebugging())
+ if (DeviceTypeProfileInformation::deviceTypeId(target()->profile()) != Core::Id(HarmattanOsType))
debuggerAspect()->suppressQmlDebuggingOptions();
}
@@ -121,11 +123,14 @@ QString MaemoRunConfiguration::environmentPreparationCommand() const
QString MaemoRunConfiguration::commandPrefix() const
{
- if (!deviceConfig())
+ LinuxDeviceConfiguration::ConstPtr dev =
+ ProjectExplorer::DeviceProfileInformation::device(target()->profile())
+ .dynamicCast<const LinuxDeviceConfiguration>();
+ if (!dev)
return QString();
QString prefix = environmentPreparationCommand() + QLatin1Char(';');
- if (deviceConfig()->type() == Core::Id(MeeGoOsType))
+ if (dev->type() == Core::Id(MeeGoOsType))
prefix += QLatin1String("DISPLAY=:0.0 ");
return QString::fromLatin1("%1 %2").arg(prefix, userEnvironmentChangesAsString());
@@ -133,10 +138,9 @@ QString MaemoRunConfiguration::commandPrefix() const
Utils::PortList MaemoRunConfiguration::freePorts() const
{
- const Qt4BuildConfiguration * const bc = activeQt4BuildConfiguration();
- return bc && deployConfig()
- ? MaemoGlobal::freePorts(deployConfig()->deviceConfiguration(), bc->qtVersion())
- : Utils::PortList();
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
+ return MaemoGlobal::freePorts(ProjectExplorer::DeviceProfileInformation::device(target()->profile())
+ .staticCast<const LinuxDeviceConfiguration>(), version);
}
QString MaemoRunConfiguration::localDirToMountForRemoteGdb() const
@@ -160,7 +164,7 @@ QString MaemoRunConfiguration::localDirToMountForRemoteGdb() const
QString MaemoRunConfiguration::remoteProjectSourcesMountPoint() const
{
- return MaemoGlobal::homeDirOnDevice(deviceConfig()->sshParameters().userName)
+ return MaemoGlobal::homeDirOnDevice(ProjectExplorer::DeviceProfileInformation::device(target()->profile())->sshParameters().userName)
+ QLatin1String("/gdbSourcesDir_")
+ QFileInfo(localExecutableFilePath()).fileName();
}
@@ -168,7 +172,8 @@ QString MaemoRunConfiguration::remoteProjectSourcesMountPoint() const
bool MaemoRunConfiguration::hasEnoughFreePorts(RunMode mode) const
{
const int freePortCount = freePorts().count();
- const bool remoteMountsAllowed = maemoTarget()->allowsRemoteMounts();
+ Core::Id typeId = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target()->profile());
+ const bool remoteMountsAllowed = MaddeDevice::allowsRemoteMounts(typeId);
const int mountDirCount = remoteMountsAllowed
? remoteMounts()->validMountSpecificationCount() : 0;
if (mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain)
@@ -184,15 +189,5 @@ void MaemoRunConfiguration::handleRemoteMountsChanged()
updateEnabledState();
}
-const AbstractQt4MaemoTarget *MaemoRunConfiguration::maemoTarget() const
-{
- const AbstractQt4MaemoTarget * const maemoTarget
- = qobject_cast<AbstractQt4MaemoTarget *>(target());
- Q_ASSERT(maemoTarget);
- return maemoTarget;
-}
-
-const Core::Id MaemoRunConfiguration::Id = Core::Id(MAEMO_RC_ID);
-
} // namespace Internal
} // namespace Madde
diff --git a/src/plugins/madde/maemorunconfiguration.h b/src/plugins/madde/maemorunconfiguration.h
index 49da9f8a4e..7db2c80576 100644
--- a/src/plugins/madde/maemorunconfiguration.h
+++ b/src/plugins/madde/maemorunconfiguration.h
@@ -35,7 +35,6 @@
namespace Madde {
namespace Internal {
-class AbstractQt4MaemoTarget;
class MaemoRemoteMountsModel;
class MaemoRunConfiguration : public RemoteLinux::RemoteLinuxRunConfiguration
@@ -43,8 +42,8 @@ class MaemoRunConfiguration : public RemoteLinux::RemoteLinuxRunConfiguration
Q_OBJECT
public:
- MaemoRunConfiguration(AbstractQt4MaemoTarget *parent, const QString &proFilePath);
- MaemoRunConfiguration(AbstractQt4MaemoTarget *parent, MaemoRunConfiguration *source);
+ MaemoRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &proFilePath);
+ MaemoRunConfiguration(ProjectExplorer::Target *parent, MaemoRunConfiguration *source);
QVariantMap toMap() const;
bool fromMap(const QVariantMap &map);
@@ -59,8 +58,6 @@ public:
QString localDirToMountForRemoteGdb() const;
QString remoteProjectSourcesMountPoint() const;
- static const Core::Id Id;
-
signals:
void remoteMountsChanged();
@@ -69,7 +66,6 @@ private slots:
private:
void init();
- const AbstractQt4MaemoTarget *maemoTarget() const;
MaemoRemoteMountsModel *m_remoteMounts;
};
diff --git a/src/plugins/madde/maemorunconfigurationwidget.cpp b/src/plugins/madde/maemorunconfigurationwidget.cpp
index 137f19d479..093143451b 100644
--- a/src/plugins/madde/maemorunconfigurationwidget.cpp
+++ b/src/plugins/madde/maemorunconfigurationwidget.cpp
@@ -31,16 +31,17 @@
#include "maemorunconfigurationwidget.h"
+#include "maddedevice.h"
#include "maemoglobal.h"
#include "maemoremotemountsmodel.h"
#include "maemorunconfiguration.h"
-#include "qt4maemotarget.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <projectexplorer/environmentwidget.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
-#include <qt4projectmanager/qt4target.h>
#include <remotelinux/remotelinuxrunconfigurationwidget.h>
#include <utils/detailswidget.h>
@@ -83,15 +84,13 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
QVBoxLayout *subLayout = new QVBoxLayout(m_subWidget);
subLayout->setMargin(0);
addMountWidgets(subLayout);
- connect(m_runConfiguration, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
- this, SLOT(updateMountWarning()));
+ connect(m_runConfiguration->target(), SIGNAL(profileChanged()), this, SLOT(updateMountWarning()));
connect(m_runConfiguration->debuggerAspect(), SIGNAL(debuggersChanged()),
SLOT(updateMountWarning()));
updateMountWarning();
- const AbstractQt4MaemoTarget * const maemoTarget
- = qobject_cast<AbstractQt4MaemoTarget *>(runConfiguration->target());
- m_mountDetailsContainer->setVisible(maemoTarget->allowsRemoteMounts());
+ Core::Id devId = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(runConfiguration->target()->profile());
+ m_mountDetailsContainer->setVisible(MaddeDevice::allowsRemoteMounts(devId));
connect(m_runConfiguration, SIGNAL(enabledChanged()),
this, SLOT(runConfigurationEnabledChange()));
diff --git a/src/plugins/madde/maemorunfactories.cpp b/src/plugins/madde/maemorunfactories.cpp
index d10ca6ea67..0d4ab92189 100644
--- a/src/plugins/madde/maemorunfactories.cpp
+++ b/src/plugins/madde/maemorunfactories.cpp
@@ -35,15 +35,17 @@
#include "maemoremotemountsmodel.h"
#include "maemorunconfiguration.h"
#include "maemoruncontrol.h"
-#include "maemotoolchain.h"
-#include "qt4maemotarget.h"
#include <debugger/debuggerconstants.h>
#include <debugger/debuggerstartparameters.h>
#include <debugger/debuggerplugin.h>
#include <debugger/debuggerrunner.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/target.h>
+#include <qt4projectmanager/qt4nodes.h>
#include <qt4projectmanager/qt4project.h>
+#include <qtsupport/customexecutablerunconfiguration.h>
using namespace Debugger;
using namespace ProjectExplorer;
@@ -57,7 +59,7 @@ namespace {
QString pathFromId(Core::Id id)
{
- QString idStr = QString::fromUtf8(id.name());
+ QString idStr = id.toString();
const QString prefix = QLatin1String(MAEMO_RC_ID_PREFIX);
if (!idStr.startsWith(prefix))
return QString();
@@ -67,9 +69,8 @@ QString pathFromId(Core::Id id)
} // namespace
MaemoRunConfigurationFactory::MaemoRunConfigurationFactory(QObject *parent)
- : IRunConfigurationFactory(parent)
-{
-}
+ : QmakeRunConfigurationFactory(parent)
+{ setObjectName(QLatin1String("MaemoRunConfigurationFactory")); }
MaemoRunConfigurationFactory::~MaemoRunConfigurationFactory()
{
@@ -77,35 +78,37 @@ MaemoRunConfigurationFactory::~MaemoRunConfigurationFactory()
bool MaemoRunConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
{
- return qobject_cast<Qt4BaseTarget *>(parent)->qt4Project()
- ->hasApplicationProFile(pathFromId(id));
+ if (!canHandle(parent))
+ return false;
+ return static_cast<Qt4Project *>(parent->project())->hasApplicationProFile(pathFromId(id));
}
bool MaemoRunConfigurationFactory::canRestore(Target *parent,
const QVariantMap &map) const
{
- Q_UNUSED(parent);
- return qobject_cast<AbstractQt4MaemoTarget *>(parent)
- && QString::fromUtf8(ProjectExplorer::idFromMap(map).name()).startsWith(QLatin1String(MAEMO_RC_ID));
+ return canHandle(parent)
+ && ProjectExplorer::idFromMap(map).toString().startsWith(QLatin1String(MAEMO_RC_ID_PREFIX));
}
bool MaemoRunConfigurationFactory::canClone(Target *parent,
RunConfiguration *source) const
{
+ if (!canHandle(parent))
+ return false;
const RemoteLinuxRunConfiguration * const rlrc
= qobject_cast<RemoteLinuxRunConfiguration *>(source);
QString idStr = QString::fromLatin1(source->id().name()) + QLatin1Char('.') + rlrc->proFilePath();
- return rlrc && canCreate(parent, Core::Id(idStr.toUtf8().constData()));
+ return rlrc && canCreate(parent, Core::Id(idStr));
}
QList<Core::Id> MaemoRunConfigurationFactory::availableCreationIds(Target *parent) const
{
QList<Core::Id> result;
- if (AbstractQt4MaemoTarget *t = qobject_cast<AbstractQt4MaemoTarget *>(parent)) {
- QStringList proFiles = t->qt4Project()->applicationProFilePathes(QLatin1String(MAEMO_RC_ID_PREFIX));
- foreach (const QString &pf, proFiles)
- result << Core::Id(pf.toUtf8().constData());
- }
+ if (!canHandle(parent))
+ return result;
+ QStringList proFiles = static_cast<Qt4Project *>(parent->project())->applicationProFilePathes(QLatin1String(MAEMO_RC_ID_PREFIX));
+ foreach (const QString &pf, proFiles)
+ result << Core::Id(pf);
return result;
}
@@ -119,8 +122,7 @@ RunConfiguration *MaemoRunConfigurationFactory::create(Target *parent, const Cor
{
if (!canCreate(parent, id))
return 0;
- return new MaemoRunConfiguration(qobject_cast<AbstractQt4MaemoTarget *>(parent),
- pathFromId(id));
+ return new MaemoRunConfiguration(parent, id, pathFromId(id));
}
RunConfiguration *MaemoRunConfigurationFactory::restore(Target *parent,
@@ -128,8 +130,10 @@ RunConfiguration *MaemoRunConfigurationFactory::restore(Target *parent,
{
if (!canRestore(parent, map))
return 0;
+
+ Core::Id id = ProjectExplorer::idFromMap(map);
MaemoRunConfiguration *rc
- = new MaemoRunConfiguration(qobject_cast<AbstractQt4MaemoTarget *>(parent), QString());
+ = new MaemoRunConfiguration(parent, id, pathFromId(id));
if (rc->fromMap(map))
return rc;
@@ -143,7 +147,28 @@ RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent, RunConfigu
return 0;
MaemoRunConfiguration *old = static_cast<MaemoRunConfiguration *>(source);
- return new MaemoRunConfiguration(static_cast<AbstractQt4MaemoTarget *>(parent), old);
+ return new MaemoRunConfiguration(parent, old);
+}
+
+bool MaemoRunConfigurationFactory::canHandle(Target *t) const
+{
+ if (!t->project()->supportsProfile(t->profile()))
+ return false;
+ if (!qobject_cast<Qt4Project *>(t->project()))
+ return false;
+ Core::Id devType = DeviceTypeProfileInformation::deviceTypeId(t->profile());
+ return devType == Core::Id(Maemo5OsType) || devType == Core::Id(HarmattanOsType)
+ || devType == Core::Id(MeeGoOsType);
+}
+
+QList<RunConfiguration *> MaemoRunConfigurationFactory::runConfigurationsForNode(Target *t, Node *n)
+{
+ QList<ProjectExplorer::RunConfiguration *> result;
+ foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations())
+ if (MaemoRunConfiguration *mrc = qobject_cast<MaemoRunConfiguration *>(rc))
+ if (mrc->proFilePath() == n->path())
+ result << rc;
+ return result;
}
// #pragma mark -- MaemoRunControlFactory
diff --git a/src/plugins/madde/maemorunfactories.h b/src/plugins/madde/maemorunfactories.h
index 797bacc6da..e6e4d0044c 100644
--- a/src/plugins/madde/maemorunfactories.h
+++ b/src/plugins/madde/maemorunfactories.h
@@ -32,13 +32,13 @@
#ifndef MAEMORUNFACTORIES_H
#define MAEMORUNFACTORIES_H
-#include <projectexplorer/runconfiguration.h>
+#include <qt4projectmanager/qmakerunconfigurationfactory.h>
namespace ProjectExplorer {
- class RunConfiguration;
- class RunControl;
- class Target;
-}
+class RunControl;
+class Target;
+} // namespace ProjectExplorer
+
using ProjectExplorer::IRunConfigurationFactory;
using ProjectExplorer::IRunControlFactory;
using ProjectExplorer::RunConfiguration;
@@ -49,7 +49,7 @@ using ProjectExplorer::Target;
namespace Madde {
namespace Internal {
-class MaemoRunConfigurationFactory : public IRunConfigurationFactory
+class MaemoRunConfigurationFactory : public Qt4ProjectManager::QmakeRunConfigurationFactory
{
Q_OBJECT
@@ -68,6 +68,10 @@ public:
bool canClone(Target *parent, RunConfiguration *source) const;
RunConfiguration *clone(Target *parent, RunConfiguration *source);
+
+ bool canHandle(ProjectExplorer::Target *t) const;
+ QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
+ ProjectExplorer::Node *n);
};
class MaemoRunControlFactory : public IRunControlFactory
diff --git a/src/plugins/madde/maemosshrunner.cpp b/src/plugins/madde/maemosshrunner.cpp
index 5d29a169fb..15a35269b9 100644
--- a/src/plugins/madde/maemosshrunner.cpp
+++ b/src/plugins/madde/maemosshrunner.cpp
@@ -35,7 +35,9 @@
#include "maemoremotemountsmodel.h"
#include "maemorunconfiguration.h"
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
+#include <qtsupport/qtprofileinformation.h>
#include <remotelinux/linuxdeviceconfiguration.h>
#include <utils/qtcassert.h>
#include <ssh/sshconnection.h>
@@ -54,7 +56,7 @@ MaemoSshRunner::MaemoSshRunner(QObject *parent, MaemoRunConfiguration *runConfig
m_mountState(InactiveMountState)
{
const Qt4BuildConfiguration * const bc = runConfig->activeQt4BuildConfiguration();
- m_qtId = bc && bc->qtVersion() ? bc->qtVersion()->uniqueId() : -1;
+ m_qtId = bc ? QtSupport::QtProfileInformation::qtVersionId(bc->target()->profile()) : -1;
m_mounter->setBuildConfiguration(bc);
connect(m_mounter, SIGNAL(mounted()), this, SLOT(handleMounted()));
connect(m_mounter, SIGNAL(unmounted()), this, SLOT(handleUnmounted()));
diff --git a/src/plugins/madde/maemotoolchain.cpp b/src/plugins/madde/maemotoolchain.cpp
deleted file mode 100644
index 848198199f..0000000000
--- a/src/plugins/madde/maemotoolchain.cpp
+++ /dev/null
@@ -1,323 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "maemotoolchain.h"
-
-#include "maemoglobal.h"
-#include "maemoqtversion.h"
-
-#include <projectexplorer/gccparser.h>
-#include <projectexplorer/headerpath.h>
-#include <projectexplorer/toolchainmanager.h>
-#include <qt4projectmanager/qt4projectmanagerconstants.h>
-#include <utils/environment.h>
-#include <qtsupport/qtversionmanager.h>
-
-#include <QDir>
-#include <QFileInfo>
-#include <QLabel>
-#include <QVBoxLayout>
-
-using namespace Qt4ProjectManager;
-
-namespace Madde {
-namespace Internal {
-
-static const char *const MAEMO_QT_VERSION_KEY = "Qt4ProjectManager.Maemo.QtVersion";
-
-// --------------------------------------------------------------------------
-// MaemoToolChain
-// --------------------------------------------------------------------------
-
-MaemoToolChain::MaemoToolChain(bool autodetected) :
- ProjectExplorer::GccToolChain(QLatin1String(Constants::MAEMO_TOOLCHAIN_ID), autodetected),
- m_qtVersionId(-1)
-{
- setQtVersionId(-1);
-}
-
-MaemoToolChain::MaemoToolChain(const MaemoToolChain &tc) :
- ProjectExplorer::GccToolChain(tc)
-{
- setQtVersionId(tc.m_qtVersionId);
-}
-
-MaemoToolChain::~MaemoToolChain()
-{ }
-
-QString MaemoToolChain::type() const
-{
- return QLatin1String("maemogcc");
-}
-
-QString MaemoToolChain::typeDisplayName() const
-{
- return MaemoToolChainFactory::tr("Maemo GCC");
-}
-
-bool MaemoToolChain::isValid() const
-{
- return GccToolChain::isValid() && m_qtVersionId >= 0 && targetAbi().isValid();
-}
-
-bool MaemoToolChain::canClone() const
-{
- return false;
-}
-
-void MaemoToolChain::addToEnvironment(Utils::Environment &env) const
-{
- const QString manglePathsKey = QLatin1String("GCCWRAPPER_PATHMANGLE");
- if (!env.hasKey(manglePathsKey)) {
- const QStringList pathsToMangle = QStringList() << QLatin1String("/lib")
- << QLatin1String("/opt") << QLatin1String("/usr");
- env.set(manglePathsKey, QString());
- foreach (const QString &path, pathsToMangle)
- env.appendOrSet(manglePathsKey, path, QLatin1String(":"));
- }
-}
-
-bool MaemoToolChain::operator ==(const ProjectExplorer::ToolChain &tc) const
-{
- if (!ToolChain::operator ==(tc))
- return false;
-
- const MaemoToolChain *tcPtr = static_cast<const MaemoToolChain *>(&tc);
- return m_qtVersionId == tcPtr->m_qtVersionId;
-}
-
-ProjectExplorer::ToolChainConfigWidget *MaemoToolChain::configurationWidget()
-{
- return new MaemoToolChainConfigWidget(this);
-}
-
-QVariantMap MaemoToolChain::toMap() const
-{
- QVariantMap result = GccToolChain::toMap();
- result.insert(QLatin1String(MAEMO_QT_VERSION_KEY), m_qtVersionId);
- return result;
-}
-
-bool MaemoToolChain::fromMap(const QVariantMap &data)
-{
- if (!GccToolChain::fromMap(data))
- return false;
-
- m_qtVersionId = data.value(QLatin1String(MAEMO_QT_VERSION_KEY), -1).toInt();
-
- return isValid();
-}
-
-void MaemoToolChain::setQtVersionId(int id)
-{
- if (id < 0) {
- setTargetAbi(ProjectExplorer::Abi());
- m_qtVersionId = -1;
- toolChainUpdated();
- return;
- }
-
- MaemoQtVersion *version = dynamic_cast<MaemoQtVersion *>(QtSupport::QtVersionManager::instance()->version(id));
- Q_ASSERT(version);
- if (!version->isValid())
- return;
- Q_ASSERT(version->qtAbis().count() == 1);
-
- m_qtVersionId = id;
- setTargetAbi(version->qtAbis().at(0));
-
- toolChainUpdated();
-
- setDisplayName(MaemoToolChainFactory::tr("Maemo GCC for %1").arg(version->displayName()));
-}
-
-int MaemoToolChain::qtVersionId() const
-{
- return m_qtVersionId;
-}
-
-QString MaemoToolChain::legacyId() const
-{
- return QString::fromLatin1("%1:%2.%3").arg(Constants::MAEMO_TOOLCHAIN_ID)
- .arg(m_qtVersionId)
- .arg(debuggerCommand().toString());
-}
-
-QList<ProjectExplorer::Abi> MaemoToolChain::detectSupportedAbis() const
-{
- if (m_qtVersionId < 0)
- return QList<ProjectExplorer::Abi>();
-
- MaemoQtVersion *mqv = dynamic_cast<MaemoQtVersion *>(QtSupport::QtVersionManager::instance()->version(m_qtVersionId));
- if (!mqv)
- return QList<ProjectExplorer::Abi>();
-
- return mqv->qtAbis();
-}
-
-// --------------------------------------------------------------------------
-// MaemoToolChainConfigWidget
-// --------------------------------------------------------------------------
-
-MaemoToolChainConfigWidget::MaemoToolChainConfigWidget(MaemoToolChain *tc) :
- ProjectExplorer::ToolChainConfigWidget(tc)
-{
- QVBoxLayout *layout = new QVBoxLayout(this);
- QLabel *label = new QLabel;
- QtSupport::BaseQtVersion *v = QtSupport::QtVersionManager::instance()->version(tc->qtVersionId());
- Q_ASSERT(v);
- label->setText(tr("<html><head/><body><table>"
- "<tr><td>Path to MADDE:</td><td>%1</td></tr>"
- "<tr><td>Path to MADDE target:</td><td>%2</td></tr>"
- "<tr><td>Debugger:</td/><td>%3</td></tr></body></html>")
- .arg(QDir::toNativeSeparators(MaemoGlobal::maddeRoot(v->qmakeCommand().toString())),
- QDir::toNativeSeparators(MaemoGlobal::targetRoot(v->qmakeCommand().toString())),
- tc->debuggerCommand().toUserOutput()));
- layout->addWidget(label);
-}
-
-void MaemoToolChainConfigWidget::apply()
-{
- // nothing to do!
-}
-
-void MaemoToolChainConfigWidget::discard()
-{
- // nothing to do!
-}
-
-bool MaemoToolChainConfigWidget::isDirty() const
-{
- return false;
-}
-
-// --------------------------------------------------------------------------
-// MaemoToolChainFactory
-// --------------------------------------------------------------------------
-
-MaemoToolChainFactory::MaemoToolChainFactory() :
- ProjectExplorer::ToolChainFactory()
-{ }
-
-QString MaemoToolChainFactory::displayName() const
-{
- return tr("Maemo GCC");
-}
-
-QString MaemoToolChainFactory::id() const
-{
- return QLatin1String(Constants::MAEMO_TOOLCHAIN_ID);
-}
-
-QList<ProjectExplorer::ToolChain *> MaemoToolChainFactory::autoDetect()
-{
- QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
- connect(vm, SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
- this, SLOT(handleQtVersionChanges(QList<int>,QList<int>,QList<int>)));
-
- QList<int> versionList;
- foreach (QtSupport::BaseQtVersion *v, vm->versions())
- versionList.append(v->uniqueId());
-
- return createToolChainList(versionList);
-}
-
-bool MaemoToolChainFactory::canRestore(const QVariantMap &data)
-{
- return idFromMap(data).startsWith(QLatin1String(Constants::MAEMO_TOOLCHAIN_ID) + QLatin1Char(':'));
-}
-
-ProjectExplorer::ToolChain *MaemoToolChainFactory::restore(const QVariantMap &data)
-{
- MaemoToolChain *tc = new MaemoToolChain(false);
- if (tc->fromMap(data))
- return tc;
-
- delete tc;
- return 0;
-}
-
-void MaemoToolChainFactory::handleQtVersionChanges(const QList<int> &added, const QList<int> &removed, const QList<int> &changed)
-{
- QList<int> changes;
- changes << added << removed << changed;
- ProjectExplorer::ToolChainManager *tcm = ProjectExplorer::ToolChainManager::instance();
- QList<ProjectExplorer::ToolChain *> tcList = createToolChainList(changes);
- foreach (ProjectExplorer::ToolChain *tc, tcList)
- tcm->registerToolChain(tc);
-}
-
-QList<ProjectExplorer::ToolChain *> MaemoToolChainFactory::createToolChainList(const QList<int> &changes)
-{
- ProjectExplorer::ToolChainManager *tcm = ProjectExplorer::ToolChainManager::instance();
- QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
- QList<ProjectExplorer::ToolChain *> result;
-
- foreach (int i, changes) {
- QtSupport::BaseQtVersion *v = vm->version(i);
- // remove tool chain (on removal, change or addition:
- QList<ProjectExplorer::ToolChain *> toRemove;
- foreach (ProjectExplorer::ToolChain *tc, tcm->toolChains()) {
- if (!tc->id().startsWith(QLatin1String(Constants::MAEMO_TOOLCHAIN_ID)))
- continue;
- MaemoToolChain *mTc = static_cast<MaemoToolChain *>(tc);
- if (mTc->qtVersionId() == i)
- toRemove.append(mTc);
- }
- foreach (ProjectExplorer::ToolChain *tc, toRemove)
- tcm->deregisterToolChain(tc);
-
- const MaemoQtVersion * const mqv = dynamic_cast<MaemoQtVersion *>(v);
- if (!mqv || !mqv->isValid() || mqv->qtAbis().isEmpty())
- continue;
-
- // (Re-)add toolchain:
- // add tool chain:
- MaemoToolChain *mTc = new MaemoToolChain(true);
- mTc->setQtVersionId(i);
- QString target = "Maemo 5";
- if (v->supportsTargetId(Constants::HARMATTAN_DEVICE_TARGET_ID))
- target = "Maemo 6";
- else if (v->supportsTargetId(Constants::MEEGO_DEVICE_TARGET_ID))
- target = "Meego";
- mTc->setDisplayName(tr("%1 GCC (%2)").arg(target).arg(MaemoGlobal::maddeRoot(mqv->qmakeCommand().toString())));
- mTc->setCompilerCommand(Utils::FileName::fromString(MaemoGlobal::targetRoot(mqv->qmakeCommand().toString()) + QLatin1String("/bin/gcc")));
- mTc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(mqv->qtAbis().at(0)));
- if (mTc->debuggerCommand().isEmpty())
- mTc->setDebuggerCommand(Utils::FileName::fromString(MaemoGlobal::targetRoot(mqv->qmakeCommand().toString()) + QLatin1String("/bin/gdb")));
- result.append(mTc);
- }
- return result;
-}
-
-} // namespace Internal
-} // namespace Madde
diff --git a/src/plugins/madde/maemotoolchain.h b/src/plugins/madde/maemotoolchain.h
deleted file mode 100644
index 845f124294..0000000000
--- a/src/plugins/madde/maemotoolchain.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef MAEMOTOOLCHAIN_H
-#define MAEMOTOOLCHAIN_H
-
-#include <projectexplorer/gcctoolchain.h>
-#include <projectexplorer/toolchainconfigwidget.h>
-
-namespace Madde {
-namespace Internal {
-
-// --------------------------------------------------------------------------
-// MaemoToolChain
-// --------------------------------------------------------------------------
-
-class MaemoToolChain : public ProjectExplorer::GccToolChain
-{
-public:
- ~MaemoToolChain();
-
- QString type() const;
- QString typeDisplayName() const;
-
- bool isValid() const;
- bool canClone() const;
-
- void addToEnvironment(Utils::Environment &env) const;
-
- bool operator ==(const ProjectExplorer::ToolChain &) const;
-
- ProjectExplorer::ToolChainConfigWidget *configurationWidget();
-
- QVariantMap toMap() const;
- bool fromMap(const QVariantMap &data);
-
- void setQtVersionId(int);
- int qtVersionId() const;
-
- QString legacyId() const;
-
-protected:
- QList<ProjectExplorer::Abi> detectSupportedAbis() const;
-
-private:
- explicit MaemoToolChain(bool);
- MaemoToolChain(const MaemoToolChain &);
-
- int m_qtVersionId;
- mutable QString m_sysroot;
-
- friend class MaemoToolChainFactory;
-};
-
-// --------------------------------------------------------------------------
-// MaemoToolChainConfigWidget
-// --------------------------------------------------------------------------
-
-class MaemoToolChainConfigWidget : public ProjectExplorer::ToolChainConfigWidget
-{
- Q_OBJECT
-
-public:
- MaemoToolChainConfigWidget(MaemoToolChain *);
-
- void apply();
- void discard();
- bool isDirty() const;
-};
-
-// --------------------------------------------------------------------------
-// MaemoToolChainFactory
-// --------------------------------------------------------------------------
-
-class MaemoToolChainFactory : public ProjectExplorer::ToolChainFactory
-{
- Q_OBJECT
-
-public:
- MaemoToolChainFactory();
-
- QString displayName() const;
- QString id() const;
-
- QList<ProjectExplorer::ToolChain *> autoDetect();
-
- bool canRestore(const QVariantMap &data);
- ProjectExplorer::ToolChain *restore(const QVariantMap &data);
-
-private slots:
- void handleQtVersionChanges(const QList<int> &added, const QList<int> &removed, const QList<int> &changed);
- QList<ProjectExplorer::ToolChain *> createToolChainList(const QList<int> &changes);
-};
-
-} // namespace Internal
-} // namespace Madde
-
-#endif // MAEMOTOOLCHAIN_H
diff --git a/src/plugins/madde/qt4maemodeployconfiguration.cpp b/src/plugins/madde/qt4maemodeployconfiguration.cpp
index cbc8f367c0..053b1bc9d5 100644
--- a/src/plugins/madde/qt4maemodeployconfiguration.cpp
+++ b/src/plugins/madde/qt4maemodeployconfiguration.cpp
@@ -31,16 +31,24 @@
**************************************************************************/
#include "qt4maemodeployconfiguration.h"
+#include "debianmanager.h"
#include "maddeuploadandinstallpackagesteps.h"
#include "maemoconstants.h"
#include "maemodeploybymountsteps.h"
#include "maemodeployconfigurationwidget.h"
+#include "maemoglobal.h"
#include "maemoinstalltosysrootstep.h"
#include "maemopackagecreationstep.h"
-#include "qt4maemotarget.h"
+#include "rpmmanager.h"
+#include <coreplugin/icore.h>
#include <projectexplorer/buildsteplist.h>
-#include <qt4projectmanager/qt4target.h>
+#include <projectexplorer/target.h>
+#include <projectexplorer/projectexplorer.h>
+#include <qt4projectmanager/qt4buildconfiguration.h>
+#include <qt4projectmanager/qt4project.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
#include <remotelinux/deployablefile.h>
#include <remotelinux/deployablefilesperprofile.h>
#include <remotelinux/deploymentinfo.h>
@@ -50,27 +58,30 @@
#include <QFileInfo>
#include <QString>
+#include <QMainWindow>
+#include <QMessageBox>
+
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
using namespace RemoteLinux;
-namespace Madde {
-namespace Internal {
namespace {
const QString OldDeployConfigId = QLatin1String("2.2MaemoDeployConfig");
+const char DEPLOYMENT_ASSISTANT_SETTING[] = "RemoteLinux.DeploymentAssistant";
} // namespace
+namespace Madde {
+namespace Internal {
+
Qt4MaemoDeployConfiguration::Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target,
const Core::Id id, const QString &displayName)
: RemoteLinuxDeployConfiguration(target, id, displayName)
-{
-}
+{ init(); }
Qt4MaemoDeployConfiguration::Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target,
Qt4MaemoDeployConfiguration *source)
: RemoteLinuxDeployConfiguration(target, source)
-{
-}
+{ init(); }
QString Qt4MaemoDeployConfiguration::localDesktopFilePath(const DeployableFilesPerProFile *proFileInfo) const
{
@@ -112,21 +123,176 @@ Core::Id Qt4MaemoDeployConfiguration::meegoId()
return Core::Id("DeployToMeego");
}
+DeploymentSettingsAssistant *Qt4MaemoDeployConfiguration::deploymentSettingsAssistant()
+{
+ return static_cast<DeploymentSettingsAssistant *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_ASSISTANT_SETTING)).value<QObject *>());
+}
+
+QString Qt4MaemoDeployConfiguration::qmakeScope() const
+{
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target()->profile());
+
+ if (deviceType == Core::Id(Maemo5OsType))
+ return QLatin1String("maemo5");
+ else if (deviceType == Core::Id(HarmattanOsType))
+ return QLatin1String("contains(MEEGO_EDITION,harmattan)");
+ else if (deviceType == Core::Id(MeeGoOsType))
+ return QLatin1String("!isEmpty(MEEGO_VERSION_MAJOR):!contains(MEEGO_EDITION,harmattan)");
+ return QString("unix");
+}
+
+QString Qt4MaemoDeployConfiguration::installPrefix() const
+{
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target()->profile());
+
+ if (deviceType == Core::Id(Maemo5OsType))
+ return QLatin1String("/opt");
+ else if (deviceType == Core::Id(HarmattanOsType))
+ return QLatin1String("/opt");
+ else if (deviceType == Core::Id(MeeGoOsType))
+ return QLatin1String("/opt");
+ return QString("unix");
+}
+
+void Qt4MaemoDeployConfiguration::debianDirChanged(const Utils::FileName &dir)
+{
+ if (dir == DebianManager::debianDirectory(target()))
+ emit packagingChanged();
+}
+
+void Qt4MaemoDeployConfiguration::setupPackaging()
+{
+ if (target()->project()->activeTarget() != target())
+ return;
+
+ disconnect(target()->project(), SIGNAL(fileListChanged()), this, SLOT(setupPackaging()));
+
+ if (id() == Qt4MaemoDeployConfiguration::meegoId())
+ ;
+ else
+ setupDebianPackaging();
+}
+
+void Qt4MaemoDeployConfiguration::setupDebianPackaging()
+{
+ Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(target()->activeBuildConfiguration());
+ if (!bc || !target()->profile())
+ return;
+
+ Utils::FileName debianDir = DebianManager::debianDirectory(target());
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target()->profile());
+ DebianManager *dm = DebianManager::instance();
+ QString projectName = target()->project()->displayName();
+
+ DebianManager::ActionStatus status = DebianManager::createTemplate(bc, debianDir);
+
+ if (status == DebianManager::NoActionRequired ||
+ status == DebianManager::ActionFailed)
+ return;
+
+ if (!DebianManager::hasPackageManagerIcon(debianDir)) {
+ // Such a file is created by the mobile wizards.
+ Utils::FileName iconPath = Utils::FileName::fromString(target()->project()->projectDirectory());
+ iconPath.appendPath(projectName + QLatin1String("64.png"));
+ if (iconPath.toFileInfo().exists())
+ dm->setPackageManagerIcon(debianDir, deviceType, iconPath);
+ }
+
+
+
+ dm->monitor(debianDir);
+ connect(dm, SIGNAL(debianDirectoryChanged(Utils::FileName)), this, SLOT(debianDirChanged(Utils::FileName)));
+
+ // Set up aegis manifest on harmattan:
+ if (deviceType == Core::Id(HarmattanOsType)) {
+ Utils::FileName manifest = debianDir;
+ const QString manifestName = QLatin1String("manifest.aegis");
+ manifest.appendPath(manifestName);
+ const QFile aegisFile(manifest.toString());
+ if (!aegisFile.exists()) {
+ Utils::FileReader reader;
+ if (!reader.fetch(Core::ICore::resourcePath()
+ + QLatin1String("/templates/shared/") + manifestName)) {
+ qDebug("Reading manifest template failed.");
+ return;
+ }
+ QString content = QString::fromUtf8(reader.data());
+ content.replace(QLatin1String("%%PROJECTNAME%%"), projectName);
+ Utils::FileSaver writer(aegisFile.fileName(), QIODevice::WriteOnly);
+ writer.write(content.toUtf8());
+ if (!writer.finalize()) {
+ qDebug("Failure writing manifest file.");
+ return;
+ }
+ }
+ }
+
+ emit packagingChanged();
+
+ // fix path:
+ QStringList files = DebianManager::debianFiles(debianDir);
+ Utils::FileName path = Utils::FileName::fromString(QDir(target()->project()->projectDirectory())
+ .relativeFilePath(debianDir.toString()));
+ QStringList relativeFiles;
+ foreach (const QString &f, files) {
+ Utils::FileName fn = path;
+ fn.appendPath(f);
+ relativeFiles << fn.toString();
+ }
+
+ addFilesToProject(relativeFiles);
+}
+
+void Qt4MaemoDeployConfiguration::addFilesToProject(const QStringList &files)
+{
+ if (files.isEmpty())
+ return;
+
+ const QString list = QLatin1String("<ul><li>") + files.join(QLatin1String("</li><li>"))
+ + QLatin1String("</li></ul>");
+ QMessageBox::StandardButton button =
+ QMessageBox::question(Core::ICore::mainWindow(),
+ tr("Add Packaging Files to Project"),
+ tr("<html>Qt Creator has set up the following files to enable "
+ "packaging:\n %1\nDo you want to add them to the project?</html>")
+ .arg(list), QMessageBox::Yes | QMessageBox::No);
+ if (button == QMessageBox::Yes)
+ ProjectExplorer::ProjectExplorerPlugin::instance()
+ ->addExistingFiles(target()->project()->rootProjectNode(), 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()));
+}
+
Qt4MaemoDeployConfigurationFactory::Qt4MaemoDeployConfigurationFactory(QObject *parent)
: DeployConfigurationFactory(parent)
-{ }
+{ setObjectName(QLatin1String("Qt4MaemoDeployConfigurationFactory")); }
QList<Core::Id> Qt4MaemoDeployConfigurationFactory::availableCreationIds(Target *parent) const
{
QList<Core::Id> ids;
- if (qobject_cast<Qt4Maemo5Target *>(parent)) {
+ if (!qobject_cast<Qt4ProjectManager::Qt4Project *>(parent->project()))
+ return ids;
+
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->profile());
+ if (deviceType == Core::Id(Maemo5OsType))
ids << Qt4MaemoDeployConfiguration::fremantleWithPackagingId()
<< Qt4MaemoDeployConfiguration::fremantleWithoutPackagingId();
- } else if (qobject_cast<Qt4HarmattanTarget *>(parent)) {
+ else if (deviceType == Core::Id(HarmattanOsType))
ids << Qt4MaemoDeployConfiguration::harmattanId();
- } else if (qobject_cast<Qt4MeegoTarget *>(parent)) {
+ else if (deviceType == Core::Id(MeeGoOsType))
ids << Qt4MaemoDeployConfiguration::meegoId();
- }
return ids;
}
@@ -180,26 +346,25 @@ DeployConfiguration *Qt4MaemoDeployConfigurationFactory::create(Target *parent,
return dc;
}
-bool Qt4MaemoDeployConfigurationFactory::canRestore(Target *parent,
- const QVariantMap &map) const
+bool Qt4MaemoDeployConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
{
return canCreate(parent, idFromMap(map))
|| (idFromMap(map) == Core::Id(OldDeployConfigId)
- && qobject_cast<AbstractQt4MaemoTarget *>(parent));
+ && MaemoGlobal::supportsMaemoDevice(parent->profile()));
}
-DeployConfiguration *Qt4MaemoDeployConfigurationFactory::restore(Target *parent,
- const QVariantMap &map)
+DeployConfiguration *Qt4MaemoDeployConfigurationFactory::restore(Target *parent, const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
Core::Id id = idFromMap(map);
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->profile());
if (id == Core::Id(OldDeployConfigId)) {
- if (qobject_cast<Qt4Maemo5Target *>(parent))
+ if (deviceType == Core::Id(Maemo5OsType))
id = Qt4MaemoDeployConfiguration::fremantleWithPackagingId();
- else if (qobject_cast<Qt4HarmattanTarget *>(parent))
+ else if (deviceType == Core::Id(HarmattanOsType))
id = Qt4MaemoDeployConfiguration::harmattanId();
- else if (qobject_cast<Qt4MeegoTarget *>(parent))
+ else if (deviceType == Core::Id(MeeGoOsType))
id = Qt4MaemoDeployConfiguration::meegoId();
}
Qt4MaemoDeployConfiguration * const dc
diff --git a/src/plugins/madde/qt4maemodeployconfiguration.h b/src/plugins/madde/qt4maemodeployconfiguration.h
index 299552bd84..4a809f06fc 100644
--- a/src/plugins/madde/qt4maemodeployconfiguration.h
+++ b/src/plugins/madde/qt4maemodeployconfiguration.h
@@ -33,12 +33,14 @@
#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 {
@@ -78,7 +80,20 @@ public:
static Core::Id harmattanId();
static Core::Id meegoId();
+ RemoteLinux::DeploymentSettingsAssistant *deploymentSettingsAssistant();
+
+ QString qmakeScope() const;
+ QString installPrefix() const;
+
+private slots:
+ void debianDirChanged(const Utils::FileName &dir);
+ void setupPackaging();
+
private:
+ void init();
+ void setupDebianPackaging();
+ void addFilesToProject(const QStringList &files);
+
friend class Internal::Qt4MaemoDeployConfigurationFactory;
Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target, const Core::Id id,
diff --git a/src/plugins/madde/qt4maemotarget.cpp b/src/plugins/madde/qt4maemotarget.cpp
deleted file mode 100644
index 6c5326a790..0000000000
--- a/src/plugins/madde/qt4maemotarget.cpp
+++ /dev/null
@@ -1,1271 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "qt4maemotarget.h"
-
-#include "maemoconstants.h"
-#include "maemoglobal.h"
-#include "maemopackagecreationstep.h"
-#include "maemorunconfiguration.h"
-#include "maemotoolchain.h"
-#include "qt4maemodeployconfiguration.h"
-
-#include <coreplugin/documentmanager.h>
-#include <coreplugin/icore.h>
-#include <coreplugin/iversioncontrol.h>
-#include <coreplugin/vcsmanager.h>
-#include <projectexplorer/abi.h>
-#include <projectexplorer/projectexplorer.h>
-#include <projectexplorer/projectnodes.h>
-#include <projectexplorer/toolchain.h>
-#include <qt4projectmanager/qt4project.h>
-#include <qt4projectmanager/qt4buildconfiguration.h>
-#include <qt4projectmanager/qt4nodes.h>
-#include <qtsupport/baseqtversion.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
-#include <remotelinux/deploymentsettingsassistant.h>
-#include <utils/fileutils.h>
-#include <utils/filesystemwatcher.h>
-#include <utils/qtcassert.h>
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QBuffer>
-#include <QDateTime>
-#include <QLocale>
-#include <QRegExp>
-#include <QDir>
-#include <QFile>
-#include <QFileInfo>
-#include <QProcess>
-#include <QStringList>
-#include <QIcon>
-#include <QMessageBox>
-
-#include <cctype>
-
-using namespace Qt4ProjectManager;
-using namespace RemoteLinux;
-
-namespace Madde {
-namespace Internal {
-
-namespace {
-const QByteArray NameFieldName("Package");
-const QByteArray IconFieldName("XB-Maemo-Icon-26");
-const QByteArray ShortDescriptionFieldName("Description");
-const QByteArray PackageFieldName("Package");
-const QLatin1String PackagingDirName("qtc_packaging");
-const QByteArray NameTag("Name");
-const QByteArray SummaryTag("Summary");
-const QByteArray VersionTag("Version");
-const QByteArray ReleaseTag("Release");
-
-bool adaptTagValue(QByteArray &document, const QByteArray &fieldName,
- const QByteArray &newFieldValue, bool caseSensitive)
-{
- QByteArray adaptedLine = fieldName + ": " + newFieldValue;
- const QByteArray completeTag = fieldName + ':';
- const int lineOffset = caseSensitive ? document.indexOf(completeTag)
- : document.toLower().indexOf(completeTag.toLower());
- if (lineOffset == -1) {
- document.append(adaptedLine).append('\n');
- return true;
- }
-
- int newlineOffset = document.indexOf('\n', lineOffset);
- bool updated = false;
- if (newlineOffset == -1) {
- newlineOffset = document.length();
- adaptedLine += '\n';
- updated = true;
- }
- const int replaceCount = newlineOffset - lineOffset;
- if (!updated && document.mid(lineOffset, replaceCount) != adaptedLine)
- updated = true;
- if (updated)
- document.replace(lineOffset, replaceCount, adaptedLine);
- return updated;
-}
-
-
-} // anonymous namespace
-
-
-AbstractQt4MaemoTarget::AbstractQt4MaemoTarget(Qt4Project *parent, const Core::Id id,
- const QString &qmakeScope) :
- AbstractEmbeddedLinuxTarget(parent, id),
- m_filesWatcher(new Utils::FileSystemWatcher(this)),
- m_deploymentSettingsAssistant(new DeploymentSettingsAssistant(qmakeScope,
- QLatin1String("/opt"), deploymentInfo())),
- m_isInitialized(false)
-{
- m_filesWatcher->setObjectName(QLatin1String("Qt4MaemoTarget"));
- setIcon(QIcon(":/projectexplorer/images/MaemoDevice.png"));
- connect(parent, SIGNAL(addedTarget(ProjectExplorer::Target*)),
- this, SLOT(handleTargetAdded(ProjectExplorer::Target*)));
- connect(parent, SIGNAL(fromMapFinished()),
- this, SLOT(handleFromMapFinished()));
-}
-
-AbstractQt4MaemoTarget::~AbstractQt4MaemoTarget()
-{ }
-
-QList<ProjectExplorer::ToolChain *> AbstractQt4MaemoTarget::possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const
-{
- QList<ProjectExplorer::ToolChain *> result;
-
- Qt4BuildConfiguration *qt4Bc = qobject_cast<Qt4BuildConfiguration *>(bc);
- if (!qt4Bc)
- return result;
-
- QList<ProjectExplorer::ToolChain *> candidates = Qt4BaseTarget::possibleToolChains(bc);
- foreach (ProjectExplorer::ToolChain *i, candidates) {
- MaemoToolChain *tc = dynamic_cast<MaemoToolChain *>(i);
- if (!tc || !qt4Bc->qtVersion())
- continue;
- if (tc->qtVersionId() == qt4Bc->qtVersion()->uniqueId())
- result.append(tc);
- }
-
- return result;
-}
-
-void AbstractQt4MaemoTarget::createApplicationProFiles(bool reparse)
-{
- if (!reparse)
- removeUnconfiguredCustomExectutableRunConfigurations();
-
- QList<Qt4ProFileNode *> profiles = qt4Project()->applicationProFiles();
- QSet<QString> paths;
- foreach (Qt4ProFileNode *pro, profiles)
- paths << pro->path();
-
- foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
- if (MaemoRunConfiguration *qt4rc = qobject_cast<MaemoRunConfiguration *>(rc))
- paths.remove(qt4rc->proFilePath());
-
- // Only add new runconfigurations if there are none.
- foreach (const QString &path, paths)
- addRunConfiguration(new MaemoRunConfiguration(this, path));
-
- // Oh still none? Add a custom executable runconfiguration
- if (runConfigurations().isEmpty()) {
- addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(this));
- }
-}
-
-QList<ProjectExplorer::RunConfiguration *> AbstractQt4MaemoTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
-{
- QList<ProjectExplorer::RunConfiguration *> result;
- foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
- if (MaemoRunConfiguration *mrc = qobject_cast<MaemoRunConfiguration *>(rc))
- if (mrc->proFilePath() == n->path())
- result << rc;
- return result;
-}
-
-bool AbstractQt4MaemoTarget::setProjectVersion(const QString &version,
- QString *error)
-{
- bool success = true;
- foreach (Target * const target, project()->targets()) {
- AbstractQt4MaemoTarget * const maemoTarget
- = qobject_cast<AbstractQt4MaemoTarget *>(target);
- if (maemoTarget) {
- if (!maemoTarget->setProjectVersionInternal(version, error))
- success = false;
- }
- }
- return success;
-}
-
-bool AbstractQt4MaemoTarget::setPackageName(const QString &name)
-{
- bool success = true;
- foreach (Target * const target, project()->targets()) {
- AbstractQt4MaemoTarget * const maemoTarget
- = qobject_cast<AbstractQt4MaemoTarget *>(target);
- if (maemoTarget) {
- if (!maemoTarget->setPackageNameInternal(name))
- success = false;
- }
- }
- return success;
-}
-
-bool AbstractQt4MaemoTarget::setShortDescription(const QString &description)
-{
- bool success = true;
- foreach (Target * const target, project()->targets()) {
- AbstractQt4MaemoTarget * const maemoTarget
- = qobject_cast<AbstractQt4MaemoTarget *>(target);
- if (maemoTarget) {
- if (!maemoTarget->setShortDescriptionInternal(description))
- success = false;
- }
- }
- return success;
-}
-
-QSharedPointer<QFile> AbstractQt4MaemoTarget::openFile(const QString &filePath,
- QIODevice::OpenMode mode, QString *error) const
-{
- const QString nativePath = QDir::toNativeSeparators(filePath);
- QSharedPointer<QFile> file(new QFile(filePath));
- if (!file->open(mode)) {
- if (error) {
- *error = tr("Cannot open file '%1': %2")
- .arg(nativePath, file->errorString());
- }
- file.clear();
- }
- return file;
-}
-
-void AbstractQt4MaemoTarget::handleFromMapFinished()
-{
- handleTargetAdded(this);
-}
-
-void AbstractQt4MaemoTarget::handleTargetAdded(ProjectExplorer::Target *target)
-{
- if (target != this)
- return;
-
- if (!project()->rootProjectNode()) {
- // Project is not fully setup yet, happens on new project
- // we wait for the fromMapFinished that comes afterwards
- return;
- }
-
- disconnect(project(), SIGNAL(fromMapFinished()),
- this, SLOT(handleFromMapFinished()));
- disconnect(project(), SIGNAL(addedTarget(ProjectExplorer::Target*)),
- this, SLOT(handleTargetAdded(ProjectExplorer::Target*)));
- connect(project(), SIGNAL(aboutToRemoveTarget(ProjectExplorer::Target*)),
- SLOT(handleTargetToBeRemoved(ProjectExplorer::Target*)));
- const ActionStatus status = createTemplates();
- if (status == ActionFailed)
- return;
- if (status == ActionSuccessful) // Don't do this when the packaging data already exists.
- initPackagingSettingsFromOtherTarget();
- handleTargetAddedSpecial();
- if (status == ActionSuccessful) {
- const QStringList &files = packagingFilePaths();
- if (!files.isEmpty()) {
- const QString list = QLatin1String("<ul><li>") + files.join(QLatin1String("</li><li>"))
- + QLatin1String("</li></ul>");
- QMessageBox::StandardButton button = QMessageBox::question(Core::ICore::mainWindow(),
- tr("Add Packaging Files to Project"),
- tr("<html>Qt Creator has set up the following files to enable "
- "packaging:\n %1\nDo you want to add them to the project?</html>")
- .arg(list), QMessageBox::Yes | QMessageBox::No);
- if (button == QMessageBox::Yes) {
- ProjectExplorer::ProjectExplorerPlugin::instance()
- ->addExistingFiles(project()->rootProjectNode(), files);
- }
- }
- }
-
- m_isInitialized = true;
-}
-
-void AbstractQt4MaemoTarget::handleTargetToBeRemoved(ProjectExplorer::Target *target)
-{
- if (target != this)
- return;
- if (!targetCanBeRemoved())
- return;
-
- const int answer = QMessageBox::warning(Core::ICore::mainWindow(),
- tr("Qt Creator"), tr("Do you want to remove the packaging files "
- "associated with the target '%1'?").arg(displayName()),
- QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
- if (answer == QMessageBox::No)
- return;
- const QStringList pkgFilePaths = packagingFilePaths();
- if (!pkgFilePaths.isEmpty()) {
- project()->rootProjectNode()->removeFiles(ProjectExplorer::UnknownFileType,
- pkgFilePaths);
- Core::IVersionControl * const vcs = Core::ICore::vcsManager()
- ->findVersionControlForDirectory(QFileInfo(pkgFilePaths.first()).dir().path());
- if (vcs && vcs->supportsOperation(Core::IVersionControl::DeleteOperation)) {
- foreach (const QString &filePath, pkgFilePaths)
- vcs->vcsDelete(filePath);
- }
- }
- delete m_filesWatcher;
- removeTarget();
- QString error;
- const QString packagingPath = project()->projectDirectory()
- + QLatin1Char('/') + PackagingDirName;
- const QStringList otherContents = QDir(packagingPath).entryList(QDir::Dirs
- | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot);
- if (otherContents.isEmpty()) {
- if (!Utils::FileUtils::removeRecursively(packagingPath, &error))
- qDebug("%s", qPrintable(error));
- }
-}
-
-AbstractQt4MaemoTarget::ActionStatus AbstractQt4MaemoTarget::createTemplates()
-{
- QDir projectDir(project()->projectDirectory());
- if (!projectDir.exists(PackagingDirName)
- && !projectDir.mkdir(PackagingDirName)) {
- raiseError(tr("Error creating packaging directory '%1'.")
- .arg(PackagingDirName));
- return ActionFailed;
- }
-
- return createSpecialTemplates();
-}
-
-bool AbstractQt4MaemoTarget::initPackagingSettingsFromOtherTarget()
-{
- bool success = true;
- foreach (const Target * const target, project()->targets()) {
- const AbstractQt4MaemoTarget * const maemoTarget
- = qobject_cast<const AbstractQt4MaemoTarget *>(target);
- if (maemoTarget && maemoTarget != this && maemoTarget->m_isInitialized) {
- if (!setProjectVersionInternal(maemoTarget->projectVersion()))
- success = false;
- if (!setPackageNameInternal(maemoTarget->packageName()))
- success = false;
- if (!setShortDescriptionInternal(maemoTarget->shortDescription()))
- success = false;
- break;
- }
- }
- return initAdditionalPackagingSettingsFromOtherTarget() && success;
-}
-
-void AbstractQt4MaemoTarget::raiseError(const QString &reason)
-{
- QMessageBox::critical(0, tr("Error creating MeeGo templates"), reason);
-}
-
-AbstractDebBasedQt4MaemoTarget::AbstractDebBasedQt4MaemoTarget(Qt4Project *parent,
- const Core::Id id,
- const QString &qmakeScope) :
- AbstractQt4MaemoTarget(parent, id, qmakeScope)
-{
-}
-
-AbstractDebBasedQt4MaemoTarget::~AbstractDebBasedQt4MaemoTarget() {}
-
-QString AbstractDebBasedQt4MaemoTarget::projectVersion(QString *error) const
-{
- QSharedPointer<QFile> changeLog = openFile(changeLogFilePath(),
- QIODevice::ReadOnly, error);
- if (!changeLog)
- return QString();
- const QByteArray &firstLine = changeLog->readLine();
- const int openParenPos = firstLine.indexOf('(');
- if (openParenPos == -1) {
- if (error) {
- *error = tr("Debian changelog file '%1' has unexpected format.")
- .arg(QDir::toNativeSeparators(changeLog->fileName()));
- }
- return QString();
- }
- const int closeParenPos = firstLine.indexOf(')', openParenPos);
- if (closeParenPos == -1) {
- if (error) {
- *error = tr("Debian changelog file '%1' has unexpected format.")
- .arg(QDir::toNativeSeparators(changeLog->fileName()));
- }
- return QString();
- }
- return QString::fromUtf8(firstLine.mid(openParenPos + 1,
- closeParenPos - openParenPos - 1).data());
-}
-
-bool AbstractDebBasedQt4MaemoTarget::setProjectVersionInternal(const QString &version,
- QString *error)
-{
- const QString filePath = changeLogFilePath();
- Utils::FileReader reader;
- if (!reader.fetch(filePath, error))
- return false;
- QString content = QString::fromUtf8(reader.data());
- if (content.contains(QLatin1Char('(') + version + QLatin1Char(')'))) {
- if (error) {
- *error = tr("Refusing to update changelog file: Already contains version '%1'.")
- .arg(version);
- }
- return false;
- }
-
- int maintainerOffset = content.indexOf(QLatin1String("\n -- "));
- const int eolOffset = content.indexOf(QLatin1Char('\n'), maintainerOffset+1);
- if (maintainerOffset == -1 || eolOffset == -1) {
- if (error) {
- *error = tr("Cannot update changelog: Invalid format (no maintainer entry found).");
- }
- return false;
- }
-
- ++maintainerOffset;
- const QDateTime currentDateTime = QDateTime::currentDateTime();
- QDateTime utcDateTime = QDateTime(currentDateTime);
- utcDateTime.setTimeSpec(Qt::UTC);
- int utcOffsetSeconds = currentDateTime.secsTo(utcDateTime);
- QChar sign;
- if (utcOffsetSeconds < 0) {
- utcOffsetSeconds = -utcOffsetSeconds;
- sign = QLatin1Char('-');
- } else {
- sign = QLatin1Char('+');
- }
- const int utcOffsetMinutes = (utcOffsetSeconds / 60) % 60;
- const int utcOffsetHours = utcOffsetSeconds / 3600;
- const QString dateString = QString::fromLatin1("%1, %2 %3 %4 %5%6%7")
- .arg(shortDayOfWeekName(currentDateTime))
- .arg(currentDateTime.toString(QLatin1String("dd")))
- .arg(shortMonthName(currentDateTime))
- .arg(currentDateTime.toString(QLatin1String("yyyy hh:mm:ss"))).arg(sign)
- .arg(utcOffsetHours, 2, 10, QLatin1Char('0'))
- .arg(utcOffsetMinutes, 2, 10, QLatin1Char('0'));
- const QString maintainerLine = content.mid(maintainerOffset, eolOffset - maintainerOffset + 1)
- .replace(QRegExp(QLatin1String("> [^\\n]*\n")),
- QString::fromLatin1("> %1").arg(dateString));
- QString versionLine = content.left(content.indexOf(QLatin1Char('\n')))
- .replace(QRegExp(QLatin1String("\\([a-zA-Z0-9_\\.]+\\)")),
- QLatin1Char('(') + version + QLatin1Char(')'));
- const QString newEntry = versionLine + QLatin1String("\n * <Add change description here>\n\n")
- + maintainerLine + QLatin1String("\n\n");
- content.prepend(newEntry);
- Core::FileChangeBlocker update(filePath);
- Utils::FileSaver saver(filePath);
- saver.write(content.toUtf8());
- return saver.finalize(error);
-}
-
-QIcon AbstractDebBasedQt4MaemoTarget::packageManagerIcon(QString *error) const
-{
- const QByteArray &base64Icon = controlFileFieldValue(IconFieldName, true);
- if (base64Icon.isEmpty())
- return QIcon();
- QPixmap pixmap;
- if (!pixmap.loadFromData(QByteArray::fromBase64(base64Icon))) {
- if (error)
- *error = tr("Invalid icon data in Debian control file.");
- return QIcon();
- }
- return QIcon(pixmap);
-}
-
-bool AbstractDebBasedQt4MaemoTarget::setPackageManagerIconInternal(const QString &iconFilePath,
- QString *error)
-{
- const QString filePath = controlFilePath();
- Utils::FileReader reader;
- if (!reader.fetch(filePath, error))
- return false;
- const QPixmap pixmap(iconFilePath);
- if (pixmap.isNull()) {
- if (error)
- *error = tr("Could not read image file '%1'.").arg(iconFilePath);
- return false;
- }
-
- QByteArray iconAsBase64;
- QBuffer buffer(&iconAsBase64);
- buffer.open(QIODevice::WriteOnly);
- if (!pixmap.scaled(packageManagerIconSize()).save(&buffer,
- QFileInfo(iconFilePath).suffix().toAscii())) {
- if (error)
- *error = tr("Could not export image file '%1'.").arg(iconFilePath);
- return false;
- }
- buffer.close();
- iconAsBase64 = iconAsBase64.toBase64();
- QByteArray contents = reader.data();
- const QByteArray iconFieldNameWithColon = IconFieldName + ':';
- const int iconFieldPos = contents.startsWith(iconFieldNameWithColon)
- ? 0 : contents.indexOf('\n' + iconFieldNameWithColon);
- if (iconFieldPos == -1) {
- if (!contents.endsWith('\n'))
- contents += '\n';
- contents.append(iconFieldNameWithColon).append(' ').append(iconAsBase64)
- .append('\n');
- } else {
- const int oldIconStartPos = (iconFieldPos != 0) + iconFieldPos
- + iconFieldNameWithColon.length();
- int nextEolPos = contents.indexOf('\n', oldIconStartPos);
- while (nextEolPos != -1 && nextEolPos != contents.length() - 1
- && contents.at(nextEolPos + 1) != '\n'
- && (contents.at(nextEolPos + 1) == '#'
- || std::isspace(contents.at(nextEolPos + 1))))
- nextEolPos = contents.indexOf('\n', nextEolPos + 1);
- if (nextEolPos == -1)
- nextEolPos = contents.length();
- contents.replace(oldIconStartPos, nextEolPos - oldIconStartPos,
- ' ' + iconAsBase64);
- }
- Core::FileChangeBlocker update(filePath);
- Utils::FileSaver saver(filePath);
- saver.write(contents);
- return saver.finalize(error);
-}
-
-QString AbstractDebBasedQt4MaemoTarget::packageName() const
-{
- return QString::fromUtf8(controlFileFieldValue(NameFieldName, false));
-}
-
-bool AbstractDebBasedQt4MaemoTarget::setPackageNameInternal(const QString &packageName)
-{
- const QString oldPackageName = this->packageName();
-
- if (!setControlFieldValue(NameFieldName, packageName.toUtf8()))
- return false;
- if (!setControlFieldValue("Source", packageName.toUtf8()))
- return false;
-
- Utils::FileReader reader;
- if (!reader.fetch(changeLogFilePath()))
- return false;
- QString changelogContents = QString::fromUtf8(reader.data());
- QRegExp pattern(QLatin1String("[^\\s]+( \\(\\d\\.\\d\\.\\d\\))"));
- changelogContents.replace(pattern, packageName + QLatin1String("\\1"));
- Utils::FileSaver saver(changeLogFilePath());
- saver.write(changelogContents.toUtf8());
- if (!saver.finalize())
- return false;
-
- if (!reader.fetch(rulesFilePath()))
- return false;
- QByteArray rulesContents = reader.data();
- const QString oldString = QLatin1String("debian/") + oldPackageName;
- const QString newString = QLatin1String("debian/") + packageName;
- rulesContents.replace(oldString.toUtf8(), newString.toUtf8());
- Utils::FileSaver rulesSaver(rulesFilePath());
- rulesSaver.write(rulesContents);
- return rulesSaver.finalize();
-}
-
-QString AbstractDebBasedQt4MaemoTarget::packageManagerName() const
-{
- return QString::fromUtf8(controlFileFieldValue(packageManagerNameFieldName(), false));
-}
-
-bool AbstractDebBasedQt4MaemoTarget::setPackageManagerName(const QString &name,
- QString *error)
-{
- bool success = true;
- foreach (Target * const t, project()->targets()) {
- AbstractDebBasedQt4MaemoTarget * const target
- = qobject_cast<AbstractDebBasedQt4MaemoTarget *>(t);
- if (target) {
- if (!target->setPackageManagerNameInternal(name, error))
- success = false;
- }
- }
- return success;
-}
-
-bool AbstractDebBasedQt4MaemoTarget::setPackageManagerNameInternal(const QString &name,
- QString *error)
-{
- Q_UNUSED(error);
- return setControlFieldValue(packageManagerNameFieldName(), name.toUtf8());
-}
-
-QString AbstractDebBasedQt4MaemoTarget::shortDescription() const
-{
- return QString::fromUtf8(controlFileFieldValue(ShortDescriptionFieldName, false));
-}
-
-QString AbstractDebBasedQt4MaemoTarget::packageFileName() const
-{
- return QString::fromUtf8(controlFileFieldValue(PackageFieldName, false))
- + QLatin1Char('_') + projectVersion() + QLatin1String("_armel.deb");
-}
-
-bool AbstractDebBasedQt4MaemoTarget::setShortDescriptionInternal(const QString &description)
-{
- return setControlFieldValue(ShortDescriptionFieldName, description.toUtf8());
-}
-
-QString AbstractDebBasedQt4MaemoTarget::debianDirPath() const
-{
- return project()->projectDirectory() + QLatin1Char('/') + PackagingDirName
- + QLatin1Char('/') + debianDirName();
-}
-
-QStringList AbstractDebBasedQt4MaemoTarget::debianFiles() const
-{
- return QDir(debianDirPath())
- .entryList(QDir::Files, QDir::Name | QDir::IgnoreCase);
-}
-
-QString AbstractDebBasedQt4MaemoTarget::changeLogFilePath() const
-{
- return debianDirPath() + QLatin1String("/changelog");
-}
-
-QString AbstractDebBasedQt4MaemoTarget::controlFilePath() const
-{
- return debianDirPath() + QLatin1String("/control");
-}
-
-QString AbstractDebBasedQt4MaemoTarget::rulesFilePath() const
-{
- return debianDirPath() + QLatin1String("/rules");
-}
-
-QByteArray AbstractDebBasedQt4MaemoTarget::controlFileFieldValue(const QString &key,
- bool multiLine) const
-{
- QByteArray value;
- Utils::FileReader reader;
- if (!reader.fetch(controlFilePath()))
- return value;
- const QByteArray &contents = reader.data();
- const int keyPos = contents.indexOf(key.toUtf8() + ':');
- if (keyPos == -1)
- return value;
- int valueStartPos = keyPos + key.length() + 1;
- int valueEndPos = contents.indexOf('\n', keyPos);
- if (valueEndPos == -1)
- valueEndPos = contents.count();
- value = contents.mid(valueStartPos, valueEndPos - valueStartPos).trimmed();
- if (multiLine) {
- Q_FOREVER {
- valueStartPos = valueEndPos + 1;
- if (valueStartPos >= contents.count())
- break;
- const char firstChar = contents.at(valueStartPos);
- if (firstChar == '#' || isspace(firstChar)) {
- valueEndPos = contents.indexOf('\n', valueStartPos);
- if (valueEndPos == -1)
- valueEndPos = contents.count();
- if (firstChar != '#') {
- value += contents.mid(valueStartPos,
- valueEndPos - valueStartPos).trimmed();
- }
- } else {
- break;
- }
- }
- }
- return value;
-}
-
-bool AbstractDebBasedQt4MaemoTarget::setControlFieldValue(const QByteArray &fieldName,
- const QByteArray &fieldValue)
-{
- Utils::FileReader reader;
- if (!reader.fetch(controlFilePath()))
- return false;
- QByteArray contents = reader.data();
- if (adaptControlFileField(contents, fieldName, fieldValue)) {
- Core::FileChangeBlocker update(controlFilePath());
- Utils::FileSaver saver(controlFilePath());
- saver.write(contents);
- return saver.finalize();
- }
- return true;
-}
-
-bool AbstractDebBasedQt4MaemoTarget::adaptControlFileField(QByteArray &document,
- const QByteArray &fieldName, const QByteArray &newFieldValue)
-{
- return adaptTagValue(document, fieldName, newFieldValue, true);
-}
-
-void AbstractDebBasedQt4MaemoTarget::handleTargetAddedSpecial()
-{
- if (controlFileFieldValue(IconFieldName, true).isEmpty()) {
- // Such a file is created by the mobile wizards.
- const QString iconPath = project()->projectDirectory()
- + QLatin1Char('/') + project()->displayName()
- + QLatin1String("64.png");
- if (QFileInfo(iconPath).exists())
- setPackageManagerIcon(iconPath);
- }
-
- m_filesWatcher->addDirectory(debianDirPath(), Utils::FileSystemWatcher::WatchAllChanges);
- m_controlFile = new WatchableFile(controlFilePath(), this);
- connect(m_controlFile, SIGNAL(modified()), SIGNAL(controlChanged()));
- m_changeLogFile = new WatchableFile(changeLogFilePath(), this);
- connect(m_changeLogFile, SIGNAL(modified()), SIGNAL(changeLogChanged()));
- Core::DocumentManager::addDocuments(QList<Core::IDocument *>()
- << m_controlFile << m_changeLogFile);
- connect(m_filesWatcher, SIGNAL(directoryChanged(QString)), this,
- SLOT(handleDebianDirContentsChanged()));
- handleDebianDirContentsChanged();
- emit controlChanged();
- emit changeLogChanged();
-}
-
-bool AbstractDebBasedQt4MaemoTarget::targetCanBeRemoved() const
-{
- return QFileInfo(debianDirPath()).exists();
-}
-
-void AbstractDebBasedQt4MaemoTarget::removeTarget()
-{
- QString error;
- if (!Utils::FileUtils::removeRecursively(debianDirPath(), &error))
- qDebug("%s", qPrintable(error));
-}
-
-void AbstractDebBasedQt4MaemoTarget::handleDebianDirContentsChanged()
-{
- emit debianDirContentsChanged();
-}
-
-AbstractQt4MaemoTarget::ActionStatus AbstractDebBasedQt4MaemoTarget::createSpecialTemplates()
-{
- if (QFileInfo(debianDirPath()).exists())
- return NoActionRequired;
- QDir projectDir(project()->projectDirectory());
- QProcess dh_makeProc;
- QString error;
- const Qt4BuildConfiguration * const bc = qobject_cast<Qt4BuildConfiguration * >(activeBuildConfiguration());
- AbstractMaemoPackageCreationStep::preparePackagingProcess(&dh_makeProc, bc,
- projectDir.path() + QLatin1Char('/') + PackagingDirName);
- const QString dhMakeDebianDir = projectDir.path() + QLatin1Char('/')
- + PackagingDirName + QLatin1String("/debian");
- Utils::FileUtils::removeRecursively(dhMakeDebianDir, &error);
- const QStringList dh_makeArgs = QStringList() << QLatin1String("dh_make")
- << QLatin1String("-s") << QLatin1String("-n") << QLatin1String("-p")
- << (defaultPackageFileName() + QLatin1Char('_')
- + AbstractMaemoPackageCreationStep::DefaultVersionNumber);
- QtSupport::BaseQtVersion *lqt = activeQt4BuildConfiguration()->qtVersion();
- if (!lqt) {
- raiseError(tr("Unable to create Debian templates: No Qt version set."));
- return ActionFailed;
- }
- if (!MaemoGlobal::callMad(dh_makeProc, dh_makeArgs, lqt->qmakeCommand().toString(), true)
- || !dh_makeProc.waitForStarted()) {
- raiseError(tr("Unable to create Debian templates: dh_make failed (%1).")
- .arg(dh_makeProc.errorString()));
- return ActionFailed;
- }
- dh_makeProc.write("\n"); // Needs user input.
- dh_makeProc.waitForFinished(-1);
- if (dh_makeProc.error() != QProcess::UnknownError
- || dh_makeProc.exitCode() != 0) {
- raiseError(tr("Unable to create debian templates: dh_make failed (%1).")
- .arg(dh_makeProc.errorString()));
- return ActionFailed;
- }
-
- if (!QFile::rename(dhMakeDebianDir, debianDirPath())) {
- raiseError(tr("Unable to move new debian directory to '%1'.")
- .arg(QDir::toNativeSeparators(debianDirPath())));
- Utils::FileUtils::removeRecursively(dhMakeDebianDir, &error);
- return ActionFailed;
- }
-
- QDir debianDir(debianDirPath());
- const QStringList &files = debianDir.entryList(QDir::Files);
- foreach (const QString &fileName, files) {
- if (fileName.endsWith(QLatin1String(".ex"), Qt::CaseInsensitive)
- || fileName.compare(QLatin1String("README.debian"), Qt::CaseInsensitive) == 0
- || fileName.compare(QLatin1String("dirs"), Qt::CaseInsensitive) == 0
- || fileName.compare(QLatin1String("docs"), Qt::CaseInsensitive) == 0) {
- debianDir.remove(fileName);
- }
- }
-
- return adaptRulesFile() && adaptControlFile()
- ? ActionSuccessful : ActionFailed;
-}
-
-bool AbstractDebBasedQt4MaemoTarget::adaptRulesFile()
-{
- Utils::FileReader reader;
- if (!reader.fetch(rulesFilePath())) {
- raiseError(reader.errorString());
- return false;
- }
- QByteArray rulesContents = reader.data();
- const QByteArray comment("# Uncomment this line for use without Qt Creator");
- rulesContents.replace("DESTDIR", "INSTALL_ROOT");
- rulesContents.replace("dh_shlibdeps", "# dh_shlibdeps " + comment);
- rulesContents.replace("# Add here commands to configure the package.",
- "# qmake PREFIX=/usr" + comment);
- rulesContents.replace("$(MAKE)\n", "# $(MAKE) " + comment + '\n');
-
- // Would be the right solution, but does not work (on Windows),
- // because dpkg-genchanges doesn't know about it (and can't be told).
- // rulesContents.replace("dh_builddeb", "dh_builddeb --destdir=.");
-
- Utils::FileSaver saver(rulesFilePath());
- saver.write(rulesContents);
- if (!saver.finalize()) {
- raiseError(saver.errorString());
- return false;
- }
- return true;
-}
-
-bool AbstractDebBasedQt4MaemoTarget::adaptControlFile()
-{
- Utils::FileReader reader;
- if (!reader.fetch(controlFilePath())) {
- raiseError(reader.errorString());
- return false;
- }
- QByteArray controlContents = reader.data();
-
- adaptControlFileField(controlContents, "Section", defaultSection());
- adaptControlFileField(controlContents, "Priority", "optional");
- adaptControlFileField(controlContents, packageManagerNameFieldName(),
- project()->displayName().toUtf8());
- const int buildDependsOffset = controlContents.indexOf("Build-Depends:");
- if (buildDependsOffset == -1) {
- qDebug("Unexpected: no Build-Depends field in debian control file.");
- } else {
- int buildDependsNewlineOffset
- = controlContents.indexOf('\n', buildDependsOffset);
- if (buildDependsNewlineOffset == -1) {
- controlContents += '\n';
- buildDependsNewlineOffset = controlContents.length() - 1;
- }
- controlContents.insert(buildDependsNewlineOffset,
- ", libqt4-dev");
- }
-
- addAdditionalControlFileFields(controlContents);
- Utils::FileSaver saver(controlFilePath());
- saver.write(controlContents);
- if (!saver.finalize()) {
- raiseError(saver.errorString());
- return false;
- }
- return true;
-}
-
-bool AbstractDebBasedQt4MaemoTarget::initAdditionalPackagingSettingsFromOtherTarget()
-{
- foreach (const Target * const t, project()->targets()) {
- const AbstractDebBasedQt4MaemoTarget *target
- = qobject_cast<const AbstractDebBasedQt4MaemoTarget *>(t);
- if (target && target != this) {
- return setControlFieldValue(IconFieldName,
- target->controlFileFieldValue(IconFieldName, true));
- }
- }
- return true;
-}
-
-QStringList AbstractDebBasedQt4MaemoTarget::packagingFilePaths() const
-{
- QStringList filePaths;
- const QString parentDir = debianDirPath();
- foreach (const QString &fileName, debianFiles())
- filePaths << parentDir + QLatin1Char('/') + fileName;
- return filePaths;
-}
-
-QString AbstractDebBasedQt4MaemoTarget::defaultPackageFileName() const
-{
- QString packageName = project()->displayName().toLower();
-
- // We also replace dots, because OVI store chokes on them.
- QRegExp legalLetter(QLatin1String("[a-z0-9+-]"), Qt::CaseSensitive, QRegExp::WildcardUnix);
-
- for (int i = 0; i < packageName.length(); ++i) {
- if (!legalLetter.exactMatch(packageName.mid(i, 1)))
- packageName[i] = QLatin1Char('-');
- }
- return packageName;
-}
-
-bool AbstractDebBasedQt4MaemoTarget::setPackageManagerIcon(const QString &iconFilePath,
- QString *error)
-{
- bool success = true;
- foreach (Target * const target, project()->targets()) {
- AbstractDebBasedQt4MaemoTarget* const maemoTarget
- = qobject_cast<AbstractDebBasedQt4MaemoTarget*>(target);
- if (maemoTarget) {
- if (!maemoTarget->setPackageManagerIconInternal(iconFilePath, error))
- success = false;
- }
- }
- return success;
-}
-
-// The QDateTime API can only deliver these in localized form...
-QString AbstractDebBasedQt4MaemoTarget::shortMonthName(const QDateTime &dt) const
-{
- switch (dt.date().month()) {
- case 1: return QLatin1String("Jan");
- case 2: return QLatin1String("Feb");
- case 3: return QLatin1String("Mar");
- case 4: return QLatin1String("Apr");
- case 5: return QLatin1String("May");
- case 6: return QLatin1String("Jun");
- case 7: return QLatin1String("Jul");
- case 8: return QLatin1String("Aug");
- case 9: return QLatin1String("Sep");
- case 10: return QLatin1String("Oct");
- case 11: return QLatin1String("Nov");
- case 12: return QLatin1String("Dec");
- default: QTC_ASSERT(false, return QString());
- }
-}
-
-QString AbstractDebBasedQt4MaemoTarget::shortDayOfWeekName(const QDateTime &dt) const
-{
- switch (dt.date().dayOfWeek()) {
- case Qt::Monday: return QLatin1String("Mon");
- case Qt::Tuesday: return QLatin1String("Tue");
- case Qt::Wednesday: return QLatin1String("Wed");
- case Qt::Thursday: return QLatin1String("Thu");
- case Qt::Friday: return QLatin1String("Fri");
- case Qt::Saturday: return QLatin1String("Sat");
- case Qt::Sunday: return QLatin1String("Sun");
- default: QTC_ASSERT(false, return QString());
- }
-}
-
-
-AbstractRpmBasedQt4MaemoTarget::AbstractRpmBasedQt4MaemoTarget(Qt4Project *parent,
- const Core::Id id, const QString &qmakeScope) :
- AbstractQt4MaemoTarget(parent, id, qmakeScope)
-{
-}
-
-AbstractRpmBasedQt4MaemoTarget::~AbstractRpmBasedQt4MaemoTarget()
-{
-}
-
-QString AbstractRpmBasedQt4MaemoTarget::specFilePath() const
-{
- const QLatin1Char sep('/');
- return project()->projectDirectory() + sep + PackagingDirName + sep
- + specFileName();
-}
-
-QString AbstractRpmBasedQt4MaemoTarget::projectVersion(QString *error) const
-{
- return QString::fromUtf8(getValueForTag(VersionTag, error));
-}
-
-bool AbstractRpmBasedQt4MaemoTarget::setProjectVersionInternal(const QString &version,
- QString *error)
-{
- return setValueForTag(VersionTag, version.toUtf8(), error);
-}
-
-QString AbstractRpmBasedQt4MaemoTarget::packageName() const
-{
- return QString::fromUtf8(getValueForTag(NameTag, 0));
-}
-
-bool AbstractRpmBasedQt4MaemoTarget::setPackageNameInternal(const QString &name)
-{
- return setValueForTag(NameTag, name.toUtf8(), 0);
-}
-
-QString AbstractRpmBasedQt4MaemoTarget::shortDescription() const
-{
- return QString::fromUtf8(getValueForTag(SummaryTag, 0));
-}
-
-QString AbstractRpmBasedQt4MaemoTarget::packageFileName() const
-{
- QtSupport::BaseQtVersion *lqt = activeQt4BuildConfiguration()->qtVersion();
- if (!lqt)
- return QString();
- return packageName() + QLatin1Char('-') + projectVersion() + QLatin1Char('-')
- + QString::fromUtf8(getValueForTag(ReleaseTag, 0)) + QLatin1Char('.')
- + MaemoGlobal::architecture(lqt->qmakeCommand().toString())
- + QLatin1String(".rpm");
-}
-
-bool AbstractRpmBasedQt4MaemoTarget::setShortDescriptionInternal(const QString &description)
-{
- return setValueForTag(SummaryTag, description.toUtf8(), 0);
-}
-
-AbstractQt4MaemoTarget::ActionStatus AbstractRpmBasedQt4MaemoTarget::createSpecialTemplates()
-{
- if (QFileInfo(specFilePath()).exists())
- return NoActionRequired;
- QByteArray initialContent(
- "Name: %%name%%\n"
- "Summary: <insert short description here>\n"
- "Version: 0.0.1\n"
- "Release: 1\n"
- "License: <Enter your application's license here>\n"
- "Group: <Set your application's group here>\n"
- "%description\n"
- "<Insert longer, multi-line description\n"
- "here.>\n"
- "\n"
- "%prep\n"
- "%setup -q\n"
- "\n"
- "%build\n"
- "# You can leave this empty for use with Qt Creator."
- "\n"
- "%install\n"
- "rm -rf %{buildroot}\n"
- "make INSTALL_ROOT=%{buildroot} install\n"
- "\n"
- "%clean\n"
- "rm -rf %{buildroot}\n"
- "\n"
- "BuildRequires: \n"
- "# %define _unpackaged_files_terminate_build 0\n"
- "%files\n"
- "%defattr(-,root,root,-)"
- "/usr\n"
- "/opt\n"
- "# Add additional files to be included in the package here.\n"
- "%pre\n"
- "# Add pre-install scripts here."
- "%post\n"
- "/sbin/ldconfig # For shared libraries\n"
- "%preun\n"
- "# Add pre-uninstall scripts here."
- "%postun\n"
- "# Add post-uninstall scripts here."
- );
- initialContent.replace("%%name%%", project()->displayName().toUtf8());
- Utils::FileSaver saver(specFilePath());
- saver.write(initialContent);
- return saver.finalize() ? ActionSuccessful : ActionFailed;
-}
-
-void AbstractRpmBasedQt4MaemoTarget::handleTargetAddedSpecial()
-{
- m_specFile = new WatchableFile(specFilePath(), this);
- connect(m_specFile, SIGNAL(modified()), SIGNAL(specFileChanged()));
- Core::DocumentManager::addDocument(m_specFile);
- emit specFileChanged();
-}
-
-bool AbstractRpmBasedQt4MaemoTarget::targetCanBeRemoved() const
-{
- return QFileInfo(specFilePath()).exists();
-}
-
-void AbstractRpmBasedQt4MaemoTarget::removeTarget()
-{
- QFile::remove(specFilePath());
-}
-
-bool AbstractRpmBasedQt4MaemoTarget::initAdditionalPackagingSettingsFromOtherTarget()
-{
- // Nothing to do here for now.
- return true;
-}
-
-QByteArray AbstractRpmBasedQt4MaemoTarget::getValueForTag(const QByteArray &tag,
- QString *error) const
-{
- Utils::FileReader reader;
- if (!reader.fetch(specFilePath(), error))
- return QByteArray();
- const QByteArray &content = reader.data();
- const QByteArray completeTag = tag.toLower() + ':';
- int index = content.toLower().indexOf(completeTag);
- if (index == -1)
- return QByteArray();
- index += completeTag.count();
- int endIndex = content.indexOf('\n', index);
- if (endIndex == -1)
- endIndex = content.count();
- return content.mid(index, endIndex - index).trimmed();
-}
-
-bool AbstractRpmBasedQt4MaemoTarget::setValueForTag(const QByteArray &tag,
- const QByteArray &value, QString *error)
-{
- Utils::FileReader reader;
- if (!reader.fetch(specFilePath(), error))
- return false;
- QByteArray content = reader.data();
- if (adaptTagValue(content, tag, value, false)) {
- Utils::FileSaver saver(specFilePath());
- saver.write(content);
- return saver.finalize(error);
- }
- return true;
-}
-
-Qt4Maemo5Target::Qt4Maemo5Target(Qt4Project *parent, const Core::Id id)
- : AbstractDebBasedQt4MaemoTarget(parent, id, QLatin1String("maemo5"))
-{
- setDisplayName(defaultDisplayName());
-}
-
-Qt4Maemo5Target::~Qt4Maemo5Target() {}
-
-bool Qt4Maemo5Target::supportsDevice(const ProjectExplorer::IDevice::ConstPtr &device) const
-{
- return device->type() == Core::Id(Maemo5OsType);
-}
-
-QString Qt4Maemo5Target::defaultDisplayName()
-{
- return QApplication::translate("Qt4ProjectManager::Qt4Target", "Maemo5",
- "Qt4 Maemo5 target display name");
-}
-
-void Qt4Maemo5Target::addAdditionalControlFileFields(QByteArray &controlContents)
-{
- Q_UNUSED(controlContents);
-}
-
-QString Qt4Maemo5Target::debianDirName() const
-{
- return QLatin1String("debian_fremantle");
-}
-
-QByteArray Qt4Maemo5Target::packageManagerNameFieldName() const
-{
- return "XB-Maemo-Display-Name";
-}
-
-QSize Qt4Maemo5Target::packageManagerIconSize() const
-{
- return QSize(48, 48);
-}
-
-QByteArray Qt4Maemo5Target::defaultSection() const
-{
- return "user/hidden";
-}
-
-Qt4HarmattanTarget::Qt4HarmattanTarget(Qt4Project *parent, const Core::Id id) :
- AbstractDebBasedQt4MaemoTarget(parent, id, QLatin1String("contains(MEEGO_EDITION,harmattan)"))
-{
- setDisplayName(defaultDisplayName());
-}
-
-Qt4HarmattanTarget::~Qt4HarmattanTarget() {}
-
-bool Qt4HarmattanTarget::supportsDevice(const ProjectExplorer::IDevice::ConstPtr &device) const
-{
- return device->type() == Core::Id(HarmattanOsType);
-}
-
-QString Qt4HarmattanTarget::defaultDisplayName()
-{
- return QApplication::translate("Qt4ProjectManager::Qt4Target", "Harmattan",
- "Qt4 Harmattan target display name");
-}
-
-QString Qt4HarmattanTarget::aegisManifestFileName()
-{
- return QLatin1String("manifest.aegis");
-}
-
-void Qt4HarmattanTarget::handleTargetAddedSpecial()
-{
- AbstractDebBasedQt4MaemoTarget::handleTargetAddedSpecial();
- const QFile aegisFile(debianDirPath() + QLatin1Char('/') + aegisManifestFileName());
- if (aegisFile.exists())
- return;
-
- Utils::FileReader reader;
- if (!reader.fetch(Core::ICore::resourcePath()
- + QLatin1String("/templates/shared/") + aegisManifestFileName())) {
- qDebug("Reading manifest template failed.");
- return;
- }
- QString content = QString::fromUtf8(reader.data());
- content.replace(QLatin1String("%%PROJECTNAME%%"), project()->displayName());
- Utils::FileSaver writer(aegisFile.fileName(), QIODevice::WriteOnly);
- writer.write(content.toUtf8());
- if (!writer.finalize()) {
- qDebug("Failure writing manifest file.");
- return;
- }
-}
-
-void Qt4HarmattanTarget::addAdditionalControlFileFields(QByteArray &controlContents)
-{
- adaptControlFileField(controlContents, "XB-Maemo-Flags", "visible");
- adaptControlFileField(controlContents, "XB-MeeGo-Desktop-Entry-Filename", QString::fromLatin1("%1_harmattan").arg(project()->displayName()).toUtf8());
- adaptControlFileField(controlContents, "XB-MeeGo-Desktop-Entry", QString::fromLatin1("\n [Desktop Entry]\n Type=Application\n Name=%1\n Icon=/usr/share/icons/hicolor/80x80/apps/%1%2.png").arg(project()->displayName()).arg(80).toUtf8());
-}
-
-QString Qt4HarmattanTarget::debianDirName() const
-{
- return QLatin1String("debian_harmattan");
-}
-
-QByteArray Qt4HarmattanTarget::packageManagerNameFieldName() const
-{
- return "XSBC-Maemo-Display-Name";
-}
-
-QSize Qt4HarmattanTarget::packageManagerIconSize() const
-{
- return QSize(64, 64);
-}
-
-QByteArray Qt4HarmattanTarget::defaultSection() const
-{
- return "user/other";
-}
-
-
-Qt4MeegoTarget::Qt4MeegoTarget(Qt4Project *parent, const Core::Id id) :
- AbstractRpmBasedQt4MaemoTarget(parent, id,
- QLatin1String("!isEmpty(MEEGO_VERSION_MAJOR):!contains(MEEGO_EDITION,harmattan)"))
-{
- setDisplayName(defaultDisplayName());
-}
-
-Qt4MeegoTarget::~Qt4MeegoTarget() {}
-
-bool Qt4MeegoTarget::supportsDevice(const ProjectExplorer::IDevice::ConstPtr &device) const
-{
- return device->type() == Core::Id(MeeGoOsType);
-}
-
-QString Qt4MeegoTarget::defaultDisplayName()
-{
- return QApplication::translate("Qt4ProjectManager::Qt4Target",
- "MeeGo", "Qt4 MeeGo target display name");
-}
-
-QString Qt4MeegoTarget::specFileName() const
-{
- return QLatin1String("meego.spec");
-}
-
-} // namespace Internal
-} // namespace Madde
diff --git a/src/plugins/madde/qt4maemotarget.h b/src/plugins/madde/qt4maemotarget.h
deleted file mode 100644
index da80854815..0000000000
--- a/src/plugins/madde/qt4maemotarget.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef QT4MAEMOTARGET_H
-#define QT4MAEMOTARGET_H
-
-#include <remotelinux/abstractembeddedlinuxtarget.h>
-
-#include <QIODevice>
-#include <QSharedPointer>
-#include <QIcon>
-
-QT_FORWARD_DECLARE_CLASS(QDateTime)
-QT_FORWARD_DECLARE_CLASS(QFile)
-
-namespace Qt4ProjectManager { class Qt4Project; }
-namespace RemoteLinux { class DeploymentSettingsAssistant; }
-namespace Utils { class FileSystemWatcher; }
-
-namespace Madde {
-namespace Internal {
-class Qt4MaemoDeployConfigurationFactory;
-class WatchableFile;
-
-class AbstractQt4MaemoTarget : public RemoteLinux::AbstractEmbeddedLinuxTarget
-{
- friend class Qt4MaemoTargetFactory;
- Q_OBJECT
-public:
- AbstractQt4MaemoTarget(Qt4ProjectManager::Qt4Project *parent, const Core::Id id,
- const QString &qmakeScope);
- virtual ~AbstractQt4MaemoTarget();
-
- void createApplicationProFiles(bool reparse);
- QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
- QList<ProjectExplorer::ToolChain *> possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const;
-
- virtual bool allowsRemoteMounts() const = 0;
- virtual bool allowsPackagingDisabling() const = 0;
- virtual bool allowsQmlDebugging() const = 0;
-
- virtual QString projectVersion(QString *error = 0) const = 0;
- virtual QString packageName() const = 0;
- virtual QString shortDescription() const = 0;
- virtual QString packageFileName() const = 0;
-
- bool setProjectVersion(const QString &version, QString *error = 0);
- bool setPackageName(const QString &packageName);
- bool setShortDescription(const QString &description);
-
- RemoteLinux::DeploymentSettingsAssistant *deploymentSettingsAssistant() const {
- return m_deploymentSettingsAssistant;
- }
-
-protected:
- enum ActionStatus { NoActionRequired, ActionSuccessful, ActionFailed };
-
- void raiseError(const QString &reason);
- QSharedPointer<QFile> openFile(const QString &filePath,
- QIODevice::OpenMode mode, QString *error) const;
-
- Utils::FileSystemWatcher* const m_filesWatcher;
-
-private slots:
- void handleTargetAdded(ProjectExplorer::Target *target);
- void handleFromMapFinished();
- void handleTargetToBeRemoved(ProjectExplorer::Target *target);
-
-private:
- virtual bool setProjectVersionInternal(const QString &version,
- QString *error = 0) = 0;
- virtual bool setPackageNameInternal(const QString &packageName) = 0;
- virtual bool setShortDescriptionInternal(const QString &description) = 0;
- virtual ActionStatus createSpecialTemplates() = 0;
- virtual void handleTargetAddedSpecial() = 0;
- virtual bool targetCanBeRemoved() const = 0;
- virtual void removeTarget() = 0;
- virtual QStringList packagingFilePaths() const = 0;
-
- ActionStatus createTemplates();
- bool initPackagingSettingsFromOtherTarget();
- virtual bool initAdditionalPackagingSettingsFromOtherTarget() = 0;
-
- RemoteLinux::DeploymentSettingsAssistant * const m_deploymentSettingsAssistant;
- bool m_isInitialized;
-};
-
-
-class AbstractDebBasedQt4MaemoTarget : public AbstractQt4MaemoTarget
-{
- Q_OBJECT
-public:
- AbstractDebBasedQt4MaemoTarget(Qt4ProjectManager::Qt4Project *parent, const Core::Id id,
- const QString &qmakeScope);
- ~AbstractDebBasedQt4MaemoTarget();
-
- QString debianDirPath() const;
- QStringList debianFiles() const;
-
- virtual QString debianDirName() const = 0;
- virtual QString projectVersion(QString *error = 0) const;
- virtual QString packageName() const;
- virtual QString shortDescription() const;
- virtual QString packageFileName() const;
-
- bool setPackageManagerIcon(const QString &iconFilePath, QString *error = 0);
- QIcon packageManagerIcon(QString *error = 0) const;
- bool setPackageManagerName(const QString &name, QString *error = 0);
- QString packageManagerName() const;
-
- virtual QSize packageManagerIconSize() const = 0;
-
-signals:
- void debianDirContentsChanged();
- void changeLogChanged();
- void controlChanged();
-
-protected:
- virtual void handleTargetAddedSpecial();
- bool adaptControlFileField(QByteArray &document, const QByteArray &fieldName,
- const QByteArray &newFieldValue);
-
-private slots:
- void handleDebianDirContentsChanged();
-
-private:
- virtual bool setProjectVersionInternal(const QString &version,
- QString *error = 0);
- virtual bool setPackageNameInternal(const QString &packageName);
- virtual bool setShortDescriptionInternal(const QString &description);
-
- virtual ActionStatus createSpecialTemplates();
- virtual bool targetCanBeRemoved() const;
- virtual void removeTarget();
- virtual bool initAdditionalPackagingSettingsFromOtherTarget();
- virtual QStringList packagingFilePaths() const;
-
- virtual void addAdditionalControlFileFields(QByteArray &controlContents) = 0;
- virtual QByteArray packageManagerNameFieldName() const = 0;
- virtual QByteArray defaultSection() const = 0;
-
- QString changeLogFilePath() const;
- QString controlFilePath() const;
- QString rulesFilePath() const;
- QByteArray controlFileFieldValue(const QString &key, bool multiLine) const;
- bool setControlFieldValue(const QByteArray &fieldName,
- const QByteArray &fieldValue);
- bool adaptRulesFile();
- bool adaptControlFile();
- bool setPackageManagerIconInternal(const QString &iconFilePath,
- QString *error = 0);
- QString defaultPackageFileName() const;
- bool setPackageManagerNameInternal(const QString &name, QString *error = 0);
- QString shortMonthName(const QDateTime &dt) const;
- QString shortDayOfWeekName(const QDateTime &dt) const;
-
- WatchableFile *m_controlFile;
- WatchableFile *m_changeLogFile;
-};
-
-
-class AbstractRpmBasedQt4MaemoTarget : public AbstractQt4MaemoTarget
-{
- Q_OBJECT
-public:
- AbstractRpmBasedQt4MaemoTarget(Qt4ProjectManager::Qt4Project *parent, const Core::Id id,
- const QString &qmakeScope);
- ~AbstractRpmBasedQt4MaemoTarget();
-
- virtual bool allowsRemoteMounts() const { return false; }
- virtual bool allowsPackagingDisabling() const { return false; }
- virtual bool allowsQmlDebugging() const { return false; }
-
- virtual QString projectVersion(QString *error = 0) const;
- virtual QString packageName() const;
- virtual QString shortDescription() const;
- virtual QString packageFileName() const;
-
- QString specFilePath() const;
-
-signals:
- void specFileChanged();
-
-private:
- virtual bool setProjectVersionInternal(const QString &version,
- QString *error = 0);
- virtual bool setPackageNameInternal(const QString &packageName);
- virtual bool setShortDescriptionInternal(const QString &description);
- virtual ActionStatus createSpecialTemplates();
- virtual void handleTargetAddedSpecial();
- virtual bool targetCanBeRemoved() const;
- virtual void removeTarget();
- virtual bool initAdditionalPackagingSettingsFromOtherTarget();
- virtual QStringList packagingFilePaths() const { return QStringList(specFilePath()); }
-
- virtual QString specFileName() const = 0;
-
- QByteArray getValueForTag(const QByteArray &tag, QString *error) const;
- bool setValueForTag(const QByteArray &tag, const QByteArray &value,
- QString *error);
-
- WatchableFile *m_specFile;
-};
-
-
-class Qt4Maemo5Target : public AbstractDebBasedQt4MaemoTarget
-{
- Q_OBJECT
-public:
- Qt4Maemo5Target(Qt4ProjectManager::Qt4Project *parent, const Core::Id id);
- virtual ~Qt4Maemo5Target();
-
- virtual bool supportsDevice(const QSharedPointer<const ProjectExplorer::IDevice> &device) const;
-
- virtual bool allowsRemoteMounts() const { return true; }
- virtual bool allowsPackagingDisabling() const { return true; }
- virtual bool allowsQmlDebugging() const { return false; }
-
- virtual QSize packageManagerIconSize() const;
-
- static QString defaultDisplayName();
-
-private:
- virtual void addAdditionalControlFileFields(QByteArray &controlContents);
- virtual QString debianDirName() const;
- virtual QByteArray packageManagerNameFieldName() const;
- virtual QByteArray defaultSection() const;
-};
-
-
-class Qt4HarmattanTarget : public AbstractDebBasedQt4MaemoTarget
-{
- Q_OBJECT
-public:
- Qt4HarmattanTarget(Qt4ProjectManager::Qt4Project *parent, const Core::Id id);
- virtual ~Qt4HarmattanTarget();
-
- virtual bool supportsDevice(const QSharedPointer<const ProjectExplorer::IDevice> &device) const;
-
- virtual bool allowsRemoteMounts() const { return false; }
- virtual bool allowsPackagingDisabling() const { return false; }
- virtual bool allowsQmlDebugging() const { return true; }
-
- virtual QSize packageManagerIconSize() const;
-
- static QString defaultDisplayName();
- static QString aegisManifestFileName();
-
-private:
- void handleTargetAddedSpecial();
- virtual void addAdditionalControlFileFields(QByteArray &controlContents);
- virtual QString debianDirName() const;
- virtual QByteArray packageManagerNameFieldName() const;
- virtual QByteArray defaultSection() const;
-};
-
-
-class Qt4MeegoTarget : public AbstractRpmBasedQt4MaemoTarget
-{
- Q_OBJECT
-public:
- Qt4MeegoTarget(Qt4ProjectManager::Qt4Project *parent, const Core::Id id);
- virtual ~Qt4MeegoTarget();
- virtual bool supportsDevice(const QSharedPointer<const ProjectExplorer::IDevice> &device) const;
- static QString defaultDisplayName();
-private:
- virtual QString specFileName() const;
-};
-
-} // namespace Internal
-} // namespace Madde
-
-#endif // QT4MAEMOTARGET_H
diff --git a/src/plugins/madde/qt4maemotargetfactory.cpp b/src/plugins/madde/qt4maemotargetfactory.cpp
deleted file mode 100644
index 9ca58d8e10..0000000000
--- a/src/plugins/madde/qt4maemotargetfactory.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "qt4maemotargetfactory.h"
-#include "maemoglobal.h"
-#include "maemopackagecreationstep.h"
-#include "qt4maemodeployconfiguration.h"
-#include "qt4maemotarget.h"
-
-#include <projectexplorer/deployconfiguration.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <qt4projectmanager/buildconfigurationinfo.h>
-#include <qt4projectmanager/qt4project.h>
-#include <qt4projectmanager/qt4projectmanagerconstants.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
-#include <qtsupport/qtversionmanager.h>
-#include <utils/qtcassert.h>
-
-using namespace Qt4ProjectManager;
-using namespace Qt4ProjectManager::Constants;
-using ProjectExplorer::idFromMap;
-
-namespace Madde {
-namespace Internal {
-
-// -------------------------------------------------------------------------
-// Qt4MaemoTargetFactory
-// -------------------------------------------------------------------------
-Qt4MaemoTargetFactory::Qt4MaemoTargetFactory(QObject *parent) :
- Qt4BaseTargetFactory(parent)
-{
- connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
- this, SIGNAL(canCreateTargetIdsChanged()));
-}
-
-Qt4MaemoTargetFactory::~Qt4MaemoTargetFactory()
-{
-}
-
-bool Qt4MaemoTargetFactory::supportsTargetId(const Core::Id id) const
-{
- return MaemoGlobal::isMaemoTargetId(id);
-}
-
-QList<Core::Id> Qt4MaemoTargetFactory::supportedTargetIds() const
-{
- QList<Core::Id> targetIds;
- targetIds << Core::Id(MAEMO5_DEVICE_TARGET_ID)
- << Core::Id(HARMATTAN_DEVICE_TARGET_ID)
- << Core::Id(MEEGO_DEVICE_TARGET_ID);
- return targetIds;
-}
-
-QString Qt4MaemoTargetFactory::displayNameForId(const Core::Id id) const
-{
- if (id == Core::Id(MAEMO5_DEVICE_TARGET_ID))
- return Qt4Maemo5Target::defaultDisplayName();
- else if (id == Core::Id(HARMATTAN_DEVICE_TARGET_ID))
- return Qt4HarmattanTarget::defaultDisplayName();
- else if (id == Core::Id(MEEGO_DEVICE_TARGET_ID))
- return Qt4MeegoTarget::defaultDisplayName();
- return QString();
-}
-
-QIcon Qt4MaemoTargetFactory::iconForId(const Core::Id id) const
-{
- Q_UNUSED(id)
- return QIcon(":/projectexplorer/images/MaemoDevice.png");
-}
-
-bool Qt4MaemoTargetFactory::canCreate(ProjectExplorer::Project *parent, const Core::Id id) const
-{
- if (!qobject_cast<Qt4Project *>(parent))
- return false;
- if (!supportsTargetId(id))
- return false;
-
- return !QtSupport::QtVersionManager::instance()->versionsForTargetId(id).isEmpty();
-}
-
-bool Qt4MaemoTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const
-{
- return qobject_cast<Qt4Project *>(parent) && supportsTargetId(idFromMap(map));
-}
-
-ProjectExplorer::Target *Qt4MaemoTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map)
-{
- if (!canRestore(parent, map))
- return 0;
-
- const Core::Id id = idFromMap(map);
- AbstractQt4MaemoTarget *target = 0;
- Qt4Project *qt4project = static_cast<Qt4Project *>(parent);
- if (id == Core::Id(MAEMO5_DEVICE_TARGET_ID))
- target = new Qt4Maemo5Target(qt4project, id);
- else if (id == Core::Id(HARMATTAN_DEVICE_TARGET_ID))
- target = new Qt4HarmattanTarget(qt4project, id);
- else if (id == Core::Id(MEEGO_DEVICE_TARGET_ID))
- target = new Qt4MeegoTarget(qt4project, id);
- if (target->fromMap(map))
- return target;
- delete target;
- return 0;
-}
-
-QString Qt4MaemoTargetFactory::buildNameForId(const Core::Id id) const
-{
- if (id == Core::Id(MAEMO5_DEVICE_TARGET_ID))
- return QLatin1String("maemo");
- else if (id == Core::Id(HARMATTAN_DEVICE_TARGET_ID))
- return QLatin1String("harmattan");
- else if (id == Core::Id(MEEGO_DEVICE_TARGET_ID))
- return QLatin1String("meego");
- else
- return QString();
-}
-
-QString Qt4MaemoTargetFactory::shadowBuildDirectory(const QString &profilePath, const Core::Id id, const QString &suffix)
-{
-#if defined(Q_OS_WIN)
- // No shadowbuilding for windows!
- Q_UNUSED(id);
- Q_UNUSED(suffix);
- return QFileInfo(profilePath).absolutePath();
-#else
- return Qt4BaseTargetFactory::shadowBuildDirectory(profilePath, id, suffix);
-#endif
-}
-
-QSet<QString> Qt4MaemoTargetFactory::targetFeatures(const Core::Id id) const
-{
- Q_UNUSED(id);
- QSet<QString> features;
- features << Qt4ProjectManager::Constants::MOBILE_TARGETFEATURE_ID;
-#ifndef Q_OS_WIN
- features << Qt4ProjectManager::Constants::SHADOWBUILD_TARGETFEATURE_ID;
-#endif
- return features;
-}
-
-ProjectExplorer::Target *Qt4MaemoTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id)
-{
- if (!canCreate(parent, id))
- return 0;
-
- QList<QtSupport::BaseQtVersion *> knownVersions = QtSupport::QtVersionManager::instance()->versionsForTargetId(id);
- if (knownVersions.isEmpty())
- return 0;
-
- QtSupport::BaseQtVersion *qtVersion = knownVersions.first();
- QtSupport::BaseQtVersion::QmakeBuildConfigs config = qtVersion->defaultBuildConfig();
-
- QList<BuildConfigurationInfo> infos;
- infos.append(BuildConfigurationInfo(qtVersion->uniqueId(), config, QString(), QString()));
- infos.append(BuildConfigurationInfo(qtVersion->uniqueId(), config ^ QtSupport::BaseQtVersion::DebugBuild, QString(), QString()));
-
- return create(parent, id, infos);
-}
-
-ProjectExplorer::Target *Qt4MaemoTargetFactory::create(ProjectExplorer::Project *parent,
- const Core::Id id, const QList<BuildConfigurationInfo> &infos)
-{
- if (!canCreate(parent, id))
- return 0;
-
- AbstractQt4MaemoTarget *target = 0;
- QList<Core::Id> deployConfigIds;
- if (id == Core::Id(MAEMO5_DEVICE_TARGET_ID)) {
- target = new Qt4Maemo5Target(static_cast<Qt4Project *>(parent), id);
- deployConfigIds << Qt4MaemoDeployConfiguration::fremantleWithPackagingId()
- << Qt4MaemoDeployConfiguration::fremantleWithoutPackagingId();
- } else if (id == Core::Id(HARMATTAN_DEVICE_TARGET_ID)) {
- target = new Qt4HarmattanTarget(static_cast<Qt4Project *>(parent), id);
- deployConfigIds << Qt4MaemoDeployConfiguration::harmattanId();
- } else if (id == Core::Id(MEEGO_DEVICE_TARGET_ID)) {
- target = new Qt4MeegoTarget(static_cast<Qt4Project *>(parent), id);
- deployConfigIds << Qt4MaemoDeployConfiguration::meegoId();
- }
- Q_ASSERT(target);
-
- foreach (const BuildConfigurationInfo &info, infos)
- target->addQt4BuildConfiguration(msgBuildConfigurationName(info), QString(),
- info.version(), info.buildConfig,
- info.additionalArguments, info.directory, info.importing);
-
- foreach (const Core::Id &deployConfigId, deployConfigIds) {
- target->addDeployConfiguration(target->createDeployConfiguration(deployConfigId));
- }
- target->createApplicationProFiles(false);
- if (target->runConfigurations().isEmpty())
- target->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(target));
- return target;
-}
-
-} // namespace Internal
-} // namespace Madde
diff --git a/src/plugins/madde/qt4maemotargetfactory.h b/src/plugins/madde/qt4maemotargetfactory.h
deleted file mode 100644
index db858de1a2..0000000000
--- a/src/plugins/madde/qt4maemotargetfactory.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef QT4MAEMOTARGETFACTORY_H
-#define QT4MAEMOTARGETFACTORY_H
-
-#include <qt4projectmanager/qt4basetargetfactory.h>
-
-namespace Madde {
-namespace Internal {
-
-class Qt4MaemoTargetFactory : public Qt4ProjectManager::Qt4BaseTargetFactory
-{
- Q_OBJECT
-public:
- Qt4MaemoTargetFactory(QObject *parent = 0);
- ~Qt4MaemoTargetFactory();
-
- QList<Core::Id> supportedTargetIds() const;
- QString displayNameForId(const Core::Id id) const;
- QIcon iconForId(const Core::Id id) const;
-
- bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
- bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
- ProjectExplorer::Target *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
-
- QString shadowBuildDirectory(const QString &profilePath, const Core::Id id, const QString &suffix);
- QString buildNameForId(const Core::Id id) const;
-
- bool supportsTargetId(const Core::Id id) const;
-
- ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id);
- ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id,
- const QList<Qt4ProjectManager::BuildConfigurationInfo> &infos);
-
- QSet<QString> targetFeatures(const Core::Id id) const;
-};
-
-} // namespace Internal
-} // namespace Madde
-
-#endif // QT4MAEMOTARGETFACTORY_H
diff --git a/src/plugins/madde/rpmmanager.cpp b/src/plugins/madde/rpmmanager.cpp
new file mode 100644
index 0000000000..ece1ec24c9
--- /dev/null
+++ b/src/plugins/madde/rpmmanager.cpp
@@ -0,0 +1,243 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "rpmmanager.h"
+
+#include "maddedevice.h"
+#include "maemoconstants.h"
+#include "maemoglobal.h"
+#include "maemopackagecreationstep.h"
+
+#include <coreplugin/documentmanager.h>
+#include <projectexplorer/project.h>
+#include <projectexplorer/target.h>
+#include <qt4projectmanager/qt4buildconfiguration.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <utils/filesystemwatcher.h>
+#include <utils/qtcassert.h>
+
+#include <QBuffer>
+#include <QByteArray>
+#include <QDateTime>
+#include <QDir>
+#include <QProcess>
+
+#include <QMessageBox>
+
+// -----------------------------------------------------------------------
+// Helpers:
+// -----------------------------------------------------------------------
+
+namespace {
+
+const QLatin1String PackagingDirName("qtc_packaging");
+const QByteArray NameTag("Name");
+const QByteArray SummaryTag("Summary");
+const QByteArray VersionTag("Version");
+const QByteArray ReleaseTag("Release");
+
+bool adaptTagValue(QByteArray &document, const QByteArray &fieldName,
+ const QByteArray &newFieldValue, bool caseSensitive)
+{
+ QByteArray adaptedLine = fieldName + ": " + newFieldValue;
+ const QByteArray completeTag = fieldName + ':';
+ const int lineOffset = caseSensitive ? document.indexOf(completeTag)
+ : document.toLower().indexOf(completeTag.toLower());
+ if (lineOffset == -1) {
+ document.append(adaptedLine).append('\n');
+ return true;
+ }
+
+ int newlineOffset = document.indexOf('\n', lineOffset);
+ bool updated = false;
+ if (newlineOffset == -1) {
+ newlineOffset = document.length();
+ adaptedLine += '\n';
+ updated = true;
+ }
+ const int replaceCount = newlineOffset - lineOffset;
+ if (!updated && document.mid(lineOffset, replaceCount) != adaptedLine)
+ updated = true;
+ if (updated)
+ document.replace(lineOffset, replaceCount, adaptedLine);
+ return updated;
+}
+
+QByteArray valueForTag(const Utils::FileName &spec, const QByteArray &tag, QString *error)
+{
+ Utils::FileReader reader;
+ if (!reader.fetch(spec.toString(), error))
+ return QByteArray();
+ const QByteArray &content = reader.data();
+ const QByteArray completeTag = tag.toLower() + ':';
+ int index = content.toLower().indexOf(completeTag);
+ if (index == -1)
+ return QByteArray();
+ index += completeTag.count();
+ int endIndex = content.indexOf('\n', index);
+ if (endIndex == -1)
+ endIndex = content.count();
+ return content.mid(index, endIndex - index).trimmed();
+}
+
+bool setValueForTag(const Utils::FileName &spec, const QByteArray &tag, const QByteArray &value, QString *error)
+{
+ Utils::FileReader reader;
+ if (!reader.fetch(spec.toString(), error))
+ return false;
+ QByteArray content = reader.data();
+ if (adaptTagValue(content, tag, value, false)) {
+ Utils::FileSaver saver(spec.toString());
+ saver.write(content);
+ return saver.finalize(error);
+ }
+ return true;
+}
+
+} // namespace
+
+namespace Madde {
+namespace Internal {
+
+// -----------------------------------------------------------------------
+// RpmManager:
+// -----------------------------------------------------------------------
+
+RpmManager *RpmManager::m_instance = 0;
+
+RpmManager::RpmManager(QObject *parent) :
+ QObject(parent),
+ m_watcher(new Utils::FileSystemWatcher(this))
+{
+ m_instance = this;
+
+ m_watcher->setObjectName("Madde::RpmManager");
+ connect(m_watcher, SIGNAL(fileChanged(QString)),
+ this, SLOT(specFileWasChanged(QString)));
+}
+
+RpmManager::~RpmManager()
+{ }
+
+RpmManager *RpmManager::instance()
+{
+ return m_instance;
+}
+
+void RpmManager::monitor(const Utils::FileName &spec)
+{
+ QFileInfo fi = spec.toFileInfo();
+ if (!fi.isFile())
+ return;
+
+ if (!m_watches.contains(spec)) {
+ m_watches.insert(spec, 1);
+ m_watcher->addFile(spec.toString(), Utils::FileSystemWatcher::WatchAllChanges);
+ }
+}
+
+void RpmManager::ignore(const Utils::FileName &spec)
+{
+ int count = m_watches.value(spec, 0) - 1;
+ if (count < 0)
+ return;
+ if (count > 0) {
+ m_watches[spec] = 0;
+ } else {
+ m_watches.remove(spec);
+ m_watcher->removeFile(spec.toString());
+ }
+}
+
+QString RpmManager::projectVersion(const Utils::FileName &spec, QString *error)
+{
+ return QString::fromUtf8(valueForTag(spec, VersionTag, error));
+}
+
+bool RpmManager::setProjectVersion(const Utils::FileName &spec, const QString &version, QString *error)
+{
+ return setValueForTag(spec, VersionTag, version.toUtf8(), error);
+}
+
+QString RpmManager::packageName(const Utils::FileName &spec)
+{
+ return QString::fromUtf8(valueForTag(spec, NameTag, 0));
+}
+
+bool RpmManager::setPackageName(const Utils::FileName &spec, const QString &packageName)
+{
+ return setValueForTag(spec, NameTag, packageName.toUtf8(), 0);
+}
+
+QString RpmManager::shortDescription(const Utils::FileName &spec)
+{
+ return QString::fromUtf8(valueForTag(spec, SummaryTag, 0));
+}
+
+bool RpmManager::setShortDescription(const Utils::FileName &spec, const QString &description)
+{
+ return setValueForTag(spec, SummaryTag, description.toUtf8(), 0);
+}
+
+Utils::FileName RpmManager::packageFileName(const Utils::FileName &spec, ProjectExplorer::Target *t)
+{
+ QtSupport::BaseQtVersion *lqt = QtSupport::QtProfileInformation::qtVersion(t->profile());
+ if (!lqt)
+ return Utils::FileName();
+ return Utils::FileName::fromString(packageName(spec)
+ + QLatin1Char('-') + projectVersion(spec)
+ + QLatin1Char('-') + QString::fromUtf8(valueForTag(spec, ReleaseTag, 0))
+ + QLatin1Char('.') + MaemoGlobal::architecture(lqt->qmakeCommand().toString())
+ + QLatin1String(".rpm"));
+}
+
+Utils::FileName RpmManager::specFile(ProjectExplorer::Target *target)
+{
+ Utils::FileName path = Utils::FileName::fromString(target->project()->projectDirectory());
+ path.appendPath(PackagingDirName);
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target->profile());
+ if (deviceType == Core::Id(MeeGoOsType))
+ path.appendPath(QLatin1String("meego.spec"));
+ else
+ path.clear();
+ return path;
+}
+
+void RpmManager::specFileWasChanged(const QString &path)
+{
+ Utils::FileName fn = Utils::FileName::fromString(path);
+ QTC_ASSERT(m_watches.contains(fn), return);
+ emit specFileChanged(fn);
+}
+
+} // namespace Internal
+} // namespace Madde
diff --git a/src/plugins/madde/rpmmanager.h b/src/plugins/madde/rpmmanager.h
new file mode 100644
index 0000000000..5a4a2f7ed8
--- /dev/null
+++ b/src/plugins/madde/rpmmanager.h
@@ -0,0 +1,92 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef RPMMANAGER_H
+#define RPMMANAGER_H
+
+#include <coreplugin/id.h>
+#include <utils/fileutils.h>
+
+#include <QObject>
+#include <QHash>
+
+namespace Utils { class FileSystemWatcher; }
+namespace ProjectExplorer { class Target; }
+namespace Qt4ProjectManager { class Qt4BuildConfiguration; }
+
+namespace Madde {
+namespace Internal {
+class MaddePlugin;
+
+class RpmManager : public QObject
+{
+ Q_OBJECT
+public:
+ ~RpmManager();
+
+ static RpmManager *instance();
+
+ // ref counted:
+ void monitor(const Utils::FileName &specFile);
+ void ignore(const Utils::FileName &specFile);
+
+ static QString projectVersion(const Utils::FileName &spec, QString *error = 0);
+ static bool setProjectVersion(const Utils::FileName &spec, const QString &version, QString *error = 0);
+ static QString packageName(const Utils::FileName &spec);
+ static bool setPackageName(const Utils::FileName &spec, const QString &packageName);
+ static QString shortDescription(const Utils::FileName &spec);
+ static bool setShortDescription(const Utils::FileName &spec, const QString &description);
+
+ static Utils::FileName packageFileName(const Utils::FileName &spec, ProjectExplorer::Target *t);
+
+ static Utils::FileName specFile(ProjectExplorer::Target *target);
+
+signals:
+ void specFileChanged(const Utils::FileName &spec);
+
+private slots:
+ void specFileWasChanged(const QString &path);
+
+private:
+ explicit RpmManager(QObject *parent = 0);
+
+ Utils::FileSystemWatcher *m_watcher;
+ QHash<Utils::FileName, int> m_watches;
+ static RpmManager *m_instance;
+
+ friend class MaddePlugin;
+};
+
+} // namespace Internal
+} // namespace Madde
+
+#endif // DEBIANMANAGER_H
diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp
index 4bb17b044e..0017243a5a 100644
--- a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp
+++ b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp
@@ -132,14 +132,6 @@ QString AbstractMsvcToolChain::makeCommand() const
return QLatin1String("nmake.exe");
}
-void AbstractMsvcToolChain::setDebuggerCommand(const Utils::FileName &d)
-{
- if (m_debuggerCommand == d)
- return;
- m_debuggerCommand = d;
- toolChainUpdated();
-}
-
Utils::FileName AbstractMsvcToolChain::compilerCommand() const
{
Utils::Environment env;
@@ -147,12 +139,6 @@ Utils::FileName AbstractMsvcToolChain::compilerCommand() const
return Utils::FileName::fromString(env.searchInPath("cl.exe"));
}
-Utils::FileName AbstractMsvcToolChain::debuggerCommand() const
-{
- return m_debuggerCommand;
-}
-
-
IOutputParser *AbstractMsvcToolChain::outputParser() const
{
return new MsvcParser;
@@ -296,7 +282,6 @@ bool AbstractMsvcToolChain::operator ==(const ToolChain &other) const
const AbstractMsvcToolChain *msvcTc = static_cast<const AbstractMsvcToolChain *>(&other);
return targetAbi() == msvcTc->targetAbi()
- && m_debuggerCommand == msvcTc->m_debuggerCommand
&& m_vcvarsBat == msvcTc->m_vcvarsBat;
}
diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.h b/src/plugins/projectexplorer/abstractmsvctoolchain.h
index 519785880c..ef26aa401c 100644
--- a/src/plugins/projectexplorer/abstractmsvctoolchain.h
+++ b/src/plugins/projectexplorer/abstractmsvctoolchain.h
@@ -57,10 +57,7 @@ public:
void addToEnvironment(Utils::Environment &env) const;
QString makeCommand() const;
- void setDebuggerCommand(const Utils::FileName &d);
-
Utils::FileName compilerCommand() const;
- Utils::FileName debuggerCommand() const;
IOutputParser *outputParser() const;
bool canClone() const;
diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp
index df9561db06..e97134952c 100644
--- a/src/plugins/projectexplorer/buildconfiguration.cpp
+++ b/src/plugins/projectexplorer/buildconfiguration.cpp
@@ -32,16 +32,16 @@
#include "buildconfiguration.h"
-#include "toolchain.h"
#include "buildmanager.h"
#include "buildsteplist.h"
#include "projectexplorer.h"
#include "projectexplorerconstants.h"
+#include "profilemanager.h"
#include "target.h"
-#include "toolchainmanager.h"
#include "project.h"
#include <coreplugin/variablemanager.h>
+#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
#include <utils/stringutils.h>
@@ -52,7 +52,6 @@ static const char BUILD_STEP_LIST_COUNT[] = "ProjectExplorer.BuildConfiguration.
static const char BUILD_STEP_LIST_PREFIX[] = "ProjectExplorer.BuildConfiguration.BuildStepList.";
static const char CLEAR_SYSTEM_ENVIRONMENT_KEY[] = "ProjectExplorer.BuildConfiguration.ClearSystemEnvironment";
static const char USER_ENVIRONMENT_CHANGES_KEY[] = "ProjectExplorer.BuildConfiguration.UserEnvironmentChanges";
-static const char TOOLCHAIN_KEY[] = "ProjectExplorer.BuildCOnfiguration.ToolChain";
namespace ProjectExplorer {
namespace Internal {
@@ -83,7 +82,6 @@ bool BuildConfigMacroExpander::resolveMacro(const QString &name, QString *ret)
BuildConfiguration::BuildConfiguration(Target *target, const Core::Id id) :
ProjectConfiguration(target, id),
m_clearSystemEnvironment(false),
- m_toolChain(0),
m_macroExpander(0)
{
Q_ASSERT(target);
@@ -96,19 +94,14 @@ BuildConfiguration::BuildConfiguration(Target *target, const Core::Id id) :
bsl->setDefaultDisplayName(tr("Clean"));
m_stepLists.append(bsl);
- connect(ToolChainManager::instance(), SIGNAL(toolChainRemoved(ProjectExplorer::ToolChain*)),
- this, SLOT(handleToolChainRemovals(ProjectExplorer::ToolChain*)));
- connect(ToolChainManager::instance(), SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
- this, SLOT(handleToolChainAddition(ProjectExplorer::ToolChain*)));
- connect(ToolChainManager::instance(), SIGNAL(toolChainUpdated(ProjectExplorer::ToolChain*)),
- this, SLOT(handleToolChainUpdates(ProjectExplorer::ToolChain*)));
+ connect(ProfileManager::instance(), SIGNAL(profileUpdated(ProjectExplorer::Profile*)),
+ this, SLOT(handleProfileUpdate(ProjectExplorer::Profile*)));
}
BuildConfiguration::BuildConfiguration(Target *target, BuildConfiguration *source) :
ProjectConfiguration(target, source),
m_clearSystemEnvironment(source->m_clearSystemEnvironment),
m_userEnvironmentChanges(source->m_userEnvironmentChanges),
- m_toolChain(source->m_toolChain),
m_macroExpander(0)
{
Q_ASSERT(target);
@@ -116,12 +109,8 @@ BuildConfiguration::BuildConfiguration(Target *target, BuildConfiguration *sourc
// otherwise BuildStepFactories might reject to set up a BuildStep for us
// since we are not yet the derived class!
- connect(ToolChainManager::instance(), SIGNAL(toolChainRemoved(ProjectExplorer::ToolChain*)),
- this, SLOT(handleToolChainRemovals(ProjectExplorer::ToolChain*)));
- connect(ToolChainManager::instance(), SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
- this, SLOT(handleToolChainAddition(ProjectExplorer::ToolChain*)));
- connect(ToolChainManager::instance(), SIGNAL(toolChainUpdated(ProjectExplorer::ToolChain*)),
- this, SLOT(handleToolChainUpdates(ProjectExplorer::ToolChain*)));
+ connect(ProfileManager::instance(), SIGNAL(profileUpdated(ProjectExplorer::Profile*)),
+ this, SLOT(handleProfileUpdate(ProjectExplorer::Profile*)));
}
BuildConfiguration::~BuildConfiguration()
@@ -162,8 +151,6 @@ QVariantMap BuildConfiguration::toMap() const
for (int i = 0; i < m_stepLists.count(); ++i)
map.insert(QLatin1String(BUILD_STEP_LIST_PREFIX) + QString::number(i), m_stepLists.at(i)->toMap());
- map.insert(QLatin1String(TOOLCHAIN_KEY), m_toolChain ? m_toolChain->id() : QLatin1String("INVALID"));
-
return map;
}
@@ -195,10 +182,6 @@ bool BuildConfiguration::fromMap(const QVariantMap &map)
m_stepLists.append(list);
}
- const QString id = map.value(QLatin1String(TOOLCHAIN_KEY)).toString();
- setToolChain(ToolChainManager::instance()->findToolChain(id)); // Do not validate the tool chain as
- // the BC is not completely set up yet!
-
// We currently assume there to be at least a clean and build list!
QTC_CHECK(knownStepLists().contains(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD)));
QTC_CHECK(knownStepLists().contains(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_CLEAN)));
@@ -206,52 +189,18 @@ bool BuildConfiguration::fromMap(const QVariantMap &map)
return ProjectConfiguration::fromMap(map);
}
-void BuildConfiguration::handleToolChainRemovals(ProjectExplorer::ToolChain *tc)
-{
- if (m_toolChain != tc)
- return;
- setToolChain(target()->preferredToolChain(this));
-}
-
-void BuildConfiguration::handleToolChainAddition(ProjectExplorer::ToolChain *tc)
-{
- Q_UNUSED(tc);
- if (m_toolChain != 0)
- return;
- setToolChain(target()->preferredToolChain(this));
-}
-
-void BuildConfiguration::handleToolChainUpdates(ProjectExplorer::ToolChain *tc)
+void BuildConfiguration::handleProfileUpdate(ProjectExplorer::Profile *p)
{
- if (tc != m_toolChain)
+ if (p != target()->profile())
return;
- QList<ToolChain *> candidates = target()->possibleToolChains(this);
- if (!candidates.contains(m_toolChain))
- setToolChain(target()->preferredToolChain(this));
- else
- emit toolChainChanged();
+ emit environmentChanged();
}
-
Target *BuildConfiguration::target() const
{
return static_cast<Target *>(parent());
}
-ProjectExplorer::ToolChain *BuildConfiguration::toolChain() const
-{
- return m_toolChain;
-}
-
-void BuildConfiguration::setToolChain(ProjectExplorer::ToolChain *tc)
-{
- if (m_toolChain == tc)
- return;
- m_toolChain = tc;
- emit toolChainChanged();
- emit environmentChanged();
-}
-
Utils::Environment BuildConfiguration::baseEnvironment() const
{
Utils::Environment result;
@@ -333,4 +282,26 @@ IBuildConfigurationFactory::IBuildConfigurationFactory(QObject *parent) :
IBuildConfigurationFactory::~IBuildConfigurationFactory()
{ }
+IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, const QVariantMap &map)
+{
+ QList<IBuildConfigurationFactory *> factories
+ = ExtensionSystem::PluginManager::instance()->getObjects<IBuildConfigurationFactory>();
+ foreach (IBuildConfigurationFactory *factory, factories) {
+ if (factory->canRestore(parent, map))
+ return factory;
+ }
+ return 0;
+}
+
+IBuildConfigurationFactory * IBuildConfigurationFactory::find(Target *parent)
+{
+ QList<IBuildConfigurationFactory *> factories
+ = ExtensionSystem::PluginManager::instance()->getObjects<IBuildConfigurationFactory>();
+ foreach (IBuildConfigurationFactory *factory, factories) {
+ if (!factory->availableCreationIds(parent).isEmpty())
+ return factory;
+ }
+ return 0;
+}
+
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/buildconfiguration.h b/src/plugins/projectexplorer/buildconfiguration.h
index e2057f4ef4..958692f900 100644
--- a/src/plugins/projectexplorer/buildconfiguration.h
+++ b/src/plugins/projectexplorer/buildconfiguration.h
@@ -47,9 +47,10 @@ class AbstractMacroExpander;
namespace ProjectExplorer {
class BuildConfiguration;
+class BuildConfigWidget;
class BuildStepList;
+class Profile;
class Target;
-class ToolChain;
class IOutputParser;
class PROJECTEXPLORER_EXPORT BuildConfiguration : public ProjectConfiguration
@@ -62,6 +63,8 @@ public:
virtual QString buildDirectory() const = 0;
+ virtual BuildConfigWidget *createConfigWidget() = 0;
+
// Maybe the BuildConfiguration is not the best place for the environment
virtual Utils::Environment baseEnvironment() const;
QString baseEnvironmentText() const;
@@ -90,9 +93,6 @@ public:
Utils::AbstractMacroExpander *macroExpander();
- virtual ProjectExplorer::ToolChain *toolChain() const;
- virtual void setToolChain(ProjectExplorer::ToolChain *tc);
-
enum BuildType {
Unknown,
Debug,
@@ -104,7 +104,10 @@ signals:
void environmentChanged();
void buildDirectoryChanged();
void enabledChanged();
- void toolChainChanged();
+ /// Emitted whenever the build system needs to be (re-) evaluated
+ void requestBuildSystemEvaluation();
+ /// Emitter whenever the build directory was successfully initialized (configured).
+ void buildDirectoryInitialized();
protected:
BuildConfiguration(Target *target, const Core::Id id);
@@ -115,15 +118,12 @@ protected:
virtual bool fromMap(const QVariantMap &map);
private slots:
- void handleToolChainRemovals(ProjectExplorer::ToolChain *tc);
- void handleToolChainAddition(ProjectExplorer::ToolChain *tc);
- void handleToolChainUpdates(ProjectExplorer::ToolChain*);
+ void handleProfileUpdate(ProjectExplorer::Profile *p);
private:
bool m_clearSystemEnvironment;
QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
QList<BuildStepList *> m_stepLists;
- ToolChain *m_toolChain;
Utils::AbstractMacroExpander *m_macroExpander;
};
@@ -137,18 +137,21 @@ public:
virtual ~IBuildConfigurationFactory();
// used to show the list of possible additons to a target, returns a list of types
- virtual QList<Core::Id> availableCreationIds(Target *parent) const = 0;
+ virtual QList<Core::Id> availableCreationIds(const Target *parent) const = 0;
// used to translate the types to names to display to the user
virtual QString displayNameForId(const Core::Id id) const = 0;
- virtual bool canCreate(Target *parent, const Core::Id id) const = 0;
- virtual BuildConfiguration *create(Target *parent, const Core::Id id) = 0;
+ virtual bool canCreate(const Target *parent, const Core::Id id) const = 0;
+ virtual BuildConfiguration *create(Target *parent, const Core::Id id, const QString &name = QString()) = 0;
// used to recreate the runConfigurations when restoring settings
- virtual bool canRestore(Target *parent, const QVariantMap &map) const = 0;
+ virtual bool canRestore(const Target *parent, const QVariantMap &map) const = 0;
virtual BuildConfiguration *restore(Target *parent, const QVariantMap &map) = 0;
- virtual bool canClone(Target *parent, BuildConfiguration *product) const = 0;
+ virtual bool canClone(const Target *parent, BuildConfiguration *product) const = 0;
virtual BuildConfiguration *clone(Target *parent, BuildConfiguration *product) = 0;
+ static IBuildConfigurationFactory *find(Target *parent, const QVariantMap &map);
+ static IBuildConfigurationFactory *find(Target *parent);
+
signals:
void availableCreationIdsChanged();
};
diff --git a/src/plugins/projectexplorer/buildenvironmentwidget.cpp b/src/plugins/projectexplorer/buildenvironmentwidget.cpp
index acafb1eb38..6ce515fb6f 100644
--- a/src/plugins/projectexplorer/buildenvironmentwidget.cpp
+++ b/src/plugins/projectexplorer/buildenvironmentwidget.cpp
@@ -35,6 +35,7 @@
#include "buildconfiguration.h"
#include "environmentwidget.h"
+#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
#include <QVBoxLayout>
@@ -69,17 +70,13 @@ void BuildEnvironmentWidget::init(BuildConfiguration *bc)
Q_ASSERT(bc);
if (m_buildConfiguration) {
- disconnect(m_buildConfiguration, SIGNAL(environmentChanged()),
- this, SLOT(environmentChanged()));
- disconnect(m_buildConfiguration, SIGNAL(toolChainChanged()),
+ disconnect(m_buildConfiguration->target(), SIGNAL(environmentChanged()),
this, SLOT(environmentChanged()));
}
m_buildConfiguration = bc;
- connect(m_buildConfiguration, SIGNAL(environmentChanged()),
- this, SLOT(environmentChanged()));
- connect(m_buildConfiguration, SIGNAL(toolChainChanged()),
+ connect(m_buildConfiguration->target(), SIGNAL(environmentChanged()),
this, SLOT(environmentChanged()));
m_clearSystemEnvironmentCheckBox->setChecked(!m_buildConfiguration->useSystemEnvironment());
diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
index 986f52de15..91a693a561 100644
--- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
@@ -80,7 +80,7 @@ int BuildSettingsPanelFactory::priority() const
bool BuildSettingsPanelFactory::supports(Target *target)
{
- return target->buildConfigurationFactory();
+ return IBuildConfigurationFactory::find(target);
}
PropertiesPanel *BuildSettingsPanelFactory::createPanel(Target *target)
@@ -120,7 +120,7 @@ void BuildSettingsWidget::setupUi()
QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->setContentsMargins(0, 0, 0, 0);
- if (!m_target->buildConfigurationFactory()) {
+ if (!IBuildConfigurationFactory::find(m_target)) {
QLabel *noSettingsLabel = new QLabel(this);
noSettingsLabel->setText(tr("No build settings available"));
QFont f = noSettingsLabel->font();
@@ -179,9 +179,7 @@ void BuildSettingsWidget::setupUi()
connect(m_target, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
this, SLOT(updateActiveConfiguration()));
- if (m_target->buildConfigurationFactory())
- connect(m_target->buildConfigurationFactory(), SIGNAL(availableCreationIdsChanged()),
- SLOT(updateAddButtonMenu()));
+ connect(m_target, SIGNAL(profileChanged()), this, SLOT(updateAddButtonMenu()));
}
void BuildSettingsWidget::addSubWidget(BuildConfigWidget *widget)
@@ -227,12 +225,10 @@ void BuildSettingsWidget::updateAddButtonMenu()
m_addButtonMenu->addAction(tr("&Clone Selected"),
this, SLOT(cloneConfiguration()));
}
- IBuildConfigurationFactory *factory = m_target->buildConfigurationFactory();
- if (factory) {
- foreach (Core::Id id, factory->availableCreationIds(m_target)) {
- QAction *action = m_addButtonMenu->addAction(factory->displayNameForId(id), this, SLOT(createConfiguration()));
- action->setData(QVariant::fromValue(id));
- }
+ IBuildConfigurationFactory * factory = IBuildConfigurationFactory::find(m_target);
+ foreach (Core::Id id, factory->availableCreationIds(m_target)) {
+ QAction *action = m_addButtonMenu->addAction(factory->displayNameForId(id), this, SLOT(createConfiguration()));
+ action->setData(QVariant::fromValue(id));
}
}
}
@@ -245,7 +241,7 @@ void BuildSettingsWidget::updateBuildSettings()
m_removeButton->setEnabled(m_target->buildConfigurations().size() > 1);
// Add pages
- BuildConfigWidget *generalConfigWidget = m_target->createConfigWidget();
+ BuildConfigWidget *generalConfigWidget = m_buildConfiguration->createConfigWidget();
addSubWidget(generalConfigWidget);
addSubWidget(new BuildStepsPage(m_target, Core::Id(Constants::BUILDSTEPS_BUILD)));
@@ -285,16 +281,22 @@ void BuildSettingsWidget::updateActiveConfiguration()
void BuildSettingsWidget::createConfiguration()
{
- if (!m_target->buildConfigurationFactory())
- return;
-
QAction *action = qobject_cast<QAction *>(sender());
Core::Id id = action->data().value<Core::Id>();
- BuildConfiguration *bc = m_target->buildConfigurationFactory()->create(m_target, id);
- if (bc) {
- m_target->setActiveBuildConfiguration(bc);
- updateBuildSettings();
- }
+
+ IBuildConfigurationFactory *factory = IBuildConfigurationFactory::find(m_target);
+ if (!factory)
+ return;
+
+ BuildConfiguration *bc = factory->create(m_target, id);
+ if (!bc)
+ return;
+
+ m_target->addBuildConfiguration(bc);
+
+ QTC_CHECK(bc->id() == id);
+ m_target->setActiveBuildConfiguration(bc);
+ updateBuildSettings();
}
void BuildSettingsWidget::cloneConfiguration()
@@ -343,8 +345,10 @@ void BuildSettingsWidget::renameConfiguration()
void BuildSettingsWidget::cloneConfiguration(BuildConfiguration *sourceConfiguration)
{
- if (!sourceConfiguration ||
- !m_target->buildConfigurationFactory())
+ if (!sourceConfiguration)
+ return;
+ IBuildConfigurationFactory *factory = IBuildConfigurationFactory::find(m_target);
+ if (!factory)
return;
//: Title of a the cloned BuildConfiguration window, text of the window
@@ -352,7 +356,7 @@ void BuildSettingsWidget::cloneConfiguration(BuildConfiguration *sourceConfigura
if (name.isEmpty())
return;
- BuildConfiguration * bc(m_target->buildConfigurationFactory()->clone(m_target, sourceConfiguration));
+ BuildConfiguration *bc = factory->clone(m_target, sourceConfiguration);
if (!bc)
return;
diff --git a/src/plugins/projectexplorer/buildsteplist.cpp b/src/plugins/projectexplorer/buildsteplist.cpp
index 2349035d70..666e148f94 100644
--- a/src/plugins/projectexplorer/buildsteplist.cpp
+++ b/src/plugins/projectexplorer/buildsteplist.cpp
@@ -159,7 +159,7 @@ bool BuildStepList::fromMap(const QVariantMap &map)
qWarning() << "No step data found for" << i << "(continuing).";
continue;
}
- IBuildStepFactory *factory(findRestoreFactory(this, bsData));
+ IBuildStepFactory *factory = findRestoreFactory(this, bsData);
if (!factory) {
qWarning() << "No factory for step" << i << "found (continuing).";
continue;
diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp
index 5c292429d9..44e9070487 100644
--- a/src/plugins/projectexplorer/buildstepspage.cpp
+++ b/src/plugins/projectexplorer/buildstepspage.cpp
@@ -65,7 +65,7 @@ ToolWidget::ToolWidget(QWidget *parent)
layout->setMargin(4);
layout->setSpacing(4);
setLayout(layout);
- m_firstWidget = new FadingWidget(this);
+ m_firstWidget = new Utils::FadingWidget(this);
m_firstWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QHBoxLayout *hbox = new QHBoxLayout();
hbox->setContentsMargins(0, 0, 0, 0);
@@ -86,7 +86,7 @@ ToolWidget::ToolWidget(QWidget *parent)
hbox->addWidget(m_disableButton);
layout->addWidget(m_firstWidget);
- m_secondWidget = new FadingWidget(this);
+ m_secondWidget = new Utils::FadingWidget(this);
m_secondWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
hbox = new QHBoxLayout();
hbox->setMargin(0);
@@ -182,39 +182,6 @@ void ToolWidget::setDownVisible(bool b)
m_downButton->setVisible(b);
}
-FadingWidget::FadingWidget(QWidget *parent) :
- QWidget(parent),
- m_opacityEffect(new QGraphicsOpacityEffect)
-{
- m_opacityEffect->setOpacity(0);
- setGraphicsEffect(m_opacityEffect);
-
- // Workaround for issue with QGraphicsEffect. GraphicsEffect
- // currently clears with Window color. Remove if flickering
- // no longer occurs on fade-in
- QPalette pal;
- pal.setBrush(QPalette::All, QPalette::Window, Qt::transparent);
- setPalette(pal);
-}
-
-void FadingWidget::setOpacity(qreal value)
-{
- m_opacityEffect->setOpacity(value);
-}
-
-void FadingWidget::fadeTo(qreal value)
-{
- QPropertyAnimation *animation = new QPropertyAnimation(m_opacityEffect, "opacity");
- animation->setDuration(200);
- animation->setEndValue(value);
- animation->start(QAbstractAnimation::DeleteWhenStopped);
-}
-
-qreal FadingWidget::opacity()
-{
- return m_opacityEffect->opacity();
-}
-
BuildStepsWidgetData::BuildStepsWidgetData(BuildStep *s) :
step(s), widget(0), detailsWidget(0)
{
@@ -395,6 +362,7 @@ void BuildStepListWidget::triggerAddBuildStep()
if (QAction *action = qobject_cast<QAction *>(sender())) {
QPair<Core::Id, IBuildStepFactory *> pair = m_addBuildStepHash.value(action);
BuildStep *newStep = pair.second->create(m_buildStepList, pair.first);
+ QTC_ASSERT(newStep, return);
int pos = m_buildStepList->count();
m_buildStepList->insertStep(pos, newStep);
}
diff --git a/src/plugins/projectexplorer/buildstepspage.h b/src/plugins/projectexplorer/buildstepspage.h
index 32f6520379..10fe1edb08 100644
--- a/src/plugins/projectexplorer/buildstepspage.h
+++ b/src/plugins/projectexplorer/buildstepspage.h
@@ -57,17 +57,6 @@ class Target;
class BuildConfiguration;
namespace Internal {
-class FadingWidget : public QWidget
-{
- Q_OBJECT
-public:
- FadingWidget(QWidget *parent = 0);
- void fadeTo(qreal value);
- qreal opacity();
- void setOpacity(qreal value);
-protected:
- QGraphicsOpacityEffect *m_opacityEffect;
-};
class ToolWidget : public Utils::FadingPanel
{
@@ -97,8 +86,8 @@ private:
QToolButton *m_removeButton;
bool m_buildStepEnabled;
- FadingWidget *m_firstWidget;
- FadingWidget *m_secondWidget;
+ Utils::FadingWidget *m_firstWidget;
+ Utils::FadingWidget *m_secondWidget;
qreal m_targetOpacity;
};
diff --git a/src/plugins/projectexplorer/deployconfiguration.cpp b/src/plugins/projectexplorer/deployconfiguration.cpp
index f7f0469a41..f5b87e3cd5 100644
--- a/src/plugins/projectexplorer/deployconfiguration.cpp
+++ b/src/plugins/projectexplorer/deployconfiguration.cpp
@@ -35,10 +35,14 @@
#include "buildmanager.h"
#include "buildsteplist.h"
#include "buildstepspage.h"
+#include "profileinformation.h"
+#include "project.h"
#include "projectexplorer.h"
#include "projectexplorerconstants.h"
#include "target.h"
+#include <extensionsystem/pluginmanager.h>
+
#include <QStringList>
using namespace ProjectExplorer;
@@ -59,7 +63,7 @@ DeployConfiguration::DeployConfiguration(Target *target, const Core::Id id) :
//: Display name of the deploy build step list. Used as part of the labels in the project window.
m_stepList->setDefaultDisplayName(tr("Deploy"));
//: Default DeployConfiguration display name
- setDefaultDisplayName(tr("No deployment"));
+ setDefaultDisplayName(tr("Deploy locally"));
}
DeployConfiguration::DeployConfiguration(Target *target, DeployConfiguration *source) :
@@ -153,14 +157,15 @@ void DeployConfiguration::cloneSteps(DeployConfiguration *source)
DeployConfigurationFactory::DeployConfigurationFactory(QObject *parent) :
QObject(parent)
-{ }
+{ setObjectName(QLatin1String("DeployConfigurationFactory")); }
DeployConfigurationFactory::~DeployConfigurationFactory()
{ }
QList<Core::Id> DeployConfigurationFactory::availableCreationIds(Target *parent) const
{
- Q_UNUSED(parent);
+ if (!canHandle(parent))
+ return QList<Core::Id>();
return QList<Core::Id>() << Core::Id(Constants::DEFAULT_DEPLOYCONFIGURATION_ID);
}
@@ -174,7 +179,8 @@ QString DeployConfigurationFactory::displayNameForId(const Core::Id id) const
bool DeployConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
{
- Q_UNUSED(parent);
+ if (!canHandle(parent))
+ return false;
return id == Core::Id(Constants::DEFAULT_DEPLOYCONFIGURATION_ID);
}
@@ -214,6 +220,35 @@ DeployConfiguration *DeployConfigurationFactory::clone(Target *parent, DeployCon
return new DeployConfiguration(parent, product);
}
+DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent, const QVariantMap &map)
+{
+ QList<DeployConfigurationFactory *> factories
+ = ExtensionSystem::PluginManager::instance()->getObjects<DeployConfigurationFactory>();
+ foreach (DeployConfigurationFactory *factory, factories) {
+ if (factory->canRestore(parent, map))
+ return factory;
+ }
+ return 0;
+}
+
+DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent)
+{
+ QList<DeployConfigurationFactory *> factories
+ = ExtensionSystem::PluginManager::instance()->getObjects<DeployConfigurationFactory>();
+ foreach (DeployConfigurationFactory *factory, factories) {
+ if (!factory->availableCreationIds(parent).isEmpty())
+ return factory;
+ }
+ return 0;
+}
+
+bool DeployConfigurationFactory::canHandle(Target *parent) const
+{
+ if (!parent->project()->supportsProfile(parent->profile()))
+ return false;
+ return DeviceTypeProfileInformation::deviceTypeId(parent->profile()) == Core::Id(Constants::DESKTOP_DEVICE_TYPE);
+}
+
///
// DeployConfigurationWidget
///
diff --git a/src/plugins/projectexplorer/deployconfiguration.h b/src/plugins/projectexplorer/deployconfiguration.h
index 878578aece..af30b665db 100644
--- a/src/plugins/projectexplorer/deployconfiguration.h
+++ b/src/plugins/projectexplorer/deployconfiguration.h
@@ -70,6 +70,7 @@ public:
signals:
void enabledChanged();
+ void requestBuildSystemEvaluation();
protected:
DeployConfiguration(Target *target, const Core::Id id);
@@ -77,7 +78,7 @@ protected:
void cloneSteps(DeployConfiguration *source);
- virtual bool fromMap(const QVariantMap &map);
+ bool fromMap(const QVariantMap &map);
private:
friend class DeployConfigurationFactory;
@@ -107,8 +108,14 @@ public:
virtual bool canClone(Target *parent, DeployConfiguration *product) const;
virtual DeployConfiguration *clone(Target *parent, DeployConfiguration *product);
+ static DeployConfigurationFactory *find(Target *parent, const QVariantMap &map);
+ static DeployConfigurationFactory *find(Target *parent);
+
signals:
void availableCreationIdsChanged();
+
+private:
+ bool canHandle(Target *parent) const;
};
class PROJECTEXPLORER_EXPORT DeployConfigurationWidget : public NamedWidget
diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
index 6a2086f6ab..2e41051be9 100644
--- a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
+++ b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
@@ -139,13 +139,16 @@ void DeviceManager::save()
{
Utils::PersistentSettingsWriter writer;
writer.saveValue(QLatin1String(DeviceManagerKey), toMap());
- writer.save(settingsFilePath(), QLatin1String("QtCreatorDevices"), Core::ICore::mainWindow());
+ writer.save(settingsFilePath(QLatin1String("/qtcreator/devices.xml")),
+ QLatin1String("QtCreatorDevices"), Core::ICore::mainWindow());
}
void DeviceManager::load()
{
Utils::PersistentSettingsReader reader;
- if (reader.load(settingsFilePath()))
+ if (reader.load(settingsFilePath(QLatin1String("/qtcreator/devices.xml"))))
+ fromMap(reader.restoreValues().value(QLatin1String(DeviceManagerKey)).toMap());
+ else if (reader.load(settingsFilePath(QLatin1String("/devices.xml"))))
fromMap(reader.restoreValues().value(QLatin1String(DeviceManagerKey)).toMap());
else
loadPre2_6();
@@ -220,9 +223,10 @@ QVariantMap DeviceManager::toMap() const
return map;
}
-QString DeviceManager::settingsFilePath()
+QString DeviceManager::settingsFilePath(const QString &extension)
{
- return QFileInfo(ExtensionSystem::PluginManager::settings()->fileName()).absolutePath() + QLatin1String("/devices.xml");
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ return QFileInfo(pm->settings()->fileName()).absolutePath() + extension;
}
void DeviceManager::addDevice(const IDevice::Ptr &_device)
diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.h b/src/plugins/projectexplorer/devicesupport/devicemanager.h
index e9a913ef31..8dc3615816 100644
--- a/src/plugins/projectexplorer/devicesupport/devicemanager.h
+++ b/src/plugins/projectexplorer/devicesupport/devicemanager.h
@@ -101,7 +101,7 @@ private:
IDevice::Ptr fromRawPointer(IDevice *device) const;
IDevice::ConstPtr fromRawPointer(const IDevice *device) const;
- static QString settingsFilePath();
+ static QString settingsFilePath(const QString &extension);
static void copy(const DeviceManager *source, DeviceManager *target, bool deep);
Internal::DeviceManagerPrivate * const d;
diff --git a/src/plugins/projectexplorer/devicesupport/devicemanagermodel.cpp b/src/plugins/projectexplorer/devicesupport/devicemanagermodel.cpp
index 352b4d58e6..bee3fb5929 100644
--- a/src/plugins/projectexplorer/devicesupport/devicemanagermodel.cpp
+++ b/src/plugins/projectexplorer/devicesupport/devicemanagermodel.cpp
@@ -46,6 +46,7 @@ class DeviceManagerModelPrivate
public:
const DeviceManager *deviceManager;
QList<IDevice::ConstPtr> devices;
+ QList<Core::Id> filter;
};
} // namespace Internal
@@ -65,6 +66,12 @@ DeviceManagerModel::~DeviceManagerModel()
delete d;
}
+void DeviceManagerModel::setFilter(const QList<Core::Id> filter)
+{
+ d->filter = filter;
+ handleDeviceListChanged();
+}
+
void DeviceManagerModel::updateDevice(Core::Id id)
{
handleDeviceUpdated(id);
@@ -87,6 +94,9 @@ Core::Id DeviceManagerModel::deviceId(int pos) const
int DeviceManagerModel::indexOf(IDevice::ConstPtr dev) const
{
+ if (dev.isNull())
+ return -1;
+
for (int i = 0; i < d->devices.count(); ++i) {
IDevice::ConstPtr current = d->devices.at(i);
if (current->id() == dev->id())
@@ -127,7 +137,7 @@ void DeviceManagerModel::handleDeviceListChanged()
for (int i = 0; i < d->deviceManager->deviceCount(); ++i) {
IDevice::ConstPtr dev = d->deviceManager->deviceAt(i);
- if (dev->id() == Core::Id(Constants::DESKTOP_DEVICE_ID))
+ if (d->filter.contains(dev->id()))
continue;
d->devices << dev;
}
diff --git a/src/plugins/projectexplorer/devicesupport/devicemanagermodel.h b/src/plugins/projectexplorer/devicesupport/devicemanagermodel.h
index bc4eeb827d..32eaa5052d 100644
--- a/src/plugins/projectexplorer/devicesupport/devicemanagermodel.h
+++ b/src/plugins/projectexplorer/devicesupport/devicemanagermodel.h
@@ -51,7 +51,7 @@ public:
explicit DeviceManagerModel(const DeviceManager *deviceManager, QObject *parent = 0);
~DeviceManagerModel();
- void updateDevice(Core::Id id);
+ void setFilter(const QList<Core::Id> filter);
IDevice::ConstPtr device(int pos) const;
Core::Id deviceId(int pos) const;
@@ -59,6 +59,8 @@ public:
int indexForId(Core::Id id) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ void updateDevice(Core::Id id);
+
private slots:
void handleDeviceAdded(Core::Id id);
void handleDeviceRemoved(Core::Id id);
diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp
index 4df175bacc..dae2671d36 100644
--- a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp
+++ b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp
@@ -31,12 +31,14 @@
#include "devicesettingswidget.h"
#include "ui_devicesettingswidget.h"
+#include "projectexplorerconstants.h"
#include "devicefactoryselectiondialog.h"
#include "devicemanager.h"
#include "devicemanagermodel.h"
#include "idevice.h"
#include "idevicefactory.h"
#include "idevicewidget.h"
+#include "projectexplorerconstants.h"
#include <coreplugin/icore.h>
#include <coreplugin/id.h>
@@ -94,7 +96,6 @@ private:
const DeviceManager * const m_deviceManager;
};
-
DeviceSettingsWidget::DeviceSettingsWidget(QWidget *parent)
: QWidget(parent),
m_ui(new Ui::DeviceSettingsWidget),
@@ -105,6 +106,7 @@ DeviceSettingsWidget::DeviceSettingsWidget(QWidget *parent)
m_additionalActionsMapper(new QSignalMapper(this)),
m_configWidget(0)
{
+ m_deviceManagerModel->setFilter(QList<Core::Id>() << Core::Id(Constants::DESKTOP_DEVICE_ID));
initGui();
connect(m_additionalActionsMapper, SIGNAL(mapped(int)),
SLOT(handleAdditionalActionRequest(int)));
diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp
index a6b1d6942e..51fee9020c 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -62,7 +62,6 @@ namespace ProjectExplorer {
static const char compilerCommandKeyC[] = "ProjectExplorer.GccToolChain.Path";
static const char targetAbiKeyC[] = "ProjectExplorer.GccToolChain.TargetAbi";
static const char supportedAbisKeyC[] = "ProjectExplorer.GccToolChain.SupportedAbis";
-static const char debuggerCommandKeyC[] = "ProjectExplorer.GccToolChain.Debugger";
static QByteArray runGcc(const Utils::FileName &gcc, const QStringList &arguments, const QStringList &env)
{
@@ -325,7 +324,6 @@ GccToolChain::GccToolChain(const GccToolChain &tc) :
ToolChain(tc),
m_predefinedMacros(tc.predefinedMacros(QStringList())),
m_compilerCommand(tc.compilerCommand()),
- m_debuggerCommand(tc.debuggerCommand()),
m_targetAbi(tc.m_targetAbi),
m_supportedAbis(tc.m_supportedAbis),
m_headerPaths(tc.m_headerPaths),
@@ -341,15 +339,6 @@ QString GccToolChain::defaultDisplayName() const
ProjectExplorer::Abi::toString(m_targetAbi.wordWidth()));
}
-QString GccToolChain::legacyId() const
-{
- QString i = id();
- i = i.left(i.indexOf(QLatin1Char(':')));
- return QString::fromLatin1("%1:%2.%3.%4")
- .arg(i).arg(m_compilerCommand.toString())
- .arg(m_targetAbi.toString()).arg(m_debuggerCommand.toString());
-}
-
QString GccToolChain::type() const
{
return QLatin1String("gcc");
@@ -428,19 +417,6 @@ void GccToolChain::addToEnvironment(Utils::Environment &env) const
}
}
-void GccToolChain::setDebuggerCommand(const Utils::FileName &d)
-{
- if (m_debuggerCommand == d)
- return;
- m_debuggerCommand = d;
- toolChainUpdated();
-}
-
-Utils::FileName GccToolChain::debuggerCommand() const
-{
- return m_debuggerCommand;
-}
-
QList<Utils::FileName> GccToolChain::suggestedMkspecList() const
{
Abi abi = targetAbi();
@@ -531,7 +507,6 @@ QVariantMap GccToolChain::toMap() const
foreach (const ProjectExplorer::Abi &a, m_supportedAbis)
abiList.append(a.toString());
data.insert(QLatin1String(supportedAbisKeyC), abiList);
- data.insert(QLatin1String(debuggerCommandKeyC), m_debuggerCommand.toString());
return data;
}
@@ -550,7 +525,6 @@ bool GccToolChain::fromMap(const QVariantMap &data)
continue;
m_supportedAbis.append(abi);
}
- m_debuggerCommand = Utils::FileName::fromString(data.value(QLatin1String(debuggerCommandKeyC)).toString());
return true;
}
@@ -560,8 +534,7 @@ bool GccToolChain::operator ==(const ToolChain &other) const
return false;
const GccToolChain *gccTc = static_cast<const GccToolChain *>(&other);
- return m_compilerCommand == gccTc->m_compilerCommand && m_targetAbi == gccTc->m_targetAbi
- && m_debuggerCommand == gccTc->m_debuggerCommand;
+ return m_compilerCommand == gccTc->m_compilerCommand && m_targetAbi == gccTc->m_targetAbi;
}
ToolChainConfigWidget *GccToolChain::configurationWidget()
@@ -615,16 +588,13 @@ ToolChain *Internal::GccToolChainFactory::create()
QList<ToolChain *> Internal::GccToolChainFactory::autoDetect()
{
- QStringList debuggers;
+ QList<ToolChain *> tcs;
#ifdef Q_OS_MAC
- // Fixme Prefer lldb once it is implemented: debuggers.push_back(QLatin1String("lldb"));
-#endif
- debuggers.push_back(QLatin1String("gdb"));
- QList<ToolChain *> tcs = autoDetectToolchains(QLatin1String("g++"), debuggers, Abi::hostAbi());
-
// Old mac compilers needed to support macx-gccXY mkspecs:
- tcs.append(autoDetectToolchains(QLatin1String("g++-4.0"), debuggers, Abi::hostAbi()));
- tcs.append(autoDetectToolchains(QLatin1String("g++-4.2"), debuggers, Abi::hostAbi()));
+ tcs.append(autoDetectToolchains(QLatin1String("g++-4.0"), Abi::hostAbi()));
+ tcs.append(autoDetectToolchains(QLatin1String("g++-4.2"), Abi::hostAbi()));
+#endif
+ tcs.append(autoDetectToolchains(QLatin1String("g++"), Abi::hostAbi()));
return tcs;
}
@@ -651,7 +621,6 @@ GccToolChain *Internal::GccToolChainFactory::createToolChain(bool autoDetect)
}
QList<ToolChain *> Internal::GccToolChainFactory::autoDetectToolchains(const QString &compiler,
- const QStringList &debuggers,
const Abi &requiredAbi)
{
QList<ToolChain *> result;
@@ -669,22 +638,12 @@ QList<ToolChain *> Internal::GccToolChainFactory::autoDetectToolchains(const QSt
return result;
}
- Utils::FileName debuggerPath = ToolChainManager::instance()->defaultDebugger(requiredAbi);
- if (debuggerPath.isEmpty()) {
- foreach (const QString &debugger, debuggers) {
- debuggerPath = Utils::FileName::fromString(systemEnvironment.searchInPath(debugger));
- if (!debuggerPath.isEmpty())
- break;
- }
- }
-
foreach (const Abi &abi, abiList) {
QScopedPointer<GccToolChain> tc(createToolChain(true));
if (tc.isNull())
return result;
tc->setCompilerCommand(compilerPath);
- tc->setDebuggerCommand(debuggerPath);
tc->setTargetAbi(abi);
tc->setDisplayName(tc->defaultDisplayName()); // reset displayname
@@ -715,14 +674,12 @@ Internal::GccToolChainConfigWidget::GccToolChainConfigWidget(GccToolChain *tc) :
layout->addRow(tr("&ABI:"), m_abiWidget);
m_abiWidget->setEnabled(false);
- addDebuggerCommandControls(layout, gnuVersionArgs);
- addMkspecControls(layout);
addErrorLabel(layout);
setFromToolchain();
connect(m_compilerCommand, SIGNAL(changed(QString)), this, SLOT(handleCompilerCommandChange()));
- connect(m_abiWidget, SIGNAL(abiChanged()), this, SLOT(handleAbiChange()));
+ connect(m_abiWidget, SIGNAL(abiChanged()), this, SIGNAL(dirty()));
}
void Internal::GccToolChainConfigWidget::apply()
@@ -736,9 +693,6 @@ void Internal::GccToolChainConfigWidget::apply()
tc->setCompilerCommand(m_compilerCommand->fileName());
tc->setTargetAbi(m_abiWidget->currentAbi());
tc->setDisplayName(displayName); // reset display name
- tc->setDebuggerCommand(debuggerCommand());
- tc->setMkspecList(mkspecList());
- m_autoDebuggerCommand = Utils::FileName::fromString(QLatin1String("<manually set>"));
}
void Internal::GccToolChainConfigWidget::setFromToolchain()
@@ -750,8 +704,6 @@ void Internal::GccToolChainConfigWidget::setFromToolchain()
m_abiWidget->setAbis(tc->supportedAbis(), tc->targetAbi());
if (!m_isReadOnly && !m_compilerCommand->path().isEmpty())
m_abiWidget->setEnabled(true);
- setDebuggerCommand(tc->debuggerCommand());
- setMkspecList(tc->mkspecList());
blockSignals(blocked);
}
@@ -760,9 +712,7 @@ bool Internal::GccToolChainConfigWidget::isDirty() const
GccToolChain *tc = static_cast<GccToolChain *>(toolChain());
Q_ASSERT(tc);
return m_compilerCommand->fileName() != tc->compilerCommand()
- || m_abiWidget->currentAbi() != tc->targetAbi()
- || debuggerCommand() != tc->debuggerCommand()
- || mkspecList() != tc->mkspecList();
+ || m_abiWidget->currentAbi() != tc->targetAbi();
}
void Internal::GccToolChainConfigWidget::makeReadOnly()
@@ -787,16 +737,6 @@ void Internal::GccToolChainConfigWidget::handleCompilerCommandChange()
m_abiWidget->setEnabled(haveCompiler);
Abi currentAbi = m_abiWidget->currentAbi();
m_abiWidget->setAbis(abiList, abiList.contains(currentAbi) ? currentAbi : Abi());
- handleAbiChange();
-}
-
-void Internal::GccToolChainConfigWidget::handleAbiChange()
-{
- if (m_autoDebuggerCommand == debuggerCommand()) {
- ProjectExplorer::Abi abi = m_abiWidget->currentAbi();
- m_autoDebuggerCommand = ToolChainManager::instance()->defaultDebugger(abi);
- setDebuggerCommand(m_autoDebuggerCommand);
- }
emit dirty();
}
@@ -868,7 +808,7 @@ QString Internal::ClangToolChainFactory::id() const
QList<ToolChain *> Internal::ClangToolChainFactory::autoDetect()
{
Abi ha = Abi::hostAbi();
- return autoDetectToolchains(QLatin1String("clang++"), QStringList(), ha);
+ return autoDetectToolchains(QLatin1String("clang++"), ha);
}
bool Internal::ClangToolChainFactory::canCreate()
@@ -967,18 +907,8 @@ QString Internal::MingwToolChainFactory::id() const
QList<ToolChain *> Internal::MingwToolChainFactory::autoDetect()
{
- // Compatibility to pre-2.2:
- // All Mingw toolchains that exist so far are either installed by the SDK itself (in
- // which case they most likely have debuggers set up) or were created when updating
- // from a previous Qt version. Add debugger in that case.
- foreach (ToolChain *tc, ToolChainManager::instance()->toolChains()) {
- if (tc->debuggerCommand().isEmpty() && tc->id().startsWith(QLatin1String(Constants::MINGW_TOOLCHAIN_ID)))
- static_cast<MingwToolChain *>(tc)
- ->setDebuggerCommand(ToolChainManager::instance()->defaultDebugger(tc->targetAbi()));
- }
-
Abi ha = Abi::hostAbi();
- return autoDetectToolchains(QLatin1String("g++"), QStringList(),
+ return autoDetectToolchains(QLatin1String("g++"),
Abi(ha.architecture(), Abi::WindowsOS, Abi::WindowsMSysFlavor, Abi::PEFormat, ha.wordWidth()));
}
@@ -1062,9 +992,7 @@ QString Internal::LinuxIccToolChainFactory::id() const
QList<ToolChain *> Internal::LinuxIccToolChainFactory::autoDetect()
{
- return autoDetectToolchains(QLatin1String("icpc"),
- QStringList(QLatin1String("gdb")),
- Abi::hostAbi());
+ return autoDetectToolchains(QLatin1String("icpc"), Abi::hostAbi());
}
ToolChain *Internal::LinuxIccToolChainFactory::create()
diff --git a/src/plugins/projectexplorer/gcctoolchain.h b/src/plugins/projectexplorer/gcctoolchain.h
index 4a77843c16..c8faf406b2 100644
--- a/src/plugins/projectexplorer/gcctoolchain.h
+++ b/src/plugins/projectexplorer/gcctoolchain.h
@@ -54,8 +54,6 @@ class LinuxIccToolChainFactory;
class PROJECTEXPLORER_EXPORT GccToolChain : public ToolChain
{
public:
- QString legacyId() const;
-
QString type() const;
QString typeDisplayName() const;
Abi targetAbi() const;
@@ -71,8 +69,6 @@ public:
QList<HeaderPath> systemHeaderPaths() const;
void addToEnvironment(Utils::Environment &env) const;
QString makeCommand() const;
- void setDebuggerCommand(const Utils::FileName &);
- Utils::FileName debuggerCommand() const;
QList<Utils::FileName> suggestedMkspecList() const;
IOutputParser *outputParser() const;
@@ -107,7 +103,6 @@ private:
void updateSupportedAbis() const;
Utils::FileName m_compilerCommand;
- Utils::FileName m_debuggerCommand;
Abi m_targetAbi;
mutable QList<Abi> m_supportedAbis;
diff --git a/src/plugins/projectexplorer/gcctoolchainfactories.h b/src/plugins/projectexplorer/gcctoolchainfactories.h
index aab545de74..34421d52c2 100644
--- a/src/plugins/projectexplorer/gcctoolchainfactories.h
+++ b/src/plugins/projectexplorer/gcctoolchainfactories.h
@@ -74,7 +74,6 @@ public:
protected:
virtual GccToolChain *createToolChain(bool autoDetect);
QList<ToolChain *> autoDetectToolchains(const QString &compiler,
- const QStringList &debuggers,
const Abi &);
};
@@ -95,7 +94,6 @@ public:
private slots:
void handleCompilerCommandChange();
- void handleAbiChange();
private:
void setFromToolchain();
diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp
index 9fdb170f61..8cc1035dde 100644
--- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp
+++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp
@@ -47,6 +47,7 @@
#include <projectexplorer/project.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/deployconfiguration.h>
+#include <projectexplorer/profilemanager.h>
#include <projectexplorer/projectmodels.h>
#include <projectexplorer/runconfiguration.h>
@@ -590,6 +591,10 @@ MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorActi
connect(m_sessionManager, SIGNAL(projectDisplayNameChanged(ProjectExplorer::Project*)),
this, SLOT(updateActionAndSummary()));
+ // for icon changes:
+ connect(ProjectExplorer::ProfileManager::instance(), SIGNAL(profileUpdated(ProjectExplorer::Profile*)),
+ this, SLOT(profileChanged(ProjectExplorer::Profile*)));
+
connect(m_listWidgets[TARGET], SIGNAL(changeActiveProjectConfiguration(ProjectExplorer::ProjectConfiguration*)),
this, SLOT(setActiveTarget(ProjectExplorer::ProjectConfiguration*)));
connect(m_listWidgets[BUILD], SIGNAL(changeActiveProjectConfiguration(ProjectExplorer::ProjectConfiguration*)),
@@ -869,6 +874,8 @@ void MiniProjectTargetSelector::activeTargetChanged(ProjectExplorer::Target *tar
this, SLOT(updateActionAndSummary()));
disconnect(m_target, SIGNAL(toolTipChanged()),
this, SLOT(updateActionAndSummary()));
+ disconnect(m_target, SIGNAL(iconChanged()),
+ this, SLOT(updateActionAndSummary()));
disconnect(m_target, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
this, SLOT(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)));
disconnect(m_target, SIGNAL(activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration*)),
@@ -925,6 +932,8 @@ void MiniProjectTargetSelector::activeTargetChanged(ProjectExplorer::Target *tar
this, SLOT(updateActionAndSummary()));
connect(m_target, SIGNAL(toolTipChanged()),
this, SLOT(updateActionAndSummary()));
+ connect(m_target, SIGNAL(iconChanged()),
+ this, SLOT(updateActionAndSummary()));
connect(m_target, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
this, SLOT(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)));
connect(m_target, SIGNAL(activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration*)),
@@ -942,6 +951,12 @@ void MiniProjectTargetSelector::activeTargetChanged(ProjectExplorer::Target *tar
updateActionAndSummary();
}
+void MiniProjectTargetSelector::profileChanged(Profile *profile)
+{
+ if (m_target && m_target->profile() == profile)
+ updateActionAndSummary();
+}
+
void MiniProjectTargetSelector::activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc)
{
if (m_buildConfiguration)
diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.h b/src/plugins/projectexplorer/miniprojecttargetselector.h
index 51f14622c5..f356610608 100644
--- a/src/plugins/projectexplorer/miniprojecttargetselector.h
+++ b/src/plugins/projectexplorer/miniprojecttargetselector.h
@@ -43,6 +43,7 @@ class QStackedWidget;
QT_END_NAMESPACE
namespace ProjectExplorer {
+class Profile;
class Project;
class Target;
class BuildConfiguration;
@@ -134,6 +135,7 @@ private slots:
void changeStartupProject(ProjectExplorer::Project *project);
void activeTargetChanged(ProjectExplorer::Target *target);
+ void profileChanged(ProjectExplorer::Profile *profile);
void activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc);
void activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration *dc);
void activeRunConfigurationChanged(ProjectExplorer::RunConfiguration *rc);
diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp
index 74e0f1ffae..8e5fa77871 100644
--- a/src/plugins/projectexplorer/msvctoolchain.cpp
+++ b/src/plugins/projectexplorer/msvctoolchain.cpp
@@ -53,7 +53,6 @@
#include <QDesktopServices>
#define KEY_ROOT "ProjectExplorer.MsvcToolChain."
-static const char debuggerCommandKeyC[] = KEY_ROOT"Debugger";
static const char varsBatKeyC[] = KEY_ROOT"VarsBat";
static const char varsBatArgKeyC[] = KEY_ROOT"VarsBatArg";
static const char supportedAbiKeyC[] = KEY_ROOT"SupportedAbi";
@@ -332,19 +331,6 @@ MsvcToolChain *MsvcToolChain::readFromMap(const QVariantMap &data)
return 0;
}
-QString MsvcToolChain::legacyId() const
-{
- const QChar colon = QLatin1Char(':');
- QString id = QLatin1String(Constants::MSVC_TOOLCHAIN_ID);
- id += colon;
- id += m_vcvarsBat;
- id += colon;
- id += m_varsBatArg;
- id += colon;
- id += m_debuggerCommand.toString();
- return id;
-}
-
QString MsvcToolChain::type() const
{
return QLatin1String("msvc");
@@ -369,8 +355,6 @@ QList<Utils::FileName> MsvcToolChain::suggestedMkspecList() const
QVariantMap MsvcToolChain::toMap() const
{
QVariantMap data = ToolChain::toMap();
- if (!m_debuggerCommand.isEmpty())
- data.insert(QLatin1String(debuggerCommandKeyC), m_debuggerCommand.toString());
data.insert(QLatin1String(varsBatKeyC), m_vcvarsBat);
if (!m_varsBatArg.isEmpty())
data.insert(QLatin1String(varsBatArgKeyC), m_varsBatArg);
@@ -384,7 +368,6 @@ bool MsvcToolChain::fromMap(const QVariantMap &data)
return false;
m_vcvarsBat = data.value(QLatin1String(varsBatKeyC)).toString();
m_varsBatArg = data.value(QLatin1String(varsBatArgKeyC)).toString();
- m_debuggerCommand = Utils::FileName::fromString(data.value(QLatin1String(debuggerCommandKeyC)).toString());
const QString abiString = data.value(QLatin1String(supportedAbiKeyC)).toString();
m_abi = Abi(abiString);
@@ -403,42 +386,6 @@ ToolChain *MsvcToolChain::clone() const
}
// --------------------------------------------------------------------------
-// MsvcDebuggerConfigLabel
-// --------------------------------------------------------------------------
-
-static const char dgbToolsDownloadLink32C[] = "http://www.microsoft.com/whdc/devtools/debugging/installx86.Mspx";
-static const char dgbToolsDownloadLink64C[] = "http://www.microsoft.com/whdc/devtools/debugging/install64bit.Mspx";
-
-QString MsvcDebuggerConfigLabel::labelText()
-{
-#ifdef Q_OS_WIN
- const bool is64bit = Utils::winIs64BitSystem();
-#else
- const bool is64bit = false;
-#endif
- const QString link = is64bit ? QLatin1String(dgbToolsDownloadLink64C) : QLatin1String(dgbToolsDownloadLink32C);
- //: Label text for path configuration. %2 is "x-bit version".
- return tr(
- "<html><body><p>Specify the path to the "
- "<a href=\"%1\">Windows Console Debugger executable</a>"
- " (%2) here.</p>"
- "</body></html>").arg(link, (is64bit ? tr("64-bit version")
- : tr("32-bit version")));
-}
-
-MsvcDebuggerConfigLabel::MsvcDebuggerConfigLabel(QWidget *parent) :
- QLabel(labelText(), parent)
-{
- connect(this, SIGNAL(linkActivated(QString)), this, SLOT(slotLinkActivated(QString)));
- setTextInteractionFlags(Qt::TextBrowserInteraction);
-}
-
-void MsvcDebuggerConfigLabel::slotLinkActivated(const QString &link)
-{
- QDesktopServices::openUrl(QUrl(link));
-}
-
-// --------------------------------------------------------------------------
// MsvcToolChainConfigWidget
// --------------------------------------------------------------------------
@@ -450,21 +397,12 @@ MsvcToolChainConfigWidget::MsvcToolChainConfigWidget(ToolChain *tc) :
formLayout->addRow(new QLabel(tc->displayName()));
m_varsBatDisplayLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
formLayout->addRow(tr("Initialization:"), m_varsBatDisplayLabel);
- formLayout->addRow(new MsvcDebuggerConfigLabel);
- addDebuggerCommandControls(formLayout, QStringList(QLatin1String("-version")));
- addDebuggerAutoDetection(this, SLOT(autoDetectDebugger()));
- addMkspecControls(formLayout);
addErrorLabel(formLayout);
setFromToolChain();
}
void MsvcToolChainConfigWidget::apply()
-{
- MsvcToolChain *tc = static_cast<MsvcToolChain *>(toolChain());
- QTC_ASSERT(tc, return; );
- tc->setDebuggerCommand(debuggerCommand());
- tc->setMkspecList(mkspecList());
-}
+{ }
void MsvcToolChainConfigWidget::setFromToolChain()
{
@@ -476,45 +414,11 @@ void MsvcToolChainConfigWidget::setFromToolChain()
varsBatDisplay += tc->varsBatArg();
}
m_varsBatDisplayLabel->setText(varsBatDisplay);
- setDebuggerCommand(tc->debuggerCommand());
- setMkspecList(tc->mkspecList());
}
bool MsvcToolChainConfigWidget::isDirty() const
{
- MsvcToolChain *tc = static_cast<MsvcToolChain *>(toolChain());
- QTC_ASSERT(tc, return false);
- return debuggerCommand() != tc->debuggerCommand()
- || mkspecList() != tc->mkspecList();
-}
-
-void MsvcToolChainConfigWidget::autoDetectDebugger()
-{
- clearErrorMessage();
-
- MsvcToolChain *tc = static_cast<MsvcToolChain *>(toolChain());
- QTC_ASSERT(tc, return);
- ProjectExplorer::Abi abi = tc->targetAbi();
-
- const QPair<Utils::FileName, Utils::FileName> cdbExecutables = MsvcToolChain::autoDetectCdbDebugger();
- Utils::FileName debugger;
- if (abi.wordWidth() == 32) {
- if (cdbExecutables.first.isEmpty()) {
- setErrorMessage(tr("No CDB debugger detected (neither 32bit nor 64bit)."));
- return;
- }
- debugger = cdbExecutables.first;
- } else if (abi.wordWidth() == 64) {
- if (cdbExecutables.second.isEmpty()) {
- setErrorMessage(tr("No 64bit CDB debugger detected."));
- return;
- }
- debugger = cdbExecutables.second;
- }
- if (debugger != debuggerCommand()) {
- setDebuggerCommand(debugger);
- emitDirty();
- }
+ return false;
}
// --------------------------------------------------------------------------
@@ -638,79 +542,10 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect()
vcvarsIA64bat, QString(), true));
}
}
- if (!results.isEmpty()) { // Detect debugger
- const QPair<Utils::FileName, Utils::FileName> cdbDebugger = MsvcToolChain::autoDetectCdbDebugger();
- foreach (ToolChain *tc, results)
- static_cast<MsvcToolChain *>(tc)->setDebuggerCommand(tc->targetAbi().wordWidth() == 32 ? cdbDebugger.first : cdbDebugger.second);
- }
return results;
}
-// Detect CDB, return a pair of <32bit, 64bit> executables.
-QPair<Utils::FileName, Utils::FileName> MsvcToolChain::autoDetectCdbDebugger()
-{
- QPair<Utils::FileName, Utils::FileName> result;
- QList<Utils::FileName> cdbs;
-
- QStringList programDirs;
- programDirs.append(QString::fromLocal8Bit(qgetenv("ProgramFiles")));
- programDirs.append(QString::fromLocal8Bit(qgetenv("ProgramFiles(x86)")));
- programDirs.append(QString::fromLocal8Bit(qgetenv("ProgramW6432")));
-
- foreach (const QString &dirName, programDirs) {
- if (dirName.isEmpty())
- continue;
- QDir dir(dirName);
- // Windows SDK's starting from version 8 live in
- // "ProgramDir\Windows Kits\<version>"
- const QString windowsKitsFolderName = QLatin1String("Windows Kits");
- if (dir.exists(windowsKitsFolderName)) {
- QDir windowKitsFolder = dir;
- if (windowKitsFolder.cd(windowsKitsFolderName)) {
- // Check in reverse order (latest first)
- const QFileInfoList kitFolders =
- windowKitsFolder.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot,
- QDir::Time|QDir::Reversed);
- foreach (const QFileInfo &kitFolderFi, kitFolders) {
- const QString path = kitFolderFi.absoluteFilePath();
- const QFileInfo cdb32(path + QLatin1String("/Debuggers/x86/cdb.exe"));
- if (cdb32.isExecutable())
- cdbs.push_back(Utils::FileName::fromString(cdb32.absoluteFilePath()));
- const QFileInfo cdb64(path + QLatin1String("/Debuggers/x64/cdb.exe"));
- if (cdb64.isExecutable())
- cdbs.push_back(Utils::FileName::fromString(cdb64.absoluteFilePath()));
- } // for Kits
- } // can cd to "Windows Kits"
- } // "Windows Kits" exists
-
- // Pre Windows SDK 8: Check 'Debugging Tools for Windows'
- foreach (const QFileInfo &fi, dir.entryInfoList(QStringList(QLatin1String("Debugging Tools for Windows*")),
- QDir::Dirs | QDir::NoDotAndDotDot)) {
- Utils::FileName filePath(fi);
- filePath.appendPath(QLatin1String("cdb.exe"));
- if (!cdbs.contains(filePath))
- cdbs.append(filePath);
- }
- }
-
- foreach (const Utils::FileName &cdb, cdbs) {
- QList<ProjectExplorer::Abi> abis = ProjectExplorer::Abi::abisOfBinary(cdb);
- if (abis.isEmpty())
- continue;
- if (abis.first().wordWidth() == 32)
- result.first = cdb;
- else if (abis.first().wordWidth() == 64)
- result.second = cdb;
- }
-
- // prefer 64bit debugger, even for 32bit binaries:
- if (!result.second.isEmpty())
- result.first = result.second;
-
- return result;
-}
-
bool MsvcToolChain::operator ==(const ToolChain &other) const
{
if (!AbstractMsvcToolChain::operator ==(other))
diff --git a/src/plugins/projectexplorer/msvctoolchain.h b/src/plugins/projectexplorer/msvctoolchain.h
index d7151e1ba4..ed08140641 100644
--- a/src/plugins/projectexplorer/msvctoolchain.h
+++ b/src/plugins/projectexplorer/msvctoolchain.h
@@ -56,7 +56,6 @@ public:
MsvcToolChain(const QString &name, const Abi &abi,
const QString &varsBat, const QString &varsBatArg, bool autodetect = false);
- QString legacyId() const;
QList<Utils::FileName> suggestedMkspecList() const;
static MsvcToolChain *readFromMap(const QVariantMap &data);
@@ -73,8 +72,6 @@ public:
QString varsBatArg() const { return m_varsBatArg; }
- static QPair<Utils::FileName, Utils::FileName> autoDetectCdbDebugger();
-
bool operator == (const ToolChain &) const;
protected:
@@ -110,23 +107,6 @@ public:
};
// --------------------------------------------------------------------------
-// MsvcDebuggerConfigLabel: Label displaying debugging tools download info.
-// --------------------------------------------------------------------------
-
-class MsvcDebuggerConfigLabel : public QLabel
-{
- Q_OBJECT
-public:
- explicit MsvcDebuggerConfigLabel(QWidget *parent = 0);
-
-private slots:
- void slotLinkActivated(const QString &l);
-
-private:
- static QString labelText();
-};
-
-// --------------------------------------------------------------------------
// MsvcToolChainConfigWidget
// --------------------------------------------------------------------------
@@ -141,9 +121,6 @@ public:
void discard() { setFromToolChain(); }
bool isDirty() const;
-private slots:
- void autoDetectDebugger();
-
private:
void setFromToolChain();
diff --git a/src/plugins/projectexplorer/profile.cpp b/src/plugins/projectexplorer/profile.cpp
new file mode 100644
index 0000000000..a183e13d16
--- /dev/null
+++ b/src/plugins/projectexplorer/profile.cpp
@@ -0,0 +1,307 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "profile.h"
+
+#include "devicesupport/devicemanager.h"
+#include "profileinformation.h"
+#include "profilemanager.h"
+#include "toolchainmanager.h"
+
+#include <QApplication>
+#include <QIcon>
+#include <QStyle>
+#include <QTextStream>
+#include <QUuid>
+
+namespace {
+
+const char ID_KEY[] = "PE.Profile.Id";
+const char DISPLAYNAME_KEY[] = "PE.Profile.Name";
+const char AUTODETECTED_KEY[] = "PE.Profile.AutoDetected";
+const char DATA_KEY[] = "PE.Profile.Data";
+const char ICON_KEY[] = "PE.Profile.Icon";
+
+} // namespace
+
+namespace ProjectExplorer {
+
+// -------------------------------------------------------------------------
+// ProfilePrivate
+// -------------------------------------------------------------------------
+
+namespace Internal {
+
+class ProfilePrivate
+{
+public:
+ ProfilePrivate() :
+ m_id(QUuid::createUuid().toString().toLatin1().constData()),
+ m_autodetected(false),
+ m_isValid(true)
+ { }
+
+ QString m_displayName;
+ Core::Id m_id;
+ bool m_autodetected;
+ bool m_isValid;
+ QIcon m_icon;
+ QString m_iconPath;
+
+ QHash<Core::Id, QVariant> m_data;
+};
+
+} // namespace Internal
+
+// -------------------------------------------------------------------------
+// Profile:
+// -------------------------------------------------------------------------
+
+Profile::Profile() :
+ d(new Internal::ProfilePrivate)
+{
+ ProfileManager *stm = ProfileManager::instance();
+ foreach (ProfileInformation *sti, stm->profileInformation())
+ d->m_data.insert(sti->dataId(), sti->defaultValue(this));
+
+ setDisplayName(QCoreApplication::translate("ProjectExplorer::Profile", "Unnamed"));
+ setIconPath(QLatin1String(":///DESKTOP///"));
+}
+
+Profile::Profile(const Profile &other) :
+ d(new Internal::ProfilePrivate)
+{
+ d->m_displayName = QCoreApplication::translate("ProjectExplorer::Profile", "Clone of %1").arg(other.d->m_displayName);
+ d->m_autodetected = false;
+ d->m_data = other.d->m_data;
+ d->m_isValid = other.d->m_isValid;
+ d->m_icon = other.d->m_icon;
+ d->m_iconPath = other.d->m_iconPath;
+}
+
+Profile::~Profile()
+{
+ delete d;
+}
+
+bool Profile::isValid() const
+{
+ return d->m_id.isValid() && d->m_isValid;
+}
+
+QList<Task> Profile::validate()
+{
+ QList<Task> result;
+ QList<ProfileInformation *> infoList = ProfileManager::instance()->profileInformation();
+ foreach (ProfileInformation *i, infoList)
+ result.append(i->validate(this));
+ return result;
+}
+
+QString Profile::displayName() const
+{
+ return d->m_displayName;
+}
+
+void Profile::setDisplayName(const QString &name)
+{
+ if (d->m_displayName == name)
+ return;
+ d->m_displayName = name;
+ profileUpdated();
+}
+
+bool Profile::isAutoDetected() const
+{
+ return d->m_autodetected;
+}
+
+Core::Id Profile::id() const
+{
+ return d->m_id;
+}
+
+QIcon Profile::icon() const
+{
+ return d->m_icon;
+}
+
+QString Profile::iconPath() const
+{
+ return d->m_iconPath;
+}
+
+void Profile::setIconPath(const QString &path)
+{
+ if (d->m_iconPath == path)
+ return;
+ d->m_iconPath = path;
+ if (path.isNull())
+ d->m_icon = QIcon();
+ else if (path == QLatin1String(":///DESKTOP///"))
+ d->m_icon = qApp->style()->standardIcon(QStyle::SP_ComputerIcon);
+ else
+ d->m_icon = QIcon(path);
+ profileUpdated();
+}
+
+QVariant Profile::value(const Core::Id &key, const QVariant &unset) const
+{
+ return d->m_data.value(key, unset);
+}
+
+bool Profile::hasValue(const Core::Id &key) const
+{
+ return d->m_data.contains(key);
+}
+
+void Profile::setValue(const Core::Id &key, const QVariant &value)
+{
+ if (d->m_data.value(key) == value)
+ return;
+ d->m_data.insert(key, value);
+ profileUpdated();
+}
+
+void Profile::removeKey(const Core::Id &key)
+{
+ if (!d->m_data.contains(key))
+ return;
+ d->m_data.remove(key);
+ profileUpdated();
+}
+
+QVariantMap Profile::toMap() const
+{
+ QVariantMap data;
+ data.insert(QLatin1String(ID_KEY), QString::fromLatin1(d->m_id.name()));
+ data.insert(QLatin1String(DISPLAYNAME_KEY), d->m_displayName);
+ data.insert(QLatin1String(AUTODETECTED_KEY), d->m_autodetected);
+ data.insert(QLatin1String(ICON_KEY), d->m_iconPath);
+
+ QVariantMap extra;
+ foreach (const Core::Id &key, d->m_data.keys())
+ extra.insert(QString::fromLatin1(key.name().constData()), d->m_data.value(key));
+ data.insert(QLatin1String(DATA_KEY), extra);
+
+ return data;
+}
+
+bool Profile::operator==(const Profile &other) const
+{
+ return d->m_data == other.d->m_data;
+}
+
+void Profile::addToEnvironment(Utils::Environment &env) const
+{
+ QList<ProfileInformation *> infoList = ProfileManager::instance()->profileInformation();
+ foreach (ProfileInformation *si, infoList)
+ si->addToEnvironment(this, env);
+}
+
+QString Profile::toHtml()
+{
+ QString rc;
+ QTextStream str(&rc);
+ str << "<html><body>";
+ str << "<h3>" << displayName() << "</h3>";
+ str << "<table>";
+
+ if (!isValid()) {
+ QList<Task> issues = validate();
+ str << "<p>";
+ foreach (const Task &t, issues) {
+ str << "<b>";
+ switch (t.type) {
+ case Task::Error:
+ QCoreApplication::translate("ProjectExplorer::Profile", "Error:");
+ break;
+ case Task::Warning:
+ QCoreApplication::translate("ProjectExplorer::Profile", "Warning:");
+ break;
+ case Task::Unknown:
+ default:
+ break;
+ }
+ str << "</b>" << t.description << "<br>";
+ }
+ str << "</p>";
+ }
+
+ QList<ProfileInformation *> infoList = ProfileManager::instance()->profileInformation();
+ foreach (ProfileInformation *i, infoList) {
+ ProfileInformation::ItemList list = i->toUserOutput(this);
+ foreach (const ProfileInformation::Item &j, list)
+ str << "<tr><td><b>" << j.first << ":</b></td><td>" << j.second << "</td></tr>";
+ }
+ str << "</table></body></html>";
+ return rc;
+}
+
+bool Profile::fromMap(const QVariantMap &data)
+{
+ const QString id = data.value(QLatin1String(ID_KEY)).toString();
+ if (id.isEmpty())
+ return false;
+ d->m_id = Core::Id(id);
+ d->m_displayName = data.value(QLatin1String(DISPLAYNAME_KEY)).toString();
+ d->m_autodetected = data.value(QLatin1String(AUTODETECTED_KEY)).toBool();
+ setIconPath(data.value(QLatin1String(ICON_KEY)).toString());
+
+ QVariantMap extra = data.value(QLatin1String(DATA_KEY)).toMap();
+ foreach (const QString &key, extra.keys())
+ d->m_data.insert(Core::Id(key), extra.value(key));
+
+ return true;
+}
+
+void Profile::setAutoDetected(bool detected)
+{
+ d->m_autodetected = detected;
+}
+
+void Profile::setId(const Core::Id &id)
+{
+ d->m_id = id;
+}
+
+void Profile::setValid(bool valid)
+{
+ d->m_isValid = valid;
+}
+
+void Profile::profileUpdated()
+{
+ ProfileManager::instance()->notifyAboutUpdate(this);
+}
+
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/profile.h b/src/plugins/projectexplorer/profile.h
new file mode 100644
index 0000000000..775100f522
--- /dev/null
+++ b/src/plugins/projectexplorer/profile.h
@@ -0,0 +1,109 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef PROFILE_H
+#define PROFILE_H
+
+#include "projectexplorer_export.h"
+#include "task.h"
+
+#include <coreplugin/id.h>
+
+#include <QVariant>
+
+namespace Utils { class Environment; }
+
+namespace ProjectExplorer {
+
+namespace Internal {
+class ProfileManagerPrivate;
+class ProfilePrivate;
+} // namespace Internal
+
+/**
+ * @brief The Profile class
+ *
+ * The profile holds a set of values defining a system targeted by the software
+ * under development.
+ */
+class PROJECTEXPLORER_EXPORT Profile
+{
+public:
+ Profile();
+ Profile(const Profile &other);
+ ~Profile();
+
+ bool isValid() const;
+ QList<Task> validate();
+
+ QString displayName() const;
+ void setDisplayName(const QString &name);
+
+ bool isAutoDetected() const;
+ Core::Id id() const;
+
+ QIcon icon() const;
+ QString iconPath() const;
+ void setIconPath(const QString &path);
+
+ QVariant value(const Core::Id &key, const QVariant &unset = QVariant()) const;
+ bool hasValue(const Core::Id &key) const;
+ void setValue(const Core::Id &key, const QVariant &value);
+ void removeKey(const Core::Id &key);
+
+ bool operator==(const Profile &other) const;
+
+ void addToEnvironment(Utils::Environment &env) const;
+
+ QString toHtml();
+
+private:
+ void setAutoDetected(bool detected);
+ void setId(const Core::Id &id);
+ void setValid(bool valid);
+
+ void profileUpdated();
+
+ QVariantMap toMap() const;
+ bool fromMap(const QVariantMap &value);
+
+ Internal::ProfilePrivate *d;
+
+ friend class ProfileManager;
+ friend class Internal::ProfileManagerPrivate;
+};
+
+} // namespace ProjectExplorer
+
+Q_DECLARE_METATYPE(ProjectExplorer::Profile *)
+
+#endif // PROFILE_H
diff --git a/src/plugins/remotelinux/abstractembeddedlinuxtarget.cpp b/src/plugins/projectexplorer/profileconfigwidget.h
index dd3f4c1fbb..c98f5cfbc0 100644
--- a/src/plugins/remotelinux/abstractembeddedlinuxtarget.cpp
+++ b/src/plugins/projectexplorer/profileconfigwidget.h
@@ -29,29 +29,39 @@
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
-#include "abstractembeddedlinuxtarget.h"
-#include "deploymentinfo.h"
-#include "typespecificdeviceconfigurationlistmodel.h"
+#ifndef PROFILECONFIGWIDGET_H
+#define PROFILECONFIGWIDGET_H
-#include <qt4projectmanager/qt4buildconfiguration.h>
+#include "projectexplorer_export.h"
-using namespace ProjectExplorer;
-using namespace Qt4ProjectManager;
+#include <QWidget>
-namespace RemoteLinux {
+namespace ProjectExplorer {
-AbstractEmbeddedLinuxTarget::AbstractEmbeddedLinuxTarget(Qt4Project *parent, const Core::Id id) :
- Qt4BaseTarget(parent, id),
- m_buildConfigurationFactory(new Qt4BuildConfigurationFactory(this)),
- m_deploymentInfo(new DeploymentInfo(this)),
- m_deviceConfigModel(new Internal::TypeSpecificDeviceConfigurationListModel(this))
-{
-}
+// --------------------------------------------------------------------------
+// ProfileConfigWidget
+// --------------------------------------------------------------------------
-IBuildConfigurationFactory *AbstractEmbeddedLinuxTarget::buildConfigurationFactory() const
+class PROJECTEXPLORER_EXPORT ProfileConfigWidget : public QWidget
{
- return m_buildConfigurationFactory;
-}
+ Q_OBJECT
+
+public:
+ ProfileConfigWidget(QWidget *parent = 0) : QWidget(parent)
+ { }
+
+ virtual QString displayName() const = 0;
+ virtual void makeReadOnly() = 0;
+
+ virtual void apply() = 0;
+ virtual void discard() = 0;
+ virtual bool isDirty() const = 0;
+
+signals:
+ void dirty();
+};
+
+} // namespace ProjectExplorer
-} // namespace RemoteLinux
+#endif // PROFILECONFIGWIDGET_H
diff --git a/src/plugins/projectexplorer/profileinformation.cpp b/src/plugins/projectexplorer/profileinformation.cpp
new file mode 100644
index 0000000000..0dd63e56d3
--- /dev/null
+++ b/src/plugins/projectexplorer/profileinformation.cpp
@@ -0,0 +1,355 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "profileinformation.h"
+
+#include "devicesupport/desktopdevice.h"
+#include "devicesupport/devicemanager.h"
+#include "projectexplorerconstants.h"
+#include "profile.h"
+#include "profileinformationconfigwidget.h"
+#include "toolchain.h"
+#include "toolchainmanager.h"
+
+#include <extensionsystem/pluginmanager.h>
+#include <projectexplorer/abi.h>
+#include <utils/pathchooser.h>
+
+#include <QComboBox>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QPushButton>
+
+namespace ProjectExplorer {
+
+// --------------------------------------------------------------------------
+// SysRootInformation:
+// --------------------------------------------------------------------------
+
+static const char SYSROOT_INFORMATION[] = "PE.Profile.SysRoot";
+
+SysRootProfileInformation::SysRootProfileInformation()
+{
+ setObjectName(QLatin1String("SysRootInformation"));
+}
+
+Core::Id SysRootProfileInformation::dataId() const
+{
+ static const Core::Id id(SYSROOT_INFORMATION);
+ return id;
+}
+
+unsigned int SysRootProfileInformation::priority() const
+{
+ return 32000;
+}
+
+QVariant SysRootProfileInformation::defaultValue(Profile *p) const
+{
+ Q_UNUSED(p)
+ return QString();
+}
+
+QList<Task> SysRootProfileInformation::validate(Profile *p) const
+{
+ QList<Task> result;
+ const Utils::FileName dir = SysRootProfileInformation::sysRoot(p);
+ if (!dir.toFileInfo().isDir() && SysRootProfileInformation::hasSysRoot(p))
+ result << Task(Task::Error, QObject::tr("Sys Root \"%1\" is not a directory.").arg(dir.toUserOutput()),
+ Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
+ return result;
+}
+
+ProfileConfigWidget *SysRootProfileInformation::createConfigWidget(Profile *p) const
+{
+ Q_ASSERT(p);
+ return new Internal::SysRootInformationConfigWidget(p);
+}
+
+ProfileInformation::ItemList SysRootProfileInformation::toUserOutput(Profile *p) const
+{
+ return ItemList() << qMakePair(tr("Sys Root"), sysRoot(p).toUserOutput());
+}
+
+bool SysRootProfileInformation::hasSysRoot(const Profile *p)
+{
+ return !p->value(Core::Id(SYSROOT_INFORMATION)).isNull();
+}
+
+Utils::FileName SysRootProfileInformation::sysRoot(const Profile *p)
+{
+ if (!p)
+ return Utils::FileName();
+ return Utils::FileName::fromString(p->value(Core::Id(SYSROOT_INFORMATION)).toString());
+}
+
+void SysRootProfileInformation::setSysRoot(Profile *p, const Utils::FileName &v)
+{
+ p->setValue(Core::Id(SYSROOT_INFORMATION), v.toString());
+}
+
+// --------------------------------------------------------------------------
+// ToolChainInformation:
+// --------------------------------------------------------------------------
+
+static const char TOOLCHAIN_INFORMATION[] = "PE.Profile.ToolChain";
+
+ToolChainProfileInformation::ToolChainProfileInformation()
+{
+ setObjectName(QLatin1String("ToolChainInformation"));
+ connect(ToolChainManager::instance(), SIGNAL(toolChainRemoved(ProjectExplorer::ToolChain*)),
+ this, SIGNAL(validationNeeded()));
+ connect(ToolChainManager::instance(), SIGNAL(toolChainUpdated(ProjectExplorer::ToolChain*)),
+ this, SIGNAL(validationNeeded()));
+}
+
+Core::Id ToolChainProfileInformation::dataId() const
+{
+ static const Core::Id id(TOOLCHAIN_INFORMATION);
+ return id;
+}
+
+unsigned int ToolChainProfileInformation::priority() const
+{
+ return 30000;
+}
+
+QVariant ToolChainProfileInformation::defaultValue(Profile *p) const
+{
+ Q_UNUSED(p);
+ QList<ToolChain *> tcList = ToolChainManager::instance()->toolChains();
+ if (tcList.isEmpty())
+ return QString();
+
+ ProjectExplorer::Abi abi = ProjectExplorer::Abi::hostAbi();
+
+ foreach (ToolChain *tc, tcList) {
+ if (tc->targetAbi() == abi)
+ return tc->id();
+ }
+
+ return tcList.at(0)->id();
+}
+
+QList<Task> ToolChainProfileInformation::validate(Profile *p) const
+{
+ QList<Task> result;
+ if (!toolChain(p)) {
+ setToolChain(p, 0); // make sure to clear out no longer known tool chains
+ result << Task(Task::Error, QObject::tr("No tool chain set up."),
+ Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
+ }
+ return result;
+}
+
+ProfileConfigWidget *ToolChainProfileInformation::createConfigWidget(Profile *p) const
+{
+ Q_ASSERT(p);
+ return new Internal::ToolChainInformationConfigWidget(p);
+}
+
+ProfileInformation::ItemList ToolChainProfileInformation::toUserOutput(Profile *p) const
+{
+ ToolChain *tc = toolChain(p);
+ return ItemList() << qMakePair(tr("Tool chain"), tc ? tc->displayName() : tr("None"));
+}
+
+void ToolChainProfileInformation::addToEnvironment(const Profile *p, Utils::Environment &env) const
+{
+ ToolChain *tc = toolChain(p);
+ if (tc)
+ tc->addToEnvironment(env);
+}
+
+ToolChain *ToolChainProfileInformation::toolChain(const Profile *p)
+{
+ if (!p)
+ return 0;
+ const QString id = p->value(Core::Id(TOOLCHAIN_INFORMATION)).toString();
+ return ToolChainManager::instance()->findToolChain(id);
+}
+
+void ToolChainProfileInformation::setToolChain(Profile *p, ToolChain *tc)
+{
+ p->setValue(Core::Id(TOOLCHAIN_INFORMATION), tc ? tc->id() : QString());
+}
+
+// --------------------------------------------------------------------------
+// DeviceTypeInformation:
+// --------------------------------------------------------------------------
+
+static const char DEVICETYPE_INFORMATION[] = "PE.Profile.DeviceType";
+
+DeviceTypeProfileInformation::DeviceTypeProfileInformation()
+{
+ setObjectName(QLatin1String("DeviceTypeInformation"));
+}
+
+Core::Id DeviceTypeProfileInformation::dataId() const
+{
+ static const Core::Id id(DEVICETYPE_INFORMATION);
+ return id;
+}
+
+unsigned int DeviceTypeProfileInformation::priority() const
+{
+ return 33000;
+}
+
+QVariant DeviceTypeProfileInformation::defaultValue(Profile *p) const
+{
+ Q_UNUSED(p);
+ return QByteArray(Constants::DESKTOP_DEVICE_TYPE);
+}
+
+QList<Task> DeviceTypeProfileInformation::validate(Profile *p) const
+{
+ IDevice::ConstPtr dev = DeviceProfileInformation::device(p);
+ QList<Task> result;
+ if (!dev.isNull() && dev->type() != DeviceTypeProfileInformation::deviceTypeId(p))
+ result.append(Task(Task::Error, QObject::tr("Device does not match device type."),
+ Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)));
+ return result;
+}
+
+ProfileConfigWidget *DeviceTypeProfileInformation::createConfigWidget(Profile *p) const
+{
+ Q_ASSERT(p);
+ return new Internal::DeviceTypeInformationConfigWidget(p);
+}
+
+ProfileInformation::ItemList DeviceTypeProfileInformation::toUserOutput(Profile *p) const
+{
+ Core::Id type = deviceTypeId(p);
+ QString typeDisplayName = tr("Unknown device type");
+ if (type.isValid()) {
+ QList<IDeviceFactory *> factories
+ = ExtensionSystem::PluginManager::instance()->getObjects<IDeviceFactory>();
+ foreach (IDeviceFactory *factory, factories) {
+ if (factory->availableCreationIds().contains(type)) {
+ typeDisplayName = factory->displayNameForId(type);
+ break;
+ }
+ }
+ }
+ return ItemList() << qMakePair(tr("Device type"), typeDisplayName);
+}
+
+const Core::Id DeviceTypeProfileInformation::deviceTypeId(const Profile *p)
+{
+ if (!p)
+ return Core::Id();
+ return Core::Id(p->value(Core::Id(DEVICETYPE_INFORMATION)).toByteArray().constData());
+}
+
+void DeviceTypeProfileInformation::setDeviceTypeId(Profile *p, Core::Id type)
+{
+ p->setValue(Core::Id(DEVICETYPE_INFORMATION), type.name());
+}
+
+// --------------------------------------------------------------------------
+// DeviceInformation:
+// --------------------------------------------------------------------------
+
+static const char DEVICE_INFORMATION[] = "PE.Profile.Device";
+
+DeviceProfileInformation::DeviceProfileInformation()
+{
+ setObjectName(QLatin1String("DeviceInformation"));
+ connect(DeviceManager::instance(), SIGNAL(deviceRemoved(Core::Id)),
+ this, SIGNAL(validationNeeded()));
+ connect(DeviceManager::instance(), SIGNAL(deviceUpdated(Core::Id)),
+ this, SIGNAL(validationNeeded()));
+}
+
+Core::Id DeviceProfileInformation::dataId() const
+{
+ static const Core::Id id(DEVICE_INFORMATION);
+ return id;
+}
+
+unsigned int DeviceProfileInformation::priority() const
+{
+ return 32000;
+}
+
+QVariant DeviceProfileInformation::defaultValue(Profile *p) const
+{
+ Q_UNUSED(p);
+ return QByteArray(Constants::DESKTOP_DEVICE_ID);
+}
+
+QList<Task> DeviceProfileInformation::validate(Profile *p) const
+{
+ Q_UNUSED(p);
+ QList<Task> result;
+ return result;
+}
+
+ProfileConfigWidget *DeviceProfileInformation::createConfigWidget(Profile *p) const
+{
+ Q_ASSERT(p);
+ return new Internal::DeviceInformationConfigWidget(p);
+}
+
+ProfileInformation::ItemList DeviceProfileInformation::toUserOutput(Profile *p) const
+{
+ IDevice::ConstPtr dev = device(p);
+ return ItemList() << qMakePair(tr("Device"), dev.isNull() ? tr("Unconfigured") : dev->displayName());
+}
+
+IDevice::ConstPtr DeviceProfileInformation::device(const Profile *p)
+{
+ DeviceManager *dm = DeviceManager::instance();
+ return dm ? dm->find(deviceId(p)) : IDevice::ConstPtr();
+}
+
+Core::Id DeviceProfileInformation::deviceId(const Profile *p)
+{
+ if (p) {
+ QByteArray idname = p->value(Core::Id(DEVICE_INFORMATION)).toByteArray();
+ return idname.isEmpty() ? IDevice::invalidId() : Core::Id(idname.constData());
+ }
+ return IDevice::invalidId();
+}
+
+void DeviceProfileInformation::setDevice(Profile *p, IDevice::ConstPtr dev)
+{
+ setDeviceId(p, dev ? dev->id() : IDevice::invalidId());
+}
+
+void DeviceProfileInformation::setDeviceId(Profile *p, const Core::Id id)
+{
+ p->setValue(Core::Id(DEVICE_INFORMATION), id.name());
+}
+
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/profileinformation.h b/src/plugins/projectexplorer/profileinformation.h
new file mode 100644
index 0000000000..44fd0793fc
--- /dev/null
+++ b/src/plugins/projectexplorer/profileinformation.h
@@ -0,0 +1,224 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef PROFILEINFORMATION_H
+#define PROFILEINFORMATION_H
+
+#include "profilemanager.h"
+#include "profile.h"
+
+#include "devicesupport/idevice.h"
+#include "toolchain.h"
+
+#include <utils/fileutils.h>
+
+#include <QVariant>
+
+namespace ProjectExplorer {
+
+class ProfileConfigWidget;
+
+// --------------------------------------------------------------------------
+// SysRootInformation:
+// --------------------------------------------------------------------------
+
+class PROJECTEXPLORER_EXPORT SysRootProfileInformation : public ProfileInformation
+{
+ Q_OBJECT
+
+public:
+ SysRootProfileInformation();
+
+ Core::Id dataId() const;
+ unsigned int priority() const;
+
+ QVariant defaultValue(Profile *p) const;
+
+ QList<Task> validate(Profile *p) const;
+
+ ProfileConfigWidget *createConfigWidget(Profile *p) const;
+
+ ItemList toUserOutput(Profile *p) const;
+
+ static bool hasSysRoot(const Profile *p);
+ static Utils::FileName sysRoot(const Profile *p);
+ static void setSysRoot(Profile *p, const Utils::FileName &v);
+};
+
+class PROJECTEXPLORER_EXPORT SysRootMatcher : public ProfileMatcher
+{
+public:
+ SysRootMatcher(const Utils::FileName &fn) : m_sysroot(fn)
+ { }
+
+ bool matches(const Profile *p) const
+ {
+ return SysRootProfileInformation::sysRoot(p) == m_sysroot;
+ }
+
+private:
+ Utils::FileName m_sysroot;
+};
+
+// --------------------------------------------------------------------------
+// ToolChainInformation:
+// --------------------------------------------------------------------------
+
+class PROJECTEXPLORER_EXPORT ToolChainProfileInformation : public ProfileInformation
+{
+ Q_OBJECT
+
+public:
+ ToolChainProfileInformation();
+
+ Core::Id dataId() const;
+ unsigned int priority() const;
+
+ QVariant defaultValue(Profile *p) const;
+
+ QList<Task> validate(Profile *p) const;
+
+ ProfileConfigWidget *createConfigWidget(Profile *p) const;
+
+ ItemList toUserOutput(Profile *p) const;
+
+ void addToEnvironment(const Profile *p, Utils::Environment &env) const;
+
+ static ToolChain *toolChain(const Profile *p);
+ static void setToolChain(Profile *p, ToolChain *tc);
+};
+
+class PROJECTEXPLORER_EXPORT ToolChainMatcher : public ProfileMatcher
+{
+public:
+ ToolChainMatcher(const ToolChain *tc) : m_tc(tc)
+ { }
+
+ bool matches(const Profile *p) const
+ {
+ return ToolChainProfileInformation::toolChain(p) == m_tc;
+ }
+
+private:
+ const ToolChain *m_tc;
+};
+
+// --------------------------------------------------------------------------
+// DeviceTypeInformation:
+// --------------------------------------------------------------------------
+
+class PROJECTEXPLORER_EXPORT DeviceTypeProfileInformation : public ProfileInformation
+{
+ Q_OBJECT
+
+public:
+ DeviceTypeProfileInformation();
+
+ Core::Id dataId() const;
+ unsigned int priority() const;
+
+ QVariant defaultValue(Profile *p) const;
+
+ QList<Task> validate(Profile *p) const;
+
+ ProfileConfigWidget *createConfigWidget(Profile *p) const;
+
+ ItemList toUserOutput(Profile *p) const;
+
+ static const Core::Id deviceTypeId(const Profile *p);
+ static void setDeviceTypeId(Profile *p, Core::Id type);
+};
+
+class PROJECTEXPLORER_EXPORT DeviceTypeMatcher : public ProfileMatcher
+{
+public:
+ DeviceTypeMatcher(const Core::Id t) : m_type(t)
+ { }
+
+ bool matches(const Profile *p) const
+ {
+ Core::Id deviceType = DeviceTypeProfileInformation::deviceTypeId(p);
+ if (!deviceType.isValid())
+ return false;
+ return deviceType == m_type;
+ }
+
+private:
+ const Core::Id m_type;
+};
+
+// --------------------------------------------------------------------------
+// DeviceInformation:
+// --------------------------------------------------------------------------
+
+class PROJECTEXPLORER_EXPORT DeviceProfileInformation : public ProfileInformation
+{
+ Q_OBJECT
+
+public:
+ DeviceProfileInformation();
+
+ Core::Id dataId() const;
+ unsigned int priority() const;
+
+ QVariant defaultValue(Profile *p) const;
+
+ QList<Task> validate(Profile *p) const;
+
+ ProfileConfigWidget *createConfigWidget(Profile *p) const;
+
+ ItemList toUserOutput(Profile *p) const;
+
+ static IDevice::ConstPtr device(const Profile *p);
+ static Core::Id deviceId(const Profile *p);
+ static void setDevice(Profile *p, IDevice::ConstPtr dev);
+ static void setDeviceId(Profile *p, const Core::Id id);
+};
+
+class PROJECTEXPLORER_EXPORT DeviceMatcher : public ProfileMatcher
+{
+public:
+ DeviceMatcher(Core::Id id) : m_devId(id)
+ { }
+
+ bool matches(const Profile *p) const
+ {
+ return DeviceProfileInformation::deviceId(p) == m_devId;
+ }
+
+private:
+ Core::Id m_devId;
+};
+
+} // namespace ProjectExplorer
+
+#endif // PROFILEINFORMATION_H
diff --git a/src/plugins/projectexplorer/profileinformationconfigwidget.cpp b/src/plugins/projectexplorer/profileinformationconfigwidget.cpp
new file mode 100644
index 0000000000..457bb8369c
--- /dev/null
+++ b/src/plugins/projectexplorer/profileinformationconfigwidget.cpp
@@ -0,0 +1,353 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "profileinformationconfigwidget.h"
+
+#include "devicesupport/devicemanager.h"
+#include "devicesupport/devicemanagermodel.h"
+#include "devicesupport/idevicefactory.h"
+#include "projectexplorerconstants.h"
+#include "profile.h"
+#include "profileinformation.h"
+#include "toolchain.h"
+#include "toolchainmanager.h"
+
+#include <coreplugin/icore.h>
+#include <extensionsystem/pluginmanager.h>
+#include <utils/pathchooser.h>
+
+#include <QComboBox>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QPushButton>
+
+namespace ProjectExplorer {
+namespace Internal {
+
+// --------------------------------------------------------------------------
+// SysRootInformationConfigWidget:
+// --------------------------------------------------------------------------
+
+SysRootInformationConfigWidget::SysRootInformationConfigWidget(Profile *p, QWidget *parent) :
+ ProfileConfigWidget(parent),
+ m_profile(p)
+{
+ QHBoxLayout *layout = new QHBoxLayout(this);
+ layout->setMargin(0);
+ m_chooser = new Utils::PathChooser;
+ m_chooser->setContentsMargins(0, 0, 0, 0);
+ layout->addWidget(m_chooser);
+ m_chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
+
+ m_chooser->setFileName(SysRootProfileInformation::sysRoot(p));
+
+ connect(m_chooser, SIGNAL(changed(QString)), this, SIGNAL(dirty()));
+}
+
+QString SysRootInformationConfigWidget::displayName() const
+{
+ return tr("Sysroot:");
+}
+
+void SysRootInformationConfigWidget::apply()
+{
+ SysRootProfileInformation::setSysRoot(m_profile, m_chooser->fileName());
+}
+
+void SysRootInformationConfigWidget::discard()
+{
+ m_chooser->setFileName(SysRootProfileInformation::sysRoot(m_profile));
+}
+
+bool SysRootInformationConfigWidget::isDirty() const
+{
+ return SysRootProfileInformation::sysRoot(m_profile) != m_chooser->fileName();
+}
+
+void SysRootInformationConfigWidget::makeReadOnly()
+{
+ m_chooser->setEnabled(false);
+}
+
+// --------------------------------------------------------------------------
+// ToolChainInformationConfigWidget:
+// --------------------------------------------------------------------------
+
+ToolChainInformationConfigWidget::ToolChainInformationConfigWidget(Profile *p, QWidget *parent) :
+ ProfileConfigWidget(parent),
+ m_isReadOnly(false), m_profile(p),
+ m_comboBox(new QComboBox), m_manageButton(new QPushButton)
+{
+ ToolChainManager *tcm = ToolChainManager::instance();
+
+ QHBoxLayout *layout = new QHBoxLayout(this);
+ layout->setMargin(0);
+ m_comboBox->setContentsMargins(0, 0, 0, 0);
+ m_comboBox->setEnabled(false);
+ m_comboBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
+ layout->addWidget(m_comboBox);
+
+ foreach (ToolChain *tc, tcm->toolChains())
+ toolChainAdded(tc);
+
+ updateComboBox();
+
+ discard();
+ connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dirty()));
+
+ m_manageButton->setContentsMargins(0, 0, 0, 0);
+ m_manageButton->setText(tr("Manage..."));
+ layout->addWidget(m_manageButton);
+ connect(m_manageButton, SIGNAL(clicked()), this, SLOT(manageToolChains()));
+
+ connect(tcm, SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
+ this, SLOT(toolChainAdded(ProjectExplorer::ToolChain*)));
+ connect(tcm, SIGNAL(toolChainRemoved(ProjectExplorer::ToolChain*)),
+ this, SLOT(toolChainRemoved(ProjectExplorer::ToolChain*)));
+ connect(tcm, SIGNAL(toolChainUpdated(ProjectExplorer::ToolChain*)),
+ this, SLOT(toolChainUpdated(ProjectExplorer::ToolChain*)));
+}
+
+QString ToolChainInformationConfigWidget::displayName() const
+{
+ return tr("Tool chain:");
+}
+
+void ToolChainInformationConfigWidget::apply()
+{
+ const QString id = m_comboBox->itemData(m_comboBox->currentIndex()).toString();
+ ToolChain *tc = ToolChainManager::instance()->findToolChain(id);
+ ToolChainProfileInformation::setToolChain(m_profile, tc);
+}
+
+void ToolChainInformationConfigWidget::discard()
+{
+ m_comboBox->setCurrentIndex(indexOf(ToolChainProfileInformation::toolChain(m_profile)));
+}
+
+bool ToolChainInformationConfigWidget::isDirty() const
+{
+ ToolChain *tc = ToolChainProfileInformation::toolChain(m_profile);
+ return (m_comboBox->itemData(m_comboBox->currentIndex()).toString())
+ == (tc ? tc->id() : QString());
+}
+
+void ToolChainInformationConfigWidget::makeReadOnly()
+{
+ m_comboBox->setEnabled(false);
+}
+
+void ToolChainInformationConfigWidget::toolChainAdded(ProjectExplorer::ToolChain *tc)
+{
+ m_comboBox->addItem(tc->displayName(), tc->id());
+ updateComboBox();
+}
+
+void ToolChainInformationConfigWidget::toolChainRemoved(ProjectExplorer::ToolChain *tc)
+{
+ const int pos = indexOf(tc);
+ if (pos < 0)
+ return;
+ m_comboBox->removeItem(pos);
+ updateComboBox();
+}
+void ToolChainInformationConfigWidget::toolChainUpdated(ProjectExplorer::ToolChain *tc)
+{
+ const int pos = indexOf(tc);
+ if (pos < 0)
+ return;
+ m_comboBox->setItemText(pos, tc->displayName());
+}
+
+void ToolChainInformationConfigWidget::manageToolChains()
+{
+ Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
+ QLatin1String(ProjectExplorer::Constants::TOOLCHAIN_SETTINGS_PAGE_ID));
+}
+
+void ToolChainInformationConfigWidget::updateComboBox()
+{
+ // remove unavailable tool chain:
+ int pos = indexOf(0);
+ if (pos >= 0)
+ m_comboBox->removeItem(pos);
+
+ if (m_comboBox->count() == 0) {
+ m_comboBox->addItem(tr("<No tool chain available>"), QString());
+ m_comboBox->setEnabled(false);
+ } else {
+ m_comboBox->setEnabled(!m_isReadOnly);
+ }
+}
+
+int ToolChainInformationConfigWidget::indexOf(const ToolChain *tc)
+{
+ const QString id = tc ? tc->id() : QString();
+ for (int i = 0; i < m_comboBox->count(); ++i) {
+ if (id == m_comboBox->itemData(i).toString())
+ return i;
+ }
+ return -1;
+}
+
+// --------------------------------------------------------------------------
+// DeviceTypeInformationConfigWidget:
+// --------------------------------------------------------------------------
+
+DeviceTypeInformationConfigWidget::DeviceTypeInformationConfigWidget(Profile *p, QWidget *parent) :
+ ProfileConfigWidget(parent),
+ m_isReadOnly(false), m_profile(p),
+ m_comboBox(new QComboBox)
+{
+ QHBoxLayout *layout = new QHBoxLayout(this);
+ layout->setMargin(0);
+ m_comboBox->setContentsMargins(0, 0, 0, 0);
+ m_comboBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
+ layout->addWidget(m_comboBox);
+
+ QList<IDeviceFactory *> factories
+ = ExtensionSystem::PluginManager::instance()->getObjects<IDeviceFactory>();
+ foreach (IDeviceFactory *factory, factories) {
+ foreach (Core::Id id, factory->availableCreationIds()) {
+ m_comboBox->addItem(factory->displayNameForId(id), QVariant::fromValue(id));
+ }
+ }
+
+ discard();
+ connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dirty()));
+}
+
+QString DeviceTypeInformationConfigWidget::displayName() const
+{
+ return tr("Device Type:");
+}
+
+void DeviceTypeInformationConfigWidget::apply()
+{
+ Core::Id devType;
+ if (m_comboBox->currentIndex() >= 0)
+ devType = m_comboBox->itemData(m_comboBox->currentIndex()).value<Core::Id>();
+ DeviceTypeProfileInformation::setDeviceTypeId(m_profile, devType);
+}
+
+void DeviceTypeInformationConfigWidget::discard()
+{
+ Core::Id devType = DeviceTypeProfileInformation::deviceTypeId(m_profile);
+ if (!devType.isValid())
+ m_comboBox->setCurrentIndex(-1);
+ for (int i = 0; i < m_comboBox->count(); ++i) {
+ if (m_comboBox->itemData(i).value<Core::Id>() == devType) {
+ m_comboBox->setCurrentIndex(i);
+ break;
+ }
+ }
+}
+
+bool DeviceTypeInformationConfigWidget::isDirty() const
+{
+ Core::Id devType;
+ if (m_comboBox->currentIndex() >= 0)
+ devType = m_comboBox->itemData(m_comboBox->currentIndex()).value<Core::Id>();
+ return DeviceTypeProfileInformation::deviceTypeId(m_profile) != devType;
+}
+
+void DeviceTypeInformationConfigWidget::makeReadOnly()
+{
+ m_comboBox->setEnabled(false);
+}
+
+// --------------------------------------------------------------------------
+// DeviceInformationConfigWidget:
+// --------------------------------------------------------------------------
+
+DeviceInformationConfigWidget::DeviceInformationConfigWidget(Profile *p, QWidget *parent) :
+ ProfileConfigWidget(parent),
+ m_isReadOnly(false), m_profile(p),
+ m_comboBox(new QComboBox), m_manageButton(new QPushButton),
+ m_model(new DeviceManagerModel(DeviceManager::instance()))
+{
+ QHBoxLayout *layout = new QHBoxLayout(this);
+ layout->setMargin(0);
+ m_comboBox->setContentsMargins(0, 0, 0, 0);
+ m_comboBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
+ layout->addWidget(m_comboBox);
+
+ m_comboBox->setModel(m_model);
+
+ m_manageButton->setContentsMargins(0, 0, 0, 0);
+ m_manageButton->setText(tr("Manage..."));
+ layout->addWidget(m_manageButton);
+
+ discard();
+ connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dirty()));
+
+ connect(m_manageButton, SIGNAL(clicked()), this, SLOT(manageDevices()));
+}
+
+QString DeviceInformationConfigWidget::displayName() const
+{
+ return tr("Device:");
+}
+
+void DeviceInformationConfigWidget::apply()
+{
+ int idx = m_comboBox->currentIndex();
+ if (idx >= 0)
+ DeviceProfileInformation::setDeviceId(m_profile, m_model->deviceId(idx));
+ else
+ DeviceProfileInformation::setDeviceId(m_profile, IDevice::invalidId());
+}
+
+void DeviceInformationConfigWidget::discard()
+{
+ m_comboBox->setCurrentIndex(m_model->indexOf(DeviceProfileInformation::device(m_profile)));
+}
+
+bool DeviceInformationConfigWidget::isDirty() const
+{
+ Core::Id devId = DeviceProfileInformation::deviceId(m_profile);
+ return devId != m_model->deviceId(m_comboBox->currentIndex());
+}
+
+void DeviceInformationConfigWidget::makeReadOnly()
+{
+ m_comboBox->setEnabled(false);
+}
+
+void DeviceInformationConfigWidget::manageDevices()
+{
+ Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY),
+ QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_PAGE_ID));
+}
+
+} // namespace Internal
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/profileinformationconfigwidget.h b/src/plugins/projectexplorer/profileinformationconfigwidget.h
new file mode 100644
index 0000000000..59eafd2a4b
--- /dev/null
+++ b/src/plugins/projectexplorer/profileinformationconfigwidget.h
@@ -0,0 +1,160 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef PROFILEINFORMATIONCONFIGWIDGET_H
+#define PROFILEINFORMATIONCONFIGWIDGET_H
+
+#include "profileconfigwidget.h"
+
+QT_FORWARD_DECLARE_CLASS(QComboBox)
+QT_FORWARD_DECLARE_CLASS(QPushButton)
+
+namespace Utils { class PathChooser; }
+
+namespace ProjectExplorer {
+
+class DeviceManagerModel;
+class Profile;
+class ToolChain;
+
+namespace Internal {
+
+// --------------------------------------------------------------------------
+// SysRootInformationConfigWidget:
+// --------------------------------------------------------------------------
+
+class SysRootInformationConfigWidget : public ProfileConfigWidget
+{
+ Q_OBJECT
+
+public:
+ explicit SysRootInformationConfigWidget(Profile *p, QWidget *parent = 0);
+
+ QString displayName() const;
+ void apply();
+ void discard();
+ bool isDirty() const;
+ void makeReadOnly();
+
+private:
+ Profile *m_profile;
+ Utils::PathChooser *m_chooser;
+};
+
+// --------------------------------------------------------------------------
+// ToolChainInformationConfigWidget:
+// --------------------------------------------------------------------------
+
+class ToolChainInformationConfigWidget : public ProfileConfigWidget
+{
+ Q_OBJECT
+
+public:
+ explicit ToolChainInformationConfigWidget(Profile *p, QWidget *parent = 0);
+
+ QString displayName() const;
+ void apply();
+ void discard();
+ bool isDirty() const;
+ void makeReadOnly();
+
+private slots:
+ void toolChainAdded(ProjectExplorer::ToolChain *tc);
+ void toolChainRemoved(ProjectExplorer::ToolChain *tc);
+ void toolChainUpdated(ProjectExplorer::ToolChain *tc);
+ void manageToolChains();
+
+private:
+ void updateComboBox();
+ int indexOf(const ToolChain *tc);
+
+ bool m_isReadOnly;
+ Profile *m_profile;
+ QComboBox *m_comboBox;
+ QPushButton *m_manageButton;
+};
+
+// --------------------------------------------------------------------------
+// DeviceTypeInformationConfigWidget:
+// --------------------------------------------------------------------------
+
+class DeviceTypeInformationConfigWidget : public ProfileConfigWidget
+{
+ Q_OBJECT
+
+public:
+ explicit DeviceTypeInformationConfigWidget(Profile *p, QWidget *parent = 0);
+
+ QString displayName() const;
+ void apply();
+ void discard();
+ bool isDirty() const;
+ void makeReadOnly();
+
+private:
+ bool m_isReadOnly;
+ Profile *m_profile;
+ QComboBox *m_comboBox;
+};
+
+// --------------------------------------------------------------------------
+// DeviceInformationConfigWidget:
+// --------------------------------------------------------------------------
+
+class DeviceInformationConfigWidget : public ProfileConfigWidget
+{
+ Q_OBJECT
+
+public:
+ explicit DeviceInformationConfigWidget(Profile *p, QWidget *parent = 0);
+
+ QString displayName() const;
+ void apply();
+ void discard();
+ bool isDirty() const;
+ void makeReadOnly();
+
+private slots:
+ void manageDevices();
+
+private:
+ bool m_isReadOnly;
+ Profile *m_profile;
+ QComboBox *m_comboBox;
+ QPushButton *m_manageButton;
+ DeviceManagerModel *m_model;
+};
+
+} // namespace Internal
+} // namespace ProjectExplorer
+
+#endif // PROFILEINFORMATIONCONFIGWIDGET_H
diff --git a/src/plugins/projectexplorer/profilemanager.cpp b/src/plugins/projectexplorer/profilemanager.cpp
new file mode 100644
index 0000000000..add233b20f
--- /dev/null
+++ b/src/plugins/projectexplorer/profilemanager.cpp
@@ -0,0 +1,471 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "profilemanager.h"
+
+#include "profile.h"
+#include "profileconfigwidget.h"
+#include "profilemanagerconfigwidget.h"
+#include "project.h"
+
+#include <coreplugin/icore.h>
+
+#include <extensionsystem/pluginmanager.h>
+
+#include <utils/persistentsettings.h>
+#include <utils/environment.h>
+
+#include <QCoreApplication>
+#include <QDir>
+#include <QSettings>
+
+#include <QFormLayout>
+#include <QLabel>
+#include <QMainWindow>
+
+static const char PROFILE_DATA_KEY[] = "Profile.";
+static const char PROFILE_COUNT_KEY[] = "Profile.Count";
+static const char PROFILE_FILE_VERSION_KEY[] = "Version";
+static const char PROFILE_DEFAULT_KEY[] = "Profile.Default";
+static const char PROFILE_FILENAME[] = "/qtcreator/profiles.xml";
+
+using Utils::PersistentSettingsWriter;
+using Utils::PersistentSettingsReader;
+
+static QString settingsFileName()
+{
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ QFileInfo settingsLocation(pm->settings()->fileName());
+ return settingsLocation.absolutePath() + QLatin1String(PROFILE_FILENAME);
+}
+
+namespace ProjectExplorer {
+
+ProfileManager *ProfileManager::m_instance = 0;
+
+namespace Internal {
+
+// --------------------------------------------------------------------------
+// ProfileManagerPrivate:
+// --------------------------------------------------------------------------
+
+class ProfileManagerPrivate
+{
+public:
+ ProfileManagerPrivate();
+ ~ProfileManagerPrivate();
+ QList<Task> validateProfile(Profile *p) const;
+
+ Profile *m_defaultProfile;
+ bool m_initialized;
+ QList<ProfileInformation *> m_informationList;
+ QList<Profile *> m_profileList;
+};
+
+ProfileManagerPrivate::ProfileManagerPrivate()
+ : m_defaultProfile(0), m_initialized(false)
+{ }
+
+ProfileManagerPrivate::~ProfileManagerPrivate()
+{
+}
+
+QList<Task> ProfileManagerPrivate::validateProfile(Profile *p) const
+{
+ Q_ASSERT(p);
+ QList<Task> result;
+ bool hasError = false;
+ foreach (ProfileInformation *pi, m_informationList) {
+ QList<Task> tmp = pi->validate(p);
+ foreach (const Task &t, tmp)
+ if (t.type == Task::Error)
+ hasError = true;
+ result << tmp;
+ }
+ p->setValid(!hasError);
+ return result;
+}
+
+} // namespace Internal
+
+// --------------------------------------------------------------------------
+// ProfileManager:
+// --------------------------------------------------------------------------
+
+ProfileManager *ProfileManager::instance()
+{
+ return m_instance;
+}
+
+ProfileManager::ProfileManager(QObject *parent) :
+ QObject(parent),
+ d(new Internal::ProfileManagerPrivate())
+{
+ Q_ASSERT(!m_instance);
+ m_instance = this;
+
+ connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()),
+ this, SLOT(saveProfiles()));
+
+ connect(this, SIGNAL(profileAdded(ProjectExplorer::Profile*)),
+ this, SIGNAL(profilesChanged()));
+ connect(this, SIGNAL(profileRemoved(ProjectExplorer::Profile*)),
+ this, SIGNAL(profilesChanged()));
+ connect(this, SIGNAL(profileUpdated(ProjectExplorer::Profile*)),
+ this, SIGNAL(profilesChanged()));
+}
+
+void ProfileManager::restoreProfiles()
+{
+ QList<Profile *> stsToRegister;
+ QList<Profile *> stsToCheck;
+
+ // read all profiles from SDK
+ QFileInfo systemSettingsFile(Core::ICore::settings(QSettings::SystemScope)->fileName());
+ ProfileList system = restoreProfiles(systemSettingsFile.absolutePath() + QLatin1String(PROFILE_FILENAME));
+ QList<Profile *> readSts = system.profiles;
+ // make sure we mark these as autodetected!
+ foreach (Profile *p, readSts)
+ p->setAutoDetected(true);
+
+ stsToRegister = readSts; // SDK profiles are always considered to be up-to-date, so no need to
+ // recheck them.
+
+ // read all profile chains from user file
+ ProfileList userProfiles = restoreProfiles(settingsFileName());
+ readSts = userProfiles.profiles;
+
+ foreach (Profile *p, readSts) {
+ if (p->isAutoDetected())
+ stsToCheck.append(p);
+ else
+ stsToRegister.append(p);
+ }
+ readSts.clear();
+
+ // Then auto create profiles:
+ QList<Profile *> detectedSts;
+ Profile *defaultProfile = new Profile; // One profile using default values
+ defaultProfile->setDisplayName(tr("Desktop"));
+ defaultProfile->setAutoDetected(true);
+ defaultProfile->setIconPath(QLatin1String(":///DESKTOP///"));
+
+ detectedSts << defaultProfile;
+
+ // Find/update autodetected profiles:
+ Profile *toStore = 0;
+ foreach (Profile *currentDetected, detectedSts) {
+ toStore = currentDetected;
+
+ // Check whether we had this profile stored and prefer the old one with the old id:
+ for (int i = 0; i < stsToCheck.count(); ++i) {
+ if (*(stsToCheck.at(i)) == *currentDetected) {
+ toStore = stsToCheck.at(i);
+ stsToCheck.removeAt(i);
+ delete currentDetected;
+ break;
+ }
+ }
+ addProfile(toStore);
+ }
+
+ // Delete all loaded autodetected profiles that were not rediscovered:
+ qDeleteAll(stsToCheck);
+
+ // Store manual tool chains
+ foreach (Profile *p, stsToRegister)
+ addProfile(p);
+
+ Profile *p = find(userProfiles.defaultProfile);
+ if (p)
+ setDefaultProfile(p);
+}
+
+ProfileManager::~ProfileManager()
+{
+ // Clean out profile information to avoid calling them during deregistration:
+ qDeleteAll(d->m_informationList);
+ qDeleteAll(d->m_profileList);
+ delete d;
+ m_instance = 0;
+}
+
+void ProfileManager::saveProfiles()
+{
+ PersistentSettingsWriter writer;
+ writer.saveValue(QLatin1String(PROFILE_FILE_VERSION_KEY), 1);
+
+ int count = 0;
+ foreach (Profile *p, profiles()) {
+ QVariantMap tmp = p->toMap();
+ if (tmp.isEmpty())
+ continue;
+ writer.saveValue(QString::fromLatin1(PROFILE_DATA_KEY) + QString::number(count), tmp);
+ ++count;
+ }
+ writer.saveValue(QLatin1String(PROFILE_COUNT_KEY), count);
+ writer.saveValue(QLatin1String(PROFILE_DEFAULT_KEY),
+ d->m_defaultProfile ? QString::fromLatin1(d->m_defaultProfile->id().name()) : QString());
+ writer.save(settingsFileName(), QLatin1String("QtCreatorProfiles"), Core::ICore::mainWindow());
+}
+
+bool greaterPriority(ProfileInformation *a, ProfileInformation *b)
+{
+ return a->priority() > b->priority();
+}
+
+void ProfileManager::registerProfileInformation(ProfileInformation *pi)
+{
+ QList<ProfileInformation *>::iterator it
+ = qLowerBound(d->m_informationList.begin(), d->m_informationList.end(), pi, greaterPriority);
+ d->m_informationList.insert(it, pi);
+
+ connect(pi, SIGNAL(validationNeeded()), this, SLOT(validateProfiles()));
+
+ if (!d->m_initialized)
+ return;
+
+ foreach (Profile *p, profiles()) {
+ if (!p->hasValue(pi->dataId()))
+ p->setValue(pi->dataId(), pi->defaultValue(p));
+ }
+
+ return;
+}
+
+void ProfileManager::deregisterProfileInformation(ProfileInformation *pi)
+{
+ Q_ASSERT(d->m_informationList.contains(pi));
+ d->m_informationList.removeAll(pi);
+ delete pi;
+}
+
+ProfileManager::ProfileList ProfileManager::restoreProfiles(const QString &fileName)
+{
+ ProfileList result;
+
+ PersistentSettingsReader reader;
+ if (!reader.load(fileName))
+ return result;
+ QVariantMap data = reader.restoreValues();
+
+ // Check version:
+ int version = data.value(QLatin1String(PROFILE_FILE_VERSION_KEY), 0).toInt();
+ if (version < 1)
+ return result;
+
+ const int count = data.value(QLatin1String(PROFILE_COUNT_KEY), 0).toInt();
+ for (int i = 0; i < count; ++i) {
+ const QString key = QString::fromLatin1(PROFILE_DATA_KEY) + QString::number(i);
+ if (!data.contains(key))
+ break;
+
+ const QVariantMap stMap = data.value(key).toMap();
+
+ Profile *p = new Profile;
+ if (p->fromMap(stMap)) {
+ result.profiles.append(p);
+ } else {
+ delete p;
+ qWarning("Warning: Unable to restore profiles stored in %s at position %d.",
+ qPrintable(QDir::toNativeSeparators(fileName)), i);
+ }
+ }
+ const QString defaultId = data.value(QLatin1String(PROFILE_DEFAULT_KEY)).toString();
+ if (defaultId.isEmpty())
+ return result;
+
+ const Core::Id id = Core::Id(defaultId);
+ foreach (Profile *i, result.profiles) {
+ if (i->id() == id) {
+ result.defaultProfile = id;
+ break;
+ }
+ }
+ return result;
+}
+
+QList<Profile *> ProfileManager::profiles(const ProfileMatcher *m) const
+{
+ if (!d->m_initialized) {
+ d->m_initialized = true;
+ const_cast<ProfileManager *>(this)->restoreProfiles();
+ }
+
+ QList<Profile *> result;
+ foreach (Profile *p, d->m_profileList) {
+ if (!m || m->matches(p))
+ result.append(p);
+ }
+ return result;
+}
+
+Profile *ProfileManager::find(const Core::Id &id) const
+{
+ if (!id.isValid())
+ return 0;
+
+ foreach (Profile *p, profiles()) {
+ if (p->id() == id)
+ return p;
+ }
+ return 0;
+}
+
+Profile *ProfileManager::find(const ProfileMatcher *m) const
+{
+ QList<Profile *> matched = profiles(m);
+ return matched.isEmpty() ? 0 : matched.first();
+}
+
+Profile *ProfileManager::defaultProfile()
+{
+ if (!d->m_initialized) {
+ d->m_initialized = true;
+ restoreProfiles();
+ }
+ return d->m_defaultProfile;
+}
+
+QList<ProfileInformation *> ProfileManager::profileInformation() const
+{
+ return d->m_informationList;
+}
+
+ProfileConfigWidget *ProfileManager::createConfigWidget(Profile *p) const
+{
+ if (!p)
+ return 0;
+
+ Internal::ProfileManagerConfigWidget *result = new Internal::ProfileManagerConfigWidget(p);
+ foreach (ProfileInformation *pi, d->m_informationList)
+ result->addConfigWidget(pi->createConfigWidget(p));
+
+ return result;
+}
+
+void ProfileManager::notifyAboutUpdate(ProjectExplorer::Profile *p)
+{
+ if (!p || !profiles().contains(p))
+ return;
+ d->validateProfile(p);
+ emit profileUpdated(p);
+}
+
+bool ProfileManager::registerProfile(ProjectExplorer::Profile *p)
+{
+ if (!p)
+ return true;
+ foreach (Profile *current, profiles()) {
+ if (p == current || *p == *current)
+ return false;
+ }
+
+ // Make name unique:
+ QStringList names;
+ foreach (Profile *tmp, profiles())
+ names << tmp->displayName();
+ p->setDisplayName(Project::makeUnique(p->displayName(), names));
+
+ // make sure we have all the information in our profiles:
+ foreach (ProfileInformation *pi, d->m_informationList) {
+ if (!p->hasValue(pi->dataId()))
+ p->setValue(pi->dataId(), pi->defaultValue(p));
+ }
+
+ addProfile(p);
+ emit profileAdded(p);
+ return true;
+}
+
+void ProfileManager::deregisterProfile(Profile *p)
+{
+ if (!p || !profiles().contains(p))
+ return;
+ d->m_profileList.removeOne(p);
+ if (d->m_defaultProfile == p) {
+ QList<Profile *> stList = profiles();
+ Profile *newDefault = 0;
+ foreach (Profile *cur, stList) {
+ if (cur->isValid()) {
+ newDefault = cur;
+ break;
+ }
+ }
+ setDefaultProfile(newDefault);
+ }
+ emit profileRemoved(p);
+ delete p;
+}
+
+QList<Task> ProfileManager::validateProfile(Profile *p)
+{
+ QList<Task> result = d->validateProfile(p);
+ qSort(result);
+ return result;
+}
+
+void ProfileManager::setDefaultProfile(Profile *p)
+{
+ if (d->m_defaultProfile == p)
+ return;
+ if (p && !profiles().contains(p))
+ return;
+ d->m_defaultProfile = p;
+ emit defaultProfileChanged();
+}
+
+void ProfileManager::validateProfiles()
+{
+ foreach (Profile *p, profiles())
+ d->validateProfile(p);
+}
+
+void ProfileManager::addProfile(Profile *p)
+{
+ if (!p)
+ return;
+ d->validateProfile(p);
+ d->m_profileList.append(p);
+ if (!d->m_defaultProfile ||
+ (!d->m_defaultProfile->isValid() && p->isValid()))
+ setDefaultProfile(p);
+}
+
+
+void ProfileInformation::addToEnvironment(const Profile *p, Utils::Environment &env) const
+{
+ Q_UNUSED(p);
+ Q_UNUSED(env);
+}
+
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/profilemanager.h b/src/plugins/projectexplorer/profilemanager.h
new file mode 100644
index 0000000000..e9bac6dc4f
--- /dev/null
+++ b/src/plugins/projectexplorer/profilemanager.h
@@ -0,0 +1,171 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef PROFILEMANAGER_H
+#define PROFILEMANAGER_H
+
+#include "projectexplorer_export.h"
+
+#include "task.h"
+
+#include <coreplugin/id.h>
+#include <utils/fileutils.h>
+
+#include <QObject>
+#include <QPair>
+
+namespace Utils { class Environment; }
+
+namespace ProjectExplorer {
+class Profile;
+class ProfileConfigWidget;
+
+namespace Internal {
+class ProfileManagerPrivate;
+class ProfileModel;
+} // namespace Internal
+
+/**
+ * @brief The ProfileInformation class
+ *
+ * One piece of information stored in the profile.
+ *
+ * This needs to get registered with the \a ProfileManager.
+ */
+class PROJECTEXPLORER_EXPORT ProfileInformation : public QObject
+{
+ Q_OBJECT
+
+public:
+ typedef QPair<QString, QString> Item;
+ typedef QList<Item> ItemList;
+
+ virtual Core::Id dataId() const = 0;
+
+ virtual unsigned int priority() const = 0; // the higher the closer to the top.
+
+ virtual bool visibleIn(Profile *) { return true; }
+ virtual QVariant defaultValue(Profile *) const = 0;
+
+ virtual QList<Task> validate(Profile *) const = 0;
+
+ virtual ItemList toUserOutput(Profile *p) const = 0;
+
+ virtual ProfileConfigWidget *createConfigWidget(Profile *) const = 0;
+
+ virtual void addToEnvironment(const Profile *p, Utils::Environment &env) const;
+
+signals:
+ void validationNeeded();
+};
+
+class PROJECTEXPLORER_EXPORT ProfileMatcher
+{
+public:
+ virtual ~ProfileMatcher() { }
+ virtual bool matches(const Profile *p) const = 0;
+};
+
+class PROJECTEXPLORER_EXPORT ProfileManager : public QObject
+{
+ Q_OBJECT
+
+public:
+ static ProfileManager *instance();
+ ~ProfileManager();
+
+ QList<Profile *> profiles(const ProfileMatcher *m = 0) const;
+ Profile *find(const Core::Id &id) const;
+ Profile *find(const ProfileMatcher *m) const;
+ Profile *defaultProfile();
+
+ QList<ProfileInformation *> profileInformation() const;
+
+ ProfileConfigWidget *createConfigWidget(Profile *p) const;
+
+public slots:
+ bool registerProfile(ProjectExplorer::Profile *p);
+ void deregisterProfile(ProjectExplorer::Profile *p);
+ QList<Task> validateProfile(ProjectExplorer::Profile *p);
+ void setDefaultProfile(ProjectExplorer::Profile *p);
+
+ void saveProfiles();
+
+ void registerProfileInformation(ProjectExplorer::ProfileInformation *pi);
+ void deregisterProfileInformation(ProjectExplorer::ProfileInformation *pi);
+
+signals:
+ void profileAdded(ProjectExplorer::Profile *);
+ // Profile is still valid when this call happens!
+ void profileRemoved(ProjectExplorer::Profile *);
+ // Profile was updated.
+ void profileUpdated(ProjectExplorer::Profile *);
+ // Default profile was changed.
+ void defaultProfileChanged();
+ // Something changed.
+ void profilesChanged();
+
+private slots:
+ void validateProfiles();
+
+private:
+ explicit ProfileManager(QObject *parent = 0);
+
+ // Make sure the this is only called after all
+ // ProfileInformation are registered!
+ void restoreProfiles();
+ class ProfileList
+ {
+ public:
+ ProfileList()
+ { }
+ Core::Id defaultProfile;
+ QList<Profile *> profiles;
+ };
+ ProfileList restoreProfiles(const QString &fileName);
+
+ void notifyAboutUpdate(ProjectExplorer::Profile *p);
+ void addProfile(Profile *p);
+
+ Internal::ProfileManagerPrivate *const d;
+
+ static ProfileManager *m_instance;
+
+ friend class Internal::ProfileManagerPrivate; // for the restoreToolChains methods
+ friend class ProjectExplorerPlugin; // for constructor
+ friend class Profile;
+ friend class Internal::ProfileModel;
+};
+
+} // namespace ProjectExplorer
+
+#endif // PROFILEMANAGER_H
diff --git a/src/plugins/projectexplorer/profilemanagerconfigwidget.cpp b/src/plugins/projectexplorer/profilemanagerconfigwidget.cpp
new file mode 100644
index 0000000000..04aed656bf
--- /dev/null
+++ b/src/plugins/projectexplorer/profilemanagerconfigwidget.cpp
@@ -0,0 +1,132 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "profilemanagerconfigwidget.h"
+
+#include "profile.h"
+
+#include <QHBoxLayout>
+#include <QFormLayout>
+#include <QPushButton>
+#include <QFileDialog>
+
+namespace ProjectExplorer {
+namespace Internal {
+
+ProfileManagerConfigWidget::ProfileManagerConfigWidget(Profile *p, QWidget *parent) :
+ ProfileConfigWidget(parent),
+ m_layout(new QFormLayout),
+ m_iconButton(new QPushButton),
+ m_profile(p)
+{
+ m_layout->setMargin(0);
+ m_layout->setSpacing(6);
+
+ m_iconButton->setMinimumSize(70, 70);
+ m_iconButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Fixed);
+ QVBoxLayout *iconLayout = new QVBoxLayout;
+ iconLayout->addWidget(m_iconButton);
+ iconLayout->addStretch();
+
+ QHBoxLayout *masterLayout = new QHBoxLayout(this);
+ masterLayout->addLayout(iconLayout);
+ masterLayout->setMargin(0);
+ masterLayout->setSpacing(12);
+ masterLayout->addLayout(m_layout);
+
+ discard();
+
+ connect(m_iconButton, SIGNAL(clicked()), this, SLOT(setIcon()));
+}
+
+QString ProfileManagerConfigWidget::displayName() const
+{
+ return tr("Profiles");
+}
+
+void ProfileManagerConfigWidget::apply()
+{
+ foreach (ProfileConfigWidget *w, m_widgets)
+ w->apply();
+ m_profile->setIconPath(m_iconPath);
+}
+
+void ProfileManagerConfigWidget::discard()
+{
+ foreach (ProfileConfigWidget *w, m_widgets)
+ w->discard();
+ m_iconButton->setIcon(m_profile->icon());
+ m_iconPath = m_profile->iconPath();
+}
+
+bool ProfileManagerConfigWidget::isDirty() const
+{
+ foreach (ProfileConfigWidget *w, m_widgets)
+ if (w->isDirty())
+ return true;
+ return m_profile->iconPath() != m_iconPath;
+}
+
+void ProfileManagerConfigWidget::addConfigWidget(ProjectExplorer::ProfileConfigWidget *widget)
+{
+ Q_ASSERT(widget);
+ Q_ASSERT(!m_widgets.contains(widget));
+
+ connect(widget, SIGNAL(dirty()), this, SIGNAL(dirty()));
+ m_layout->addRow(widget->displayName(), widget);
+ m_widgets.append(widget);
+}
+
+void ProfileManagerConfigWidget::makeReadOnly()
+{
+ foreach (ProfileConfigWidget *w, m_widgets)
+ w->makeReadOnly();
+ m_iconButton->setEnabled(false);
+}
+
+void ProfileManagerConfigWidget::setIcon()
+{
+ const QString path = QFileDialog::getOpenFileName(0, tr("Select Icon"), m_iconPath, tr("Images (*.png *.xpm *.jpg)"));
+ if (path.isEmpty())
+ return;
+
+ const QIcon icon = QIcon(path);
+ if (icon.isNull())
+ return;
+
+ m_iconButton->setIcon(icon);
+ m_iconPath = path;
+ emit dirty();
+}
+
+} // namespace Internal
+} // namespace ProjectExplorer
diff --git a/src/plugins/remotelinux/genericembeddedlinuxtarget.h b/src/plugins/projectexplorer/profilemanagerconfigwidget.h
index fe84489b02..0bf7204a29 100644
--- a/src/plugins/remotelinux/genericembeddedlinuxtarget.h
+++ b/src/plugins/projectexplorer/profilemanagerconfigwidget.h
@@ -30,33 +30,49 @@
**
**************************************************************************/
-#ifndef EMBEDDEDLINUXTARGET_H
-#define EMBEDDEDLINUXTARGET_H
+#ifndef PROFILEMANAGERWIDGET_H
+#define PROFILEMANAGERWIDGET_H
-#include "abstractembeddedlinuxtarget.h"
+#include "profileconfigwidget.h"
-namespace RemoteLinux {
-namespace Internal {
+QT_BEGIN_NAMESPACE
+class QHBoxLayout;
+class QFormLayout;
+class QPushButton;
+QT_END_NAMESPACE
+
+namespace ProjectExplorer {
+class Profile;
-class EmbeddedLinuxTargetFactory;
+namespace Internal {
-class GenericEmbeddedLinuxTarget : public AbstractEmbeddedLinuxTarget
+class ProfileManagerConfigWidget : public ProjectExplorer::ProfileConfigWidget
{
Q_OBJECT
public:
- GenericEmbeddedLinuxTarget(Qt4ProjectManager::Qt4Project *parent, const Core::Id id);
+ ProfileManagerConfigWidget(Profile *p, QWidget *parent = 0);
+
+ QString displayName() const;
+
+ void apply();
+ void discard();
+ bool isDirty() const;
+ void addConfigWidget(ProjectExplorer::ProfileConfigWidget *widget);
+ void makeReadOnly();
- void createApplicationProFiles(bool reparse);
- QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
- Utils::FileName mkspec(const Qt4ProjectManager::Qt4BuildConfiguration *bc) const;
- bool supportsDevice(const QSharedPointer<const ProjectExplorer::IDevice> &device) const;
+private slots:
+ void setIcon();
private:
- friend class EmbeddedLinuxTargetFactory;
+ QFormLayout *m_layout;
+ QPushButton *m_iconButton;
+ QList<ProfileConfigWidget *> m_widgets;
+ Profile *m_profile;
+ QString m_iconPath;
};
} // namespace Internal
-} // namespace RemoteLinux
+} // namespace ProjectExplorer
-#endif // EMBEDDEDLINUXTARGET_H
+#endif // PROFILEMANAGERCONFIGWIDGET_H
diff --git a/src/plugins/projectexplorer/profilemodel.cpp b/src/plugins/projectexplorer/profilemodel.cpp
new file mode 100644
index 0000000000..b4da323a81
--- /dev/null
+++ b/src/plugins/projectexplorer/profilemodel.cpp
@@ -0,0 +1,521 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "profilemodel.h"
+
+#include "profile.h"
+#include "profileconfigwidget.h"
+#include "profilemanager.h"
+
+#include <utils/qtcassert.h>
+
+#include <QApplication>
+#include <QLayout>
+#include <QMessageBox>
+
+namespace ProjectExplorer {
+namespace Internal {
+
+class ProfileNode
+{
+public:
+ explicit ProfileNode(ProfileNode *pn, Profile *p = 0, bool c = false) :
+ parent(pn), profile(p), changed(c)
+ {
+ if (pn)
+ pn->childNodes.append(this);
+ widget = ProfileManager::instance()->createConfigWidget(p);
+ if (widget) {
+ if (p && p->isAutoDetected())
+ widget->makeReadOnly();
+ widget->setVisible(false);
+ }
+ }
+
+ ~ProfileNode()
+ {
+ if (parent)
+ parent->childNodes.removeOne(this);
+
+ // deleting a child removes it from childNodes
+ // so operate on a temporary list
+ QList<ProfileNode *> tmp = childNodes;
+ qDeleteAll(tmp);
+ Q_ASSERT(childNodes.isEmpty());
+ }
+
+ ProfileNode *parent;
+ QString newName;
+ QList<ProfileNode *> childNodes;
+ Profile *profile;
+ ProfileConfigWidget *widget;
+ bool changed;
+};
+
+// --------------------------------------------------------------------------
+// ProfileModel
+// --------------------------------------------------------------------------
+
+ProfileModel::ProfileModel(QBoxLayout *parentLayout, QObject *parent) :
+ QAbstractItemModel(parent),
+ m_parentLayout(parentLayout),
+ m_defaultNode(0)
+{
+ Q_ASSERT(m_parentLayout);
+
+ connect(ProfileManager::instance(), SIGNAL(profileAdded(ProjectExplorer::Profile*)),
+ this, SLOT(addProfile(ProjectExplorer::Profile*)));
+ connect(ProfileManager::instance(), SIGNAL(profileRemoved(ProjectExplorer::Profile*)),
+ this, SLOT(removeProfile(ProjectExplorer::Profile*)));
+ connect(ProfileManager::instance(), SIGNAL(profileUpdated(ProjectExplorer::Profile*)),
+ this, SLOT(updateProfile(ProjectExplorer::Profile*)));
+ connect(ProfileManager::instance(), SIGNAL(defaultProfileChanged()),
+ this, SLOT(changeDefaultProfile()));
+
+ m_root = new ProfileNode(0);
+ m_autoRoot = new ProfileNode(m_root);
+ m_manualRoot = new ProfileNode(m_root);
+
+ foreach (Profile *p, ProfileManager::instance()->profiles())
+ addProfile(p);
+
+ changeDefaultProfile();
+}
+
+ProfileModel::~ProfileModel()
+{
+ delete m_root;
+}
+
+QModelIndex ProfileModel::index(int row, int column, const QModelIndex &parent) const
+{
+ if (!parent.isValid()) {
+ if (row >= 0 && row < m_root->childNodes.count())
+ return createIndex(row, column, m_root->childNodes.at(row));
+ }
+ ProfileNode *node = static_cast<ProfileNode *>(parent.internalPointer());
+ if (row < node->childNodes.count() && column == 0)
+ return createIndex(row, column, node->childNodes.at(row));
+ else
+ return QModelIndex();
+}
+
+QModelIndex ProfileModel::parent(const QModelIndex &idx) const
+{
+ if (!idx.isValid())
+ return QModelIndex();
+ ProfileNode *node = static_cast<ProfileNode *>(idx.internalPointer());
+ if (node->parent == m_root)
+ return QModelIndex();
+ return index(node->parent);
+}
+
+int ProfileModel::rowCount(const QModelIndex &parent) const
+{
+ if (!parent.isValid())
+ return m_root->childNodes.count();
+ ProfileNode *node = static_cast<ProfileNode *>(parent.internalPointer());
+ return node->childNodes.count();
+}
+
+int ProfileModel::columnCount(const QModelIndex &parent) const
+{
+ Q_UNUSED(parent);
+ return 1;
+}
+
+QVariant ProfileModel::data(const QModelIndex &index, int role) const
+{
+ static QIcon warningIcon(":/projectexplorer/images/compile_warning.png");
+
+ if (!index.isValid() || index.column() != 0)
+ return QVariant();
+
+ ProfileNode *node = static_cast<ProfileNode *>(index.internalPointer());
+ QTC_ASSERT(node, return QVariant());
+ if (node == m_autoRoot && role == Qt::DisplayRole)
+ return tr("Auto-detected");
+ if (node == m_manualRoot && role == Qt::DisplayRole)
+ return tr("Manual");
+ if (node->profile) {
+ if (role == Qt::FontRole) {
+ QFont f = QApplication::font();
+ if (node->changed)
+ f.setBold(!f.bold());
+ if (node == m_defaultNode)
+ f.setItalic(f.style() != QFont::StyleItalic);
+ return f;
+ } else if (role == Qt::DisplayRole || role == Qt::EditRole) {
+ QString baseName = node->newName.isEmpty() ? node->profile->displayName() : node->newName;
+ if (node == m_defaultNode)
+ //: Mark up a profile as the default one.
+ baseName = tr("%1 (default)").arg(baseName);
+ return baseName;
+ } else if (role == Qt::DecorationRole) {
+ return node->profile->isValid() ? QIcon() : warningIcon;
+ } else if (role == Qt::ToolTipRole) {
+ return node->profile->toHtml();
+ }
+ }
+ return QVariant();
+}
+
+bool ProfileModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ if (!index.isValid())
+ return false;
+
+ ProfileNode *node = static_cast<ProfileNode *>(index.internalPointer());
+ Q_ASSERT(node);
+ if (index.column() != 0 || !node->profile || role != Qt::EditRole)
+ return false;
+ node->newName = value.toString();
+ if (!node->newName.isEmpty() && node->newName != node->profile->displayName())
+ node->changed = true;
+ return true;
+}
+
+Qt::ItemFlags ProfileModel::flags(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return 0;
+
+ ProfileNode *node = static_cast<ProfileNode *>(index.internalPointer());
+ Q_ASSERT(node);
+ if (!node->profile)
+ return Qt::ItemIsEnabled;
+
+ if (node->profile->isAutoDetected())
+ return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+
+ return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
+}
+
+QVariant ProfileModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ Q_UNUSED(section);
+ if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
+ return tr("Name");
+ return QVariant();
+}
+
+Profile *ProfileModel::profile(const QModelIndex &index)
+{
+ if (!index.isValid())
+ return 0;
+ ProfileNode *node = static_cast<ProfileNode *>(index.internalPointer());
+ Q_ASSERT(node);
+ return node->profile;
+}
+
+QModelIndex ProfileModel::indexOf(Profile *p) const
+{
+ ProfileNode *n = find(p);
+ return n ? index(n) : QModelIndex();
+}
+
+void ProfileModel::setDefaultProfile(const QModelIndex &index)
+{
+ if (!index.isValid())
+ return;
+ ProfileNode *node = static_cast<ProfileNode *>(index.internalPointer());
+ Q_ASSERT(node);
+ if (node->profile)
+ setDefaultNode(node);
+}
+
+bool ProfileModel::isDefaultProfile(const QModelIndex &index)
+{
+ return m_defaultNode == static_cast<ProfileNode *>(index.internalPointer());
+}
+
+ProfileConfigWidget *ProfileModel::widget(const QModelIndex &index)
+{
+ if (!index.isValid())
+ return 0;
+ ProfileNode *node = static_cast<ProfileNode *>(index.internalPointer());
+ Q_ASSERT(node);
+ return node->widget;
+}
+
+bool ProfileModel::isDirty() const
+{
+ foreach (ProfileNode *n, m_manualRoot->childNodes) {
+ if (n->changed)
+ return true;
+ }
+ return false;
+}
+
+bool ProfileModel::isDirty(Profile *p) const
+{
+ ProfileNode *n = find(p);
+ return n ? !n->changed : false;
+}
+
+void ProfileModel::setDirty()
+{
+ ProfileConfigWidget *w = qobject_cast<ProfileConfigWidget *>(sender());
+ foreach (ProfileNode *n, m_manualRoot->childNodes) {
+ if (n->widget == w) {
+ n->changed = true;
+ emit dataChanged(index(n, 0), index(n, columnCount(QModelIndex())));
+ }
+ }
+}
+
+void ProfileModel::apply()
+{
+ // Remove unused profiles:
+ QList<ProfileNode *> nodes = m_toRemoveList;
+ foreach (ProfileNode *n, nodes) {
+ Q_ASSERT(!n->parent);
+ ProfileManager::instance()->deregisterProfile(n->profile);
+ }
+ Q_ASSERT(m_toRemoveList.isEmpty());
+
+ // Update profiles:
+ foreach (ProfileNode *n, m_manualRoot->childNodes) {
+ Q_ASSERT(n);
+ Q_ASSERT(n->profile);
+ if (n->changed) {
+ ProfileManager::instance()->blockSignals(true);
+ if (!n->newName.isEmpty()) {
+ n->profile->setDisplayName(n->newName);
+ n->newName.clear();
+ }
+ if (n->widget)
+ n->widget->apply();
+ n->changed = false;
+
+ ProfileManager::instance()->blockSignals(false);
+ ProfileManager::instance()->notifyAboutUpdate(n->profile);
+ emit dataChanged(index(n, 0), index(n, columnCount(QModelIndex())));
+ }
+ }
+
+ // Add new (and already updated) profiles
+ QStringList removedSts;
+ nodes = m_toAddList;
+ foreach (ProfileNode *n, nodes) {
+ if (!ProfileManager::instance()->registerProfile(n->profile))
+ removedSts << n->profile->displayName();
+ }
+
+ foreach (ProfileNode *n, m_toAddList)
+ markForRemoval(n->profile);
+
+ if (removedSts.count() == 1) {
+ QMessageBox::warning(0,
+ tr("Duplicate profiles detected"),
+ tr("The following profile was already configured:<br>"
+ "&nbsp;%1<br>"
+ "It was not configured again.")
+ .arg(removedSts.at(0)));
+
+ } else if (!removedSts.isEmpty()) {
+ QMessageBox::warning(0,
+ tr("Duplicate profile detected"),
+ tr("The following profiles were already configured:<br>"
+ "&nbsp;%1<br>"
+ "They were not configured again.")
+ .arg(removedSts.join(QLatin1String(",<br>&nbsp;"))));
+ }
+
+ // Set default profile:
+ if (m_defaultNode)
+ ProfileManager::instance()->setDefaultProfile(m_defaultNode->profile);
+}
+
+void ProfileModel::markForRemoval(Profile *p)
+{
+ ProfileNode *node = find(p);
+ if (!node)
+ return;
+
+ beginRemoveRows(index(m_manualRoot), m_manualRoot->childNodes.indexOf(node), m_manualRoot->childNodes.indexOf(node));
+ m_manualRoot->childNodes.removeOne(node);
+ node->parent = 0;
+ if (m_toAddList.contains(node)) {
+ delete node->profile;
+ node->profile = 0;
+ m_toAddList.removeOne(node);
+ delete node;
+ } else {
+ m_toRemoveList.append(node);
+ }
+ endRemoveRows();
+
+ if (node == m_defaultNode) {
+ ProfileNode *newDefault = 0;
+ if (!m_autoRoot->childNodes.isEmpty())
+ newDefault = m_autoRoot->childNodes.at(0);
+ else if (!m_manualRoot->childNodes.isEmpty())
+ newDefault = m_manualRoot->childNodes.at(0);
+ setDefaultNode(newDefault);
+ }
+}
+
+void ProfileModel::markForAddition(Profile *p)
+{
+ int pos = m_manualRoot->childNodes.size();
+ beginInsertRows(index(m_manualRoot), pos, pos);
+
+ ProfileNode *node = createNode(m_manualRoot, p, true);
+ m_toAddList.append(node);
+
+ if (!m_defaultNode)
+ setDefaultNode(node);
+
+ endInsertRows();
+}
+
+QModelIndex ProfileModel::index(ProfileNode *node, int column) const
+{
+ if (node->parent == 0) // is root (or was marked for deletion)
+ return QModelIndex();
+ else if (node->parent == m_root)
+ return index(m_root->childNodes.indexOf(node), column, QModelIndex());
+ else
+ return index(node->parent->childNodes.indexOf(node), column, index(node->parent));
+}
+
+ProfileNode *ProfileModel::find(Profile *p) const
+{
+ foreach (ProfileNode *n, m_autoRoot->childNodes) {
+ if (n->profile == p)
+ return n;
+ }
+ foreach (ProfileNode *n, m_manualRoot->childNodes) {
+ if (n->profile == p)
+ return n;
+ }
+ return 0;
+}
+
+ProfileNode *ProfileModel::createNode(ProfileNode *parent, Profile *p, bool changed)
+{
+ ProfileNode *node = new ProfileNode(parent, p, changed);
+ if (node->widget) {
+ m_parentLayout->addWidget(node->widget);
+ connect(node->widget, SIGNAL(dirty()),
+ this, SLOT(setDirty()));
+ }
+ return node;
+}
+
+void ProfileModel::setDefaultNode(ProfileNode *node)
+{
+ if (m_defaultNode) {
+ QModelIndex idx = index(m_defaultNode);
+ if (idx.isValid())
+ emit dataChanged(idx, idx);
+ }
+ m_defaultNode = node;
+ if (m_defaultNode) {
+ QModelIndex idx = index(m_defaultNode);
+ if (idx.isValid())
+ emit dataChanged(idx, idx);
+ }
+}
+
+void ProfileModel::addProfile(Profile *p)
+{
+ QList<ProfileNode *> nodes = m_toAddList;
+ foreach (ProfileNode *n, nodes) {
+ if (n->profile == p) {
+ m_toAddList.removeOne(n);
+ // do not delete n: Still used elsewhere!
+ return;
+ }
+ }
+
+ ProfileNode *parent = m_manualRoot;
+ if (p->isAutoDetected())
+ parent = m_autoRoot;
+ int row = parent->childNodes.count();
+
+ beginInsertRows(index(parent), row, row);
+ createNode(parent, p, false);
+ endInsertRows();
+
+ emit profileStateChanged();
+}
+
+void ProfileModel::removeProfile(Profile *p)
+{
+ QList<ProfileNode *> nodes = m_toRemoveList;
+ foreach (ProfileNode *n, nodes) {
+ if (n->profile == p) {
+ m_toRemoveList.removeOne(n);
+ delete n;
+ return;
+ }
+ }
+
+ ProfileNode *parent = m_manualRoot;
+ if (p->isAutoDetected())
+ parent = m_autoRoot;
+ int row = 0;
+ ProfileNode *node = 0;
+ foreach (ProfileNode *current, parent->childNodes) {
+ if (current->profile == p) {
+ node = current;
+ break;
+ }
+ ++row;
+ }
+
+ beginRemoveRows(index(parent), row, row);
+ parent->childNodes.removeAt(row);
+ delete node;
+ endRemoveRows();
+
+ emit profileStateChanged();
+}
+
+void ProfileModel::updateProfile(Profile *p)
+{
+ ProfileNode *n = find(p);
+ if (n->widget)
+ n->widget->discard();
+ QModelIndex idx = index(n);
+ emit dataChanged(idx, idx);
+}
+
+void ProfileModel::changeDefaultProfile()
+{
+ setDefaultNode(find(ProfileManager::instance()->defaultProfile()));
+}
+
+} // namespace Internal
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/profilemodel.h b/src/plugins/projectexplorer/profilemodel.h
new file mode 100644
index 0000000000..edd4af0a3b
--- /dev/null
+++ b/src/plugins/projectexplorer/profilemodel.h
@@ -0,0 +1,124 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef PROFILEMODEL_H
+#define PROFILEMODEL_H
+
+#include "projectexplorer_export.h"
+
+#include <QAbstractItemModel>
+
+QT_BEGIN_NAMESPACE
+class QTreeWidgetItem;
+class QBoxLayout;
+QT_END_NAMESPACE
+
+namespace ProjectExplorer {
+
+class Profile;
+class ProfileConfigWidget;
+class ProfileFactory;
+class ProfileManager;
+
+namespace Internal {
+
+class ProfileNode;
+
+// --------------------------------------------------------------------------
+// ProfileModel:
+// --------------------------------------------------------------------------
+
+class ProfileModel : public QAbstractItemModel
+{
+ Q_OBJECT
+
+public:
+ explicit ProfileModel(QBoxLayout *parentLayout, QObject *parent = 0);
+ ~ProfileModel();
+
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex parent(const QModelIndex &index) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
+ Qt::ItemFlags flags(const QModelIndex &index) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+
+ Profile *profile(const QModelIndex &);
+ QModelIndex indexOf(Profile *p) const;
+
+ void setDefaultProfile(const QModelIndex &index);
+ bool isDefaultProfile(const QModelIndex &index);
+
+ ProfileConfigWidget *widget(const QModelIndex &);
+
+ bool isDirty() const;
+ bool isDirty(Profile *p) const;
+
+ void apply();
+
+ void markForRemoval(Profile *p);
+ void markForAddition(Profile *p);
+
+signals:
+ void profileStateChanged();
+
+private slots:
+ void addProfile(ProjectExplorer::Profile *p);
+ void removeProfile(ProjectExplorer::Profile *p);
+ void updateProfile(ProjectExplorer::Profile *p);
+ void changeDefaultProfile();
+ void setDirty();
+
+private:
+ QModelIndex index(ProfileNode *, int column = 0) const;
+ ProfileNode *find(Profile *) const;
+ ProfileNode *createNode(ProfileNode *parent, Profile *p, bool changed);
+ void setDefaultNode(ProfileNode *node);
+
+ ProfileNode *m_root;
+ ProfileNode *m_autoRoot;
+ ProfileNode *m_manualRoot;
+
+ QList<ProfileNode *> m_toAddList;
+ QList<ProfileNode *> m_toRemoveList;
+
+ QBoxLayout *m_parentLayout;
+ ProfileNode *m_defaultNode;
+};
+
+} // namespace Internal
+} // namespace ProjectExplorer
+
+#endif // PROFILEMODEL_H
diff --git a/src/plugins/projectexplorer/profileoptionspage.cpp b/src/plugins/projectexplorer/profileoptionspage.cpp
new file mode 100644
index 0000000000..7cc7d80a89
--- /dev/null
+++ b/src/plugins/projectexplorer/profileoptionspage.cpp
@@ -0,0 +1,253 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "profileoptionspage.h"
+
+#include "profilemodel.h"
+#include "profile.h"
+#include "projectexplorerconstants.h"
+#include "profileconfigwidget.h"
+#include "profilemanager.h"
+
+#include <coreplugin/icore.h>
+
+#include <utils/qtcassert.h>
+
+#include <QHBoxLayout>
+#include <QHeaderView>
+#include <QItemSelectionModel>
+#include <QPushButton>
+#include <QTreeView>
+#include <QVBoxLayout>
+
+namespace ProjectExplorer {
+
+// --------------------------------------------------------------------------
+// ProfileOptionsPage:
+// --------------------------------------------------------------------------
+
+ProfileOptionsPage::ProfileOptionsPage() :
+ m_model(0), m_selectionModel(0), m_currentWidget(0), m_toShow(0)
+{
+ setId(Constants::PROFILE_SETTINGS_PAGE_ID);
+ setDisplayName(tr("Targets"));
+ setCategory(QLatin1String(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY));
+ setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
+ Constants::PROJECTEXPLORER_SETTINGS_TR_CATEGORY));
+ setCategoryIcon(QLatin1String(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY_ICON));
+}
+
+QWidget *ProfileOptionsPage::createPage(QWidget *parent)
+{
+ m_configWidget = new QWidget(parent);
+
+ m_profilesView = new QTreeView(m_configWidget);
+ m_profilesView->setUniformRowHeights(true);
+ m_profilesView->header()->setStretchLastSection(true);
+
+ m_addButton = new QPushButton(tr("Add"), m_configWidget);
+ m_cloneButton = new QPushButton(tr("Clone"), m_configWidget);
+ m_delButton = new QPushButton(tr("Remove"), m_configWidget);
+ m_makeDefaultButton = new QPushButton(tr("Make Default"), m_configWidget);
+
+ QVBoxLayout *buttonLayout = new QVBoxLayout();
+ buttonLayout->setContentsMargins(0, 0, 0, 0);
+ buttonLayout->addWidget(m_addButton);
+ buttonLayout->addWidget(m_cloneButton);
+ buttonLayout->addWidget(m_delButton);
+ buttonLayout->addWidget(m_makeDefaultButton);
+ buttonLayout->addItem(new QSpacerItem(10, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
+
+ QVBoxLayout *verticalLayout = new QVBoxLayout();
+ verticalLayout->addWidget(m_profilesView);
+
+ QHBoxLayout *horizontalLayout = new QHBoxLayout(m_configWidget);
+ horizontalLayout->addLayout(verticalLayout);
+ horizontalLayout->addLayout(buttonLayout);
+
+ Q_ASSERT(!m_model);
+ m_model = new Internal::ProfileModel(verticalLayout);
+ connect(m_model, SIGNAL(profileStateChanged()), this, SLOT(updateState()));
+
+ m_profilesView->setModel(m_model);
+ m_profilesView->header()->setResizeMode(0, QHeaderView::Stretch);
+ m_profilesView->expandAll();
+
+ m_selectionModel = m_profilesView->selectionModel();
+ connect(m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
+ this, SLOT(profileSelectionChanged()));
+ connect(ProfileManager::instance(), SIGNAL(profileAdded(ProjectExplorer::Profile*)),
+ this, SLOT(profileSelectionChanged()));
+ connect(ProfileManager::instance(), SIGNAL(profileRemoved(ProjectExplorer::Profile*)),
+ this, SLOT(profileSelectionChanged()));
+ connect(ProfileManager::instance(), SIGNAL(profileUpdated(ProjectExplorer::Profile*)),
+ this, SLOT(profileSelectionChanged()));
+
+ // Set up add menu:
+ connect(m_addButton, SIGNAL(clicked()), this, SLOT(addNewProfile()));
+ connect(m_cloneButton, SIGNAL(clicked()), this, SLOT(cloneProfile()));
+ connect(m_delButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
+ connect(m_makeDefaultButton, SIGNAL(clicked()), this, SLOT(makeDefaultProfile()));
+
+ m_searchKeywords = tr("Profiles");
+
+ updateState();
+
+ if (m_toShow)
+ m_selectionModel->select(m_model->indexOf(m_toShow),
+ QItemSelectionModel::Clear
+ | QItemSelectionModel::SelectCurrent
+ | QItemSelectionModel::Rows);
+ m_toShow = 0;
+
+ return m_configWidget;
+}
+
+void ProfileOptionsPage::apply()
+{
+ if (m_model)
+ m_model->apply();
+}
+
+void ProfileOptionsPage::finish()
+{
+ if (m_model) {
+ delete m_model;
+ m_model = 0;
+ }
+
+ m_configWidget = 0; // deleted by settingsdialog
+ m_selectionModel = 0; // child of m_configWidget
+ m_profilesView = 0; // child of m_configWidget
+ m_currentWidget = 0; // deleted by the model
+ m_toShow = 0;
+}
+
+bool ProfileOptionsPage::matches(const QString &s) const
+{
+ return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+}
+
+void ProfileOptionsPage::showProfile(Profile *p)
+{
+ m_toShow = p;
+}
+
+void ProfileOptionsPage::profileSelectionChanged()
+{
+ if (m_currentWidget)
+ m_currentWidget->setVisible(false);
+
+ QModelIndex current = currentIndex();
+ m_currentWidget = current.isValid() ? m_model->widget(current) : 0;
+
+ if (m_currentWidget)
+ m_currentWidget->setVisible(true);
+ updateState();
+}
+
+void ProfileOptionsPage::addNewProfile()
+{
+ Profile *p = new Profile;
+ m_model->markForAddition(p);
+
+ QModelIndex newIdx = m_model->indexOf(p);
+ m_selectionModel->select(newIdx,
+ QItemSelectionModel::Clear
+ | QItemSelectionModel::SelectCurrent
+ | QItemSelectionModel::Rows);
+}
+
+void ProfileOptionsPage::cloneProfile()
+{
+ Profile *clone = m_model->profile(currentIndex());
+ if (!clone)
+ return;
+
+ Profile *p = new Profile(*clone);
+
+ m_model->markForAddition(p);
+
+ QModelIndex newIdx = m_model->indexOf(p);
+ m_selectionModel->select(newIdx,
+ QItemSelectionModel::Clear
+ | QItemSelectionModel::SelectCurrent
+ | QItemSelectionModel::Rows);
+}
+
+void ProfileOptionsPage::removeProfile()
+{
+ Profile *p = m_model->profile(currentIndex());
+ if (!p)
+ return;
+ m_model->markForRemoval(p);
+}
+
+void ProfileOptionsPage::makeDefaultProfile()
+{
+ m_model->setDefaultProfile(currentIndex());
+ updateState();
+}
+
+void ProfileOptionsPage::updateState()
+{
+ if (!m_profilesView)
+ return;
+
+ bool canCopy = false;
+ bool canDelete = false;
+ bool canMakeDefault = false;
+ QModelIndex index = currentIndex();
+ Profile *p = m_model->profile(index);
+ if (p) {
+ canCopy = p->isValid();
+ canDelete = !p->isAutoDetected();
+ canMakeDefault = !m_model->isDefaultProfile(index);
+ }
+
+ m_cloneButton->setEnabled(canCopy);
+ m_delButton->setEnabled(canDelete);
+ m_makeDefaultButton->setEnabled(canMakeDefault);
+}
+
+QModelIndex ProfileOptionsPage::currentIndex() const
+{
+ if (!m_selectionModel)
+ return QModelIndex();
+
+ QModelIndexList idxs = m_selectionModel->selectedRows();
+ if (idxs.count() != 1)
+ return QModelIndex();
+ return idxs.at(0);
+}
+
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/profileoptionspage.h b/src/plugins/projectexplorer/profileoptionspage.h
new file mode 100644
index 0000000000..ec60543cc4
--- /dev/null
+++ b/src/plugins/projectexplorer/profileoptionspage.h
@@ -0,0 +1,104 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef PROFILEOPTIONSPAGE_H
+#define PROFILEOPTIONSPAGE_H
+
+#include "projectexplorer_export.h"
+
+#include <coreplugin/dialogs/ioptionspage.h>
+
+#include <QModelIndex>
+
+QT_BEGIN_NAMESPACE
+class QItemSelectionModel;
+class QTreeView;
+class QPushButton;
+QT_END_NAMESPACE
+
+namespace ProjectExplorer {
+
+namespace Internal { class ProfileModel; }
+
+class Profile;
+class ProfileConfigWidget;
+class ProfileFactory;
+class ProfileManager;
+
+// --------------------------------------------------------------------------
+// ProfileOptionsPage:
+// --------------------------------------------------------------------------
+
+class PROJECTEXPLORER_EXPORT ProfileOptionsPage : public Core::IOptionsPage
+{
+ Q_OBJECT
+
+public:
+ ProfileOptionsPage();
+
+ QWidget *createPage(QWidget *parent);
+ void apply();
+ void finish();
+ bool matches(const QString &) const;
+
+ void showProfile(Profile *p);
+
+private slots:
+ void profileSelectionChanged();
+ void addNewProfile();
+ void cloneProfile();
+ void removeProfile();
+ void makeDefaultProfile();
+ void updateState();
+
+private:
+ QModelIndex currentIndex() const;
+
+ QTreeView *m_profilesView;
+ QPushButton *m_addButton;
+ QPushButton *m_cloneButton;
+ QPushButton *m_delButton;
+ QPushButton *m_makeDefaultButton;
+
+ QWidget *m_configWidget;
+ QString m_searchKeywords;
+
+ Internal::ProfileModel *m_model;
+ QItemSelectionModel *m_selectionModel;
+ ProfileConfigWidget *m_currentWidget;
+
+ Profile *m_toShow;
+};
+
+} // namespace ProjectExplorer
+
+#endif // PROFILEOPTIONSPAGE_H
diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index 2f7641ec83..c2ef837aa4 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -32,11 +32,14 @@
#include "project.h"
+#include "buildconfiguration.h"
+#include "deployconfiguration.h"
#include "editorconfiguration.h"
#include "environment.h"
#include "projectexplorer.h"
#include "projectexplorerconstants.h"
#include "projectnodes.h"
+#include "runconfiguration.h"
#include "target.h"
#include "settingsaccessor.h"
@@ -44,6 +47,8 @@
#include <coreplugin/icontext.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/buildmanager.h>
+#include <projectexplorer/profile.h>
+#include <projectexplorer/profilemanager.h>
#include <limits>
#include <utils/qtcassert.h>
@@ -112,7 +117,7 @@ Project::~Project()
bool Project::hasActiveBuildSettings() const
{
- return activeTarget() && activeTarget()->buildConfigurationFactory();
+ return activeTarget() && IBuildConfigurationFactory::find(activeTarget());
}
QString Project::makeUnique(const QString &preferredName, const QStringList &usedNames)
@@ -143,7 +148,7 @@ void Project::changeBuildConfigurationEnabled()
void Project::addTarget(Target *t)
{
QTC_ASSERT(t && !d->m_targets.contains(t), return);
- QTC_ASSERT(!target(t->id()), return);
+ QTC_ASSERT(!target(t->profile()), return);
Q_ASSERT(t->project() == this);
// Check that we don't have a configuration with the same displayName
@@ -160,6 +165,10 @@ void Project::addTarget(Target *t)
SLOT(changeEnvironment()));
connect(t, SIGNAL(buildConfigurationEnabledChanged()),
this, SLOT(changeBuildConfigurationEnabled()));
+ connect(t, SIGNAL(requestBuildSystemEvaluation()),
+ this, SLOT(triggerBuildSystemEvaluation()));
+ connect(t, SIGNAL(buildDirectoryChanged()),
+ this, SLOT(onBuildDirectoryChanged()));
emit addedTarget(t);
// check activeTarget:
@@ -216,7 +225,7 @@ void Project::setActiveTarget(Target *target)
}
}
-Target *Project::target(Core::Id id) const
+Target *Project::target(const Core::Id id) const
{
foreach (Target * target, d->m_targets) {
if (target->id() == id)
@@ -225,6 +234,55 @@ Target *Project::target(Core::Id id) const
return 0;
}
+Target *Project::target(Profile *p) const
+{
+ foreach (Target *target, d->m_targets) {
+ if (target->profile() == p)
+ return target;
+ }
+ return 0;
+}
+
+bool Project::supportsProfile(Profile *p) const
+{
+ Q_UNUSED(p);
+ return true;
+}
+
+Target *Project::createTarget(Profile *p)
+{
+ if (target(p))
+ return 0;
+
+ Target *t = new Target(this, p);
+ t->createDefaultSetup();
+
+ return t;
+}
+
+Target *Project::restoreTarget(const QVariantMap &data)
+{
+ Core::Id id = idFromMap(data);
+ if (target(id)) {
+ qWarning("Warning: Duplicated target id found, not restoring second target with id '%s'. Continuing.",
+ qPrintable(id.toString()));
+ return 0;
+ }
+
+ Profile *p = ProfileManager::instance()->find(id);
+ if (!p) {
+ qWarning("Warning: No profile '%s' found. Continuing.", qPrintable(id.toString()));
+ return 0;
+ }
+
+ Target *t = new Target(this, p);
+ if (!t->fromMap(data)) {
+ delete t;
+ return 0;
+ }
+ return t;
+}
+
void Project::saveSettings()
{
emit aboutToSaveSettings();
@@ -314,32 +372,15 @@ bool Project::fromMap(const QVariantMap &map)
}
QVariantMap targetMap = map.value(key).toMap();
- QList<ITargetFactory *> factories =
- ExtensionSystem::PluginManager::getObjects<ITargetFactory>();
-
- Target *t = 0;
+ Target *t = restoreTarget(targetMap);
+ if (!t)
+ continue;
- Core::Id id = idFromMap(targetMap);
- if (target(id)) {
- qWarning("Warning: Duplicated target id found, not restoring second target with id '%s'. Continuing.",
- qPrintable(id.toString()));
- } else {
- foreach (ITargetFactory *factory, factories) {
- if (factory->canRestore(this, targetMap)) {
- t = factory->restore(this, targetMap);
- break;
- }
- }
-
- if (!t) {
- qWarning("Warning: Unable to restore target '%s'. Continuing.", qPrintable(id.toString()));
- continue;
- }
- addTarget(t);
- if (i == active)
- setActiveTarget(t);
- }
+ addTarget(t);
+ if (i == active)
+ setActiveTarget(t);
}
+
return true;
}
@@ -363,6 +404,9 @@ void Project::setProjectLanguage(Core::Context language)
d->m_projectLanguage = language;
}
+void Project::evaluateBuildSystem()
+{ buildSystemEvaluationFinished(true); }
+
Core::Context Project::projectContext() const
{
return d->m_projectContext;
@@ -380,7 +424,10 @@ QVariant Project::namedSettings(const QString &name) const
void Project::setNamedSettings(const QString &name, QVariant &value)
{
- d->m_pluginSettings.insert(name, value);
+ if (value.isNull())
+ d->m_pluginSettings.remove(name);
+ else
+ d->m_pluginSettings.insert(name, value);
}
bool Project::needsConfiguration() const
@@ -393,4 +440,39 @@ void Project::configureAsExampleProject(const QStringList &platforms)
Q_UNUSED(platforms);
}
+void Project::triggerBuildSystemEvaluation()
+{
+ Target *target = qobject_cast<Target *>(sender());
+ if (target && target != activeTarget())
+ return;
+
+ evaluateBuildSystem();
+}
+
+void Project::buildSystemEvaluationFinished(bool success)
+{
+ if (!success)
+ return;
+
+ // Create new run configurations:
+ foreach (Target *t, targets())
+ t->updateDefaultRunConfigurations();
+
+ emit buildSystemEvaluated();
+}
+
+void Project::onBuildDirectoryInitialized()
+{
+ Target *target = qobject_cast<Target *>(sender());
+ if (target && target == activeTarget())
+ emit buildDirectoryInitialized();
+}
+
+void Project::onBuildDirectoryChanged()
+{
+ Target *target = qobject_cast<Target *>(sender());
+ if (target && target == activeTarget())
+ emit buildDirectoryChanged();
+}
+
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h
index 49d0aec07b..20a5f58038 100644
--- a/src/plugins/projectexplorer/project.h
+++ b/src/plugins/projectexplorer/project.h
@@ -52,6 +52,7 @@ class BuildConfigWidget;
class IProjectManager;
class EditorConfiguration;
class ProjectNode;
+class Profile;
class Target;
class ProjectPrivate;
@@ -89,7 +90,12 @@ public:
// Note: activeTarget can be 0 (if no targets are defined).
Target *activeTarget() const;
void setActiveTarget(Target *target);
- Target *target(Core::Id id) const;
+ Target *target(const Core::Id id) const;
+ Target *target(Profile *p) const;
+ virtual bool supportsProfile(Profile *p) const;
+
+ Target *createTarget(Profile *p);
+ Target *restoreTarget(const QVariantMap &data);
void saveSettings();
bool restoreSettings();
@@ -120,6 +126,12 @@ public:
virtual bool needsConfiguration() const;
virtual void configureAsExampleProject(const QStringList &platforms);
+public slots:
+ void triggerBuildSystemEvaluation();
+
+protected slots:
+ void buildSystemEvaluationFinished(bool success);
+
signals:
void displayNameChanged();
void fileListChanged();
@@ -133,6 +145,11 @@ signals:
void environmentChanged();
void buildConfigurationEnabledChanged();
+ // The build directory of the current target/build configuration was successfully
+ // initialized (or configured).
+ void buildDirectoryInitialized();
+ void buildDirectoryChanged();
+ void buildSystemEvaluated();
void settingsLoaded();
void aboutToSaveSettings();
@@ -143,9 +160,18 @@ protected:
virtual void setProjectContext(Core::Context context);
virtual void setProjectLanguage(Core::Context language);
+ // Implement this to (re-)evaluate the build system of the project.
+ //
+ // This method is triggered by one of its active children (active*Configuration
+ // of the activeTarget) whenever some settings that has influence on the build
+ // system parsing is changed.
+ virtual void evaluateBuildSystem();
+
private slots:
void changeEnvironment();
void changeBuildConfigurationEnabled();
+ void onBuildDirectoryInitialized();
+ void onBuildDirectoryChanged();
private:
ProjectPrivate *d;
diff --git a/src/plugins/projectexplorer/projectconfiguration.cpp b/src/plugins/projectexplorer/projectconfiguration.cpp
index 78b3a05a25..bdb4718db7 100644
--- a/src/plugins/projectexplorer/projectconfiguration.cpp
+++ b/src/plugins/projectexplorer/projectconfiguration.cpp
@@ -41,7 +41,7 @@ const char DEFAULT_DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.De
ProjectConfiguration::ProjectConfiguration(QObject *parent, const Core::Id &id) :
QObject(parent),
m_id(id)
-{ }
+{ setObjectName(id.toString()); }
ProjectConfiguration::ProjectConfiguration(QObject *parent, const ProjectConfiguration *source) :
QObject(parent),
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 8d9ed394b4..dbc0fd66cb 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -37,6 +37,8 @@
#include "gcctoolchainfactories.h"
#include "project.h"
#include "projectexplorersettings.h"
+#include "profilemanager.h"
+#include "profileoptionspage.h"
#include "target.h"
#include "targetsettingspanel.h"
#include "toolchainmanager.h"
@@ -63,6 +65,7 @@
#include "processstep.h"
#include "projectexplorerconstants.h"
#include "customwizard.h"
+#include "profileinformation.h"
#include "projectfilewizardextension.h"
#include "projecttreewidget.h"
#include "projectwindow.h"
@@ -247,6 +250,8 @@ struct ProjectExplorerPluginPrivate {
Core::IMode *m_projectsMode;
TaskHub *m_taskHub;
+ ProfileManager *m_profileManager;
+ ToolChainManager *m_toolChainManager;
bool m_shuttingDown;
};
@@ -256,6 +261,8 @@ ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
m_delayedRunConfiguration(0),
m_runMode(NoRunMode),
m_projectsMode(0),
+ m_profileManager(0),
+ m_toolChainManager(0),
m_shuttingDown(false)
{
}
@@ -295,6 +302,10 @@ ProjectExplorerPlugin::~ProjectExplorerPlugin()
removeObject(d->m_welcomePage);
delete d->m_welcomePage;
removeObject(this);
+ // Force sequence of deletion:
+ delete d->m_profileManager; // remove all the profile informations
+ delete d->m_toolChainManager;
+
delete d;
}
@@ -334,8 +345,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
addAutoReleasedObject(new Internal::DesktopDeviceFactory);
- new ToolChainManager(this);
+ d->m_profileManager = new ProfileManager; // register before ToolChainManager
+ d->m_toolChainManager = new ToolChainManager;
addAutoReleasedObject(new Internal::ToolChainOptionsPage);
+ addAutoReleasedObject(new ProfileOptionsPage);
d->m_taskHub = new TaskHub;
addAutoReleasedObject(d->m_taskHub);
@@ -1095,15 +1108,17 @@ void ProjectExplorerPlugin::extensionsInitialized()
addAutoReleasedObject(pf);
}
d->m_buildManager->extensionsInitialized();
-}
-bool ProjectExplorerPlugin::delayedInitialize()
-{
+ // Register ProfileInformation:
+ // Only do this now to make sure all device factories were properly initialized.
+ ProfileManager::instance()->registerProfileInformation(new SysRootProfileInformation);
+ ProfileManager::instance()->registerProfileInformation(new DeviceProfileInformation);
+ ProfileManager::instance()->registerProfileInformation(new DeviceTypeProfileInformation);
+ ProfileManager::instance()->registerProfileInformation(new ToolChainProfileInformation);
+
DeviceManager *dm = DeviceManager::instance();
if (dm->find(Core::Id(Constants::DESKTOP_DEVICE_ID)).isNull())
DeviceManager::instance()->addDevice(IDevice::Ptr(new DesktopDevice));
-
- return true;
}
void ProjectExplorerPlugin::loadCustomWizards()
@@ -2623,6 +2638,9 @@ void ProjectExplorerPlugin::addExistingFiles(const QStringList &filePaths)
void ProjectExplorerPlugin::addExistingFiles(ProjectNode *projectNode, const QStringList &filePaths)
{
+ if (!projectNode) // can happen when project is not yet parsed
+ return;
+
const QString dir = directoryFor(projectNode);
QStringList fileNames = filePaths;
QHash<FileType, QString> fileTypeToFiles;
diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h
index 489db72b59..2037050f8d 100644
--- a/src/plugins/projectexplorer/projectexplorer.h
+++ b/src/plugins/projectexplorer/projectexplorer.h
@@ -105,7 +105,6 @@ public:
//PluginInterface
bool initialize(const QStringList &arguments, QString *errorMessage);
void extensionsInitialized();
- bool delayedInitialize();
ShutdownFlag aboutToShutdown();
void setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes);
diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro
index a9b64a52b8..9f8c632f53 100644
--- a/src/plugins/projectexplorer/projectexplorer.pro
+++ b/src/plugins/projectexplorer/projectexplorer.pro
@@ -20,6 +20,14 @@ HEADERS += projectexplorer.h \
gcctoolchain.h \
projectexplorer_export.h \
projectwindow.h \
+ profile.h \
+ profileconfigwidget.h \
+ profileinformation.h \
+ profileinformationconfigwidget.h \
+ profilemanager.h \
+ profilemanagerconfigwidget.h \
+ profilemodel.h \
+ profileoptionspage.h \
buildmanager.h \
buildsteplist.h \
compileoutputwindow.h \
@@ -122,6 +130,13 @@ SOURCES += projectexplorer.cpp \
clangparser.cpp \
gcctoolchain.cpp \
projectwindow.cpp \
+ profile.cpp \
+ profileinformation.cpp \
+ profileinformationconfigwidget.cpp \
+ profilemanager.cpp \
+ profilemanagerconfigwidget.cpp \
+ profilemodel.cpp \
+ profileoptionspage.cpp \
buildmanager.cpp \
buildsteplist.cpp \
compileoutputwindow.cpp \
@@ -209,7 +224,6 @@ SOURCES += projectexplorer.cpp \
devicesupport/devicesettingspage.cpp
FORMS += processstep.ui \
- toolchainoptionspage.ui \
editorsettingspropertiespage.ui \
sessiondialog.ui \
projectwizardpage.ui \
diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs
index a59814d774..f5684dc478 100644
--- a/src/plugins/projectexplorer/projectexplorer.qbs
+++ b/src/plugins/projectexplorer/projectexplorer.qbs
@@ -108,6 +108,21 @@ QtcPlugin {
"processparameters.h",
"processstep.cpp",
"processstep.h",
+ "profile.cpp",
+ "profile.h",
+ "profileconfigwidget.h",
+ "profileinformation.cpp",
+ "profileinformation.h",
+ "profileinformationconfigwidget.cpp",
+ "profileinformationconfigwidget.h",
+ "profilemanager.cpp",
+ "profilemanager.h",
+ "profilemanagerconfigwidget.cpp",
+ "profilemanagerconfigwidget.h",
+ "profilemodel.cpp",
+ "profilemodel.h",
+ "profileoptionspage.cpp",
+ "profileoptionspage.h",
"project.cpp",
"project.h",
"projectconfiguration.cpp",
@@ -158,7 +173,6 @@ QtcPlugin {
"toolchainconfigwidget.h",
"toolchainmanager.h",
"toolchainoptionspage.h",
- "toolchainoptionspage.ui",
"vcsannotatetaskhandler.h",
"environmentitemswidget.h",
"abi.cpp",
diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h
index 04fcd6cf17..f7d984a515 100644
--- a/src/plugins/projectexplorer/projectexplorerconstants.h
+++ b/src/plugins/projectexplorer/projectexplorerconstants.h
@@ -182,6 +182,7 @@ const char PROJECTEXPLORER_SETTINGS_TR_CATEGORY[] = QT_TRANSLATE_NOOP("ProjectEx
const char PROJECTEXPLORER_SETTINGS_CATEGORY_ICON[] = ":/core/images/category_buildrun.png";
const char PROJECTEXPLORER_SETTINGS_ID[] = "A.ProjectExplorer.ProjectExplorer";
const char TOOLCHAIN_SETTINGS_PAGE_ID[] = "M.ProjectExplorer.ToolChainOptions";
+const char PROFILE_SETTINGS_PAGE_ID[] = "D.ProjectExplorer.ProfileOptions";
// Device settings page
const char DEVICE_SETTINGS_CATEGORY[] = "X.Devices";
diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp
index 9707b49e13..1ef5d92720 100644
--- a/src/plugins/projectexplorer/projectwindow.cpp
+++ b/src/plugins/projectexplorer/projectwindow.cpp
@@ -34,6 +34,7 @@
#include "doubletabwidget.h"
+#include "profilemanager.h"
#include "project.h"
#include "projectexplorer.h"
#include "projectexplorerconstants.h"
@@ -128,7 +129,7 @@ PanelsWidget::PanelsWidget(QWidget *parent) :
// side of the screen.
m_root->setFixedWidth(900);
m_root->setContentsMargins(0, 0, 40, 0);
-
+
QPalette pal = m_root->palette();
QColor background = Utils::StyleHelper::mergedColors(
palette().window().color(), Qt::white, 85);
@@ -262,9 +263,7 @@ ProjectWindow::~ProjectWindow()
void ProjectWindow::extensionsInitialized()
{
- foreach (ITargetFactory *fac, ExtensionSystem::PluginManager::getObjects<ITargetFactory>())
- connect(fac, SIGNAL(canCreateTargetIdsChanged()),
- this, SLOT(targetFactoriesChanged()));
+ connect(ProfileManager::instance(), SIGNAL(profilesChanged()), this, SLOT(handleProfilesChanges()));
QList<IProjectPanelFactory *> list = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
qSort(list.begin(), list.end(), &IPanelFactory::prioritySort);
@@ -286,7 +285,7 @@ void ProjectWindow::projectUpdated(Project *p)
m_tabWidget->setCurrentIndex(index);
}
-void ProjectWindow::targetFactoriesChanged()
+void ProjectWindow::handleProfilesChanges()
{
bool changed = false;
int index = m_tabWidget->currentIndex();
@@ -309,13 +308,12 @@ bool ProjectWindow::useTargetPage(ProjectExplorer::Project *project)
if (project->targets().size() > 1)
return true;
int count = 0;
- foreach (ITargetFactory *fac, ExtensionSystem::PluginManager::getObjects<ITargetFactory>()) {
- foreach (Core::Id targetId, fac->supportedTargetIds()) {
- if (fac->canCreate(project, targetId))
- ++count;
- if (count > 1)
- return true;
- }
+ QList<Profile *> profiles = ProfileManager::instance()->profiles();
+ foreach (Profile *p, profiles) {
+ if (project->supportsProfile(p))
+ ++count;
+ if (count > 1)
+ return true;
}
return false;
}
diff --git a/src/plugins/projectexplorer/projectwindow.h b/src/plugins/projectexplorer/projectwindow.h
index 1a15fad6af..5a5ec3385b 100644
--- a/src/plugins/projectexplorer/projectwindow.h
+++ b/src/plugins/projectexplorer/projectwindow.h
@@ -87,7 +87,7 @@ public slots:
void projectUpdated(ProjectExplorer::Project *p);
private slots:
- void targetFactoriesChanged();
+ void handleProfilesChanges();
void showProperties(int index, int subIndex);
void registerProject(ProjectExplorer::Project*);
void deregisterProject(ProjectExplorer::Project*);
diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp
index d445dcb1ec..d4cada4b63 100644
--- a/src/plugins/projectexplorer/runconfiguration.cpp
+++ b/src/plugins/projectexplorer/runconfiguration.cpp
@@ -38,6 +38,7 @@
#include "abi.h"
#include "buildconfiguration.h"
#include "projectexplorerconstants.h"
+#include "profileinformation.h"
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
@@ -66,91 +67,6 @@ const char USE_QML_DEBUGGER_AUTO_KEY[] = "RunConfiguration.UseQmlDebuggerAuto";
const char QML_DEBUG_SERVER_PORT_KEY[] = "RunConfiguration.QmlDebugServerPort";
const char USE_MULTIPROCESS_KEY[] = "RunConfiguration.UseMultiProcess";
-// Function objects:
-
-class RunConfigurationFactoryMatcher
-{
-public:
- RunConfigurationFactoryMatcher(Target * target) : m_target(target)
- { }
-
- virtual ~RunConfigurationFactoryMatcher() { }
-
- virtual bool operator()(IRunConfigurationFactory *) const = 0;
-
- Target *target() const
- {
- return m_target;
- }
-
-private:
- Target *m_target;
-};
-
-class CreateMatcher : public RunConfigurationFactoryMatcher
-{
-public:
- CreateMatcher(Target *target, const Core::Id id) :
- RunConfigurationFactoryMatcher(target),
- m_id(id)
- { }
-
- bool operator()(IRunConfigurationFactory *factory) const
- {
- return factory->canCreate(target(), m_id);
- }
-
-private:
- const Core::Id m_id;
-};
-
-class CloneMatcher : public RunConfigurationFactoryMatcher
-{
-public:
- CloneMatcher(Target *target, RunConfiguration *source) :
- RunConfigurationFactoryMatcher(target),
- m_source(source)
- { }
-
- bool operator()(IRunConfigurationFactory *factory) const
- {
- return factory->canClone(target(), m_source);
- }
-
-private:
- RunConfiguration *m_source;
-};
-
-class RestoreMatcher : public RunConfigurationFactoryMatcher
-{
-public:
- RestoreMatcher(Target *target, const QVariantMap &map) :
- RunConfigurationFactoryMatcher(target),
- m_map(map)
- { }
-
- bool operator()(IRunConfigurationFactory *factory) const
- {
- return factory->canRestore(target(), m_map);
- }
-
-private:
- QVariantMap m_map;
-};
-
-// Helper methods:
-
-IRunConfigurationFactory *findRunConfigurationFactory(RunConfigurationFactoryMatcher &matcher)
-{
- QList<IRunConfigurationFactory *> factories
- = ExtensionSystem::PluginManager::getObjects<IRunConfigurationFactory>();
- foreach (IRunConfigurationFactory *factory, factories) {
- if (matcher(factory))
- return factory;
- }
- return 0;
-}
-
} // namespace
/*!
@@ -404,6 +320,11 @@ QString RunConfiguration::disabledReason() const
return QString();
}
+bool RunConfiguration::isConfigured() const
+{
+ return true;
+}
+
/*!
\fn virtual QWidget *ProjectExplorer::RunConfiguration::createConfigurationWidget()
@@ -439,7 +360,7 @@ ProjectExplorer::Abi RunConfiguration::abi() const
BuildConfiguration *bc = target()->activeBuildConfiguration();
if (!bc)
return Abi::hostAbi();
- ToolChain *tc = bc->toolChain();
+ ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
if (!tc)
return Abi::hostAbi();
return tc->targetAbi();
@@ -516,22 +437,27 @@ IRunConfigurationFactory::~IRunConfigurationFactory()
{
}
-IRunConfigurationFactory *IRunConfigurationFactory::createFactory(Target *parent, const Core::Id id)
+IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, const QVariantMap &map)
{
- CreateMatcher matcher(parent, id);
- return findRunConfigurationFactory(matcher);
-}
-
-IRunConfigurationFactory *IRunConfigurationFactory::cloneFactory(Target *parent, RunConfiguration *source)
-{
- CloneMatcher matcher(parent, source);
- return findRunConfigurationFactory(matcher);
+ QList<IRunConfigurationFactory *> factories
+ = ExtensionSystem::PluginManager::instance()->getObjects<IRunConfigurationFactory>();
+ foreach (IRunConfigurationFactory *factory, factories) {
+ if (factory->canRestore(parent, map))
+ return factory;
+ }
+ return 0;
}
-IRunConfigurationFactory *IRunConfigurationFactory::restoreFactory(Target *parent, const QVariantMap &map)
+QList<IRunConfigurationFactory *> IRunConfigurationFactory::find(Target *parent)
{
- RestoreMatcher matcher(parent, map);
- return findRunConfigurationFactory(matcher);
+ QList<IRunConfigurationFactory *> factories
+ = ExtensionSystem::PluginManager::instance()->getObjects<IRunConfigurationFactory>();
+ QList<IRunConfigurationFactory *> result;
+ foreach (IRunConfigurationFactory *factory, factories) {
+ if (!factory->availableCreationIds(parent).isEmpty())
+ result << factory;
+ }
+ return result;
}
/*!
diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h
index 78a523e4b9..4d145370b7 100644
--- a/src/plugins/projectexplorer/runconfiguration.h
+++ b/src/plugins/projectexplorer/runconfiguration.h
@@ -147,18 +147,19 @@ class PROJECTEXPLORER_EXPORT RunConfiguration : public ProjectConfiguration
Q_OBJECT
public:
- virtual ~RunConfiguration();
+ ~RunConfiguration();
virtual bool isEnabled() const;
virtual QString disabledReason() const;
virtual QWidget *createConfigurationWidget() = 0;
+ virtual bool isConfigured() const;
Target *target() const;
virtual Utils::OutputFormatter *createOutputFormatter() const;
- virtual bool fromMap(const QVariantMap &map);
- virtual QVariantMap toMap() const;
+ bool fromMap(const QVariantMap &map);
+ QVariantMap toMap() const;
DebuggerRunConfigurationAspect *debuggerAspect() const { return m_debuggerAspect; }
@@ -212,9 +213,8 @@ public:
virtual bool canClone(Target *parent, RunConfiguration *product) const = 0;
virtual RunConfiguration *clone(Target *parent, RunConfiguration *product) = 0;
- static IRunConfigurationFactory *createFactory(Target *parent, const Core::Id id);
- static IRunConfigurationFactory *cloneFactory(Target *parent, RunConfiguration *source);
- static IRunConfigurationFactory *restoreFactory(Target *parent, const QVariantMap &map);
+ static IRunConfigurationFactory *find(Target *parent, const QVariantMap &map);
+ static QList<IRunConfigurationFactory *> find(Target *parent);
signals:
void availableCreationIdsChanged();
diff --git a/src/plugins/projectexplorer/runconfigurationmodel.cpp b/src/plugins/projectexplorer/runconfigurationmodel.cpp
index 66fc77ec7d..e047451d72 100644
--- a/src/plugins/projectexplorer/runconfigurationmodel.cpp
+++ b/src/plugins/projectexplorer/runconfigurationmodel.cpp
@@ -182,6 +182,9 @@ void RunConfigurationModel::addedRunConfiguration(ProjectExplorer::RunConfigurat
void RunConfigurationModel::removedRunConfiguration(ProjectExplorer::RunConfiguration *rc)
{
int i = m_runConfigurations.indexOf(rc);
+ if (i < 0)
+ return;
+
beginRemoveRows(QModelIndex(), i, i);
m_runConfigurations.removeAt(i);
endRemoveRows();
diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp
index d0497bfcbf..b9c7b8b4c3 100644
--- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp
@@ -292,6 +292,7 @@ void RunSettingsWidget::addRunConfiguration()
RunConfiguration *newRC = fai.factory->create(m_target, fai.id);
if (!newRC)
return;
+ QTC_CHECK(newRC->id() == fai.id);
m_target->addRunConfiguration(newRC);
m_target->setActiveRunConfiguration(newRC);
m_removeRunToolButton->setEnabled(m_target->runConfigurations().size() > 1);
@@ -370,9 +371,12 @@ void RunSettingsWidget::currentDeployConfigurationChanged(int index)
void RunSettingsWidget::aboutToShowDeployMenu()
{
m_addDeployMenu->clear();
- QList<Core::Id> ids = m_target->availableDeployConfigurationIds();
+ DeployConfigurationFactory *factory = DeployConfigurationFactory::find(m_target);
+ if (!factory)
+ return;
+ QList<Core::Id> ids = factory->availableCreationIds(m_target);
foreach (Core::Id id, ids) {
- QAction *action = m_addDeployMenu->addAction(m_target->displayNameForDeployConfigurationId(id));
+ QAction *action = m_addDeployMenu->addAction(factory->displayNameForId(id));
action->setData(QVariant::fromValue(id));
connect(action, SIGNAL(triggered()),
this, SLOT(addDeployConfiguration()));
@@ -385,9 +389,18 @@ void RunSettingsWidget::addDeployConfiguration()
if (!act)
return;
Core::Id id = act->data().value<Core::Id>();
- DeployConfiguration *newDc = m_target->createDeployConfiguration(id);
+ DeployConfigurationFactory *factory = DeployConfigurationFactory::find(m_target);
+ if (!factory)
+ return;
+ DeployConfiguration *newDc = 0;
+ foreach (Core::Id id, factory->availableCreationIds(m_target)) {
+ if (!factory->canCreate(m_target, id))
+ continue;
+ newDc = factory->create(m_target, id);
+ }
if (!newDc)
return;
+ QTC_CHECK(!newDc || newDc->id() == id);
m_target->addDeployConfiguration(newDc);
m_target->setActiveDeployConfiguration(newDc);
m_removeDeployToolButton->setEnabled(m_target->deployConfigurations().size() > 1);
diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp
index d19eadf5f8..f3330fbdde 100644
--- a/src/plugins/projectexplorer/settingsaccessor.cpp
+++ b/src/plugins/projectexplorer/settingsaccessor.cpp
@@ -38,9 +38,12 @@
#include "projectexplorersettings.h"
#include "projectexplorerconstants.h"
#include "target.h"
+#include "profile.h"
+#include "profilemanager.h"
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
+#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/persistentsettings.h>
@@ -341,6 +344,52 @@ public:
QVariantMap update(Project *project, const QVariantMap &map);
};
+// Version 10 introduces disabling buildsteps, and handles upgrading custom process steps
+class Version11Handler : public UserFileVersionHandler
+{
+public:
+ Version11Handler();
+ ~Version11Handler();
+
+ int userFileVersion() const
+ {
+ return 11;
+ }
+
+ QString displayUserFileVersion() const
+ {
+ return QLatin1String("2.6pre1");
+ }
+
+ QVariantMap update(Project *project, const QVariantMap &map);
+
+private:
+ void addBuildConfiguration(const QString &origTarget, Profile *p,
+ bool targetActive,
+ const QVariantMap &bc, bool bcActive);
+ void addOtherConfiguration(const QString &origTarget,
+ const QList<QVariantMap> &dcs, int activeDc,
+ const QList<QVariantMap> &rcs, int activeRc);
+
+ void parseQtversionFile();
+ void parseToolChainFile();
+
+ class ToolChainExtraData {
+ public:
+ explicit ToolChainExtraData(const QString &mks = QString(), const QString &d = QString()) :
+ m_mkspec(mks), m_debugger(d)
+ { }
+
+ QString m_mkspec;
+ QString m_debugger;
+ };
+
+ QHash<QString, ToolChainExtraData> m_toolChainExtras;
+ QHash<int, QString> m_qtVersionExtras;
+
+ QHash<Profile *, QVariantMap> m_targets;
+};
+
} // namespace
//
@@ -429,6 +478,7 @@ SettingsAccessor::SettingsAccessor() :
addVersionHandler(new Version8Handler);
addVersionHandler(new Version9Handler);
addVersionHandler(new Version10Handler);
+ addVersionHandler(new Version11Handler);
}
SettingsAccessor::~SettingsAccessor()
@@ -2277,3 +2327,287 @@ QVariantMap Version10Handler::update(Project *project, const QVariantMap &map)
QLatin1String("ProjectExplorer.BuildStep.Enabled")));
return renameKeys(changes, QVariantMap(map));
}
+
+Version11Handler::Version11Handler()
+{
+ parseQtversionFile();
+ parseToolChainFile();
+}
+
+Version11Handler::~Version11Handler()
+{
+ ProfileManager *pm = ProfileManager::instance();
+ if (!pm) // Can happen during teardown!
+ return;
+ QList<Profile *> knownProfiles = pm->profiles();
+ foreach (Profile *p, m_targets.keys()) {
+ if (!knownProfiles.contains(p))
+ delete p;
+ }
+ m_targets.clear();
+}
+
+QVariantMap Version11Handler::update(Project *project, const QVariantMap &map)
+{
+ Q_UNUSED(project);
+ QVariantMap result;
+ ProfileManager *pm = ProfileManager::instance();
+
+ foreach (Profile *p, pm->profiles())
+ m_targets.insert(p, QVariantMap());
+
+ QMapIterator<QString, QVariant> globalIt(map);
+ int activeTarget = map.value(QLatin1String("ProjectExplorer.Project.ActiveTarget"), 0).toInt();
+
+ while (globalIt.hasNext()) {
+ globalIt.next();
+ const QString &globalKey = globalIt.key();
+ // Keep everything but targets:
+ if (!globalKey.startsWith(QLatin1String("ProjectExplorer.Project.Target."))) {
+ result.insert(globalKey, globalIt.value());
+ continue;
+ }
+
+ // Update Targets:
+ const QVariantMap &target = globalIt.value().toMap();
+ int targetPos = globalKey.mid(globalKey.lastIndexOf(QLatin1Char('.'))).toInt();
+
+ QVariantMap extraTargetData;
+ QList<QVariantMap> bcs;
+ int activeBc = -1;
+ QList<QVariantMap> dcs;
+ int activeDc = -1;
+ QList<QVariantMap> rcs;
+ int activeRc = -1;
+
+ // Read old target:
+ QMapIterator<QString, QVariant> targetIt(target);
+ while (targetIt.hasNext()) {
+ targetIt.next();
+ const QString &targetKey = targetIt.key();
+ QList<QVariantMap> newTargets;
+ // BuildConfigurations:
+ if (targetKey == QLatin1String("ProjectExplorer.Target.ActiveBuildConfiguration"))
+ activeBc = targetIt.value().toInt();
+ else if (targetKey == QLatin1String("ProjectExplorer.Target.BuildConfigurationCount"))
+ continue;
+ else if (targetKey.startsWith(QLatin1String("ProjectExplorer.Target.BuildConfiguration.")))
+ bcs.append(targetIt.value().toMap());
+ else
+
+ // DeployConfigurations:
+ if (targetKey == QLatin1String("ProjectExplorer.Target.ActiveDeployConfiguration"))
+ activeDc = targetIt.value().toInt();
+ else if (targetKey == QLatin1String("ProjectExplorer.Target.DeployConfigurationCount"))
+ continue;
+ else if (targetKey.startsWith(QLatin1String("ProjectExplorer.Target.DeployConfiguration.")))
+ dcs.append(targetIt.value().toMap());
+ else
+
+ // RunConfigurations:
+ if (targetKey == QLatin1String("ProjectExplorer.Target.ActiveRunConfiguration"))
+ activeRc = targetIt.value().toInt();
+ else if (targetKey == QLatin1String("ProjectExplorer.Target.RunConfigurationCount"))
+ continue;
+ else if (targetKey.startsWith(QLatin1String("ProjectExplorer.Target.RunConfiguration.")))
+ rcs.append(targetIt.value().toMap());
+
+ // Rest (the target's ProjectConfiguration QList<QVariantMap> newTargets; related settings only as there is nothing else)
+ else
+ extraTargetData.insert(targetKey, targetIt.value());
+ }
+
+ const QString targetId = extraTargetData.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id")).toString();
+ // Check each BCs/DCs and create profiles as needed
+ int bcPos = 0;
+ foreach (const QVariantMap &bc, bcs) {
+ const QString targetId = extraTargetData.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id")).toString();
+ Profile *tmp = new Profile;
+ tmp->setDisplayName(extraTargetData.value(QLatin1String("ProjectExplorer.ProjectConfiguration.DisplayName")).toString());
+
+ if (targetId == QLatin1String("Qt4ProjectManager.Target.AndroidDeviceTarget"))
+ tmp->setIconPath(QLatin1String(":/android/images/QtAndroid.png"));
+ else if (targetId == QLatin1String("Qt4ProjectManager.Target.HarmattanDeviceTarget"))
+ tmp->setIconPath(QLatin1String(":/projectexplorer/images/MaemoDevice.png"));
+ else if (targetId == QLatin1String("Qt4ProjectManager.Target.MaemoDeviceTarget"))
+ tmp->setIconPath(QLatin1String(":/projectexplorer/images/MaemoDevice.png"));
+ else if (targetId == QLatin1String("Qt4ProjectManager.Target.MeegoDeviceTarget"))
+ tmp->setIconPath(QLatin1String(":/projectexplorer/images/MaemoDevice.png"));
+ else if (targetId == QLatin1String("Qt4ProjectManager.Target.S60DeviceTarget"))
+ tmp->setIconPath(QLatin1String(":/projectexplorer/images/SymbianDevice.png"));
+ else if (targetId == QLatin1String("Qt4ProjectManager.Target.QtSimulatorTarget"))
+ tmp->setIconPath(QLatin1String(":/projectexplorer/images/SymbianEmulator.png"));
+ // use default desktop icon
+
+ // Tool chain
+ QString tcId = bc.value(QLatin1String("CMakeProjectManager.CMakeBuildConfiguration.ToolChain")).toString();
+ if (tcId.isEmpty())
+ tcId = bc.value(QLatin1String("ProjectExplorer.BuildCOnfiguration.ToolChain")).toString();
+ tmp->setValue(Core::Id("PE.Profile.ToolChain"), tcId);
+
+ // QtVersion
+ int qtVersionId = bc.value(QLatin1String("Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId"), -1).toInt();
+ tmp->setValue(Core::Id("QtSupport.QtInformation"), qtVersionId);
+
+ // Debugger + mkspec
+ if (m_toolChainExtras.contains(tcId)) {
+ tmp->setValue(Core::Id("Debugger.Information"), m_toolChainExtras.value(tcId).m_debugger);
+ tmp->setValue(Core::Id("QtPM4.mkSpecInformation"), m_toolChainExtras.value(tcId).m_mkspec);
+ }
+
+ // SysRoot
+ if (m_qtVersionExtras.contains(qtVersionId))
+ tmp->setValue(Core::Id("PE.Profile.SysRoot"), m_qtVersionExtras.value(qtVersionId));
+
+ // Device
+ if (dcs.isEmpty()) {
+ QByteArray devId;
+ if (targetId == QLatin1String("Qt4ProjectManager.Target.S60DeviceTarget"))
+ devId = QByteArray("Symbian Device");
+ else
+ devId = QByteArray("Desktop Device");
+
+ tmp->setValue(Core::Id("PE.Profile.Device"), devId);
+ } else {
+ foreach (const QVariantMap &dc, dcs) {
+ QByteArray devId = dc.value(QLatin1String("Qt4ProjectManager.MaemoRunConfiguration.DeviceId")).toString().toUtf8();
+ if (devId.isEmpty())
+ devId = QByteArray("Desktop Device");
+ tmp->setValue(Core::Id("PE.Profile.Device"), devId);
+ } // dcs
+ }
+
+ addBuildConfiguration(targetId, tmp, activeTarget == targetPos, bc, bcPos == activeBc);
+
+ ++bcPos;
+ } // bcs
+
+ addOtherConfiguration(targetId, dcs, activeDc, rcs, activeRc);
+ }
+
+ int newPos = 0;
+ QList<Profile *> knownProfiles = pm->profiles();
+ // Generate new target data:
+ foreach (Profile *p, m_targets.keys()) {
+ QVariantMap data = m_targets.value(p);
+ if (data.isEmpty())
+ continue;
+
+ if (!knownProfiles.contains(p))
+ pm->registerProfile(p);
+
+ data.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"), p->id().name());
+ data.insert(QLatin1String("ProjectExplorer.Target.Profile"), p->id().name());
+ data.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.DisplayName"), p->displayName());
+ data.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.DefaultDisplayName"), p->displayName());
+
+ result.insert(QString::fromLatin1("ProjectExplorer.Project.Target.") + QString::number(newPos), data);
+ if (data.value(QLatin1String("IsActive"), false).toBool())
+ result.insert(QLatin1String("ProjectExplorer.Project.ActiveTarget"), newPos);
+ ++newPos;
+ }
+ result.insert(QLatin1String("ProjectExplorer.Project.TargetCount"), newPos);
+
+ return result;
+}
+
+void Version11Handler::addBuildConfiguration(const QString &origTarget, Profile *p, bool targetActive,
+ const QVariantMap &bc, bool bcActive)
+{
+ foreach (Profile *i, m_targets.keys()) {
+ if (*i == *p) {
+ delete p;
+ p = i;
+ }
+ }
+ QVariantMap merged = m_targets.value(p);
+
+ int bcCount = merged.value(QLatin1String("ProjectExplorer.Target.BuildConfigurationCount"), 0).toInt();
+ merged.insert(QString::fromLatin1("ProjectExplorer.Target.BuildConfiguration.") + QString::number(bcCount), bc);
+ if (bcActive)
+ merged.insert(QLatin1String("ProjectExplorer.Target.ActiveBuildConfiguration"), bcCount);
+ merged.insert(QLatin1String("ProjectExplorer.Target.BuildConfigurationCount"), bcCount + 1);
+
+ if (targetActive && bcActive)
+ merged.insert(QLatin1String("Update.IsActive"), true);
+ merged.insert(QLatin1String("Update.OriginalTarget"), origTarget);
+
+ m_targets.insert(p, merged);
+}
+
+void Version11Handler::addOtherConfiguration(const QString &origTarget, const QList<QVariantMap> &dcs, int activeDc, const QList<QVariantMap> &rcs, int activeRc)
+{
+ foreach (Profile *tmp, m_targets.keys()) {
+ QVariantMap data = m_targets.value(tmp);
+ if (data.isEmpty())
+ continue;
+ const QString dataTarget = data.value(QLatin1String("Update.OriginalTarget")).toString();
+ if (dataTarget != origTarget)
+ continue;
+
+ int dcCount = dcs.count();
+ data.insert(QLatin1String("ProjectExplorer.Target.DeployConfigurationCount"), dcCount);
+ for (int i = 0; i < dcCount; ++i)
+ data.insert(QString::fromLatin1("ProjectExplorer.Target.DeployConfiguration.") + QString::number(i), dcs.at(i));
+ data.insert(QLatin1String("ProjectExplorer.Target.ActiveDeployConfiguration"), activeDc);
+
+ int rcCount = rcs.count();
+ data.insert(QLatin1String("ProjectExplorer.Target.RunConfigurationCount"), rcCount);
+ for (int i = 0; i < rcCount; ++i)
+ data.insert(QString::fromLatin1("ProjectExplorer.Target.RunConfiguration.") + QString::number(i), rcs.at(i));
+ data.insert(QLatin1String("ProjectExplorer.Target.ActiveRunConfiguration"), activeRc);
+
+ m_targets.insert(tmp, data);
+ }
+}
+
+void Version11Handler::parseQtversionFile()
+{
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ QFileInfo settingsLocation(pm->settings()->fileName());
+ QString fileName = settingsLocation.absolutePath() + QLatin1String("/qtversion.xml");
+ Utils::PersistentSettingsReader reader;
+ if (!reader.load(fileName))
+ return;
+ QVariantMap data = reader.restoreValues();
+
+ int count = data.value(QLatin1String("QtVersion.Count"), 0).toInt();
+ for (int i = 0; i < count; ++i) {
+ const QString key = QString::fromLatin1("QtVersion.") + QString::number(i);
+ if (!data.contains(key))
+ continue;
+
+ const QVariantMap qtversionMap = data.value(key).toMap();
+ QString sysRoot = qtversionMap.value(QLatin1String("SystemRoot")).toString();
+ int id = qtversionMap.value(QLatin1String("Id")).toInt();
+ if (id > -1 && !sysRoot.isEmpty())
+ m_qtVersionExtras.insert(id, sysRoot);
+ }
+}
+
+void Version11Handler::parseToolChainFile()
+{
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ QFileInfo settingsLocation(pm->settings()->fileName());
+ QString fileName = settingsLocation.absolutePath() + QLatin1String("/toolChains.xml");
+ Utils::PersistentSettingsReader reader;
+ if (!reader.load(fileName))
+ return;
+ QVariantMap data = reader.restoreValues();
+ int count = data.value(QLatin1String("ToolChain.Count"), 0).toInt();
+ for (int i = 0; i < count; ++i) {
+ const QString key = QString::fromLatin1("ToolChain.") + QString::number(i);
+ if (!data.contains(key))
+ continue;
+
+ const QVariantMap tcMap = data.value(key).toMap();
+ QString id = tcMap.value(QLatin1String("ProjectExplorer.ToolChain.Id")).toString();
+ if (id.isEmpty())
+ continue;
+ QString mkspec = tcMap.value(QLatin1String("ProjectExplorer.ToolChain.MkSpecOverride")).toString();
+ QString debugger = tcMap.value(QLatin1String("ProjectExplorer.GccToolChain.Debugger")).toString();
+
+ m_toolChainExtras.insert(id, ToolChainExtraData(mkspec, debugger));
+ }
+}
+
diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp
index a3a86af7a1..a35c37aca7 100644
--- a/src/plugins/projectexplorer/target.cpp
+++ b/src/plugins/projectexplorer/target.cpp
@@ -32,13 +32,14 @@
#include "target.h"
-#include "toolchain.h"
+#include "profile.h"
+#include "profileinformation.h"
+#include "profilemanager.h"
#include "buildconfiguration.h"
#include "deployconfiguration.h"
#include "project.h"
#include "projectexplorerconstants.h"
#include "runconfiguration.h"
-#include "toolchainmanager.h"
#include <limits>
#include <coreplugin/coreconstants.h>
@@ -48,6 +49,7 @@
#include <projectexplorer/projectexplorer.h>
#include <utils/qtcassert.h>
+#include <QDebug>
#include <QIcon>
#include <QPainter>
@@ -94,6 +96,8 @@ public:
QPixmap m_connectedPixmap;
QPixmap m_readyToUsePixmap;
QPixmap m_disconnectedPixmap;
+
+ Profile *m_profile;
};
TargetPrivate::TargetPrivate() :
@@ -103,7 +107,8 @@ TargetPrivate::TargetPrivate() :
m_activeRunConfiguration(0),
m_connectedPixmap(QLatin1String(":/projectexplorer/images/DeviceConnected.png")),
m_readyToUsePixmap(QLatin1String(":/projectexplorer/images/DeviceReadyToUse.png")),
- m_disconnectedPixmap(QLatin1String(":/projectexplorer/images/DeviceDisconnected.png"))
+ m_disconnectedPixmap(QLatin1String(":/projectexplorer/images/DeviceDisconnected.png")),
+ m_profile(0)
{
}
@@ -113,16 +118,28 @@ QList<DeployConfigurationFactory *> TargetPrivate::deployFactories() const
}
-Target::Target(Project *project, const Core::Id id) :
- ProjectConfiguration(project, id),
+Target::Target(Project *project, Profile *p) :
+ ProjectConfiguration(project, p->id()),
d(new TargetPrivate)
{
connect(DeviceManager::instance(), SIGNAL(updated()), this, SLOT(updateDeviceState()));
+
+ d->m_profile = p;
+
+ setDisplayName(d->m_profile->displayName());
+ setIcon(d->m_profile->icon());
+
+ ProfileManager *pm = ProfileManager::instance();
+ connect(pm, SIGNAL(profileUpdated(ProjectExplorer::Profile*)),
+ this, SLOT(handleProfileUpdates(ProjectExplorer::Profile*)));
+ connect(pm, SIGNAL(profileRemoved(ProjectExplorer::Profile*)),
+ this, SLOT(handleProfileRemoval(ProjectExplorer::Profile*)));
}
Target::~Target()
{
qDeleteAll(d->m_buildConfigurations);
+ qDeleteAll(d->m_deployConfigurations);
qDeleteAll(d->m_runConfigurations);
delete d;
}
@@ -155,19 +172,47 @@ void Target::changeRunConfigurationEnabled()
emit runConfigurationEnabledChanged();
}
+void Target::onBuildDirectoryChanged()
+{
+ BuildConfiguration *bc = qobject_cast<BuildConfiguration *>(sender());
+ if (bc)
+ emit buildDirectoryChanged();
+}
+
+void Target::handleProfileUpdates(Profile *p)
+{
+ if (p != d->m_profile)
+ return;
+
+ setDisplayName(p->displayName());
+ setIcon(p->icon());
+ updateDefaultDeployConfigurations();
+ emit profileChanged();
+}
+
+void Target::handleProfileRemoval(Profile *p)
+{
+ if (p != d->m_profile)
+ return;
+ d->m_profile = 0;
+ project()->removeTarget(this);
+}
+
Project *Target::project() const
{
return static_cast<Project *>(parent());
}
+Profile *Target::profile() const
+{
+ return d->m_profile;
+}
+
void Target::addBuildConfiguration(BuildConfiguration *configuration)
{
QTC_ASSERT(configuration && !d->m_buildConfigurations.contains(configuration), return);
Q_ASSERT(configuration->target() == this);
- if (!buildConfigurationFactory())
- return;
-
// Check that we don't have a configuration with the same displayName
QString configurationDisplayName = configuration->displayName();
QStringList displayNames;
@@ -175,18 +220,12 @@ void Target::addBuildConfiguration(BuildConfiguration *configuration)
displayNames << bc->displayName();
configurationDisplayName = Project::makeUnique(configurationDisplayName, displayNames);
if (configurationDisplayName != configuration->displayName()) {
- if (configuration->usesDefaultDisplayName()) {
+ if (configuration->usesDefaultDisplayName())
configuration->setDefaultDisplayName(configurationDisplayName);
- } else {
+ else
configuration->setDisplayName(configurationDisplayName);
- }
}
- // Make sure we have a sane tool chain if at all possible
- if (!configuration->toolChain()
- || !possibleToolChains(configuration).contains(configuration->toolChain()))
- configuration->setToolChain(preferredToolChain(configuration));
-
// add it
d->m_buildConfigurations.push_back(configuration);
@@ -194,9 +233,11 @@ void Target::addBuildConfiguration(BuildConfiguration *configuration)
connect(configuration, SIGNAL(environmentChanged()),
SLOT(changeEnvironment()));
-
connect(configuration, SIGNAL(enabledChanged()),
this, SLOT(changeBuildConfigurationEnabled()));
+ connect(configuration, SIGNAL(requestBuildSystemEvaluation()),
+ this, SLOT(onRequestBuildSystemEvaluation()));
+
if (!activeBuildConfiguration())
setActiveBuildConfiguration(configuration);
@@ -247,6 +288,8 @@ void Target::setActiveBuildConfiguration(BuildConfiguration *configuration)
emit activeBuildConfigurationChanged(d->m_activeBuildConfiguration);
emit environmentChanged();
emit buildConfigurationEnabledChanged();
+ emit buildDirectoryChanged();
+ emit requestBuildSystemEvaluation();
}
}
@@ -270,6 +313,7 @@ void Target::addDeployConfiguration(DeployConfiguration *dc)
d->m_deployConfigurations.push_back(dc);
connect(dc, SIGNAL(enabledChanged()), this, SLOT(changeDeployConfigurationEnabled()));
+ connect(dc, SIGNAL(requestBuildSystemEvaluation()), this, SLOT(onRequestBuildSystemEvaluation()));
emit addedDeployConfiguration(dc);
@@ -322,36 +366,11 @@ void Target::setActiveDeployConfiguration(DeployConfiguration *dc)
d->m_activeDeployConfiguration = dc;
emit activeDeployConfigurationChanged(d->m_activeDeployConfiguration);
emit deployConfigurationEnabledChanged();
+ emit requestBuildSystemEvaluation();
}
updateDeviceState();
}
-QList<Core::Id> Target::availableDeployConfigurationIds()
-{
- QList<Core::Id> ids;
- foreach (const DeployConfigurationFactory * const factory, d->deployFactories())
- ids << factory->availableCreationIds(this);
- return ids;
-}
-
-QString Target::displayNameForDeployConfigurationId(Core::Id &id)
-{
- foreach (const DeployConfigurationFactory * const factory, d->deployFactories()) {
- if (factory->availableCreationIds(this).contains(id))
- return factory->displayNameForId(id);
- }
- return QString();
-}
-
-DeployConfiguration *Target::createDeployConfiguration(Core::Id id)
-{
- foreach (DeployConfigurationFactory * const factory, d->deployFactories()) {
- if (factory->canCreate(this, id))
- return factory->create(this, id);
- }
- return 0;
-}
-
QList<RunConfiguration *> Target::runConfigurations() const
{
return d->m_runConfigurations;
@@ -410,6 +429,7 @@ void Target::setActiveRunConfiguration(RunConfiguration* configuration)
d->m_activeRunConfiguration = configuration;
emit activeRunConfigurationChanged(d->m_activeRunConfiguration);
emit runConfigurationEnabledChanged();
+ emit requestBuildSystemEvaluation();
}
updateDeviceState();
}
@@ -452,31 +472,14 @@ void Target::setToolTip(const QString &text)
emit toolTipChanged();
}
-QList<ToolChain *> Target::possibleToolChains(BuildConfiguration *) const
-{
- QList<ToolChain *> tcList = ToolChainManager::instance()->toolChains();
- QList<ToolChain *> result;
- foreach (ToolChain *tc, tcList) {
- QList<Core::Id> restricted = tc->restrictedToTargets();
- if (restricted.isEmpty() || restricted.contains(id()))
- result.append(tc);
- }
- return result;
-}
-
-ToolChain *Target::preferredToolChain(BuildConfiguration *bc) const
-{
- QList<ToolChain *> tcs = possibleToolChains(bc);
- if (tcs.isEmpty())
- return 0;
- return tcs.at(0);
-}
-
QVariantMap Target::toMap() const
{
- const QList<BuildConfiguration *> bcs = buildConfigurations();
+ if (!d->m_profile) // Profile was deleted, target is only around to be copied.
+ return QVariantMap();
QVariantMap map(ProjectConfiguration::toMap());
+
+ const QList<BuildConfiguration *> bcs = buildConfigurations();
map.insert(QLatin1String(ACTIVE_BC_KEY), bcs.indexOf(d->m_activeBuildConfiguration));
map.insert(QLatin1String(BC_COUNT_KEY), bcs.size());
for (int i = 0; i < bcs.size(); ++i)
@@ -497,6 +500,153 @@ QVariantMap Target::toMap() const
return map;
}
+void Target::createDefaultSetup()
+{
+ updateDefaultBuildConfigurations();
+ updateDefaultDeployConfigurations();
+ updateDefaultRunConfigurations();
+}
+
+void Target::updateDefaultBuildConfigurations()
+{
+ IBuildConfigurationFactory *bcFactory = IBuildConfigurationFactory::find(this);
+ if (!bcFactory) {
+ qWarning("No build configuration factory found for target id '%s'.", qPrintable(id().toString()));
+ return;
+ }
+ QList<Core::Id> bcIds = bcFactory->availableCreationIds(this);
+ foreach (Core::Id id, bcIds) {
+ if (!bcFactory->canCreate(this, id))
+ continue;
+ BuildConfiguration *bc = bcFactory->create(this, id, tr("Default build"));
+ if (!bc)
+ continue;
+ QTC_CHECK(bc->id() == id);
+ addBuildConfiguration(bc);
+ }
+}
+
+void Target::updateDefaultDeployConfigurations()
+{
+ DeployConfigurationFactory *dcFactory = DeployConfigurationFactory::find(this);
+ if (!dcFactory) {
+ qWarning("No deployment configuration factory found for target id '%s'.", qPrintable(id().toString()));
+ return;
+ }
+ QList<Core::Id> dcIds = dcFactory->availableCreationIds(this);
+ QList<DeployConfiguration *> dcList = deployConfigurations();
+
+ foreach (DeployConfiguration *dc, dcList) {
+ if (dcIds.contains(dc->id()))
+ dcIds.removeOne(dc->id());
+ else
+ removeDeployConfiguration(dc);
+ }
+
+ foreach (Core::Id id, dcIds) {
+ if (!dcFactory->canCreate(this, id))
+ continue;
+ DeployConfiguration *dc = dcFactory->create(this, id);
+ if (dc) {
+ QTC_CHECK(dc->id() == id);
+ addDeployConfiguration(dc);
+ }
+ }
+}
+
+void Target::updateDefaultRunConfigurations()
+{
+ QList<IRunConfigurationFactory *> rcFactories = IRunConfigurationFactory::find(this);
+ if (rcFactories.isEmpty()) {
+ qWarning("No run configuration factory found for target id '%s'.", qPrintable(id().toString()));
+ return;
+ }
+
+ QList<RunConfiguration *> existingConfigured; // Existing configured RCs
+ QList<RunConfiguration *> existingUnconfigured; // Existing unconfigured RCs
+ QList<RunConfiguration *> newConfigured; // NEW configured Rcs
+ QList<RunConfiguration *> newUnconfigured; // NEW unconfigured RCs
+
+
+ // sort existing RCs into configured/unconfigured.
+ foreach (RunConfiguration *rc, runConfigurations()) {
+ if (rc->isConfigured())
+ existingConfigured << rc;
+ else
+ existingUnconfigured << rc;
+ }
+ int configuredCount = existingConfigured.count();
+
+ // find all RC ids that can get created:
+ QList<Core::Id> factoryIds;
+ foreach (IRunConfigurationFactory *rcFactory, rcFactories)
+ factoryIds.append(rcFactory->availableCreationIds(this));
+
+ // Put outdated RCs into toRemove, do not bother with factories
+ // that produce already existing RCs
+ QList<RunConfiguration *> toRemove;
+ foreach (RunConfiguration *rc, existingConfigured) {
+ if (factoryIds.contains(rc->id()))
+ factoryIds.removeOne(rc->id()); // Already there
+ else
+ toRemove << rc;
+ }
+ configuredCount -= toRemove.count();
+
+ // Create new RCs and put them into newConfigured/newUnconfigured
+ foreach (Core::Id id, factoryIds) {
+ IRunConfigurationFactory *factory = 0;
+ foreach (IRunConfigurationFactory *i, rcFactories) {
+ if (i->canCreate(this, id)) {
+ factory = i;
+ break;
+ }
+ }
+ if (!factory)
+ continue;
+
+ RunConfiguration *rc = factory->create(this, id);
+ if (!rc)
+ continue;
+ QTC_CHECK(rc->id() == id);
+ if (!rc->isConfigured())
+ newUnconfigured << rc;
+ else
+ newConfigured << rc;
+ }
+ configuredCount += newConfigured.count();
+
+ // Decide what to do with the different categories:
+ bool removeExistingUnconfigured = false;
+ if (configuredCount > 0) {
+ // new non-Custom Executable RCs were added
+ removeExistingUnconfigured = true;
+ qDeleteAll(newUnconfigured);
+ newUnconfigured.clear();
+ } else {
+ // no new RCs, use old or new CERCs?
+ if (!existingUnconfigured.isEmpty()) {
+ qDeleteAll(newUnconfigured);
+ newUnconfigured.clear();
+ }
+ }
+
+ // Do actual changes:
+ foreach (RunConfiguration *rc, toRemove)
+ removeRunConfiguration(rc);
+
+ if (removeExistingUnconfigured) {
+ foreach (RunConfiguration *rc, existingUnconfigured)
+ removeRunConfiguration(rc);
+ existingUnconfigured.clear();
+ }
+
+ foreach (RunConfiguration *rc, newConfigured)
+ addRunConfiguration(rc);
+ foreach (RunConfiguration *rc, newUnconfigured)
+ addRunConfiguration(rc);
+}
+
static QString formatToolTip(const IDevice::DeviceInfo &input)
{
QStringList lines;
@@ -507,7 +657,7 @@ static QString formatToolTip(const IDevice::DeviceInfo &input)
void Target::updateDeviceState()
{
- IDevice::ConstPtr current = currentDevice();
+ IDevice::ConstPtr current = DeviceProfileInformation::device(profile());
QPixmap overlay;
if (current.isNull()) {
@@ -547,11 +697,6 @@ void Target::updateDeviceState()
setToolTip(current.isNull() ? QString() : formatToolTip(current->deviceInformation()));
}
-ProjectExplorer::IDevice::ConstPtr Target::currentDevice() const
-{
- return DeviceManager::instance()->find(ProjectExplorer::Constants::DESKTOP_DEVICE_ID);
-}
-
void Target::setEnabled(bool enabled)
{
if (enabled == d->m_isEnabled)
@@ -566,6 +711,10 @@ bool Target::fromMap(const QVariantMap &map)
if (!ProjectConfiguration::fromMap(map))
return false;
+ d->m_profile = ProfileManager::instance()->find(id());
+ if (!d->m_profile)
+ return false;
+
bool ok;
int bcCount = map.value(QLatin1String(BC_COUNT_KEY), 0).toInt(&ok);
if (!ok || bcCount < 0)
@@ -580,14 +729,23 @@ bool Target::fromMap(const QVariantMap &map)
const QString key = QString::fromLatin1(BC_KEY_PREFIX) + QString::number(i);
if (!map.contains(key))
return false;
- BuildConfiguration *bc = buildConfigurationFactory()->restore(this, map.value(key).toMap());
- if (!bc)
+ const QVariantMap valueMap = map.value(key).toMap();
+ IBuildConfigurationFactory *factory = IBuildConfigurationFactory::find(this, valueMap);
+ if (!factory) {
+ qWarning("No factory found to restore build configuration!");
+ continue;
+ }
+ BuildConfiguration *bc = factory->restore(this, valueMap);
+ if (!bc) {
+ qWarning("Failed '%s' to restore build configuration!", qPrintable(factory->objectName()));
continue;
+ }
+ QTC_CHECK(bc->id() == ProjectExplorer::idFromMap(valueMap));
addBuildConfiguration(bc);
if (i == activeConfiguration)
setActiveBuildConfiguration(bc);
}
- if (buildConfigurations().isEmpty() && buildConfigurationFactory())
+ if (buildConfigurations().isEmpty() && IBuildConfigurationFactory::find(this))
return false;
int dcCount = map.value(QLatin1String(DC_COUNT_KEY), 0).toInt(&ok);
@@ -603,16 +761,18 @@ bool Target::fromMap(const QVariantMap &map)
const QString key = QString::fromLatin1(DC_KEY_PREFIX) + QString::number(i);
if (!map.contains(key))
return false;
- DeployConfiguration *dc = 0;
- foreach (DeployConfigurationFactory * const factory, d->deployFactories()) {
- QVariantMap valueMap = map.value(key).toMap();
- if (factory->canRestore(this, valueMap)) {
- dc = factory->restore(this, valueMap);
- break;
- }
+ QVariantMap valueMap = map.value(key).toMap();
+ DeployConfigurationFactory *factory = DeployConfigurationFactory::find(this, valueMap);
+ if (!factory) {
+ qWarning("No factory found to restore deployment configuration!");
+ continue;
}
- if (!dc)
+ DeployConfiguration *dc = factory->restore(this, valueMap);
+ if (!dc) {
+ qWarning("Factory '%s' failed to restore deployment configuration!", qPrintable(factory->objectName()));
continue;
+ }
+ QTC_CHECK(dc->id() == ProjectExplorer::idFromMap(valueMap));
addDeployConfiguration(dc);
if (i == activeConfiguration)
setActiveDeployConfiguration(dc);
@@ -632,32 +792,40 @@ bool Target::fromMap(const QVariantMap &map)
if (!map.contains(key))
return false;
+ // Ignore missing RCs: We will just populate them using the default ones.
QVariantMap valueMap = map.value(key).toMap();
- IRunConfigurationFactory *factory = IRunConfigurationFactory::restoreFactory(this, valueMap);
- if (!factory)
- continue; // Skip RCs we do not know about.)
-
+ IRunConfigurationFactory *factory = IRunConfigurationFactory::find(this, valueMap);
+ if (!factory || !factory->canRestore(this, valueMap))
+ continue;
RunConfiguration *rc = factory->restore(this, valueMap);
if (!rc)
continue;
+ QTC_CHECK(rc->id() == ProjectExplorer::idFromMap(valueMap));
addRunConfiguration(rc);
if (i == activeConfiguration)
setActiveRunConfiguration(rc);
}
- // Ignore missing RCs: We will just populate them using the default ones.
return true;
}
-// -------------------------------------------------------------------------
-// ITargetFactory
-// -------------------------------------------------------------------------
+void Target::onRequestBuildSystemEvaluation()
+{
+ ProjectConfiguration *config = qobject_cast<ProjectConfiguration *>(sender());
+ if (!config)
+ return;
+ if (config == static_cast<ProjectConfiguration *>(activeBuildConfiguration())
+ || config == static_cast<ProjectConfiguration *>(activeDeployConfiguration()))
+ emit requestBuildSystemEvaluation();
+}
-ITargetFactory::ITargetFactory(QObject *parent) :
- QObject(parent)
+void Target::onBuildDirectoryInitialized()
{
- connect(ToolChainManager::instance(), SIGNAL(toolChainsChanged()),
- this, SIGNAL(canCreateTargetIdsChanged()));
+ BuildConfiguration *bc = qobject_cast<BuildConfiguration *>(sender());
+ if (!bc)
+ return;
+ if (bc == activeBuildConfiguration())
+ emit buildDirectoryInitialized();
}
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/target.h b/src/plugins/projectexplorer/target.h
index 1b05c9c07b..69e4fb4459 100644
--- a/src/plugins/projectexplorer/target.h
+++ b/src/plugins/projectexplorer/target.h
@@ -43,12 +43,12 @@ namespace Utils { class Environment; }
namespace ProjectExplorer {
class RunConfiguration;
-class ToolChain;
class BuildConfiguration;
class DeployConfiguration;
class IBuildConfigurationFactory;
class DeployConfigurationFactory;
class IRunConfigurationFactory;
+class Profile;
class Project;
class BuildConfigWidget;
@@ -59,11 +59,14 @@ class PROJECTEXPLORER_EXPORT Target : public ProjectConfiguration
Q_OBJECT
public:
- virtual ~Target();
+ Target(Project *parent, Profile *p);
+ ~Target();
- virtual BuildConfigWidget *createConfigWidget() = 0;
Project *project() const;
+ // Profile:
+ Profile *profile() const;
+
// Build configuration
void addBuildConfiguration(BuildConfiguration *configuration);
bool removeBuildConfiguration(BuildConfiguration *configuration);
@@ -72,8 +75,6 @@ public:
BuildConfiguration *activeBuildConfiguration() const;
void setActiveBuildConfiguration(BuildConfiguration *configuration);
- virtual IBuildConfigurationFactory *buildConfigurationFactory() const = 0;
-
// DeployConfiguration
void addDeployConfiguration(DeployConfiguration *dc);
bool removeDeployConfiguration(DeployConfiguration *dc);
@@ -82,10 +83,6 @@ public:
DeployConfiguration *activeDeployConfiguration() const;
void setActiveDeployConfiguration(DeployConfiguration *configuration);
- QList<Core::Id> availableDeployConfigurationIds();
- QString displayNameForDeployConfigurationId(Core::Id &id);
- DeployConfiguration *createDeployConfiguration(Core::Id id);
-
// Running
QList<RunConfiguration *> runConfigurations() const;
void addRunConfiguration(RunConfiguration *runConfiguration);
@@ -108,10 +105,12 @@ public:
QString toolTip() const;
void setToolTip(const QString &text);
- virtual QList<ToolChain *> possibleToolChains(BuildConfiguration *) const;
- virtual ToolChain *preferredToolChain(BuildConfiguration *) const;
+ QVariantMap toMap() const;
- virtual QVariantMap toMap() const;
+ void createDefaultSetup();
+ void updateDefaultBuildConfigurations();
+ void updateDefaultDeployConfigurations();
+ void updateDefaultRunConfigurations();
signals:
void targetEnabled(bool);
@@ -119,6 +118,8 @@ signals:
void overlayIconChanged();
void toolTipChanged();
+ void profileChanged();
+
// TODO clean up signal names
// might be better to also have aboutToRemove signals
void removedRunConfiguration(ProjectExplorer::RunConfiguration *);
@@ -143,14 +144,23 @@ signals:
void deployConfigurationEnabledChanged();
void runConfigurationEnabledChanged();
-protected:
- Target(Project *parent, const Core::Id id);
+ /// Emitted whenever the project should (re-)evaluate the build system
+ void requestBuildSystemEvaluation();
+ /// Emitted whenever the current build configuration has finished to initialize its build directory.
+ void buildDirectoryInitialized();
+ /// Emitted whenever the current build configuartion changed or the build directory of the current
+ /// build configuration was changed.
+ void buildDirectoryChanged();
- virtual ProjectExplorer::IDevice::ConstPtr currentDevice() const;
+public slots:
+ void onRequestBuildSystemEvaluation();
+ void onBuildDirectoryInitialized();
+ void onBuildDirectoryChanged();
+protected:
void setEnabled(bool);
- virtual bool fromMap(const QVariantMap &map);
+ bool fromMap(const QVariantMap &map);
protected slots:
void updateDeviceState();
@@ -161,31 +171,13 @@ private slots:
void changeDeployConfigurationEnabled();
void changeRunConfigurationEnabled();
+ void handleProfileUpdates(ProjectExplorer::Profile *p);
+ void handleProfileRemoval(ProjectExplorer::Profile *p);
+
private:
TargetPrivate *d;
-};
-class PROJECTEXPLORER_EXPORT ITargetFactory :
- public QObject
-{
- Q_OBJECT
-
-public:
- explicit ITargetFactory(QObject *parent = 0);
-
- virtual QList<Core::Id> supportedTargetIds() const = 0;
- virtual bool supportsTargetId(const Core::Id id) const = 0;
-
- // used to translate the types to names to display to the user
- virtual QString displayNameForId(const Core::Id id) const = 0;
-
- virtual bool canCreate(Project *parent, const Core::Id id) const = 0;
- virtual Target *create(Project *parent, const Core::Id id) = 0;
- virtual bool canRestore(Project *parent, const QVariantMap &map) const = 0;
- virtual Target *restore(Project *parent, const QVariantMap &map) = 0;
-
-signals:
- void canCreateTargetIdsChanged();
+ friend class Project;
};
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/targetselector.cpp b/src/plugins/projectexplorer/targetselector.cpp
index 707160377d..20a3023187 100644
--- a/src/plugins/projectexplorer/targetselector.cpp
+++ b/src/plugins/projectexplorer/targetselector.cpp
@@ -80,6 +80,12 @@ void TargetSelector::insertTarget(int index, const QString &name)
update();
}
+void TargetSelector::renameTarget(int index, const QString &name)
+{
+ m_targets[index].name = name;
+ update();
+}
+
void TargetSelector::removeTarget(int index)
{
QTC_ASSERT(index >= 0 && index < m_targets.count(), return);
diff --git a/src/plugins/projectexplorer/targetselector.h b/src/plugins/projectexplorer/targetselector.h
index 6aaadf849b..752bb1c14e 100644
--- a/src/plugins/projectexplorer/targetselector.h
+++ b/src/plugins/projectexplorer/targetselector.h
@@ -70,6 +70,7 @@ public:
public:
void insertTarget(int index, const QString &name);
+ void renameTarget(int index, const QString &name);
void removeTarget(int index);
void setCurrentIndex(int index);
void setCurrentSubIndex(int subindex);
diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp
index a94c34fde4..3646d10fa1 100644
--- a/src/plugins/projectexplorer/targetsettingspanel.cpp
+++ b/src/plugins/projectexplorer/targetsettingspanel.cpp
@@ -41,7 +41,10 @@
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/profile.h>
+#include <projectexplorer/profilemanager.h>
#include <projectexplorer/buildmanager.h>
+#include <utils/qtcassert.h>
#include <QCoreApplication>
#include <QLabel>
@@ -84,13 +87,8 @@ TargetSettingsPanelWidget::TargetSettingsPanelWidget(Project *project) :
connect(m_project, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
this, SLOT(activeTargetChanged(ProjectExplorer::Target*)));
- QList<ITargetFactory *> factories =
- ExtensionSystem::PluginManager::getObjects<ITargetFactory>();
-
- foreach (ITargetFactory *fac, factories) {
- connect(fac, SIGNAL(canCreateTargetIdsChanged()),
- this, SLOT(updateTargetAddAndRemoveButtons()));
- }
+ connect(ProfileManager::instance(), SIGNAL(profilesChanged()),
+ this, SLOT(updateTargetAddAndRemoveButtons()));
}
TargetSettingsPanelWidget::~TargetSettingsPanelWidget()
@@ -213,19 +211,10 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
void TargetSettingsPanelWidget::addTarget(QAction *action)
{
- Core::Id id = action->data().value<Core::Id>();
- Q_ASSERT(!m_project->target(id));
- QList<ITargetFactory *> factories =
- ExtensionSystem::PluginManager::getObjects<ITargetFactory>();
-
- Target *target = 0;
- foreach (ITargetFactory *fac, factories) {
- if (fac->canCreate(m_project, id)) {
- target = fac->create(m_project, id);
- break;
- }
- }
+ Profile *p = ProfileManager::instance()->find(action->data().value<Core::Id>());
+ QTC_ASSERT(!m_project->target(p), return);
+ Target *target = m_project->createTarget(p);
if (!target)
return;
m_project->addTarget(target);
@@ -278,6 +267,7 @@ void TargetSettingsPanelWidget::targetAdded(ProjectExplorer::Target *target)
}
}
+ connect(target, SIGNAL(displayNameChanged()), this, SLOT(renameTarget()));
updateTargetAddAndRemoveButtons();
}
@@ -312,35 +302,42 @@ void TargetSettingsPanelWidget::updateTargetAddAndRemoveButtons()
m_addMenu->clear();
- QList<ITargetFactory *> factories =
- ExtensionSystem::PluginManager::getObjects<ITargetFactory>();
-
- foreach (ITargetFactory *fac, factories) {
- foreach (Core::Id id, fac->supportedTargetIds()) {
- if (m_project->target(id))
- continue;
- if (!fac->canCreate(m_project, id))
- continue;
- QString displayName = fac->displayNameForId(id);
- QAction *action = new QAction(displayName, m_addMenu);
- action->setData(QVariant::fromValue(id));
- bool added = false;
- foreach (QAction *existing, m_addMenu->actions()) {
- if (existing->text() > action->text()) {
- m_addMenu->insertAction(existing, action);
- added = true;
- }
- }
+ foreach (Profile *p, ProfileManager::instance()->profiles()) {
+ if (m_project->target(p))
+ continue;
+ if (!m_project->supportsProfile(p))
+ continue;
- if (!added)
- m_addMenu->addAction(action);
+ QAction *action = new QAction(p->displayName(), m_addMenu);
+ action->setData(QVariant::fromValue(p->id()));
+
+ 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);
}
m_selector->setAddButtonEnabled(!m_addMenu->actions().isEmpty());
m_selector->setRemoveButtonEnabled(m_project->targets().count() > 1);
}
+void TargetSettingsPanelWidget::renameTarget()
+{
+ Target *t = qobject_cast<Target *>(sender());
+ if (!t)
+ return;
+ const int pos = m_targets.indexOf(t);
+ if (pos < 0)
+ return;
+ m_selector->renameTarget(pos, t->displayName());
+}
+
int TargetSettingsPanelWidget::currentSubIndex() const
{
return m_selector->currentSubIndex();
diff --git a/src/plugins/projectexplorer/targetsettingspanel.h b/src/plugins/projectexplorer/targetsettingspanel.h
index d95c358d1b..5f84c6fe22 100644
--- a/src/plugins/projectexplorer/targetsettingspanel.h
+++ b/src/plugins/projectexplorer/targetsettingspanel.h
@@ -71,6 +71,7 @@ private slots:
void removedTarget(ProjectExplorer::Target *target);
void activeTargetChanged(ProjectExplorer::Target *target);
void updateTargetAddAndRemoveButtons();
+ void renameTarget();
private:
Target *m_currentTarget;
diff --git a/src/plugins/projectexplorer/targetsettingswidget.cpp b/src/plugins/projectexplorer/targetsettingswidget.cpp
index 18d9e06561..f8f8b3c835 100644
--- a/src/plugins/projectexplorer/targetsettingswidget.cpp
+++ b/src/plugins/projectexplorer/targetsettingswidget.cpp
@@ -78,6 +78,12 @@ void TargetSettingsWidget::insertTarget(int index, const QString &name)
updateTargetSelector();
}
+void TargetSettingsWidget::renameTarget(int index, const QString &name)
+{
+ m_targetSelector->renameTarget(index, name);
+ // geometry won't change, so no need to updateTargetSelector()
+}
+
void TargetSettingsWidget::removeTarget(int index)
{
m_targetSelector->removeTarget(index);
diff --git a/src/plugins/projectexplorer/targetsettingswidget.h b/src/plugins/projectexplorer/targetsettingswidget.h
index dedede723f..ebc3c48dd7 100644
--- a/src/plugins/projectexplorer/targetsettingswidget.h
+++ b/src/plugins/projectexplorer/targetsettingswidget.h
@@ -65,6 +65,7 @@ public:
public:
void insertTarget(int index, const QString &name);
+ void renameTarget(int index, const QString &name);
void removeTarget(int index);
void setCurrentIndex(int index);
void setCurrentSubIndex(int index);
diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp
index 75eeb0baea..1c92f3c77b 100644
--- a/src/plugins/projectexplorer/toolchain.cpp
+++ b/src/plugins/projectexplorer/toolchain.cpp
@@ -32,6 +32,7 @@
#include "toolchain.h"
+#include "abi.h"
#include "toolchainmanager.h"
#include <extensionsystem/pluginmanager.h>
@@ -43,30 +44,6 @@
static const char ID_KEY[] = "ProjectExplorer.ToolChain.Id";
static const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ToolChain.DisplayName";
static const char AUTODETECT_KEY[] = "ProjectExplorer.ToolChain.Autodetect";
-static const char MKSPEC_KEY[] = "ProjectExplorer.ToolChain.MkSpecOverride";
-
-namespace {
-
-QString mkspecListToString(const QList<Utils::FileName> &specList)
-{
- QStringList result;
- foreach (const Utils::FileName &spec, specList)
- result.append(spec.toString());
- return result.join(QChar::fromLatin1(';'));
-}
-
-QList<Utils::FileName> mkspecListFromString(const QString &string)
-{
- QList<Utils::FileName> result;
- QStringList partList;
- if (!string.isEmpty())
- partList = string.split(QLatin1Char(';'));
- foreach (const QString &part, partList)
- result.append(Utils::FileName::fromString(part));
- return result;
-}
-
-} // namespace
namespace ProjectExplorer {
namespace Internal {
@@ -94,7 +71,6 @@ public:
QString m_id;
bool m_autodetect;
mutable QString m_displayName;
- QList<Utils::FileName> m_mkspecList;
};
} // namespace Internal
@@ -150,31 +126,9 @@ QString ToolChain::id() const
return d->m_id;
}
-/*!
- \brief Returns a list of target ids that this tool chain is restricted to.
-
- An empty list is shows that the toolchain is compatible with all targets.
-*/
-
-QList<Core::Id> ToolChain::restrictedToTargets() const
-{
- return QList<Core::Id>();
-}
-
-QList<Utils::FileName> ToolChain::mkspecList() const
+Utils::FileName ToolChain::suggestedDebugger()
{
- if (d->m_mkspecList.isEmpty())
- return suggestedMkspecList();
- return d->m_mkspecList;
-}
-
-void ToolChain::setMkspecList(const QList<Utils::FileName> &specList)
-{
- QList<Utils::FileName> oldSpecList = mkspecList();
- d->m_mkspecList = specList;
-
- if (oldSpecList != mkspecList())
- toolChainUpdated();
+ return ToolChainManager::instance()->defaultDebugger(targetAbi());
}
bool ToolChain::canClone() const
@@ -211,7 +165,6 @@ QVariantMap ToolChain::toMap() const
result.insert(QLatin1String(ID_KEY), id());
result.insert(QLatin1String(DISPLAY_NAME_KEY), displayName());
result.insert(QLatin1String(AUTODETECT_KEY), isAutoDetected());
- result.insert(QLatin1String(MKSPEC_KEY), mkspecListToString(d->m_mkspecList));
return result;
}
@@ -241,7 +194,6 @@ bool ToolChain::fromMap(const QVariantMap &data)
// make sure we have new style ids:
d->m_id = data.value(QLatin1String(ID_KEY)).toString();
d->m_autodetect = data.value(QLatin1String(AUTODETECT_KEY), false).toBool();
- d->m_mkspecList = mkspecListFromString(data.value(QLatin1String(MKSPEC_KEY)).toString());
return true;
}
diff --git a/src/plugins/projectexplorer/toolchain.h b/src/plugins/projectexplorer/toolchain.h
index 31211acc7d..1ce975d2c6 100644
--- a/src/plugins/projectexplorer/toolchain.h
+++ b/src/plugins/projectexplorer/toolchain.h
@@ -73,8 +73,9 @@ public:
bool isAutoDetected() const;
QString id() const;
- // No need to implement this for new tool chains:
- virtual QString legacyId() const { return QString(); }
+
+ virtual QList<Utils::FileName> suggestedMkspecList() const { return QList<Utils::FileName>(); }
+ Utils::FileName suggestedDebugger();
virtual QString type() const = 0;
virtual QString typeDisplayName() const = 0;
@@ -82,8 +83,6 @@ public:
virtual bool isValid() const = 0;
- virtual QList<Core::Id> restrictedToTargets() const;
-
virtual QByteArray predefinedMacros(const QStringList &cxxflags) const = 0;
enum CompilerFlags {
@@ -95,12 +94,7 @@ public:
virtual void addToEnvironment(Utils::Environment &env) const = 0;
virtual QString makeCommand() const = 0;
- QList<Utils::FileName> mkspecList() const;
- void setMkspecList(const QList<Utils::FileName> &specList);
- virtual QList<Utils::FileName> suggestedMkspecList() const { return QList<Utils::FileName>(); }
-
virtual Utils::FileName compilerCommand() const = 0;
- virtual Utils::FileName debuggerCommand() const = 0;
virtual QString defaultMakeTarget() const;
virtual IOutputParser *outputParser() const = 0;
diff --git a/src/plugins/projectexplorer/toolchainconfigwidget.cpp b/src/plugins/projectexplorer/toolchainconfigwidget.cpp
index 3ad7e4da4c..93ad2f5d49 100644
--- a/src/plugins/projectexplorer/toolchainconfigwidget.cpp
+++ b/src/plugins/projectexplorer/toolchainconfigwidget.cpp
@@ -44,46 +44,6 @@
#include <QLabel>
#include <QPushButton>
-namespace {
-
-const char DEFAULT_MKSPEC[] = "default";
-
-QString mkspecListToString(const QList<Utils::FileName> &specList)
-{
- QStringList specStrings;
- foreach (const Utils::FileName &spec, specList) {
- if (spec.isEmpty())
- specStrings.append(QLatin1String(DEFAULT_MKSPEC));
- else
- specStrings.append(spec.toUserOutput());
- }
- QString specString = specStrings.join(QChar::fromAscii(';'));
- if (specString.isEmpty())
- return QLatin1String(DEFAULT_MKSPEC);
- return specString;
-}
-
-QList<Utils::FileName> mkspecListFromString(const QString &specString)
-{
- QStringList specList = specString.split(QLatin1Char(';'));
- QList<Utils::FileName> result;
- foreach (const QString &spec, specList) {
- QString trimmed = spec.trimmed();
- if (trimmed == QLatin1String(DEFAULT_MKSPEC))
- result.append(Utils::FileName());
- else
- result.append(Utils::FileName::fromUserInput(trimmed));
- }
-
- if (result.size() == 1 && result.at(0).isEmpty())
- return QList<Utils::FileName>();
-
- return result;
-}
-
-
-} // namespace
-
namespace ProjectExplorer {
namespace Internal {
@@ -95,21 +55,13 @@ class ToolChainConfigWidgetPrivate
{
public:
ToolChainConfigWidgetPrivate(ToolChain *tc) :
- m_toolChain(tc), m_debuggerPathChooser(0),
- m_mkspecLayout(0), m_mkspecEdit(0), m_mkspecResetButton(0), m_mkspecEdited(false),
- m_errorLabel(0)
+ m_toolChain(tc), m_errorLabel(0)
{
QTC_CHECK(tc);
}
ToolChain *m_toolChain;
- Utils::PathChooser *m_debuggerPathChooser;
- QHBoxLayout *m_mkspecLayout;
- QLineEdit *m_mkspecEdit;
- QPushButton *m_mkspecResetButton;
- bool m_mkspecEdited;
QLabel *m_errorLabel;
- QList<Utils::FileName> m_suggestedMkspec;
};
} // namespace Internal
@@ -134,132 +86,7 @@ ToolChain *ToolChainConfigWidget::toolChain() const
}
void ToolChainConfigWidget::makeReadOnly()
-{
- if (d->m_debuggerPathChooser)
- d->m_debuggerPathChooser->setEnabled(false);
- if (d->m_mkspecEdit)
- d->m_mkspecEdit->setEnabled(false);
- if (d->m_mkspecResetButton)
- d->m_mkspecResetButton->setEnabled(false);
-}
-
-void ToolChainConfigWidget::emitDirty()
-{
- if (d->m_mkspecEdit)
- d->m_mkspecEdited = (mkspecListFromString(d->m_mkspecEdit->text()) != d->m_suggestedMkspec);
- if (d->m_mkspecResetButton)
- d->m_mkspecResetButton->setEnabled(d->m_mkspecEdited);
- emit dirty();
-}
-
-void ToolChainConfigWidget::resetMkspecList()
-{
- if (!d->m_mkspecEdit || !d->m_mkspecEdited)
- return;
- d->m_mkspecEdit->setText(mkspecListToString(d->m_suggestedMkspec));
- d->m_mkspecEdited = false;
-}
-
-void ToolChainConfigWidget::addDebuggerCommandControls(QFormLayout *lt,
- const QStringList &versionArguments)
-{
- ensureDebuggerPathChooser(versionArguments);
- lt->addRow(tr("&Debugger:"), d->m_debuggerPathChooser);
-}
-
-void ToolChainConfigWidget::addDebuggerCommandControls(QGridLayout *lt,
- int row, int column,
- const QStringList &versionArguments)
-{
- ensureDebuggerPathChooser(versionArguments);
- QLabel *label = new QLabel(tr("&Debugger:"));
- label->setBuddy(d->m_debuggerPathChooser);
- lt->addWidget(label, row, column);
- lt->addWidget(d->m_debuggerPathChooser, row, column + 1);
-}
-
-void ToolChainConfigWidget::ensureDebuggerPathChooser(const QStringList &versionArguments)
-{
- if (d->m_debuggerPathChooser)
- return;
- d->m_debuggerPathChooser = new Utils::PathChooser;
- d->m_debuggerPathChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
- d->m_debuggerPathChooser->setCommandVersionArguments(versionArguments);
- connect(d->m_debuggerPathChooser, SIGNAL(changed(QString)), this, SLOT(emitDirty()));
-}
-
-void ToolChainConfigWidget::addDebuggerAutoDetection(QObject *receiver, const char *autoDetectSlot)
-{
- QTC_ASSERT(d->m_debuggerPathChooser, return);
- d->m_debuggerPathChooser->addButton(tr("Autodetect"), receiver, autoDetectSlot);
-}
-
-Utils::FileName ToolChainConfigWidget::debuggerCommand() const
-{
- QTC_ASSERT(d->m_debuggerPathChooser, return Utils::FileName());
- return d->m_debuggerPathChooser->fileName();
-}
-
-void ToolChainConfigWidget::setDebuggerCommand(const Utils::FileName &debugger)
-{
- QTC_ASSERT(d->m_debuggerPathChooser, return);
- d->m_debuggerPathChooser->setFileName(debugger);
-}
-
-void ToolChainConfigWidget::addMkspecControls(QFormLayout *lt)
-{
- ensureMkspecEdit();
- lt->addRow(tr("mkspec:"), d->m_mkspecLayout);
-}
-
-void ToolChainConfigWidget::addMkspecControls(QGridLayout *lt, int row, int column)
-{
- ensureMkspecEdit();
- QLabel *label = new QLabel(tr("mkspec:"));
- label->setBuddy(d->m_mkspecEdit);
- lt->addWidget(label, row, column);
- lt->addLayout(d->m_mkspecLayout, row, column + 1);
-}
-
-void ToolChainConfigWidget::ensureMkspecEdit()
-{
- if (d->m_mkspecEdit)
- return;
-
- QTC_CHECK(!d->m_mkspecLayout);
- QTC_CHECK(!d->m_mkspecResetButton);
-
- d->m_suggestedMkspec = d->m_toolChain->suggestedMkspecList();
-
- d->m_mkspecLayout = new QHBoxLayout;
- d->m_mkspecLayout->setMargin(0);
-
- d->m_mkspecEdit = new QLineEdit;
- d->m_mkspecEdit->setWhatsThis(tr("All possible mkspecs separated by a semicolon (';')."));
- d->m_mkspecResetButton = new QPushButton(tr("Reset"));
- d->m_mkspecResetButton->setEnabled(d->m_mkspecEdited);
- d->m_mkspecLayout->addWidget(d->m_mkspecEdit);
- d->m_mkspecLayout->addWidget(d->m_mkspecResetButton);
-
- connect(d->m_mkspecEdit, SIGNAL(textChanged(QString)), this, SLOT(emitDirty()));
- connect(d->m_mkspecResetButton, SIGNAL(clicked()), this, SLOT(resetMkspecList()));
-}
-
-QList<Utils::FileName> ToolChainConfigWidget::mkspecList() const
-{
- QTC_ASSERT(d->m_mkspecEdit, return QList<Utils::FileName>());
-
- return mkspecListFromString(d->m_mkspecEdit->text());
-}
-
-void ToolChainConfigWidget::setMkspecList(const QList<Utils::FileName> &specList)
-{
- QTC_ASSERT(d->m_mkspecEdit, return);
-
- d->m_mkspecEdit->setText(mkspecListToString(specList));
-
- emitDirty();
-}
+{ }
void ToolChainConfigWidget::addErrorLabel(QFormLayout *lt)
{
diff --git a/src/plugins/projectexplorer/toolchainconfigwidget.h b/src/plugins/projectexplorer/toolchainconfigwidget.h
index 1bc25b6661..2314df576c 100644
--- a/src/plugins/projectexplorer/toolchainconfigwidget.h
+++ b/src/plugins/projectexplorer/toolchainconfigwidget.h
@@ -74,33 +74,14 @@ signals:
void dirty();
protected slots:
- void emitDirty();
- void resetMkspecList();
void setErrorMessage(const QString &);
void clearErrorMessage();
protected:
- void addDebuggerCommandControls(QFormLayout *lt,
- const QStringList &versionArguments = QStringList());
- void addDebuggerCommandControls(QGridLayout *lt,
- int row = 0, int column = 0,
- const QStringList &versionArguments = QStringList());
- void addDebuggerAutoDetection(QObject *receiver, const char *autoDetectSlot);
- void addMkspecControls(QFormLayout *lt);
- void addMkspecControls(QGridLayout *lt, int row = 0, int column = 0);
void addErrorLabel(QFormLayout *lt);
void addErrorLabel(QGridLayout *lt, int row = 0, int column = 0, int colSpan = 1);
- Utils::FileName debuggerCommand() const;
- void setDebuggerCommand(const Utils::FileName &debugger);
-
- QList<Utils::FileName> mkspecList() const;
- void setMkspecList(const QList<Utils::FileName> &specList);
-
private:
- void ensureDebuggerPathChooser(const QStringList &versionArguments);
- void ensureMkspecEdit();
-
Internal::ToolChainConfigWidgetPrivate *d;
};
diff --git a/src/plugins/projectexplorer/toolchainmanager.cpp b/src/plugins/projectexplorer/toolchainmanager.cpp
index b87a38f8da..5b76d3f9ca 100644
--- a/src/plugins/projectexplorer/toolchainmanager.cpp
+++ b/src/plugins/projectexplorer/toolchainmanager.cpp
@@ -31,7 +31,9 @@
**************************************************************************/
#include "toolchainmanager.h"
+
#include "abi.h"
+#include "profileinformation.h"
#include "toolchain.h"
#include <coreplugin/icore.h>
@@ -51,15 +53,17 @@ static const char TOOLCHAIN_FILE_VERSION_KEY[] = "Version";
static const char DEFAULT_DEBUGGER_COUNT_KEY[] = "DefaultDebugger.Count";
static const char DEFAULT_DEBUGGER_ABI_KEY[] = "DefaultDebugger.Abi.";
static const char DEFAULT_DEBUGGER_PATH_KEY[] = "DefaultDebugger.Path.";
-static const char TOOLCHAIN_FILENAME[] = "/toolChains.xml";
+static const char TOOLCHAIN_FILENAME[] = "/qtcreator/toolchains.xml";
+static const char LEGACY_TOOLCHAIN_FILENAME[] = "/toolChains.xml";
using Utils::PersistentSettingsWriter;
using Utils::PersistentSettingsReader;
-static QString settingsFileName()
+static QString settingsFileName(const QString &path)
{
- QFileInfo settingsLocation(ExtensionSystem::PluginManager::settings()->fileName());
- return settingsLocation.absolutePath() + QLatin1String(TOOLCHAIN_FILENAME);
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ QFileInfo settingsLocation(pm->settings()->fileName());
+ return settingsLocation.absolutePath() + path;
}
namespace ProjectExplorer {
@@ -89,8 +93,7 @@ private:
ToolChainManagerPrivate::ToolChainManagerPrivate(ToolChainManager *parent)
: q(parent), m_initialized(false)
-{
-}
+{ }
QList<ToolChain *> &ToolChainManagerPrivate::toolChains()
{
@@ -109,7 +112,6 @@ QList<ToolChain *> &ToolChainManagerPrivate::toolChains()
ToolChainManager *ToolChainManager::instance()
{
- Q_ASSERT(m_instance);
return m_instance;
}
@@ -119,6 +121,7 @@ ToolChainManager::ToolChainManager(QObject *parent) :
{
Q_ASSERT(!m_instance);
m_instance = this;
+
connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()),
this, SLOT(saveToolChains()));
connect(this, SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
@@ -137,7 +140,7 @@ void ToolChainManager::restoreToolChains()
// read all tool chains from SDK
QFileInfo systemSettingsFile(Core::ICore::settings(QSettings::SystemScope)->fileName());
QList<ToolChain *> readTcs =
- restoreToolChains(systemSettingsFile.absolutePath() + QLatin1String(TOOLCHAIN_FILENAME));
+ restoreToolChains(systemSettingsFile.absolutePath() + QLatin1String(LEGACY_TOOLCHAIN_FILENAME));
// make sure we mark these as autodetected!
foreach (ToolChain *tc, readTcs)
tc->setAutoDetected(true);
@@ -145,8 +148,12 @@ void ToolChainManager::restoreToolChains()
tcsToRegister = readTcs; // SDK TCs are always considered to be up-to-date, so no need to
// recheck them.
- // read all tool chains from user file
- readTcs = restoreToolChains(settingsFileName());
+ // read all tool chains from user file.
+ // Read legacy settings once and keep them around...
+ QString fileName = settingsFileName(QLatin1String(TOOLCHAIN_FILENAME));
+ if (!QFileInfo(fileName).exists())
+ fileName = settingsFileName(QLatin1String(LEGACY_TOOLCHAIN_FILENAME));
+ readTcs = restoreToolChains(fileName);
foreach (ToolChain *tc, readTcs) {
if (tc->isAutoDetected())
@@ -214,7 +221,7 @@ void ToolChainManager::saveToolChains()
}
}
writer.saveValue(QLatin1String(TOOLCHAIN_COUNT_KEY), count);
- writer.save(settingsFileName(), QLatin1String("QtCreatorToolChains"), Core::ICore::mainWindow());
+ writer.save(settingsFileName(QLatin1String(TOOLCHAIN_FILENAME)), QLatin1String("QtCreatorToolChains"), Core::ICore::mainWindow());
// Do not save default debuggers! Those are set by the SDK!
}
@@ -296,7 +303,7 @@ ToolChain *ToolChainManager::findToolChain(const QString &id) const
return 0;
foreach (ToolChain *tc, d->toolChains()) {
- if (tc->id() == id || (!tc->legacyId().isEmpty() && tc->legacyId() == id))
+ if (tc->id() == id)
return tc;
}
return 0;
diff --git a/src/plugins/projectexplorer/toolchainoptionspage.cpp b/src/plugins/projectexplorer/toolchainoptionspage.cpp
index 1cdbe5bafa..5cd461ef70 100644
--- a/src/plugins/projectexplorer/toolchainoptionspage.cpp
+++ b/src/plugins/projectexplorer/toolchainoptionspage.cpp
@@ -42,13 +42,20 @@
#include <utils/qtcassert.h>
-#include <QSignalMapper>
-#include <QTextStream>
#include <QAction>
+#include <QApplication>
+#include <QHBoxLayout>
+#include <QHeaderView>
#include <QItemSelectionModel>
#include <QLabel>
#include <QMenu>
#include <QMessageBox>
+#include <QPushButton>
+#include <QSignalMapper>
+#include <QSpacerItem>
+#include <QTextStream>
+#include <QTreeView>
+#include <QVBoxLayout>
namespace ProjectExplorer {
namespace Internal {
@@ -92,11 +99,11 @@ public:
// ToolChainModel
// --------------------------------------------------------------------------
-ToolChainModel::ToolChainModel(QWidget *configWidgetParent, QObject *parent) :
+ToolChainModel::ToolChainModel(QBoxLayout *parentLayout, QObject *parent) :
QAbstractItemModel(parent),
- m_configWidgetParent(configWidgetParent)
+ m_parentLayout(parentLayout)
{
- Q_ASSERT(m_configWidgetParent);
+ Q_ASSERT(m_parentLayout);
connect(ToolChainManager::instance(), SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
this, SLOT(addToolChain(ProjectExplorer::ToolChain*)));
@@ -404,9 +411,8 @@ ToolChainNode *ToolChainModel::createNode(ToolChainNode *parent, ToolChain *tc,
{
ToolChainNode *node = new ToolChainNode(parent, tc, changed);
if (node->widget) {
- m_configWidgetParent->layout()->addWidget(node->widget);
- connect(node->widget, SIGNAL(dirty()),
- this, SLOT(setDirty()));
+ m_parentLayout->addWidget(node->widget);
+ connect(node->widget, SIGNAL(dirty()), this, SLOT(setDirty()));
}
return node;
}
@@ -471,7 +477,8 @@ void ToolChainModel::removeToolChain(ToolChain *tc)
// --------------------------------------------------------------------------
ToolChainOptionsPage::ToolChainOptionsPage() :
- m_ui(0), m_model(0), m_selectionModel(0), m_currentTcWidget(0)
+ m_model(0), m_selectionModel(0), m_currentTcWidget(0),
+ m_toolChainView(0), m_addButton(0), m_cloneButton(0), m_delButton(0)
{
setId(QLatin1String(Constants::TOOLCHAIN_SETTINGS_PAGE_ID));
setDisplayName(tr("Tool Chains"));
@@ -488,19 +495,39 @@ QWidget *ToolChainOptionsPage::createPage(QWidget *parent)
m_currentTcWidget = 0;
- m_ui = new Ui::ToolChainOptionsPage;
- m_ui->setupUi(m_configWidget);
+ m_toolChainView = new QTreeView(m_configWidget);
+ m_toolChainView->setUniformRowHeights(true);
+ m_toolChainView->header()->setStretchLastSection(false);
+ m_addButton = new QPushButton(tr("Add"), m_configWidget);
+ m_cloneButton = new QPushButton(tr("Clone"), m_configWidget);
+ m_delButton = new QPushButton(tr("Remove"), m_configWidget);
+
+ QVBoxLayout *buttonLayout = new QVBoxLayout();
+ buttonLayout->setSpacing(6);
+ buttonLayout->setContentsMargins(0, 0, 0, 0);
+ buttonLayout->addWidget(m_addButton);
+ buttonLayout->addWidget(m_cloneButton);
+ buttonLayout->addWidget(m_delButton);
+ buttonLayout->addItem(new QSpacerItem(10, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
+
+ QVBoxLayout *verticalLayout = new QVBoxLayout();
+ verticalLayout->addWidget(m_toolChainView);
+
+ QHBoxLayout *horizontalLayout = new QHBoxLayout(m_configWidget);
+ horizontalLayout->addLayout(verticalLayout);
+ horizontalLayout->addLayout(buttonLayout);
Q_ASSERT(!m_model);
- m_model = new ToolChainModel(m_configWidget);
+ m_model = new ToolChainModel(verticalLayout);
+
connect(m_model, SIGNAL(toolChainStateChanged()), this, SLOT(updateState()));
- m_ui->toolChainView->setModel(m_model);
- m_ui->toolChainView->header()->setResizeMode(0, QHeaderView::ResizeToContents);
- m_ui->toolChainView->header()->setResizeMode(1, QHeaderView::Stretch);
- m_ui->toolChainView->expandAll();
+ m_toolChainView->setModel(m_model);
+ m_toolChainView->header()->setResizeMode(0, QHeaderView::ResizeToContents);
+ m_toolChainView->header()->setResizeMode(1, QHeaderView::Stretch);
+ m_toolChainView->expandAll();
- m_selectionModel = m_ui->toolChainView->selectionModel();
+ m_selectionModel = m_toolChainView->selectionModel();
connect(m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(toolChainSelectionChanged()));
connect(ToolChainManager::instance(), SIGNAL(toolChainsChanged()),
@@ -510,7 +537,7 @@ QWidget *ToolChainOptionsPage::createPage(QWidget *parent)
m_factories = ExtensionSystem::PluginManager::getObjects<ToolChainFactory>();
// Set up add menu:
- QMenu *addMenu = new QMenu(m_ui->addButton);
+ QMenu *addMenu = new QMenu(m_addButton);
QSignalMapper *mapper = new QSignalMapper(addMenu);
connect(mapper, SIGNAL(mapped(QObject*)), this, SLOT(createToolChain(QObject*)));
@@ -524,12 +551,12 @@ QWidget *ToolChainOptionsPage::createPage(QWidget *parent)
addMenu->addAction(action);
}
}
- connect(m_ui->cloneButton, SIGNAL(clicked()), mapper, SLOT(map()));
- mapper->setMapping(m_ui->cloneButton, static_cast<QObject *>(0));
+ connect(m_cloneButton, SIGNAL(clicked()), mapper, SLOT(map()));
+ mapper->setMapping(m_cloneButton, static_cast<QObject *>(0));
- m_ui->addButton->setMenu(addMenu);
+ m_addButton->setMenu(addMenu);
- connect(m_ui->delButton, SIGNAL(clicked()), this, SLOT(removeToolChain()));
+ connect(m_delButton, SIGNAL(clicked()), this, SLOT(removeToolChain()));
// setup keywords:
if (m_searchKeywords.isEmpty()) {
@@ -562,8 +589,12 @@ void ToolChainOptionsPage::finish()
m_configWidget = 0; // deleted by settingsdialog
m_selectionModel = 0; // child of m_configWidget
- m_ui = 0; // child of m_configWidget
m_currentTcWidget = 0; // deleted by the model
+ // childs of m_configWidget
+ m_toolChainView = 0;
+ m_addButton = 0;
+ m_cloneButton = 0;
+ m_delButton = 0;
}
bool ToolChainOptionsPage::matches(const QString &s) const
@@ -619,7 +650,7 @@ void ToolChainOptionsPage::removeToolChain()
void ToolChainOptionsPage::updateState()
{
- if (!m_ui)
+ if (!m_cloneButton)
return;
bool canCopy = false;
@@ -630,8 +661,8 @@ void ToolChainOptionsPage::updateState()
canDelete = !tc->isAutoDetected();
}
- m_ui->cloneButton->setEnabled(canCopy);
- m_ui->delButton->setEnabled(canDelete);
+ m_cloneButton->setEnabled(canCopy);
+ m_delButton->setEnabled(canDelete);
}
QModelIndex ToolChainOptionsPage::currentIndex() const
diff --git a/src/plugins/projectexplorer/toolchainoptionspage.h b/src/plugins/projectexplorer/toolchainoptionspage.h
index 2049154455..9d882b2001 100644
--- a/src/plugins/projectexplorer/toolchainoptionspage.h
+++ b/src/plugins/projectexplorer/toolchainoptionspage.h
@@ -33,15 +33,16 @@
#ifndef TOOLCHAINOPTIONSPAGE_H
#define TOOLCHAINOPTIONSPAGE_H
-#include "ui_toolchainoptionspage.h"
-
#include <coreplugin/dialogs/ioptionspage.h>
#include <QAbstractItemModel>
QT_BEGIN_NAMESPACE
+class QBoxLayout;
+class QItemSelectionModel;
+class QPushButton;
+class QTreeView;
class QTreeWidgetItem;
-class QWidget;
QT_END_NAMESPACE
namespace ProjectExplorer {
@@ -63,7 +64,7 @@ class ToolChainModel : public QAbstractItemModel
Q_OBJECT
public:
- explicit ToolChainModel(QWidget *configWidgetParent, QObject *parent = 0);
+ explicit ToolChainModel(QBoxLayout *parentLayout, QObject *parent = 0);
~ToolChainModel();
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
@@ -109,7 +110,7 @@ private:
QList<ToolChainNode *> m_toAddList;
QList<ToolChainNode *> m_toRemoveList;
- QWidget *m_configWidgetParent;
+ QBoxLayout *m_parentLayout;
};
// --------------------------------------------------------------------------
@@ -137,7 +138,6 @@ private slots:
private:
QModelIndex currentIndex() const;
- Ui::ToolChainOptionsPage *m_ui;
QWidget *m_configWidget;
QString m_searchKeywords;
@@ -145,6 +145,10 @@ private:
QList<ToolChainFactory *> m_factories;
QItemSelectionModel * m_selectionModel;
ToolChainConfigWidget *m_currentTcWidget;
+ QTreeView *m_toolChainView;
+ QPushButton *m_addButton;
+ QPushButton *m_cloneButton;
+ QPushButton *m_delButton;
};
} // namespace Internal
diff --git a/src/plugins/projectexplorer/toolchainoptionspage.ui b/src/plugins/projectexplorer/toolchainoptionspage.ui
deleted file mode 100644
index 8c31359673..0000000000
--- a/src/plugins/projectexplorer/toolchainoptionspage.ui
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ProjectExplorer::Internal::ToolChainOptionsPage</class>
- <widget class="QWidget" name="ProjectExplorer::Internal::ToolChainOptionsPage">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>398</width>
- <height>296</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QTreeView" name="toolChainView">
- <property name="uniformRowHeights">
- <bool>true</bool>
- </property>
- <attribute name="headerStretchLastSection">
- <bool>false</bool>
- </attribute>
- </widget>
- </item>
- <item>
- <layout class="QVBoxLayout" name="_2">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>0</number>
- </property>
- <item>
- <widget class="QPushButton" name="addButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>21</width>
- <height>23</height>
- </size>
- </property>
- <property name="text">
- <string>Add</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="cloneButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>21</width>
- <height>23</height>
- </size>
- </property>
- <property name="text">
- <string>Clone</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="delButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>21</width>
- <height>23</height>
- </size>
- </property>
- <property name="text">
- <string>Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>10</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/plugins/projectexplorer/wincetoolchain.cpp b/src/plugins/projectexplorer/wincetoolchain.cpp
index 8108746528..eb08ddba9e 100644
--- a/src/plugins/projectexplorer/wincetoolchain.cpp
+++ b/src/plugins/projectexplorer/wincetoolchain.cpp
@@ -50,7 +50,6 @@
#include <QXmlStreamReader>
#define KEY_ROOT "ProjectExplorer.WinCEToolChain."
-static const char debuggerCommandKeyC[] = KEY_ROOT"Debugger";
static const char msvcVerKeyC[] = KEY_ROOT"MSVCVer";
static const char ceVerKeyC[] = KEY_ROOT"CEVer";
static const char binPathKeyC[] = KEY_ROOT"BinPath";
@@ -278,23 +277,6 @@ WinCEToolChain *WinCEToolChain::readFromMap(const QVariantMap &data)
return 0;
}
-QString WinCEToolChain::legacyId() const
-{
- const QChar colon = QLatin1Char(':');
- QString id = QLatin1String(Constants::WINCE_TOOLCHAIN_ID);
- id += colon;
- id += m_msvcVer;
- id += colon;
- id += m_binPath;
- id += colon;
- id += m_includePath;
- id += colon;
- id += m_libPath;
- id += colon;
- id += m_debuggerCommand.toString();
- return id;
-}
-
QString WinCEToolChain::type() const
{
return QLatin1String("wince");
@@ -330,8 +312,6 @@ QString WinCEToolChain::ceVer() const
QVariantMap WinCEToolChain::toMap() const
{
QVariantMap data = ToolChain::toMap();
- if (!m_debuggerCommand.isEmpty())
- data.insert(QLatin1String(debuggerCommandKeyC), m_debuggerCommand.toString());
data.insert(QLatin1String(msvcVerKeyC), m_msvcVer);
data.insert(QLatin1String(ceVerKeyC), m_ceVer);
@@ -356,7 +336,6 @@ bool WinCEToolChain::fromMap(const QVariantMap &data)
m_libPath = data.value(QLatin1String(libPathKeyC)).toString();
m_vcvarsBat = data.value(QLatin1String(vcVarsKeyC)).toString();
- m_debuggerCommand = Utils::FileName::fromString(data.value(QLatin1String(debuggerCommandKeyC)).toString());
const QString abiString = data.value(QLatin1String(supportedAbiKeyC)).toString();
m_abi = Abi(abiString);
diff --git a/src/plugins/projectexplorer/wincetoolchain.h b/src/plugins/projectexplorer/wincetoolchain.h
index f09a1ded26..2f8e7db30b 100644
--- a/src/plugins/projectexplorer/wincetoolchain.h
+++ b/src/plugins/projectexplorer/wincetoolchain.h
@@ -57,7 +57,6 @@ public:
const QString &libPath,
bool autodetect = false);
- QString legacyId() const;
QList<Utils::FileName> suggestedMkspecList() const;
static WinCEToolChain *readFromMap(const QVariantMap &data);
@@ -65,8 +64,6 @@ public:
QString type() const;
QString typeDisplayName() const;
- Utils::FileName mkspecList() const;
-
QString ceVer() const;
QVariantMap toMap() const;
diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp
index e3c16c1e5d..1c0d118e67 100644
--- a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp
+++ b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp
@@ -37,7 +37,9 @@
#include "subcomponentmanager.h"
#include "model/viewlogger.h"
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
+#include <qtsupport/qtprofileinformation.h>
#include <itemlibraryview.h>
#include <itemlibrarywidget.h>
@@ -89,9 +91,8 @@
#include <projectexplorer/projectexplorer.h>
#include <qt4projectmanager/qt4project.h>
-#include <qt4projectmanager/qt4target.h>
#include <qtsupport/qtversionmanager.h>
-#include <qt4projectmanager/qt4projectmanagerconstants.h>
+#include <qtsupport/qtsupportconstants.h>
#include <qmlprojectmanager/qmlprojectrunconfiguration.h>
enum {
@@ -221,8 +222,8 @@ QString DesignDocumentController::pathToQt() const
{
QtSupport::BaseQtVersion *activeQtVersion = QtSupport::QtVersionManager::instance()->version(d->qt_versionId);
if (activeQtVersion && (activeQtVersion->qtVersion().majorVersion > 3)
- && (activeQtVersion->supportsTargetId(Qt4ProjectManager::Constants::QT_SIMULATOR_TARGET_ID)
- || activeQtVersion->supportsTargetId(Qt4ProjectManager::Constants::DESKTOP_TARGET_ID)))
+ && (activeQtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT)
+ || activeQtVersion->type() == QLatin1String(QtSupport::Constants::SIMULATORQT)))
return activeQtVersion->versionInfo().value("QT_INSTALL_DATA");
return QString();
}
@@ -925,22 +926,8 @@ static inline QtSupport::BaseQtVersion *getActiveQtVersion(DesignDocumentControl
if (!target)
return 0;
- ProjectExplorer::RunConfiguration *runConfiguration = target->activeRunConfiguration();
- QmlProjectManager::QmlProjectRunConfiguration *qmlRunConfiguration = qobject_cast<QmlProjectManager::QmlProjectRunConfiguration* >(runConfiguration);
-
- if (qmlRunConfiguration) {
- controller->connect(target, SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)), controller, SLOT(activeQtVersionChanged()));
- return qmlRunConfiguration->qtVersion();
- }
-
- Qt4ProjectManager::Qt4BuildConfiguration *activeBuildConfiguration = qobject_cast<Qt4ProjectManager::Qt4BuildConfiguration *>(target->activeBuildConfiguration());
-
- if (activeBuildConfiguration) {
- controller->connect(target, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)), controller, SLOT(activeQtVersionChanged()));
- return activeBuildConfiguration->qtVersion();
- }
-
- return 0;
+ controller->connect(target, SIGNAL(profileChanged()), controller, SLOT(activeQtVersionChanged()));
+ return QtSupport::QtProfileInformation::qtVersion(target->profile());
}
void DesignDocumentController::activeQtVersionChanged()
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index 191b23f904..a0243e55a2 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -77,6 +77,8 @@
#include <qt4projectmanager/qt-s60/s60deployconfiguration.h>
#include <qt4projectmanager/qt-s60/symbianidevice.h>
+#include <qtsupport/qtprofileinformation.h>
+
#include <QApplication>
#include <QHBoxLayout>
#include <QLabel>
@@ -243,10 +245,9 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
// Check minimum Qt Version. We cannot really be sure what the Qt version
// at runtime is, but guess that the active build configuraiton has been used.
QtSupport::QtVersionNumber minimumVersion(4, 7, 4);
- if (Qt4ProjectManager::Qt4BuildConfiguration *qt4Config
- = qobject_cast<Qt4ProjectManager::Qt4BuildConfiguration*>(
- runConfiguration->target()->activeBuildConfiguration())) {
- if (qt4Config->qtVersion()->isValid() && qt4Config->qtVersion()->qtVersion() < minimumVersion) {
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(runConfiguration->target()->profile());
+ if (version) {
+ if (version->isValid() && version->qtVersion() < minimumVersion) {
int result = QMessageBox::warning(QApplication::activeWindow(), tr("QML Profiler"),
tr("The QML profiler requires Qt 4.7.4 or newer.\n"
"The Qt version configured in your active build configuration is too old.\n"
@@ -306,13 +307,9 @@ bool QmlProfilerTool::canRun(RunConfiguration *runConfiguration, RunMode mode) c
static QString sysroot(RunConfiguration *runConfig)
{
QTC_ASSERT(runConfig, return QString());
- if (Qt4ProjectManager::Qt4BuildConfiguration *buildConfig =
- qobject_cast<Qt4ProjectManager::Qt4BuildConfiguration*>(
- runConfig->target()->activeBuildConfiguration())) {
- if (QtSupport::BaseQtVersion *qtVersion = buildConfig->qtVersion())
- return qtVersion->systemRoot();
- }
-
+ ProjectExplorer::Profile *p = runConfig->target()->profile();
+ if (p && ProjectExplorer::SysRootProfileInformation::hasSysRoot(p))
+ return ProjectExplorer::SysRootProfileInformation::sysRoot(runConfig->target()->profile()).toString();
return QString();
}
@@ -347,7 +344,7 @@ AnalyzerStartParameters QmlProfilerTool::createStartParameters(RunConfiguration
qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
sp.debuggee = rc3->remoteExecutableFilePath();
sp.debuggeeArgs = rc3->arguments();
- sp.connParams = rc3->deviceConfig()->sshParameters();
+ sp.connParams = ProjectExplorer::DeviceProfileInformation::device(rc3->target()->profile())->sshParameters();
sp.analyzerCmdPrefix = rc3->commandPrefix();
sp.displayName = rc3->displayName();
sp.sysroot = sysroot(rc3);
diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp
index 1e43c76a04..91937d6de0 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.cpp
+++ b/src/plugins/qmlprojectmanager/qmlproject.cpp
@@ -35,7 +35,6 @@
#include "qmlprojectmanagerconstants.h"
#include "fileformat/qmlprojectitem.h"
#include "qmlprojectrunconfiguration.h"
-#include "qmlprojecttarget.h"
#include "qmlprojectconstants.h"
#include "qmlprojectnodes.h"
#include "qmlprojectmanager.h"
@@ -47,9 +46,12 @@
#include <qtsupport/qmldumptool.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtversionmanager.h>
+#include <qtsupport/qtprofileinformation.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <utils/fileutils.h>
-#include <projectexplorer/toolchainmanager.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/profilemanager.h>
+#include <projectexplorer/target.h>
#include <utils/filesystemwatcher.h>
#include <QTextStream>
@@ -157,13 +159,9 @@ void QmlProject::refresh(RefreshOptions options)
pinfo.importPaths = importPaths();
QtSupport::BaseQtVersion *version = 0;
if (activeTarget()) {
- if (QmlProjectRunConfiguration *rc = qobject_cast<QmlProjectRunConfiguration *>(activeTarget()->activeRunConfiguration()))
- version = rc->qtVersion();
- QList<ProjectExplorer::ToolChain *> tcList;
- if (version && !version->qtAbis().isEmpty())
- tcList = ProjectExplorer::ToolChainManager::instance()->findToolChains(version->qtAbis().at(0));
- if (!tcList.isEmpty())
- QtSupport::QmlDumpTool::pathAndEnvironment(this, version, tcList.first(), false, &pinfo.qmlDumpPath, &pinfo.qmlDumpEnvironment);
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(activeTarget()->profile());
+ version = QtSupport::QtProfileInformation::qtVersion(activeTarget()->profile());
+ QtSupport::QmlDumpTool::pathAndEnvironment(this, version, tc, false, &pinfo.qmlDumpPath, &pinfo.qmlDumpEnvironment);
}
if (version) {
pinfo.tryQmlDump = true;
@@ -273,14 +271,20 @@ ProjectExplorer::IProjectManager *QmlProject::projectManager() const
return m_manager;
}
-QList<ProjectExplorer::BuildConfigWidget*> QmlProject::subConfigWidgets()
+bool QmlProject::supportsProfile(ProjectExplorer::Profile *p) const
{
- return QList<ProjectExplorer::BuildConfigWidget*>();
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(p);
+ if (deviceType != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
+ return false;
+
+ // TODO: Limit supported versions?
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(p);
+ return version;
}
-Internal::QmlProjectTarget *QmlProject::activeTarget() const
+QList<ProjectExplorer::BuildConfigWidget*> QmlProject::subConfigWidgets()
{
- return static_cast<Internal::QmlProjectTarget *>(Project::activeTarget());
+ return QList<ProjectExplorer::BuildConfigWidget*>();
}
ProjectExplorer::ProjectNode *QmlProject::rootProjectNode() const
@@ -298,12 +302,8 @@ bool QmlProject::fromMap(const QVariantMap &map)
if (!Project::fromMap(map))
return false;
- if (targets().isEmpty()) {
- Internal::QmlProjectTargetFactory *factory
- = ExtensionSystem::PluginManager::getObject<Internal::QmlProjectTargetFactory>();
- Internal::QmlProjectTarget *target = factory->create(this, Core::Id(Constants::QML_VIEWER_TARGET_ID));
- addTarget(target);
- }
+ if (!activeTarget())
+ addTarget(createTarget(ProjectExplorer::ProfileManager::instance()->defaultProfile()));
refresh(Everything);
// FIXME workaround to guarantee that run/debug actions are enabled if a valid file exists
diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h
index 94af81d2ce..6f00900b81 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.h
+++ b/src/plugins/qmlprojectmanager/qmlproject.h
@@ -39,13 +39,8 @@
#include <QDeclarativeEngine>
-namespace QmlJS {
-class ModelManagerInterface;
-}
-
-namespace Utils {
-class FileSystemWatcher;
-}
+namespace QmlJS { class ModelManagerInterface; }
+namespace Utils { class FileSystemWatcher; }
namespace QmlProjectManager {
@@ -54,7 +49,6 @@ class QmlProjectItem;
namespace Internal {
class Manager;
class QmlProjectFile;
-class QmlProjectTarget;
class QmlProjectNode;
} // namespace Internal
@@ -72,7 +66,8 @@ public:
Core::Id id() const;
Core::IDocument *document() const;
ProjectExplorer::IProjectManager *projectManager() const;
- Internal::QmlProjectTarget *activeTarget() const;
+
+ bool supportsProfile(ProjectExplorer::Profile *p) const;
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanager.pro b/src/plugins/qmlprojectmanager/qmlprojectmanager.pro
index cd40ae3e2f..5249f4687b 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectmanager.pro
+++ b/src/plugins/qmlprojectmanager/qmlprojectmanager.pro
@@ -25,7 +25,6 @@ HEADERS += qmlproject.h \
qmlprojectapplicationwizard.h \
qmlprojectmanager_global.h \
qmlprojectmanagerconstants.h \
- qmlprojecttarget.h \
qmlprojectrunconfigurationwidget.h
SOURCES += qmlproject.cpp \
@@ -37,7 +36,6 @@ SOURCES += qmlproject.cpp \
qmlprojectrunconfiguration.cpp \
qmlprojectrunconfigurationfactory.cpp \
qmlprojectapplicationwizard.cpp \
- qmlprojecttarget.cpp \
qmlprojectrunconfigurationwidget.cpp
RESOURCES += qmlproject.qrc
diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs b/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs
index 52b421c123..9ac468e42c 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs
+++ b/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs
@@ -37,7 +37,6 @@ QtcPlugin {
"qmlprojectapplicationwizard.h",
"qmlprojectmanager_global.h",
"qmlprojectmanagerconstants.h",
- "qmlprojecttarget.h",
"qmlprojectrunconfigurationwidget.h",
"fileformat/qmlprojectitem.cpp",
"fileformat/filefilteritems.cpp",
@@ -51,7 +50,6 @@ QtcPlugin {
"qmlprojectrunconfiguration.cpp",
"qmlprojectrunconfigurationfactory.cpp",
"qmlprojectapplicationwizard.cpp",
- "qmlprojecttarget.cpp",
"qmlprojectrunconfigurationwidget.cpp",
"qmlproject.qrc",
"QmlProject.mimetypes.xml"
diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanagerconstants.h b/src/plugins/qmlprojectmanager/qmlprojectmanagerconstants.h
index e8bd9eeb21..2cbbc589e7 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectmanagerconstants.h
+++ b/src/plugins/qmlprojectmanager/qmlprojectmanagerconstants.h
@@ -36,9 +36,7 @@ namespace QmlProjectManager {
namespace Constants {
const char QML_RC_ID[] = "QmlProjectManager.QmlRunConfiguration";
-const char QML_VIEWER_QT_KEY[] = "QmlProjectManager.QmlRunConfiguration.QtVersion";
const char QML_VIEWER_ARGUMENTS_KEY[] = "QmlProjectManager.QmlRunConfiguration.QDeclarativeViewerArguments";
-const char QML_VIEWER_TARGET_ID[] = "QmlProjectManager.QmlTarget";
const char QML_VIEWER_TARGET_DISPLAY_NAME[] = "QML Viewer";
const char QML_MAINSCRIPT_KEY[] = "QmlProjectManager.QmlRunConfiguration.MainScript";
const char USER_ENVIRONMENT_CHANGES_KEY[] = "QmlProjectManager.QmlRunConfiguration.UserEnvironmentChanges";
diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
index 580e08e9c9..addb170b3f 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
@@ -37,7 +37,6 @@
#include "qmlproject.h"
#include "qmlprojectrunconfigurationfactory.h"
#include "qmlprojectruncontrol.h"
-#include "qmlprojecttarget.h"
#include "fileformat/qmlprojectfileformat.h"
#include <extensionsystem/pluginmanager.h>
@@ -85,7 +84,6 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
addAutoReleasedObject(new Internal::QmlProjectRunConfigurationFactory);
addAutoReleasedObject(new Internal::QmlProjectRunControlFactory);
addAutoReleasedObject(new Internal::QmlProjectApplicationWizard);
- addAutoReleasedObject(new Internal::QmlProjectTargetFactory);
QmlProjectFileFormat::registerDeclarativeTypes();
diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp
index 9a3dc44895..80346d3d13 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp
@@ -33,15 +33,15 @@
#include "qmlprojectrunconfiguration.h"
#include "qmlproject.h"
#include "qmlprojectmanagerconstants.h"
-#include "qmlprojecttarget.h"
#include "qmlprojectrunconfigurationwidget.h"
#include <coreplugin/mimedatabase.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/icore.h>
+#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
-#include <qtsupport/qtversionmanager.h>
+#include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtoutputformatter.h>
#include <qtsupport/qtsupportconstants.h>
@@ -52,7 +52,6 @@
using Core::EditorManager;
using Core::ICore;
using Core::IEditor;
-using QtSupport::QtVersionManager;
using namespace QmlProjectManager::Internal;
@@ -60,29 +59,23 @@ namespace QmlProjectManager {
const char * const M_CURRENT_FILE = "CurrentFile";
-QmlProjectRunConfiguration::QmlProjectRunConfiguration(QmlProjectTarget *parent) :
+QmlProjectRunConfiguration::QmlProjectRunConfiguration(ProjectExplorer::Target *parent) :
ProjectExplorer::RunConfiguration(parent, Core::Id(Constants::QML_RC_ID)),
- m_qtVersionId(-1),
m_scriptFile(M_CURRENT_FILE),
- m_projectTarget(parent),
m_isEnabled(false)
{
ctor();
- updateQtVersions();
}
-QmlProjectRunConfiguration::QmlProjectRunConfiguration(QmlProjectTarget *parent,
+QmlProjectRunConfiguration::QmlProjectRunConfiguration(ProjectExplorer::Target *parent,
QmlProjectRunConfiguration *source) :
ProjectExplorer::RunConfiguration(parent, source),
- m_qtVersionId(source->m_qtVersionId),
m_scriptFile(source->m_scriptFile),
m_qmlViewerArgs(source->m_qmlViewerArgs),
- m_projectTarget(parent),
m_isEnabled(source->m_isEnabled),
m_userEnvironmentChanges(source->m_userEnvironmentChanges)
{
ctor();
- updateQtVersions();
}
bool QmlProjectRunConfiguration::isEnabled() const
@@ -107,8 +100,8 @@ void QmlProjectRunConfiguration::ctor()
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(changeCurrentFile(Core::IEditor*)));
- QtVersionManager *qtVersions = QtVersionManager::instance();
- connect(qtVersions, SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)), this, SLOT(updateQtVersions()));
+ connect(target(), SIGNAL(profileChanged()),
+ this, SLOT(updateEnabled()));
setDisplayName(tr("QML Viewer", "QMLRunConfiguration display name."));
}
@@ -117,19 +110,13 @@ QmlProjectRunConfiguration::~QmlProjectRunConfiguration()
{
}
-QmlProjectTarget *QmlProjectRunConfiguration::qmlTarget() const
-{
- return static_cast<QmlProjectTarget *>(target());
-}
-
QString QmlProjectRunConfiguration::viewerPath() const
{
QtSupport::BaseQtVersion *version = qtVersion();
- if (!version) {
+ if (!version)
return QString();
- } else {
+ else
return version->qmlviewerCommand();
- }
}
QString QmlProjectRunConfiguration::observerPath() const
@@ -150,7 +137,10 @@ QString QmlProjectRunConfiguration::viewerArguments() const
QString args = m_qmlViewerArgs;
// arguments from .qmlproject file
- foreach (const QString &importPath, qmlTarget()->qmlProject()->importPaths()) {
+ QmlProject *project = qobject_cast<QmlProject *>(target()->project());
+ if (!project)
+ return args;
+ foreach (const QString &importPath, project->importPaths()) {
Utils::QtcProcess::addArg(&args, "-I");
Utils::QtcProcess::addArg(&args, importPath);
}
@@ -165,26 +155,10 @@ QString QmlProjectRunConfiguration::viewerArguments() const
QString QmlProjectRunConfiguration::workingDirectory() const
{
- QFileInfo projectFile(qmlTarget()->qmlProject()->document()->fileName());
+ QFileInfo projectFile(target()->project()->document()->fileName());
return canonicalCapsPath(projectFile.absolutePath());
}
-int QmlProjectRunConfiguration::qtVersionId() const
-{
- return m_qtVersionId;
-}
-
-void QmlProjectRunConfiguration::setQtVersionId(int id)
-{
- if (m_qtVersionId == id)
- return;
-
- m_qtVersionId = id;
- qmlTarget()->qmlProject()->refresh(QmlProject::Configuration);
- if (m_configurationWidget)
- m_configurationWidget.data()->updateQtVersionComboBox();
-}
-
/* QtDeclarative checks explicitly that the capitalization for any URL / path
is exactly like the capitalization on disk.*/
QString QmlProjectRunConfiguration::canonicalCapsPath(const QString &fileName)
@@ -201,14 +175,7 @@ QString QmlProjectRunConfiguration::canonicalCapsPath(const QString &fileName)
QtSupport::BaseQtVersion *QmlProjectRunConfiguration::qtVersion() const
{
- if (m_qtVersionId == -1)
- return 0;
-
- QtSupport::QtVersionManager *versionManager = QtSupport::QtVersionManager::instance();
- QtSupport::BaseQtVersion *version = versionManager->version(m_qtVersionId);
- QTC_ASSERT(version, return 0);
-
- return version;
+ return QtSupport::QtProfileInformation::qtVersion(target()->profile());
}
QWidget *QmlProjectRunConfiguration::createConfigurationWidget()
@@ -220,16 +187,18 @@ QWidget *QmlProjectRunConfiguration::createConfigurationWidget()
Utils::OutputFormatter *QmlProjectRunConfiguration::createOutputFormatter() const
{
- return new QtSupport::QtOutputFormatter(qmlTarget()->qmlProject());
+ return new QtSupport::QtOutputFormatter(target()->project());
}
QmlProjectRunConfiguration::MainScriptSource QmlProjectRunConfiguration::mainScriptSource() const
{
- if (!qmlTarget()->qmlProject()->mainFile().isEmpty())
+ QmlProject *project = qobject_cast<QmlProject *>(target()->project());
+ if (!project)
+ return FileInEditor;
+ if (!project->mainFile().isEmpty())
return FileInProjectFile;
- if (!m_mainScriptFilename.isEmpty()) {
+ if (!m_mainScriptFilename.isEmpty())
return FileInSettings;
- }
return FileInEditor;
}
@@ -238,12 +207,15 @@ QmlProjectRunConfiguration::MainScriptSource QmlProjectRunConfiguration::mainScr
*/
QString QmlProjectRunConfiguration::mainScript() const
{
- if (!qmlTarget()->qmlProject()->mainFile().isEmpty()) {
- const QString pathInProject = qmlTarget()->qmlProject()->mainFile();
+ QmlProject *project = qobject_cast<QmlProject *>(target()->project());
+ if (!project)
+ return m_currentFileFilename;
+ if (!project->mainFile().isEmpty()) {
+ const QString pathInProject = project->mainFile();
if (QFileInfo(pathInProject).isAbsolute())
return pathInProject;
else
- return qmlTarget()->qmlProject()->projectDir().absoluteFilePath(pathInProject);
+ return project->projectDir().absoluteFilePath(pathInProject);
}
if (!m_mainScriptFilename.isEmpty())
@@ -264,7 +236,7 @@ void QmlProjectRunConfiguration::setScriptSource(MainScriptSource source,
} else { // FileInSettings
m_scriptFile = settingsPath;
m_mainScriptFilename
- = qmlTarget()->qmlProject()->projectDir().absoluteFilePath(m_scriptFile);
+ = target()->project()->projectDirectory() + QLatin1Char('/') + m_scriptFile;
}
updateEnabled();
if (m_configurationWidget)
@@ -289,7 +261,6 @@ QVariantMap QmlProjectRunConfiguration::toMap() const
{
QVariantMap map(ProjectExplorer::RunConfiguration::toMap());
- map.insert(QLatin1String(Constants::QML_VIEWER_QT_KEY), m_qtVersionId);
map.insert(QLatin1String(Constants::QML_VIEWER_ARGUMENTS_KEY), m_qmlViewerArgs);
map.insert(QLatin1String(Constants::QML_MAINSCRIPT_KEY), m_scriptFile);
map.insert(QLatin1String(Constants::USER_ENVIRONMENT_CHANGES_KEY),
@@ -299,30 +270,25 @@ QVariantMap QmlProjectRunConfiguration::toMap() const
bool QmlProjectRunConfiguration::fromMap(const QVariantMap &map)
{
- setQtVersionId(map.value(QLatin1String(Constants::QML_VIEWER_QT_KEY), -1).toInt());
m_qmlViewerArgs = map.value(QLatin1String(Constants::QML_VIEWER_ARGUMENTS_KEY)).toString();
m_scriptFile = map.value(QLatin1String(Constants::QML_MAINSCRIPT_KEY), M_CURRENT_FILE).toString();
m_userEnvironmentChanges = Utils::EnvironmentItem::fromStringList(
map.value(QLatin1String(Constants::USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
-
- updateQtVersions();
- if (m_scriptFile == M_CURRENT_FILE) {
+ if (m_scriptFile == M_CURRENT_FILE)
setScriptSource(FileInEditor);
- } else if (m_scriptFile.isEmpty()) {
+ else if (m_scriptFile.isEmpty())
setScriptSource(FileInProjectFile);
- } else {
+ else
setScriptSource(FileInSettings, m_scriptFile);
- }
return RunConfiguration::fromMap(map);
}
void QmlProjectRunConfiguration::changeCurrentFile(Core::IEditor *editor)
{
- if (editor) {
+ if (editor)
m_currentFileFilename = editor->document()->fileName();
- }
updateEnabled();
}
@@ -341,7 +307,7 @@ void QmlProjectRunConfiguration::updateEnabled()
|| db->findByFile(mainScript()).type() == QLatin1String("application/x-qmlproject")) {
// find a qml file with lowercase filename. This is slow, but only done
// in initialization/other border cases.
- foreach(const QString &filename, m_projectTarget->qmlProject()->files()) {
+ foreach (const QString &filename, target()->project()->files(ProjectExplorer::Project::AllFiles)) {
const QFileInfo fi(filename);
if (!filename.isEmpty() && fi.baseName()[0].isLower()
@@ -367,29 +333,6 @@ void QmlProjectRunConfiguration::updateEnabled()
emit enabledChanged();
}
-void QmlProjectRunConfiguration::updateQtVersions()
-{
- QtVersionManager *qtVersions = QtVersionManager::instance();
-
- //
- // update m_qtVersionId
- //
- if (!qtVersions->isValidId(m_qtVersionId)
- || !isValidVersion(qtVersions->version(m_qtVersionId))) {
- int newVersionId = -1;
- // take first one you find
- foreach (QtSupport::BaseQtVersion *version, qtVersions->validVersions()) {
- if (isValidVersion(version)) {
- newVersionId = version->uniqueId();
- break;
- }
- }
- setQtVersionId(newVersionId);
- }
-
- updateEnabled();
-}
-
bool QmlProjectRunConfiguration::isValidVersion(QtSupport::BaseQtVersion *version)
{
if (version
diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h
index 97f2975837..a767cb64ba 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h
+++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h
@@ -50,14 +50,11 @@ namespace Utils {
class EnvironmentItem;
}
-namespace QtSupport {
- class BaseQtVersion;
-}
+namespace QtSupport { class BaseQtVersion; }
namespace QmlProjectManager {
namespace Internal {
- class QmlProjectTarget;
class QmlProjectRunConfigurationFactory;
class QmlProjectRunConfigurationWidget;
}
@@ -68,20 +65,14 @@ class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplor
friend class Internal::QmlProjectRunConfigurationFactory;
friend class Internal::QmlProjectRunConfigurationWidget;
- // used in qmldumptool.cpp
- Q_PROPERTY(int qtVersionId READ qtVersionId)
-
public:
- QmlProjectRunConfiguration(Internal::QmlProjectTarget *parent);
+ QmlProjectRunConfiguration(ProjectExplorer::Target *parent);
virtual ~QmlProjectRunConfiguration();
- Internal::QmlProjectTarget *qmlTarget() const;
-
QString viewerPath() const;
QString observerPath() const;
QString viewerArguments() const;
QString workingDirectory() const;
- int qtVersionId() const;
QtSupport::BaseQtVersion *qtVersion() const;
enum MainScriptSource {
@@ -110,10 +101,9 @@ public slots:
private slots:
void updateEnabled();
- void updateQtVersions();
protected:
- QmlProjectRunConfiguration(Internal::QmlProjectTarget *parent,
+ QmlProjectRunConfiguration(ProjectExplorer::Target *parent,
QmlProjectRunConfiguration *source);
virtual bool fromMap(const QVariantMap &map);
void setEnabled(bool value);
@@ -121,7 +111,6 @@ protected:
private:
void ctor();
static bool isValidVersion(QtSupport::BaseQtVersion *version);
- void setQtVersionId(int id);
static QString canonicalCapsPath(const QString &filePath);
@@ -138,7 +127,6 @@ private:
QString m_scriptFile;
QString m_qmlViewerArgs;
- Internal::QmlProjectTarget *m_projectTarget;
QWeakPointer<Internal::QmlProjectRunConfigurationWidget> m_configurationWidget;
bool m_isEnabled;
diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.cpp
index 877cacf0ed..1704ff0ceb 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.cpp
@@ -31,20 +31,21 @@
**************************************************************************/
#include "qmlprojectmanagerconstants.h"
+#include "qmlproject.h"
#include "qmlprojectrunconfiguration.h"
#include "qmlprojectrunconfigurationfactory.h"
-#include "qmlprojecttarget.h"
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectconfiguration.h>
#include <projectexplorer/runconfiguration.h>
+#include <projectexplorer/target.h>
namespace QmlProjectManager {
namespace Internal {
QmlProjectRunConfigurationFactory::QmlProjectRunConfigurationFactory(QObject *parent) :
ProjectExplorer::IRunConfigurationFactory(parent)
-{
-}
+{ setObjectName(QLatin1String("QmlProjectRunConfigurationFactory")); }
QmlProjectRunConfigurationFactory::~QmlProjectRunConfigurationFactory()
{
@@ -52,7 +53,7 @@ QmlProjectRunConfigurationFactory::~QmlProjectRunConfigurationFactory()
QList<Core::Id> QmlProjectRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
{
- if (!qobject_cast<QmlProjectTarget *>(parent))
+ if (!canHandle(parent))
return QList<Core::Id>();
return QList<Core::Id>() << Core::Id(Constants::QML_RC_ID);
}
@@ -66,7 +67,7 @@ QString QmlProjectRunConfigurationFactory::displayNameForId(const Core::Id id) c
bool QmlProjectRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
{
- if (!qobject_cast<QmlProjectTarget *>(parent))
+ if (!canHandle(parent))
return false;
return id == Core::Id(Constants::QML_RC_ID);
}
@@ -75,8 +76,7 @@ ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::create(Pro
{
if (!canCreate(parent, id))
return 0;
- QmlProjectTarget *qmlparent = static_cast<QmlProjectTarget *>(parent);
- return new QmlProjectRunConfiguration(qmlparent);
+ return new QmlProjectRunConfiguration(parent);
}
bool QmlProjectRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
@@ -88,8 +88,7 @@ ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::restore(Pr
{
if (!canRestore(parent, map))
return 0;
- QmlProjectTarget *qmlparent = static_cast<QmlProjectTarget *>(parent);
- QmlProjectRunConfiguration *rc = new QmlProjectRunConfiguration(qmlparent);
+ QmlProjectRunConfiguration *rc = new QmlProjectRunConfiguration(parent);
if (rc->fromMap(map))
return rc;
delete rc;
@@ -106,8 +105,17 @@ ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::clone(Proj
{
if (!canClone(parent, source))
return 0;
- QmlProjectTarget *qmlparent = static_cast<QmlProjectTarget *>(parent);
- return new QmlProjectRunConfiguration(qmlparent, qobject_cast<QmlProjectRunConfiguration *>(source));
+ return new QmlProjectRunConfiguration(parent, qobject_cast<QmlProjectRunConfiguration *>(source));
+}
+
+bool QmlProjectRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const
+{
+ if (!parent->project()->supportsProfile(parent->profile()))
+ return false;
+ if (!qobject_cast<QmlProject *>(parent->project()))
+ return false;
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->profile());
+ return deviceType == Core::Id(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
}
} // namespace Internal
diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.h b/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.h
index ee2e615dea..8969a35f89 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.h
+++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationfactory.h
@@ -55,6 +55,9 @@ public:
ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
+
+private:
+ bool canHandle(ProjectExplorer::Target *parent) const;
};
} // namespace Internal
diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.cpp
index 8b07a5fe74..886f319ba1 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.cpp
@@ -32,7 +32,6 @@
#include "qmlprojectrunconfigurationwidget.h"
#include "qmlprojectrunconfiguration.h"
-#include "qmlprojecttarget.h"
#include "qmlproject.h"
#include <coreplugin/helpmanager.h>
@@ -40,11 +39,9 @@
#include <projectexplorer/environmentwidget.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
#include <utils/detailswidget.h>
#include <utils/environment.h>
-#include <utils/qtcassert.h>
-#include <qtsupport/qtsupportconstants.h>
-#include <qtsupport/qtversionmanager.h>
#include <QLineEdit>
#include <QComboBox>
@@ -54,14 +51,12 @@
#include <QStandardItemModel>
using Core::ICore;
-using QtSupport::QtVersionManager;
namespace QmlProjectManager {
namespace Internal {
QmlProjectRunConfigurationWidget::QmlProjectRunConfigurationWidget(QmlProjectRunConfiguration *rc) :
m_runConfiguration(rc),
- m_qtVersionComboBox(0),
m_fileListCombo(0),
m_fileListModel(new QStandardItemModel(this))
{
@@ -86,38 +81,16 @@ QmlProjectRunConfigurationWidget::QmlProjectRunConfigurationWidget(QmlProjectRun
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(fileListChanged()),
SLOT(updateFileComboBox()));
- m_qtVersionComboBox = new QComboBox;
- m_qtVersionComboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
- connect(m_qtVersionComboBox, SIGNAL(activated(int)),
- this, SLOT(onQtVersionSelectionChanged()));
-
- QPushButton *pushButton = new QPushButton;
- pushButton->setText(tr("Manage Qt versions..."));
- connect(pushButton, SIGNAL(clicked()), this, SLOT(manageQtVersions()));
-
- QHBoxLayout *qtVersionLayout = new QHBoxLayout;
- qtVersionLayout->addWidget(m_qtVersionComboBox);
- qtVersionLayout->addWidget(pushButton);
-
QLineEdit *qmlViewerArgs = new QLineEdit;
qmlViewerArgs->setText(rc->m_qmlViewerArgs);
connect(qmlViewerArgs, SIGNAL(textChanged(QString)), this, SLOT(onViewerArgsChanged()));
- form->addRow(tr("Qt version:"), qtVersionLayout);
form->addRow(tr("Arguments:"), qmlViewerArgs);
form->addRow(tr("Main QML file:"), m_fileListCombo);
layout->addWidget(detailsWidget);
//
- // Debugging
- //
-
- QtVersionManager *qtVersions = QtVersionManager::instance();
- connect(qtVersions, SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
- this, SLOT(updateQtVersionComboBox()));
-
- //
// Environment
//
@@ -145,7 +118,6 @@ QmlProjectRunConfigurationWidget::QmlProjectRunConfigurationWidget(QmlProjectRun
layout->addWidget(m_environmentWidget);
updateFileComboBox();
- updateQtVersionComboBox();
}
static bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
@@ -155,8 +127,8 @@ static bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
void QmlProjectRunConfigurationWidget::updateFileComboBox()
{
- QmlProject *project = m_runConfiguration->qmlTarget()->qmlProject();
- QDir projectDir = project->projectDir();
+ ProjectExplorer::Project *project = m_runConfiguration->target()->project();
+ QDir projectDir(project->projectDirectory());
if (m_runConfiguration->mainScriptSource() == QmlProjectRunConfiguration::FileInProjectFile) {
const QString mainScriptInFilePath
@@ -172,7 +144,7 @@ void QmlProjectRunConfigurationWidget::updateFileComboBox()
m_fileListModel->appendRow(new QStandardItem(CURRENT_FILE));
QModelIndex currentIndex;
- QStringList sortedFiles = project->files();
+ QStringList sortedFiles = project->files(ProjectExplorer::Project::AllFiles);
// make paths relative to project directory
QStringList relativeFiles;
@@ -216,50 +188,12 @@ void QmlProjectRunConfigurationWidget::setMainScript(int index)
}
}
-void QmlProjectRunConfigurationWidget::onQtVersionSelectionChanged()
-{
- QVariant data = m_qtVersionComboBox->itemData(m_qtVersionComboBox->currentIndex());
- QTC_ASSERT(data.isValid() && data.canConvert(QVariant::Int), return);
- m_runConfiguration->setQtVersionId(data.toInt());
- m_runConfiguration->updateEnabled();
- m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment());
-}
-
void QmlProjectRunConfigurationWidget::onViewerArgsChanged()
{
if (QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender()))
m_runConfiguration->m_qmlViewerArgs = lineEdit->text();
}
-void QmlProjectRunConfigurationWidget::manageQtVersions()
-{
- ICore::showOptionsDialog(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
- QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID);
-}
-
-void QmlProjectRunConfigurationWidget::updateQtVersionComboBox()
-{
- m_qtVersionComboBox->clear();
-
- QtVersionManager *qtVersions = QtVersionManager::instance();
- foreach (QtSupport::BaseQtVersion *version, qtVersions->validVersions()) {
- if (m_runConfiguration->isValidVersion(version)) {
- m_qtVersionComboBox->addItem(version->displayName(), version->uniqueId());
- }
- }
-
- if (m_runConfiguration->m_qtVersionId != -1) {
- int index = m_qtVersionComboBox->findData(m_runConfiguration->m_qtVersionId);
- QTC_ASSERT(index >= 0, return);
- m_qtVersionComboBox->setCurrentIndex(index);
- } else {
- m_qtVersionComboBox->addItem(tr("Invalid Qt version"), -1);
- m_qtVersionComboBox->setCurrentIndex(0);
- }
- // Might have edited the qt version or changed e.g. the sysroot of a SymbianQtVersion
- m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment());
-}
-
void QmlProjectRunConfigurationWidget::userChangesChanged()
{
m_runConfiguration->setUserEnvironmentChanges(m_environmentWidget->userChanges());
@@ -270,6 +204,5 @@ void QmlProjectRunConfigurationWidget::userEnvironmentChangesChanged()
m_environmentWidget->setUserChanges(m_runConfiguration->userEnvironmentChanges());
}
-
} // namespace Internal
} // namespace QmlProjectManager
diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.h b/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.h
index 1bf02cdf88..5acbb95057 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.h
+++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.h
@@ -59,21 +59,17 @@ public:
explicit QmlProjectRunConfigurationWidget(QmlProjectRunConfiguration *rc);
public slots:
- void updateQtVersionComboBox();
void userEnvironmentChangesChanged();
void updateFileComboBox();
private slots:
void setMainScript(int index);
- void onQtVersionSelectionChanged();
void onViewerArgsChanged();
void userChangesChanged();
- void manageQtVersions();
private:
QmlProjectRunConfiguration *m_runConfiguration;
- QComboBox *m_qtVersionComboBox;
QComboBox *m_fileListCombo;
QStandardItemModel *m_fileListModel;
diff --git a/src/plugins/qmlprojectmanager/qmlprojecttarget.cpp b/src/plugins/qmlprojectmanager/qmlprojecttarget.cpp
deleted file mode 100644
index c520131433..0000000000
--- a/src/plugins/qmlprojectmanager/qmlprojecttarget.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "qmlprojecttarget.h"
-
-#include "qmlproject.h"
-#include "qmlprojectmanagerconstants.h"
-#include "qmlprojectrunconfiguration.h"
-
-#include <QDebug>
-#include <QApplication>
-#include <QStyle>
-
-namespace QmlProjectManager {
-namespace Internal {
-
-QmlProjectTarget::QmlProjectTarget(QmlProject *parent) :
- ProjectExplorer::Target(parent, Core::Id(Constants::QML_VIEWER_TARGET_ID))
-{
- setDisplayName(QApplication::translate("QmlProjectManager::QmlTarget",
- Constants::QML_VIEWER_TARGET_DISPLAY_NAME,
- "QML Viewer target display name"));
- setIcon(qApp->style()->standardIcon(QStyle::SP_ComputerIcon));
-}
-
-QmlProjectTarget::~QmlProjectTarget()
-{
-}
-
-ProjectExplorer::BuildConfigWidget *QmlProjectTarget::createConfigWidget()
-{
- return 0;
-}
-
-QmlProject *QmlProjectTarget::qmlProject() const
-{
- return static_cast<QmlProject *>(project());
-}
-
-ProjectExplorer::IBuildConfigurationFactory *QmlProjectTarget::buildConfigurationFactory(void) const
-{
- return 0;
-}
-
-bool QmlProjectTarget::fromMap(const QVariantMap &map)
-{
- if (!Target::fromMap(map))
- return false;
-
- if (runConfigurations().isEmpty()) {
- qWarning() << "Failed to restore run configuration of QML project!";
- return false;
- }
-
- setDisplayName(QApplication::translate("QmlProjectManager::QmlTarget",
- Constants::QML_VIEWER_TARGET_DISPLAY_NAME,
- "QML Viewer target display name"));
-
- return true;
-}
-
-QmlProjectTargetFactory::QmlProjectTargetFactory(QObject *parent) :
- ITargetFactory(parent)
-{
-}
-
-QmlProjectTargetFactory::~QmlProjectTargetFactory()
-{
-}
-
-bool QmlProjectTargetFactory::supportsTargetId(const Core::Id id) const
-{
- return id == Core::Id(Constants::QML_VIEWER_TARGET_ID);
-}
-
-QList<Core::Id> QmlProjectTargetFactory::supportedTargetIds() const
-{
- return QList<Core::Id>() << Core::Id(Constants::QML_VIEWER_TARGET_ID);
-}
-
-QString QmlProjectTargetFactory::displayNameForId(const Core::Id id) const
-{
- if (id == Core::Id(Constants::QML_VIEWER_TARGET_ID))
- return QCoreApplication::translate("QmlProjectManager::QmlTarget",
- Constants::QML_VIEWER_TARGET_DISPLAY_NAME,
- "QML Viewer target display name");
- return QString();
-}
-
-bool QmlProjectTargetFactory::canCreate(ProjectExplorer::Project *parent, const Core::Id id) const
-{
- if (!qobject_cast<QmlProject *>(parent))
- return false;
- return id == Core::Id(Constants::QML_VIEWER_TARGET_ID);
-}
-
-QmlProjectTarget *QmlProjectTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id)
-{
- if (!canCreate(parent, id))
- return 0;
- QmlProject *qmlproject(static_cast<QmlProject *>(parent));
- QmlProjectTarget *target = new QmlProjectTarget(qmlproject);
-
- // Add RunConfiguration (QML does not have BuildConfigurations)
- QmlProjectRunConfiguration *runConf = new QmlProjectRunConfiguration(target);
- target->addRunConfiguration(runConf);
-
- return target;
-}
-
-bool QmlProjectTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const
-{
- return canCreate(parent, ProjectExplorer::idFromMap(map));
-}
-
-QmlProjectTarget *QmlProjectTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map)
-{
- if (!canRestore(parent, map))
- return 0;
- QmlProject *qmlproject(static_cast<QmlProject *>(parent));
- QmlProjectTarget *target(new QmlProjectTarget(qmlproject));
- if (target->fromMap(map))
- return target;
- delete target;
- return 0;
-}
-
-} // namespace Internal
-} // namespace QmlProjectManager
diff --git a/src/plugins/qmlprojectmanager/qmlprojecttarget.h b/src/plugins/qmlprojectmanager/qmlprojecttarget.h
deleted file mode 100644
index 7359bb81fd..0000000000
--- a/src/plugins/qmlprojectmanager/qmlprojecttarget.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef QMLPROJECTTARGET_H
-#define QMLPROJECTTARGET_H
-
-#include <projectexplorer/target.h>
-
-#include <QStringList>
-#include <QVariantMap>
-
-namespace QmlProjectManager {
-class QmlProject;
-class QmlProjectRunConfiguration;
-
-namespace Internal {
-
-class QmlProjectTargetFactory;
-
-class QmlProjectTarget : public ProjectExplorer::Target
-{
- Q_OBJECT
- friend class QmlProjectTargetFactory;
-
-public:
- explicit QmlProjectTarget(QmlProject *parent);
- ~QmlProjectTarget();
-
- ProjectExplorer::BuildConfigWidget *createConfigWidget();
-
- QmlProject *qmlProject() const;
-
- ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
-
-protected:
- bool fromMap(const QVariantMap &map);
-};
-
-class QmlProjectTargetFactory : public ProjectExplorer::ITargetFactory
-{
- Q_OBJECT
-
-public:
- explicit QmlProjectTargetFactory(QObject *parent = 0);
- ~QmlProjectTargetFactory();
-
- bool supportsTargetId(const Core::Id id) const;
- QList<Core::Id> supportedTargetIds() const;
- QString displayNameForId(const Core::Id id) const;
-
- bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
- QmlProjectTarget *create(ProjectExplorer::Project *parent, const Core::Id id);
- bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
- QmlProjectTarget *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
-};
-
-} // namespace Internal
-} // namespace QmlProjectManager
-
-#endif // QMLPROJECTTARGET_H
diff --git a/src/plugins/qt4projectmanager/buildconfigurationinfo.h b/src/plugins/qt4projectmanager/buildconfigurationinfo.h
index 3deb409c6e..bfb4d2e711 100644
--- a/src/plugins/qt4projectmanager/buildconfigurationinfo.h
+++ b/src/plugins/qt4projectmanager/buildconfigurationinfo.h
@@ -34,56 +34,43 @@
#define BUILDCONFIGURATIONINFO_H
#include "qt4projectmanager_global.h"
+
#include <coreplugin/featureprovider.h>
#include <qtsupport/baseqtversion.h>
namespace Qt4ProjectManager {
-struct QT4PROJECTMANAGER_EXPORT BuildConfigurationInfo {
+
+class QT4PROJECTMANAGER_EXPORT BuildConfigurationInfo
+{
+public:
explicit BuildConfigurationInfo()
- : qtVersionId(-1), buildConfig(QtSupport::BaseQtVersion::QmakeBuildConfig(0)), importing(false), temporaryQtVersion(0)
- {}
+ : buildConfig(QtSupport::BaseQtVersion::QmakeBuildConfig(0)), importing(false)
+ { }
- explicit BuildConfigurationInfo(int v, QtSupport::BaseQtVersion::QmakeBuildConfigs bc,
+ explicit BuildConfigurationInfo(QtSupport::BaseQtVersion::QmakeBuildConfigs bc,
const QString &aa, const QString &d,
bool importing_ = false,
- QtSupport::BaseQtVersion *temporaryQtVersion_ = 0,
const QString &makefile_ = QString())
- : qtVersionId(v), buildConfig(bc),
+ : buildConfig(bc),
additionalArguments(aa), directory(d),
- importing(importing_), temporaryQtVersion(temporaryQtVersion_),
+ importing(importing_),
makefile(makefile_)
{ }
- bool isValid() const
- {
- return version() != 0;
- }
-
bool operator ==(const BuildConfigurationInfo &other) const
{
- return qtVersionId == other.qtVersionId
- && buildConfig == other.buildConfig
+ return buildConfig == other.buildConfig
&& additionalArguments == other.additionalArguments
&& directory == other.directory
&& importing == other.importing
- && temporaryQtVersion == other.temporaryQtVersion
&& makefile == other.makefile;
}
- QtSupport::BaseQtVersion *version() const;
- int qtVersionId;
QtSupport::BaseQtVersion::QmakeBuildConfigs buildConfig;
QString additionalArguments;
QString directory;
bool importing;
- QtSupport::BaseQtVersion *temporaryQtVersion;
QString makefile;
-
- static QList<BuildConfigurationInfo> importBuildConfigurations(const QString &proFilePath);
- static QList<BuildConfigurationInfo> checkForBuild(const QString &directory, const QString &proFilePath);
- static QList<BuildConfigurationInfo> filterBuildConfigurationInfos(const QList<BuildConfigurationInfo> &infos, Core::Id id);
- static QList<BuildConfigurationInfo> filterBuildConfigurationInfos(const QList<BuildConfigurationInfo> &infos, Core::FeatureSet features);
- static QList<BuildConfigurationInfo> filterBuildConfigurationInfosByPlatform(const QList<BuildConfigurationInfo> &infos, const QString &platform);
};
} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.cpp b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.cpp
index f0d92d995d..520091e3d6 100644
--- a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.cpp
+++ b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.cpp
@@ -35,6 +35,32 @@
#include "customwidgetpluginwizardpage.h"
#include "customwidgetwizard.h"
+#include <projectexplorer/devicesupport/idevice.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/profilemanager.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
+
+namespace {
+
+class DesktopQtProfileMatcher : public ProjectExplorer::ProfileMatcher
+{
+public:
+ bool matches(const ProjectExplorer::Profile *p) const
+ {
+ ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceProfileInformation::device(p);
+ if (dev.isNull() || dev->id() != Core::Id(ProjectExplorer::Constants::DESKTOP_DEVICE_ID))
+ return false;
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(p);
+ return version && version->type() == QtSupport::Constants::DESKTOPQT;
+ }
+};
+
+} // namespace
+
namespace Qt4ProjectManager {
namespace Internal {
@@ -54,8 +80,7 @@ CustomWidgetWizardDialog::CustomWidgetWizardDialog(const QString &templateName,
setIntroDescription(tr("This wizard generates a Qt4 Designer Custom Widget "
"or a Qt4 Designer Custom Widget Collection project."));
-
- addTargetSetupPage(BaseQt4ProjectWizardDialog::desktopTarget());
+ addTargetSetupPage();
m_widgetPageId = addPage(m_widgetsPage);
m_pluginPageId = addPage(m_pluginPage);
wizardProgress()->item(m_widgetPageId)->setTitle(tr("Custom Widgets"));
diff --git a/src/plugins/qt4projectmanager/externaleditors.cpp b/src/plugins/qt4projectmanager/externaleditors.cpp
index fc02094407..8c0ed398e4 100644
--- a/src/plugins/qt4projectmanager/externaleditors.cpp
+++ b/src/plugins/qt4projectmanager/externaleditors.cpp
@@ -32,13 +32,14 @@
#include "externaleditors.h"
#include "qt4project.h"
-#include "qt4target.h"
#include "qt4projectmanagerconstants.h"
#include "qt4buildconfiguration.h"
#include <utils/synchronousprocess.h>
#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/target.h>
#include <projectexplorer/session.h>
+#include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtversionmanager.h>
#include <designer/designerconstants.h>
@@ -142,12 +143,10 @@ bool ExternalQtEditor::getEditorLaunchData(const QString &fileName,
{
// Get the binary either from the current Qt version of the project or Path
if (const Qt4Project *project = qt4ProjectFor(fileName)) {
- if (const Qt4BaseTarget *target = project->activeTarget()) {
- if (const Qt4BuildConfiguration *qt4bc = target->activeQt4BuildConfiguration()) {
- if (const QtSupport::BaseQtVersion *qtVersion = qt4bc->qtVersion()) {
- data->binary = (qtVersion->*commandAccessor)();
- data->workingDirectory = project->projectDirectory();
- }
+ if (const ProjectExplorer::Target *target = project->activeTarget()) {
+ if (const QtSupport::BaseQtVersion *qtVersion = QtSupport::QtProfileInformation::qtVersion(target->profile())) {
+ data->binary = (qtVersion->*commandAccessor)();
+ data->workingDirectory = project->projectDirectory();
}
}
}
diff --git a/src/plugins/qt4projectmanager/makestep.cpp b/src/plugins/qt4projectmanager/makestep.cpp
index 2afc49d89a..400dbcc37b 100644
--- a/src/plugins/qt4projectmanager/makestep.cpp
+++ b/src/plugins/qt4projectmanager/makestep.cpp
@@ -34,18 +34,20 @@
#include "ui_makestep.h"
#include "qt4project.h"
-#include "qt4target.h"
#include "qt4nodes.h"
#include "qt4buildconfiguration.h"
#include "qt4projectmanagerconstants.h"
+#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/profileinformation.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcprocess.h>
#include <qtsupport/qtparser.h>
+#include <qtsupport/qtprofileinformation.h>
#include <QDir>
#include <QFileInfo>
@@ -152,11 +154,13 @@ bool MakeStep::init()
return false;
}
- if (!bc->toolChain()) {
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
+ if (!tc) {
m_tasks.append(ProjectExplorer::Task(ProjectExplorer::Task::Error,
- tr("Qt Creator needs a tool chain set up to build. Configure a tool chain in Project mode."),
+ tr("Qt Creator needs a tool chain set up to build. Configure a tool chain the profile options."),
Utils::FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
+ return false;
}
ProjectExplorer::ProcessParameters *pp = processParameters();
@@ -169,7 +173,7 @@ bool MakeStep::init()
workingDirectory = bc->buildDirectory();
pp->setWorkingDirectory(workingDirectory);
- QString makeCmd = bc->makeCommand();
+ QString makeCmd = tc->makeCommand();
if (!m_makeCmd.isEmpty())
makeCmd = m_makeCmd;
pp->setCommand(makeCmd);
@@ -181,8 +185,6 @@ bool MakeStep::init()
QString args;
- ProjectExplorer::ToolChain *toolchain = bc->toolChain();
-
Qt4ProjectManager::Qt4ProFileNode *subNode = bc->subNodeBuild();
if (subNode) {
QString makefile = subNode->makefile();
@@ -245,12 +247,11 @@ bool MakeStep::init()
// so we only do it for unix and if the user didn't override the make command
// but for now this is the least invasive change
// We also prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose
- ProjectExplorer::ToolChain *toolChain = bc->toolChain();
- if (toolChain && m_makeCmd.isEmpty()) {
- if (toolChain->targetAbi().binaryFormat() != ProjectExplorer::Abi::PEFormat )
+ if (tc && m_makeCmd.isEmpty()) {
+ if (tc->targetAbi().binaryFormat() != ProjectExplorer::Abi::PEFormat )
Utils::QtcProcess::addArg(&args, QLatin1String("-w"));
- if (toolChain->targetAbi().os() == ProjectExplorer::Abi::WindowsOS
- && toolChain->targetAbi().osFlavor() != ProjectExplorer::Abi::WindowsMSysFlavor) {
+ if (tc->targetAbi().os() == ProjectExplorer::Abi::WindowsOS
+ && tc->targetAbi().osFlavor() != ProjectExplorer::Abi::WindowsMSysFlavor) {
const QString makeFlags = QLatin1String("MAKEFLAGS");
env.set(makeFlags, QLatin1Char('L') + env.value(makeFlags));
}
@@ -260,20 +261,21 @@ bool MakeStep::init()
pp->setArguments(args);
ProjectExplorer::IOutputParser *parser = 0;
- if (bc->qtVersion())
- parser = bc->qtVersion()->createOutputParser();
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
+ if (version)
+ parser = version->createOutputParser();
if (parser)
parser->appendOutputParser(new QtSupport::QtParser);
else
parser = new QtSupport::QtParser;
- if (toolchain)
- parser->appendOutputParser(toolchain->outputParser());
+ if (tc)
+ parser->appendOutputParser(tc->outputParser());
parser->setWorkingDirectory(workingDirectory);
setOutputParser(parser);
- m_scriptTarget = (bc->qt4Target()->qt4Project()->rootQt4ProjectNode()->projectType() == ScriptTemplate);
+ m_scriptTarget = (static_cast<Qt4Project *>(bc->target()->project())->rootQt4ProjectNode()->projectType() == ScriptTemplate);
return AbstractProcessStep::init();
}
@@ -351,7 +353,6 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
m_ui->makePathChooser->setPath(makeCmd);
m_ui->makeArgumentsLineEdit->setText(m_makeStep->userArguments());
- updateMakeOverrideLabel();
updateDetails();
connect(m_ui->makePathChooser, SIGNAL(changed(QString)),
@@ -365,7 +366,7 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
ProjectExplorer::BuildConfiguration *bc = makeStep->buildConfiguration();
if (!bc) {
// That means the step is in the deploylist, so we listen to the active build config
- // changed signal and update various things in return
+ // changed signal and react to the buildDirectoryChanged() signal of the buildconfiguration
bc = makeStep->target()->activeBuildConfiguration();
m_bc = bc;
connect (makeStep->target(), SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
@@ -375,17 +376,11 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
if (bc) {
connect(bc, SIGNAL(buildDirectoryChanged()),
this, SLOT(updateDetails()));
- connect(bc, SIGNAL(toolChainChanged()),
- this, SLOT(updateDetails()));
-
- connect(bc, SIGNAL(qtVersionChanged()),
- this, SLOT(qtVersionChanged()));
}
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
- this, SLOT(updateMakeOverrideLabel()));
- connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
this, SLOT(updateDetails()));
+ connect(m_makeStep->target(), SIGNAL(profileChanged()), this, SLOT(updateDetails()));
}
void MakeStepConfigWidget::activeBuildConfigurationChanged()
@@ -393,62 +388,55 @@ void MakeStepConfigWidget::activeBuildConfigurationChanged()
if (m_bc) {
disconnect(m_bc, SIGNAL(buildDirectoryChanged()),
this, SLOT(updateDetails()));
- disconnect(m_bc, SIGNAL(toolChainChanged()),
- this, SLOT(updateDetails()));
-
- disconnect(m_bc, SIGNAL(qtVersionChanged()),
- this, SLOT(qtVersionChanged()));
}
m_bc = m_makeStep->target()->activeBuildConfiguration();
- updateMakeOverrideLabel();
updateDetails();
if (m_bc) {
connect(m_bc, SIGNAL(buildDirectoryChanged()),
this, SLOT(updateDetails()));
- connect(m_bc, SIGNAL(toolChainChanged()),
- this, SLOT(updateDetails()));
-
- connect(m_bc, SIGNAL(qtVersionChanged()),
- this, SLOT(qtVersionChanged()));
}
}
-MakeStepConfigWidget::~MakeStepConfigWidget()
+void MakeStepConfigWidget::setSummaryText(const QString &text)
{
- delete m_ui;
+ if (text == m_summaryText)
+ return;
+ m_summaryText = text;
+ emit updateSummary();
}
-void MakeStepConfigWidget::qtVersionChanged()
+MakeStepConfigWidget::~MakeStepConfigWidget()
{
- updateMakeOverrideLabel();
- updateDetails();
+ delete m_ui;
}
-void MakeStepConfigWidget::updateMakeOverrideLabel()
+void MakeStepConfigWidget::updateDetails()
{
- Qt4BuildConfiguration *bc = m_makeStep->qt4BuildConfiguration();
- if (!bc)
- bc = qobject_cast<Qt4BuildConfiguration *>(m_makeStep->target()->activeBuildConfiguration());
- if (bc)
- m_ui->makeLabel->setText(tr("Override %1:").arg(bc->makeCommand()));
+ ProjectExplorer::ToolChain *tc
+ = ProjectExplorer::ToolChainProfileInformation::toolChain(m_makeStep->target()->profile());
+ if (tc)
+ m_ui->makeLabel->setText(tr("Override %1:").arg(tc->makeCommand()));
else
m_ui->makeLabel->setText(tr("Make:"));
-}
-void MakeStepConfigWidget::updateDetails()
-{
+ if (!tc) {
+ setSummaryText(tr("<b>Make:</b> No tool chain set in profile."));
+ return;
+ }
Qt4BuildConfiguration *bc = m_makeStep->qt4BuildConfiguration();
if (!bc)
bc = qobject_cast<Qt4BuildConfiguration *>(m_makeStep->target()->activeBuildConfiguration());
- if (!bc)
- m_summaryText = tr("No Qt4 build configuration."); // Can't happen
+ if (!bc) {
+ setSummaryText(tr("<b>Make:</b> No Qt4 build configuration."));
+ return;
+ }
ProjectExplorer::ProcessParameters param;
param.setMacroExpander(bc->macroExpander());
param.setWorkingDirectory(bc->buildDirectory());
- QString makeCmd = bc->makeCommand();
+ QString makeCmd = tc->makeCommand();
if (!m_makeStep->makeCommand().isEmpty())
makeCmd = m_makeStep->makeCommand();
param.setCommand(makeCmd);
@@ -469,23 +457,22 @@ void MakeStepConfigWidget::updateDetails()
// so we only do it for unix and if the user didn't override the make command
// but for now this is the least invasive change
// We also prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose
- ProjectExplorer::ToolChain *toolChain = bc->toolChain();
- if (toolChain && m_makeStep->makeCommand().isEmpty()) {
- if (toolChain->targetAbi().binaryFormat() != ProjectExplorer::Abi::PEFormat )
+ if (tc && m_makeStep->makeCommand().isEmpty()) {
+ if (tc->targetAbi().binaryFormat() != ProjectExplorer::Abi::PEFormat )
Utils::QtcProcess::addArg(&args, QLatin1String("-w"));
- if (toolChain->targetAbi().os() == ProjectExplorer::Abi::WindowsOS
- && toolChain->targetAbi().osFlavor() != ProjectExplorer::Abi::WindowsMSysFlavor) {
+ if (tc->targetAbi().os() == ProjectExplorer::Abi::WindowsOS
+ && tc->targetAbi().osFlavor() != ProjectExplorer::Abi::WindowsMSysFlavor) {
const QString makeFlags = QLatin1String("MAKEFLAGS");
env.set(makeFlags, QLatin1Char('L') + env.value(makeFlags));
}
}
param.setArguments(args);
param.setEnvironment(env);
- m_summaryText = param.summaryInWorkdir(displayName());
if (param.commandMissing())
- m_summaryText = tr("<b>Make:</b> %1 not found in the environment.").arg(makeCmd); // Override display text
- emit updateSummary();
+ setSummaryText(tr("<b>Make:</b> %1 not found in the environment.").arg(makeCmd)); // Override display text
+ else
+ setSummaryText(param.summaryInWorkdir(displayName()));
}
QString MakeStepConfigWidget::summaryText() const
diff --git a/src/plugins/qt4projectmanager/makestep.h b/src/plugins/qt4projectmanager/makestep.h
index b902b8b5c7..64662e83d7 100644
--- a/src/plugins/qt4projectmanager/makestep.h
+++ b/src/plugins/qt4projectmanager/makestep.h
@@ -136,12 +136,12 @@ private slots:
void makeEdited();
void makeArgumentsLineEdited();
- void updateMakeOverrideLabel();
void updateDetails();
void userArgumentsChanged();
- void qtVersionChanged();
void activeBuildConfigurationChanged();
private:
+ void setSummaryText(const QString &text);
+
Internal::Ui::MakeStep *m_ui;
MakeStep *m_makeStep;
QString m_summaryText;
diff --git a/src/plugins/qt4projectmanager/qmakeprofileconfigwidget.cpp b/src/plugins/qt4projectmanager/qmakeprofileconfigwidget.cpp
new file mode 100644
index 0000000000..bfb8439296
--- /dev/null
+++ b/src/plugins/qt4projectmanager/qmakeprofileconfigwidget.cpp
@@ -0,0 +1,89 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "qmakeprofileconfigwidget.h"
+
+#include "qt4projectmanagerconstants.h"
+#include "qmakeprofileinformation.h"
+
+#include <coreplugin/icore.h>
+#include <projectexplorer/projectexplorerconstants.h>
+
+#include <QHBoxLayout>
+#include <QLineEdit>
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+QmakeProfileConfigWidget::QmakeProfileConfigWidget(ProjectExplorer::Profile *p,
+ QWidget *parent) :
+ ProjectExplorer::ProfileConfigWidget(parent),
+ m_profile(p),
+ m_lineEdit(new QLineEdit)
+{
+ QHBoxLayout *layout = new QHBoxLayout(this);
+ layout->setMargin(0);
+
+ m_lineEdit->setContentsMargins(0, 0, 0, 0);
+ layout->addWidget(m_lineEdit);
+
+ discard(); // set up everything according to profile
+ connect(m_lineEdit, SIGNAL(textEdited(QString)), this, SIGNAL(dirty()));
+}
+
+QString QmakeProfileConfigWidget::displayName() const
+{
+ return tr("Mkspec:");
+}
+
+void QmakeProfileConfigWidget::makeReadOnly()
+{
+ m_lineEdit->setEnabled(false);
+}
+
+void QmakeProfileConfigWidget::apply()
+{
+ QmakeProfileInformation::setMkspec(m_profile, Utils::FileName::fromString(m_lineEdit->text()));
+}
+
+void QmakeProfileConfigWidget::discard()
+{
+ m_lineEdit->setText(QmakeProfileInformation::mkspec(m_profile).toString());
+}
+
+bool QmakeProfileConfigWidget::isDirty() const
+{
+ return m_lineEdit->text() != QmakeProfileInformation::mkspec(m_profile).toString();
+}
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortarget.h b/src/plugins/qt4projectmanager/qmakeprofileconfigwidget.h
index 0815c724fc..b4bda7b1b0 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortarget.h
+++ b/src/plugins/qt4projectmanager/qmakeprofileconfigwidget.h
@@ -30,38 +30,43 @@
**
**************************************************************************/
-#ifndef QT4SIMULATORTARGET_H
-#define QT4SIMULATORTARGET_H
+#ifndef QT4PM_QMAKEPROFILECONFIGWIDGET_H
+#define QT4PM_QMAKEPROFILECONFIGWIDGET_H
-#include "qt4target.h"
+#include <projectexplorer/profileconfigwidget.h>
-namespace Qt4ProjectManager {
+QT_FORWARD_DECLARE_CLASS(QLineEdit)
+
+namespace ProjectExplorer { class Profile; }
-class Qt4Project;
-class Qt4BuildConfigurationFactory;
+namespace Qt4ProjectManager {
+class BaseQtVersion;
namespace Internal {
-class Qt4SimulatorTarget : public Qt4BaseTarget
+class QmakeProfileConfigWidget : public ProjectExplorer::ProfileConfigWidget
{
- friend class Qt4SimulatorTargetFactory;
Q_OBJECT
+
public:
- Qt4SimulatorTarget(Qt4Project *parent, const Core::Id id);
- ~Qt4SimulatorTarget();
+ QmakeProfileConfigWidget(ProjectExplorer::Profile *p, QWidget *parent = 0);
- ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
+ QString displayName() const;
- void createApplicationProFiles(bool reparse);
- QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
+ void makeReadOnly();
- static QString defaultDisplayName();
+ void apply();
+ void discard();
+ bool isDirty() const;
private:
- Qt4BuildConfigurationFactory *m_buildConfigurationFactory;
+ int findQtVersion(const int id) const;
+
+ ProjectExplorer::Profile *m_profile;
+ QLineEdit *m_lineEdit;
};
} // namespace Internal
-} // namespace Qt4ProjectManager
+} // namespace Debugger
-#endif // QT4SIMULATORTARGET_H
+#endif // QT4PM_QMAKEPROFILECONFIGWIDGET_H
diff --git a/src/plugins/qt4projectmanager/qmakeprofileinformation.cpp b/src/plugins/qt4projectmanager/qmakeprofileinformation.cpp
new file mode 100644
index 0000000000..348e939c31
--- /dev/null
+++ b/src/plugins/qt4projectmanager/qmakeprofileinformation.cpp
@@ -0,0 +1,123 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "qmakeprofileinformation.h"
+
+#include "qmakeprofileinformation.h"
+#include "qmakeprofileconfigwidget.h"
+
+#include <projectexplorer/projectexplorerconstants.h>
+
+#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtprofileinformation.h>
+
+namespace Qt4ProjectManager {
+namespace Internal {
+const char MKSPEC_INFORMATION[] = "QtPM4.mkSpecInformation";
+} // namespace Internal
+
+QmakeProfileInformation::QmakeProfileInformation()
+{
+ setObjectName(QLatin1String("QmakeProfileInformation"));
+}
+
+Core::Id QmakeProfileInformation::dataId() const
+{
+ static Core::Id id = Core::Id(Internal::MKSPEC_INFORMATION);
+ return id;
+}
+
+unsigned int QmakeProfileInformation::priority() const
+{
+ return 24000;
+}
+
+QVariant QmakeProfileInformation::defaultValue(ProjectExplorer::Profile *p) const
+{
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(p);
+ if (!version) // No version, so no qmake
+ return QString();
+
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
+
+ const QList<Utils::FileName> tcSpecList = tc ? tc->suggestedMkspecList() : QList<Utils::FileName>();
+ foreach (const Utils::FileName &tcSpec, tcSpecList) {
+ if (version->hasMkspec(tcSpec))
+ return tcSpec.toString();
+ }
+
+ return version ? version->mkspec().toString() : QString();
+}
+
+QList<ProjectExplorer::Task> QmakeProfileInformation::validate(ProjectExplorer::Profile *p) const
+{
+ QList<ProjectExplorer::Task> result;
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(p);
+
+ Utils::FileName mkspec = QmakeProfileInformation::mkspec(p);
+ if (!version && !mkspec.isEmpty())
+ result << ProjectExplorer::Task(ProjectExplorer::Task::Warning,
+ tr("No Qt version set, so mkspec is ignored."),
+ Utils::FileName(), -1,
+ Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
+ if (version && !version->hasMkspec(mkspec))
+ result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
+ tr("Mkspec not found for Qt version."),
+ Utils::FileName(), -1,
+ Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
+ return result;
+}
+
+ProjectExplorer::ProfileConfigWidget *
+QmakeProfileInformation::createConfigWidget(ProjectExplorer::Profile *p) const
+{
+ return new Internal::QmakeProfileConfigWidget(p);
+}
+
+ProjectExplorer::ProfileInformation::ItemList QmakeProfileInformation::toUserOutput(ProjectExplorer::Profile *p) const
+{
+ return ItemList() << qMakePair(tr("mkspec"), mkspec(p).toUserOutput());
+}
+
+Utils::FileName QmakeProfileInformation::mkspec(const ProjectExplorer::Profile *p)
+{
+ if (!p)
+ return Utils::FileName();
+ return Utils::FileName::fromString(p->value(Core::Id(Internal::MKSPEC_INFORMATION)).toString());
+}
+
+void QmakeProfileInformation::setMkspec(ProjectExplorer::Profile *p, const Utils::FileName &fn)
+{
+ p->setValue(Core::Id(Internal::MKSPEC_INFORMATION), fn.toString());
+}
+
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qmakeprofileinformation.h b/src/plugins/qt4projectmanager/qmakeprofileinformation.h
new file mode 100644
index 0000000000..013f102e49
--- /dev/null
+++ b/src/plugins/qt4projectmanager/qmakeprofileinformation.h
@@ -0,0 +1,67 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef QT4PM_QMAKEPROFILEINFORMATION_H
+#define QT4PM_QMAKEPROFILEINFORMATION_H
+
+#include "qt4projectmanager_global.h"
+
+#include <projectexplorer/profilemanager.h>
+
+namespace Qt4ProjectManager {
+
+class QT4PROJECTMANAGER_EXPORT QmakeProfileInformation : public ProjectExplorer::ProfileInformation
+{
+ Q_OBJECT
+
+public:
+ QmakeProfileInformation();
+
+ Core::Id dataId() const;
+
+ unsigned int priority() const; // the higher the closer to the top.
+
+ QVariant defaultValue(ProjectExplorer::Profile *p) const;
+
+ QList<ProjectExplorer::Task> validate(ProjectExplorer::Profile *p) const;
+
+ ProjectExplorer::ProfileConfigWidget *createConfigWidget(ProjectExplorer::Profile *p) const;
+
+ ItemList toUserOutput(ProjectExplorer::Profile *p) const;
+
+ static Utils::FileName mkspec(const ProjectExplorer::Profile *p);
+ static void setMkspec(ProjectExplorer::Profile *p, const Utils::FileName &fn);
+};
+
+} // namespace Qt4ProjectManager
+
+#endif // QT4PM_QMAKEPROFILEINFORMATION_H
diff --git a/src/plugins/qt4projectmanager/qmakerunconfigurationfactory.cpp b/src/plugins/qt4projectmanager/qmakerunconfigurationfactory.cpp
new file mode 100644
index 0000000000..4844d237eb
--- /dev/null
+++ b/src/plugins/qt4projectmanager/qmakerunconfigurationfactory.cpp
@@ -0,0 +1,73 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "qmakerunconfigurationfactory.h"
+
+#include <extensionsystem/pluginmanager.h>
+#include <projectexplorer/target.h>
+#include <qtsupport/customexecutablerunconfiguration.h>
+
+namespace Qt4ProjectManager {
+
+QmakeRunConfigurationFactory::QmakeRunConfigurationFactory(QObject *parent) :
+ ProjectExplorer::IRunConfigurationFactory(parent)
+{ }
+
+QmakeRunConfigurationFactory *QmakeRunConfigurationFactory::find(ProjectExplorer::Target *t)
+{
+ if (!t)
+ return 0;
+
+ QList<QmakeRunConfigurationFactory *> factories
+ = ExtensionSystem::PluginManager::instance()->getObjects<QmakeRunConfigurationFactory>();
+ foreach (QmakeRunConfigurationFactory *factory, factories) {
+ if (factory->canHandle(t))
+ return factory;
+ }
+ return 0;
+}
+
+void QmakeRunConfigurationFactory::removeUnconfiguredCustomExectutableRunConfigurations(ProjectExplorer::Target *t)
+{
+ QList<ProjectExplorer::RunConfiguration*> toRemove;
+ // Remove all run configurations which the new project wizard created
+ foreach (ProjectExplorer::RunConfiguration * rc, t->runConfigurations()) {
+ QtSupport::CustomExecutableRunConfiguration *cerc
+ = qobject_cast<QtSupport::CustomExecutableRunConfiguration *>(rc);
+ if (cerc && !cerc->isConfigured())
+ toRemove.append(rc);
+ }
+ foreach (ProjectExplorer::RunConfiguration *rc, toRemove)
+ t->removeRunConfiguration(rc);
+}
+
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantarget.h b/src/plugins/qt4projectmanager/qmakerunconfigurationfactory.h
index 1b356a5dde..373341b922 100644
--- a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantarget.h
+++ b/src/plugins/qt4projectmanager/qmakerunconfigurationfactory.h
@@ -30,41 +30,34 @@
**
**************************************************************************/
-#ifndef QT4SYMBIANTARGET_H
-#define QT4SYMBIANTARGET_H
+#ifndef QMAKERUNCONFIGURATIONFACTORY_H
+#define QMAKERUNCONFIGURATIONFACTORY_H
-#include "qt4target.h"
+#include "qt4projectmanager_global.h"
-#include <QPixmap>
+#include <projectexplorer/runconfiguration.h>
-namespace Qt4ProjectManager {
-class Qt4Project;
-class Qt4BuildConfigurationFactory;
-namespace Internal {
+namespace ProjectExplorer { class Node; }
+namespace Qt4ProjectManager {
-class Qt4SymbianTarget : public Qt4BaseTarget
+class QT4PROJECTMANAGER_EXPORT QmakeRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
{
- friend class Qt4SymbianTargetFactory; // for from Map
Q_OBJECT
-public:
- Qt4SymbianTarget(Qt4Project *parent, const Core::Id id);
- ~Qt4SymbianTarget();
- ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
+public:
+ explicit QmakeRunConfigurationFactory(QObject *parent = 0);
- void createApplicationProFiles(bool reparse);
- virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
+ virtual bool canHandle(ProjectExplorer::Target *t) const = 0;
+ virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
+ ProjectExplorer::Node *n) = 0;
- static QString defaultDisplayName(const Core::Id id);
- static QIcon iconForId(Core::Id id);
+ static QmakeRunConfigurationFactory *find(ProjectExplorer::Target *t);
protected:
- ProjectExplorer::IDevice::ConstPtr currentDevice() const;
-
-private:
- Qt4BuildConfigurationFactory *m_buildConfigurationFactory;
+ void removeUnconfiguredCustomExectutableRunConfigurations(ProjectExplorer::Target *t);
};
-} // namespace Internal
-} // namespace Qt4ProjectManager
-#endif // QT4SYMBIANTARGET_H
+
+} // Qt4ProjectManager
+
+#endif // QMAKERUNCONFIGURATIONFACTORY_H
diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp
index 365be43db7..4af5f7de27 100644
--- a/src/plugins/qt4projectmanager/qmakestep.cpp
+++ b/src/plugins/qt4projectmanager/qmakestep.cpp
@@ -39,19 +39,21 @@
#include "qt4project.h"
#include "qt4projectmanagerconstants.h"
#include "qt4projectmanager.h"
-#include "qt4target.h"
+#include "qmakeprofileinformation.h"
#include "qt4nodes.h"
-#include "qt4basetargetfactory.h"
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <coreplugin/icore.h>
#include <coreplugin/mainwindow.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/messagemanager.h>
+#include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtversionmanager.h>
#include <qtsupport/debugginghelperbuildtask.h>
#include <utils/qtcassert.h>
@@ -169,9 +171,9 @@ QString QMakeStep::allArguments(bool shorted)
/// QMAKE_VAR_QMLJSDEBUGGER_PATH
QStringList QMakeStep::deducedArguments()
{
- Qt4BuildConfiguration *bc = qt4BuildConfiguration();
QStringList arguments;
- ProjectExplorer::ToolChain *tc = bc->toolChain();
+ ProjectExplorer::ToolChain *tc
+ = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
ProjectExplorer::Abi targetAbi;
if (tc)
targetAbi = tc->targetAbi();
@@ -197,16 +199,16 @@ QStringList QMakeStep::deducedArguments()
}
}
- const QtSupport::BaseQtVersion *qtVersion = bc->qtVersion();
- if (linkQmlDebuggingLibrary() && qtVersion) {
- if (!qtVersion->needsQmlDebuggingLibrary()) {
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
+ if (linkQmlDebuggingLibrary() && version) {
+ if (!version->needsQmlDebuggingLibrary()) {
// This Qt version has the QML debugging services built in, however
// they still need to be enabled at compile time
- arguments << (qtVersion->qtVersion().majorVersion >= 5 ?
+ arguments << (version->qtVersion().majorVersion >= 5 ?
QLatin1String(Constants::QMAKEVAR_DECLARATIVE_DEBUG5) :
QLatin1String(Constants::QMAKEVAR_DECLARATIVE_DEBUG4));
} else {
- const QString qmlDebuggingHelperLibrary = qtVersion->qmlDebuggingHelperLibrary(true);
+ const QString qmlDebuggingHelperLibrary = version->qmlDebuggingHelperLibrary(true);
if (!qmlDebuggingHelperLibrary.isEmpty()) {
// Do not turn debugger path into native path separators: Qmake does not like that!
const QString debuggingHelperPath
@@ -225,8 +227,8 @@ QStringList QMakeStep::deducedArguments()
/// -after OBJECTS_DIR, MOC_DIR, UI_DIR, RCC_DIR
QStringList QMakeStep::deducedArgumentsAfter()
{
- Qt4BuildConfiguration *bc = qt4BuildConfiguration();
- if (bc->qtVersion() && !bc->qtVersion()->supportsShadowBuilds()) {
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
+ if (version && version->supportsShadowBuilds()) {
// We have a target which does not allow shadow building.
// But we really don't want to have the build artefacts in the source dir
// so we try to hack around it, to make the common cases work.
@@ -244,7 +246,7 @@ QStringList QMakeStep::deducedArgumentsAfter()
bool QMakeStep::init()
{
Qt4BuildConfiguration *qt4bc = qt4BuildConfiguration();
- const QtSupport::BaseQtVersion *qtVersion = qt4bc->qtVersion();
+ const QtSupport::BaseQtVersion *qtVersion = QtSupport::QtProfileInformation::qtVersion(target()->profile());
if (!qtVersion)
return false;
@@ -262,11 +264,10 @@ bool QMakeStep::init()
QString makefile = workingDirectory;
if (qt4bc->subNodeBuild()) {
- if (!qt4bc->subNodeBuild()->makefile().isEmpty()) {
+ if (!qt4bc->subNodeBuild()->makefile().isEmpty())
makefile.append(qt4bc->subNodeBuild()->makefile());
- } else {
+ else
makefile.append(QLatin1String("/Makefile"));
- }
} else if (!qt4bc->makefile().isEmpty()) {
makefile.append(QLatin1Char('/'));
makefile.append(qt4bc->makefile());
@@ -275,14 +276,7 @@ bool QMakeStep::init()
}
// Check whether we need to run qmake
- bool makefileOutDated = true;
- if (QFileInfo(makefile).exists()) {
- Utils::FileName qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
- if (qtVersion->qmakeCommand() == qmakePath) {
- makefileOutDated = !qt4bc->compareToImportFrom(makefile);
- }
- }
-
+ bool makefileOutDated = (qt4bc->compareToImportFrom(makefile) != Qt4BuildConfiguration::MakefileMatches);
if (m_forced || makefileOutDated)
m_needToRunQMake = true;
m_forced = false;
@@ -296,16 +290,12 @@ bool QMakeStep::init()
setOutputParser(new QMakeParser);
- Qt4ProFileNode *node = qt4bc->qt4Target()->qt4Project()->rootQt4ProjectNode();
+ Qt4ProFileNode *node = static_cast<Qt4Project *>(qt4bc->target()->project())->rootQt4ProjectNode();
if (qt4bc->subNodeBuild())
node = qt4bc->subNodeBuild();
QString proFile = node->path();
- QtSupport::BaseQtVersion *version = qt4BuildConfiguration()->qtVersion();
- m_tasks = version->reportIssues(proFile, workingDirectory);
-
- foreach (Qt4BaseTargetFactory *factory, Qt4BaseTargetFactory::qt4BaseTargetFactoriesForIds(version->supportedTargetIds().toList()))
- m_tasks.append(factory->reportIssues(proFile));
+ m_tasks = qtVersion->reportIssues(proFile, workingDirectory);
qSort(m_tasks);
m_scriptTemplate = node->projectType() == ScriptTemplate;
@@ -387,12 +377,12 @@ void QMakeStep::setUserArguments(const QString &arguments)
emit userArgumentsChanged();
qt4BuildConfiguration()->emitQMakeBuildConfigurationChanged();
- qt4BuildConfiguration()->emitProFileEvaluateNeeded();
+ qt4BuildConfiguration()->emitEvaluateBuildSystem();
}
bool QMakeStep::isQmlDebuggingLibrarySupported(QString *reason) const
{
- QtSupport::BaseQtVersion *version = qt4BuildConfiguration()->qtVersion();
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
if (!version) {
if (reason)
*reason = tr("No Qt version.");
@@ -403,7 +393,7 @@ bool QMakeStep::isQmlDebuggingLibrarySupported(QString *reason) const
return true;
if (!version->qtAbis().isEmpty()) {
- ProjectExplorer::Abi abi = qt4BuildConfiguration()->qtVersion()->qtAbis().first();
+ ProjectExplorer::Abi abi = version->qtAbis().first();
if (abi.osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor) {
if (reason)
reason->clear();
@@ -449,7 +439,7 @@ void QMakeStep::setLinkQmlDebuggingLibrary(bool enable)
emit linkQmlDebuggingLibraryChanged();
qt4BuildConfiguration()->emitQMakeBuildConfigurationChanged();
- qt4BuildConfiguration()->emitProFileEvaluateNeeded();
+ qt4BuildConfiguration()->emitEvaluateBuildSystem();
}
QStringList QMakeStep::parserArguments()
@@ -468,7 +458,6 @@ QString QMakeStep::userArguments()
Utils::FileName QMakeStep::mkspec()
{
- Qt4BuildConfiguration *bc = qt4BuildConfiguration();
QString additionalArguments = m_userArgs;
for (Utils::QtcProcess::ArgIterator ait(&additionalArguments); ait.next(); ) {
if (ait.value() == QLatin1String("-spec")) {
@@ -477,7 +466,7 @@ Utils::FileName QMakeStep::mkspec()
}
}
- return static_cast<Qt4BaseTarget *>(target())->mkspec(bc);
+ return Qt4ProjectManager::QmakeProfileInformation::mkspec(target()->profile());
}
QVariantMap QMakeStep::toMap() const
@@ -538,14 +527,9 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
this, SLOT(userArgumentsChanged()));
connect(step, SIGNAL(linkQmlDebuggingLibraryChanged()),
this, SLOT(linkQmlDebuggingLibraryChanged()));
- connect(step->qt4BuildConfiguration(), SIGNAL(qtVersionChanged()),
- this, SLOT(qtVersionChanged()));
- connect(step->qt4BuildConfiguration(), SIGNAL(toolChainChanged()),
- this, SLOT(qtVersionChanged()));
connect(step->qt4BuildConfiguration(), SIGNAL(qmakeBuildConfigurationChanged()),
this, SLOT(qmakeBuildConfigChanged()));
- connect(QtSupport::QtVersionManager::instance(), SIGNAL(dumpUpdatedFor(Utils::FileName)),
- this, SLOT(qtVersionsDumpUpdated(Utils::FileName)));
+ connect(step->target(), SIGNAL(profileChanged()), this, SLOT(qtVersionChanged()));
}
QMakeStepConfigWidget::~QMakeStepConfigWidget()
@@ -575,13 +559,6 @@ void QMakeStepConfigWidget::qtVersionChanged()
updateQmlDebuggingOption();
}
-void QMakeStepConfigWidget::qtVersionsDumpUpdated(const Utils::FileName &qmakeCommand)
-{
- QtSupport::BaseQtVersion *version = m_step->qt4BuildConfiguration()->qtVersion();
- if (version && version->qmakeCommand() == qmakeCommand)
- qtVersionChanged();
-}
-
void QMakeStepConfigWidget::qmakeBuildConfigChanged()
{
Qt4BuildConfiguration *bc = m_step->qt4BuildConfiguration();
@@ -666,12 +643,14 @@ void QMakeStepConfigWidget::linkQmlDebuggingLibraryChecked(bool checked)
void QMakeStepConfigWidget::buildQmlDebuggingHelper()
{
- QtSupport::BaseQtVersion *version = m_step->qt4BuildConfiguration()->qtVersion();
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(m_step->target()->profile());
if (!version)
return;
+ ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(m_step->target()->profile());
+
QtSupport::DebuggingHelperBuildTask *buildTask =
- new QtSupport::DebuggingHelperBuildTask(version, m_step->qt4BuildConfiguration()->toolChain(),
+ new QtSupport::DebuggingHelperBuildTask(version, tc,
QtSupport::DebuggingHelperBuildTask::QmlDebugging);
// pop up Application Output on error
@@ -685,8 +664,7 @@ void QMakeStepConfigWidget::buildQmlDebuggingHelper()
void QMakeStepConfigWidget::updateSummaryLabel()
{
- Qt4BuildConfiguration *qt4bc = m_step->qt4BuildConfiguration();
- QtSupport::BaseQtVersion *qtVersion = qt4bc->qtVersion();
+ QtSupport::BaseQtVersion *qtVersion = QtSupport::QtProfileInformation::qtVersion(m_step->target()->profile());
if (!qtVersion) {
setSummaryText(tr("<b>qmake:</b> No Qt version set. Cannot run qmake."));
return;
@@ -696,15 +674,6 @@ void QMakeStepConfigWidget::updateSummaryLabel()
// And we only use the .pro filename not the full path
QString program = qtVersion->qmakeCommand().toFileInfo().fileName();
setSummaryText(tr("<b>qmake:</b> %1 %2").arg(program, args));
-
- ToolChain *tc = qt4bc->toolChain();
- if (!tc)
- return;
- QList<Utils::FileName> tcSpecList = tc->mkspecList();
- if (!tcSpecList.isEmpty() && !tcSpecList.contains(m_step->mkspec()))
- setAdditionalSummaryText(tr("<b>Warning:</b> The tool chain suggests using another mkspec."));
- else
- setAdditionalSummaryText(QString());
}
void QMakeStepConfigWidget::updateQmlDebuggingOption()
@@ -725,8 +694,7 @@ void QMakeStepConfigWidget::updateQmlDebuggingOption()
void QMakeStepConfigWidget::updateEffectiveQMakeCall()
{
- Qt4BuildConfiguration *qt4bc = m_step->qt4BuildConfiguration();
- QtSupport::BaseQtVersion *qtVersion = qt4bc->qtVersion();
+ QtSupport::BaseQtVersion *qtVersion = QtSupport::QtProfileInformation::qtVersion(m_step->target()->profile());
QString program = tr("<No Qt version>");
if (qtVersion)
program = qtVersion->qmakeCommand().toFileInfo().fileName();
@@ -758,14 +726,6 @@ void QMakeStepConfigWidget::setSummaryText(const QString &text)
emit updateSummary();
}
-void QMakeStepConfigWidget::setAdditionalSummaryText(const QString &text)
-{
- if (text == m_additionalSummaryText)
- return;
- m_additionalSummaryText = text;
- emit updateAdditionalSummary();
-}
-
////
// QMakeStepFactory
////
diff --git a/src/plugins/qt4projectmanager/qmakestep.h b/src/plugins/qt4projectmanager/qmakestep.h
index 4483c4b474..69f7fdea5f 100644
--- a/src/plugins/qt4projectmanager/qmakestep.h
+++ b/src/plugins/qt4projectmanager/qmakestep.h
@@ -151,7 +151,6 @@ public:
private slots:
// slots for handling buildconfiguration/step signals
void qtVersionChanged();
- void qtVersionsDumpUpdated(const Utils::FileName &qmakeCommand);
void qmakeBuildConfigChanged();
void userArgumentsChanged();
void linkQmlDebuggingLibraryChanged();
@@ -173,7 +172,6 @@ private:
void updateEffectiveQMakeCall();
void setSummaryText(const QString &);
- void setAdditionalSummaryText(const QString &);
Internal::Ui::QMakeStep *m_ui;
QMakeStep *m_step;
diff --git a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp
index 5617070ea4..1c78eeacdd 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp
+++ b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp
@@ -84,29 +84,6 @@ QList<ProjectExplorer::Abi> DesktopQtVersion::detectQtAbis() const
return qtAbisFromLibrary(qtCorePath(versionInfo(), qtVersionString()));
}
-bool DesktopQtVersion::supportsTargetId(const Core::Id id) const
-{
- using namespace ProjectExplorer;
- if (id == Core::Id(Constants::DESKTOP_TARGET_ID))
- return true;
- if (id == Core::Id("RemoteLinux.EmbeddedLinuxTarget")) {
- foreach (const Abi &abi, qtAbis()) {
- switch (abi.os()) {
- case Abi::BsdOS: case Abi::LinuxOS: case Abi::MacOS: case Abi::UnixOS:
- return true;
- default:
- break;
- }
- }
- }
- return false;
-}
-
-QSet<Core::Id> DesktopQtVersion::supportedTargetIds() const
-{
- return QSet<Core::Id>() << Core::Id(Constants::DESKTOP_TARGET_ID);
-}
-
QString DesktopQtVersion::description() const
{
return QCoreApplication::translate("QtVersion", "Desktop", "Qt Version is meant for the desktop");
diff --git a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.h b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.h
index c5a0e998e6..bd965e685f 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.h
+++ b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.h
@@ -53,9 +53,6 @@ public:
QList<ProjectExplorer::Abi> detectQtAbis() const;
- bool supportsTargetId(const Core::Id id) const;
- QSet<Core::Id> supportedTargetIds() const;
-
QString description() const;
Core::FeatureSet availableFeatures() const;
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt-desktop.pri b/src/plugins/qt4projectmanager/qt-desktop/qt-desktop.pri
index 8f3fcfd8ef..46424cc4b0 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/qt-desktop.pri
+++ b/src/plugins/qt4projectmanager/qt-desktop/qt-desktop.pri
@@ -1,10 +1,6 @@
HEADERS += \
$$PWD/qt4runconfiguration.h \
- $$PWD/qt4desktoptargetfactory.h \
- $$PWD/qt4simulatortargetfactory.h \
- $$PWD/qt4desktoptarget.h \
- $$PWD/qt4simulatortarget.h \
$$PWD/desktopqtversionfactory.h \
$$PWD/simulatorqtversionfactory.h \
$$PWD/desktopqtversion.h \
@@ -12,10 +8,6 @@ HEADERS += \
SOURCES += \
$$PWD/qt4runconfiguration.cpp \
- $$PWD/qt4desktoptargetfactory.cpp \
- $$PWD/qt4simulatortargetfactory.cpp \
- $$PWD/qt4desktoptarget.cpp \
- $$PWD/qt4simulatortarget.cpp \
$$PWD/desktopqtversionfactory.cpp \
$$PWD/simulatorqtversionfactory.cpp \
$$PWD/desktopqtversion.cpp \
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptarget.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptarget.cpp
deleted file mode 100644
index d784efcea6..0000000000
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptarget.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "qt4desktoptarget.h"
-#include "qt4project.h"
-#include "qt4nodes.h"
-#include "qt4runconfiguration.h"
-#include "qt4buildconfiguration.h"
-#include <projectexplorer/deployconfiguration.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
-#include <QApplication>
-#include <QStyle>
-
-using namespace Qt4ProjectManager;
-using namespace Qt4ProjectManager::Internal;
-
-Qt4DesktopTarget::Qt4DesktopTarget(Qt4Project *parent, const Core::Id id) :
- Qt4BaseTarget(parent, id),
- m_buildConfigurationFactory(new Qt4BuildConfigurationFactory(this))
-{
- setDisplayName(defaultDisplayName());
- setIcon(qApp->style()->standardIcon(QStyle::SP_ComputerIcon));
-}
-
-Qt4DesktopTarget::~Qt4DesktopTarget()
-{
-}
-
-QString Qt4DesktopTarget::defaultDisplayName()
-{
- return QApplication::translate("Qt4ProjectManager::Qt4Target", "Desktop", "Qt4 Desktop target display name");
-}
-
-ProjectExplorer::IBuildConfigurationFactory *Qt4DesktopTarget::buildConfigurationFactory() const
-{
- return m_buildConfigurationFactory;
-}
-
-void Qt4DesktopTarget::createApplicationProFiles(bool reparse)
-{
- if (!reparse)
- removeUnconfiguredCustomExectutableRunConfigurations();
-
- // We use the list twice
- QList<Qt4ProFileNode *> profiles = qt4Project()->applicationProFiles();
- QHash<QString, bool> paths;
- foreach (Qt4ProFileNode *pro, profiles) {
- bool isConsole = pro->variableValue(ConfigVar).contains(QLatin1String("console"));
- paths.insert(pro->path(), isConsole);
- }
-
- foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
- if (Qt4RunConfiguration *qt4rc = qobject_cast<Qt4RunConfiguration *>(rc)) {
- paths.remove(qt4rc->proFilePath());
- }
-
- // Only add new runconfigurations if there are none.
- QHash<QString, bool>::const_iterator it, end;
- end = paths.constEnd();
- for (it = paths.constBegin(); it != end; ++it) {
- Qt4RunConfiguration *qt4rc = new Qt4RunConfiguration(this, it.key());
- if (it.value())
- qt4rc->setRunMode(ProjectExplorer::LocalApplicationRunConfiguration::Console);
- addRunConfiguration(qt4rc);
- }
-
- // Oh still none? Add a custom executable runconfiguration
- if (runConfigurations().isEmpty()) {
- addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(this));
- }
-}
-
-QList<ProjectExplorer::RunConfiguration *> Qt4DesktopTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
-{
- QList<ProjectExplorer::RunConfiguration *> result;
- foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
- if (Qt4RunConfiguration *qt4c = qobject_cast<Qt4RunConfiguration *>(rc))
- if (qt4c->proFilePath() == n->path())
- result << rc;
- return result;
-}
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp
index 47ab921d69..6895748264 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp
+++ b/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp
@@ -32,6 +32,7 @@
#include "qt4desktoptargetfactory.h"
#include "buildconfigurationinfo.h"
+#include "qt4buildconfiguration.h"
#include "qt4projectmanagerconstants.h"
#include "qt4project.h"
#include "qt4runconfiguration.h"
@@ -39,8 +40,9 @@
#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/projectexplorerconstants.h>
-#include <projectexplorer/projectexplorerconstants.h>
#include <qtsupport/customexecutablerunconfiguration.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
#include <qtsupport/qtversionmanager.h>
@@ -55,58 +57,29 @@ using ProjectExplorer::idFromMap;
Qt4DesktopTargetFactory::Qt4DesktopTargetFactory(QObject *parent) :
Qt4BaseTargetFactory(parent)
-{
- connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
- this, SIGNAL(canCreateTargetIdsChanged()));
-}
+{ }
Qt4DesktopTargetFactory::~Qt4DesktopTargetFactory()
-{
-}
-
-bool Qt4DesktopTargetFactory::supportsTargetId(const Core::Id id) const
-{
- return id == Core::Id(Constants::DESKTOP_TARGET_ID);
-}
-
-QList<Core::Id> Qt4DesktopTargetFactory::supportedTargetIds() const
-{
- return QList<Core::Id>() << Core::Id(Constants::DESKTOP_TARGET_ID);
-}
-
-QString Qt4DesktopTargetFactory::displayNameForId(const Core::Id id) const
-{
- if (id == Core::Id(Constants::DESKTOP_TARGET_ID))
- return Qt4DesktopTarget::defaultDisplayName();
- return QString();
-}
+{ }
-QString Qt4DesktopTargetFactory::buildNameForId(const Core::Id id) const
+bool Qt4DesktopTargetFactory::supportsProfile(const ProjectExplorer::Profile *p) const
{
- if (id == Core::Id(Constants::DESKTOP_TARGET_ID))
- return QLatin1String("desktop");
- return QString();
-}
-
-QIcon Qt4DesktopTargetFactory::iconForId(const Core::Id id) const
-{
- if (id == Core::Id(Constants::DESKTOP_TARGET_ID))
- return qApp->style()->standardIcon(QStyle::SP_ComputerIcon);
- return QIcon();
+ if (!p)
+ return false;
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(p);
+ return version && version->type() == QLatin1String(QtSupport::Constants::DESKTOPQT);
}
-bool Qt4DesktopTargetFactory::canCreate(ProjectExplorer::Project *parent, const Core::Id id) const
+bool Qt4DesktopTargetFactory::canCreate(ProjectExplorer::Project *parent, const ProjectExplorer::Profile *p) const
{
if (!qobject_cast<Qt4Project *>(parent))
return false;
- if (!supportsTargetId(id))
- return false;
- return QtSupport::QtVersionManager::instance()->supportsTargetId(id);
+ return supportsProfile(p);
}
bool Qt4DesktopTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const
{
- return qobject_cast<Qt4Project *>(parent) && supportsTargetId(idFromMap(map));
+ return qobject_cast<Qt4Project *>(parent) && supportsProfile(profileFromMap(map));
}
ProjectExplorer::Target *Qt4DesktopTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map)
@@ -115,7 +88,10 @@ ProjectExplorer::Target *Qt4DesktopTargetFactory::restore(ProjectExplorer::Proj
return 0;
Qt4Project *qt4project = static_cast<Qt4Project *>(parent);
- Qt4DesktopTarget *target = new Qt4DesktopTarget(qt4project, idFromMap(map));
+ ProjectExplorer::Profile *p = profileFromMap(map);
+ if (!p)
+ return 0;
+ Qt4DesktopTarget *target = new Qt4DesktopTarget(qt4project, p);
if (target->fromMap(map))
return target;
@@ -123,70 +99,44 @@ ProjectExplorer::Target *Qt4DesktopTargetFactory::restore(ProjectExplorer::Proj
return 0;
}
-Qt4TargetSetupWidget *Qt4DesktopTargetFactory::createTargetSetupWidget(const Core::Id id, const QString &proFilePath,
- const QtSupport::QtVersionNumber &minimumQtVersion,
- const QtSupport::QtVersionNumber &maximumQtVersion,
- const Core::FeatureSet &requiredFeatures,
- bool importEnabled, QList<BuildConfigurationInfo> importInfos)
-{
-
- QList<BuildConfigurationInfo> infos = this->availableBuildConfigurations(id, proFilePath,
- minimumQtVersion,
- maximumQtVersion,
- requiredFeatures);
- if (infos.isEmpty() && importInfos.isEmpty())
- return 0;
- Qt4DefaultTargetSetupWidget *widget = new Qt4DefaultTargetSetupWidget(this, id, proFilePath, infos,
- minimumQtVersion, maximumQtVersion,
- requiredFeatures,
- importEnabled, importInfos,
- Qt4DefaultTargetSetupWidget::USER);
- widget->setBuildConfiguraionComboBoxVisible(true);
- return widget;
-}
-
-ProjectExplorer::Target *Qt4DesktopTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id)
+ProjectExplorer::Target *Qt4DesktopTargetFactory::create(ProjectExplorer::Project *parent, ProjectExplorer::Profile *p)
{
- if (!canCreate(parent, id))
+ if (!canCreate(parent, p))
return 0;
- QList<QtSupport::BaseQtVersion *> knownVersions = QtSupport::QtVersionManager::instance()->versionsForTargetId(id);
- if (knownVersions.isEmpty())
- return 0;
-
- QtSupport::BaseQtVersion *qtVersion = knownVersions.first();
+ QtSupport::BaseQtVersion *qtVersion = QtSupport::QtProfileInformation::qtVersion(p);
QtSupport::BaseQtVersion::QmakeBuildConfigs config = qtVersion->defaultBuildConfig();
QList<BuildConfigurationInfo> infos;
- infos.append(BuildConfigurationInfo(qtVersion->uniqueId(), config, QString(), QString()));
- infos.append(BuildConfigurationInfo(qtVersion->uniqueId(), config ^ QtSupport::BaseQtVersion::DebugBuild, QString(), QString()));
+ infos.append(BuildConfigurationInfo(config, QString(), QString()));
+ infos.append(BuildConfigurationInfo(config ^ QtSupport::BaseQtVersion::DebugBuild, QString(), QString()));
- return create(parent, id, infos);
+ return create(parent, p, infos);
}
-QSet<QString> Qt4DesktopTargetFactory::targetFeatures(const Core::Id id) const
+QSet<QString> Qt4DesktopTargetFactory::targetFeatures(ProjectExplorer::Profile *s) const
{
- Q_UNUSED(id);
QSet<QString> features;
- features << QLatin1String(Constants::DESKTOP_TARGETFEATURE_ID);
- features << QLatin1String(Constants::SHADOWBUILD_TARGETFEATURE_ID);
+ if (supportsProfile(s))
+ features << QLatin1String(Constants::DESKTOP_TARGETFEATURE_ID)
+ << QLatin1String(Constants::SHADOWBUILD_TARGETFEATURE_ID);
return features;
}
-ProjectExplorer::Target *Qt4DesktopTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id, const QList<BuildConfigurationInfo> &infos)
+ProjectExplorer::Target *Qt4DesktopTargetFactory::create(ProjectExplorer::Project *parent,
+ ProjectExplorer::Profile *p,
+ const QList<BuildConfigurationInfo> &infos)
{
- if (!canCreate(parent, id))
+ if (!canCreate(parent, p))
return 0;
if (infos.isEmpty())
return 0;
- Qt4DesktopTarget *t = new Qt4DesktopTarget(static_cast<Qt4Project *>(parent), id);
+ Qt4DesktopTarget *t = new Qt4DesktopTarget(static_cast<Qt4Project *>(parent), p);
foreach (const BuildConfigurationInfo &info, infos)
- t->addQt4BuildConfiguration(msgBuildConfigurationName(info), QString(),
- info.version(), info.buildConfig,
+ Qt4BuildConfiguration::setup(t, buildConfigurationDisplayName(info), QString(), info.buildConfig,
info.additionalArguments, info.directory, info.importing);
-
t->addDeployConfiguration(t->createDeployConfiguration(Core::Id(ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID)));
t->createApplicationProFiles(false);
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.h b/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.h
deleted file mode 100644
index be5ced77fa..0000000000
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef QT4DESKTOPTARGETFACTORY_H
-#define QT4DESKTOPTARGETFACTORY_H
-
-#include "qt4basetargetfactory.h"
-
-namespace Qt4ProjectManager {
-namespace Internal {
-class Qt4DesktopTargetFactory : public Qt4BaseTargetFactory
-{
- Q_OBJECT
-public:
- Qt4DesktopTargetFactory(QObject *parent = 0);
- ~Qt4DesktopTargetFactory();
-
- QList<Core::Id> supportedTargetIds() const;
- QString displayNameForId(const Core::Id id) const;
- QIcon iconForId(const Core::Id id) const;
-
- bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
- bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
- ProjectExplorer::Target *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
-
- virtual bool supportsTargetId(const Core::Id id) const;
-
- Qt4TargetSetupWidget *createTargetSetupWidget(const Core::Id id, const QString &proFilePath,
- const QtSupport::QtVersionNumber &minimumQtVersion,
- const QtSupport::QtVersionNumber &maximumQtVersion,
- const Core::FeatureSet &requiredFeatures,
- bool importEnabled, QList<BuildConfigurationInfo> importInfos);
- QString buildNameForId(const Core::Id id) const;
- QSet<QString> targetFeatures(const Core::Id id) const;
-
- ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id);
- ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id,
- const QList<BuildConfigurationInfo> &infos);
-};
-}
-}
-#endif // QT4DESKTOPTARGETFACTORY_H
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp
index 044b5680c2..98ab43b34f 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp
@@ -35,7 +35,6 @@
#include "makestep.h"
#include "qt4nodes.h"
#include "qt4project.h"
-#include "qt4target.h"
#include "qt4buildconfiguration.h"
#include "qt4projectmanagerconstants.h"
#include "qmakestep.h"
@@ -48,16 +47,20 @@
#include <coreplugin/helpmanager.h>
#include <projectexplorer/buildstep.h>
#include <projectexplorer/environmentwidget.h>
-#include <projectexplorer/toolchain.h>
+#include <projectexplorer/target.h>
+#include <projectexplorer/projectexplorerconstants.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/pathchooser.h>
#include <utils/detailswidget.h>
#include <utils/stringutils.h>
#include <utils/persistentsettings.h>
+#include <qtsupport/customexecutablerunconfiguration.h>
#include <qtsupport/qtoutputformatter.h>
+#include <qtsupport/qtsupportconstants.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/profilereader.h>
+#include <qtsupport/qtprofileinformation.h>
#include <QFormLayout>
#include <QInputDialog>
@@ -76,7 +79,6 @@ using Utils::PersistentSettingsReader;
using Utils::PersistentSettingsWriter;
namespace {
-const char * const QT4_RC_ID("Qt4ProjectManager.Qt4RunConfiguration");
const char * const QT4_RC_PREFIX("Qt4ProjectManager.Qt4RunConfiguration.");
const char * const COMMAND_LINE_ARGUMENTS_KEY("Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments");
@@ -89,7 +91,7 @@ const char * const USER_WORKING_DIRECTORY_KEY("Qt4ProjectManager.Qt4RunConfigura
QString pathFromId(Core::Id id)
{
- QString idstr = QString::fromUtf8(id.name());
+ QString idstr = id.toString();
const QString prefix = QLatin1String(QT4_RC_PREFIX);
if (!idstr.startsWith(prefix))
return QString();
@@ -102,19 +104,21 @@ QString pathFromId(Core::Id id)
// Qt4RunConfiguration
//
-Qt4RunConfiguration::Qt4RunConfiguration(Qt4BaseTarget *parent, const QString &proFilePath) :
- LocalApplicationRunConfiguration(parent, Core::Id(QT4_RC_ID)),
- m_proFilePath(proFilePath),
+Qt4RunConfiguration::Qt4RunConfiguration(ProjectExplorer::Target *parent, Core::Id id) :
+ LocalApplicationRunConfiguration(parent, id),
+ m_proFilePath(pathFromId(id)),
m_runMode(Gui),
m_isUsingDyldImageSuffix(false),
- m_baseEnvironmentBase(Qt4RunConfiguration::BuildEnvironmentBase),
- m_parseSuccess(parent->qt4Project()->validParse(m_proFilePath)),
- m_parseInProgress(parent->qt4Project()->parseInProgress(m_proFilePath))
+ m_baseEnvironmentBase(Qt4RunConfiguration::BuildEnvironmentBase)
{
+ Qt4Project *project = static_cast<Qt4Project *>(parent->project());
+ m_parseSuccess = project->validParse(m_proFilePath);
+ m_parseInProgress = project->parseInProgress(m_proFilePath);
+
ctor();
}
-Qt4RunConfiguration::Qt4RunConfiguration(Qt4BaseTarget *parent, Qt4RunConfiguration *source) :
+Qt4RunConfiguration::Qt4RunConfiguration(ProjectExplorer::Target *parent, Qt4RunConfiguration *source) :
LocalApplicationRunConfiguration(parent, source),
m_commandLineArguments(source->m_commandLineArguments),
m_proFilePath(source->m_proFilePath),
@@ -133,11 +137,6 @@ Qt4RunConfiguration::~Qt4RunConfiguration()
{
}
-Qt4BaseTarget *Qt4RunConfiguration::qt4Target() const
-{
- return static_cast<Qt4BaseTarget *>(target());
-}
-
bool Qt4RunConfiguration::isEnabled() const
{
return m_parseSuccess && !m_parseInProgress;
@@ -150,7 +149,7 @@ QString Qt4RunConfiguration::disabledReason() const
.arg(QFileInfo(m_proFilePath).fileName());
if (!m_parseSuccess)
- return qt4Target()->qt4Project()->disabledReasonForRunConfiguration(m_proFilePath);
+ return static_cast<Qt4Project *>(target()->project())->disabledReasonForRunConfiguration(m_proFilePath);
return QString();
}
@@ -182,10 +181,22 @@ void Qt4RunConfiguration::ctor()
{
setDefaultDisplayName(defaultDisplayName());
- connect(qt4Target(), SIGNAL(environmentChanged()),
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
+ m_forcedGuiMode = (version && version->type() == QtSupport::Constants::SIMULATORQT);
+
+ connect(target(), SIGNAL(environmentChanged()),
this, SIGNAL(baseEnvironmentChanged()));
- connect(qt4Target()->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
+ connect(target()->project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
this, SLOT(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
+ connect(target(), SIGNAL(profileChanged()),
+ this, SLOT(profileChanged()));
+}
+
+void Qt4RunConfiguration::profileChanged()
+{
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
+ m_forcedGuiMode = (version && version->type() == QtSupport::Constants::SIMULATORQT);
+ emit runModeChanged(runMode()); // Always emit
}
//////
@@ -251,7 +262,7 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
m_useTerminalCheck = new QCheckBox(tr("Run in terminal"), this);
m_useTerminalCheck->setChecked(m_qt4RunConfiguration->runMode() == ProjectExplorer::LocalApplicationRunConfiguration::Console);
toplayout->addRow(QString(), m_useTerminalCheck);
- m_useTerminalCheck->setVisible(qt4RunConfiguration->target()->id() != Core::Id(Constants::QT_SIMULATOR_TARGET_ID));
+ 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);
@@ -431,8 +442,10 @@ void Qt4RunConfigurationWidget::commandLineArgumentsChanged(const QString &args)
void Qt4RunConfigurationWidget::runModeChanged(LocalApplicationRunConfiguration::RunMode runMode)
{
- if (!m_ignoreChange)
+ if (!m_ignoreChange) {
+ m_useTerminalCheck->setVisible(!m_qt4RunConfiguration->forcedGuiMode());
m_useTerminalCheck->setChecked(runMode == LocalApplicationRunConfiguration::Console);
+ }
}
void Qt4RunConfigurationWidget::usingDyldImageSuffixChanged(bool state)
@@ -496,15 +509,15 @@ bool Qt4RunConfiguration::fromMap(const QVariantMap &map)
m_userEnvironmentChanges = Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
m_baseEnvironmentBase = static_cast<BaseEnvironmentBase>(map.value(QLatin1String(BASE_ENVIRONMENT_BASE_KEY), static_cast<int>(Qt4RunConfiguration::BuildEnvironmentBase)).toInt());
- m_parseSuccess = qt4Target()->qt4Project()->validParse(m_proFilePath);
- m_parseInProgress = qt4Target()->qt4Project()->parseInProgress(m_proFilePath);
+ m_parseSuccess = static_cast<Qt4Project *>(target()->project())->validParse(m_proFilePath);
+ m_parseInProgress = static_cast<Qt4Project *>(target()->project())->parseInProgress(m_proFilePath);
return RunConfiguration::fromMap(map);
}
QString Qt4RunConfiguration::executable() const
{
- Qt4Project *pro = qt4Target()->qt4Project();
+ Qt4Project *pro = static_cast<Qt4Project *>(target()->project());
TargetInformation ti = pro->rootQt4ProjectNode()->targetInformation(m_proFilePath);
if (!ti.valid)
return QString();
@@ -513,9 +526,16 @@ QString Qt4RunConfiguration::executable() const
LocalApplicationRunConfiguration::RunMode Qt4RunConfiguration::runMode() const
{
+ if (m_forcedGuiMode)
+ return LocalApplicationRunConfiguration::Gui;
return m_runMode;
}
+bool Qt4RunConfiguration::forcedGuiMode() const
+{
+ return m_forcedGuiMode;
+}
+
bool Qt4RunConfiguration::isUsingDyldImageSuffix() const
{
return m_isUsingDyldImageSuffix;
@@ -540,7 +560,7 @@ QString Qt4RunConfiguration::baseWorkingDirectory() const
return m_userWorkingDirectory;
// else what the pro file reader tells us
- Qt4Project *pro = qt4Target()->qt4Project();
+ Qt4Project *pro = static_cast<Qt4Project *>(target()->project());
TargetInformation ti = pro->rootQt4ProjectNode()->targetInformation(m_proFilePath);
if (!ti.valid)
return QString();
@@ -575,7 +595,8 @@ Utils::Environment Qt4RunConfiguration::baseEnvironment() const
// Nothing
} else if (m_baseEnvironmentBase == Qt4RunConfiguration::SystemEnvironmentBase) {
env = Utils::Environment::systemEnvironment();
- } else if (m_baseEnvironmentBase == Qt4RunConfiguration::BuildEnvironmentBase) {
+ } else if (m_baseEnvironmentBase == Qt4RunConfiguration::BuildEnvironmentBase
+ && target()->activeBuildConfiguration()) {
env = target()->activeBuildConfiguration()->environment();
}
if (m_isUsingDyldImageSuffix) {
@@ -585,7 +606,7 @@ Utils::Environment Qt4RunConfiguration::baseEnvironment() const
// The user could be linking to a library found via a -L/some/dir switch
// to find those libraries while actually running we explicitly prepend those
// dirs to the library search path
- const Qt4ProFileNode *node = qt4Target()->qt4Project()->rootQt4ProjectNode()->findProFileFor(m_proFilePath);
+ const Qt4ProFileNode *node = static_cast<Qt4Project *>(target()->project())->rootQt4ProjectNode()->findProFileFor(m_proFilePath);
if (node) {
const QStringList libDirectories = node->variableValue(LibDirectoriesVar);
if (!libDirectories.isEmpty()) {
@@ -600,7 +621,7 @@ Utils::Environment Qt4RunConfiguration::baseEnvironment() const
} // libDirectories
} // node
- QtSupport::BaseQtVersion *qtVersion = qt4Target()->activeQt4BuildConfiguration()->qtVersion();
+ QtSupport::BaseQtVersion *qtVersion = QtSupport::QtProfileInformation::qtVersion(target()->profile());
if (qtVersion)
env.prependOrSetLibrarySearchPath(qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_LIBS")));
return env;
@@ -656,7 +677,7 @@ QString Qt4RunConfiguration::proFilePath() const
QString Qt4RunConfiguration::dumperLibrary() const
{
- QtSupport::BaseQtVersion *version = qt4Target()->activeQt4BuildConfiguration()->qtVersion();
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
if (version)
return version->gdbDebuggingHelperLibrary();
return QString();
@@ -664,7 +685,7 @@ QString Qt4RunConfiguration::dumperLibrary() const
QStringList Qt4RunConfiguration::dumperLibraryLocations() const
{
- QtSupport::BaseQtVersion *version = qt4Target()->activeQt4BuildConfiguration()->qtVersion();
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
if (version)
return version->debuggingHelperLibraryLocations();
return QStringList();
@@ -695,7 +716,7 @@ Qt4RunConfiguration::BaseEnvironmentBase Qt4RunConfiguration::baseEnvironmentBas
Utils::OutputFormatter *Qt4RunConfiguration::createOutputFormatter() const
{
- return new QtSupport::QtOutputFormatter(qt4Target()->qt4Project());
+ return new QtSupport::QtOutputFormatter(target()->project());
}
///
@@ -704,50 +725,50 @@ Utils::OutputFormatter *Qt4RunConfiguration::createOutputFormatter() const
///
Qt4RunConfigurationFactory::Qt4RunConfigurationFactory(QObject *parent) :
- ProjectExplorer::IRunConfigurationFactory(parent)
-{
-}
+ QmakeRunConfigurationFactory(parent)
+{ setObjectName(QLatin1String("Qt4RunConfigurationFactory")); }
Qt4RunConfigurationFactory::~Qt4RunConfigurationFactory()
-{
-}
+{ }
bool Qt4RunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
{
- Qt4BaseTarget *t = qobject_cast<Qt4BaseTarget *>(parent);
- if (!t)
+ if (!canHandle(parent))
return false;
- if (t->id() != Core::Id(Constants::DESKTOP_TARGET_ID)
- && t->id() != Core::Id(Constants::QT_SIMULATOR_TARGET_ID))
- return false;
- return t->qt4Project()->hasApplicationProFile(pathFromId(id));
+ Qt4Project *project = static_cast<Qt4Project *>(parent->project());
+ return project->hasApplicationProFile(pathFromId(id));
}
ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
{
if (!canCreate(parent, id))
return 0;
- Qt4BaseTarget *t = static_cast<Qt4BaseTarget *>(parent);
- return new Qt4RunConfiguration(t, pathFromId(id));
+
+ Qt4RunConfiguration *rc = new Qt4RunConfiguration(parent, id);
+ QList<Qt4ProFileNode *> profiles = static_cast<Qt4Project *>(parent->project())->applicationProFiles();
+ foreach (Qt4ProFileNode *node, profiles) {
+ if (node->path() != rc->proFilePath())
+ continue;
+ rc->setRunMode(node->variableValue(ConfigVar).contains(QLatin1String("console"))
+ ? ProjectExplorer::LocalApplicationRunConfiguration::Console
+ : ProjectExplorer::LocalApplicationRunConfiguration::Gui);
+ break;
+ }
+ return rc;
}
bool Qt4RunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
{
- if (!qobject_cast<Qt4BaseTarget *>(parent))
- return false;
- if (parent->id() != Core::Id(Constants::DESKTOP_TARGET_ID)
- && parent->id() != Core::Id(Constants::QT_SIMULATOR_TARGET_ID))
+ if (!canHandle(parent))
return false;
- QString id = QString::fromLatin1(ProjectExplorer::idFromMap(map).name());
- return id.startsWith(QLatin1String(QT4_RC_ID));
+ return ProjectExplorer::idFromMap(map).toString().startsWith(QLatin1String(QT4_RC_PREFIX));
}
ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
- Qt4BaseTarget *t = static_cast<Qt4BaseTarget *>(parent);
- Qt4RunConfiguration *rc = new Qt4RunConfiguration(t, QString());
+ Qt4RunConfiguration *rc = new Qt4RunConfiguration(parent, ProjectExplorer::idFromMap(map));
if (rc->fromMap(map))
return rc;
@@ -764,23 +785,20 @@ ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::clone(ProjectExpl
{
if (!canClone(parent, source))
return 0;
- Qt4BaseTarget *t = static_cast<Qt4BaseTarget *>(parent);
Qt4RunConfiguration *old = static_cast<Qt4RunConfiguration *>(source);
- return new Qt4RunConfiguration(t, old);
+ return new Qt4RunConfiguration(parent, old);
}
QList<Core::Id> Qt4RunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
{
QList<Core::Id> result;
- Qt4BaseTarget *t = qobject_cast<Qt4BaseTarget *>(parent);
- if (!t)
+ if (!canHandle(parent))
return result;
- if (t->id() != Core::Id(Constants::DESKTOP_TARGET_ID)
- && t->id() != Core::Id(Constants::QT_SIMULATOR_TARGET_ID))
- return result;
- QStringList proFiles = t->qt4Project()->applicationProFilePathes(QLatin1String(QT4_RC_PREFIX));
+
+ Qt4Project *project = static_cast<Qt4Project *>(parent->project());
+ QStringList proFiles = project->applicationProFilePathes(QLatin1String(QT4_RC_PREFIX));
foreach (const QString &pf, proFiles)
- result << Core::Id(pf.toUtf8().constData());
+ result << Core::Id(pf);
return result;
}
@@ -788,3 +806,24 @@ QString Qt4RunConfigurationFactory::displayNameForId(const Core::Id id) const
{
return QFileInfo(pathFromId(id)).completeBaseName();
}
+
+bool Qt4RunConfigurationFactory::canHandle(ProjectExplorer::Target *t) const
+{
+ if (!t->project()->supportsProfile(t->profile()))
+ return false;
+ if (!qobject_cast<Qt4Project *>(t->project()))
+ return false;
+ Core::Id devType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(t->profile());
+ return devType == Core::Id(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
+}
+
+QList<ProjectExplorer::RunConfiguration *> Qt4RunConfigurationFactory::runConfigurationsForNode(ProjectExplorer::Target *t, ProjectExplorer::Node *n)
+{
+ QList<ProjectExplorer::RunConfiguration *> result;
+ foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations())
+ if (Qt4RunConfiguration *qt4c = qobject_cast<Qt4RunConfiguration *>(rc))
+ if (qt4c->proFilePath() == n->path())
+ result << rc;
+ return result;
+
+}
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.h b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.h
index 8152690879..765f38fae4 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.h
+++ b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.h
@@ -33,6 +33,8 @@
#ifndef QT4RUNCONFIGURATION_H
#define QT4RUNCONFIGURATION_H
+#include "qmakerunconfigurationfactory.h"
+
#include <projectexplorer/applicationrunconfiguration.h>
#include <utils/environment.h>
@@ -61,7 +63,6 @@ namespace ProjectExplorer {
namespace Qt4ProjectManager {
class Qt4Project;
-class Qt4BaseTarget;
class Qt4ProFileNode;
class Qt4PriFileNode;
@@ -76,17 +77,16 @@ class Qt4RunConfiguration : public ProjectExplorer::LocalApplicationRunConfigura
friend class Qt4RunConfigurationFactory;
public:
- Qt4RunConfiguration(Qt4BaseTarget *parent, const QString &proFilePath);
+ Qt4RunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
virtual ~Qt4RunConfiguration();
- Qt4BaseTarget *qt4Target() const;
-
virtual bool isEnabled() const;
virtual QString disabledReason() const;
virtual QWidget *createConfigurationWidget();
virtual QString executable() const;
virtual RunMode runMode() const;
+ bool forcedGuiMode() const;
virtual QString workingDirectory() const;
virtual QString commandLineArguments() const;
virtual Utils::Environment environment() const;
@@ -115,10 +115,11 @@ signals:
void effectiveTargetInformationChanged();
private slots:
+ void profileChanged();
void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress);
protected:
- Qt4RunConfiguration(Qt4BaseTarget *parent, Qt4RunConfiguration *source);
+ Qt4RunConfiguration(ProjectExplorer::Target *parent, Qt4RunConfiguration *source);
virtual bool fromMap(const QVariantMap &map);
private:
@@ -146,6 +147,7 @@ private:
// Cached startup sub project information
ProjectExplorer::LocalApplicationRunConfiguration::RunMode m_runMode;
+ bool m_forcedGuiMode;
bool m_userSetName;
bool m_isUsingDyldImageSuffix;
QString m_userWorkingDirectory;
@@ -204,23 +206,27 @@ private:
bool m_isShown;
};
-class Qt4RunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
+class Qt4RunConfigurationFactory : public QmakeRunConfigurationFactory
{
Q_OBJECT
public:
explicit Qt4RunConfigurationFactory(QObject *parent = 0);
- virtual ~Qt4RunConfigurationFactory();
+ ~Qt4RunConfigurationFactory();
- virtual bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
- virtual ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
- virtual bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
- virtual ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
- virtual bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
- virtual ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
+ bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
+ ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
+ bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
+ ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
+ bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
+ ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
QString displayNameForId(const Core::Id id) const;
+
+ bool canHandle(ProjectExplorer::Target *t) const;
+ QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
+ ProjectExplorer::Node *n);
};
} // namespace Internal
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortarget.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortarget.cpp
deleted file mode 100644
index 049f3d0501..0000000000
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortarget.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "qt4simulatortarget.h"
-#include "qt4project.h"
-#include "qt4nodes.h"
-#include "qt4runconfiguration.h"
-#include "qt4buildconfiguration.h"
-
-#include <projectexplorer/deployconfiguration.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
-#include <QApplication>
-
-using namespace Qt4ProjectManager;
-using namespace Qt4ProjectManager::Internal;
-
-
-// -------------------------------------------------------------------------
-// Qt4Target
-// -------------------------------------------------------------------------
-
-Qt4SimulatorTarget::Qt4SimulatorTarget(Qt4Project *parent, const Core::Id id) :
- Qt4BaseTarget(parent, id),
- m_buildConfigurationFactory(new Qt4BuildConfigurationFactory(this))
-{
- setDisplayName(defaultDisplayName());
- setIcon(QIcon(QLatin1String(":/projectexplorer/images/SymbianEmulator.png")));
-}
-
-Qt4SimulatorTarget::~Qt4SimulatorTarget()
-{
-}
-
-QString Qt4SimulatorTarget::defaultDisplayName()
-{
- return QApplication::translate("Qt4ProjectManager::Qt4Target", "Qt Simulator", "Qt4 Simulator target display name");
-}
-
-ProjectExplorer::IBuildConfigurationFactory *Qt4SimulatorTarget::buildConfigurationFactory() const
-{
- return m_buildConfigurationFactory;
-}
-
-void Qt4SimulatorTarget::createApplicationProFiles(bool reparse)
-{
- if (!reparse)
- removeUnconfiguredCustomExectutableRunConfigurations();
-
- // We use the list twice
- QList<Qt4ProFileNode *> profiles = qt4Project()->applicationProFiles();
- QSet<QString> paths;
- foreach (Qt4ProFileNode *pro, profiles)
- paths << pro->path();
-
- foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
- if (Qt4RunConfiguration *qt4rc = qobject_cast<Qt4RunConfiguration *>(rc))
- paths.remove(qt4rc->proFilePath());
-
- // Only add new runconfigurations if there are none.
- foreach (const QString &path, paths)
- addRunConfiguration(new Qt4RunConfiguration(this, path));
-
- // Oh still none? Add a custom executable runconfiguration
- if (runConfigurations().isEmpty()) {
- addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(this));
- }
-}
-
-QList<ProjectExplorer::RunConfiguration *> Qt4SimulatorTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
-{
- QList<ProjectExplorer::RunConfiguration *> result;
- foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
- if (Qt4RunConfiguration *qt4c = qobject_cast<Qt4RunConfiguration *>(rc))
- if (qt4c->proFilePath() == n->path())
- result << rc;
- return result;
-}
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp
deleted file mode 100644
index cf20eb813c..0000000000
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "qt4simulatortargetfactory.h"
-#include "buildconfigurationinfo.h"
-#include "qt4projectmanagerconstants.h"
-#include "qt4project.h"
-#include "qt4runconfiguration.h"
-#include "qt4simulatortarget.h"
-#include <qtsupport/qtversionmanager.h>
-
-#include <projectexplorer/deployconfiguration.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
-
-#include <QApplication>
-#include <QStyle>
-
-using namespace Qt4ProjectManager;
-using namespace Qt4ProjectManager::Internal;
-using ProjectExplorer::idFromMap;
-
-// -------------------------------------------------------------------------
-// Qt4SimulatorTargetFactory
-// -------------------------------------------------------------------------
-
-Qt4SimulatorTargetFactory::Qt4SimulatorTargetFactory(QObject *parent) :
- Qt4BaseTargetFactory(parent)
-{
- connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
- this, SIGNAL(canCreateTargetIdsChanged()));
-}
-
-Qt4SimulatorTargetFactory::~Qt4SimulatorTargetFactory()
-{
-}
-
-bool Qt4SimulatorTargetFactory::supportsTargetId(const Core::Id id) const
-{
- return id == Core::Id(Constants::QT_SIMULATOR_TARGET_ID);
-}
-
-QList<Core::Id> Qt4SimulatorTargetFactory::supportedTargetIds() const
-{
- return QList<Core::Id>() << Core::Id(Constants::QT_SIMULATOR_TARGET_ID);
-}
-
-QString Qt4SimulatorTargetFactory::displayNameForId(const Core::Id id) const
-{
- if (id == Core::Id(Constants::QT_SIMULATOR_TARGET_ID))
- return Qt4SimulatorTarget::defaultDisplayName();
- return QString();
-}
-
-QIcon Qt4SimulatorTargetFactory::iconForId(const Core::Id id) const
-{
- if (id == Core::Id(Constants::QT_SIMULATOR_TARGET_ID))
- return QIcon(QLatin1String(":/projectexplorer/images/SymbianEmulator.png"));
- return QIcon();
-}
-
-QString Qt4SimulatorTargetFactory::buildNameForId(const Core::Id id) const
-{
- if (id == Core::Id(Constants::QT_SIMULATOR_TARGET_ID))
- return QLatin1String("simulator");
- return QString();
-}
-
-bool Qt4SimulatorTargetFactory::canCreate(ProjectExplorer::Project *parent, const Core::Id id) const
-{
- if (!qobject_cast<Qt4Project *>(parent))
- return false;
- if (!supportsTargetId(id))
- return false;
- return QtSupport::QtVersionManager::instance()->supportsTargetId(id);
-}
-
-bool Qt4SimulatorTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const
-{
- return qobject_cast<Qt4Project *>(parent) && supportsTargetId(idFromMap(map));
-}
-
-ProjectExplorer::Target *Qt4SimulatorTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map)
-{
- if (!canRestore(parent, map))
- return 0;
-
- Qt4Project *qt4project = static_cast<Qt4Project *>(parent);
- Qt4SimulatorTarget *target = new Qt4SimulatorTarget(qt4project, idFromMap(map));
- if (target->fromMap(map))
- return target;
- delete target;
- return 0;
-}
-
-QSet<QString> Qt4SimulatorTargetFactory::targetFeatures(const Core::Id /*id*/) const
-{
- QSet<QString> features;
-
- features << QLatin1String(Constants::MOBILE_TARGETFEATURE_ID)
- << QLatin1String(Constants::SHADOWBUILD_TARGETFEATURE_ID);
-
- return features;
-}
-
-ProjectExplorer::Target *Qt4SimulatorTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id)
-{
- if (!canCreate(parent, id))
- return 0;
-
- QList<QtSupport::BaseQtVersion *> knownVersions = QtSupport::QtVersionManager::instance()->versionsForTargetId(id);
- if (knownVersions.isEmpty())
- return 0;
-
- QtSupport::BaseQtVersion *qtVersion = knownVersions.first();
- QtSupport::BaseQtVersion::QmakeBuildConfigs config = qtVersion->defaultBuildConfig();
- QList<BuildConfigurationInfo> infos;
- infos.append(BuildConfigurationInfo(qtVersion->uniqueId(), config, QString(), QString()));
- infos.append(BuildConfigurationInfo(qtVersion->uniqueId(), config ^ QtSupport::BaseQtVersion::DebugBuild, QString(), QString()));
-
- return create(parent, id, infos);
-}
-
-ProjectExplorer::Target *Qt4SimulatorTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id,
- const QList<BuildConfigurationInfo> &infos)
-{
- if (!canCreate(parent, id))
- return 0;
- if (infos.isEmpty())
- return 0;
- Qt4SimulatorTarget *t = new Qt4SimulatorTarget(static_cast<Qt4Project *>(parent), id);
-
- foreach (const BuildConfigurationInfo &info, infos)
- t->addQt4BuildConfiguration(msgBuildConfigurationName(info), QString(), info.version(), info.buildConfig,
- info.additionalArguments, info.directory, info.importing);
-
- t->addDeployConfiguration(t->createDeployConfiguration(Core::Id(ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID)));
-
- t->createApplicationProFiles(false);
-
- if (t->runConfigurations().isEmpty())
- t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
- return t;
-}
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.h b/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.h
deleted file mode 100644
index 8c0f96f9e2..0000000000
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef QT4SIMULATORTARGETFACTORY_H
-#define QT4SIMULATORTARGETFACTORY_H
-
-#include "qt4basetargetfactory.h"
-
-namespace Qt4ProjectManager {
-namespace Internal {
-
-class Qt4SimulatorTargetFactory : public Qt4BaseTargetFactory
-{
- Q_OBJECT
-public:
- Qt4SimulatorTargetFactory(QObject *parent = 0);
- ~Qt4SimulatorTargetFactory();
-
- bool supportsTargetId(const Core::Id id) const;
-
- QList<Core::Id> supportedTargetIds() const;
- QString displayNameForId(const Core::Id id) const;
- QIcon iconForId(const Core::Id id) const;
-
- bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
- bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
- ProjectExplorer::Target *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
-
- QSet<QString> targetFeatures(const Core::Id id) const;
-
- QString buildNameForId(const Core::Id id) const;
- ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id);
- ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id,
- const QList<BuildConfigurationInfo> &infos);
-};
-
-}
-}
-
-#endif // QT4SIMULATORTARGETFACTORY_H
diff --git a/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.cpp b/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.cpp
index e0f4328e24..f9d31d37b9 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.cpp
+++ b/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.cpp
@@ -85,16 +85,6 @@ QList<ProjectExplorer::Abi> SimulatorQtVersion::detectQtAbis() const
return qtAbisFromLibrary(qtCorePath(versionInfo(), qtVersionString()));
}
-bool SimulatorQtVersion::supportsTargetId(const Core::Id id) const
-{
- return id == Core::Id(Constants::QT_SIMULATOR_TARGET_ID);
-}
-
-QSet<Core::Id> SimulatorQtVersion::supportedTargetIds() const
-{
- return QSet<Core::Id>() << Core::Id(Constants::QT_SIMULATOR_TARGET_ID);
-}
-
QString SimulatorQtVersion::description() const
{
return QCoreApplication::translate("QtVersion", "Qt Simulator", "Qt Version is meant for Qt Simulator");
diff --git a/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.h b/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.h
index 69d5cf2feb..25a4342510 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.h
+++ b/src/plugins/qt4projectmanager/qt-desktop/simulatorqtversion.h
@@ -53,9 +53,6 @@ public:
QList<ProjectExplorer::Abi> detectQtAbis() const;
- bool supportsTargetId(const Core::Id id) const;
- QSet<Core::Id> supportedTargetIds() const;
-
QString description() const;
Core::FeatureSet availableFeatures() const;
diff --git a/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp b/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp
index f9f5753356..ee0ecf5cb1 100644
--- a/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp
@@ -40,13 +40,12 @@
#include "codamessage.h"
#include "qt4buildconfiguration.h"
-#include "qt4symbiantarget.h"
-#include "qt4target.h"
#include "symbiandevicemanager.h"
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
#include <symbianutils/symbiandevicemanager.h>
diff --git a/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp b/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp
index bad030375d..a3818cd52c 100644
--- a/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp
@@ -181,7 +181,6 @@ QList<ProjectExplorer::ToolChain *> GcceToolChainFactory::autoDetect()
GcceToolChain *tc = new GcceToolChain(false);
tc->setCompilerCommand(Utils::FileName(fi));
tc->setDisplayName(tr("GCCE from Qt version"));
- tc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(tc->targetAbi()));
result.append(tc);
}
}
@@ -195,7 +194,6 @@ QList<ProjectExplorer::ToolChain *> GcceToolChainFactory::autoDetect()
GcceToolChain *tc = new GcceToolChain(true);
tc->setCompilerCommand(fullPath);
tc->setDisplayName(tr("GCCE (%1)").arg(version));
- tc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(tc->targetAbi()));
if (tc->targetAbi() == ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture,
ProjectExplorer::Abi::SymbianOS,
ProjectExplorer::Abi::SymbianDeviceFlavor,
diff --git a/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri b/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri
index f25ce876fd..5f1fb95de6 100644
--- a/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri
+++ b/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri
@@ -21,8 +21,6 @@ SOURCES += $$PWD/s60manager.cpp \
$$PWD/certificatepathchooser.cpp \
$$PWD/s60symbiancertificate.cpp \
$$PWD/s60certificatedetailsdialog.cpp \
- $$PWD/qt4symbiantargetfactory.cpp \
- $$PWD/qt4symbiantarget.cpp \
$$PWD/s60runcontrolfactory.cpp \
$$PWD/codaruncontrol.cpp \
$$PWD/s60runcontrolbase.cpp \
@@ -57,8 +55,6 @@ HEADERS += $$PWD/s60manager.h \
$$PWD/certificatepathchooser.h \
$$PWD/s60symbiancertificate.h \
$$PWD/s60certificatedetailsdialog.h \
- $$PWD/qt4symbiantargetfactory.h \
- $$PWD/qt4symbiantarget.h \
$$PWD/s60runcontrolfactory.h \
$$PWD/codaruncontrol.h \
$$PWD/s60runcontrolbase.h \
diff --git a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantarget.cpp b/src/plugins/qt4projectmanager/qt-s60/qt4symbiantarget.cpp
deleted file mode 100644
index 00d3fad54a..0000000000
--- a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantarget.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "qt4symbiantarget.h"
-#include "qt4projectmanagerconstants.h"
-#include "qt4project.h"
-#include "qt4nodes.h"
-#include "qt4buildconfiguration.h"
-#include "symbianidevice.h"
-
-#include "qt-s60/s60deployconfiguration.h"
-#include "qt-s60/s60devicerunconfiguration.h"
-
-#include <projectexplorer/devicesupport/idevice.h>
-#include <projectexplorer/project.h>
-#include <projectexplorer/toolchainmanager.h>
-#include <projectexplorer/toolchain.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
-#include <extensionsystem/pluginmanager.h>
-#include <QApplication>
-
-using namespace Qt4ProjectManager;
-using namespace Qt4ProjectManager::Internal;
-
-Qt4SymbianTarget::Qt4SymbianTarget(Qt4Project *parent, const Core::Id id) :
- Qt4BaseTarget(parent, id),
- m_buildConfigurationFactory(new Qt4BuildConfigurationFactory(this))
-{
- setDisplayName(defaultDisplayName(id));
- setIcon(iconForId(id));
-}
-
-Qt4SymbianTarget::~Qt4SymbianTarget()
-{ }
-
-QString Qt4SymbianTarget::defaultDisplayName(const Core::Id id)
-{
- if (id == Core::Id(Constants::S60_DEVICE_TARGET_ID))
- return QApplication::translate("Qt4ProjectManager::Qt4Target", "Symbian Device", "Qt4 Symbian Device target display name");
- return QString();
-}
-
-QIcon Qt4SymbianTarget::iconForId(Core::Id id)
-{
- if (id == Core::Id(Constants::S60_DEVICE_TARGET_ID))
- return QIcon(QLatin1String(":/projectexplorer/images/SymbianDevice.png"));
- return QIcon();
-}
-
-ProjectExplorer::IBuildConfigurationFactory *Qt4SymbianTarget::buildConfigurationFactory() const
-{
- return m_buildConfigurationFactory;
-}
-
-void Qt4SymbianTarget::createApplicationProFiles(bool reparse)
-{
- if (!reparse)
- removeUnconfiguredCustomExectutableRunConfigurations();
-
- // We use the list twice
- QList<Qt4ProFileNode *> profiles = qt4Project()->applicationProFiles();
- QSet<QString> paths;
- foreach (Qt4ProFileNode *pro, profiles)
- paths << pro->path();
-
- if (id() == Core::Id(Constants::S60_DEVICE_TARGET_ID)) {
- foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
- if (S60DeviceRunConfiguration *qt4rc = qobject_cast<S60DeviceRunConfiguration *>(rc))
- paths.remove(qt4rc->proFilePath());
-
- // Only add new runconfigurations if there are none.
- foreach (const QString &path, paths)
- addRunConfiguration(new S60DeviceRunConfiguration(this, path));
- }
-
- // Oh still none? Add a custom executable runconfiguration
- if (runConfigurations().isEmpty()) {
- addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(this));
- }
-}
-
-QList<ProjectExplorer::RunConfiguration *> Qt4SymbianTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
-{
- QList<ProjectExplorer::RunConfiguration *> result;
- foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) {
- if (id() == Core::Id(Constants::S60_DEVICE_TARGET_ID)) {
- if (S60DeviceRunConfiguration *s60rc = qobject_cast<S60DeviceRunConfiguration *>(rc))
- if (s60rc->proFilePath() == n->path())
- result << rc;
- }
- }
- return result;
-}
-
-ProjectExplorer::IDevice::ConstPtr Qt4SymbianTarget::currentDevice() const
-{
- S60DeployConfiguration *dc = dynamic_cast<S60DeployConfiguration *>(activeDeployConfiguration());
- if (dc)
- return dc->device();
- return ProjectExplorer::IDevice::ConstPtr();
-}
diff --git a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp b/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp
deleted file mode 100644
index 9f90794900..0000000000
--- a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp
+++ /dev/null
@@ -1,223 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "qt4symbiantargetfactory.h"
-#include "qt4projectmanagerconstants.h"
-#include "qt4project.h"
-#include "buildconfigurationinfo.h"
-
-#include "qt-s60/s60deployconfiguration.h"
-#include "qt-s60/s60devicerunconfiguration.h"
-#include "qt-s60/s60createpackagestep.h"
-#include "qt-s60/s60deploystep.h"
-#include "qt-s60/qt4symbiantarget.h"
-
-#include <projectexplorer/projectexplorerconstants.h>
-#include <projectexplorer/toolchainmanager.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
-
-#include <qtsupport/qtversionmanager.h>
-
-using ProjectExplorer::idFromMap;
-using ProjectExplorer::Task;
-using namespace Qt4ProjectManager;
-using namespace Qt4ProjectManager::Internal;
-
-// -------------------------------------------------------------------------
-// Qt4SymbianTargetFactory
-// -------------------------------------------------------------------------
-
-Qt4SymbianTargetFactory::Qt4SymbianTargetFactory(QObject *parent) :
- Qt4BaseTargetFactory(parent)
-{
- connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
- this, SIGNAL(canCreateTargetIdsChanged()));
-}
-
-Qt4SymbianTargetFactory::~Qt4SymbianTargetFactory()
-{
-}
-
-bool Qt4SymbianTargetFactory::supportsTargetId(const Core::Id id) const
-{
- return id == Core::Id(Constants::S60_DEVICE_TARGET_ID);
-}
-
-QList<Core::Id> Qt4SymbianTargetFactory::supportedTargetIds() const
-{
- QList<Core::Id> ids;
- ids << Core::Id(Constants::S60_DEVICE_TARGET_ID);
- return ids;
-}
-
-QString Qt4SymbianTargetFactory::displayNameForId(const Core::Id id) const
-{
- return Qt4SymbianTarget::defaultDisplayName(id);
-}
-
-QIcon Qt4SymbianTargetFactory::iconForId(const Core::Id id) const
-{
- if (id == Core::Id(Constants::S60_DEVICE_TARGET_ID))
- return QIcon(QLatin1String(":/projectexplorer/images/SymbianDevice.png"));
- return QIcon();
-}
-
-bool Qt4SymbianTargetFactory::canCreate(ProjectExplorer::Project *parent, const Core::Id id) const
-{
- if (!qobject_cast<Qt4Project *>(parent))
- return false;
- if (!supportsTargetId(id))
- return false;
- return QtSupport::QtVersionManager::instance()->supportsTargetId(id);
-}
-
-bool Qt4SymbianTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const
-{
- return qobject_cast<Qt4Project *>(parent) && supportsTargetId(idFromMap(map));
-}
-
-ProjectExplorer::Target *Qt4SymbianTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map)
-{
- if (!canRestore(parent, map))
- return 0;
-
- Qt4Project *qt4project = static_cast<Qt4Project *>(parent);
- Qt4SymbianTarget *target = new Qt4SymbianTarget(qt4project, idFromMap(map));
-
- if (target->fromMap(map))
- return target;
- delete target;
- return 0;
-}
-
-QString Qt4SymbianTargetFactory::shadowBuildDirectory(const QString &profilePath, const Core::Id id, const QString &suffix)
-{
- Q_UNUSED(id);
- Q_UNUSED(suffix);
- return QFileInfo(profilePath).absolutePath();
-}
-
-QList<ProjectExplorer::Task> Qt4SymbianTargetFactory::reportIssues(const QString &proFile)
-{
- QList<ProjectExplorer::Task> results;
- // Warn of strange characters in project name and path:
- const QString projectName = proFile.mid(proFile.lastIndexOf(QLatin1Char('/')) + 1);
- QString projectPath = proFile.left(proFile.lastIndexOf(QLatin1Char('/')));
-#if defined (Q_OS_WIN)
- if (projectPath.at(1) == QLatin1Char(':') && projectPath.at(0).toUpper() >= QLatin1Char('A') && projectPath.at(0).toUpper() <= QLatin1Char('Z'))
- projectPath.remove(0, 2);
-#endif
- if (projectPath.contains(QLatin1Char(' '))) {
- results.append(Task(Task::Warning,
- QCoreApplication::translate("ProjectExplorer::Internal::S60ProjectChecker",
- "The Symbian tool chain does not handle spaces "
- "in the project path '%1'.").arg(projectPath),
- Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
- }
- if (projectName.contains(QRegExp(QLatin1String("[^a-zA-Z0-9.-]")))) {
- results.append(Task(Task::Warning,
- QCoreApplication::translate("ProjectExplorer::Internal::S60ProjectChecker",
- "The Symbian tool chain does not handle special "
- "characters in the project name '%1' well.")
- .arg(projectName),
- Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
- }
- return results;
-}
-
-QList<BuildConfigurationInfo> Qt4SymbianTargetFactory::availableBuildConfigurations(const Core::Id id, const QString &proFilePath,
- const QtSupport::QtVersionNumber &minimumQtVersion,
- const QtSupport::QtVersionNumber &maximumQtVersion,
- const Core::FeatureSet &requiredFeatures)
-{
- return Qt4BaseTargetFactory::availableBuildConfigurations(id, proFilePath, minimumQtVersion, maximumQtVersion, requiredFeatures);
-}
-
-bool Qt4SymbianTargetFactory::selectByDefault(const Core::Id id) const
-{
- Q_UNUSED(id);
- return true;
-}
-
-QSet<QString> Qt4SymbianTargetFactory::targetFeatures(const Core::Id /*id*/) const
-{
- QSet<QString> features;
- features << QLatin1String(Constants::MOBILE_TARGETFEATURE_ID);
-
- return features;
-}
-
-ProjectExplorer::Target *Qt4SymbianTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id)
-{
- if (!canCreate(parent, id))
- return 0;
-
- QList<QtSupport::BaseQtVersion *> knownVersions = QtSupport::QtVersionManager::instance()->versionsForTargetId(id);
- if (knownVersions.isEmpty())
- return 0;
-
- QtSupport::BaseQtVersion *qtVersion = knownVersions.first();
- QtSupport::BaseQtVersion::QmakeBuildConfigs config = qtVersion->defaultBuildConfig();
-
- QList<BuildConfigurationInfo> infos;
- infos.append(BuildConfigurationInfo(qtVersion->uniqueId(), config, QString(), QString()));
- infos.append(BuildConfigurationInfo(qtVersion->uniqueId(), config ^ QtSupport::BaseQtVersion::DebugBuild, QString(), QString()));
-
- return create(parent, id, infos);
-}
-
-ProjectExplorer::Target *Qt4SymbianTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id, const QList<BuildConfigurationInfo> &infos)
-{
- if (!canCreate(parent, id))
- return 0;
- Qt4SymbianTarget *t = new Qt4SymbianTarget(static_cast<Qt4Project *>(parent), id);
- foreach (const BuildConfigurationInfo &info, infos)
- t->addQt4BuildConfiguration(msgBuildConfigurationName(info), QString(),
- info.version(), info.buildConfig,
- info.additionalArguments, info.directory, info.importing);
-
- t->addDeployConfiguration(t->createDeployConfiguration(Core::Id(S60_DEPLOYCONFIGURATION_ID)));
-
- t->createApplicationProFiles(false);
-
- if (t->runConfigurations().isEmpty())
- t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
- return t;
-}
-
-ProjectExplorer::Target *Qt4SymbianTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id, Qt4TargetSetupWidget *widget)
-{
- if (!widget->isTargetSelected())
- return 0;
- Qt4DefaultTargetSetupWidget *w = static_cast<Qt4DefaultTargetSetupWidget *>(widget);
- return create(parent, id, w->buildConfigurationInfos());
-}
diff --git a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.h b/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.h
deleted file mode 100644
index c802a50607..0000000000
--- a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef QT4SYMBIANTARGETFACTORY_H
-#define QT4SYMBIANTARGETFACTORY_H
-
-#include "qt4basetargetfactory.h"
-
-namespace Qt4ProjectManager {
-namespace Internal {
-class Qt4SymbianTargetFactory : public Qt4BaseTargetFactory
-{
- Q_OBJECT
-public:
- Qt4SymbianTargetFactory(QObject *parent = 0);
- ~Qt4SymbianTargetFactory();
-
- QList<Core::Id> supportedTargetIds() const;
- bool supportsTargetId(const Core::Id id) const;
- QString displayNameForId(const Core::Id id) const;
- QIcon iconForId(const Core::Id id) const;
-
- bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
- bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
- virtual ProjectExplorer::Target *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
-
- virtual ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id);
- virtual ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id,
- const QList<BuildConfigurationInfo> &infos);
- virtual ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id,
- Qt4TargetSetupWidget *widget);
-
- QString shadowBuildDirectory(const QString &profilePath, const Core::Id id, const QString &suffix);
- QList<ProjectExplorer::Task> reportIssues(const QString &proFile);
- QList<BuildConfigurationInfo> availableBuildConfigurations(const Core::Id id, const QString &proFilePath,
- const QtSupport::QtVersionNumber &minimumQtVersion,
- const QtSupport::QtVersionNumber &maximumQtVersion,
- const Core::FeatureSet &requiredFeatures);
-
- bool selectByDefault(const Core::Id id) const;
- QSet<QString> targetFeatures(const Core::Id id) const;
-};
-
-} // namespace Internal
-} // namespace Qt4ProjectManager
-
-
-#endif // QT4SYMBIANTARGETFACTORY_H
diff --git a/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp b/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp
index 21e30c9097..9ffc10b37f 100644
--- a/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp
@@ -62,7 +62,6 @@ static const char *const RVCT_LICENSE_KEY = "ARMLMD_LICENSE_FILE";
static const char rvctPathKeyC[] = "Qt4ProjectManager.RvctToolChain.CompilerPath";
static const char rvctEnvironmentKeyC[] = "Qt4ProjectManager.RvctToolChain.Environment";
static const char rvctArmVersionKeyC[] = "Qt4ProjectManager.RvctToolChain.ArmVersion";
-static const char debuggerCommandKeyC[] = "Qt4ProjectManager.RvctToolChain.Debugger";
static QString valueOf(const QList<Utils::EnvironmentItem> &items, const QString &suffix)
{
@@ -104,8 +103,7 @@ RvctToolChain::RvctToolChain(const RvctToolChain &tc) :
ToolChain(tc),
m_compilerCommand(tc.m_compilerCommand),
m_environmentChanges(tc.m_environmentChanges),
- m_armVersion(tc.m_armVersion),
- m_debuggerCommand(tc.debuggerCommand())
+ m_armVersion(tc.m_armVersion)
{ }
RvctToolChain::RvctVersion RvctToolChain::version(const Utils::FileName &rvctPath)
@@ -253,8 +251,7 @@ bool RvctToolChain::operator ==(const ToolChain &other) const
const RvctToolChain *otherPtr = dynamic_cast<const RvctToolChain *>(&other);
return m_compilerCommand == otherPtr->m_compilerCommand
&& m_environmentChanges == otherPtr->m_environmentChanges
- && m_armVersion == otherPtr->m_armVersion
- && m_debuggerCommand == otherPtr->m_debuggerCommand;
+ && m_armVersion == otherPtr->m_armVersion;
}
void RvctToolChain::setEnvironmentChanges(const QList<Utils::EnvironmentItem> &changes)
@@ -285,19 +282,6 @@ Utils::FileName RvctToolChain::compilerCommand() const
return m_compilerCommand;
}
-void RvctToolChain::setDebuggerCommand(const Utils::FileName &d)
-{
- if (m_debuggerCommand == d)
- return;
- m_debuggerCommand = d;
- toolChainUpdated();
-}
-
-Utils::FileName RvctToolChain::debuggerCommand() const
-{
- return m_debuggerCommand;
-}
-
void RvctToolChain::setArmVersion(RvctToolChain::ArmVersion av)
{
if (m_armVersion == av)
@@ -339,7 +323,6 @@ QVariantMap RvctToolChain::toMap() const
tmp.insert(i.name, i.value);
result.insert(QLatin1String(rvctEnvironmentKeyC), tmp);
result.insert(QLatin1String(rvctArmVersionKeyC), static_cast<int>(m_armVersion));
- result.insert(QLatin1String(debuggerCommandKeyC), m_debuggerCommand.toString());
return result;
}
@@ -354,17 +337,9 @@ bool RvctToolChain::fromMap(const QVariantMap &data)
for (QVariantMap::const_iterator i = tmp.constBegin(); i != tmp.constEnd(); ++i)
m_environmentChanges.append(Utils::EnvironmentItem(i.key(), i.value().toString()));
m_armVersion = static_cast<ArmVersion>(data.value(QLatin1String(rvctArmVersionKeyC), 0).toInt());
- m_debuggerCommand = Utils::FileName::fromString(data.value(QLatin1String(debuggerCommandKeyC)).toString());
return isValid();
}
-QString RvctToolChain::legacyId() const
-{
- const QChar dot = QLatin1Char('.');
- return QLatin1String(Constants::RVCT_TOOLCHAIN_ID) + QLatin1Char(':') + m_compilerCommand.toString() + dot
- + armVersionString(m_armVersion) + dot + m_debuggerCommand.toString();
-}
-
QString RvctToolChain::varName(const QString &postFix) const
{
return QString::fromLatin1("RVCT%1%2%3")
@@ -381,7 +356,6 @@ RvctToolChainConfigWidget::RvctToolChainConfigWidget(RvctToolChain *tc) :
m_model(new Utils::EnvironmentModel(this))
{
m_ui->setupUi(this);
- addDebuggerCommandControls(m_ui->formLayout, QStringList(QLatin1String("--version")));
m_ui->environmentView->setModel(m_model);
m_ui->environmentView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
@@ -400,8 +374,6 @@ RvctToolChainConfigWidget::RvctToolChainConfigWidget(RvctToolChain *tc) :
m_ui->versionComboBox->setCurrentIndex(static_cast<int>(tc->armVersion()));
connect(m_ui->versionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(emitDirty()));
- addMkspecControls(m_ui->formLayout);
-
setFromToolChain();
}
@@ -419,8 +391,6 @@ void RvctToolChainConfigWidget::apply()
tc->setCompilerCommand(m_ui->compilerPath->fileName());
tc->setArmVersion(static_cast<RvctToolChain::ArmVersion>(m_ui->versionComboBox->currentIndex()));
tc->setEnvironmentChanges(changes);
- tc->setDebuggerCommand(debuggerCommand());
- tc->setMkspecList(mkspecList());
m_model->setUserChanges(changes);
}
@@ -434,8 +404,6 @@ void RvctToolChainConfigWidget::setFromToolChain()
m_ui->compilerPath->setFileName(tc->compilerCommand());
m_ui->versionComboBox->setCurrentIndex(static_cast<int>(tc->armVersion()));
- setDebuggerCommand(tc->debuggerCommand());
- setMkspecList(tc->mkspecList());
}
bool RvctToolChainConfigWidget::isDirty() const
@@ -445,9 +413,7 @@ bool RvctToolChainConfigWidget::isDirty() const
return tc->compilerCommand() != m_ui->compilerPath->fileName()
|| tc->armVersion() != static_cast<RvctToolChain::ArmVersion>(m_ui->versionComboBox->currentIndex())
- || tc->environmentChanges() != environmentChanges()
- || tc->debuggerCommand() != debuggerCommand()
- || tc->mkspecList() != mkspecList();
+ || tc->environmentChanges() != environmentChanges();
}
void RvctToolChainConfigWidget::makeReadOnly()
@@ -544,7 +510,6 @@ QList<ProjectExplorer::ToolChain *> RvctToolChainFactory::autoDetect()
tc->setDisplayName(name.arg(armVersionString(tc->armVersion()))
.arg(v.majorVersion).arg(v.minorVersion).arg(v.build));
tc->setVersion(v);
- tc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(tc->targetAbi()));
result.append(tc);
tc = new RvctToolChain(true);
@@ -554,7 +519,6 @@ QList<ProjectExplorer::ToolChain *> RvctToolChainFactory::autoDetect()
tc->setDisplayName(name.arg(armVersionString(tc->armVersion()))
.arg(v.majorVersion).arg(v.minorVersion).arg(v.build));
tc->setVersion(v);
- tc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(tc->targetAbi()));
result.append(tc);
}
diff --git a/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.h b/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.h
index 36e9df44d3..62435f7cea 100644
--- a/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.h
+++ b/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.h
@@ -85,8 +85,6 @@ public:
QString typeDisplayName() const;
ProjectExplorer::Abi targetAbi() const;
- QString legacyId() const;
-
bool isValid() const;
QByteArray predefinedMacros(const QStringList &cxxflags) const;
@@ -105,9 +103,6 @@ public:
void setCompilerCommand(const Utils::FileName &path);
Utils::FileName compilerCommand() const;
- void setDebuggerCommand(const Utils::FileName &d);
- Utils::FileName debuggerCommand() const;
-
void setArmVersion(ArmVersion);
ArmVersion armVersion() const;
@@ -130,7 +125,6 @@ private:
QList<Utils::EnvironmentItem> m_environmentChanges;
ArmVersion m_armVersion;
mutable RvctVersion m_version;
- Utils::FileName m_debuggerCommand;
friend class RvctToolChainFactory;
};
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.cpp b/src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.cpp
index 493c9bd65f..464f842132 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.cpp
@@ -43,6 +43,7 @@
#include "s60certificateinfo.h"
#include "s60certificatedetailsdialog.h"
#include "symbianqtversion.h"
+#include "symbianidevicefactory.h"
#include <app/app_version.h>
@@ -52,11 +53,14 @@
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/target.h>
#include <projectexplorer/project.h>
#include <projectexplorer/gnumakeparser.h>
#include <projectexplorer/task.h>
+#include <qtsupport/qtprofileinformation.h>
+
#include <QDir>
#include <QTimer>
#include <QCryptographicHash>
@@ -182,12 +186,21 @@ Qt4BuildConfiguration *S60CreatePackageStep::qt4BuildConfiguration() const
bool S60CreatePackageStep::init()
{
Qt4Project *pro = qobject_cast<Qt4Project *>(project());
+ ProjectExplorer::ToolChain *tc
+ = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
QList<Qt4ProFileNode *> nodes = pro->allProFiles();
- SymbianQtVersion *sqv = dynamic_cast<SymbianQtVersion *>(qt4BuildConfiguration()->qtVersion());
- if (!sqv)
+ SymbianQtVersion *sqv
+ = dynamic_cast<SymbianQtVersion *>(QtSupport::QtProfileInformation::qtVersion(target()->profile()));
+ if (!sqv) {
+ emit addOutput(tr("The selected profile is not configured with a Symbian Qt"), BuildStep::ErrorOutput);
+ return false;
+ }
+ if (!tc) {
+ emit addOutput(tr("The selected profile has no toolchain"), BuildStep::ErrorOutput);
return false;
+ }
m_isBuildWithSymbianSbsV2 = sqv->isBuildWithSymbianSbsV2();
m_workingDirectories.clear();
@@ -198,7 +211,7 @@ bool S60CreatePackageStep::init()
}
projectCapabilities.removeDuplicates();
- m_makeCmd = qt4BuildConfiguration()->makeCommand();
+ m_makeCmd = tc->makeCommand();
if (!QFileInfo(m_makeCmd).isAbsolute()) {
// Try to detect command in environment
const QString tmp = qt4BuildConfiguration()->environment().searchInPath(m_makeCmd);
@@ -265,7 +278,7 @@ void S60CreatePackageStep::handleWarnAboutPatching()
changedText = tr("<p>Qt modified some of your packages.</p>");
}
const QString text =
- tr("%1<p><em>These changes were not part of your build system</em> but are required to "
+ tr("%1<p><em>These changes were not part of your build profile</em> but are required to "
"make sure the <em>self-signed</em> package can be installed successfully on a device.</p>"
"<p>Check the Issues pane for more details on the modifications made.</p>"
"<p>Please see the <a href=\"%2\">documentation</a> for other signing options which "
@@ -739,11 +752,7 @@ S60CreatePackageStepFactory::~S60CreatePackageStepFactory()
bool S60CreatePackageStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
{
- if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY))
- return false;
- if (parent->target()->id() != Core::Id(Constants::S60_DEVICE_TARGET_ID))
- return false;
- return (id == Core::Id(SIGN_BS_ID));
+ return canHandle(parent) && id == Core::Id(SIGN_BS_ID);
}
ProjectExplorer::BuildStep *S60CreatePackageStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
@@ -765,6 +774,16 @@ ProjectExplorer::BuildStep *S60CreatePackageStepFactory::clone(ProjectExplorer::
return new S60CreatePackageStep(parent, static_cast<S60CreatePackageStep *>(source));
}
+bool S60CreatePackageStepFactory::canHandle(ProjectExplorer::BuildStepList *parent) const
+{
+ if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY))
+ return false;
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->target()->profile());
+ if (deviceType != SymbianIDeviceFactory::deviceType())
+ return false;
+ return qobject_cast<Qt4Project *>(parent->target()->project());
+}
+
bool S60CreatePackageStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
@@ -783,11 +802,10 @@ ProjectExplorer::BuildStep *S60CreatePackageStepFactory::restore(ProjectExplorer
QList<Core::Id> S60CreatePackageStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
{
- if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY))
+ if (!canHandle(parent))
return QList<Core::Id>();
- if (parent->target()->id() == Core::Id(Constants::S60_DEVICE_TARGET_ID))
- return QList<Core::Id>() << Core::Id(SIGN_BS_ID);
- return QList<Core::Id>();
+
+ return QList<Core::Id>() << Core::Id(SIGN_BS_ID);
}
QString S60CreatePackageStepFactory::displayNameForId(const Core::Id id) const
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.h b/src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.h
index 8cbdb8aa1c..b308036123 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.h
+++ b/src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.h
@@ -73,6 +73,8 @@ public:
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);
bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product);
+
+ bool canHandle(ProjectExplorer::BuildStepList *parent) const;
};
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.cpp
index 6b7f323378..0e9b22f2b1 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.cpp
@@ -34,11 +34,9 @@
#include "s60deployconfigurationwidget.h"
#include "s60manager.h"
#include "qt4project.h"
-#include "qt4target.h"
#include "qt4nodes.h"
#include "qt4projectmanagerconstants.h"
#include "qt4buildconfiguration.h"
-#include "qt4symbiantarget.h"
#include "s60createpackagestep.h"
#include "s60deploystep.h"
#include "symbianidevice.h"
@@ -51,9 +49,13 @@
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/project.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/devicesupport/devicemanager.h>
+#include <qtsupport/qtprofileinformation.h>
+
#include <QFileInfo>
using namespace ProjectExplorer;
@@ -107,15 +109,17 @@ S60DeployConfiguration::S60DeployConfiguration(Target *target, S60DeployConfigur
void S60DeployConfiguration::ctor()
{
setDefaultDisplayName(defaultDisplayName());
+
+ Qt4Project *project = static_cast<Qt4Project *>(target()->project());
// TODO disable S60 Deploy Configuration while parsing
// requires keeping track of the parsing state of the project
- connect(qt4Target()->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
+ connect(project, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
this, SLOT(slotTargetInformationChanged(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
- connect(qt4Target(), SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
+ connect(target(), SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
this, SLOT(updateActiveBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
- connect(qt4Target(), SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
+ connect(target(), SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
this, SLOT(updateActiveRunConfiguration(ProjectExplorer::RunConfiguration*)));
- updateActiveBuildConfiguration(qt4Target()->activeBuildConfiguration());
+ updateActiveBuildConfiguration(target()->activeBuildConfiguration());
}
S60DeployConfiguration::~S60DeployConfiguration()
@@ -155,7 +159,7 @@ bool S60DeployConfiguration::hasSisPackage(const Qt4ProFileNode &projectNode) co
QStringList S60DeployConfiguration::signedPackages() const
{
- QList<Qt4ProFileNode *> list = qt4Target()->qt4Project()->allProFiles();
+ QList<Qt4ProFileNode *> list = static_cast<Qt4Project *>(target()->project())->allProFiles();
QStringList result;
foreach (Qt4ProFileNode *node, list) {
if (!hasSisPackage(*node))
@@ -183,7 +187,7 @@ SymbianIDevice::ConstPtr S60DeployConfiguration::device() const
QStringList S60DeployConfiguration::packageFileNamesWithTargetInfo() const
{
- QList<Qt4ProFileNode *> leafs = qt4Target()->qt4Project()->allProFiles();
+ QList<Qt4ProFileNode *> leafs = static_cast<Qt4Project *>(target()->project())->allProFiles();
QStringList result;
foreach (Qt4ProFileNode *qt4ProFileNode, leafs) {
if (!hasSisPackage(*qt4ProFileNode))
@@ -192,9 +196,10 @@ QStringList S60DeployConfiguration::packageFileNamesWithTargetInfo() const
if (!ti.valid)
continue;
QString baseFileName = ti.buildDir + QLatin1Char('/') + ti.target;
+ ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
baseFileName += QLatin1Char('_')
+ (isDebug() ? QLatin1String("debug") : QLatin1String("release"))
- + QLatin1Char('-') + S60Manager::platform(qt4Target()->activeBuildConfiguration()->toolChain()) + QLatin1String(".sis");
+ + QLatin1Char('-') + S60Manager::platform(tc) + QLatin1String(".sis");
result << baseFileName;
}
return result;
@@ -202,7 +207,7 @@ QStringList S60DeployConfiguration::packageFileNamesWithTargetInfo() const
QStringList S60DeployConfiguration::packageTemplateFileNames() const
{
- QList<Qt4ProFileNode *> list = qt4Target()->qt4Project()->allProFiles();
+ QList<Qt4ProFileNode *> list = static_cast<Qt4Project *>(target()->project())->allProFiles();
QStringList result;
foreach (Qt4ProFileNode *node, list) {
if (!hasSisPackage(*node))
@@ -216,7 +221,7 @@ QStringList S60DeployConfiguration::packageTemplateFileNames() const
QStringList S60DeployConfiguration::appPackageTemplateFileNames() const
{
- QList<Qt4ProFileNode *> list = qt4Target()->qt4Project()->allProFiles();
+ QList<Qt4ProFileNode *> list = static_cast<Qt4Project *>(target()->project())->allProFiles();
QStringList result;
foreach (Qt4ProFileNode *node, list) {
if (!hasSisPackage(*node))
@@ -258,16 +263,10 @@ bool S60DeployConfiguration::isSigned() const
return false;
}
-ProjectExplorer::ToolChain *S60DeployConfiguration::toolChain() const
-{
- if (Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(target()->activeBuildConfiguration()))
- return bc->toolChain();
- return 0;
-}
-
bool S60DeployConfiguration::isDebug() const
{
- const Qt4BuildConfiguration *qt4bc = qt4Target()->activeQt4BuildConfiguration();
+ const Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(target()->activeBuildConfiguration());
+ QTC_ASSERT(qt4bc, return false);
return (qt4bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild);
}
@@ -276,13 +275,6 @@ QString S60DeployConfiguration::symbianTarget() const
return isDebug() ? QLatin1String("udeb") : QLatin1String("urel");
}
-const QtSupport::BaseQtVersion *S60DeployConfiguration::qtVersion() const
-{
- if (const Qt4BuildConfiguration *qt4bc = qt4Target()->activeQt4BuildConfiguration())
- return qt4bc->qtVersion();
- return 0;
-}
-
void S60DeployConfiguration::updateActiveBuildConfiguration(ProjectExplorer::BuildConfiguration *buildConfiguration)
{
if (m_activeBuildConfiguration)
@@ -311,7 +303,7 @@ QVariantMap S60DeployConfiguration::toMap() const
QString S60DeployConfiguration::defaultDisplayName() const
{
- QList<Qt4ProFileNode *> list = qt4Target()->qt4Project()->allProFiles();
+ QList<Qt4ProFileNode *> list = static_cast<Qt4Project *>(target()->project())->allProFiles();
foreach (Qt4ProFileNode *node, list) {
TargetInformation ti = node->targetInformation();
if (ti.valid && !ti.buildDir.isEmpty())
@@ -332,11 +324,6 @@ bool S60DeployConfiguration::fromMap(const QVariantMap &map)
return true;
}
-Qt4SymbianTarget *S60DeployConfiguration::qt4Target() const
-{
- return static_cast<Qt4SymbianTarget *>(target());
-}
-
char S60DeployConfiguration::installationDrive() const
{
return m_installationDrive;
@@ -375,8 +362,7 @@ const QList<S60DeployConfiguration::DeviceDrive> &S60DeployConfiguration::availa
S60DeployConfigurationFactory::S60DeployConfigurationFactory(QObject *parent) :
DeployConfigurationFactory(parent)
-{
-}
+{ setObjectName(QLatin1String("S60DeployConfiguration")); }
S60DeployConfigurationFactory::~S60DeployConfigurationFactory()
{
@@ -385,11 +371,16 @@ S60DeployConfigurationFactory::~S60DeployConfigurationFactory()
QList<Core::Id> S60DeployConfigurationFactory::availableCreationIds(Target *parent) const
{
QList<Core::Id> result;
- Qt4SymbianTarget *target = qobject_cast<Qt4SymbianTarget *>(parent);
- if (!target || target->id() != Core::Id(Constants::S60_DEVICE_TARGET_ID))
+ Qt4Project *project = qobject_cast<Qt4Project *>(parent->project());
+
+ if (!project)
+ return result;
+
+ ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceProfileInformation::device(parent->profile());
+ if (dev.isNull() || dev->type() != SymbianIDeviceFactory::deviceType())
return result;
- QStringList proFiles = target->qt4Project()->applicationProFilePathes(QLatin1String(S60_DC_PREFIX));
+ QStringList proFiles = project->applicationProFilePathes(QLatin1String(S60_DC_PREFIX));
foreach (const QString &pf, proFiles)
result << Core::Id(pf.toUtf8().constData());
return result;
@@ -407,8 +398,7 @@ DeployConfiguration *S60DeployConfigurationFactory::create(Target *parent, const
if (!canCreate(parent, id))
return 0;
- Qt4SymbianTarget *t = static_cast<Qt4SymbianTarget *>(parent);
- S60DeployConfiguration *dc = new S60DeployConfiguration(t);
+ S60DeployConfiguration *dc = new S60DeployConfiguration(parent);
dc->setDefaultDisplayName(tr("Deploy to Symbian device"));
dc->stepList()->insertStep(0, new S60CreatePackageStep(dc->stepList()));
@@ -418,11 +408,13 @@ DeployConfiguration *S60DeployConfigurationFactory::create(Target *parent, const
bool S60DeployConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
{
- Qt4SymbianTarget * t = qobject_cast<Qt4SymbianTarget *>(parent);
- if (!t || t->id() != Core::Id(Constants::S60_DEVICE_TARGET_ID)
- || !QString::fromUtf8(id.name()).startsWith(QLatin1String(S60_DEPLOYCONFIGURATION_ID)))
+ Qt4Project *project = qobject_cast<Qt4Project *>(parent->project());
+ if (!project)
return false;
- return true;
+ ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceProfileInformation::device(parent->profile());
+ if (dev.isNull() || dev->type() != SymbianIDeviceFactory::deviceType())
+ return false;
+ return id == Core::Id(S60_DEPLOYCONFIGURATION_ID);
}
bool S60DeployConfigurationFactory::canRestore(Target *parent, const QVariantMap& map) const
@@ -434,8 +426,7 @@ DeployConfiguration *S60DeployConfigurationFactory::restore(Target *parent, cons
{
if (!canRestore(parent, map))
return 0;
- Qt4SymbianTarget *t = static_cast<Qt4SymbianTarget *>(parent);
- S60DeployConfiguration *dc = new S60DeployConfiguration(t);
+ S60DeployConfiguration *dc = new S60DeployConfiguration(parent);
if (dc->fromMap(map))
return dc;
@@ -445,7 +436,7 @@ DeployConfiguration *S60DeployConfigurationFactory::restore(Target *parent, cons
bool S60DeployConfigurationFactory::canClone(Target *parent, DeployConfiguration *source) const
{
- if (!qobject_cast<Qt4SymbianTarget *>(parent))
+ if (!qobject_cast<Qt4Project *>(parent->project()))
return false;
return source->id() == Core::Id(S60_DEPLOYCONFIGURATION_ID);
}
@@ -454,7 +445,6 @@ DeployConfiguration *S60DeployConfigurationFactory::clone(Target *parent, Deploy
{
if (!canClone(parent, source))
return 0;
- Qt4SymbianTarget *t = static_cast<Qt4SymbianTarget *>(parent);
- S60DeployConfiguration * old = static_cast<S60DeployConfiguration *>(source);
- return new S60DeployConfiguration(t, old);
+ S60DeployConfiguration *old = static_cast<S60DeployConfiguration *>(source);
+ return new S60DeployConfiguration(parent, old);
}
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h
index ca5552c9a0..ed7de185d1 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h
+++ b/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h
@@ -71,9 +71,6 @@ public:
ProjectExplorer::DeployConfigurationWidget *configurationWidget() const;
- const QtSupport::BaseQtVersion *qtVersion() const;
- ProjectExplorer::ToolChain *toolChain() const;
-
char installationDrive() const;
void setInstallationDrive(char drive);
@@ -118,7 +115,6 @@ private:
bool isStaticLibrary(const Qt4ProFileNode &projectNode) const;
bool isApplication(const Qt4ProFileNode &projectNode) const;
bool hasSisPackage(const Qt4ProFileNode &projectNode) const;
- Internal::Qt4SymbianTarget *qt4Target() const;
private:
ProjectExplorer::BuildConfiguration *m_activeBuildConfiguration;
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp
index 239e981361..b6ab99ee9c 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp
@@ -33,15 +33,18 @@
#include "s60deploystep.h"
#include "qt4buildconfiguration.h"
+#include "qt4project.h"
#include "s60deployconfiguration.h"
#include "s60devicerunconfiguration.h"
#include "symbianidevice.h"
+#include "symbianidevicefactory.h"
#include "codadevice.h"
#include "codaruncontrol.h"
#include <coreplugin/icore.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/target.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <qt4projectmanagerconstants.h>
@@ -678,11 +681,7 @@ S60DeployStepFactory::~S60DeployStepFactory()
bool S60DeployStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
{
- if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY))
- return false;
- if (parent->target()->id() != Core::Id(Constants::S60_DEVICE_TARGET_ID))
- return false;
- return (id == Core::Id(S60_DEPLOY_STEP_ID));
+ return canHandle(parent) && id == Core::Id(S60_DEPLOY_STEP_ID);
}
ProjectExplorer::BuildStep *S60DeployStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
@@ -708,6 +707,16 @@ ProjectExplorer::BuildStep *S60DeployStepFactory::clone(ProjectExplorer::BuildSt
return new S60DeployStep(parent, static_cast<S60DeployStep *>(source));
}
+bool S60DeployStepFactory::canHandle(BuildStepList *parent) const
+{
+ if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY))
+ return false;
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->target()->profile());
+ if (deviceType != SymbianIDeviceFactory::deviceType())
+ return false;
+ return qobject_cast<Qt4Project *>(parent->target()->project());
+}
+
bool S60DeployStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
@@ -726,10 +735,9 @@ ProjectExplorer::BuildStep *S60DeployStepFactory::restore(ProjectExplorer::Build
QList<Core::Id> S60DeployStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
{
- if (parent->id() == Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
- && parent->target()->id() == Core::Id(Constants::S60_DEVICE_TARGET_ID))
- return QList<Core::Id>() << Core::Id(S60_DEPLOY_STEP_ID);
- return QList<Core::Id>();
+ if (!canHandle(parent))
+ return QList<Core::Id>();
+ return QList<Core::Id>() << Core::Id(S60_DEPLOY_STEP_ID);
}
QString S60DeployStepFactory::displayNameForId(const Core::Id id) const
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h
index bbe172f4bd..e2e15e7396 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h
+++ b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h
@@ -82,6 +82,8 @@ public:
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);
bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product);
+
+ bool canHandle(ProjectExplorer::BuildStepList *parent) const;
};
class S60DeployStep : public ProjectExplorer::BuildStep
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp
index 924ab78920..041fa573b5 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp
@@ -33,7 +33,6 @@
#include "s60devicedebugruncontrol.h"
#include "codaruncontrol.h"
-#include "qt4symbiantarget.h"
#include "s60deployconfiguration.h"
#include "s60devicerunconfiguration.h"
#include "symbianidevice.h"
@@ -41,8 +40,9 @@
#include <coreplugin/icore.h>
#include <debugger/debuggerengine.h>
#include <debugger/debuggerstartparameters.h>
-#include <projectexplorer/project.h>
#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/project.h>
+#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
#include <QFileInfo>
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
index 70d9a978d3..99e304829d 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
@@ -35,17 +35,20 @@
#include "qt4project.h"
#include "qt4nodes.h"
#include "qt4projectmanagerconstants.h"
-#include "qt4symbiantarget.h"
-#include "qt4target.h"
#include "qt4buildconfiguration.h"
#include "s60deployconfiguration.h"
#include "s60devicerunconfigurationwidget.h"
#include "s60manager.h"
#include "symbianidevice.h"
+#include "symbianidevicefactory.h"
#include "symbianqtversion.h"
#include <utils/qtcassert.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/target.h>
+#include <qtsupport/customexecutablerunconfiguration.h>
#include <qtsupport/qtoutputformatter.h>
+#include <qtsupport/qtprofileinformation.h>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
@@ -75,17 +78,19 @@ QString pathFromId(Core::Id id)
// ======== S60DeviceRunConfiguration
-S60DeviceRunConfiguration::S60DeviceRunConfiguration(Qt4BaseTarget *parent, const QString &proFilePath) :
- RunConfiguration(parent, Core::Id(S60_DEVICE_RC_ID)),
- m_proFilePath(proFilePath),
- m_validParse(parent->qt4Project()->validParse(proFilePath)),
- m_parseInProgress(parent->qt4Project()->parseInProgress(proFilePath))
+S60DeviceRunConfiguration::S60DeviceRunConfiguration(Target *parent, Core::Id id) :
+ RunConfiguration(parent, id),
+ m_proFilePath(pathFromId(id))
{
+ Qt4Project *project = static_cast<Qt4Project *>(parent->project());
+ m_validParse = project->validParse(m_proFilePath);
+ m_parseInProgress = project->parseInProgress(m_proFilePath);
+
ctor();
}
-S60DeviceRunConfiguration::S60DeviceRunConfiguration(Qt4BaseTarget *target, S60DeviceRunConfiguration *source) :
- RunConfiguration(target, source),
+S60DeviceRunConfiguration::S60DeviceRunConfiguration(Target *parent, S60DeviceRunConfiguration *source) :
+ RunConfiguration(parent, source),
m_proFilePath(source->m_proFilePath),
m_commandLineArguments(source->m_commandLineArguments),
m_validParse(source->m_validParse),
@@ -103,7 +108,7 @@ void S60DeviceRunConfiguration::ctor()
//: S60 device runconfiguration default display name (no profile set)
setDefaultDisplayName(tr("Run on Symbian device"));
- Qt4Project *pro = qt4Target()->qt4Project();
+ Qt4Project *pro = static_cast<Qt4Project *>(target()->project());
connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
this, SLOT(proFileUpdate(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
}
@@ -126,11 +131,6 @@ S60DeviceRunConfiguration::~S60DeviceRunConfiguration()
{
}
-Qt4SymbianTarget *S60DeviceRunConfiguration::qt4Target() const
-{
- return static_cast<Qt4SymbianTarget *>(target());
-}
-
bool S60DeviceRunConfiguration::isEnabled() const
{
return m_validParse && !m_parseInProgress;
@@ -142,7 +142,7 @@ QString S60DeviceRunConfiguration::disabledReason() const
return tr("The .pro file '%1' is currently being parsed.")
.arg(QFileInfo(m_proFilePath).fileName());
if (!m_validParse)
- return qt4Target()->qt4Project()->disabledReasonForRunConfiguration(m_proFilePath);
+ return static_cast<Qt4Project *>(target()->project())->disabledReasonForRunConfiguration(m_proFilePath);
return QString();
}
@@ -153,7 +153,7 @@ QWidget *S60DeviceRunConfiguration::createConfigurationWidget()
Utils::OutputFormatter *S60DeviceRunConfiguration::createOutputFormatter() const
{
- return new QtSupport::QtOutputFormatter(qt4Target()->qt4Project());
+ return new QtSupport::QtOutputFormatter(target()->project());
}
QVariantMap S60DeviceRunConfiguration::toMap() const
@@ -179,8 +179,8 @@ bool S60DeviceRunConfiguration::fromMap(const QVariantMap &map)
if (!QFileInfo(m_proFilePath).exists())
return false;
- m_validParse = qt4Target()->qt4Project()->validParse(m_proFilePath);
- m_parseInProgress = qt4Target()->qt4Project()->parseInProgress(m_proFilePath);
+ m_validParse = static_cast<Qt4Project *>(target()->project())->validParse(m_proFilePath);
+ m_parseInProgress = static_cast<Qt4Project *>(target()->project())->parseInProgress(m_proFilePath);
setDefaultDisplayName(tr("%1 on Symbian Device").arg(QFileInfo(m_proFilePath).completeBaseName()));
@@ -198,23 +198,16 @@ static inline QString fixBaseNameTarget(const QString &in)
QString S60DeviceRunConfiguration::targetName() const
{
- TargetInformation ti = qt4Target()->qt4Project()->rootQt4ProjectNode()->targetInformation(projectFilePath());
+ TargetInformation ti = static_cast<Qt4Project *>(target()->project())
+ ->rootQt4ProjectNode()->targetInformation(projectFilePath());
if (!ti.valid)
return QString();
return ti.target;
}
-SymbianQtVersion *S60DeviceRunConfiguration::qtVersion() const
-{
- if (const BuildConfiguration *bc = target()->activeBuildConfiguration())
- if (const Qt4BuildConfiguration *qt4bc = qobject_cast<const Qt4BuildConfiguration *>(bc))
- return dynamic_cast<SymbianQtVersion *>(qt4bc->qtVersion());
- return 0;
-}
-
bool S60DeviceRunConfiguration::isDebug() const
{
- const Qt4BuildConfiguration *qt4bc = qt4Target()->activeQt4BuildConfiguration();
+ const Qt4BuildConfiguration *qt4bc = static_cast<const Qt4BuildConfiguration *>(target()->activeBuildConfiguration());
return (qt4bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild);
}
@@ -224,12 +217,18 @@ QString S60DeviceRunConfiguration::symbianTarget() const
}
// ABLD/Raptor: Return executable from device/EPOC
-static inline QString localExecutableFromVersion(const SymbianQtVersion *qtv,
- const QString &symbianTarget, /* udeb/urel */
- const QString &targetName,
- const ProjectExplorer::ToolChain *tc)
+static inline QString localExecutableFromVersion(const ProjectExplorer::Profile *p,
+ const QString &symbianTarget, /* udeb/urel */
+ const QString &targetName)
{
- Q_ASSERT(qtv);
+ Q_ASSERT(p);
+
+ ToolChain *tc = ToolChainProfileInformation::toolChain(p);
+ SymbianQtVersion *qtv = dynamic_cast<SymbianQtVersion *>(QtSupport::QtProfileInformation::qtVersion(p));
+ QString root;
+ if (SysRootProfileInformation::hasSysRoot(p))
+ root = SysRootProfileInformation::sysRoot(p).toString();
+
if (!tc)
return QString();
@@ -237,19 +236,18 @@ static inline QString localExecutableFromVersion(const SymbianQtVersion *qtv,
QString platform = S60Manager::platform(tc);
if (qtv->isBuildWithSymbianSbsV2() && platform == QLatin1String("gcce"))
platform = QLatin1String("armv5");
- QTextStream(&localExecutable) << qtv->systemRoot() << "/epoc32/release/"
+ QTextStream(&localExecutable) << root << "/epoc32/release/"
<< platform << '/' << symbianTarget << '/' << targetName << ".exe";
return localExecutable;
}
QString S60DeviceRunConfiguration::localExecutableFileName() const
{
- TargetInformation ti = qt4Target()->qt4Project()->rootQt4ProjectNode()->targetInformation(projectFilePath());
+ TargetInformation ti = static_cast<Qt4Project *>(target()->project())->rootQt4ProjectNode()->targetInformation(projectFilePath());
if (!ti.valid)
return QString();
- ProjectExplorer::ToolChain *tc = target()->activeBuildConfiguration()->toolChain();
- return localExecutableFromVersion(qtVersion(), symbianTarget(), targetName(), tc);
+ return localExecutableFromVersion(target()->profile(), symbianTarget(), targetName());
}
quint32 S60DeviceRunConfiguration::executableUid() const
@@ -293,7 +291,7 @@ QString S60DeviceRunConfiguration::qmlCommandLineArguments() const
QString args;
if (debuggerAspect()->useQmlDebugger()) {
const S60DeployConfiguration *activeDeployConf =
- qobject_cast<S60DeployConfiguration *>(qt4Target()->activeDeployConfiguration());
+ qobject_cast<const S60DeployConfiguration *>(target()->activeDeployConfiguration());
QTC_ASSERT(activeDeployConf, return args);
QSharedPointer<const SymbianIDevice> dev = activeDeployConf->device().dynamicCast<const SymbianIDevice>();
@@ -313,24 +311,22 @@ QString S60DeviceRunConfiguration::proFilePath() const
// ======== S60DeviceRunConfigurationFactory
S60DeviceRunConfigurationFactory::S60DeviceRunConfigurationFactory(QObject *parent) :
- IRunConfigurationFactory(parent)
-{
-}
+ QmakeRunConfigurationFactory(parent)
+{ setObjectName(QLatin1String("S60DeviceRunConfigurationFactory"));}
S60DeviceRunConfigurationFactory::~S60DeviceRunConfigurationFactory()
-{
-}
+{ }
QList<Core::Id> S60DeviceRunConfigurationFactory::availableCreationIds(Target *parent) const
{
QList<Core::Id> result;
- Qt4SymbianTarget *target = qobject_cast<Qt4SymbianTarget *>(parent);
- if (!target || target->id() != Core::Id(Constants::S60_DEVICE_TARGET_ID))
+ if (!canHandle(parent))
return result;
- QStringList proFiles = target->qt4Project()->applicationProFilePathes(QLatin1String(S60_DEVICE_RC_PREFIX));
+ Qt4Project *project = static_cast<Qt4Project *>(parent->project());
+ QStringList proFiles = project->applicationProFilePathes(QLatin1String(S60_DEVICE_RC_PREFIX));
foreach (const QString &pf, proFiles)
- result << Core::Id(pf.toUtf8().constData());
+ result << Core::Id(pf);
return result;
}
@@ -341,12 +337,34 @@ QString S60DeviceRunConfigurationFactory::displayNameForId(const Core::Id id) co
return QString();
}
+bool S60DeviceRunConfigurationFactory::canHandle(Target *t) const
+{
+ if (!t->project()->supportsProfile(t->profile()))
+ return false;
+ if (!qobject_cast<Qt4Project *>(t->project()))
+ return false;
+
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(t->profile());
+ return deviceType == SymbianIDeviceFactory::deviceType();
+}
+
+QList<RunConfiguration *> S60DeviceRunConfigurationFactory::runConfigurationsForNode(Target *t, ProjectExplorer::Node *n)
+{
+ QList<ProjectExplorer::RunConfiguration *> result;
+ foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations()) {
+ if (S60DeviceRunConfiguration *s60rc = qobject_cast<S60DeviceRunConfiguration *>(rc))
+ if (s60rc->proFilePath() == n->path())
+ result << rc;
+ }
+ return result;
+}
+
bool S60DeviceRunConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
{
- Qt4SymbianTarget *t = qobject_cast<Qt4SymbianTarget *>(parent);
- if (!t || t->id() != Core::Id(Constants::S60_DEVICE_TARGET_ID))
+ if (!canHandle(parent))
return false;
- return t->qt4Project()->hasApplicationProFile(pathFromId(id));
+ Qt4Project *project = static_cast<Qt4Project *>(parent->project());
+ return project->hasApplicationProFile(pathFromId(id));
}
RunConfiguration *S60DeviceRunConfigurationFactory::create(Target *parent, const Core::Id id)
@@ -354,25 +372,23 @@ RunConfiguration *S60DeviceRunConfigurationFactory::create(Target *parent, const
if (!canCreate(parent, id))
return 0;
- Qt4SymbianTarget *t = static_cast<Qt4SymbianTarget *>(parent);
- return new S60DeviceRunConfiguration(t, pathFromId(id));
+ return new S60DeviceRunConfiguration(parent, id);
}
bool S60DeviceRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
{
- Qt4SymbianTarget *t = qobject_cast<Qt4SymbianTarget *>(parent);
- if (!t || t->id() != Core::Id(Constants::S60_DEVICE_TARGET_ID))
+ if (!canHandle(parent))
return false;
- QString id = QString::fromUtf8(ProjectExplorer::idFromMap(map).name());
- return id == QLatin1String(S60_DEVICE_RC_ID);
+
+ const Core::Id id = ProjectExplorer::idFromMap(map);
+ return id == Core::Id(S60_DEVICE_RC_ID);
}
RunConfiguration *S60DeviceRunConfigurationFactory::restore(Target *parent, const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
- Qt4SymbianTarget *t = static_cast<Qt4SymbianTarget *>(parent);
- S60DeviceRunConfiguration *rc = new S60DeviceRunConfiguration(t, QString());
+ S60DeviceRunConfiguration *rc = new S60DeviceRunConfiguration(parent, idFromMap(map));
if (rc->fromMap(map))
return rc;
@@ -382,7 +398,7 @@ RunConfiguration *S60DeviceRunConfigurationFactory::restore(Target *parent, cons
bool S60DeviceRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
{
- if (!qobject_cast<Qt4SymbianTarget *>(parent))
+ if (!canHandle(parent))
return false;
return source->id() == Core::Id(S60_DEVICE_RC_ID);
}
@@ -391,7 +407,6 @@ RunConfiguration *S60DeviceRunConfigurationFactory::clone(Target *parent, RunCon
{
if (!canClone(parent, source))
return 0;
- Qt4SymbianTarget *t = static_cast<Qt4SymbianTarget *>(parent);
S60DeviceRunConfiguration *old = static_cast<S60DeviceRunConfiguration *>(source);
- return new S60DeviceRunConfiguration(t, old);
+ return new S60DeviceRunConfiguration(parent, old);
}
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h
index 1480e04ff7..82f181ac9a 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h
@@ -33,8 +33,10 @@
#ifndef S60DEVICERUNCONFIGURATION_H
#define S60DEVICERUNCONFIGURATION_H
+#include "../qmakerunconfigurationfactory.h"
+#include "../qt4projectmanager_global.h"
+
#include <projectexplorer/runconfiguration.h>
-#include <qt4projectmanager/qt4projectmanager_global.h>
#include <QFutureInterface>
#include <QStringList>
@@ -43,14 +45,12 @@ QT_BEGIN_NAMESPACE
class QWidget;
QT_END_NAMESPACE
+namespace ProjectExplorer { class Node; }
+
namespace Qt4ProjectManager {
-class Qt4BaseTarget;
class Qt4ProFileNode;
-namespace Internal {
-class SymbianQtVersion;
-class Qt4SymbianTarget;
-}
+namespace Internal { class SymbianQtVersion; }
class S60DeviceRunConfigurationFactory;
@@ -60,7 +60,7 @@ class QT4PROJECTMANAGER_EXPORT S60DeviceRunConfiguration : public ProjectExplore
friend class S60DeviceRunConfigurationFactory;
public:
- S60DeviceRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, const QString &proFilePath);
+ S60DeviceRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
virtual ~S60DeviceRunConfiguration();
bool isEnabled() const;
@@ -89,7 +89,7 @@ signals:
void targetInformationChanged();
protected:
- S60DeviceRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, S60DeviceRunConfiguration *source);
+ S60DeviceRunConfiguration(ProjectExplorer::Target *parent, S60DeviceRunConfiguration *source);
QString defaultDisplayName() const;
virtual bool fromMap(const QVariantMap &map);
@@ -98,8 +98,6 @@ private slots:
private:
void ctor();
- Internal::Qt4SymbianTarget *qt4Target() const;
- Internal::SymbianQtVersion *qtVersion() const;
QString m_proFilePath;
QString m_commandLineArguments;
@@ -107,7 +105,7 @@ private:
bool m_parseInProgress;
};
-class S60DeviceRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
+class S60DeviceRunConfigurationFactory : public QmakeRunConfigurationFactory
{
Q_OBJECT
@@ -125,6 +123,10 @@ public:
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
// used to translate the ids to names to display to the user
QString displayNameForId(const Core::Id id) const;
+
+ bool canHandle(ProjectExplorer::Target *t) const;
+ QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
+ ProjectExplorer::Node *n);
};
} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp
index 35213a401e..252984fd7c 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp
@@ -31,9 +31,7 @@
**************************************************************************/
#include "s60manager.h"
-//#include "qtversionmanager.h"
-//#include "s60devicespreferencepane.h"
#include "s60devicerunconfiguration.h"
#include "s60createpackagestep.h"
#include "s60deployconfiguration.h"
@@ -43,7 +41,6 @@
#include "symbianidevice.h"
#include "symbianidevicefactory.h"
-#include "qt4symbiantargetfactory.h"
#include "s60publishingwizardfactories.h"
#include "gccetoolchain.h"
@@ -120,7 +117,6 @@ S60Manager::S60Manager(QObject *parent) : QObject(parent)
addAutoReleasedObject(new S60DeployStepFactory);
addAutoReleasedObject(new S60DeviceDebugRunControlFactory);
- addAutoReleasedObject(new Qt4SymbianTargetFactory);
addAutoReleasedObject(new S60DeployConfigurationFactory);
addAutoReleasedObject(new S60PublishingWizardFactoryOvi);
@@ -154,7 +150,7 @@ QString S60Manager::platform(const ProjectExplorer::ToolChain *tc)
return target.right(target.lastIndexOf(QLatin1Char('-')));
}
-void S60Manager::delayedInitialize()
+void S60Manager::extensionsInitialize()
{
handleQtVersionChanges();
connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60manager.h b/src/plugins/qt4projectmanager/qt-s60/s60manager.h
index febcefc693..4f7a030b73 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60manager.h
+++ b/src/plugins/qt4projectmanager/qt-s60/s60manager.h
@@ -49,11 +49,12 @@ class S60Manager : public QObject
public:
S60Manager(QObject *parent = 0);
~S60Manager();
+
static S60Manager *instance();
static QString platform(const ProjectExplorer::ToolChain *tc);
- void delayedInitialize();
+ void extensionsInitialize();
private slots:
void symbianDeviceRemoved(const SymbianUtils::SymbianDevice &d);
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.cpp b/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.cpp
index 32c0fcc57e..4d0b8e3dac 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.cpp
@@ -31,7 +31,6 @@
**************************************************************************/
#include "s60publisherovi.h"
-#include "qt4symbiantarget.h"
#include "s60certificateinfo.h"
#include "s60manager.h"
@@ -43,7 +42,9 @@
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/buildstep.h>
+#include <projectexplorer/target.h>
#include <qtsupport/qtversionmanager.h>
+#include <qtsupport/qtprofileinformation.h>
#include <qtsupport/profilereader.h>
#include <utils/qtcassert.h>
@@ -131,6 +132,7 @@ void S60PublisherOvi::cleanUp()
void S60PublisherOvi::completeCreation()
{
+#if 0 // FIXME: This needs serious reworking!
// set active target
m_activeTargetOfProject = qobject_cast<Qt4SymbianTarget *>(m_qt4bc->target());
QTC_ASSERT(m_activeTargetOfProject, return);
@@ -213,6 +215,7 @@ void S60PublisherOvi::completeCreation()
}
}
}
+#endif
}
bool S60PublisherOvi::isDynamicLibrary(const Qt4Project &project) const
@@ -292,9 +295,8 @@ bool S60PublisherOvi::isVendorNameValid(const QString &vendorName) const
QString S60PublisherOvi::qtVersion() const
{
- if (!m_qt4bc->qtVersion())
- return QString();
- return m_qt4bc->qtVersion()->displayName();
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(m_qt4bc->target()->profile());
+ return version ? version->displayName() : QString();
}
QString S60PublisherOvi::uid3() const
@@ -439,7 +441,8 @@ void S60PublisherOvi::publishStepFinished(bool success)
bool S60PublisherOvi::sisExists(QString &sisFile)
{
QString fileNamePostFix = QLatin1String("_installer_unsigned.sis");
- if (m_qt4bc->qtVersion()->qtVersion() == QtSupport::QtVersionNumber(4,6,3) )
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(m_qt4bc->target()->profile());
+ if (version && version->qtVersion() == QtSupport::QtVersionNumber(4,6,3) )
fileNamePostFix = QLatin1String("_installer.sis");
sisFile = m_qt4bc->buildDirectory() + QLatin1Char('/') + m_qt4project->displayName() + fileNamePostFix;
@@ -451,7 +454,8 @@ bool S60PublisherOvi::sisExists(QString &sisFile)
QString S60PublisherOvi::createdSisFileContainingFolder()
{
QString fileNamePostFix = QLatin1String("_installer_unsigned.sis");
- if (m_qt4bc->qtVersion()->qtVersion() == QtSupport::QtVersionNumber(4,6,3) )
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(m_qt4bc->target()->profile());
+ if (version && version->qtVersion() == QtSupport::QtVersionNumber(4,6,3) )
fileNamePostFix = QLatin1String("_installer.sis");
QString resultFile = m_qt4bc->buildDirectory() + QLatin1Char('/') + m_qt4project->displayName() + fileNamePostFix;
@@ -463,7 +467,8 @@ QString S60PublisherOvi::createdSisFileContainingFolder()
QString S60PublisherOvi::createdSisFilePath()
{
QString fileNamePostFix = QLatin1String("_installer_unsigned.sis");
- if (m_qt4bc->qtVersion()->qtVersion() == QtSupport::QtVersionNumber(4,6,3) )
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(m_qt4bc->target()->profile());
+ if (version && version->qtVersion() == QtSupport::QtVersionNumber(4,6,3) )
fileNamePostFix = QLatin1String("_installer.sis");
const QString resultFile = m_qt4bc->buildDirectory() + QLatin1Char('/')
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingbuildsettingspageovi.cpp b/src/plugins/qt4projectmanager/qt-s60/s60publishingbuildsettingspageovi.cpp
index 158c9f98ae..cd92115c4a 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60publishingbuildsettingspageovi.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingbuildsettingspageovi.cpp
@@ -54,6 +54,7 @@ S60PublishingBuildSettingsPageOvi::S60PublishingBuildSettingsPageOvi(S60Publishe
{
m_ui->setupUi(this);
+#if 0 // FIXME: This needs serious work!
QList<Qt4BuildConfiguration *> list;
foreach (const ProjectExplorer::Target *const target, project->targets()) {
if (target->id() != Core::Id(Qt4ProjectManager::Constants::S60_DEVICE_TARGET_ID))
@@ -92,6 +93,9 @@ S60PublishingBuildSettingsPageOvi::S60PublishingBuildSettingsPageOvi(S60Publishe
m_ui->toolchainInfoIconLabel->setToolTip(tr("No valid tool chain has been detected.<br>"
"Define a correct tool chain in \"Options > Tool Chains\""));
populateToolchainList(m_bc);
+#else
+ Q_UNUSED(project);
+#endif
//change the build configuration if the user changes it
connect(m_ui->chooseBuildConfigDropDown, SIGNAL(currentIndexChanged(int)), this, SLOT(buildConfigChosen()));
@@ -106,6 +110,7 @@ bool S60PublishingBuildSettingsPageOvi::isComplete() const
void S60PublishingBuildSettingsPageOvi::populateToolchainList(ProjectExplorer::BuildConfiguration *bc)
{
+#if 0 // FIXME: Do the right thing here...
if (!bc)
return;
@@ -134,6 +139,9 @@ void S60PublishingBuildSettingsPageOvi::populateToolchainList(ProjectExplorer::B
toolchainChosen();
else
bc->setToolChain(m_toolchain);
+#else
+ Q_UNUSED(bc);
+#endif
}
void S60PublishingBuildSettingsPageOvi::buildConfigChosen()
@@ -149,6 +157,7 @@ void S60PublishingBuildSettingsPageOvi::buildConfigChosen()
void S60PublishingBuildSettingsPageOvi::toolchainChosen()
{
+#if 0 // FIXME: Do the right thing!
const int currentIndex = m_ui->chooseToolchainDropDown->currentIndex();
if (currentIndex == -1) {
m_toolchain = 0;
@@ -160,6 +169,7 @@ void S60PublishingBuildSettingsPageOvi::toolchainChosen()
if (m_bc)
m_bc->setToolChain(m_toolchain);
+#endif
emit toolchainConfigurationChosen();
}
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.cpp b/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.cpp
index 9ab0e9b60c..3924b1bc18 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.cpp
@@ -39,6 +39,10 @@
#include <projectexplorer/target.h>
+#include <qtsupport/qtsupportconstants.h>
+#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtprofileinformation.h>
+
using namespace ProjectExplorer;
namespace Qt4ProjectManager {
@@ -71,7 +75,8 @@ bool S60PublishingWizardFactoryOvi::canCreateWizard(const Project *project) cons
if (!qobject_cast<const Qt4Project *>(project))
return false;
foreach (const Target *const target, project->targets()) {
- if (target->id() == Core::Id(Constants::S60_DEVICE_TARGET_ID))
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
+ if (version->type() == QLatin1String(QtSupport::Constants::SYMBIANQT))
return true;
}
return false;
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.h b/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.h
index 6bcb4d9bee..4ec25e743d 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.h
+++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.h
@@ -38,17 +38,16 @@
namespace Qt4ProjectManager {
namespace Internal {
-class S60PublishingWizardFactoryOvi
- : public ProjectExplorer::IPublishingWizardFactory
+class S60PublishingWizardFactoryOvi : public ProjectExplorer::IPublishingWizardFactory
{
Q_OBJECT
public:
explicit S60PublishingWizardFactoryOvi(QObject *parent =0);
private:
- virtual QString displayName() const;
- virtual QString description() const;
- virtual bool canCreateWizard(const ProjectExplorer::Project *project) const;
- virtual QWizard *createWizard(const ProjectExplorer::Project *project) const;
+ QString displayName() const;
+ QString description() const;
+ bool canCreateWizard(const ProjectExplorer::Project *project) const;
+ QWizard *createWizard(const ProjectExplorer::Project *project) const;
};
} // namespace Internal
} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60runcontrolbase.cpp b/src/plugins/qt4projectmanager/qt-s60/s60runcontrolbase.cpp
index bdb4a94358..774618bf12 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60runcontrolbase.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60runcontrolbase.cpp
@@ -32,20 +32,17 @@
#include "s60runcontrolbase.h"
+#include "qt4buildconfiguration.h"
#include "s60deployconfiguration.h"
#include "s60devicerunconfiguration.h"
-#include "qt4buildconfiguration.h"
-#include "qt4symbiantarget.h"
-#include "qt4target.h"
-
-#include <utils/qtcassert.h>
-
-#include <debugger/debuggerconstants.h>
#include <analyzerbase/analyzerconstants.h>
-
#include <coreplugin/icore.h>
+#include <debugger/debuggerconstants.h>
#include <coreplugin/progressmanager/progressmanager.h>
+#include <projectexplorer/target.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <utils/qtcassert.h>
#include <QDateTime>
#include <QDir>
@@ -96,7 +93,7 @@ S60RunControlBase::S60RunControlBase(RunConfiguration *runConfiguration,
m_commandLineArguments.prepend(QLatin1Char(' '));
m_commandLineArguments.prepend(qmlArgs);
}
- if (const QtSupport::BaseQtVersion *qtv = activeBuildConf->qtVersion()) {
+ if (const QtSupport::BaseQtVersion *qtv = QtSupport::QtProfileInformation::qtVersion(runConfiguration->target()->profile())) {
m_qtDir = qtv->versionInfo().value(QLatin1String("QT_INSTALL_DATA"));
m_qtBinPath = qtv->versionInfo().value(QLatin1String("QT_INSTALL_BINS"));
}
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60runcontrolfactory.cpp b/src/plugins/qt4projectmanager/qt-s60/s60runcontrolfactory.cpp
index f1f96795f8..b9ac0026cf 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60runcontrolfactory.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60runcontrolfactory.cpp
@@ -35,8 +35,8 @@
#include "codaruncontrol.h"
#include "s60devicerunconfiguration.h"
#include "s60deployconfiguration.h"
-#include "qt4symbiantarget.h"
+#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
diff --git a/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.cpp b/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.cpp
index 045712879e..7cb2f69230 100644
--- a/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.cpp
@@ -36,6 +36,7 @@
#include "qt-s60/abldparser.h"
#include <projectexplorer/gnumakeparser.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/toolchainmanager.h>
@@ -54,14 +55,12 @@ using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
SymbianQtVersion::SymbianQtVersion()
- : BaseQtVersion(),
- m_validSystemRoot(false)
+ : BaseQtVersion()
{
}
SymbianQtVersion::SymbianQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource)
- : BaseQtVersion(path, isAutodetected, autodetectionSource),
- m_validSystemRoot(false)
+ : BaseQtVersion(path, isAutodetected, autodetectionSource)
{
}
@@ -81,8 +80,7 @@ bool SymbianQtVersion::equals(BaseQtVersion *other)
if (!BaseQtVersion::equals(other))
return false;
SymbianQtVersion *o = static_cast<SymbianQtVersion *>(other);
- return m_sbsV2Directory == o->m_sbsV2Directory
- && m_systemRoot == o->m_systemRoot;
+ return m_sbsV2Directory == o->m_sbsV2Directory;
}
QString SymbianQtVersion::type() const
@@ -94,8 +92,6 @@ bool SymbianQtVersion::isValid() const
{
if (!BaseQtVersion::isValid())
return false;
- if (!m_validSystemRoot)
- return false;
if (isBuildWithSymbianSbsV2() && (m_sbsV2Directory.isEmpty() || !QFileInfo(m_sbsV2Directory + QLatin1String("/sbs")).exists()))
return false;
return true;
@@ -104,8 +100,6 @@ bool SymbianQtVersion::isValid() const
QString SymbianQtVersion::invalidReason() const
{
QString tmp = BaseQtVersion::invalidReason();
- if (tmp.isEmpty() && !m_validSystemRoot)
- return QCoreApplication::translate("QtVersion", "The \"Open C/C++ plugin\" is not installed in the Symbian SDK or the Symbian SDK path is misconfigured");
if (isBuildWithSymbianSbsV2()
&& (m_sbsV2Directory.isEmpty() || !QFileInfo(m_sbsV2Directory + QLatin1String("/sbs")).exists()))
return QCoreApplication::translate("QtVersion", "SBS was not found.");
@@ -113,21 +107,8 @@ QString SymbianQtVersion::invalidReason() const
return tmp;
}
-bool SymbianQtVersion::toolChainAvailable(const QString &id) const
-{
- if (!isValid())
- return false;
- if (id == QLatin1String(Constants::S60_DEVICE_TARGET_ID)) {
- QList<ProjectExplorer::ToolChain *> tcList =
- ProjectExplorer::ToolChainManager::instance()->toolChains();
- return !tcList.isEmpty();
- }
- return false;
-}
-
void SymbianQtVersion::restoreLegacySettings(QSettings *s)
{
- setSystemRoot(QDir::fromNativeSeparators(s->value(QLatin1String("S60SDKDirectory")).toString()));
setSbsV2Directory(QDir::fromNativeSeparators(s->value(QLatin1String("SBSv2Directory")).toString()));
}
@@ -135,14 +116,12 @@ void SymbianQtVersion::fromMap(const QVariantMap &map)
{
BaseQtVersion::fromMap(map);
setSbsV2Directory(QDir::fromNativeSeparators(map.value(QLatin1String("SBSv2Directory")).toString()));
- setSystemRoot(QDir::fromNativeSeparators(map.value(QLatin1String("SystemRoot")).toString()));
}
QVariantMap SymbianQtVersion::toMap() const
{
QVariantMap result = BaseQtVersion::toMap();
result.insert(QLatin1String("SBSv2Directory"), sbsV2Directory());
- result.insert(QLatin1String("SystemRoot"), systemRoot());
return result;
}
@@ -155,16 +134,6 @@ QList<ProjectExplorer::Abi> SymbianQtVersion::detectQtAbis() const
32);
}
-bool SymbianQtVersion::supportsTargetId(const Core::Id id) const
-{
- return supportedTargetIds().contains(id);
-}
-
-QSet<Core::Id> SymbianQtVersion::supportedTargetIds() const
-{
- return QSet<Core::Id>() << Core::Id(Constants::S60_DEVICE_TARGET_ID);
-}
-
QString SymbianQtVersion::description() const
{
return QCoreApplication::translate("QtVersion", "Symbian", "Qt Version is meant for Symbian");
@@ -198,11 +167,11 @@ static const char *S60_EPOC_HEADERS[] = {
"epoc32/include/platform/mw/loc/sc"
};
-void SymbianQtVersion::addToEnvironment(Utils::Environment &env) const
+void SymbianQtVersion::addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const
{
- BaseQtVersion::addToEnvironment(env);
+ BaseQtVersion::addToEnvironment(p, env);
// Generic Symbian environment:
- QString epocRootPath = systemRoot();
+ QString epocRootPath = ProjectExplorer::SysRootProfileInformation::sysRoot(p).toString();
QDir epocDir(epocRootPath);
// Clean up epoc root path for the environment:
@@ -253,10 +222,10 @@ void SymbianQtVersion::addToEnvironment(Utils::Environment &env) const
}
}
-QList<ProjectExplorer::HeaderPath> SymbianQtVersion::systemHeaderPathes() const
+QList<ProjectExplorer::HeaderPath> SymbianQtVersion::systemHeaderPathes(const ProjectExplorer::Profile *p) const
{
QList<ProjectExplorer::HeaderPath> result;
- QString root = systemRoot() + QLatin1Char('/');
+ QString root = ProjectExplorer::SysRootProfileInformation::sysRoot(p).toString() + QLatin1Char('/');
const int count = sizeof(S60_EPOC_HEADERS) / sizeof(const char *);
for (int i = 0; i < count; ++i) {
const QDir dir(root + QLatin1String(S60_EPOC_HEADERS[i]));
@@ -264,7 +233,7 @@ QList<ProjectExplorer::HeaderPath> SymbianQtVersion::systemHeaderPathes() const
result.append(ProjectExplorer::HeaderPath(dir.absolutePath(),
ProjectExplorer::HeaderPath::GlobalHeaderPath));
}
- result.append(BaseQtVersion::systemHeaderPathes());
+ result.append(BaseQtVersion::systemHeaderPathes(p));
return result;
}
@@ -313,39 +282,6 @@ void SymbianQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
BaseQtVersion::parseMkSpec(evaluator);
}
-QList<ProjectExplorer::Task> SymbianQtVersion::reportIssuesImpl(const QString &proFile, const QString &buildDir)
-{
- QList<ProjectExplorer::Task> results = BaseQtVersion::reportIssuesImpl(proFile, buildDir);
- const QString epocRootDir = systemRoot();
- // Report an error if project- and epoc directory are on different drives:
- if (!epocRootDir.startsWith(proFile.left(3), Qt::CaseInsensitive)) {
- // Note: SBSv2 works fine with the EPOCROOT and the sources being on different drives,
- // but it fails when Qt is on a different drive than the sources. Since
- // the SDK installs Qt and the EPOCROOT on the same drive we just stick with this
- // warning.
- results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error,
- QCoreApplication::translate("ProjectExplorer::Internal::S60ProjectChecker",
- "The Symbian SDK and the project sources must reside on the same drive."),
- Utils::FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
- }
- return results;
-}
-
-void SymbianQtVersion::setSystemRoot(const QString &root)
-{
- if (root == m_systemRoot)
- return;
- m_systemRoot = root;
-
- m_validSystemRoot = false;
- if (!m_systemRoot.isEmpty()) {
- if (!m_systemRoot.endsWith(QLatin1Char('/')))
- m_systemRoot.append(QLatin1Char('/'));
- QFileInfo cppheader(m_systemRoot + QLatin1String("epoc32/include/stdapis/string.h"));
- m_validSystemRoot = cppheader.exists();
- }
-}
-
Core::FeatureSet SymbianQtVersion::availableFeatures() const
{
Core::FeatureSet features = QtSupport::BaseQtVersion::availableFeatures();
@@ -366,11 +302,6 @@ QString SymbianQtVersion::platformDisplayName() const
return QLatin1String(QtSupport::Constants::SYMBIAN_PLATFORM_TR);
}
-QString SymbianQtVersion::systemRoot() const
-{
- return m_systemRoot;
-}
-
QtSupport::QtConfigWidget *SymbianQtVersion::createConfigurationWidget() const
{
return new SymbianQtConfigWidget(const_cast<SymbianQtVersion *>(this));
@@ -383,16 +314,6 @@ SymbianQtConfigWidget::SymbianQtConfigWidget(SymbianQtVersion *version)
fl->setMargin(0);
setLayout(fl);
- Utils::PathChooser *s60sdkPath = new Utils::PathChooser;
- s60sdkPath->setExpectedKind(Utils::PathChooser::ExistingDirectory);
-
- fl->addRow(tr("S60 SDK:"), s60sdkPath);
-
- s60sdkPath->setPath(QDir::toNativeSeparators(version->systemRoot()));
-
- connect(s60sdkPath, SIGNAL(changed(QString)),
- this, SLOT(updateCurrentS60SDKDirectory(QString)));
-
if (version->isBuildWithSymbianSbsV2()) {
Utils::PathChooser *sbsV2Path = new Utils::PathChooser;
sbsV2Path->setExpectedKind(Utils::PathChooser::ExistingDirectory);
@@ -404,12 +325,6 @@ SymbianQtConfigWidget::SymbianQtConfigWidget(SymbianQtVersion *version)
}
}
-void SymbianQtConfigWidget::updateCurrentS60SDKDirectory(const QString &path)
-{
- m_version->setSystemRoot(QDir::fromNativeSeparators(path));
- emit changed();
-}
-
void SymbianQtConfigWidget::updateCurrentSbsV2Directory(const QString &path)
{
m_version->setSbsV2Directory(QDir::fromNativeSeparators(path));
diff --git a/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.h b/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.h
index d21ea2132c..13c47631af 100644
--- a/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.h
+++ b/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.h
@@ -53,29 +53,21 @@ public:
bool isValid() const;
QString invalidReason() const;
- bool toolChainAvailable(const QString &id) const;
-
void restoreLegacySettings(QSettings *s);
void fromMap(const QVariantMap &map);
QVariantMap toMap() const;
QList<ProjectExplorer::Abi> detectQtAbis() const;
- bool supportsTargetId(const Core::Id id) const;
- QSet<Core::Id> supportedTargetIds() const;
-
QString description() const;
bool supportsShadowBuilds() const;
bool supportsBinaryDebuggingHelper() const;
- void addToEnvironment(Utils::Environment &env) const;
- QList<ProjectExplorer::HeaderPath> systemHeaderPathes() const;
+ void addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const;
+ QList<ProjectExplorer::HeaderPath> systemHeaderPathes(const ProjectExplorer::Profile *p) const;
ProjectExplorer::IOutputParser *createOutputParser() const;
- QString systemRoot() const;
- void setSystemRoot(const QString &);
-
bool isBuildWithSymbianSbsV2() const;
QString sbsV2Directory() const;
@@ -88,23 +80,22 @@ public:
QString platformDisplayName() const;
protected:
- QList<ProjectExplorer::Task> reportIssuesImpl(const QString &proFile, const QString &buildDir);
void parseMkSpec(ProFileEvaluator *) const;
private:
QString m_sbsV2Directory;
- QString m_systemRoot;
- mutable bool m_validSystemRoot;
mutable bool m_isBuildUsingSbsV2;
};
class SymbianQtConfigWidget : public QtSupport::QtConfigWidget
{
Q_OBJECT
+
public:
SymbianQtConfigWidget(SymbianQtVersion *version);
+
public slots:
void updateCurrentSbsV2Directory(const QString &path);
- void updateCurrentS60SDKDirectory(const QString &path);
+
private:
SymbianQtVersion *m_version;
};
diff --git a/src/plugins/qt4projectmanager/qt4basetargetfactory.h b/src/plugins/qt4projectmanager/qt4basetargetfactory.h
deleted file mode 100644
index 7482faf6ae..0000000000
--- a/src/plugins/qt4projectmanager/qt4basetargetfactory.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef QT4BASETARGETFACTORY_H
-#define QT4BASETARGETFACTORY_H
-
-#include "qt4projectmanager_global.h"
-
-#include <projectexplorer/task.h>
-#include <projectexplorer/target.h>
-
-#include <QList>
-
-namespace Core {
-class FeatureSet;
-}
-
-namespace QtSupport {
-class QtVersionNumber;
-}
-
-namespace Qt4ProjectManager {
-class Qt4TargetSetupWidget;
-struct BuildConfigurationInfo;
-
-class QT4PROJECTMANAGER_EXPORT Qt4BaseTargetFactory : public ProjectExplorer::ITargetFactory
-{
- Q_OBJECT
-public:
- explicit Qt4BaseTargetFactory(QObject *parent);
- virtual ~Qt4BaseTargetFactory();
-
- virtual Qt4TargetSetupWidget *createTargetSetupWidget(const Core::Id id,
- const QString &proFilePath,
- const QtSupport::QtVersionNumber &minimumQtVersion,
- const QtSupport::QtVersionNumber &maximumQtVersion,
- const Core::FeatureSet &requiredFeatures,
- bool importEnabled,
- QList<BuildConfigurationInfo> importInfos);
-
- /// suffix should be unique
- virtual QString shadowBuildDirectory(const QString &profilePath, const Core::Id id, const QString &suffix);
- /// used by the default implementation of shadowBuildDirectory
- virtual QString buildNameForId(const Core::Id id) const;
-
- /// used by the default implementation of createTargetSetupWidget
- /// not needed otherwise
- /// by default creates one debug + one release buildconfiguration per qtversion
- virtual QList<BuildConfigurationInfo> availableBuildConfigurations(const Core::Id id, const QString &proFilePath,
- const QtSupport::QtVersionNumber &minimumQtVersion,
- const QtSupport::QtVersionNumber &maximumQtVersion,
- const Core::FeatureSet &requiredFeatures);
-
- virtual QList<ProjectExplorer::Task> reportIssues(const QString &proFile);
- /// only used in the TargetSetupPage
- virtual QIcon iconForId(const Core::Id id) const = 0;
-
- virtual QSet<QString> targetFeatures(const Core::Id id) const = 0;
- virtual bool selectByDefault(const Core::Id id) const;
-
- virtual ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id) = 0;
- virtual ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id,
- const QList<BuildConfigurationInfo> &infos) = 0;
- virtual ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id,
- Qt4TargetSetupWidget *widget);
-
- static Qt4BaseTargetFactory *qt4BaseTargetFactoryForId(const Core::Id id);
-
- static QList<Qt4BaseTargetFactory *> qt4BaseTargetFactoriesForIds(const QList<Core::Id> &ids);
-
-protected:
- static QString msgBuildConfigurationName(const BuildConfigurationInfo &info);
-};
-
-} // namespace Qt4ProjectManager
-
-#endif // QT4BASETARGETFACTORY_H
diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
index 7a86929c61..5649140986 100644
--- a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
@@ -33,22 +33,24 @@
#include "qt4buildconfiguration.h"
#include "qt4project.h"
-#include "qt4target.h"
+#include "qt4projectconfigwidget.h"
#include "qt4projectmanagerconstants.h"
#include "qt4nodes.h"
#include "qmakestep.h"
#include "makestep.h"
-#include "qt4basetargetfactory.h"
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <limits>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
-#include <projectexplorer/toolchainmanager.h>
+#include <projectexplorer/profileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
#include <qtsupport/qtversionfactory.h>
#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtversionmanager.h>
#include <QDebug>
@@ -59,22 +61,19 @@ using namespace Qt4ProjectManager::Internal;
using namespace ProjectExplorer;
namespace {
-const char * const QT4_BC_ID_PREFIX("Qt4ProjectManager.Qt4BuildConfiguration.");
const char * const QT4_BC_ID("Qt4ProjectManager.Qt4BuildConfiguration");
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 * const QT_VERSION_ID_KEY("Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId");
enum { debug = 0 };
}
-Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4BaseTarget *target) :
+Qt4BuildConfiguration::Qt4BuildConfiguration(Target *target) :
BuildConfiguration(target, Core::Id(QT4_BC_ID)),
m_shadowBuild(true),
m_isEnabled(false),
- m_qtVersionId(-1),
m_qmakeBuildConfiguration(0),
m_subNodeBuild(0),
m_fileNodeBuild(0)
@@ -82,11 +81,10 @@ Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4BaseTarget *target) :
ctor();
}
-Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4BaseTarget *target, const Core::Id id) :
+Qt4BuildConfiguration::Qt4BuildConfiguration(Target *target, const Core::Id id) :
BuildConfiguration(target, id),
m_shadowBuild(true),
m_isEnabled(false),
- m_qtVersionId(-1),
m_qmakeBuildConfiguration(0),
m_subNodeBuild(0),
m_fileNodeBuild(0)
@@ -94,12 +92,11 @@ Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4BaseTarget *target, const Core::
ctor();
}
-Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4BaseTarget *target, Qt4BuildConfiguration *source) :
+Qt4BuildConfiguration::Qt4BuildConfiguration(Target *target, Qt4BuildConfiguration *source) :
BuildConfiguration(target, source),
m_shadowBuild(source->m_shadowBuild),
m_isEnabled(false),
m_buildDirectory(source->m_buildDirectory),
- m_qtVersionId(source->m_qtVersionId),
m_qmakeBuildConfiguration(source->m_qmakeBuildConfiguration),
m_subNodeBuild(0), // temporary value, so not copied
m_fileNodeBuild(0)
@@ -117,7 +114,6 @@ QVariantMap Qt4BuildConfiguration::toMap() const
QVariantMap map(BuildConfiguration::toMap());
map.insert(QLatin1String(USE_SHADOW_BUILD_KEY), m_shadowBuild);
map.insert(QLatin1String(BUILD_DIRECTORY_KEY), m_buildDirectory);
- map.insert(QLatin1String(QT_VERSION_ID_KEY), m_qtVersionId);
map.insert(QLatin1String(BUILD_CONFIGURATION_KEY), int(m_qmakeBuildConfiguration));
return map;
}
@@ -128,52 +124,11 @@ bool Qt4BuildConfiguration::fromMap(const QVariantMap &map)
return false;
m_shadowBuild = map.value(QLatin1String(USE_SHADOW_BUILD_KEY), true).toBool();
- m_qtVersionId = map.value(QLatin1String(QT_VERSION_ID_KEY)).toInt();
m_qmakeBuildConfiguration = QtSupport::BaseQtVersion::QmakeBuildConfigs(map.value(QLatin1String(BUILD_CONFIGURATION_KEY)).toInt());
m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY), defaultShadowBuildDirectory()).toString();
- // Pick a Qt version if the default version is used:
- // We assume that the default Qt version was used in earlier versions of Qt creator.
- // Pick a Qt version that supports this target (usually desktop)
- if (m_qtVersionId == 0) {
- QList<QtSupport::BaseQtVersion *> versions = QtSupport::QtVersionManager::instance()->versionsForTargetId(target()->id());
- foreach (QtSupport::BaseQtVersion *v, versions) {
- if (v->isValid()) {
- m_qtVersionId = v->uniqueId();
- break;
- }
- }
- if (m_qtVersionId == 0)
- m_qtVersionId = -1;
- }
-
- QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::instance()->version(m_qtVersionId);
- if (!version || !version->supportsTargetId(target()->id())) {
- m_qtVersionId = -1;
- version = 0;
- }
-
m_lastEmmitedBuildDirectory = buildDirectory();
-
- ProjectExplorer::ToolChain *tc = toolChain();
- if (version && version->isValid()) {
- if (tc && !qt4Target()->possibleToolChains(this).contains(tc))
- setToolChain(0);
- if (!toolChain())
- setToolChain(qt4Target()->preferredToolChain(this));
- m_shadowBuild = (m_shadowBuild && version->supportsShadowBuilds());
- }
-
- if (!toolChain()) {
- if (version && version->isValid()) {
- qWarning("Warning: No tool chain available for '%s' from %s used in '%s'.",
- qPrintable(version->displayName()), qPrintable(version->qmakeCommand().toUserOutput()),
- qPrintable(target()->id().toString()));
- } else {
- qWarning("Warning: No tool chain available for invalid Qt version used in '%s'.",
- qPrintable(target()->id().toString()));
- }
- }
+ m_qtVersionSupportsShadowBuilds = supportsShadowBuilds();
return true;
}
@@ -183,55 +138,47 @@ void Qt4BuildConfiguration::ctor()
connect(this, SIGNAL(environmentChanged()),
this, SLOT(emitBuildDirectoryChanged()));
connect(this, SIGNAL(environmentChanged()),
- this, SLOT(emitProFileEvaluateNeeded()));
- connect(qt4Target()->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
- this, SLOT(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
+ this, SLOT(emitEvaluateBuildSystem()));
+ connect(target(), SIGNAL(profileChanged()),
+ this, SLOT(profileChanged()));
+}
- QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
- connect(vm, SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
- this, SLOT(qtVersionsChanged(QList<int>,QList<int>,QList<int>)));
+void Qt4BuildConfiguration::profileChanged()
+{
+ // emit qtVersionChanged(); TODO what was connected to that
+ emit requestBuildSystemEvaluation();
+ emit environmentChanged();
+ emitBuildDirectoryChanged();
}
void Qt4BuildConfiguration::emitBuildDirectoryChanged()
{
- if (buildDirectory() != m_lastEmmitedBuildDirectory) {
+ // We also emit buildDirectoryChanged if the the qt version's supportShadowBuild changed
+ if (buildDirectory() != m_lastEmmitedBuildDirectory
+ || supportsShadowBuilds() != m_qtVersionSupportsShadowBuilds) {
m_lastEmmitedBuildDirectory = buildDirectory();
+ m_qtVersionSupportsShadowBuilds = supportsShadowBuilds();
emit buildDirectoryChanged();
}
}
-void Qt4BuildConfiguration::proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *, bool success, bool parseInProgress)
-{
- // Changing the included Qt modules from 0 to at least one might have caused the
- // tool chain to become invalid.
- if (!success || parseInProgress)
- return;
- if (!qt4Target()->possibleToolChains(this).contains(toolChain()))
- setToolChain(qt4Target()->preferredToolChain(this));
-}
-
-Qt4BaseTarget *Qt4BuildConfiguration::qt4Target() const
-{
- return static_cast<Qt4BaseTarget *>(target());
-}
-
Utils::Environment Qt4BuildConfiguration::baseEnvironment() const
{
Utils::Environment env = BuildConfiguration::baseEnvironment();
- if (qtVersion())
- qtVersion()->addToEnvironment(env);
-
- ToolChain *tc = toolChain();
- if (tc)
- tc->addToEnvironment(env);
+ target()->profile()->addToEnvironment(env);
return env;
}
+BuildConfigWidget *Qt4BuildConfiguration::createConfigWidget()
+{
+ return new Qt4ProjectConfigWidget(target());
+}
+
QString Qt4BuildConfiguration::defaultShadowBuildDirectory() const
{
- Qt4BaseTargetFactory *factory = Qt4BaseTargetFactory::qt4BaseTargetFactoryForId(qt4Target()->id());
// todo displayName isn't ideal
- return factory->shadowBuildDirectory(qt4Target()->qt4Project()->document()->fileName(), qt4Target()->id(), displayName());
+ return Qt4Project::shadowBuildDirectory(target()->project()->document()->fileName(),
+ target()->profile(), displayName());
}
/// returns the unexpanded build directory
@@ -255,6 +202,12 @@ QString Qt4BuildConfiguration::buildDirectory() const
return QDir::cleanPath(environment().expandVariables(rawBuildDirectory()));
}
+bool Qt4BuildConfiguration::supportsShadowBuilds()
+{
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
+ return !version || version->supportsShadowBuilds();
+}
+
/// If only a sub tree should be build this function returns which sub node
/// should be build
/// \see Qt4BuildConfiguration::setSubNodeBuild
@@ -304,7 +257,7 @@ QString Qt4BuildConfiguration::shadowBuildDirectory() const
void Qt4BuildConfiguration::setShadowBuildAndDirectory(bool shadowBuild, const QString &buildDirectory)
{
- QtSupport::BaseQtVersion *version = qtVersion();
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
QString directoryToSet = buildDirectory;
bool toSet = (shadowBuild && version && version->isValid() && version->supportsShadowBuilds());
if (m_shadowBuild == toSet && m_buildDirectory == directoryToSet)
@@ -315,13 +268,7 @@ void Qt4BuildConfiguration::setShadowBuildAndDirectory(bool shadowBuild, const Q
emit environmentChanged();
emitBuildDirectoryChanged();
- emit proFileEvaluateNeeded(this);
-}
-
-QString Qt4BuildConfiguration::makeCommand() const
-{
- ToolChain *tc = toolChain();
- return tc ? tc->makeCommand() : QLatin1String("make");
+ emitEvaluateBuildSystem();
}
static inline QString symbianMakeTarget(QtSupport::BaseQtVersion::QmakeBuildConfigs buildConfig,
@@ -335,64 +282,18 @@ static inline QString symbianMakeTarget(QtSupport::BaseQtVersion::QmakeBuildConf
QString Qt4BuildConfiguration::defaultMakeTarget() const
{
- ToolChain *tc = toolChain();
- if (!tc || target()->id() != Core::Id(Constants::S60_DEVICE_TARGET_ID))
+ ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
+ if (!tc || !version || version->type() != QtSupport::Constants::SYMBIANQT)
return QString();
- const QtSupport::BaseQtVersion::QmakeBuildConfigs buildConfig = qmakeBuildConfiguration();
+ const QtSupport::BaseQtVersion::QmakeBuildConfigs buildConfig = qmakeBuildConfiguration();
return symbianMakeTarget(buildConfig, tc->defaultMakeTarget());
}
QString Qt4BuildConfiguration::makefile() const
{
- return qt4Target()->qt4Project()->rootQt4ProjectNode()->makefile();
-}
-
-QtSupport::BaseQtVersion *Qt4BuildConfiguration::qtVersion() const
-{
- QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
- return vm->version(m_qtVersionId);
-}
-
-void Qt4BuildConfiguration::setQtVersion(QtSupport::BaseQtVersion *version)
-{
- if (version == 0) {
- m_qtVersionId = -1;
- m_shadowBuild = false;
- setToolChain(0);
- emit proFileEvaluateNeeded(this);
- emit qtVersionChanged();
- emit environmentChanged();
- emitBuildDirectoryChanged();
- return;
- }
- if (m_qtVersionId == version->uniqueId())
- return;
-
- m_qtVersionId = version->uniqueId();
-
- if (!qt4Target()->possibleToolChains(this).contains(toolChain()))
- setToolChain(qt4Target()->preferredToolChain(this));
- m_shadowBuild = m_shadowBuild && qtVersion()->supportsShadowBuilds();
-
- emit proFileEvaluateNeeded(this);
- emit qtVersionChanged();
- emit environmentChanged();
- emitBuildDirectoryChanged();
-}
-
-void Qt4BuildConfiguration::setToolChain(ProjectExplorer::ToolChain *tc)
-{
- if (tc != 0 && m_qtVersionId > 0 && !qt4Target()->possibleToolChains(this).contains(tc))
- return;
-
- if (toolChain() == tc)
- return;
-
- BuildConfiguration::setToolChain(tc);
-
- emit proFileEvaluateNeeded(this);
- emitBuildDirectoryChanged();
+ return static_cast<Qt4Project *>(target()->project())->rootQt4ProjectNode()->makefile();
}
QtSupport::BaseQtVersion::QmakeBuildConfigs Qt4BuildConfiguration::qmakeBuildConfiguration() const
@@ -406,14 +307,14 @@ void Qt4BuildConfiguration::setQMakeBuildConfiguration(QtSupport::BaseQtVersion:
return;
m_qmakeBuildConfiguration = config;
- emit proFileEvaluateNeeded(this);
+ emitEvaluateBuildSystem();
emit qmakeBuildConfigurationChanged();
emitBuildDirectoryChanged();
}
-void Qt4BuildConfiguration::emitProFileEvaluateNeeded()
+void Qt4BuildConfiguration::emitEvaluateBuildSystem()
{
- emit proFileEvaluateNeeded(this);
+ emit requestBuildSystemEvaluation();
}
void Qt4BuildConfiguration::emitQMakeBuildConfigurationChanged()
@@ -431,11 +332,11 @@ void Qt4BuildConfiguration::emitS60CreatesSmartInstallerChanged()
emit s60CreatesSmartInstallerChanged();
}
-
QStringList Qt4BuildConfiguration::configCommandLineArguments() const
{
QStringList result;
- QtSupport::BaseQtVersion::QmakeBuildConfigs defaultBuildConfiguration = qtVersion() ? qtVersion()->defaultBuildConfig() : (QtSupport::BaseQtVersion::DebugBuild | QtSupport::BaseQtVersion::BuildAll);
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
+ 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))
result << QLatin1String("CONFIG-=debug_and_release");
@@ -471,30 +372,15 @@ MakeStep *Qt4BuildConfiguration::makeStep() const
return 0;
}
-void Qt4BuildConfiguration::qtVersionsChanged(const QList<int> &addedVersions, const QList<int> &removedVersions, const QList<int> &changedVersions)
-{
- Q_UNUSED(addedVersions);
- if (removedVersions.contains(m_qtVersionId)) {
- m_qtVersionId = -1;
- QList<QtSupport::BaseQtVersion *> versionList
- = QtSupport::QtVersionManager::instance()->versionsForTargetId(target()->id());
- if (!versionList.isEmpty())
- m_qtVersionId = versionList.at(0)->uniqueId();
- emit qtVersionChanged();
- } else if (changedVersions.contains(m_qtVersionId)) {
- emit environmentChanged();
- }
-}
-
// returns true if both are equal
-bool Qt4BuildConfiguration::compareToImportFrom(const QString &makefile)
+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 = qtVersion();
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
if (!version)
- return false;
+ return MakefileForWrongProject;
if (version->qmakeCommand() == qmakePath) {
// same qtversion
QPair<QtSupport::BaseQtVersion::QmakeBuildConfigs, QString> result =
@@ -509,7 +395,7 @@ bool Qt4BuildConfiguration::compareToImportFrom(const QString &makefile)
QString userArgs = qs->userArguments();
// This copies the settings from userArgs to actualArgs (minus some we
// are not interested in), splitting them up into individual strings:
- extractSpecFromArguments(&userArgs, workingDirectory, version, &actualArgs),
+ extractSpecFromArguments(&userArgs, workingDirectory, version, &actualArgs);
actualArgs = qs->deducedArguments() + actualArgs + qs->deducedArgumentsAfter();
Utils::FileName actualSpec = qs->mkspec();
@@ -543,21 +429,26 @@ bool Qt4BuildConfiguration::compareToImportFrom(const QString &makefile)
if (actualArgs == parsedArgs) {
// Specs match exactly
if (actualSpec == parsedSpec)
- return true;
+ 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()))
- return true;
+ return MakefileMatches;
}
- } else if (debug) {
- qDebug()<<"different qmake buildconfigurations buildconfiguration:"<<qmakeBuildConfiguration()<<" Makefile:"<<result.first;
+ return MakefileIncompatible;
+ } else {
+ if (debug)
+ qDebug()<<"different qmake buildconfigurations buildconfiguration:"<<qmakeBuildConfiguration()<<" Makefile:"<<result.first;
+ return MakefileIncompatible;
}
- } else if (debug) {
- qDebug()<<"diffrent qt versions, buildconfiguration:"<<version->qmakeCommand().toString()<<" Makefile:"<<qmakePath.toString();
+ } else {
+ if (debug)
+ qDebug()<<"diffrent qt versions, buildconfiguration:"<<version->qmakeCommand().toString()<<" Makefile:"<<qmakePath.toString();
+ return MakefileForWrongProject;
}
}
- return false;
+ return MakefileMissing;
}
bool Qt4BuildConfiguration::removeQMLInspectorFromArguments(QString *args)
@@ -649,10 +540,8 @@ Utils::FileName Qt4BuildConfiguration::extractSpecFromArguments(QString *args,
ProjectExplorer::IOutputParser *Qt4BuildConfiguration::createOutputParser() const
{
- ToolChain *tc = toolChain();
- if (tc)
- return toolChain()->outputParser();
- return 0;
+ ToolChain *tc = ToolChainProfileInformation::toolChain(target()->profile());
+ return tc ? tc->outputParser() : 0;
}
bool Qt4BuildConfiguration::isEnabled() const
@@ -698,77 +587,51 @@ void Qt4BuildConfigurationFactory::update()
emit availableCreationIdsChanged();
}
-QList<Core::Id> Qt4BuildConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
+bool Qt4BuildConfigurationFactory::canHandle(const Target *t) const
{
- QList<Core::Id> results;
- if (!qobject_cast<Qt4BaseTarget *>(parent))
- return results;
-
- QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
- QList<QtSupport::BaseQtVersion *> versions = vm->versionsForTargetId(parent->id());
- foreach (QtSupport::BaseQtVersion *v, versions) {
- if (v->toolChainAvailable(parent->id()))
- results << Core::Id(QLatin1String(QT4_BC_ID_PREFIX) + QString::number(v->uniqueId()));
- }
-
-
- return results;
+ if (!t->project()->supportsProfile(t->profile()))
+ return false;
+ return qobject_cast<Qt4Project *>(t->project());
}
-int idToUniqueId(const Core::Id id)
+QList<Core::Id> Qt4BuildConfigurationFactory::availableCreationIds(const Target *parent) const
{
- QString rest = id.name().mid(QString(QT4_BC_ID_PREFIX).length());
- bool ok;
- int unqieuid = rest.toInt(&ok);
- if (!ok)
- return -1;
- return unqieuid;
+ if (!canHandle(parent))
+ return QList<Core::Id>();
+ return QList<Core::Id>() << Core::Id(QT4_BC_ID);
}
QString Qt4BuildConfigurationFactory::displayNameForId(const Core::Id id) const
{
- if (!id.name().startsWith(QT4_BC_ID_PREFIX))
+ if (id != Core::Id(QT4_BC_ID))
return QString();
- QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
- QtSupport::BaseQtVersion *v = vm->version(idToUniqueId(id));
- if (!v)
- return QString();
- return tr("Using Qt Version \"%1\"").arg(v->displayName());
+ return tr("Qmake based build");
}
-bool Qt4BuildConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
+bool Qt4BuildConfigurationFactory::canCreate(const Target *parent, const Core::Id id) const
{
- const QString idStr = QString::fromLatin1(id.name());
- if (!qobject_cast<Qt4BaseTarget *>(parent))
- return false;
- if (!id.name().startsWith(QT4_BC_ID_PREFIX))
- return false;
-
- QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::instance()->version(idToUniqueId(id));
- if (!version ||
- !version->supportsTargetId(parent->id()))
+ if (!canHandle(parent))
return false;
- return true;
+ return id.toString() == QLatin1String(QT4_BC_ID);
}
-BuildConfiguration *Qt4BuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
+BuildConfiguration *Qt4BuildConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name)
{
if (!canCreate(parent, id))
return 0;
- QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::instance()->version(idToUniqueId(id));
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(parent->profile());
Q_ASSERT(version);
- Qt4BaseTarget *qt4Target = static_cast<Qt4BaseTarget *>(parent);
-
- bool ok;
- QString buildConfigurationName = QInputDialog::getText(0,
- tr("New Configuration"),
- tr("New configuration name:"),
- QLineEdit::Normal,
- version->displayName(),
- &ok);
+ bool ok = true;
+ QString buildConfigurationName = name;
+ if (buildConfigurationName.isEmpty())
+ buildConfigurationName = QInputDialog::getText(0,
+ tr("New Configuration"),
+ tr("New configuration name:"),
+ QLineEdit::Normal,
+ version->displayName(), &ok);
buildConfigurationName = buildConfigurationName.trimmed();
if (!ok || buildConfigurationName.isEmpty())
return 0;
@@ -790,129 +653,76 @@ BuildConfiguration *Qt4BuildConfigurationFactory::create(ProjectExplorer::Target
qSwap(customFirstName, customSecondName);
}
- BuildConfiguration *bc = qt4Target->addQt4BuildConfiguration(defaultFirstName, customFirstName,
- version,
- version->defaultBuildConfig(),
- QString(), QString(), false);
-
- qt4Target->addQt4BuildConfiguration(defaultSecondName, customSecondName,
- version,
- (version->defaultBuildConfig() ^ QtSupport::BaseQtVersion::DebugBuild),
- QString(), QString(), false);
+ BuildConfiguration *bc
+ = Qt4BuildConfiguration::setup(parent, defaultFirstName, customFirstName,
+ version->defaultBuildConfig(), QString(), QString(), false);
+ parent->addBuildConfiguration(
+ Qt4BuildConfiguration::setup(parent, defaultSecondName, customSecondName,
+ (version->defaultBuildConfig() ^ QtSupport::BaseQtVersion::DebugBuild),
+ QString(), QString(), false));
return bc;
}
-bool Qt4BuildConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const
+bool Qt4BuildConfigurationFactory::canClone(const Target *parent, ProjectExplorer::BuildConfiguration *source) const
{
- if (!qobject_cast<Qt4BaseTarget *>(parent))
- return false;
- Qt4BuildConfiguration *qt4bc(qobject_cast<Qt4BuildConfiguration *>(source));
- if (!qt4bc)
- return false;
-
- QtSupport::BaseQtVersion *version = qt4bc->qtVersion();
- if (!version ||
- !version->supportsTargetId(parent->id()))
- return false;
- return true;
+ return canHandle(parent) && qobject_cast<Qt4BuildConfiguration *>(source);
}
BuildConfiguration *Qt4BuildConfigurationFactory::clone(Target *parent, BuildConfiguration *source)
{
if (!canClone(parent, source))
return 0;
- Qt4BaseTarget *target = static_cast<Qt4BaseTarget *>(parent);
Qt4BuildConfiguration *oldbc(static_cast<Qt4BuildConfiguration *>(source));
- return new Qt4BuildConfiguration(target, oldbc);
+ return new Qt4BuildConfiguration(parent, oldbc);
}
-bool Qt4BuildConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
+bool Qt4BuildConfigurationFactory::canRestore(const Target *parent, const QVariantMap &map) const
{
- QString id = QString::fromLatin1(ProjectExplorer::idFromMap(map).name()); // unicode save
- if (!qobject_cast<Qt4BaseTarget *>(parent))
+ if (!canHandle(parent))
return false;
- return id.startsWith(QLatin1String(QT4_BC_ID_PREFIX)) ||
- id == QLatin1String(QT4_BC_ID);
+ return ProjectExplorer::idFromMap(map).toString() == QLatin1String(QT4_BC_ID);
}
BuildConfiguration *Qt4BuildConfigurationFactory::restore(Target *parent, const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
- Qt4BaseTarget *target = static_cast<Qt4BaseTarget *>(parent);
- Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(target);
+ Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(parent);
if (bc->fromMap(map))
return bc;
delete bc;
return 0;
}
-void Qt4BuildConfiguration::importFromBuildDirectory()
+QList<BuildConfigurationInfo> Qt4BuildConfigurationFactory::availableBuildConfigurations(const ProjectExplorer::Profile *p,
+ const QString &proFilePath)
{
- QString directory = buildDirectory();
- if (!directory.isEmpty()) {
- QString mkfile = directory;
- if (makefile().isEmpty())
- mkfile.append(QLatin1String("/Makefile"));
- else
- mkfile.append(makefile());
-
- Utils::FileName qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(mkfile);
- if (!qmakePath.isEmpty()) {
- QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
- QtSupport::BaseQtVersion *version = vm->qtVersionForQMakeBinary(qmakePath);
- if (!version) {
- version = QtSupport::QtVersionFactory::createQtVersionFromQMakePath(qmakePath);
- vm->addVersion(version);
- }
+ QList<BuildConfigurationInfo> infoList;
- QPair<QtSupport::BaseQtVersion::QmakeBuildConfigs, QString> result =
- QtSupport::QtVersionManager::scanMakeFile(mkfile, version->defaultBuildConfig());
- QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfig = result.first;
-
- QString additionalArguments = result.second;
- Utils::FileName parsedSpec = Qt4BuildConfiguration::extractSpecFromArguments(&additionalArguments, directory, version);
- const bool enableQmlDebugger =
- Qt4BuildConfiguration::removeQMLInspectorFromArguments(&additionalArguments);
-
- // So we got all the information now apply it...
- setQtVersion(version);
-
- QMakeStep *qs = qmakeStep();
- qs->setUserArguments(additionalArguments);
- qs->setLinkQmlDebuggingLibrary(enableQmlDebugger);
- if (!parsedSpec.isEmpty() && parsedSpec != Utils::FileName::fromString(QLatin1String("default")) && qs->mkspec() != parsedSpec) {
- Utils::QtcProcess::addArgs(&additionalArguments, (QStringList() << QLatin1String("-spec") << parsedSpec.toUserOutput()));
- qs->setUserArguments(additionalArguments);
- }
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(p);
+ if (!version || !version->isValid())
+ return infoList;
+ QtSupport::BaseQtVersion::QmakeBuildConfigs config = version->defaultBuildConfig();
+ BuildConfigurationInfo info = BuildConfigurationInfo(config, QString(), QString(), false);
+ info.directory = Qt4Project::shadowBuildDirectory(proFilePath, p, buildConfigurationDisplayName(info));
+ infoList.append(info);
- setQMakeBuildConfiguration(qmakeBuildConfig);
- // Adjust command line arguments, this is ugly as hell
- // If we are switching to BuildAll we want "release" in there and no "debug"
- // or "debug" in there and no "release"
- // If we are switching to not BuildAll we want neither "release" nor "debug" in there
- bool debug = qmakeBuildConfig & QtSupport::BaseQtVersion::DebugBuild;
- bool haveTag = !(qmakeBuildConfig & QtSupport::BaseQtVersion::BuildAll);
- QString makeCmdArguments = makeStep()->userArguments();
- Utils::QtcProcess::ArgIterator ait(&makeCmdArguments);
- while (ait.next()) {
- if (ait.value() == QLatin1String("debug")) {
- if (!haveTag && debug)
- haveTag = true;
- else
- ait.deleteArg();
- } else if (ait.value() == QLatin1String("release")) {
- if (!haveTag && !debug)
- haveTag = true;
- else
- ait.deleteArg();
- }
- }
- if (!haveTag)
- ait.appendArg(QLatin1String(debug ? "debug" : "release"));
- makeStep()->setUserArguments(makeCmdArguments);
- }
- }
+ info.buildConfig = config ^ QtSupport::BaseQtVersion::DebugBuild;
+ info.directory = Qt4Project::shadowBuildDirectory(proFilePath, p, buildConfigurationDisplayName(info));
+ if (!QFileInfo(info.directory).exists())
+ infoList.append(info);
+
+ return infoList;
+}
+
+// Return name of a build configuration.
+QString Qt4BuildConfigurationFactory::buildConfigurationDisplayName(const BuildConfigurationInfo &info)
+{
+ return (info.buildConfig & QtSupport::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.
+ tr("Release");
}
BuildConfiguration::BuildType Qt4BuildConfiguration::buildType() const
@@ -922,3 +732,53 @@ BuildConfiguration::BuildType Qt4BuildConfiguration::buildType() const
else
return Release;
}
+
+Qt4BuildConfiguration *Qt4BuildConfiguration::setup(Target *t, QString defaultDisplayName,
+ QString displayName,
+ QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
+ QString additionalArguments, QString directory,
+ bool importing)
+{
+ bool debug = qmakeBuildConfiguration & QtSupport::BaseQtVersion::DebugBuild;
+
+ // Add the buildconfiguration
+ 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));
+ Q_ASSERT(buildSteps);
+ Q_ASSERT(cleanSteps);
+
+ QMakeStep *qmakeStep = new QMakeStep(buildSteps);
+ buildSteps->insertStep(0, qmakeStep);
+
+ MakeStep *makeStep = new MakeStep(buildSteps);
+ buildSteps->insertStep(1, makeStep);
+
+ MakeStep* cleanStep = new MakeStep(cleanSteps);
+ cleanStep->setClean(true);
+ cleanStep->setUserArguments(QLatin1String("clean"));
+ cleanSteps->insertStep(0, cleanStep);
+
+ bool enableQmlDebugger
+ = Qt4BuildConfiguration::removeQMLInspectorFromArguments(&additionalArguments);
+ if (!additionalArguments.isEmpty())
+ qmakeStep->setUserArguments(additionalArguments);
+ if (importing)
+ qmakeStep->setLinkQmlDebuggingLibrary(enableQmlDebugger);
+
+ // set some options for qmake and make
+ if (qmakeBuildConfiguration & QtSupport::BaseQtVersion::BuildAll) // debug_and_release => explicit targets
+ makeStep->setUserArguments(debug ? QLatin1String("debug") : QLatin1String("release"));
+
+ bc->setQMakeBuildConfiguration(qmakeBuildConfiguration);
+
+ if (!directory.isEmpty())
+ bc->setShadowBuildAndDirectory(directory != t->project()->projectDirectory(), directory);
+
+ return bc;
+}
diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.h b/src/plugins/qt4projectmanager/qt4buildconfiguration.h
index b2ba12ac9a..11d3bc2baa 100644
--- a/src/plugins/qt4projectmanager/qt4buildconfiguration.h
+++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.h
@@ -35,19 +35,17 @@
#include "qt4projectmanager_global.h"
+#include "buildconfigurationinfo.h"
+
#include <projectexplorer/buildconfiguration.h>
#include <qtsupport/baseqtversion.h>
-namespace ProjectExplorer {
-class ToolChain;
-class FileNode;
-}
+namespace ProjectExplorer { class FileNode; }
namespace Qt4ProjectManager {
class QMakeStep;
class MakeStep;
-class Qt4BaseTarget;
class Qt4BuildConfigurationFactory;
class Qt4ProFileNode;
@@ -57,14 +55,13 @@ class QT4PROJECTMANAGER_EXPORT Qt4BuildConfiguration : public ProjectExplorer::B
friend class Qt4BuildConfigurationFactory;
public:
- explicit Qt4BuildConfiguration(Qt4BaseTarget *target);
- virtual ~Qt4BuildConfiguration();
-
- Qt4BaseTarget *qt4Target() const;
+ explicit Qt4BuildConfiguration(ProjectExplorer::Target *target);
+ ~Qt4BuildConfiguration();
- virtual Utils::Environment baseEnvironment() const;
+ Utils::Environment baseEnvironment() const;
- virtual QString buildDirectory() const;
+ ProjectExplorer::BuildConfigWidget *createConfigWidget();
+ QString buildDirectory() const;
bool shadowBuild() const;
QString shadowBuildDirectory() const;
void setShadowBuildAndDirectory(bool shadowBuild, const QString &buildDirectory);
@@ -75,12 +72,6 @@ public:
ProjectExplorer::FileNode *fileNodeBuild() const;
void setFileNodeBuild(ProjectExplorer::FileNode *node);
- // returns the qtVersion
- QtSupport::BaseQtVersion *qtVersion() const;
- void setQtVersion(QtSupport::BaseQtVersion *);
-
- void setToolChain(ProjectExplorer::ToolChain *tc);
-
QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration() const;
void setQMakeBuildConfiguration(QtSupport::BaseQtVersion::QmakeBuildConfigs config);
@@ -106,11 +97,11 @@ public:
QMakeStep *qmakeStep() const;
MakeStep *makeStep() const;
- QString makeCommand() const;
QString defaultMakeTarget() const;
QString makefile() const;
- bool compareToImportFrom(const QString &makefile);
+ enum MakefileState { MakefileMatches, MakefileForWrongProject, MakefileIncompatible, MakefileMissing };
+ MakefileState compareToImportFrom(const QString &makefile);
static bool removeQMLInspectorFromArguments(QString *args);
static Utils::FileName extractSpecFromArguments(QString *arguments,
const QString &directory, const QtSupport::BaseQtVersion *version,
@@ -127,39 +118,37 @@ public:
BuildType buildType() const;
+ static Qt4BuildConfiguration *setup(ProjectExplorer::Target *t,
+ QString defaultDisplayName,
+ QString displayName,
+ QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
+ QString additionalArguments,
+ QString directory,
+ bool importing);
+ /// returns whether the qt version in the profile supports shadow building (also true for no qt version)
+ bool supportsShadowBuilds();
+
public slots:
- void importFromBuildDirectory();
- void emitProFileEvaluateNeeded();
+ void emitEvaluateBuildSystem();
signals:
- /// emitted if the qt version changes (either directly, or because the default qt version changed
- /// or because the user changed the settings for the qt version
- void qtVersionChanged();
/// emitted for setQMakeBuildConfig, not emitted for qt version changes, even
/// if those change the qmakebuildconfig
void qmakeBuildConfigurationChanged();
/// emitted when smart installer property of S60 create package step changes
void s60CreatesSmartInstallerChanged();
- /// emitted if the build configuration changed in a way that
- /// should trigger a reevaluation of all .pro files
- void proFileEvaluateNeeded(Qt4ProjectManager::Qt4BuildConfiguration *);
-
- void buildDirectoryInitialized();
-
private slots:
- void qtVersionsChanged(const QList<int> &addedVersions, const QList<int> &removedVersions, const QList<int> &changedVersions);
+ void profileChanged();
void emitBuildDirectoryChanged();
- void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *, bool, bool parseInProgress);
protected:
- Qt4BuildConfiguration(Qt4BaseTarget *target, Qt4BuildConfiguration *source);
- Qt4BuildConfiguration(Qt4BaseTarget *target, const Core::Id id);
+ Qt4BuildConfiguration(ProjectExplorer::Target *target, Qt4BuildConfiguration *source);
+ Qt4BuildConfiguration(ProjectExplorer::Target *target, const Core::Id id);
virtual bool fromMap(const QVariantMap &map);
private:
void ctor();
- void pickValidQtVersion();
QString rawBuildDirectory() const;
QString defaultShadowBuildDirectory() const;
@@ -167,7 +156,7 @@ private:
bool m_isEnabled;
QString m_buildDirectory;
QString m_lastEmmitedBuildDirectory;
- int m_qtVersionId;
+ bool m_qtVersionSupportsShadowBuilds;
QtSupport::BaseQtVersion::QmakeBuildConfigs m_qmakeBuildConfiguration;
Qt4ProjectManager::Qt4ProFileNode *m_subNodeBuild;
ProjectExplorer::FileNode *m_fileNodeBuild;
@@ -181,18 +170,24 @@ public:
explicit Qt4BuildConfigurationFactory(QObject *parent = 0);
~Qt4BuildConfigurationFactory();
- QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
+ QList<Core::Id> availableCreationIds(const ProjectExplorer::Target *parent) const;
QString displayNameForId(const Core::Id id) const;
- bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
- ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
- bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
+ bool canCreate(const ProjectExplorer::Target *parent, const Core::Id id) const;
+ ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id, const QString &name = QString());
+ bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source);
- bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
+ bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
+ static QList<BuildConfigurationInfo> availableBuildConfigurations(const ProjectExplorer::Profile *p, const QString &proFilePath);
+ static QString buildConfigurationDisplayName(const BuildConfigurationInfo &info);
+
private slots:
void update();
+
+private:
+ bool canHandle(const ProjectExplorer::Target *t) const;
};
} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp
index 2bb595682c..7ac30646fa 100644
--- a/src/plugins/qt4projectmanager/qt4nodes.cpp
+++ b/src/plugins/qt4projectmanager/qt4nodes.cpp
@@ -32,12 +32,12 @@
#include "qt4nodes.h"
#include "qt4project.h"
-#include "qt4target.h"
#include "qt4projectmanager.h"
#include "qt4projectmanagerconstants.h"
#include "qtuicodemodelsupport.h"
#include "qmakestep.h"
#include "qt4buildconfiguration.h"
+#include "qmakerunconfigurationfactory.h"
#include <projectexplorer/nodesvisitor.h>
#include <projectexplorer/runconfiguration.h>
@@ -53,9 +53,12 @@
#include <cpptools/ModelManagerInterface.h>
#include <cplusplus/CppDocument.h>
#include <extensionsystem/pluginmanager.h>
-#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/buildmanager.h>
+#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/target.h>
#include <qtsupport/profilereader.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
#include <utils/qtcassert.h>
#include <utils/stringutils.h>
@@ -801,8 +804,9 @@ void Qt4PriFileNode::folderChanged(const QString &folder)
// We need to regenerate that list by running qmake
// Other platforms do not have a explicit list of files to package, but package
// directories
- foreach (ProjectExplorer::Target *target, m_project->targets()) {
- if (target->id() == Core::Id(Constants::S60_DEVICE_TARGET_ID)) {
+ foreach (const ProjectExplorer::Target *target, m_project->targets()) {
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
+ if (version && version->type() == QtSupport::Constants::SYMBIANQT) {
foreach (ProjectExplorer::BuildConfiguration *bc, target->buildConfigurations()) {
Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(bc);
if (qt4bc) {
@@ -833,9 +837,9 @@ bool Qt4PriFileNode::deploysFolder(const QString &folder) const
QList<ProjectExplorer::RunConfiguration *> Qt4PriFileNode::runConfigurationsFor(Node *node)
{
- Qt4BaseTarget *target = m_project->activeTarget();
- if (target)
- return target->runConfigurationsForNode(node);
+ QmakeRunConfigurationFactory *factory = QmakeRunConfigurationFactory::find(m_project->activeTarget());
+ if (factory)
+ return factory->runConfigurationsForNode(m_project->activeTarget(), node);
return QList<ProjectExplorer::RunConfiguration *>();
}
@@ -917,8 +921,9 @@ QList<ProjectNode::ProjectAction> Qt4PriFileNode::supportedActions(Node *node) c
actions << Rename;
- Qt4BaseTarget *target = m_project->activeTarget();
- if (target && !target->runConfigurationsForNode(node).isEmpty())
+ ProjectExplorer::Target *target = m_project->activeTarget();
+ QmakeRunConfigurationFactory *factory = QmakeRunConfigurationFactory::find(target);
+ if (factory && !factory->runConfigurationsForNode(target, node).isEmpty())
actions << HasSubProjectRunConfigurations;
return actions;
@@ -2321,8 +2326,9 @@ TargetInformation Qt4ProFileNode::targetInformation(QtSupport::ProFileReader *re
// Hmm can we find out whether it's debug or release in a saner way?
// Theoretically it's in CONFIG
QString qmakeBuildConfig = QLatin1String("release");
- Qt4BaseTarget *target = m_project->activeTarget();
- if (!target || target->activeQt4BuildConfiguration()->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild)
+ ProjectExplorer::Target *target = m_project->activeTarget();
+ Qt4BuildConfiguration *bc = target ? qobject_cast<Qt4BuildConfiguration *>(target->activeBuildConfiguration()) : 0;
+ if (!target || !bc || bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild)
qmakeBuildConfig = QLatin1String("debug");
wd += QLatin1Char('/') + qmakeBuildConfig;
}
@@ -2454,7 +2460,7 @@ QString Qt4ProFileNode::buildDir(Qt4BuildConfiguration *bc) const
const QDir srcDirRoot = QFileInfo(m_project->rootProjectNode()->path()).absoluteDir();
const QString relativeDir = srcDirRoot.relativeFilePath(m_projectDir);
if (!bc && m_project->activeTarget())
- bc = m_project->activeTarget()->activeQt4BuildConfiguration();
+ bc = qobject_cast<Qt4BuildConfiguration *>(m_project->activeTarget()->activeBuildConfiguration());
if (!bc)
return QString();
return QDir(bc->buildDirectory()).absoluteFilePath(relativeDir);
diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp
index 44c12bfc93..54abc51f7e 100644
--- a/src/plugins/qt4projectmanager/qt4project.cpp
+++ b/src/plugins/qt4projectmanager/qt4project.cpp
@@ -33,15 +33,14 @@
#include "qt4project.h"
#include "qt4projectmanager.h"
-#include "qt4target.h"
#include "makestep.h"
#include "qmakestep.h"
+#include "qmakerunconfigurationfactory.h"
#include "qt4nodes.h"
#include "qt4projectconfigwidget.h"
#include "qt4projectmanagerconstants.h"
#include "qt4buildconfiguration.h"
#include "findqt4profiles.h"
-#include "qt4basetargetfactory.h"
#include "buildconfigurationinfo.h"
#include <coreplugin/icore.h>
@@ -57,6 +56,7 @@
#include <projectexplorer/headerpath.h>
#include <projectexplorer/target.h>
#include <projectexplorer/buildenvironmentwidget.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/qtcassert.h>
@@ -64,6 +64,7 @@
#include <qtsupport/qmldumptool.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/profilereader.h>
+#include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtsupportconstants.h>
#include <qtsupport/qtversionmanager.h>
#include <utils/QtConcurrentTools>
@@ -80,6 +81,43 @@ using namespace ProjectExplorer;
enum { debug = 0 };
+// -----------------------------------------------------------------------
+// Helpers:
+// -----------------------------------------------------------------------
+
+namespace {
+
+Qt4BuildConfiguration *enableActiveQt4BuildConfiguration(ProjectExplorer::Target *t, bool enabled)
+{
+ if (!t)
+ return 0;
+ Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(t->activeBuildConfiguration());
+ if (!bc)
+ return 0;
+ bc->setEnabled(enabled);
+ return bc;
+}
+
+QString sanitize(const QString &input)
+{
+ QString result;
+ result.reserve(input.size());
+ foreach (const QChar &qc, input) {
+ const char c = qc.toLatin1();
+ if ((c >= 'a' && c <='z')
+ || (c >= 'A' && c <= 'Z')
+ || (c >= '0' && c <= '9')
+ || c == '-'
+ || c == '_')
+ result.append(qc);
+ else
+ result.append(QLatin1Char('_'));
+ }
+ return result;
+}
+
+} // namespace
+
namespace Qt4ProjectManager {
namespace Internal {
@@ -139,7 +177,8 @@ private:
};
// Qt4ProjectFiles: Struct for (Cached) lists of files in a project
-struct Qt4ProjectFiles {
+class Qt4ProjectFiles {
+public:
void clear();
bool equals(const Qt4ProjectFiles &f) const;
@@ -371,7 +410,6 @@ bool Qt4Project::fromMap(const QVariantMap &map)
if (t->buildConfigurations().isEmpty()) {
qWarning() << "Removing" << t->id().name() << "since it has no buildconfigurations!";
removeTarget(t);
- delete t;
}
}
@@ -385,51 +423,22 @@ bool Qt4Project::fromMap(const QVariantMap &map)
// This might be incorrect, need a full update
updateCodeModels();
- foreach (Target *t, targets())
- static_cast<Qt4BaseTarget *>(t)->createApplicationProFiles(false);
-
- foreach (Target *t, targets())
- onAddedTarget(t);
-
+ // We have the profile nodes now, so we know the runconfigs!
connect(m_nodesWatcher, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
this, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
// Now we emit update once :)
m_rootProjectNode->emitProFileUpdatedRecursive();
-
- // Setup Qt versions supported (== possible targets).
- connect(this, SIGNAL(addedTarget(ProjectExplorer::Target*)),
- this, SLOT(onAddedTarget(ProjectExplorer::Target*)));
-
connect(this, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
this, SLOT(activeTargetWasChanged()));
- emit fromMapFinished();
-
return true;
}
-Qt4BaseTarget *Qt4Project::activeTarget() const
+void Qt4Project::evaluateBuildSystem()
{
- return static_cast<Qt4BaseTarget *>(Project::activeTarget());
-}
-
-void Qt4Project::onAddedTarget(ProjectExplorer::Target *t)
-{
- Q_ASSERT(t);
- Qt4BaseTarget *qt4target = qobject_cast<Qt4BaseTarget *>(t);
- Q_ASSERT(qt4target);
- connect(qt4target, SIGNAL(buildDirectoryInitialized()),
- this, SIGNAL(buildDirectoryInitialized()));
- connect(qt4target, SIGNAL(proFileEvaluateNeeded(Qt4ProjectManager::Qt4BaseTarget*)),
- this, SLOT(proFileEvaluateNeeded(Qt4ProjectManager::Qt4BaseTarget*)));
-}
-
-void Qt4Project::proFileEvaluateNeeded(Qt4ProjectManager::Qt4BaseTarget *target)
-{
- if (activeTarget() == target)
- scheduleAsyncUpdate();
+ scheduleAsyncUpdate();
}
/// equalFileList compares two file lists ignoring
@@ -473,15 +482,15 @@ void Qt4Project::updateCppCodeModel()
{
typedef CPlusPlus::CppModelManagerInterface::ProjectPart ProjectPart;
+ Profile *p = 0;
QtSupport::BaseQtVersion *qtVersion = 0;
ToolChain *tc = 0;
- if (Qt4BaseTarget *target = activeTarget()) {
- qtVersion = target->activeQt4BuildConfiguration()->qtVersion();
- tc = target->activeQt4BuildConfiguration()->toolChain();
- } else {
- qtVersion = qt4ProjectManager()->unconfiguredSettings().version;
- tc = qt4ProjectManager()->unconfiguredSettings().toolchain;
- }
+ if (ProjectExplorer::Target *target = activeTarget())
+ p = target->profile();
+ else
+ p = ProfileManager::instance()->defaultProfile();
+ qtVersion = QtSupport::QtProfileInformation::qtVersion(p);
+ tc = ToolChainProfileInformation::toolChain(p);
CPlusPlus::CppModelManagerInterface *modelmanager =
CPlusPlus::CppModelManagerInterface::instance();
@@ -519,7 +528,7 @@ void Qt4Project::updateCppCodeModel()
if (tc)
headers = tc->systemHeaderPaths(); // todo pass cxxflags?
if (qtVersion) {
- headers.append(qtVersion->systemHeaderPathes());
+ headers.append(qtVersion->systemHeaderPathes(p));
}
foreach (const HeaderPath &headerPath, headers) {
@@ -585,41 +594,32 @@ void Qt4Project::updateQmlJSCodeModel()
bool preferDebugDump = false;
projectInfo.tryQmlDump = false;
- QtSupport::BaseQtVersion *qtVersion = 0;
- if (Qt4BaseTarget *t = activeTarget()) {
- if (Qt4BuildConfiguration *bc = t->activeQt4BuildConfiguration()) {
- qtVersion = bc->qtVersion();
+ ProjectExplorer::Target *t = activeTarget();
+ ProjectExplorer::Profile *p = t ? t->profile() : ProjectExplorer::ProfileManager::instance()->defaultProfile();
+ QtSupport::BaseQtVersion *qtVersion = QtSupport::QtProfileInformation::qtVersion(p);
+
+ if (t) {
+ if (Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(t->activeBuildConfiguration()))
preferDebugDump = bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild;
- }
} else {
- qtVersion = qt4ProjectManager()->unconfiguredSettings().version;
if (qtVersion)
preferDebugDump = qtVersion->defaultBuildConfig() & QtSupport::BaseQtVersion::DebugBuild;
}
- if (qtVersion) {
- if (qtVersion && qtVersion->isValid()) {
- projectInfo.tryQmlDump = qtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT)
- || qtVersion->type() == QLatin1String(QtSupport::Constants::SIMULATORQT);
- projectInfo.qtImportsPath = qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_IMPORTS"));
- if (!projectInfo.qtImportsPath.isEmpty())
- projectInfo.importPaths += projectInfo.qtImportsPath;
- projectInfo.qtVersionString = qtVersion->qtVersionString();
- }
+ if (qtVersion && qtVersion->isValid()) {
+ projectInfo.tryQmlDump = qtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT)
+ || qtVersion->type() == QLatin1String(QtSupport::Constants::SIMULATORQT);
+ projectInfo.qtImportsPath = qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_IMPORTS"));
+ if (!projectInfo.qtImportsPath.isEmpty())
+ projectInfo.importPaths += projectInfo.qtImportsPath;
+ projectInfo.qtVersionString = qtVersion->qtVersionString();
}
projectInfo.importPaths.removeDuplicates();
if (projectInfo.tryQmlDump) {
- if (Qt4BaseTarget *target = activeTarget()) {
- const Qt4BuildConfiguration *bc = target->activeQt4BuildConfiguration();
- if (bc)
- QtSupport::QmlDumpTool::pathAndEnvironment(this, bc->qtVersion(), bc->toolChain(),
- preferDebugDump, &projectInfo.qmlDumpPath,
- &projectInfo.qmlDumpEnvironment);
- } else {
- UnConfiguredSettings us = qt4ProjectManager()->unconfiguredSettings();
- QtSupport::QmlDumpTool::pathAndEnvironment(this, us.version, us.toolchain,
- preferDebugDump, &projectInfo.qmlDumpPath, &projectInfo.qmlDumpEnvironment);
- }
+ QtSupport::QmlDumpTool::pathAndEnvironment(this, qtVersion,
+ ToolChainProfileInformation::toolChain(p),
+ preferDebugDump, &projectInfo.qmlDumpPath,
+ &projectInfo.qmlDumpEnvironment);
} else {
projectInfo.qmlDumpPath.clear();
projectInfo.qmlDumpEnvironment.clear();
@@ -640,10 +640,8 @@ void Qt4Project::update()
if (debug)
qDebug()<<"State is now Base";
m_asyncUpdateState = Base;
- Qt4BaseTarget *target = activeTarget();
- if (target)
- target->activeQt4BuildConfiguration()->setEnabled(true);
- emit proParsingDone();
+ enableActiveQt4BuildConfiguration(activeTarget(), true);
+ buildSystemEvaluationFinished(true);
}
void Qt4Project::scheduleAsyncUpdate(Qt4ProFileNode *node)
@@ -664,8 +662,7 @@ void Qt4Project::scheduleAsyncUpdate(Qt4ProFileNode *node)
return;
}
- if (activeTarget() && activeTarget()->activeQt4BuildConfiguration())
- activeTarget()->activeQt4BuildConfiguration()->setEnabled(false);
+ enableActiveQt4BuildConfiguration(activeTarget(), false);
if (m_asyncUpdateState == AsyncFullUpdatePending) {
// Just postpone
@@ -735,8 +732,7 @@ void Qt4Project::scheduleAsyncUpdate()
qDebug()<<" update in progress, canceling and setting state to full update pending";
m_cancelEvaluate = true;
m_asyncUpdateState = AsyncFullUpdatePending;
- if (activeTarget() && activeTarget()->activeQt4BuildConfiguration())
- activeTarget()->activeQt4BuildConfiguration()->setEnabled(false);
+ enableActiveQt4BuildConfiguration(activeTarget(), false);
m_rootProjectNode->setParseInProgressRecursive(true);
return;
}
@@ -744,8 +740,7 @@ void Qt4Project::scheduleAsyncUpdate()
if (debug)
qDebug()<<" starting timer for full update, setting state to full update pending";
m_partialEvaluate.clear();
- if (activeTarget() && activeTarget()->activeQt4BuildConfiguration())
- activeTarget()->activeQt4BuildConfiguration()->setEnabled(false);
+ enableActiveQt4BuildConfiguration(activeTarget(), false);
m_rootProjectNode->setParseInProgressRecursive(true);
m_asyncUpdateState = AsyncFullUpdatePending;
m_asyncUpdateTimer.start();
@@ -793,13 +788,10 @@ void Qt4Project::decrementPendingEvaluateFutures()
} else if (m_asyncUpdateState != ShuttingDown){
// After being done, we need to call:
m_asyncUpdateState = Base;
- if (activeTarget() && activeTarget()->activeQt4BuildConfiguration())
- activeTarget()->activeQt4BuildConfiguration()->setEnabled(true);
- foreach (Target *t, targets())
- static_cast<Qt4BaseTarget *>(t)->createApplicationProFiles(true);
+ enableActiveQt4BuildConfiguration(activeTarget(), true);
updateFileList();
updateCodeModels();
- emit proParsingDone();
+ buildSystemEvaluationFinished(true);
if (debug)
qDebug()<<" Setting state to Base";
}
@@ -855,6 +847,12 @@ Qt4Manager *Qt4Project::qt4ProjectManager() const
return m_manager;
}
+bool Qt4Project::supportsProfile(Profile *p) const
+{
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(p);
+ return version;
+}
+
QString Qt4Project::displayName() const
{
return QFileInfo(document()->fileName()).completeBaseName();
@@ -924,43 +922,33 @@ QtSupport::ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4Pro
m_proFileOption = new ProFileOption;
m_proFileOptionRefCnt = 0;
- QtSupport::BaseQtVersion *qtVersion = 0;
- ProjectExplorer::ToolChain *tc = 0;
+ Profile *p;
Utils::Environment env = Utils::Environment::systemEnvironment();
+ Qt4BuildConfiguration *currentBc = bc;
QStringList qmakeArgs;
- if (bc) {
- qtVersion = bc->qtVersion();
- env = bc->environment();
- tc = bc->toolChain();
- if (QMakeStep *qs = bc->qmakeStep()) {
- qmakeArgs = qs->parserArguments();
- m_proFileOption->qmakespec = qs->mkspec().toString();
+ if (!currentBc)
+ currentBc = activeTarget() ? qobject_cast<Qt4BuildConfiguration *>(activeTarget()->activeBuildConfiguration()) : 0;
+
+ if (currentBc) {
+ p = currentBc->target()->profile();
+ env = currentBc->environment();
+ if (currentBc->qmakeStep()) {
+ qmakeArgs = currentBc->qmakeStep()->parserArguments();
+ m_proFileOption->qmakespec = currentBc->qmakeStep()->mkspec().toString();
} else {
qmakeArgs = bc->configCommandLineArguments();
}
- } else if (Qt4BaseTarget *target = activeTarget()) {
- if (Qt4BuildConfiguration *bc = target->activeQt4BuildConfiguration()) {
- qtVersion = bc->qtVersion();
- env = bc->environment();
- tc = bc->toolChain();
- if (QMakeStep *qs = bc->qmakeStep()) {
- qmakeArgs = qs->parserArguments();
- m_proFileOption->qmakespec = qs->mkspec().toString();
- } else {
- qmakeArgs = bc->configCommandLineArguments();
- }
- }
} else {
- UnConfiguredSettings ucs = qt4ProjectManager()->unconfiguredSettings();
- qtVersion = ucs.version;
- tc = ucs.toolchain;
+ p = ProfileManager::instance()->defaultProfile();
}
- if (qtVersion && qtVersion->isValid()) {
+ QtSupport::BaseQtVersion *qtVersion = QtSupport::QtProfileInformation::qtVersion(p);
+ QString systemRoot = SysRootProfileInformation::hasSysRoot(p)
+ ? SysRootProfileInformation::sysRoot(p).toString() : QString();
+
+ if (qtVersion && qtVersion->isValid())
m_proFileOption->properties = qtVersion->versionInfo();
- if (tc)
- m_proFileOption->sysroot = qtVersion->systemRoot();
- }
+ m_proFileOption->sysroot = systemRoot;
Utils::Environment::const_iterator eit = env.constBegin(), eend = env.constEnd();
for (; eit != eend; ++eit)
@@ -1334,30 +1322,19 @@ bool Qt4Project::needsConfiguration() const
void Qt4Project::configureAsExampleProject(const QStringList &platforms)
{
- QList<Qt4BaseTargetFactory *> factories = ExtensionSystem::PluginManager::getObjects<Qt4BaseTargetFactory>();
- foreach (Qt4BaseTargetFactory *factory, factories) {
- foreach (const Core::Id id, factory->supportedTargetIds()) {
- QList<BuildConfigurationInfo> infos
- = factory->availableBuildConfigurations(id, rootProjectNode()->path(),
- QtSupport::QtVersionNumber(),
- QtSupport::QtVersionNumber(INT_MAX, INT_MAX, INT_MAX),
- Core::FeatureSet());
- if (!platforms.isEmpty()) {
- QList<BuildConfigurationInfo> filtered;
- foreach (const BuildConfigurationInfo &info, infos) {
- foreach (const QString &platform, platforms) {
- if (info.version()->supportsPlatform(platform)) {
- filtered << info;
- break;
- }
- }
- }
- infos = filtered;
- }
-
- if (!infos.isEmpty())
- addTarget(factory->create(this, id, infos));
- }
+ QList<Profile *> profiles = ProjectExplorer::ProfileManager::instance()->profiles();
+ foreach (Profile *p, profiles) {
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(p);
+ if (!version)
+ continue;
+ if (!platforms.isEmpty() && !platforms.contains(version->platformName()))
+ continue;
+
+ QList<BuildConfigurationInfo> infoList
+ = Qt4BuildConfigurationFactory::availableBuildConfigurations(p, document()->fileName());
+ if (infoList.isEmpty())
+ continue;
+ addTarget(createTarget(p, infoList));
}
ProjectExplorer::ProjectExplorerPlugin::instance()->requestProjectModeUpdate(this);
}
@@ -1379,6 +1356,55 @@ QString Qt4Project::disabledReasonForRunConfiguration(const QString &proFilePath
.arg(QFileInfo(proFilePath).fileName());
}
+QString Qt4Project::shadowBuildDirectory(const QString &profilePath, const Profile *p, const QString &suffix)
+{
+ if (profilePath.isEmpty())
+ return QString();
+ QFileInfo info(profilePath);
+
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(p);
+ if (version && !version->supportsShadowBuilds())
+ return info.absolutePath();
+
+ QString base = QDir::cleanPath(projectDirectory(profilePath) + QLatin1String("/../")
+ + info.baseName() + QLatin1String("-build-"));
+ return base + buildNameFor(p) + QLatin1String("-") + sanitize(suffix);
+}
+
+QString Qt4Project::buildNameFor(const Profile *p)
+{
+ if (!p)
+ return QLatin1String("unknown");
+ return QString::fromLatin1(p->id().name()).mid(31, 6); // part of the UUID, should be pretty unique;-)
+}
+
+Target *Qt4Project::createTarget(Profile *p, const QList<BuildConfigurationInfo> &infoList)
+{
+ if (target(p))
+ return 0;
+
+ Target *t = new Target(this, p);
+
+ // Build Configurations:
+ foreach (const BuildConfigurationInfo &info, infoList) {
+ QString name = info.buildConfig & QtSupport::BaseQtVersion::DebugBuild
+ ? tr("Debug") : tr("Release");
+ Qt4BuildConfiguration *bc
+ = Qt4BuildConfiguration::setup(t, name, name,
+ info.buildConfig, info.additionalArguments,
+ info.directory, info.importing);
+ t->addBuildConfiguration(bc);
+ }
+
+ // Deploy Configurations:
+ t->updateDefaultDeployConfigurations();
+
+ // Run Configurations:
+ t->updateDefaultRunConfigurations();
+
+ return t;
+}
+
} // namespace Qt4ProjectManager
#include "qt4project.moc"
diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h
index a568aeb5b3..7ca97059f3 100644
--- a/src/plugins/qt4projectmanager/qt4project.h
+++ b/src/plugins/qt4projectmanager/qt4project.h
@@ -48,35 +48,27 @@ QT_BEGIN_NAMESPACE
struct ProFileOption;
QT_END_NAMESPACE
-namespace QtSupport {
-class ProFileReader;
-}
+namespace QtSupport { class ProFileReader; }
namespace Qt4ProjectManager {
-class Qt4ProFileNode;
-class Qt4PriFileNode;
-class Qt4BaseTarget;
+class BuildConfigurationInfo;
+class MakeStep;
+class QMakeStep;
class Qt4BuildConfiguration;
class Qt4Manager;
-
-namespace Internal {
- class DeployHelperRunStep;
- class FileItem;
- class GCCPreprocessor;
- struct Qt4ProjectFiles;
- class Qt4ProjectConfigWidget;
- class Qt4ProjectFile;
- class Qt4NodesWatcher;
-}
-
-class QMakeStep;
-class MakeStep;
-
-class Qt4Project;
+class Qt4PriFileNode;
+class Qt4ProFileNode;
class Qt4RunStep;
namespace Internal {
class CentralizedFolderWatcher;
+class DeployHelperRunStep;
+class FileItem;
+class GCCPreprocessor;
+class Qt4ProjectFiles;
+class Qt4ProjectConfigWidget;
+class Qt4ProjectFile;
+class Qt4NodesWatcher;
}
class QT4PROJECTMANAGER_EXPORT Qt4Project : public ProjectExplorer::Project
@@ -93,7 +85,7 @@ public:
ProjectExplorer::IProjectManager *projectManager() const;
Qt4Manager *qt4ProjectManager() const;
- Qt4BaseTarget *activeTarget() const;
+ bool supportsProfile(ProjectExplorer::Profile *p) const;
ProjectExplorer::ProjectNode *rootProjectNode() const;
Qt4ProFileNode *rootQt4ProjectNode() const;
@@ -142,28 +134,31 @@ public:
/// \internal
QString disabledReasonForRunConfiguration(const QString &proFilePath);
+ /// suffix should be unique
+ static QString shadowBuildDirectory(const QString &profilePath, const ProjectExplorer::Profile *p,
+ const QString &suffix);
+ /// used by the default implementation of shadowBuildDirectory
+ static QString buildNameFor(const ProjectExplorer::Profile *p);
+
+ ProjectExplorer::Target *createTarget(ProjectExplorer::Profile *p, const QList<BuildConfigurationInfo> &infoList);
+
signals:
- void proParsingDone();
void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *node, bool, bool);
- void buildDirectoryInitialized();
- void fromMapFinished();
public slots:
void proFileParseError(const QString &errorMessage);
void update();
protected:
- virtual bool fromMap(const QVariantMap &map);
+ bool fromMap(const QVariantMap &map);
private slots:
- void proFileEvaluateNeeded(Qt4ProjectManager::Qt4BaseTarget *target);
-
void asyncUpdate();
- void onAddedTarget(ProjectExplorer::Target *t);
void activeTargetWasChanged();
private:
+ void evaluateBuildSystem();
void scheduleAsyncUpdate();
void updateCppCodeModel();
diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp
index 0f24693b1f..7318f21849 100644
--- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp
+++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp
@@ -35,25 +35,24 @@
#include "makestep.h"
#include "qmakestep.h"
#include "qt4project.h"
-#include "qt4target.h"
#include "qt4projectmanagerconstants.h"
#include "qt4projectmanager.h"
#include "qt4buildconfiguration.h"
-#include "qt4basetargetfactory.h"
#include "ui_qt4projectconfigwidget.h"
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
-#include <projectexplorer/toolchainmanager.h>
+#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/task.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/buildconfiguration.h>
#include <qtsupport/qtversionfactory.h>
#include <qtsupport/baseqtversion.h>
-#include <qtsupport/qtversionmanager.h>
+#include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtsupportconstants.h>
+#include <qtsupport/qtversionmanager.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <extensionsystem/pluginmanager.h>
@@ -70,7 +69,7 @@ using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
using namespace ProjectExplorer;
-Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4BaseTarget *target)
+Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(ProjectExplorer::Target *target)
: BuildConfigWidget(),
m_buildConfiguration(0),
m_ignoreChange(false)
@@ -89,7 +88,6 @@ Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4BaseTarget *target)
m_ui->shadowBuildDirEdit->setPromptDialogTitle(tr("Shadow Build Directory"));
m_ui->shadowBuildDirEdit->setExpectedKind(Utils::PathChooser::ExistingDirectory);
- m_ui->shadowBuildDirEdit->setBaseDirectory(target->qt4Project()->projectDirectory());
connect(m_ui->shadowBuildCheckBox, SIGNAL(clicked(bool)),
this, SLOT(shadowBuildClicked(bool)));
@@ -100,32 +98,11 @@ Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4BaseTarget *target)
connect(m_ui->shadowBuildDirEdit, SIGNAL(changed(QString)),
this, SLOT(shadowBuildEdited()));
- connect(m_ui->qtVersionComboBox, SIGNAL(currentIndexChanged(QString)),
- this, SLOT(qtVersionSelected(QString)));
-
- connect(m_ui->toolChainComboBox, SIGNAL(activated(int)),
- this, SLOT(toolChainSelected(int)));
-
- connect(m_ui->importLabel, SIGNAL(linkActivated(QString)),
- this, SLOT(importLabelClicked()));
-
- connect(m_ui->manageQtVersionPushButtons, SIGNAL(clicked()),
- this, SLOT(manageQtVersions()));
-
- connect(m_ui->manageToolChainPushButton, SIGNAL(clicked()),
- this, SLOT(manageToolChains()));
-
- connect(target->qt4Project(), SIGNAL(environmentChanged()),
- this, SLOT(environmentChanged()));
-
- connect(target->qt4Project(), SIGNAL(buildDirectoryInitialized()),
- this, SLOT(updateImportLabel()));
-
- connect(target->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
- this, SLOT(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
-
- connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainsChanged()),
- this, SLOT(updateToolChainCombo()));
+ Qt4Project *project = qobject_cast<Qt4Project *>(target->project());
+ if (project) {
+ connect(project, SIGNAL(environmentChanged()), this, SLOT(environmentChanged()));
+ connect(project, SIGNAL(buildDirectoryInitialized()), this, SLOT(updateProblemLabel()));
+ }
}
Qt4ProjectConfigWidget::~Qt4ProjectConfigWidget()
@@ -135,30 +112,9 @@ Qt4ProjectConfigWidget::~Qt4ProjectConfigWidget()
void Qt4ProjectConfigWidget::updateDetails()
{
- QtSupport::BaseQtVersion *version = m_buildConfiguration->qtVersion();
-
- QString versionString;
- if (version)
- versionString = version->displayName();
-
- if (!version || !version->isValid()) {
- // Not a valid qt version
- m_detailsContainer->setSummaryText(
- tr("using <font color=\"#ff0000\">invalid</font> Qt Version: <b>%1</b><br>"
- "%2")
- .arg(versionString,
- version ? version->invalidReason() : tr("No Qt Version found.")));
- } else {
- // Qt Version, Build Directory and tool chain
- m_detailsContainer->setSummaryText(
- tr("using Qt version: <b>%1</b><br>"
- "with tool chain <b>%2</b><br>"
- "building in <b>%3</b>")
- .arg(versionString,
- m_buildConfiguration->toolChain() ? m_buildConfiguration->toolChain()->displayName() :
- tr("<Invalid tool chain>"),
- QDir::toNativeSeparators(m_buildConfiguration->buildDirectory())));
- }
+ m_detailsContainer->setSummaryText(
+ tr("building in <b>%3</b>")
+ .arg(QDir::toNativeSeparators(m_buildConfiguration->buildDirectory())));
}
void Qt4ProjectConfigWidget::environmentChanged()
@@ -166,28 +122,6 @@ void Qt4ProjectConfigWidget::environmentChanged()
m_ui->shadowBuildDirEdit->setEnvironment(m_buildConfiguration->environment());
}
-void Qt4ProjectConfigWidget::updateShadowBuildUi()
-{
- QtSupport::BaseQtVersion *version = m_buildConfiguration->qtVersion();
- m_ui->shadowBuildCheckBox->setEnabled(version && version->supportsShadowBuilds());
- bool isShadowbuilding = m_buildConfiguration->shadowBuild();
- m_ui->shadowBuildDirEdit->setEnabled(isShadowbuilding && version && version->supportsShadowBuilds());
- m_browseButton->setEnabled(isShadowbuilding && version && version->supportsShadowBuilds());
- m_ui->shadowBuildDirEdit->setPath(m_buildConfiguration->shadowBuildDirectory());
-}
-
-void Qt4ProjectConfigWidget::manageQtVersions()
-{
- Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
- QLatin1String(QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID));
-}
-
-void Qt4ProjectConfigWidget::manageToolChains()
-{
- Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
- QLatin1String(ProjectExplorer::Constants::TOOLCHAIN_SETTINGS_PAGE_ID));
-}
-
QString Qt4ProjectConfigWidget::displayName() const
{
return tr("General");
@@ -203,95 +137,20 @@ void Qt4ProjectConfigWidget::init(ProjectExplorer::BuildConfiguration *bc)
if (m_buildConfiguration) {
disconnect(m_buildConfiguration, SIGNAL(buildDirectoryChanged()),
this, SLOT(buildDirectoryChanged()));
- disconnect(m_buildConfiguration, SIGNAL(qtVersionChanged()),
- this, SLOT(qtVersionChanged()));
disconnect(m_buildConfiguration, SIGNAL(qmakeBuildConfigurationChanged()),
- this, SLOT(updateImportLabel()));
- disconnect(m_buildConfiguration, SIGNAL(toolChainChanged()),
- this, SLOT(toolChainChanged()));
+ this, SLOT(updateProblemLabel()));
}
m_buildConfiguration = static_cast<Qt4BuildConfiguration *>(bc);
m_ui->shadowBuildDirEdit->setEnvironment(m_buildConfiguration->environment());
connect(m_buildConfiguration, SIGNAL(buildDirectoryChanged()),
this, SLOT(buildDirectoryChanged()));
- connect(m_buildConfiguration, SIGNAL(qtVersionChanged()),
- this, SLOT(qtVersionChanged()));
connect(m_buildConfiguration, SIGNAL(qmakeBuildConfigurationChanged()),
- this, SLOT(updateImportLabel()));
- connect(m_buildConfiguration, SIGNAL(toolChainChanged()),
- this, SLOT(toolChainChanged()));
+ this, SLOT(updateProblemLabel()));
- qtVersionsChanged();
- QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
- connect(vm, SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
- this, SLOT(qtVersionsChanged()));
+ m_ui->shadowBuildDirEdit->setBaseDirectory(m_buildConfiguration->target()->project()->projectDirectory());
- bool shadowBuild = m_buildConfiguration->shadowBuild();
- m_ui->shadowBuildCheckBox->setChecked(shadowBuild);
- m_ui->shadowBuildCheckBox->setEnabled(m_buildConfiguration->qtVersion()
- && m_buildConfiguration->qtVersion()->supportsShadowBuilds());
-
- updateShadowBuildUi();
- updateImportLabel();
- updateToolChainCombo();
- updateDetails();
-
- connect(ToolChainManager::instance(), SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
- this, SLOT(updateToolChainCombo()));
- connect(ToolChainManager::instance(), SIGNAL(toolChainRemoved(ProjectExplorer::ToolChain*)),
- this, SLOT(updateToolChainCombo()));
-}
-
-void Qt4ProjectConfigWidget::qtVersionChanged()
-{
- if (m_ignoreChange)
- return;
-
- int versionId = -1;
- if (m_buildConfiguration->qtVersion())
- versionId = m_buildConfiguration->qtVersion()->uniqueId();
- int comboBoxIndex = m_ui->qtVersionComboBox->findData(QVariant(versionId), Qt::UserRole);
- m_ui->qtVersionComboBox->setCurrentIndex(comboBoxIndex);
-
- updateShadowBuildUi();
- updateImportLabel();
- updateToolChainCombo();
- updateDetails();
-}
-
-void Qt4ProjectConfigWidget::qtVersionsChanged()
-{
- m_ignoreChange = true;
- QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
-
- m_ui->qtVersionComboBox->clear();
- QtSupport::BaseQtVersion *qtVersion = m_buildConfiguration->qtVersion();
-
- QList<QtSupport::BaseQtVersion *> validVersions = vm->versionsForTargetId(m_buildConfiguration->target()->id());
- if (!validVersions.isEmpty()) {
- for (int i = 0; i < validVersions.size(); ++i) {
- const QtSupport::BaseQtVersion *version = validVersions.at(i);
- m_ui->qtVersionComboBox->addItem(version->displayName(),
- version->uniqueId());
-
- if (version == qtVersion) {
- m_ui->qtVersionComboBox->setCurrentIndex(i);
- m_ui->qtVersionComboBox->setToolTip(version->toHtml(false));
- }
- }
- }
- if (!qtVersion || !qtVersion->isValid()) {
- m_ui->qtVersionComboBox->addItem(tr("Invalid Qt version"), -1);
- m_ui->qtVersionComboBox->setCurrentIndex(m_ui->qtVersionComboBox->count() - 1);
- }
- m_ui->qtVersionComboBox->setEnabled(m_ui->qtVersionComboBox->count() > 1);
- m_ignoreChange = false;
-
- updateToolChainCombo();
- updateShadowBuildUi();
- updateDetails();
- updateImportLabel();
+ buildDirectoryChanged();
}
void Qt4ProjectConfigWidget::buildDirectoryChanged()
@@ -299,8 +158,13 @@ void Qt4ProjectConfigWidget::buildDirectoryChanged()
if (m_ignoreChange)
return;
m_ui->shadowBuildDirEdit->setPath(m_buildConfiguration->shadowBuildDirectory());
+ bool shadowBuild = m_buildConfiguration->shadowBuild();
+ m_ui->shadowBuildCheckBox->setChecked(shadowBuild);
+ m_ui->shadowBuildDirEdit->setEnabled(shadowBuild);
+ m_browseButton->setEnabled(shadowBuild);
+
updateDetails();
- updateImportLabel();
+ updateProblemLabel();
}
void Qt4ProjectConfigWidget::onBeforeBeforeShadowBuildDirBrowsed()
@@ -321,7 +185,7 @@ void Qt4ProjectConfigWidget::shadowBuildClicked(bool checked)
m_ignoreChange = false;
updateDetails();
- updateImportLabel();
+ updateProblemLabel();
}
void Qt4ProjectConfigWidget::shadowBuildEdited()
@@ -335,238 +199,110 @@ void Qt4ProjectConfigWidget::shadowBuildEdited()
// if the directory already exists
// check if we have a build in there and
// offer to import it
- updateImportLabel();
+ updateProblemLabel();
updateDetails();
}
-void Qt4ProjectConfigWidget::updateImportLabel()
+void Qt4ProjectConfigWidget::updateProblemLabel()
{
- bool visible = false;
- bool targetMatches = false;
+ bool targetMismatch = false;
bool incompatibleBuild = false;
- bool couldnotparse = false;
+ bool allGood = false;
+
+ ProjectExplorer::Profile *p = m_buildConfiguration->target()->profile();
+ const QString proFileName = m_buildConfiguration->target()->project()->document()->fileName();
+
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(p);
+ if (!version) {
+ m_ui->problemLabel->setVisible(true);
+ m_ui->warningLabel->setVisible(true);
+ m_ui->problemLabel->setText(tr("This target can not build this project since it does not define a "
+ "Qt version."));
+ return;
+ }
- QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
// we only show if we actually have a qmake and makestep
if (m_buildConfiguration->qmakeStep() && m_buildConfiguration->makeStep()) {
- QString makefile = m_buildConfiguration->buildDirectory();
+ QString makefile = m_buildConfiguration->buildDirectory() + QLatin1Char('/');
if (m_buildConfiguration->makefile().isEmpty())
- makefile.append(QLatin1String("/Makefile"));
+ makefile.append(QLatin1String("Makefile"));
else
makefile.append(m_buildConfiguration->makefile());
- Utils::FileName qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
- QtSupport::BaseQtVersion *version = m_buildConfiguration->qtVersion();
- // check that there's a makefile
- if (!qmakePath.isEmpty()) {
- // Is it from the same build?
- QtSupport::QtVersionManager::MakefileCompatible mc =
- QtSupport::QtVersionManager::makefileIsFor(makefile, m_buildConfiguration->target()->project()->document()->fileName());
- if (mc == QtSupport::QtVersionManager::DifferentProject) {
- incompatibleBuild = true;
- } else if (mc == QtSupport::QtVersionManager::SameProject) {
- if (qmakePath != (version ? version->qmakeCommand() : Utils::FileName())) {
- // and that the qmake path is different from the current version
- // import enable
- visible = true;
- QtSupport::BaseQtVersion *newVersion = vm->qtVersionForQMakeBinary(qmakePath);
- bool mustDelete(false);
- if (!newVersion) {
- newVersion = QtSupport::QtVersionFactory::createQtVersionFromQMakePath(qmakePath);
- mustDelete = true;
- }
- targetMatches = newVersion ? newVersion->supportsTargetId(m_buildConfiguration->target()->id()) : false;
- if (mustDelete)
- delete newVersion;
- } else {
- // check that the qmake flags, arguments match
- visible = !m_buildConfiguration->compareToImportFrom(makefile);
- targetMatches = true;
- }
- } else if (mc == QtSupport::QtVersionManager::CouldNotParse) {
- couldnotparse = true;
- }
+ switch (m_buildConfiguration->compareToImportFrom(makefile)) {
+ case Qt4BuildConfiguration::MakefileMatches:
+ allGood = true;
+ break;
+ case Qt4BuildConfiguration::MakefileMissing:
+ allGood = true;
+ break;
+ case Qt4BuildConfiguration::MakefileIncompatible:
+ incompatibleBuild = true;
+ break;
+ case Qt4BuildConfiguration::MakefileForWrongProject:
+ targetMismatch = true;
+ break;
}
}
- QString buildDirectory = m_buildConfiguration->target()->project()->projectDirectory();;
- if (m_buildConfiguration->shadowBuild())
- buildDirectory = m_buildConfiguration->buildDirectory();
- QList<ProjectExplorer::Task> issues;
- if (QtSupport::BaseQtVersion *version = m_buildConfiguration->qtVersion()) {
- issues = version->reportIssues(m_buildConfiguration->target()->project()->document()->fileName(),
- buildDirectory);
- foreach (Qt4BaseTargetFactory *factory,
- Qt4BaseTargetFactory::qt4BaseTargetFactoriesForIds(version->supportedTargetIds().toList()))
- issues.append(factory->reportIssues(m_buildConfiguration->target()->project()->document()->fileName()));
+ QString shadowBuildWarning;
+ if (!version->supportsShadowBuilds() && m_buildConfiguration->shadowBuild()) {
+ shadowBuildWarning =tr("The qt version %1 does not support shadow builds, building might fail.")
+ .arg(version->displayName())
+ + QLatin1String("<br>");
+ }
+ if (allGood) {
+ QString buildDirectory = m_buildConfiguration->target()->project()->projectDirectory();;
+ if (m_buildConfiguration->shadowBuild())
+ buildDirectory = m_buildConfiguration->buildDirectory();
+ QList<ProjectExplorer::Task> issues;
+ issues = version->reportIssues(proFileName, buildDirectory);
qSort(issues);
- }
- if (incompatibleBuild) {
+ if (issues.isEmpty() && shadowBuildWarning.isEmpty()) {
+ m_ui->problemLabel->setVisible(false);
+ m_ui->warningLabel->setVisible(false);
+ } else {
+ m_ui->problemLabel->setVisible(true);
+ m_ui->warningLabel->setVisible(true);
+ QString text = QLatin1String("<nobr>") + shadowBuildWarning;
+ foreach (const ProjectExplorer::Task &task, issues) {
+ QString type;
+ switch (task.type) {
+ case ProjectExplorer::Task::Error:
+ type = tr("Error:");
+ type += QLatin1Char(' ');
+ break;
+ case ProjectExplorer::Task::Warning:
+ type = tr("Warning:");
+ type += QLatin1Char(' ');
+ break;
+ case ProjectExplorer::Task::Unknown:
+ default:
+ break;
+ }
+ if (!text.endsWith(QLatin1String("br>")))
+ text.append(QLatin1String("<br>"));
+ text.append(type + task.description);
+ }
+ m_ui->problemLabel->setText(text);
+ }
+ } else if (targetMismatch) {
m_ui->problemLabel->setVisible(true);
m_ui->warningLabel->setVisible(true);
- m_ui->importLabel->setVisible(false);
- m_ui->problemLabel->setText(tr("A build for a different project exists in %1, which will be overwritten.",
- "%1 build directory").
- arg(m_ui->shadowBuildDirEdit->path()));
- } else if (!issues.isEmpty()) {
+ m_ui->problemLabel->setText(shadowBuildWarning + tr("A build for a different project exists in %1, which will be overwritten.",
+ "%1 build directory")
+ .arg(m_ui->shadowBuildDirEdit->path()));
+ } else if (incompatibleBuild) {
+ m_ui->warningLabel->setVisible(true);
m_ui->problemLabel->setVisible(true);
+ m_ui->problemLabel->setText(shadowBuildWarning +tr("An incompatible build exists in %1, which will be overwritten.",
+ "%1 build directory")
+ .arg(m_ui->shadowBuildDirEdit->path()));
+ } else if (shadowBuildWarning.isEmpty()) {
m_ui->warningLabel->setVisible(true);
- m_ui->importLabel->setVisible(visible);
- QString text = QLatin1String("<nobr>");
- foreach (const ProjectExplorer::Task &task, issues) {
- QString type;
- switch (task.type) {
- case ProjectExplorer::Task::Error:
- type = tr("Error:");
- type += QLatin1Char(' ');
- break;
- case ProjectExplorer::Task::Warning:
- type = tr("Warning:");
- type += QLatin1Char(' ');
- break;
- case ProjectExplorer::Task::Unknown:
- default:
- break;
- }
- if (!text.endsWith(QLatin1String("br>")))
- text.append(QLatin1String("<br>"));
- text.append(type + task.description);
- }
- m_ui->problemLabel->setText(text);
- } else if (targetMatches) {
- m_ui->problemLabel->setVisible(false);
- m_ui->warningLabel->setVisible(false);
- m_ui->importLabel->setVisible(visible);
- } else if (couldnotparse) {
- m_ui->problemLabel->setVisible(false);
- m_ui->warningLabel->setVisible(false);
- m_ui->importLabel->setVisible(false);
- } else { // target did not match
- m_ui->warningLabel->setVisible(visible);
- m_ui->problemLabel->setVisible(visible);
- m_ui->problemLabel->setText(tr("An incompatible build exists in %1, which will be overwritten.",
- "%1 build directory").
- arg(m_ui->shadowBuildDirEdit->path()));
- m_ui->importLabel->setVisible(false);
- }
-}
-
-void Qt4ProjectConfigWidget::importLabelClicked()
-{
- if (!m_buildConfiguration->qmakeStep() || !m_buildConfiguration->makeStep())
- return;
-
- // We do the importing via a single shot timer due to QTCREATORBUG-2723
- // Adding a qtversion might trigger a supportedTargetIds changed signal
- // which results in a recreation of all the widgets on the page
- // That means also "this" gets deleted
- QTimer::singleShot(0, m_buildConfiguration, SLOT(importFromBuildDirectory()));
-}
-
-void Qt4ProjectConfigWidget::qtVersionSelected(const QString &)
-{
- if (m_ignoreChange)
- return;
-
- int newQtVersionId = m_ui->qtVersionComboBox->itemData(m_ui->qtVersionComboBox->currentIndex()).toInt();
-
- if (m_ui->qtVersionComboBox->itemData(m_ui->qtVersionComboBox->count() - 1).toInt() == -1)
- m_ui->qtVersionComboBox->removeItem(m_ui->qtVersionComboBox->count() - 1);
-
- QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
- QtSupport::BaseQtVersion *newQtVersion = vm->version(newQtVersionId);
-
- if (newQtVersion) {
- const QString qtVersionName = newQtVersion->displayName();
- QString defaultConfigName = (m_buildConfiguration->buildType() & BuildConfiguration::Debug) ?
- //: Name of a debug build configuration to created by a project wizard, %1 being the Qt version name. We recommend not translating it.
- tr("%1 Debug").arg(qtVersionName) :
- //: Name of a release build configuration to created by a project wizard, %1 being the Qt version name. We recommend not translating it.
- tr("%1 Release").arg(qtVersionName);
-
- // make name unique
- QStringList displayNames;
- foreach (const BuildConfiguration *bc, m_buildConfiguration->target()->buildConfigurations()) {
- if (bc != m_buildConfiguration)
- displayNames << bc->displayName();
- }
- defaultConfigName = Project::makeUnique(defaultConfigName, displayNames);
-
- m_buildConfiguration->setDefaultDisplayName(defaultConfigName);
- }
-
- m_ignoreChange = true;
- m_buildConfiguration->setQtVersion(newQtVersion);
- m_ignoreChange = false;
-
- m_ui->qtVersionComboBox->setToolTip(newQtVersion ? newQtVersion->toHtml(false) : QString());
-
- updateShadowBuildUi();
- updateToolChainCombo();
- updateImportLabel();
- updateDetails();
-}
-
-void Qt4ProjectConfigWidget::toolChainChanged()
-{
- if (m_ignoreChange)
- return;
- bool foundTc = false;
- for (int i = 0; i < m_ui->toolChainComboBox->count(); ++i) {
- ProjectExplorer::ToolChain *tc =
- static_cast<ProjectExplorer::ToolChain *>(m_ui->toolChainComboBox->itemData(i, Qt::UserRole).value<void *>());
- if (tc == m_buildConfiguration->toolChain()) {
- m_ignoreChange = true;
- m_ui->toolChainComboBox->setCurrentIndex(i);
- m_ignoreChange = false;
- foundTc = true;
- break;
- }
- }
- if (foundTc) {
- int index = m_ui->toolChainComboBox->findData(qVariantFromValue(static_cast<void *>(0)));
- if (index >= 0)
- m_ui->toolChainComboBox->removeItem(index);
- } else {
- m_ignoreChange = true;
- m_ui->toolChainComboBox->addItem(tr("<No tool chain selected>"), qVariantFromValue(static_cast<void *>(0)));
- m_ui->toolChainComboBox->setCurrentIndex(m_ui->toolChainComboBox->count() - 1);
- m_ignoreChange = false;
+ m_ui->problemLabel->setVisible(true);
+ m_ui->problemLabel->setText(shadowBuildWarning);
}
}
-
-void Qt4ProjectConfigWidget::proFileUpdated(Qt4ProjectManager::Qt4ProFileNode * /*node*/, bool success, bool parseInProgress)
-{
- if (!success || parseInProgress)
- return;
- updateToolChainCombo();
-}
-
-void Qt4ProjectConfigWidget::updateToolChainCombo()
-{
- m_ui->toolChainComboBox->clear();
- QList<ProjectExplorer::ToolChain *> toolchains =
- m_buildConfiguration->qt4Target()->possibleToolChains(m_buildConfiguration);
-
- foreach (ProjectExplorer::ToolChain *toolchain, toolchains)
- m_ui->toolChainComboBox->addItem(toolchain->displayName(),
- qVariantFromValue(static_cast<void *>(toolchain)));
- m_ui->toolChainComboBox->setEnabled(toolchains.size() > 1);
- toolChainChanged();
-}
-
-void Qt4ProjectConfigWidget::toolChainSelected(int index)
-{
- if (m_ignoreChange)
- return;
- ProjectExplorer::ToolChain *selectedToolChain =
- static_cast<ProjectExplorer::ToolChain *>(
- m_ui->toolChainComboBox->itemData(index,
- Qt::UserRole).value<void *>());
- m_ignoreChange = true;
- m_buildConfiguration->setToolChain(selectedToolChain);
- m_ignoreChange = false;
- updateDetails();
-}
diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.h b/src/plugins/qt4projectmanager/qt4projectconfigwidget.h
index 0302ec0d54..bb73777a59 100644
--- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.h
+++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.h
@@ -44,7 +44,6 @@ namespace Utils {
}
namespace Qt4ProjectManager {
-class Qt4BaseTarget;
class Qt4BuildConfiguration;
class Qt4ProFileNode;
@@ -57,7 +56,7 @@ class Qt4ProjectConfigWidget : public ProjectExplorer::BuildConfigWidget
{
Q_OBJECT
public:
- explicit Qt4ProjectConfigWidget(Qt4BaseTarget *target);
+ Qt4ProjectConfigWidget(ProjectExplorer::Target *target);
~Qt4ProjectConfigWidget();
QString displayName() const;
@@ -68,25 +67,14 @@ private slots:
void shadowBuildClicked(bool checked);
void onBeforeBeforeShadowBuildDirBrowsed();
void shadowBuildEdited();
- void qtVersionSelected(const QString &);
- void toolChainSelected(int index);
- void manageQtVersions();
- void manageToolChains();
- void importLabelClicked();
// Changes triggered from creator
- void qtVersionsChanged();
- void qtVersionChanged();
void buildDirectoryChanged();
- void toolChainChanged();
- void updateImportLabel();
+ void updateProblemLabel();
void environmentChanged();
- void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool);
- void updateToolChainCombo();
private:
void updateDetails();
- void updateShadowBuildUi();
Ui::Qt4ProjectConfigWidget *m_ui;
QAbstractButton *m_browseButton;
diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.ui b/src/plugins/qt4projectmanager/qt4projectconfigwidget.ui
index 65f7c995e8..35f7acd185 100644
--- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.ui
+++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.ui
@@ -6,107 +6,59 @@
<rect>
<x>0</x>
<y>0</y>
- <width>712</width>
- <height>188</height>
+ <width>408</width>
+ <height>78</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="qtVersionLabel">
+ <item row="1" column="0">
+ <widget class="QLabel" name="buildDirLabel">
<property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
- <string>Qt version:</string>
+ <string>Build directory:</string>
</property>
</widget>
</item>
- <item row="0" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="spacing">
- <number>4</number>
- </property>
+ <item row="2" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
- <widget class="QComboBox" name="qtVersionComboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <widget class="QLabel" name="warningLabel">
+ <property name="pixmap">
+ <pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap>
</property>
</widget>
</item>
<item>
- <widget class="QPushButton" name="manageQtVersionPushButtons">
- <property name="text">
- <string>Manage...</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="toolchainLabel">
- <property name="text">
- <string>Tool chain:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <property name="spacing">
- <number>4</number>
- </property>
- <item>
- <widget class="QComboBox" name="toolChainComboBox">
+ <widget class="QLabel" name="problemLabel">
<property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="manageToolChainPushButton">
<property name="text">
- <string>Manage...</string>
+ <string>problemLabel</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
- <item row="2" column="0">
+ <item row="0" column="0">
<widget class="QLabel" name="shadowBuildLabel">
<property name="text">
<string>Shadow build:</string>
</property>
</widget>
</item>
- <item row="2" column="1">
- <widget class="QCheckBox" name="shadowBuildCheckBox">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="buildDirLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Build directory:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
+ <item row="1" column="1">
<widget class="Utils::PathChooser" name="shadowBuildDirEdit" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -116,42 +68,12 @@
</property>
</widget>
</item>
- <item row="4" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="importLabel">
- <property name="text">
- <string>&lt;a href=&quot;import&quot;&gt;Import existing build&lt;/a&gt;</string>
- </property>
- <property name="textFormat">
- <enum>Qt::RichText</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="warningLabel">
- <property name="pixmap">
- <pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="problemLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>10</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>problemLabel</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
+ <item row="0" column="1">
+ <widget class="QCheckBox" name="shadowBuildCheckBox">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
</item>
</layout>
</widget>
diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.cpp b/src/plugins/qt4projectmanager/qt4projectmanager.cpp
index 60fb45588f..d7df4ae73f 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanager.cpp
+++ b/src/plugins/qt4projectmanager/qt4projectmanager.cpp
@@ -36,7 +36,6 @@
#include "qt4projectmanagerplugin.h"
#include "qt4nodes.h"
#include "qt4project.h"
-#include "qt4target.h"
#include "profileeditor.h"
#include "qmakestep.h"
#include "qt4buildconfiguration.h"
@@ -55,11 +54,11 @@
#include <projectexplorer/session.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
-#include <projectexplorer/toolchainmanager.h>
-#include <projectexplorer/toolchain.h>
+#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
#include <qtsupport/profilereader.h>
#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtversionmanager.h>
#include <QCoreApplication>
@@ -147,12 +146,6 @@ void Qt4Manager::init()
tr("Full path to the bin directory of the current project's Qt version."));
connect(vm, SIGNAL(variableUpdateRequested(QByteArray)),
this, SLOT(updateVariable(QByteArray)));
-
- QSettings *settings = Core::ICore::instance()->settings();
- settings->beginGroup(QLatin1String("Qt4ProjectManager"));
- m_unConfiguredVersionId = settings->value(QLatin1String("QtVersionId"), -1).toInt();
- m_unconfiguredToolChainId = settings->value(QLatin1String("ToolChainId"), QString()).toString();
- settings->endGroup();
}
void Qt4Manager::editorChanged(Core::IEditor *editor)
@@ -204,12 +197,10 @@ void Qt4Manager::updateVariable(const QByteArray &variable)
}
QString value;
const QtSupport::BaseQtVersion *qtv = 0;
- if (Qt4BaseTarget *t = qt4pro->activeTarget()) {
- if (Qt4BuildConfiguration *bc = t->activeQt4BuildConfiguration())
- qtv = bc->qtVersion();
- } else {
- qtv = unconfiguredSettings().version;
- }
+ if (ProjectExplorer::Target *t = qt4pro->activeTarget())
+ qtv = QtSupport::QtProfileInformation::qtVersion(t->profile());
+ else
+ qtv = QtSupport::QtProfileInformation::qtVersion(ProjectExplorer::ProfileManager::instance()->defaultProfile());
if (qtv)
value = qtv->versionInfo().value(QLatin1String("QT_INSTALL_BINS"));
@@ -382,11 +373,14 @@ void Qt4Manager::runQMake(ProjectExplorer::Project *p, ProjectExplorer::Node *no
!qt4pro->activeTarget()->activeBuildConfiguration())
return;
- Qt4BuildConfiguration *bc = qt4pro->activeTarget()->activeQt4BuildConfiguration();
- QMakeStep *qs = bc->qmakeStep();
+ Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(qt4pro->activeTarget()->activeBuildConfiguration());
+ if (!bc)
+ return;
+ QMakeStep *qs = bc->qmakeStep();
if (!qs)
return;
+
//found qmakeStep, now use it
qs->setForced(true);
@@ -429,7 +423,10 @@ void Qt4Manager::handleSubDirContextMenu(Qt4Manager::Action action, bool isFileB
if (!m_contextNode || !m_contextFile)
isFileBuild = false;
- Qt4BuildConfiguration *bc = qt4pro->activeTarget()->activeQt4BuildConfiguration();
+ Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(qt4pro->activeTarget()->activeBuildConfiguration());
+ if (!bc)
+ return;
+
if (m_contextNode != 0 && (m_contextNode != qt4pro->rootProjectNode() || isFileBuild))
if (Qt4ProFileNode *profile = qobject_cast<Qt4ProFileNode *>(m_contextNode))
bc->setSubNodeBuild(profile);
@@ -478,58 +475,3 @@ QString Qt4Manager::fileTypeId(ProjectExplorer::FileType type)
return QString();
}
-UnConfiguredSettings Qt4Manager::unconfiguredSettings() const
-{
- if (m_unConfiguredVersionId == -1 && m_unconfiguredToolChainId.isEmpty()) {
- // Choose a good default qtversion and try to find a toolchain that fit
- QtSupport::BaseQtVersion *version = 0;
- ProjectExplorer::ToolChain *toolChain = 0;
- QList<QtSupport::BaseQtVersion *> versions = QtSupport::QtVersionManager::instance()->validVersions();
- if (!versions.isEmpty()) {
- version = versions.first();
-
- foreach (ProjectExplorer::ToolChain *tc, ProjectExplorer::ToolChainManager::instance()->toolChains()) {
- if (tc->mkspecList().contains(version->mkspec())) {
- toolChain = tc;
- break;
- }
- }
- if (!toolChain) {
- foreach (ProjectExplorer::ToolChain *tc, ProjectExplorer::ToolChainManager::instance()->toolChains()) {
- if (version->qtAbis().contains(tc->targetAbi())) {
- toolChain = tc;
- break;
- }
- }
- }
- m_unConfiguredVersionId = version->uniqueId();
- if (toolChain)
- m_unconfiguredToolChainId = toolChain->id();
- }
- UnConfiguredSettings us;
- us.version = version;
- us.toolchain = toolChain;
- return us;
- }
- UnConfiguredSettings us;
- us.version = QtSupport::QtVersionManager::instance()->version(m_unConfiguredVersionId);
- us.toolchain = ProjectExplorer::ToolChainManager::instance()->findToolChain(m_unconfiguredToolChainId);
- return us;
-}
-
-void Qt4Manager::setUnconfiguredSettings(const UnConfiguredSettings &setting)
-{
- m_unConfiguredVersionId = setting.version ? setting.version->uniqueId() : -1;
- m_unconfiguredToolChainId = setting.toolchain ? setting.toolchain->id() : QString();
-
- QSettings *settings = Core::ICore::instance()->settings();
- settings->beginGroup(QLatin1String("Qt4ProjectManager"));
- settings->setValue(QLatin1String("QtVersionId"), m_unConfiguredVersionId);
- settings->setValue(QLatin1String("ToolChainId"), m_unconfiguredToolChainId);
- settings->endGroup();
-
- foreach (Qt4Project *pro, m_projects)
- if (pro->targets().isEmpty())
- pro->scheduleAsyncUpdate();
- emit unconfiguredSettingsChanged();
-}
diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.h b/src/plugins/qt4projectmanager/qt4projectmanager.h
index 32a12fa80c..d9ff3961bb 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanager.h
+++ b/src/plugins/qt4projectmanager/qt4projectmanager.h
@@ -38,13 +38,8 @@
#include <projectexplorer/iprojectmanager.h>
#include <projectexplorer/projectnodes.h>
-namespace Core {
- class IEditor;
-}
-
-namespace ExtensionSystem {
-class PluginManager;
-}
+namespace Core { class IEditor; }
+namespace ExtensionSystem { class PluginManager; }
namespace ProjectExplorer {
class Project;
@@ -64,14 +59,7 @@ namespace Internal {
class Qt4Builder;
class ProFileEditorWidget;
class Qt4ProjectManagerPlugin;
-
-class UnConfiguredSettings
-{
-public:
- QtSupport::BaseQtVersion *version;
- ProjectExplorer::ToolChain *toolchain;
-};
-}
+} // namespace Internal
class Qt4Project;
@@ -107,13 +95,6 @@ public:
enum Action { BUILD, REBUILD, CLEAN };
- /// Settings to use for codemodel if no targets exist
- Internal::UnConfiguredSettings unconfiguredSettings() const;
- void setUnconfiguredSettings(const Internal::UnConfiguredSettings &setting);
-
-signals:
- void unconfiguredSettingsChanged();
-
public slots:
void addLibrary();
void addLibraryContextMenu();
@@ -137,8 +118,6 @@ private:
void runQMake(ProjectExplorer::Project *p, ProjectExplorer::Node *node);
Internal::Qt4ProjectManagerPlugin *m_plugin;
- mutable int m_unConfiguredVersionId;
- mutable QString m_unconfiguredToolChainId;
ProjectExplorer::Node *m_contextNode;
ProjectExplorer::Project *m_contextProject;
ProjectExplorer::FileNode *m_contextFile;
diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.pro b/src/plugins/qt4projectmanager/qt4projectmanager.pro
index 2a13afdb98..158e8e001f 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanager.pro
+++ b/src/plugins/qt4projectmanager/qt4projectmanager.pro
@@ -6,6 +6,9 @@ include(../../qtcreatorplugin.pri)
include(qt4projectmanager_dependencies.pri)
HEADERS += \
+ qmakeprofileinformation.h \
+ qmakeprofileconfigwidget.h \
+ qmakerunconfigurationfactory.h \
qt4projectmanagerplugin.h \
qt4projectmanager.h \
qt4project.h \
@@ -36,6 +39,7 @@ HEADERS += \
wizards/filespage.h \
wizards/qtwizard.h \
wizards/targetsetuppage.h \
+ wizards/importwidget.h \
wizards/qtquickapp.h \
wizards/qtquickappwizard.h \
wizards/qtquickappwizardpages.h \
@@ -54,7 +58,6 @@ HEADERS += \
qtuicodemodelsupport.h \
externaleditors.h \
qt4buildconfiguration.h \
- qt4target.h \
qmakeparser.h \
addlibrarywizard.h \
librarydetailscontroller.h \
@@ -66,11 +69,13 @@ HEADERS += \
winceqtversionfactory.h \
winceqtversion.h \
profilecompletionassist.h \
- qt4basetargetfactory.h \
unconfiguredprojectpanel.h \
- unconfiguredsettingsoptionpage.h
-SOURCES += qt4projectmanagerplugin.cpp \
+SOURCES += \
+ qmakeprofileconfigwidget.cpp \
+ qmakeprofileinformation.cpp \
+ qmakerunconfigurationfactory.cpp \
+ qt4projectmanagerplugin.cpp \
qt4projectmanager.cpp \
qt4project.cpp \
qt4nodes.cpp \
@@ -100,6 +105,7 @@ SOURCES += qt4projectmanagerplugin.cpp \
wizards/filespage.cpp \
wizards/qtwizard.cpp \
wizards/targetsetuppage.cpp \
+ wizards/importwidget.cpp \
wizards/qtquickapp.cpp \
wizards/qtquickappwizard.cpp \
wizards/qtquickappwizardpages.cpp \
@@ -117,17 +123,16 @@ SOURCES += qt4projectmanagerplugin.cpp \
qtuicodemodelsupport.cpp \
externaleditors.cpp \
qt4buildconfiguration.cpp \
- qt4target.cpp \
qmakeparser.cpp \
addlibrarywizard.cpp \
librarydetailscontroller.cpp \
findqt4profiles.cpp \
profilekeywords.cpp \
+ qt4targetsetupwidget.cpp \
winceqtversionfactory.cpp \
winceqtversion.cpp \
profilecompletionassist.cpp \
unconfiguredprojectpanel.cpp \
- unconfiguredsettingsoptionpage.cpp
FORMS += makestep.ui \
qmakestep.ui \
diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.qbs b/src/plugins/qt4projectmanager/qt4projectmanager.qbs
index 3088252695..a14069fc25 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanager.qbs
+++ b/src/plugins/qt4projectmanager/qt4projectmanager.qbs
@@ -65,10 +65,15 @@ QtcPlugin {
"profilekeywords.h",
"qmakeparser.cpp",
"qmakeparser.h",
+ "qmakeprofileconfigwidget.cpp",
+ "qmakeprofileconfigwidget.h",
+ "qmakeprofileinformation.cpp",
+ "qmakeprofileinformation.h",
+ "qmakerunconfigurationfactory.cpp",
+ "qmakerunconfigurationfactory.h",
"qmakestep.cpp",
"qmakestep.h",
"qmakestep.ui",
- "qt4basetargetfactory.h",
"qt4buildconfiguration.cpp",
"qt4buildconfiguration.h",
"qt4nodes.h",
@@ -81,13 +86,12 @@ QtcPlugin {
"qt4projectmanagerconstants.h",
"qt4projectmanagerplugin.cpp",
"qt4projectmanagerplugin.h",
+ "qt4targetsetupwidget.cpp",
"qt4targetsetupwidget.h",
"qtmodulesinfo.cpp",
"qtmodulesinfo.h",
"qtuicodemodelsupport.cpp",
"qtuicodemodelsupport.h",
- "unconfiguredsettingsoptionpage.cpp",
- "unconfiguredsettingsoptionpage.h",
"unconfiguredprojectpanel.cpp",
"unconfiguredprojectpanel.h",
"winceqtversion.cpp",
@@ -99,8 +103,6 @@ QtcPlugin {
"qt4nodes.cpp",
"qt4projectmanager.cpp",
"qt4projectmanager.h",
- "qt4target.cpp",
- "qt4target.h",
"customwidgetwizard/classdefinition.ui",
"customwidgetwizard/customwidgetpluginwizardpage.ui",
"customwidgetwizard/customwidgetwidgetswizardpage.ui",
@@ -132,16 +134,8 @@ QtcPlugin {
"qt-desktop/desktopqtversion.h",
"qt-desktop/desktopqtversionfactory.cpp",
"qt-desktop/desktopqtversionfactory.h",
- "qt-desktop/qt4desktoptarget.cpp",
- "qt-desktop/qt4desktoptarget.h",
- "qt-desktop/qt4desktoptargetfactory.cpp",
- "qt-desktop/qt4desktoptargetfactory.h",
"qt-desktop/qt4runconfiguration.cpp",
"qt-desktop/qt4runconfiguration.h",
- "qt-desktop/qt4simulatortarget.cpp",
- "qt-desktop/qt4simulatortarget.h",
- "qt-desktop/qt4simulatortargetfactory.cpp",
- "qt-desktop/qt4simulatortargetfactory.h",
"qt-desktop/simulatorqtversion.cpp",
"qt-desktop/simulatorqtversion.h",
"qt-desktop/simulatorqtversionfactory.cpp",
@@ -155,10 +149,6 @@ QtcPlugin {
"qt-s60/gccetoolchain.h",
"qt-s60/passphraseforkeydialog.cpp",
"qt-s60/passphraseforkeydialog.h",
- "qt-s60/qt4symbiantarget.cpp",
- "qt-s60/qt4symbiantarget.h",
- "qt-s60/qt4symbiantargetfactory.cpp",
- "qt-s60/qt4symbiantargetfactory.h",
"qt-s60/rvctparser.cpp",
"qt-s60/rvctparser.h",
"qt-s60/rvcttoolchain.cpp",
@@ -201,6 +191,12 @@ QtcPlugin {
"qt-s60/s60symbiancertificate.h",
"qt-s60/sbsv2parser.cpp",
"qt-s60/sbsv2parser.h",
+ "qt-s60/symbianidevice.cpp",
+ "qt-s60/symbianidevice.h",
+ "qt-s60/symbianideviceconfigwidget.cpp",
+ "qt-s60/symbianideviceconfigwidget.h",
+ "qt-s60/symbianidevicefactory.cpp",
+ "qt-s60/symbianidevicefactory.h",
"qt-s60/symbianqtversion.cpp",
"qt-s60/symbianqtversion.h",
"qt-s60/symbianqtversionfactory.cpp",
@@ -289,6 +285,8 @@ 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",
diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h b/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h
index 3d6bc7c57e..d919a52fad 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h
+++ b/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h
@@ -75,15 +75,6 @@ const char PROFILE_EVALUATE[] = "Qt4ProjectManager.ProFileEvaluate";
// Project
const char QT4PROJECT_ID[] = "Qt4ProjectManager.Qt4Project";
-// Targets
-const char DESKTOP_TARGET_ID[] = "Qt4ProjectManager.Target.DesktopTarget";
-const char S60_DEVICE_TARGET_ID[] = "Qt4ProjectManager.Target.S60DeviceTarget";
-const char MAEMO5_DEVICE_TARGET_ID[] = "Qt4ProjectManager.Target.MaemoDeviceTarget";
-const char HARMATTAN_DEVICE_TARGET_ID[] = "Qt4ProjectManager.Target.HarmattanDeviceTarget";
-const char MEEGO_DEVICE_TARGET_ID[] = "Qt4ProjectManager.Target.MeegoDeviceTarget";
-const char QT_SIMULATOR_TARGET_ID[] = "Qt4ProjectManager.Target.QtSimulatorTarget";
-const char ANDROID_DEVICE_TARGET_ID[] = "Qt4ProjectManager.Target.AndroidDeviceTarget";
-
// Target Features
const char MOBILE_TARGETFEATURE_ID[] = "Qt4ProjectManager.TargetFeature.Mobile";
const char DESKTOP_TARGETFEATURE_ID[] = "Qt4ProjectManager.TargetFeature.Desktop";
@@ -104,10 +95,6 @@ const char QMAKEVAR_QMLJSDEBUGGER_PATH[] = "QMLJSDEBUGGER_PATH";
const char QMAKEVAR_DECLARATIVE_DEBUG4[] = "CONFIG+=declarative_debug";
const char QMAKEVAR_DECLARATIVE_DEBUG5[] = "CONFIG+=qml_debug";
-// Unconfigured Settings page
-const char UNCONFIGURED_SETTINGS_PAGE_ID[] = "R.UnconfiguredSettings";
-const char UNCONFIGURED_SETTINGS_PAGE_NAME[] = QT_TRANSLATE_NOOP("Qt4ProjectManager", "Unconfigured Project");
-
// Unconfigured Panel
const char UNCONFIGURED_PANEL_PAGE_ID[] = "UnconfiguredPanel";
diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
index 192de942e5..d414ad0047 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
+++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
@@ -36,7 +36,6 @@
#include "qt4nodes.h"
#include "qmakestep.h"
#include "makestep.h"
-#include "qt4target.h"
#include "qt4buildconfiguration.h"
#include "wizards/consoleappwizard.h"
#include "wizards/guiappwizard.h"
@@ -56,14 +55,12 @@
#include "externaleditors.h"
#include "profilecompletionassist.h"
#include "qt-s60/s60manager.h"
-#include "qt-desktop/qt4desktoptargetfactory.h"
-#include "qt-desktop/qt4simulatortargetfactory.h"
#include "qt-desktop/qt4runconfiguration.h"
#include "qt-desktop/desktopqtversionfactory.h"
#include "qt-desktop/simulatorqtversionfactory.h"
#include "winceqtversionfactory.h"
#include "unconfiguredprojectpanel.h"
-#include "unconfiguredsettingsoptionpage.h"
+#include "qmakeprofileinformation.h"
#include <coreplugin/id.h>
#include <coreplugin/icore.h>
@@ -71,9 +68,11 @@
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/project.h>
#include <projectexplorer/session.h>
+#include <projectexplorer/profilemanager.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectnodes.h>
+#include <projectexplorer/target.h>
#include <coreplugin/mimedatabase.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
@@ -133,6 +132,9 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
| TextEditor::TextEditorActionHandler::JumpToFileUnderCursor);
m_proFileEditorFactory = new ProFileEditorFactory(m_qt4ProjectManager, editorHandler);
+
+ ProjectExplorer::ProfileManager::instance()->registerProfileInformation(new QmakeProfileInformation);
+
addObject(m_proFileEditorFactory);
addAutoReleasedObject(new EmptyProjectWizard);
@@ -151,8 +153,8 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
addAutoReleasedObject(new QMakeStepFactory);
addAutoReleasedObject(new MakeStepFactory);
+ addAutoReleasedObject(new Qt4BuildConfigurationFactory);
addAutoReleasedObject(new Qt4RunConfigurationFactory);
- addAutoReleasedObject(new UnConfiguredSettingsOptionPage);
#ifdef Q_OS_MAC
addAutoReleasedObject(new MacDesignerExternalEditor);
@@ -163,9 +165,6 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
addAutoReleasedObject(new S60Manager);
- addAutoReleasedObject(new Qt4DesktopTargetFactory);
- addAutoReleasedObject(new Qt4SimulatorTargetFactory);
-
addAutoReleasedObject(new DesktopQtVersionFactory);
addAutoReleasedObject(new SimulatorQtVersionFactory);
addAutoReleasedObject(new WinCeQtVersionFactory);
@@ -308,15 +307,10 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
return true;
}
-bool Qt4ProjectManagerPlugin::delayedInitialize()
-{
- S60Manager::instance()->delayedInitialize();
- return true;
-}
-
void Qt4ProjectManagerPlugin::extensionsInitialized()
{
m_qt4ProjectManager->init();
+ S60Manager::instance()->extensionsInitialize();
}
void Qt4ProjectManagerPlugin::startupProjectChanged()
@@ -391,7 +385,7 @@ void Qt4ProjectManagerPlugin::updateContextActions(ProjectExplorer::Node *node,
m_buildFileAction->setParameter(buildFilePossible ? QFileInfo(fileNode->path()).fileName() : QString());
Qt4BuildConfiguration *buildConfiguration = (qt4Project && qt4Project->activeTarget()) ?
- qt4Project->activeTarget()->activeQt4BuildConfiguration() : 0;
+ qobject_cast<Qt4BuildConfiguration *>(qt4Project->activeTarget()->activeBuildConfiguration()) : 0;
bool isProjectNode = qt4Project && proFileNode && buildConfiguration;
bool isBuilding = m_projectExplorer->buildManager()->isBuilding(project);
bool enabled = subProjectActionsVisible && !isBuilding;
diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
index f01806f98b..9cb066d8bb 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
+++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
@@ -41,9 +41,11 @@ class QAction;
QT_END_NAMESPACE
namespace ProjectExplorer {
- class Project;
- class Node;
- class ProjectExplorerPlugin;
+class Node;
+class Project;
+class ProjectExplorerPlugin;
+class ProfileInformation;
+class Target;
}
namespace Utils { class ParameterAction; }
@@ -52,7 +54,6 @@ namespace Qt4ProjectManager {
class Qt4Manager;
class QtVersionManager;
class Qt4Project;
-class Qt4BaseTarget;
namespace Internal {
@@ -67,7 +68,6 @@ public:
Qt4ProjectManagerPlugin();
~Qt4ProjectManagerPlugin();
bool initialize(const QStringList &arguments, QString *errorMessage);
- bool delayedInitialize();
void extensionsInitialized();
private slots:
@@ -93,7 +93,7 @@ private:
ProFileEditorFactory *m_proFileEditorFactory;
Qt4Manager *m_qt4ProjectManager;
Qt4Project *m_previousStartupProject;
- Qt4BaseTarget *m_previousTarget;
+ ProjectExplorer::Target *m_previousTarget;
QAction *m_runQMakeAction;
QAction *m_runQMakeActionContextMenu;
diff --git a/src/plugins/qt4projectmanager/qt4target.cpp b/src/plugins/qt4projectmanager/qt4target.cpp
deleted file mode 100644
index 879c1bbe9c..0000000000
--- a/src/plugins/qt4projectmanager/qt4target.cpp
+++ /dev/null
@@ -1,1493 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "qt4target.h"
-#include "buildconfigurationinfo.h"
-
-#include "makestep.h"
-#include "qmakestep.h"
-#include "qt4project.h"
-#include "qt4basetargetfactory.h"
-#include "qt4nodes.h"
-#include "qt4projectconfigwidget.h"
-#include "qt4projectmanagerconstants.h"
-#include "qt4buildconfiguration.h"
-
-#include <coreplugin/icore.h>
-#include <coreplugin/featureprovider.h>
-#include <extensionsystem/pluginmanager.h>
-#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/runconfiguration.h>
-#include <projectexplorer/toolchainmanager.h>
-#include <projectexplorer/toolchain.h>
-#include <projectexplorer/projectexplorerconstants.h>
-#include <projectexplorer/task.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
-#include <qtsupport/qtversionfactory.h>
-#include <qtsupport/baseqtversion.h>
-#include <qtsupport/qtversionmanager.h>
-#include <utils/pathchooser.h>
-#include <utils/detailswidget.h>
-#include <utils/qtcprocess.h>
-
-#include <QCoreApplication>
-#include <QPushButton>
-#include <QMessageBox>
-#include <QCheckBox>
-#include <QComboBox>
-#include <QHBoxLayout>
-#include <QLabel>
-#include <QMainWindow>
-#include <QVBoxLayout>
-
-#include <algorithm>
-#include <set>
-
-using namespace Qt4ProjectManager;
-using namespace Qt4ProjectManager::Internal;
-
-// -------------------------------------------------------------------------
-// Qt4BaseTargetFactory
-// -------------------------------------------------------------------------
-
-Qt4BaseTargetFactory::Qt4BaseTargetFactory(QObject *parent) :
- ITargetFactory(parent)
-{
-
-}
-
-Qt4BaseTargetFactory::~Qt4BaseTargetFactory()
-{
-
-}
-
-Qt4TargetSetupWidget *Qt4BaseTargetFactory::createTargetSetupWidget(const Core::Id id,
- const QString &proFilePath,
- const QtSupport::QtVersionNumber &minimumQtVersion,
- const QtSupport::QtVersionNumber &maximumQtVersion,
- const Core::FeatureSet &requiredFeatures,
- bool importEnabled,
- QList<BuildConfigurationInfo> importInfos)
-{
- QList<BuildConfigurationInfo> infos = this->availableBuildConfigurations(id,
- proFilePath,
- minimumQtVersion,
- maximumQtVersion,
- requiredFeatures);
- if (infos.isEmpty() && importInfos.isEmpty())
- return 0;
- const bool supportsShadowBuilds
- = targetFeatures(id).contains(QLatin1String(Constants::SHADOWBUILD_TARGETFEATURE_ID));
- Qt4DefaultTargetSetupWidget *widget
- = new Qt4DefaultTargetSetupWidget(this, id, proFilePath, infos,
- minimumQtVersion, maximumQtVersion, requiredFeatures,
- importEnabled && supportsShadowBuilds, importInfos,
- (supportsShadowBuilds
- ? Qt4DefaultTargetSetupWidget::ENABLE
- : Qt4DefaultTargetSetupWidget::DISABLE));
- return widget;
-}
-
-ProjectExplorer::Target *Qt4BaseTargetFactory::create(ProjectExplorer::Project *parent, const Core::Id id, Qt4TargetSetupWidget *widget)
-{
- if (!widget->isTargetSelected())
- return 0;
- Q_ASSERT(qobject_cast<Qt4DefaultTargetSetupWidget *>(widget));
- Qt4DefaultTargetSetupWidget *w = static_cast<Qt4DefaultTargetSetupWidget *>(widget);
- w->storeSettings();
- return create(parent, id, w->buildConfigurationInfos());
-}
-
-QList<BuildConfigurationInfo> Qt4BaseTargetFactory::availableBuildConfigurations(const Core::Id id, const QString &proFilePath,
- const QtSupport::QtVersionNumber &minimumQtVersion,
- const QtSupport::QtVersionNumber &maximumQtVersion,
- const Core::FeatureSet &requiredFeatures)
-{
- QList<BuildConfigurationInfo> infoList;
- QList<QtSupport::BaseQtVersion *> knownVersions
- = QtSupport::QtVersionManager::instance()->versionsForTargetId(id, minimumQtVersion, maximumQtVersion);
-
- foreach (QtSupport::BaseQtVersion *version, knownVersions) {
- if (!version->isValid() || !version->toolChainAvailable(id))
- continue;
- QtSupport::BaseQtVersion::QmakeBuildConfigs config = version->defaultBuildConfig();
- BuildConfigurationInfo info = BuildConfigurationInfo(version->uniqueId(), config, QString(), QString(), false);
- info.directory = shadowBuildDirectory(proFilePath, id, msgBuildConfigurationName(info));
- infoList.append(info);
-
- info.buildConfig = config ^ QtSupport::BaseQtVersion::DebugBuild;
- info.directory = shadowBuildDirectory(proFilePath, id, msgBuildConfigurationName(info));
- infoList.append(info);
- }
-
- infoList = BuildConfigurationInfo::filterBuildConfigurationInfos(infoList, requiredFeatures);
-
- return infoList;
-}
-
-QString sanitize(const QString &input)
-{
- QString result;
- result.reserve(input.size());
- foreach (const QChar &qc, input) {
- const char c = qc.toLatin1();
- if ((c >= 'a' && c <='z')
- || (c >= 'A' && c <= 'Z')
- || (c >= '0' && c <= '9')
- || c == '-'
- || c == '_')
- result.append(qc);
- else
- result.append(QLatin1Char('_'));
- }
- return result;
-}
-
-QString projectDirectory(const QString &proFile)
-{
- if (proFile.isEmpty())
- return QString();
- QFileInfo info(proFile);
- return info.absoluteDir().path();
-}
-
-QString Qt4BaseTargetFactory::shadowBuildDirectory(const QString &profilePath, const Core::Id id, const QString &suffix)
-{
- if (profilePath.isEmpty())
- return QString();
- QFileInfo info(profilePath);
-
- QString base = QDir::cleanPath(projectDirectory(profilePath) + QLatin1String("/../") + info.baseName() + QLatin1String("-build-"));
- return base + buildNameForId(id) + QLatin1String("-") + sanitize(suffix);
-}
-
-QString Qt4BaseTargetFactory::buildNameForId(Core::Id id) const
-{
- Q_UNUSED(id);
- return QString();
-}
-
-Qt4BaseTargetFactory *Qt4BaseTargetFactory::qt4BaseTargetFactoryForId(const Core::Id id)
-{
- QList<Qt4BaseTargetFactory *> factories = ExtensionSystem::PluginManager::getObjects<Qt4BaseTargetFactory>();
- foreach (Qt4BaseTargetFactory *fac, factories) {
- if (fac->supportsTargetId(id))
- return fac;
- }
- return 0;
-}
-
-QList<Qt4BaseTargetFactory *> Qt4BaseTargetFactory::qt4BaseTargetFactoriesForIds(const QList<Core::Id> &ids)
-{
- QList<Qt4BaseTargetFactory *> factories;
- foreach (Core::Id id, ids)
- if (Qt4BaseTargetFactory *factory = qt4BaseTargetFactoryForId(id))
- factories << factory;
-
- qSort(factories);
- factories.erase(std::unique(factories.begin(), factories.end()), factories.end());
- return factories;
-}
-
-// Return name of a build configuration.
-QString Qt4BaseTargetFactory::msgBuildConfigurationName(const BuildConfigurationInfo &info)
-{
- const QString qtVersionName = info.version()->displayName();
- return (info.buildConfig & QtSupport::BaseQtVersion::DebugBuild) ?
- //: Name of a debug build configuration to created by a project wizard, %1 being the Qt version name. We recommend not translating it.
- tr("%1 Debug").arg(qtVersionName) :
- //: Name of a release build configuration to be created by a project wizard, %1 being the Qt version name. We recommend not translating it.
- tr("%1 Release").arg(qtVersionName);
-}
-
-QList<ProjectExplorer::Task> Qt4BaseTargetFactory::reportIssues(const QString &proFile)
-{
- Q_UNUSED(proFile);
- return QList<ProjectExplorer::Task>();
-}
-
-bool Qt4BaseTargetFactory::selectByDefault(const Core::Id id) const
-{
- Q_UNUSED(id);
- return true;
-}
-
-// -------------------------------------------------------------------------
-// Qt4BaseTarget
-// -------------------------------------------------------------------------
-
-Qt4BaseTarget::Qt4BaseTarget(Qt4Project *parent, const Core::Id id) :
- ProjectExplorer::Target(parent, id)
-{
- connect(this, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
- this, SLOT(emitProFileEvaluateNeeded()));
- connect(this, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
- this, SIGNAL(environmentChanged()));
- connect(this, SIGNAL(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
- this, SLOT(onAddedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
-}
-
-Qt4BaseTarget::~Qt4BaseTarget()
-{
-}
-
-ProjectExplorer::BuildConfigWidget *Qt4BaseTarget::createConfigWidget()
-{
- return new Qt4ProjectConfigWidget(this);
-}
-
-Qt4BuildConfiguration *Qt4BaseTarget::activeQt4BuildConfiguration() const
-{
- return static_cast<Qt4BuildConfiguration *>(Target::activeBuildConfiguration());
-}
-
-Qt4Project *Qt4BaseTarget::qt4Project() const
-{
- return static_cast<Qt4Project *>(project());
-}
-
-QList<ProjectExplorer::ToolChain *> Qt4BaseTarget::possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const
-{
- QList<ProjectExplorer::ToolChain *> tmp;
- QList<ProjectExplorer::ToolChain *> result;
-
- Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(bc);
- if (!qt4bc || !qt4bc->qtVersion())
- return tmp;
-
- QList<Qt4ProFileNode *> profiles = qt4Project()->allProFiles();
- bool qtUsed = false;
- foreach (Qt4ProFileNode *pro, profiles) {
- if (pro->variableValue(ConfigVar).contains(QLatin1String("qt")) && !pro->variableValue(QtVar).isEmpty()) {
- qtUsed = true;
- break;
- }
- }
-
- if (!qtUsed || !qt4bc->qtVersion()->isValid())
- return ProjectExplorer::ToolChainManager::instance()->toolChains();
-
- QList<ProjectExplorer::Abi> abiList = qt4bc->qtVersion()->qtAbis();
- foreach (const ProjectExplorer::Abi &abi, abiList)
- tmp.append(ProjectExplorer::ToolChainManager::instance()->findToolChains(abi));
-
- foreach (ProjectExplorer::ToolChain *tc, tmp) {
- if (result.contains(tc))
- continue;
- if (tc->restrictedToTargets().isEmpty() || tc->restrictedToTargets().contains(id()))
- result.append(tc);
- }
- return result;
-}
-
-ProjectExplorer::ToolChain *Qt4BaseTarget::preferredToolChain(ProjectExplorer::BuildConfiguration *bc) const
-{
- Qt4BuildConfiguration *qtBc = qobject_cast<Qt4BuildConfiguration *>(bc);
- if (!qtBc || !qtBc->qtVersion())
- return Target::preferredToolChain(bc);
-
- QList<ProjectExplorer::ToolChain *> tcs = possibleToolChains(bc);
- const Utils::FileName mkspec = qtBc->qtVersion()->mkspec();
- foreach (ProjectExplorer::ToolChain *tc, tcs)
- if (tc->mkspecList().contains(mkspec))
- return tc;
- return tcs.isEmpty() ? 0 : tcs.at(0);
-}
-
-Utils::FileName Qt4BaseTarget::mkspec(const Qt4BuildConfiguration *bc) const
-{
- QtSupport::BaseQtVersion *version = bc->qtVersion();
- // We do not know which abi the Qt version has, so let's stick with the defaults
- if (version && version->qtAbis().count() == 1 && version->qtAbis().first().isNull())
- return Utils::FileName();
-
- const QList<Utils::FileName> tcSpecList
- = bc->toolChain() ? bc->toolChain()->mkspecList() : QList<Utils::FileName>();
- if (!version)
- return Utils::FileName(); // No Qt version, so no qmake either...
- foreach (const Utils::FileName &tcSpec, tcSpecList) {
- if (version->hasMkspec(tcSpec))
- return tcSpec;
- }
- return version->mkspec();
-}
-
-void Qt4BaseTarget::removeUnconfiguredCustomExectutableRunConfigurations()
-{
- if (runConfigurations().count()) {
- // Remove all run configurations which the new project wizard created
- QList<ProjectExplorer::RunConfiguration*> toRemove;
- foreach (ProjectExplorer::RunConfiguration * rc, runConfigurations()) {
- QtSupport::CustomExecutableRunConfiguration *cerc
- = qobject_cast<QtSupport::CustomExecutableRunConfiguration *>(rc);
- if (cerc && !cerc->isConfigured())
- toRemove.append(rc);
- }
- foreach (ProjectExplorer::RunConfiguration *rc, toRemove)
- removeRunConfiguration(rc);
- }
-}
-
-Qt4BuildConfiguration *Qt4BaseTarget::addQt4BuildConfiguration(QString defaultDisplayName,
- QString displayName, QtSupport::BaseQtVersion *qtversion,
- QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
- QString additionalArguments,
- QString directory,
- bool importing)
-{
- Q_ASSERT(qtversion);
- bool debug = qmakeBuildConfiguration & QtSupport::BaseQtVersion::DebugBuild;
-
- // Add the buildconfiguration
- Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(this);
- 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));
- Q_ASSERT(buildSteps);
- Q_ASSERT(cleanSteps);
-
- QMakeStep *qmakeStep = new QMakeStep(buildSteps);
- buildSteps->insertStep(0, qmakeStep);
-
- MakeStep *makeStep = new MakeStep(buildSteps);
- buildSteps->insertStep(1, makeStep);
-
- MakeStep* cleanStep = new MakeStep(cleanSteps);
- cleanStep->setClean(true);
- cleanStep->setUserArguments(QLatin1String("clean"));
- cleanSteps->insertStep(0, cleanStep);
-
- bool enableQmlDebugger
- = Qt4BuildConfiguration::removeQMLInspectorFromArguments(&additionalArguments);
- if (!additionalArguments.isEmpty())
- qmakeStep->setUserArguments(additionalArguments);
- if (importing)
- qmakeStep->setLinkQmlDebuggingLibrary(enableQmlDebugger);
-
- // set some options for qmake and make
- if (qmakeBuildConfiguration & QtSupport::BaseQtVersion::BuildAll) // debug_and_release => explicit targets
- makeStep->setUserArguments(debug ? QLatin1String("debug") : QLatin1String("release"));
-
- bc->setQMakeBuildConfiguration(qmakeBuildConfiguration);
-
- // Finally set the qt version & tool chain
- bc->setQtVersion(qtversion);
- if (!directory.isEmpty())
- bc->setShadowBuildAndDirectory(directory != project()->projectDirectory(), directory);
-
- addBuildConfiguration(bc);
-
- Utils::FileName extractedMkspec
- = Qt4BuildConfiguration::extractSpecFromArguments(&additionalArguments,
- directory, qtversion);
- // Find a good tool chain for the mkspec we extracted from the build (rely on default behavior
- // if no -spec argument was given or it is the default).
- if (!extractedMkspec.isEmpty()
- && extractedMkspec != Utils::FileName::fromString(QLatin1String("default"))
- && extractedMkspec != qtversion->mkspec()) {
- QList<ProjectExplorer::ToolChain *> tcList = bc->target()->possibleToolChains(bc);
- foreach (ProjectExplorer::ToolChain *tc, tcList) {
- if (tc->mkspecList().contains(extractedMkspec)) {
- bc->setToolChain(tc);
- qmakeStep->setUserArguments(additionalArguments); // remove unnecessary -spec
- }
- }
- }
-
- return bc;
-}
-
-void Qt4BaseTarget::onAddedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc)
-{
- Q_ASSERT(bc);
- Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(bc);
- Q_ASSERT(qt4bc);
- connect(qt4bc, SIGNAL(buildDirectoryInitialized()),
- this, SIGNAL(buildDirectoryInitialized()));
- connect(qt4bc, SIGNAL(proFileEvaluateNeeded(Qt4ProjectManager::Qt4BuildConfiguration*)),
- this, SLOT(onProFileEvaluateNeeded(Qt4ProjectManager::Qt4BuildConfiguration*)));
-}
-
-void Qt4BaseTarget::onProFileEvaluateNeeded(Qt4ProjectManager::Qt4BuildConfiguration *bc)
-{
- if (bc && bc == activeBuildConfiguration())
- emit proFileEvaluateNeeded(this);
-}
-
-void Qt4BaseTarget::emitProFileEvaluateNeeded()
-{
- emit proFileEvaluateNeeded(this);
-}
-
-// -------------------------------------------------------------------------
-// Qt4TargetSetupWidget
-// -------------------------------------------------------------------------
-
-Qt4TargetSetupWidget::Qt4TargetSetupWidget(QWidget *parent)
- : QWidget(parent)
-{
-
-}
-
-Qt4TargetSetupWidget::~Qt4TargetSetupWidget()
-{
-
-}
-
-// -------------------------------------------------------------------------
-// Qt4DefaultTargetSetupWidget
-// -------------------------------------------------------------------------
-
-QString issuesListToString(const QList<ProjectExplorer::Task> &issues)
-{
- QStringList lines;
- foreach (const ProjectExplorer::Task &t, issues) {
- // set severity:
- QString severity;
- if (t.type == ProjectExplorer::Task::Error)
- severity = QCoreApplication::translate("Qt4DefaultTargetSetupWidget", "<b>Error:</b> ", "Severity is Task::Error");
- else if (t.type == ProjectExplorer::Task::Warning)
- severity = QCoreApplication::translate("Qt4DefaultTargetSetupWidget", "<b>Warning:</b> ", "Severity is Task::Warning");
- lines.append(severity + t.description);
- }
- return lines.join(QLatin1String("<br>"));
-}
-
-Qt4DefaultTargetSetupWidget::Qt4DefaultTargetSetupWidget(Qt4BaseTargetFactory *factory,
- Core::Id id,
- const QString &proFilePath,
- const QList<BuildConfigurationInfo> &infos,
- const QtSupport::QtVersionNumber &minimumQtVersion,
- const QtSupport::QtVersionNumber &maximumQtVersion,
- const Core::FeatureSet &requiredFeatures,
- bool importEnabled,
- const QList<BuildConfigurationInfo> &importInfos,
- ShadowBuildOption shadowBuild)
- : Qt4TargetSetupWidget(),
- m_id(id),
- m_factory(factory),
- m_proFilePath(proFilePath),
- m_minimumQtVersion(minimumQtVersion),
- m_maximumQtVersion(maximumQtVersion),
- m_requiredFeatures(requiredFeatures),
- m_importInfos(importInfos),
- m_directoriesEnabled(true),
- m_hasInSourceBuild(false),
- m_ignoreChange(false),
- m_showImport(importEnabled),
- m_buildConfigurationTemplateUnchanged(true),
- m_shadowBuildCheckBoxVisible(false),
- m_selected(0)
-{
- QSettings *s = Core::ICore::settings();
- QString sourceDir = QFileInfo(m_proFilePath).absolutePath();
-
- setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
- QVBoxLayout *vboxLayout = new QVBoxLayout();
- setLayout(vboxLayout);
- vboxLayout->setContentsMargins(0, 0, 0, 0);
- m_detailsWidget = new Utils::DetailsWidget(this);
- m_detailsWidget->setUseCheckBox(true);
- m_detailsWidget->setSummaryText(factory->displayNameForId(id));
- m_detailsWidget->setChecked(false);
- m_detailsWidget->setSummaryFontBold(true);
- m_detailsWidget->setIcon(factory->iconForId(id));
- m_detailsWidget->setAdditionalSummaryText(issuesListToString(factory->reportIssues(m_proFilePath)));
- vboxLayout->addWidget(m_detailsWidget);
-
- QWidget *widget = new QWidget;
- QVBoxLayout *layout = new QVBoxLayout;
- widget->setLayout(layout);
- layout->setContentsMargins(0, 0, 0, 0);
-
- QWidget *w = new QWidget;
- m_importLayout = new QGridLayout;
- m_importLayout->setMargin(0);
- w->setLayout(m_importLayout);
- layout->addWidget(w);
-
- w = new QWidget;
- m_importLineLayout = new QHBoxLayout();
- m_importLineLayout->setContentsMargins(0, 0, 0, 0);
- w->setLayout(m_importLineLayout);
- m_importLineLabel = new QLabel();
- m_importLineLabel->setText(tr("Add build from:"));
- m_importLineLayout->addWidget(m_importLineLabel);
-
- m_importLinePath = new Utils::PathChooser();
- m_importLinePath->setExpectedKind(Utils::PathChooser::ExistingDirectory);
- m_importLinePath->setPath(sourceDir);
- m_importLinePath->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- m_importLineLayout->addWidget(m_importLinePath);
-
- m_importLineButton = new QPushButton;
- m_importLineButton->setText(tr("Add Build"));
- m_importLineButton->setAttribute(Qt::WA_MacSmallSize);
- // make it in line with import path chooser button on mac
- m_importLineButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
- m_importLineLayout->addWidget(m_importLineButton);
- m_importLineStretch = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed);
- m_importLineLayout->addSpacerItem(m_importLineStretch);
- m_importLinePath->installEventFilter(this);
- layout->addWidget(w);
-
- m_importLineLabel->setVisible(false);
- m_importLinePath->setVisible(false);
- m_importLineButton->setVisible(m_showImport);
-
- m_buildConfigurationLabel = new QLabel;
- m_buildConfigurationLabel->setText(tr("Create build configurations:"));
- m_buildConfigurationLabel->setVisible(false);
-
- m_buildConfigurationComboBox = new QComboBox;
- m_buildConfigurationComboBox->addItem(tr("For Each Qt Version One Debug And One Release"), PERQT);
- m_buildConfigurationComboBox->addItem(tr("For One Qt Version One Debug And One Release"), ONEQT);
- m_buildConfigurationComboBox->addItem(tr("Manually"), MANUALLY);
- m_buildConfigurationComboBox->addItem(tr("None"), NONE);
-
- if (m_importInfos.isEmpty())
- m_buildConfigurationComboBox->setCurrentIndex(s->value(QLatin1String("Qt4ProjectManager.TargetSetupPage.BuildTemplate"), 0).toInt());
- else
- m_buildConfigurationComboBox->setCurrentIndex(3); // NONE
-
- m_buildConfigurationComboBox->setVisible(false);
-
- QHBoxLayout *hbox = new QHBoxLayout();
- hbox->addWidget(m_buildConfigurationLabel);
- hbox->addWidget(m_buildConfigurationComboBox);
- hbox->addStretch();
- layout->addLayout(hbox);
-
- m_shadowBuildEnabled = new QCheckBox;
- m_shadowBuildEnabled->setText(tr("Shadow build"));
- m_shadowBuildCheckBoxVisible = shadowBuild == USER;
-
- layout->addWidget(m_shadowBuildEnabled);
- m_shadowBuildEnabled->setVisible(m_shadowBuildCheckBoxVisible);
-
- m_versionLabel = new QLabel;
- m_versionLabel->setText(tr("Qt version:"));
- m_versionLabel->setVisible(false);
- m_versionComboBox = new QComboBox;
- m_versionComboBox->setVisible(false);
- hbox = new QHBoxLayout();
- hbox->addWidget(m_versionLabel);
- hbox->addWidget(m_versionComboBox);
- hbox->addStretch();
- layout->addLayout(hbox);
-
- w = new QWidget;
- m_newBuildsLayout = new QGridLayout;
- m_newBuildsLayout->setMargin(0);
-#ifdef Q_OS_MAC
- m_newBuildsLayout->setSpacing(0);
-#endif
- w->setLayout(m_newBuildsLayout);
- layout->addWidget(w);
-
- widget->setEnabled(false);
- m_detailsWidget->setWidget(widget);
-
- for (int i = 0; i < m_importInfos.size(); ++i) {
- if (m_importInfos.at(i).directory == sourceDir)
- m_hasInSourceBuild = true;
- m_importEnabled << true;
- }
-
- if (m_hasInSourceBuild || shadowBuild == DISABLE) {
- m_shadowBuildEnabled->setChecked(false);
- m_directoriesEnabled = false;
- } else if (shadowBuild == ENABLE) {
- m_shadowBuildEnabled->setChecked(true);
- m_directoriesEnabled = true;
- } else {
- m_directoriesEnabled = s->value(QLatin1String("Qt4ProjectManager.TargetSetupPage.ShadowBuilding"), true).toBool();
- m_shadowBuildEnabled->setChecked(m_directoriesEnabled);
- }
-
- m_selected += m_importInfos.size();
-
- setupImportWidgets();
-
- setBuildConfigurationInfos(infos, false);
-
- int qtVersionId = s->value(QLatin1String("Qt4ProjectManager.TargetSetupPage.QtVersionId"), -1).toInt();
- int index = m_versionComboBox->findData(qtVersionId);
- if (index != -1)
- m_versionComboBox->setCurrentIndex(index);
- updateOneQtVisible();
-
- if (!m_importInfos.isEmpty())
- m_detailsWidget->setState(Utils::DetailsWidget::Expanded);
-
- connect(m_importLineButton, SIGNAL(clicked()),
- this, SLOT(addImportClicked()));
-
- connect(m_detailsWidget, SIGNAL(checked(bool)),
- this, SLOT(targetCheckBoxToggled(bool)));
- connect(m_shadowBuildEnabled, SIGNAL(toggled(bool)),
- this, SLOT(shadowBuildingToggled()));
- connect(m_buildConfigurationComboBox, SIGNAL(currentIndexChanged(int)),
- this, SLOT(buildConfigurationComboBoxChanged()));
- connect(m_versionComboBox, SIGNAL(currentIndexChanged(int)),
- this, SLOT(updateOneQtVisible()));
-}
-
-Qt4DefaultTargetSetupWidget::~Qt4DefaultTargetSetupWidget()
-{
-
-}
-
-bool Qt4DefaultTargetSetupWidget::isTargetSelected() const
-{
- if (!m_detailsWidget->isChecked())
- return false;
-
- return !buildConfigurationInfos().isEmpty();
-}
-
-void Qt4DefaultTargetSetupWidget::setTargetSelected(bool b)
-{
- // Only check target if there are build configurations possible
- b &= !buildConfigurationInfos().isEmpty();
- m_ignoreChange = true;
- m_detailsWidget->setChecked(b);
- m_detailsWidget->widget()->setEnabled(b);
- m_ignoreChange = false;
- // We want the shadow build option to be visible
- if (b && (m_shadowBuildEnabled->isVisibleTo(m_shadowBuildEnabled->parentWidget())
- || m_buildConfigurationComboBox->isVisibleTo(m_buildConfigurationComboBox->parentWidget())))
- m_detailsWidget->setState(Utils::DetailsWidget::Expanded);
-}
-
-void Qt4DefaultTargetSetupWidget::updateBuildConfigurationInfos(const QList<BuildConfigurationInfo> &infos)
-{
- setBuildConfigurationInfos(infos, false);
-}
-
-void Qt4DefaultTargetSetupWidget::targetCheckBoxToggled(bool b)
-{
- if (m_ignoreChange)
- return;
- m_detailsWidget->widget()->setEnabled(b);
- if (b) {
- foreach (bool error, m_issues) {
- if (error) {
- m_detailsWidget->setState(Utils::DetailsWidget::Expanded);
- break;
- }
- }
- }
- emit selectedToggled();
-}
-
-QString Qt4DefaultTargetSetupWidget::displayNameFrom(const BuildConfigurationInfo &info)
-{
- QString buildType;
- if ((info.buildConfig & QtSupport::BaseQtVersion::BuildAll) == 0) {
- if (info.buildConfig & QtSupport::BaseQtVersion::DebugBuild)
- //: Debug build
- buildType = tr("debug");
- else
- //: release build
- buildType = tr("release");
- }
- return info.version()->displayName() + QLatin1Char(' ') + buildType;
-}
-
-void Qt4DefaultTargetSetupWidget::setProFilePath(const QString &proFilePath)
-{
- m_proFilePath = proFilePath;
- m_detailsWidget->setAdditionalSummaryText(issuesListToString(m_factory->reportIssues(m_proFilePath)));
- setBuildConfigurationInfos(m_factory->availableBuildConfigurations(m_id,
- proFilePath,
- m_minimumQtVersion,
- m_maximumQtVersion,
- m_requiredFeatures),
- true);
-}
-
-void Qt4DefaultTargetSetupWidget::setBuildConfiguraionComboBoxVisible(bool b)
-{
- m_buildConfigurationLabel->setVisible(b);
- m_buildConfigurationComboBox->setVisible(b);
- updateWidgetVisibility();
-}
-
-
-Qt4DefaultTargetSetupWidget::BuildConfigurationTemplate Qt4DefaultTargetSetupWidget::buildConfigurationTemplate() const
-{
- if (!m_buildConfigurationComboBox->isVisibleTo(m_buildConfigurationComboBox->parentWidget()))
- return MANUALLY; // the default
- return static_cast<BuildConfigurationTemplate>(m_buildConfigurationComboBox->itemData(m_buildConfigurationComboBox->currentIndex()).toInt());
-}
-
-void Qt4DefaultTargetSetupWidget::setBuildConfigurationTemplate(Qt4DefaultTargetSetupWidget::BuildConfigurationTemplate value)
-{
- int index = m_buildConfigurationComboBox->findData(QVariant::fromValue(int(value)));
- m_buildConfigurationComboBox->setCurrentIndex(index);
-}
-
-void Qt4DefaultTargetSetupWidget::storeSettings() const
-{
- bool importing = false;
- for (int i=0; i < m_importEnabled.size(); ++i) {
- if (m_importEnabled.at(i)) {
- importing = true;
- break;
- }
- }
-
- QSettings *s = Core::ICore::settings();
- s->setValue(QLatin1String("Qt4ProjectManager.TargetSetupPage.ShadowBuilding"), m_shadowBuildEnabled->isChecked());
- int id = -1;
- int ci = m_versionComboBox->currentIndex();
- if (ci != -1)
- id = m_versionComboBox->itemData(ci).toInt();
- s->setValue(QLatin1String("Qt4ProjectManager.TargetSetupPage.QtVersionId"), id);
-
- // if we are importing we don't save the template setting
- // essentially we assume that the settings apply for the new project case
- // and for the importing case "None" is likely the most sensible
- if (!importing)
- s->setValue(QLatin1String("Qt4ProjectManager.TargetSetupPage.BuildTemplate"), m_buildConfigurationComboBox->currentIndex());
-}
-
-bool Qt4DefaultTargetSetupWidget::eventFilter(QObject *obj, QEvent *event)
-{
- if (obj == m_importLinePath) {
- if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
- QKeyEvent *ke = static_cast<QKeyEvent *>(event);
- if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter) {
- if (event->type() == QEvent::KeyPress)
- addImportClicked();
- return true;
- }
- }
- }
- return false;
-}
-
-QList<BuildConfigurationInfo> Qt4DefaultTargetSetupWidget::buildConfigurationInfos() const
-{
- QList<BuildConfigurationInfo> infos;
- for (int i = 0; i < m_importInfos.size(); ++i) {
- if (m_importEnabled.at(i))
- infos << m_importInfos.at(i);
- }
-
- BuildConfigurationTemplate state = buildConfigurationTemplate();
- if (state == NONE)
- return infos;
-
- int qtVersionId = -1;
- if (state == ONEQT && m_versionComboBox->currentIndex() != -1)
- qtVersionId = m_versionComboBox->itemData(m_versionComboBox->currentIndex()).toInt();
-
- QString sourceDir = QFileInfo(m_proFilePath).absolutePath();
- int size = m_infos.size();
- for (int i=0; i < size; ++i) {
- if (state == PERQT || (m_enabled.at(i) && (state == MANUALLY || (state == ONEQT && m_infos.at(i).version()->uniqueId() == qtVersionId)))) {
- BuildConfigurationInfo info = m_infos.at(i);
- if (!m_shadowBuildEnabled->isChecked())
- info.directory = sourceDir;
- infos << info;
- }
- }
- return infos;
-}
-
-void Qt4DefaultTargetSetupWidget::addImportClicked()
-{
- if (!m_importLineLabel->isVisible()) {
- m_importLineLabel->setVisible(true);
- m_importLinePath->setVisible(true);
- m_importLineButton->setAttribute(Qt::WA_MacNormalSize);
- m_importLineStretch->changeSize(0,0, QSizePolicy::Fixed, QSizePolicy::Fixed);
- m_importLineLayout->invalidate();
- return;
- }
-
- QList<BuildConfigurationInfo> infos = BuildConfigurationInfo::checkForBuild(m_importLinePath->path(), m_proFilePath);
- if (infos.isEmpty()) {
- QMessageBox::critical(this,
- tr("No Build Found"),
- tr("No build found in %1 matching project %2.").arg(m_importLinePath->path()).arg(m_proFilePath));
- return;
- }
-
- QList<BuildConfigurationInfo> filterdInfos;
- bool filtered = false;
- foreach (const BuildConfigurationInfo &info, infos) {
- if (info.version()->supportsTargetId(m_id))
- filterdInfos << info;
- else
- filtered = true;
- }
-
- if (filtered) {
- if (filterdInfos.isEmpty()) {
- QMessageBox::critical(this,
- tr("Incompatible Build Found"),
- tr("The build found in %1 is incompatible with this target.").arg(m_importLinePath->path()));
- return;
- }
- // show something if we found incompatible builds?
- }
-
- // Filter out already imported builds
- infos = filterdInfos;
- filterdInfos.clear();
- foreach (const BuildConfigurationInfo &info, infos) {
- bool alreadyImported = false;
- foreach (const BuildConfigurationInfo &existingImport, m_importInfos) {
- if (info == existingImport) {
- alreadyImported = true;
- break;
- }
- }
- if (!alreadyImported)
- filterdInfos << info;
- }
-
- if (filterdInfos.isEmpty() && !infos.isEmpty()) {
- QMessageBox::critical(this,
- tr("Already Imported Build"),
- tr("The build found in %1 is already imported.").arg(m_importLinePath->path()));
- return;
- }
-
- // We switch from to "NONE" on importing if the user has not changed it
- if (m_buildConfigurationTemplateUnchanged)
- setBuildConfigurationTemplate(NONE);
-
- foreach (const BuildConfigurationInfo &info, filterdInfos) {
- ++m_selected;
- m_importEnabled << true;
-
- m_importInfos << info;
-
- createImportWidget(info, m_importEnabled.size() - 1);
- emit newImportBuildConfiguration(info);
- }
- emit selectedToggled();
-}
-
-QList<QtSupport::BaseQtVersion *> Qt4DefaultTargetSetupWidget::usedTemporaryQtVersions()
-{
- QList<QtSupport::BaseQtVersion *> versions;
- for (int i = 0; i < m_importInfos.size(); ++i) {
- if (m_importEnabled.at(i) && m_importInfos.at(i).temporaryQtVersion)
- versions << m_importInfos.at(i).temporaryQtVersion;
- }
- return versions;
-}
-
-void Qt4DefaultTargetSetupWidget::replaceQtVersionWithQtVersion(int oldId, int newId)
-{
- QList<BuildConfigurationInfo>::iterator it, end;
- it = m_importInfos.begin();
- end = m_importInfos.end();
- for ( ; it != end; ++it) {
- BuildConfigurationInfo &info = *it;
- if (info.qtVersionId == oldId) {
- info.qtVersionId = newId;
- }
- }
-}
-
-void Qt4DefaultTargetSetupWidget::replaceTemporaryQtVersionWithQtVersion(QtSupport::BaseQtVersion *version, int id)
-{
- QList<BuildConfigurationInfo>::iterator it, end;
- it = m_importInfos.begin();
- end = m_importInfos.end();
- for ( ; it != end; ++it) {
- BuildConfigurationInfo &info = *it;
- if (info.temporaryQtVersion == version) {
- info.temporaryQtVersion = 0;
- info.qtVersionId = id;
- }
- }
-}
-
-void Qt4DefaultTargetSetupWidget::replaceQtVersionWithTemporaryQtVersion(int id, QtSupport::BaseQtVersion *version)
-{
- QList<BuildConfigurationInfo>::iterator it, end;
- it = m_importInfos.begin();
- end = m_importInfos.end();
- for ( ; it != end; ++it) {
- BuildConfigurationInfo &info = *it;
- if (info.qtVersionId == id) {
- info.temporaryQtVersion = version;
- info.qtVersionId = -1;
- }
- }
-}
-
-namespace {
-class BuildConfigurationInfoCompare
-{
-public:
- bool operator()(const BuildConfigurationInfo &a, const BuildConfigurationInfo &b) const
- {
- if (a.qtVersionId < b.qtVersionId)
- return true;
- if (a.qtVersionId > b.qtVersionId)
- return false;
-
- if (a.buildConfig != b.buildConfig) {
- QtSupport::BaseQtVersion *version = a.version();
- QtSupport::BaseQtVersion::QmakeBuildConfigs defaultBuildConfigs = QtSupport::BaseQtVersion::DebugBuild;
- if (version)
- defaultBuildConfigs = version->defaultBuildConfig();
-
- bool adebug = a.buildConfig & QtSupport::BaseQtVersion::DebugBuild;
- bool bdebug = b.buildConfig & QtSupport::BaseQtVersion::DebugBuild;
- bool defaultdebug = defaultBuildConfigs & QtSupport::BaseQtVersion::DebugBuild;
-
- if (adebug != bdebug)
- return (adebug == defaultdebug);
-
- bool abuildall = a.buildConfig & QtSupport::BaseQtVersion::BuildAll;
- bool bbuildall = b.buildConfig & QtSupport::BaseQtVersion::BuildAll;
- bool defaultbuildall = defaultBuildConfigs & QtSupport::BaseQtVersion::BuildAll;
-
- if (abuildall != bbuildall)
- return (abuildall == defaultbuildall);
-
- // Those cases can't happen
- if (a.buildConfig < b.buildConfig)
- return true;
- if (a.buildConfig > b.buildConfig)
- return false;
- }
- if (a.additionalArguments < b.additionalArguments)
- return true;
- if (a.additionalArguments > b.additionalArguments)
- return false;
- // Equal
- return false;
- }
-};
-
-}
-
-void Qt4DefaultTargetSetupWidget::setBuildConfigurationInfos(QList<BuildConfigurationInfo> infos, bool resetDirectories)
-{
- // We need to preserve the ordering of infos, so we jump through some hops
- // to figure out which infos are newly added and which are deleted
- std::set<BuildConfigurationInfo, BuildConfigurationInfoCompare> added;
- std::set<BuildConfigurationInfo, BuildConfigurationInfoCompare> removed;
- { // Figure out differences
- std::set<BuildConfigurationInfo, BuildConfigurationInfoCompare> oldInfos;
- std::set<BuildConfigurationInfo, BuildConfigurationInfoCompare> newInfos;
-
- oldInfos.insert(m_infos.constBegin(), m_infos.constEnd());
- newInfos.insert(infos.constBegin(), infos.constEnd());
-
- BuildConfigurationInfoCompare comp;
- std::set_difference(newInfos.begin(), newInfos.end(),
- oldInfos.begin(), oldInfos.end(),
- std::inserter(added, added.begin()),
- comp);
- std::set_difference(oldInfos.begin(), oldInfos.end(),
- newInfos.begin(), newInfos.end(),
- std::inserter(removed, removed.begin()),
- comp);
- }
-
- // Existing builds, to figure out which newly added
- // buildconfigurations should be en/disabled
- QStringList existingBuilds;
- for (int i = 0; i < m_importInfos.size(); ++i) {
- const BuildConfigurationInfo &info = m_importInfos.at(i);
- existingBuilds << info.directory;
- }
-
- // Iterate over old/new infos to get the correct
- // m_selected and m_enabled state
- QList<BuildConfigurationInfo>::const_iterator oldit, oend;
- oldit = m_infos.constBegin();
- oend = m_infos.constEnd();
-
- QList<BuildConfigurationInfo>::iterator newit, nend;
- newit = infos.begin();
- nend = infos.end();
-
- QList<bool>::const_iterator enabledIt = m_enabled.constBegin();
- QList<bool> enabled;
- while (oldit != oend && newit != nend) {
- if (removed.find(*oldit) != removed.end()) {
- // Deleted qt version
- if (*enabledIt)
- --m_selected;
- ++oldit;
- ++enabledIt;
- } else if (added.find(*newit) != added.end()) {
- // new info, check if we have a import build for that directory already
- // then disable this build
- if (existingBuilds.contains(newit->directory) || m_hasInSourceBuild) {
- enabled << false;
- } else {
- enabled << true;
- ++m_selected;
- }
-
- ++newit;
- } else {
- // updated
- if (!resetDirectories)
- newit->directory = oldit->directory;
- enabled << *enabledIt;
-
- ++oldit;
- ++enabledIt;
- ++newit;
- }
- }
-
- while (oldit != oend) {
- if (*enabledIt)
- --m_selected;
- ++oldit;
- ++enabledIt;
- }
-
- while (newit != nend) {
- if (existingBuilds.contains(newit->directory) || m_hasInSourceBuild) {
- enabled << false;
- } else {
- enabled << true;
- ++m_selected;
- }
-
- ++newit;
- }
-
- m_infos = infos;
- m_enabled = enabled;
-
- // Recreate widgets
- clearWidgets();
- setupWidgets();
-
- // update version combobox
- int oldQtVersionId = -1;
- if (m_versionComboBox->currentIndex() != -1)
- oldQtVersionId = m_versionComboBox->itemData(m_versionComboBox->currentIndex()).toInt();
- QList<QtSupport::BaseQtVersion *> list;
- foreach (const BuildConfigurationInfo &info, m_infos) {
- if (!list.contains(info.version()))
- list << info.version();
- }
- m_ignoreChange = true;
- m_versionComboBox->clear();
- foreach (QtSupport::BaseQtVersion *v, list) {
- m_versionComboBox->addItem(v->displayName(), v->uniqueId());
- if (v->uniqueId() == oldQtVersionId)
- m_versionComboBox->setCurrentIndex(m_versionComboBox->count() - 1);
- }
- m_ignoreChange = false;
- updateWidgetVisibility();
-
- emit selectedToggled();
-}
-
-void Qt4DefaultTargetSetupWidget::setupImportWidgets()
-{
- for (int i = 0; i < m_importInfos.size(); ++i)
- createImportWidget(m_importInfos.at(i), i);
-}
-
-void Qt4DefaultTargetSetupWidget::createImportWidget(const BuildConfigurationInfo &info, int pos)
-{
- QCheckBox *checkBox = new QCheckBox;
- checkBox->setText(tr("Import build from %1.").arg(QDir::toNativeSeparators(info.directory)));
- checkBox->setChecked(m_importEnabled.at(pos));
- if (info.version())
- checkBox->setToolTip(info.version()->toHtml(false));
- m_importLayout->addWidget(checkBox, pos, 0, 1, 2);
-
- connect(checkBox, SIGNAL(toggled(bool)),
- this, SLOT(importCheckBoxToggled(bool)));
-
- m_importCheckBoxes.append(checkBox);
-}
-
-void Qt4DefaultTargetSetupWidget::setupWidgets()
-{
- m_ignoreChange = true;
- QString sourceDir = QFileInfo(m_proFilePath).absolutePath();
- bool foundIssues = false;
- for (int i = 0; i < m_infos.size(); ++i) {
- const BuildConfigurationInfo &info = m_infos.at(i);
- QCheckBox *checkbox = new QCheckBox;
- checkbox->setText(displayNameFrom(info));
- checkbox->setChecked(m_enabled.at(i));
- checkbox->setAttribute(Qt::WA_LayoutUsesWidgetRect);
- if (info.version())
- checkbox->setToolTip(info.version()->toHtml(false));
- m_newBuildsLayout->addWidget(checkbox, i * 2, 0);
-
- Utils::PathChooser *pathChooser = new Utils::PathChooser();
- pathChooser->setExpectedKind(Utils::PathChooser::Directory);
- if (m_shadowBuildEnabled->isChecked())
- pathChooser->setPath(info.directory);
- else
- pathChooser->setPath(sourceDir);
- pathChooser->setReadOnly(!m_directoriesEnabled);
- m_newBuildsLayout->addWidget(pathChooser, i * 2, 1);
-
- QLabel *reportIssuesLabel = new QLabel;
- reportIssuesLabel->setIndent(32);
- m_newBuildsLayout->addWidget(reportIssuesLabel, i * 2 + 1, 0, 1, 2);
- reportIssuesLabel->setVisible(false);
-
- connect(checkbox, SIGNAL(toggled(bool)),
- this, SLOT(checkBoxToggled(bool)));
-
- connect(pathChooser, SIGNAL(changed(QString)),
- this, SLOT(pathChanged()));
-
- m_checkboxes.append(checkbox);
- m_pathChoosers.append(pathChooser);
- m_reportIssuesLabels.append(reportIssuesLabel);
- m_issues.append(false);
- bool issue = reportIssues(i);
- foundIssues |= issue;
- }
- if (foundIssues && isTargetSelected())
- m_detailsWidget->setState(Utils::DetailsWidget::Expanded);
- m_ignoreChange = false;
-}
-
-void Qt4DefaultTargetSetupWidget::clearWidgets()
-{
- qDeleteAll(m_checkboxes);
- m_checkboxes.clear();
- qDeleteAll(m_pathChoosers);
- m_pathChoosers.clear();
- qDeleteAll(m_reportIssuesLabels);
- m_reportIssuesLabels.clear();
- m_issues.clear();
-}
-
-void Qt4DefaultTargetSetupWidget::checkBoxToggled(bool b)
-{
- QCheckBox *box = qobject_cast<QCheckBox *>(sender());
- if (!box)
- return;
- int index = m_checkboxes.indexOf(box);
- if (index == -1)
- return;
- if (m_enabled[index] == b)
- return;
- m_selected += b ? 1 : -1;
- m_enabled[index] = b;
- if ((m_selected == 0 && !b) || (m_selected == 1 && b))
- emit selectedToggled();
-}
-
-void Qt4DefaultTargetSetupWidget::importCheckBoxToggled(bool b)
-{
- QCheckBox *box = qobject_cast<QCheckBox *>(sender());
- if (!box)
- return;
- int index = m_importCheckBoxes.indexOf(box);
- if (index == -1)
- return;
- if (m_importEnabled[index] == b)
- return;
- m_selected += b ? 1 : -1;
- m_importEnabled[index] = b;
- if ((m_selected == 0 && !b) || (m_selected == 1 && b))
- emit selectedToggled();
-}
-
-void Qt4DefaultTargetSetupWidget::pathChanged()
-{
- if (m_ignoreChange)
- return;
- Utils::PathChooser *pathChooser = qobject_cast<Utils::PathChooser *>(sender());
- if (!pathChooser)
- return;
- int index = m_pathChoosers.indexOf(pathChooser);
- if (index == -1)
- return;
- m_infos[index].directory = pathChooser->path();
- reportIssues(index);
-}
-
-void Qt4DefaultTargetSetupWidget::shadowBuildingToggled()
-{
- m_ignoreChange = true;
- bool b = m_shadowBuildEnabled->isChecked();
- if (m_directoriesEnabled == b)
- return;
- m_directoriesEnabled = b;
- QString sourceDir = QFileInfo(m_proFilePath).absolutePath();
- for (int i = 0; i < m_pathChoosers.size(); ++i) {
- Utils::PathChooser *pathChooser = m_pathChoosers.at(i);
- pathChooser->setReadOnly(!b);
- if (b)
- pathChooser->setPath(m_infos.at(i).directory);
- else
- pathChooser->setPath(sourceDir);
- reportIssues(i);
- }
- m_ignoreChange = false;
-}
-
-void Qt4DefaultTargetSetupWidget::buildConfigurationComboBoxChanged()
-{
- m_buildConfigurationTemplateUnchanged = false;
- updateWidgetVisibility();
-}
-
-void Qt4DefaultTargetSetupWidget::updateWidgetVisibility()
-{
- m_versionLabel->setVisible(false);
- m_versionComboBox->setVisible(false);
- BuildConfigurationTemplate state = buildConfigurationTemplate();
- if (state == NONE || state == PERQT) {
- foreach (QCheckBox *cb, m_checkboxes)
- cb->setVisible(false);
- foreach (Utils::PathChooser *pc, m_pathChoosers)
- pc->setVisible(false);
- foreach (QLabel *label, m_reportIssuesLabels)
- label->setVisible(false);
- } else if (state == MANUALLY) {
- foreach (QCheckBox *cb, m_checkboxes)
- cb->setVisible(true);
- foreach (Utils::PathChooser *pc, m_pathChoosers)
- pc->setVisible(true);
- for (int i = 0; i < m_reportIssuesLabels.count(); ++i)
- m_reportIssuesLabels.at(i)->setVisible(m_issues.at(i));
- } else if (state == ONEQT) {
- m_versionLabel->setVisible(true);
- m_versionComboBox->setVisible(true);
- updateOneQtVisible();
- }
- m_shadowBuildEnabled->setVisible(m_shadowBuildCheckBoxVisible && (state != NONE));
- emit selectedToggled();
-}
-
-void Qt4DefaultTargetSetupWidget::updateOneQtVisible()
-{
- if (m_ignoreChange)
- return;
- int id = -1;
- if (m_versionComboBox->currentIndex() != -1)
- id = m_versionComboBox->itemData(m_versionComboBox->currentIndex()).toInt();
- if (buildConfigurationTemplate() != ONEQT)
- return;
- for (int i = 0; i < m_infos.size(); ++i) {
- bool visible = m_infos.at(i).version()->uniqueId() == id;
- m_checkboxes.at(i)->setVisible(visible);
- m_pathChoosers.at(i)->setVisible(visible);
- m_reportIssuesLabels.at(i)->setVisible(m_issues.at(i));
- }
-}
-
-bool Qt4DefaultTargetSetupWidget::reportIssues(int index)
-{
- QPair<ProjectExplorer::Task::TaskType, QString> issues = findIssues(m_infos.at(index));
- QLabel *reportIssuesLabel = m_reportIssuesLabels.at(index);
- reportIssuesLabel->setText(issues.second);
- bool error = issues.first != ProjectExplorer::Task::Unknown;
- reportIssuesLabel->setVisible(error);
- m_issues[index] = error;
- return error;
-}
-
-QPair<ProjectExplorer::Task::TaskType, QString> Qt4DefaultTargetSetupWidget::findIssues(const BuildConfigurationInfo &info)
-{
- if (m_proFilePath.isEmpty())
- return qMakePair(ProjectExplorer::Task::Unknown, QString());
-
- QString buildDir = info.directory;
- if (!m_shadowBuildEnabled->isChecked())
- buildDir = QFileInfo(m_proFilePath).absolutePath();
- QtSupport::BaseQtVersion *version = info.version();
-
- QList<ProjectExplorer::Task> issues = version->reportIssues(m_proFilePath, buildDir);
-
- QString text;
- ProjectExplorer::Task::TaskType highestType = ProjectExplorer::Task::Unknown;
- foreach (const ProjectExplorer::Task &t, issues) {
- if (!text.isEmpty())
- text.append(QLatin1String("<br>"));
- // set severity:
- QString severity;
- if (t.type == ProjectExplorer::Task::Error) {
- highestType = ProjectExplorer::Task::Error;
- severity = tr("<b>Error:</b> ", "Severity is Task::Error");
- } else if (t.type == ProjectExplorer::Task::Warning) {
- if (highestType == ProjectExplorer::Task::Unknown)
- highestType = ProjectExplorer::Task::Warning;
- severity = tr("<b>Warning:</b> ", "Severity is Task::Warning");
- }
- text.append(severity + t.description);
- }
- if (!text.isEmpty())
- text = QLatin1String("<nobr>") + text;
- return qMakePair(highestType, text);
-}
-
-// -----------------------
-// BuildConfigurationInfo
-// -----------------------
-
-QList<BuildConfigurationInfo> BuildConfigurationInfo::filterBuildConfigurationInfos(const QList<BuildConfigurationInfo> &infos, Core::Id id)
-{
- QList<BuildConfigurationInfo> result;
- foreach (const BuildConfigurationInfo &info, infos)
- if (info.version()->supportsTargetId(id))
- result.append(info);
- return result;
-}
-
-QList<BuildConfigurationInfo> BuildConfigurationInfo::filterBuildConfigurationInfosByPlatform(const QList<BuildConfigurationInfo> &infos,
- const QString &platform)
-{
- if (platform.isEmpty()) // empty target == target independent
- return infos;
- QList<BuildConfigurationInfo> result;
- foreach (const BuildConfigurationInfo &info, infos)
- if (info.version()->supportsPlatform(platform))
- result.append(info);
- return result;
-}
-
-QList<BuildConfigurationInfo> BuildConfigurationInfo::filterBuildConfigurationInfos(const QList<BuildConfigurationInfo> &infos, Core::FeatureSet features)
-{
- QList<BuildConfigurationInfo> result;
- foreach (const BuildConfigurationInfo &info, infos)
- if (info.version()->availableFeatures().contains(features))
- result.append(info);
- return result;
-}
-
-QtSupport::BaseQtVersion *BuildConfigurationInfo::version() const
-{
- if (temporaryQtVersion)
- return temporaryQtVersion;
- QtSupport::QtVersionManager *manager = QtSupport::QtVersionManager::instance();
- return manager->version(qtVersionId);
-}
-
-QList<BuildConfigurationInfo> BuildConfigurationInfo::importBuildConfigurations(const QString &proFilePath)
-{
- QList<BuildConfigurationInfo> result;
-
- // Check for in source build first
- QString sourceDir = QFileInfo(proFilePath).absolutePath();
- QList<BuildConfigurationInfo> infos = checkForBuild(sourceDir, proFilePath);
- if (!infos.isEmpty())
- result.append(infos);
-
- // If we found a in source build, we do not search for out of source builds
- if (!result.isEmpty())
- return result;
-
- // Check for builds in build directory
- QList<Qt4BaseTargetFactory *> factories =
- ExtensionSystem::PluginManager::getObjects<Qt4BaseTargetFactory>();
- foreach (Qt4BaseTargetFactory *factory, factories) {
- foreach (const Core::Id id, factory->supportedTargetIds()) {
- QString expectedBuildprefix = factory->shadowBuildDirectory(proFilePath, id, QString());
- QString baseDir = QFileInfo(expectedBuildprefix).absolutePath();
- foreach (const QString &dir, QDir(baseDir).entryList()) {
- if (dir.startsWith(expectedBuildprefix)) {
- QList<BuildConfigurationInfo> infos = checkForBuild(dir, proFilePath);
- if (infos.isEmpty())
- result.append(infos);
- }
- }
- }
- }
- return result;
-}
-
-QList<BuildConfigurationInfo> BuildConfigurationInfo::checkForBuild(const QString &directory, const QString &proFilePath)
-{
- QStringList makefiles = QDir(directory).entryList(QStringList(QLatin1String("Makefile*")));
- QList<BuildConfigurationInfo> infos;
- foreach (const QString &file, makefiles) {
- QString makefile = directory + QLatin1Char('/') + file;
- Utils::FileName qmakeBinary = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
- if (qmakeBinary.isEmpty())
- continue;
- if (QtSupport::QtVersionManager::makefileIsFor(makefile, proFilePath) != QtSupport::QtVersionManager::SameProject)
- continue;
-
- bool temporaryQtVersion = false;
- QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::instance()->qtVersionForQMakeBinary(qmakeBinary);
- if (!version) {
- version = QtSupport::QtVersionFactory::createQtVersionFromQMakePath(qmakeBinary);
- temporaryQtVersion = true;
- if (!version)
- continue;
- }
-
- QPair<QtSupport::BaseQtVersion::QmakeBuildConfigs, QString> makefileBuildConfig =
- QtSupport::QtVersionManager::scanMakeFile(makefile, version->defaultBuildConfig());
-
- QString additionalArguments = makefileBuildConfig.second;
- Utils::FileName parsedSpec = Qt4BuildConfiguration::extractSpecFromArguments(&additionalArguments, directory, version);
- Utils::FileName versionSpec = version->mkspec();
-
- QString specArgument;
- // Compare mkspecs and add to additional arguments
- if (parsedSpec.isEmpty() || parsedSpec == versionSpec
- || parsedSpec == Utils::FileName::fromString(QLatin1String("default"))) {
- // using the default spec, don't modify additional arguments
- } else {
- specArgument = QLatin1String("-spec ") + Utils::QtcProcess::quoteArg(parsedSpec.toUserOutput());
- }
- Utils::QtcProcess::addArgs(&specArgument, additionalArguments);
-
- BuildConfigurationInfo info = BuildConfigurationInfo(version->uniqueId(),
- makefileBuildConfig.first,
- specArgument,
- directory,
- true,
- temporaryQtVersion ? version : 0,
- file);
- infos.append(info);
- }
- return infos;
-}
diff --git a/src/plugins/qt4projectmanager/qt4target.h b/src/plugins/qt4projectmanager/qt4target.h
deleted file mode 100644
index 2a18e84f95..0000000000
--- a/src/plugins/qt4projectmanager/qt4target.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef QT4TARGET_H
-#define QT4TARGET_H
-
-#include "qt4targetsetupwidget.h"
-
-#include <qtsupport/baseqtversion.h>
-#include <projectexplorer/target.h>
-#include <projectexplorer/task.h>
-
-#include <QSpacerItem>
-
-namespace Utils {
-class DetailsWidget;
-class PathChooser;
-}
-
-QT_BEGIN_NAMESPACE
-class QCheckBox;
-class QHBoxLayout;
-class QGridLayout;
-class QLabel;
-class QComboBox;
-class QPushButton;
-QT_END_NAMESPACE
-
-namespace ProjectExplorer {
-class Node;
-}
-
-namespace Qt4ProjectManager {
-class Qt4Project;
-class Qt4BaseTargetFactory;
-class Qt4ProFileNode;
-class Qt4BuildConfiguration;
-
-class QT4PROJECTMANAGER_EXPORT Qt4BaseTarget : public ProjectExplorer::Target
-{
- Q_OBJECT
-public:
- Qt4BaseTarget(Qt4Project *parent, const Core::Id id);
- virtual ~Qt4BaseTarget();
-
- ProjectExplorer::BuildConfigWidget *createConfigWidget();
-
- Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
- Qt4ProjectManager::Qt4Project *qt4Project() const;
-
- // This is the same for almost all Qt4Targets
- // so for now offer a convience function
- Qt4BuildConfiguration *addQt4BuildConfiguration(QString defaultDisplayName,
- QString displayName,
- QtSupport::BaseQtVersion *qtversion,
- QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
- QString additionalArguments,
- QString directory,
- bool importing);
-
- virtual void createApplicationProFiles(bool reparse) = 0;
-
- virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n) = 0;
-
- QList<ProjectExplorer::ToolChain *> possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const;
- ProjectExplorer::ToolChain *preferredToolChain(ProjectExplorer::BuildConfiguration *) const;
-
- virtual Utils::FileName mkspec(const Qt4BuildConfiguration *bc) const;
-
-signals:
- void buildDirectoryInitialized();
- /// emitted if the build configuration changed in a way that
- /// should trigger a reevaluation of all .pro files
- void proFileEvaluateNeeded(Qt4ProjectManager::Qt4BaseTarget *);
-
-protected:
- void removeUnconfiguredCustomExectutableRunConfigurations();
-
-private slots:
- void onAddedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
- void onProFileEvaluateNeeded(Qt4ProjectManager::Qt4BuildConfiguration *bc);
- void emitProFileEvaluateNeeded();
-};
-
-// TODO handle the user deleting/creating qt versions correctly
-// Update list of buildconfigurations on adding/removing
-// Do advanced magic for importing cases:
-// - If the qt version that would be imported was created in the mean time
-// delete the temporary qt version and set the versionId to the newly created version
-// - If the qt version that a import configuration uses was deleted from the qt versions
-// create a new temporary qt version and use that
-// For greatness!
-class Qt4DefaultTargetSetupWidget : public Qt4TargetSetupWidget
-{
- Q_OBJECT
-public:
- enum ShadowBuildOption { DISABLE, ENABLE, USER };
- Qt4DefaultTargetSetupWidget(Qt4BaseTargetFactory *factory,
- const Core::Id id,
- const QString &proFilePath,
- const QList<BuildConfigurationInfo> &info,
- const QtSupport::QtVersionNumber &minimumQtVersion,
- const QtSupport::QtVersionNumber &maximumQtVersion,
- const Core::FeatureSet &requiredFeatures,
- bool importEnabled,
- const QList<BuildConfigurationInfo> &importInfos,
- ShadowBuildOption shadowBuild);
- ~Qt4DefaultTargetSetupWidget();
- bool isTargetSelected() const;
- void setTargetSelected(bool b);
-
- void updateBuildConfigurationInfos(const QList<BuildConfigurationInfo> &infos);
- QList<QtSupport::BaseQtVersion *> usedTemporaryQtVersions();
- void replaceQtVersionWithQtVersion(int oldId, int newId);
- void replaceTemporaryQtVersionWithQtVersion(QtSupport::BaseQtVersion *version, int id);
- void replaceQtVersionWithTemporaryQtVersion(int id, QtSupport::BaseQtVersion *version);
-
- QList<BuildConfigurationInfo> buildConfigurationInfos() const;
- void setProFilePath(const QString &proFilePath);
-
- void setBuildConfiguraionComboBoxVisible(bool b);
-
- enum BuildConfigurationTemplate { PERQT = 0,
- ONEQT = 1,
- MANUALLY = 2,
- NONE = 3 };
- BuildConfigurationTemplate buildConfigurationTemplate() const;
- void setBuildConfigurationTemplate(BuildConfigurationTemplate value);
-
- void storeSettings() const;
-protected:
- bool eventFilter(QObject *, QEvent *);
-private slots:
- void addImportClicked();
- void checkBoxToggled(bool b);
- void importCheckBoxToggled(bool b);
- void pathChanged();
- void shadowBuildingToggled();
- void buildConfigurationComboBoxChanged();
- void updateOneQtVisible();
- void targetCheckBoxToggled(bool b);
-
-private:
- void updateWidgetVisibility();
- void setBuildConfigurationInfos(QList<BuildConfigurationInfo> list, bool resetDirectories);
- bool reportIssues(int index);
- QPair<ProjectExplorer::Task::TaskType, QString> findIssues(const BuildConfigurationInfo &info);
- void createImportWidget(const BuildConfigurationInfo &info, int pos);
-
- Core::Id m_id;
- Qt4BaseTargetFactory *m_factory;
- QString m_proFilePath;
- QtSupport::QtVersionNumber m_minimumQtVersion;
- QtSupport::QtVersionNumber m_maximumQtVersion;
- Core::FeatureSet m_requiredFeatures;
- Utils::DetailsWidget *m_detailsWidget;
- QGridLayout *m_importLayout;
- QGridLayout *m_newBuildsLayout;
- QCheckBox *m_shadowBuildEnabled;
- QLabel *m_buildConfigurationLabel;
- QComboBox *m_buildConfigurationComboBox;
- QLabel *m_versionLabel;
- QComboBox *m_versionComboBox;
-
- // import line widgets
- QHBoxLayout *m_importLineLayout;
- QLabel *m_importLineLabel;
- Utils::PathChooser *m_importLinePath;
- QPushButton *m_importLineButton;
- QSpacerItem *m_importLineStretch;
-
- void setupWidgets();
- void clearWidgets();
- void setupImportWidgets();
- QString displayNameFrom(const BuildConfigurationInfo &info);
- QList<QCheckBox *> m_checkboxes;
- QList<Utils::PathChooser *> m_pathChoosers;
- QList<BuildConfigurationInfo> m_infos;
- QList<bool> m_enabled;
- QList<QCheckBox *> m_importCheckBoxes;
- QList<BuildConfigurationInfo> m_importInfos;
- QList<bool> m_importEnabled;
- QList<QLabel *> m_reportIssuesLabels;
- QList<bool> m_issues;
- bool m_directoriesEnabled;
- bool m_hasInSourceBuild;
- bool m_ignoreChange;
- bool m_showImport;
- bool m_buildConfigurationTemplateUnchanged;
- bool m_shadowBuildCheckBoxVisible;
- int m_selected; // Number of selected buildconfiguartions
-};
-
-} // namespace Qt4ProjectManager
-
-#endif // QT4TARGET_H
diff --git a/src/plugins/qt4projectmanager/qt4targetsetupwidget.cpp b/src/plugins/qt4projectmanager/qt4targetsetupwidget.cpp
new file mode 100644
index 0000000000..16b1a5a092
--- /dev/null
+++ b/src/plugins/qt4projectmanager/qt4targetsetupwidget.cpp
@@ -0,0 +1,358 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "qt4targetsetupwidget.h"
+
+#include "buildconfigurationinfo.h"
+#include "qt4buildconfiguration.h"
+
+#include <coreplugin/icore.h>
+#include <extensionsystem/pluginmanager.h>
+#include <projectexplorer/profile.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/profileoptionspage.h>
+#include <qtsupport/qtprofileinformation.h>
+
+#include <utils/detailsbutton.h>
+#include <utils/detailswidget.h>
+#include <utils/pathchooser.h>
+
+#include <QCheckBox>
+#include <QHBoxLayout>
+#include <QGridLayout>
+#include <QLabel>
+#include <QPushButton>
+
+namespace Qt4ProjectManager {
+
+// -------------------------------------------------------------------------
+// Qt4TargetSetupWidget
+// -------------------------------------------------------------------------
+
+Qt4TargetSetupWidget::Qt4TargetSetupWidget(ProjectExplorer::Profile *p,
+ const QString &proFilePath,
+ const QList<BuildConfigurationInfo> &infoList) :
+ m_profile(p),
+ m_haveImported(false),
+ m_ignoreChange(false),
+ m_selected(0)
+{
+ setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
+ QVBoxLayout *vboxLayout = new QVBoxLayout();
+ setLayout(vboxLayout);
+ vboxLayout->setContentsMargins(0, 0, 0, 0);
+ m_detailsWidget = new Utils::DetailsWidget(this);
+ m_detailsWidget->setUseCheckBox(true);
+ m_detailsWidget->setChecked(false);
+ m_detailsWidget->setSummaryFontBold(true);
+ m_detailsWidget->setToolTip(m_profile->toHtml());
+ vboxLayout->addWidget(m_detailsWidget);
+
+ Utils::FadingWidget *panel = new Utils::FadingWidget(m_detailsWidget);
+ QHBoxLayout *panelLayout = new QHBoxLayout(panel);
+ m_manageButton = new QPushButton(tr("Manage..."));
+ panelLayout->addWidget(m_manageButton);
+ m_detailsWidget->setToolWidget(panel);
+
+ handleProfileUpdate(m_profile);
+
+ QWidget *widget = new QWidget;
+ QVBoxLayout *layout = new QVBoxLayout;
+ widget->setLayout(layout);
+ layout->setContentsMargins(0, 0, 0, 0);
+
+ QWidget *w = new QWidget;
+ m_newBuildsLayout = new QGridLayout;
+ m_newBuildsLayout->setMargin(0);
+#ifdef Q_OS_MAC
+ m_newBuildsLayout->setSpacing(0);
+#endif
+ w->setLayout(m_newBuildsLayout);
+ layout->addWidget(w);
+
+ widget->setEnabled(false);
+ m_detailsWidget->setWidget(widget);
+
+ foreach (const BuildConfigurationInfo &info, infoList)
+ addBuildConfigurationInfo(info);
+
+ setProFilePath(proFilePath);
+
+ connect(m_detailsWidget, SIGNAL(checked(bool)),
+ this, SLOT(targetCheckBoxToggled(bool)));
+
+ connect(ProjectExplorer::ProfileManager::instance(), SIGNAL(profileUpdated(ProjectExplorer::Profile*)),
+ this, SLOT(handleProfileUpdate(ProjectExplorer::Profile*)));
+
+ connect(m_manageButton, SIGNAL(clicked()), this, SLOT(manageProfile()));
+}
+
+Qt4TargetSetupWidget::~Qt4TargetSetupWidget()
+{ }
+
+ProjectExplorer::Profile *Qt4TargetSetupWidget::profile()
+{
+ return m_profile;
+}
+
+bool Qt4TargetSetupWidget::isTargetSelected() const
+{
+ if (!m_detailsWidget->isChecked())
+ return false;
+
+ return !selectedBuildConfigurationInfoList().isEmpty();
+}
+
+void Qt4TargetSetupWidget::setTargetSelected(bool b)
+{
+ // Only check target if there are build configurations possible
+ b &= !selectedBuildConfigurationInfoList().isEmpty();
+ m_ignoreChange = true;
+ m_detailsWidget->setChecked(b);
+ m_detailsWidget->widget()->setEnabled(b);
+ m_ignoreChange = false;
+
+ m_detailsWidget->setState(b ? Utils::DetailsWidget::Expanded : Utils::DetailsWidget::Collapsed);
+}
+
+void Qt4TargetSetupWidget::addBuildConfigurationInfo(const BuildConfigurationInfo &info, bool importing)
+{
+ if (importing) {
+ if (!m_haveImported) {
+ // disable everything on first import
+ for (int i = 0; i < m_enabled.count(); ++i) {
+ m_enabled[i] = false;
+ m_checkboxes[i]->setChecked(false);
+ }
+ m_selected = 0;
+ }
+
+ m_haveImported = true;
+ }
+ int pos = m_pathChoosers.count();
+ m_enabled.append(true);
+ ++m_selected;
+
+ m_infoList.append(info);
+
+ QCheckBox *checkbox = new QCheckBox;
+ checkbox->setText(Qt4BuildConfigurationFactory::buildConfigurationDisplayName(info));
+ checkbox->setChecked(m_enabled.at(pos));
+ checkbox->setAttribute(Qt::WA_LayoutUsesWidgetRect);
+ m_newBuildsLayout->addWidget(checkbox, pos * 2, 0);
+
+ Utils::PathChooser *pathChooser = new Utils::PathChooser();
+ pathChooser->setExpectedKind(Utils::PathChooser::Directory);
+ pathChooser->setPath(info.directory);
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(m_profile);
+ Q_ASSERT(version);
+ pathChooser->setReadOnly(!version->supportsShadowBuilds() || importing);
+ m_newBuildsLayout->addWidget(pathChooser, pos * 2, 1);
+
+ QLabel *reportIssuesLabel = new QLabel;
+ reportIssuesLabel->setIndent(32);
+ m_newBuildsLayout->addWidget(reportIssuesLabel, pos * 2 + 1, 0, 1, 2);
+ reportIssuesLabel->setVisible(false);
+
+ connect(checkbox, SIGNAL(toggled(bool)),
+ this, SLOT(checkBoxToggled(bool)));
+
+ connect(pathChooser, SIGNAL(changed(QString)),
+ this, SLOT(pathChanged()));
+
+ m_checkboxes.append(checkbox);
+ m_pathChoosers.append(pathChooser);
+ m_reportIssuesLabels.append(reportIssuesLabel);
+
+ m_issues.append(false);
+ reportIssues(pos);
+
+ emit selectedToggled();
+}
+
+void Qt4TargetSetupWidget::targetCheckBoxToggled(bool b)
+{
+ if (m_ignoreChange)
+ return;
+ m_detailsWidget->widget()->setEnabled(b);
+ if (b) {
+ foreach (bool error, m_issues) {
+ if (error) {
+ m_detailsWidget->setState(Utils::DetailsWidget::Expanded);
+ break;
+ }
+ }
+ }
+ emit selectedToggled();
+}
+
+void Qt4TargetSetupWidget::manageProfile()
+{
+ ProjectExplorer::ProfileOptionsPage *page =
+ ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::ProfileOptionsPage>();
+ if (!page)
+ return;
+
+ page->showProfile(m_profile);
+ Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
+ QLatin1String(ProjectExplorer::Constants::PROFILE_SETTINGS_PAGE_ID));
+}
+
+void Qt4TargetSetupWidget::setProFilePath(const QString &proFilePath)
+{
+ m_proFilePath = proFilePath;
+
+ clear();
+
+ QList<BuildConfigurationInfo> infoList
+ = Qt4BuildConfigurationFactory::availableBuildConfigurations(m_profile, proFilePath);
+ foreach (const BuildConfigurationInfo &info, infoList)
+ addBuildConfigurationInfo(info);
+}
+
+void Qt4TargetSetupWidget::handleProfileUpdate(ProjectExplorer::Profile *p)
+{
+ if (p != m_profile)
+ return;
+
+ m_detailsWidget->setIcon(p->icon());
+ m_detailsWidget->setSummaryText(p->displayName());
+}
+
+QList<BuildConfigurationInfo> Qt4TargetSetupWidget::selectedBuildConfigurationInfoList() const
+{
+ QList<BuildConfigurationInfo> result;
+ for (int i = 0; i < m_infoList.count(); ++i) {
+ if (m_enabled.at(i))
+ result.append(m_infoList.at(i));
+ }
+ return result;
+}
+
+QList<BuildConfigurationInfo> Qt4TargetSetupWidget::allBuildConfigurationInfoList() const
+{
+ return m_infoList;
+}
+
+void Qt4TargetSetupWidget::clear()
+{
+ qDeleteAll(m_checkboxes);
+ m_checkboxes.clear();
+ qDeleteAll(m_pathChoosers);
+ m_pathChoosers.clear();
+ qDeleteAll(m_reportIssuesLabels);
+ m_reportIssuesLabels.clear();
+
+ m_infoList.clear();
+ m_issues.clear();
+ m_enabled.clear();
+ m_selected = 0;
+ m_haveImported = false;
+
+ emit selectedToggled();
+}
+
+void Qt4TargetSetupWidget::checkBoxToggled(bool b)
+{
+ QCheckBox *box = qobject_cast<QCheckBox *>(sender());
+ if (!box)
+ return;
+ int index = m_checkboxes.indexOf(box);
+ if (index == -1)
+ return;
+ if (m_enabled[index] == b)
+ return;
+ m_selected += b ? 1 : -1;
+ m_enabled[index] = b;
+ if ((m_selected == 0 && !b) || (m_selected == 1 && b)) {
+ emit selectedToggled();
+ m_detailsWidget->setChecked(b);
+ }
+}
+
+void Qt4TargetSetupWidget::pathChanged()
+{
+ if (m_ignoreChange)
+ return;
+ Utils::PathChooser *pathChooser = qobject_cast<Utils::PathChooser *>(sender());
+ if (!pathChooser)
+ return;
+ int index = m_pathChoosers.indexOf(pathChooser);
+ if (index == -1)
+ return;
+ m_infoList[index].directory = pathChooser->path();
+ reportIssues(index);
+}
+
+void Qt4TargetSetupWidget::reportIssues(int index)
+{
+ QPair<ProjectExplorer::Task::TaskType, QString> issues = findIssues(m_infoList.at(index));
+ QLabel *reportIssuesLabel = m_reportIssuesLabels.at(index);
+ reportIssuesLabel->setText(issues.second);
+ bool error = issues.first != ProjectExplorer::Task::Unknown;
+ reportIssuesLabel->setVisible(error);
+ m_issues[index] = error;
+}
+
+QPair<ProjectExplorer::Task::TaskType, QString> Qt4TargetSetupWidget::findIssues(const BuildConfigurationInfo &info)
+{
+ if (m_proFilePath.isEmpty())
+ return qMakePair(ProjectExplorer::Task::Unknown, QString());
+
+ QString buildDir = info.directory;
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(m_profile);
+
+ QList<ProjectExplorer::Task> issues = version->reportIssues(m_proFilePath, buildDir);
+
+ QString text;
+ ProjectExplorer::Task::TaskType highestType = ProjectExplorer::Task::Unknown;
+ foreach (const ProjectExplorer::Task &t, issues) {
+ if (!text.isEmpty())
+ text.append(QLatin1String("<br>"));
+ // set severity:
+ QString severity;
+ if (t.type == ProjectExplorer::Task::Error) {
+ highestType = ProjectExplorer::Task::Error;
+ severity = tr("<b>Error:</b> ", "Severity is Task::Error");
+ } else if (t.type == ProjectExplorer::Task::Warning) {
+ if (highestType == ProjectExplorer::Task::Unknown)
+ highestType = ProjectExplorer::Task::Warning;
+ severity = tr("<b>Warning:</b> ", "Severity is Task::Warning");
+ }
+ text.append(severity + t.description);
+ }
+ if (!text.isEmpty())
+ text = QLatin1String("<nobr>") + text;
+ return qMakePair(highestType, text);
+}
+
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt4targetsetupwidget.h b/src/plugins/qt4projectmanager/qt4targetsetupwidget.h
index be1679928e..8fb7fe12cf 100644
--- a/src/plugins/qt4projectmanager/qt4targetsetupwidget.h
+++ b/src/plugins/qt4projectmanager/qt4targetsetupwidget.h
@@ -35,35 +35,81 @@
#include "qt4projectmanager_global.h"
+#include <projectexplorer/task.h>
+
#include <QWidget>
+QT_BEGIN_NAMESPACE
+class QCheckBox;
+class QHBoxLayout;
+class QGridLayout;
+class QLabel;
+class QPushButton;
+class QSpacerItem;
+QT_END_NAMESPACE
+
+namespace ProjectExplorer { class Profile; }
namespace QtSupport {
class BaseQtVersion;
-}
+} // namespace QtSupport
+namespace Utils {
+class DetailsWidget;
+class PathChooser;
+} // namespace Utils
namespace Qt4ProjectManager {
-struct BuildConfigurationInfo;
+class BuildConfigurationInfo;
class QT4PROJECTMANAGER_EXPORT Qt4TargetSetupWidget : public QWidget
{
Q_OBJECT
public:
- explicit Qt4TargetSetupWidget(QWidget *parent = 0);
+ Qt4TargetSetupWidget(ProjectExplorer::Profile *p,
+ const QString &proFilePath,
+ const QList<BuildConfigurationInfo> &infoList);
~Qt4TargetSetupWidget();
- virtual bool isTargetSelected() const = 0;
- virtual void setTargetSelected(bool b) = 0;
- virtual void setProFilePath(const QString &proFilePath) = 0;
- virtual void updateBuildConfigurationInfos(const QList<BuildConfigurationInfo> &infos) = 0;
+ ProjectExplorer::Profile *profile();
+
+ bool isTargetSelected() const;
+ void setTargetSelected(bool b);
+
+ void addBuildConfigurationInfo(const BuildConfigurationInfo &info, bool importing = false);
- virtual QList<QtSupport::BaseQtVersion *> usedTemporaryQtVersions() = 0;
- virtual void replaceQtVersionWithQtVersion(int oldId, int newId) = 0;
- virtual void replaceTemporaryQtVersionWithQtVersion(QtSupport::BaseQtVersion *version, int id) = 0;
- virtual void replaceQtVersionWithTemporaryQtVersion(int id, QtSupport::BaseQtVersion *version) = 0;
+ QList<BuildConfigurationInfo> selectedBuildConfigurationInfoList() const;
+ QList<BuildConfigurationInfo> allBuildConfigurationInfoList() const;
+ void setProFilePath(const QString &proFilePath);
signals:
void selectedToggled() const;
- void newImportBuildConfiguration(const BuildConfigurationInfo &info);
+
+private slots:
+ void handleProfileUpdate(ProjectExplorer::Profile *p);
+
+ void checkBoxToggled(bool b);
+ void pathChanged();
+ void targetCheckBoxToggled(bool b);
+ void manageProfile();
+
+private:
+ void reportIssues(int index);
+ QPair<ProjectExplorer::Task::TaskType, QString> findIssues(const BuildConfigurationInfo &info);
+ void clear();
+
+ ProjectExplorer::Profile *m_profile;
+ QString m_proFilePath;
+ bool m_haveImported;
+ Utils::DetailsWidget *m_detailsWidget;
+ QPushButton *m_manageButton;
+ QGridLayout *m_newBuildsLayout;
+ QList<QCheckBox *> m_checkboxes;
+ QList<Utils::PathChooser *> m_pathChoosers;
+ QList<BuildConfigurationInfo> m_infoList;
+ QList<bool> m_enabled;
+ QList<QLabel *> m_reportIssuesLabels;
+ QList<bool> m_issues;
+ bool m_ignoreChange;
+ int m_selected; // Number of selected buildconfiguartions
};
} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp b/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp
index 05a8cd819f..5f89ca6cec 100644
--- a/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp
+++ b/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp
@@ -35,8 +35,9 @@
#include "qt4project.h"
#include "qt4projectmanager.h"
-#include "qt4target.h"
+#include <projectexplorer/target.h>
#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtprofileinformation.h>
using namespace Qt4ProjectManager;
using namespace Internal;
@@ -47,30 +48,21 @@ Qt4UiCodeModelSupport::Qt4UiCodeModelSupport(CPlusPlus::CppModelManagerInterface
const QString &uiHeaderFile)
: CppTools::UiCodeModelSupport(modelmanager, source, uiHeaderFile),
m_project(project)
-{
-
-}
+{ }
Qt4UiCodeModelSupport::~Qt4UiCodeModelSupport()
-{
-
-}
+{ }
QString Qt4UiCodeModelSupport::uicCommand() const
{
+ QtSupport::BaseQtVersion *version;
if (m_project->needsConfiguration()) {
- UnConfiguredSettings us = m_project->qt4ProjectManager()->unconfiguredSettings();
- if (!us.version)
- return QString();
- return us.version->uicCommand();
+ version = QtSupport::QtProfileInformation::qtVersion(ProjectExplorer::ProfileManager::instance()->defaultProfile());
} else {
- Qt4BaseTarget *target = m_project->activeTarget();
- Qt4BuildConfiguration *qt4bc = target->activeQt4BuildConfiguration();
- if (!qt4bc->qtVersion())
- return QString();
- return qt4bc->qtVersion()->uicCommand();
+ ProjectExplorer::Target *target = m_project->activeTarget();
+ version = QtSupport::QtProfileInformation::qtVersion(target->profile());
}
- return QString();
+ return version ? version->uicCommand() : QString();
}
QStringList Qt4UiCodeModelSupport::environment() const
@@ -78,8 +70,10 @@ QStringList Qt4UiCodeModelSupport::environment() const
if (m_project->needsConfiguration()) {
return Utils::Environment::systemEnvironment().toStringList();
} else {
- Qt4BaseTarget *target = m_project->activeTarget();
- Qt4BuildConfiguration *qt4bc = target->activeQt4BuildConfiguration();
- return qt4bc->environment().toStringList();
+ ProjectExplorer::Target *target = m_project->activeTarget();
+ if (!target)
+ return QStringList();
+ ProjectExplorer::BuildConfiguration *bc = target->activeBuildConfiguration();
+ return bc ? bc->environment().toStringList() : QStringList();
}
}
diff --git a/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp b/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp
index bdf921dd50..b9490d8a45 100644
--- a/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp
+++ b/src/plugins/qt4projectmanager/unconfiguredprojectpanel.cpp
@@ -42,9 +42,10 @@
#include <coreplugin/modemanager.h>
#include <coreplugin/coreconstants.h>
+#include <projectexplorer/profile.h>
+#include <projectexplorer/profilemanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorer.h>
-#include <projectexplorer/toolchain.h>
#include <QLabel>
#include <QVBoxLayout>
@@ -131,39 +132,38 @@ TargetSetupPageWrapper::TargetSetupPageWrapper(ProjectExplorer::Project *project
this, SLOT(noteTextLinkActivated()));
connect(m_targetSetupPage, SIGNAL(completeChanged()),
this, SLOT(completeChanged()));
- connect(m_project->qt4ProjectManager(), SIGNAL(unconfiguredSettingsChanged()),
+ connect(ProjectExplorer::ProfileManager::instance(), SIGNAL(defaultProfileChanged()),
this, SLOT(updateNoteText()));
+ connect(ProjectExplorer::ProfileManager::instance(), SIGNAL(profileUpdated(ProjectExplorer::Profile*)),
+ this, SLOT(profileUpdated(ProjectExplorer::Profile*)));
+}
+
+void TargetSetupPageWrapper::profileUpdated(ProjectExplorer::Profile *profile)
+{
+ if (profile == ProjectExplorer::ProfileManager::instance()->defaultProfile())
+ updateNoteText();
}
void TargetSetupPageWrapper::updateNoteText()
{
- UnConfiguredSettings us = m_project->qt4ProjectManager()->unconfiguredSettings();
+ ProjectExplorer::Profile *p = ProjectExplorer::ProfileManager::instance()->defaultProfile();
QString text;
- if (us.version && us.toolchain)
- text = tr("<p>The project <b>%1</b> is not yet configured.</p><p>Qt Creator uses the Qt version: <b>%2</b> "
- "and the tool chain: <b>%3</b> to parse the project. You can edit "
- "these in the <b><a href=\"edit\">options.</a></b></p>")
- .arg(m_project->displayName())
- .arg(us.version->displayName())
- .arg(us.toolchain->displayName());
- else if (us.version)
- text = tr("<p>The project <b>%1</b> is not yet configured.</p><p>Qt Creator uses the Qt version: <b>%2</b> "
- "and <b>no tool chain</b> to parse the project. You can edit "
- "these in the <b><a href=\"edit\">settings</a></b></p>")
+ if (p->isValid())
+ text = tr("<p>The project <b>%1</b> is not yet configured.</p>"
+ "<p>Qt Creator uses the profile: <b>%2</b> "
+ "to parse the project. You can edit "
+ "these in the <b><a href=\"edit\">settings.</a></b></p>")
.arg(m_project->displayName())
- .arg(us.version->displayName());
- else if (us.toolchain)
- text = tr("<p>The project <b>%1</b> is not yet configured.</p><p>Qt Creator uses <b>no Qt version</b> "
- "and the tool chain: <b>%2</b> to parse the project. You can edit "
- "these in the <b><a href=\"edit\">settings</a></b></p>")
- .arg(m_project->displayName())
- .arg(us.toolchain->displayName());
+ .arg(p->displayName());
else
- text = tr("<p>The project <b>%1</b> is not yet configured.</p><p>Qt Creator uses <b>no Qt version</b> "
- "and <b>no tool chain</b> to parse the project. You can edit "
+ text = tr("<p>The project <b>%1</b> is not yet configured.</p>"
+ "<p>Qt Creator uses the <b>invalid</b> profile: <b>%2</b> "
+ "to parse the project. You can edit "
"these in the <b><a href=\"edit\">settings</a></b></p>")
- .arg(m_project->displayName());
+ .arg(m_project->displayName())
+ .arg(p->displayName());
+
m_targetSetupPage->setNoteText(text);
}
@@ -193,7 +193,7 @@ void TargetSetupPageWrapper::done()
void TargetSetupPageWrapper::noteTextLinkActivated()
{
Core::ICore::instance()->showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
- QLatin1String(Constants::UNCONFIGURED_SETTINGS_PAGE_ID));
+ QLatin1String(ProjectExplorer::Constants::PROFILE_SETTINGS_PAGE_ID));
}
void TargetSetupPageWrapper::completeChanged()
diff --git a/src/plugins/qt4projectmanager/unconfiguredprojectpanel.h b/src/plugins/qt4projectmanager/unconfiguredprojectpanel.h
index 6466108f3e..70616a99bb 100644
--- a/src/plugins/qt4projectmanager/unconfiguredprojectpanel.h
+++ b/src/plugins/qt4projectmanager/unconfiguredprojectpanel.h
@@ -39,6 +39,8 @@
QT_FORWARD_DECLARE_CLASS(QPushButton)
+namespace ProjectExplorer { class Profile; }
+
namespace Qt4ProjectManager {
class TargetSetupPage;
class Qt4Project;
@@ -68,6 +70,7 @@ protected:
private slots:
void done();
void noteTextLinkActivated();
+ void profileUpdated(ProjectExplorer::Profile *profile);
void updateNoteText();
void completeChanged();
diff --git a/src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.h b/src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.h
deleted file mode 100644
index b97472351f..0000000000
--- a/src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef UNCONFIGUREDSETTINGSOPTIONPAGE_H
-#define UNCONFIGUREDSETTINGSOPTIONPAGE_H
-
-#include <coreplugin/dialogs/ioptionspage.h>
-#include <QWidget>
-
-QT_BEGIN_NAMESPACE
-class QComboBox;
-class QCheckBox;
-QT_END_NAMESPACE
-
-namespace Qt4ProjectManager {
-namespace Internal {
-
-class UnConfiguredSettingsWidget : public QWidget
-{
- Q_OBJECT
-public:
- UnConfiguredSettingsWidget(QWidget *parent);
- void apply();
- bool matches(const QString &searchKeyword);
-private:
- QComboBox *m_qtVersionComboBox;
- QComboBox *m_toolchainComboBox;
- QCheckBox *m_alwaysSkipCheckBox;
-};
-
-class UnConfiguredSettingsOptionPage : public Core::IOptionsPage
-{
-public:
- UnConfiguredSettingsOptionPage();
-
- bool matches(const QString &searcKeyword) const;
- QWidget *createPage(QWidget *parent);
- void apply();
- void finish();
-
-private:
- UnConfiguredSettingsWidget *m_widget;
-};
-
-} // namespace Internal
-} // namespace Qt4ProjectManager
-
-#endif // UNCONFIGUREDSETTINGSOPTIONPAGE_H
diff --git a/src/plugins/qt4projectmanager/winceqtversion.cpp b/src/plugins/qt4projectmanager/winceqtversion.cpp
index f752b4dfd7..9a5671db14 100644
--- a/src/plugins/qt4projectmanager/winceqtversion.cpp
+++ b/src/plugins/qt4projectmanager/winceqtversion.cpp
@@ -79,16 +79,6 @@ QList<ProjectExplorer::Abi> WinCeQtVersion::detectQtAbis() const
false);
}
-bool WinCeQtVersion::supportsTargetId(const Core::Id id) const
-{
- return id == Core::Id(Constants::DESKTOP_TARGET_ID);
-}
-
-QSet<Core::Id> WinCeQtVersion::supportedTargetIds() const
-{
- return QSet<Core::Id>() << Core::Id(Constants::DESKTOP_TARGET_ID);
-}
-
QString WinCeQtVersion::description() const
{
return QCoreApplication::translate("QtVersion",
diff --git a/src/plugins/qt4projectmanager/winceqtversion.h b/src/plugins/qt4projectmanager/winceqtversion.h
index e65d906aac..9853f00315 100644
--- a/src/plugins/qt4projectmanager/winceqtversion.h
+++ b/src/plugins/qt4projectmanager/winceqtversion.h
@@ -51,9 +51,6 @@ public:
QList<ProjectExplorer::Abi> detectQtAbis() const;
- bool supportsTargetId(const Core::Id id) const;
- QSet<Core::Id> supportedTargetIds() const;
-
QString description() const;
virtual QVariantMap toMap() const;
diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp
index 5f6bbed288..f0e63cd78d 100644
--- a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp
+++ b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp
@@ -40,6 +40,8 @@
#include <qt4projectmanager/qt4project.h>
#include <qt4projectmanager/qt4projectmanager.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
+#include <qtsupport/qtsupportconstants.h>
+#include <qtsupport/qtprofileinformation.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/customwizard/customwizard.h>
#include <coreplugin/editormanager/editormanager.h>
@@ -67,11 +69,10 @@ AbstractMobileAppWizardDialog::AbstractMobileAppWizardDialog(QWidget *parent,
, m_harmattanItem(0)
{
m_targetsPage = new TargetSetupPage;
- m_targetsPage->setPreferredFeatures(QSet<QString>() << QLatin1String(Constants::MOBILE_TARGETFEATURE_ID));
- m_targetsPage->setMinimumQtVersion(minimumQtVersionNumber);
- m_targetsPage->setMaximumQtVersion(maximumQtVersionNumber);
- m_targetsPage->setSelectedPlatform(selectedPlatform());
- m_targetsPage->setRequiredQtFeatures(requiredFeatures());
+ m_targetsPage->setPreferredProfileMatcher(new QtSupport::QtPlatformProfileMatcher(selectedPlatform()));
+ m_targetsPage->setRequiredProfileMatcher(new QtSupport::QtVersionProfileMatcher(requiredFeatures(),
+ minimumQtVersionNumber,
+ maximumQtVersionNumber));
resize(900, 450);
m_genericOptionsPage = new Internal::MobileAppWizardGenericOptionsPage;
@@ -117,33 +118,36 @@ int AbstractMobileAppWizardDialog::addPageWithTitle(QWizardPage *page, const QSt
int AbstractMobileAppWizardDialog::nextId() const
{
if (currentPage() == m_targetsPage) {
- if ((isSymbianTargetSelected() && !m_ignoreGeneralOptions) || isFremantleTargetSelected())
+ if ((isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM) && !m_ignoreGeneralOptions) ||
+ isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM))
return m_genericOptionsPageId;
// If Symbian target and Qt Quick components for Symbian, skip the mobile options page.
- else if (isSymbianTargetSelected() && m_ignoreGeneralOptions)
+ else if (isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM) && m_ignoreGeneralOptions)
return m_symbianOptionsPageId;
- else if (isMeegoTargetSelected())
+ else if (isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM))
return m_maemoOptionsPageId;
- else if (isHarmattanTargetSelected())
+ else if (isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM))
return m_harmattanOptionsPageId;
else
return idOfNextGenericPage();
} else if (currentPage() == m_genericOptionsPage) {
- if (isSymbianTargetSelected())
+ if (isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM))
return m_symbianOptionsPageId;
- else if (isFremantleTargetSelected() || isMeegoTargetSelected())
+ else if (isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM)
+ || isQtPlatformSelected(QtSupport::Constants::MEEGO_PLATFORM))
return m_maemoOptionsPageId;
else
return m_harmattanOptionsPageId;
} else if (currentPage() == m_symbianOptionsPage) {
- if (isFremantleTargetSelected() || isMeegoTargetSelected())
+ if (isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM)
+ || isQtPlatformSelected(QtSupport::Constants::MEEGO_PLATFORM))
return m_maemoOptionsPageId;
- else if (isHarmattanTargetSelected())
+ else if (isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM))
return m_harmattanOptionsPageId;
else
return idOfNextGenericPage();
} else if (currentPage() == m_maemoOptionsPage) {
- if (isHarmattanTargetSelected())
+ if (isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM))
return m_harmattanOptionsPageId;
else
return idOfNextGenericPage();
@@ -168,11 +172,12 @@ void AbstractMobileAppWizardDialog::initializePage(int id)
|| id == m_maemoOptionsPageId) {
QList<Utils::WizardProgressItem *> order;
order << m_genericItem;
- if (isSymbianTargetSelected())
+ if (isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM))
order << m_symbianItem;
- if (isFremantleTargetSelected() || isMeegoTargetSelected())
+ if (isQtPlatformSelected(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM)
+ || isQtPlatformSelected(QtSupport::Constants::MEEGO_PLATFORM))
order << m_maemoItem;
- if (isHarmattanTargetSelected())
+ if (isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM))
order << m_harmattanItem;
order << itemOfNextGenericPage();
@@ -202,31 +207,14 @@ Utils::WizardProgressItem *AbstractMobileAppWizardDialog::itemOfNextGenericPage(
return wizardProgress()->item(idOfNextGenericPage());
}
-bool AbstractMobileAppWizardDialog::isSymbianTargetSelected() const
+bool AbstractMobileAppWizardDialog::isQtPlatformSelected(const QString &platform) const
{
- return m_targetsPage->isTargetSelected(Core::Id(Constants::S60_DEVICE_TARGET_ID));
+ return m_targetsPage->isQtPlatformSelected(platform);
}
-bool AbstractMobileAppWizardDialog::isFremantleTargetSelected() const
-{
- return m_targetsPage->isTargetSelected(Core::Id(Constants::MAEMO5_DEVICE_TARGET_ID));
-}
-
-bool AbstractMobileAppWizardDialog::isHarmattanTargetSelected() const
-{
- return m_targetsPage->isTargetSelected(Core::Id(Constants::HARMATTAN_DEVICE_TARGET_ID));
-}
-
-bool AbstractMobileAppWizardDialog::isMeegoTargetSelected() const
-{
- return m_targetsPage->isTargetSelected(Core::Id(Constants::MEEGO_DEVICE_TARGET_ID));
-}
-
-
AbstractMobileAppWizard::AbstractMobileAppWizard(const Core::BaseFileWizardParameters &params,
QObject *parent) : Core::BaseFileWizard(params, parent)
-{
-}
+{ }
QWizard *AbstractMobileAppWizard::createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const
@@ -258,9 +246,8 @@ Core::GeneratedFiles AbstractMobileAppWizard::generateFiles(const QWizard *wizar
app()->setNetworkEnabled(wdlg->m_symbianOptionsPage->networkEnabled());
app()->setPngIcon64(wdlg->m_maemoOptionsPage->pngIcon());
app()->setPngIcon80(wdlg->m_harmattanOptionsPage->pngIcon());
- if (wdlg->isHarmattanTargetSelected())
- app()->setSupportsMeegoBooster(wdlg->isHarmattanTargetSelected()
- && wdlg->m_harmattanOptionsPage->supportsBooster());
+ if (wdlg->isQtPlatformSelected(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM))
+ app()->setSupportsMeegoBooster(wdlg->m_harmattanOptionsPage->supportsBooster());
prepareGenerateFiles(wizard, errorMessage);
return app()->generateFiles(errorMessage);
}
diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.h b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.h
index 759efa0017..77a32779e2 100644
--- a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.h
+++ b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.h
@@ -76,10 +76,7 @@ protected:
private:
int idOfNextGenericPage() const;
Utils::WizardProgressItem *itemOfNextGenericPage() const;
- bool isSymbianTargetSelected() const;
- bool isFremantleTargetSelected() const;
- bool isHarmattanTargetSelected() const;
- bool isMeegoTargetSelected() const;
+ bool isQtPlatformSelected(const QString &platform) const;
Internal::MobileAppWizardGenericOptionsPage *m_genericOptionsPage;
Internal::MobileAppWizardSymbianOptionsPage *m_symbianOptionsPage;
diff --git a/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp
index 5eac1936c3..d6a581ce34 100644
--- a/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp
+++ b/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp
@@ -33,9 +33,9 @@
#include "guiappwizarddialog.h"
#include "filespage.h"
-#include "qt4target.h"
#include "qtprojectparameters.h"
-#include "qt4projectmanagerconstants.h"
+
+#include <qtsupport/qtsupportconstants.h>
#include <QSet>
@@ -66,7 +66,7 @@ GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName,
"and includes an empty widget."));
addModulesPage();
- addTargetSetupPage(QSet<QString>(), isMobile);
+ addTargetSetupPage(isMobile);
m_filesPage->setFormInputCheckable(true);
m_filesPage->setClassTypeComboVisible(false);
@@ -115,13 +115,13 @@ GuiAppParameters GuiAppWizardDialog::parameters() const
rc.formFileName = m_filesPage->formFileName();
rc.designerForm = m_filesPage->formInputChecked();
rc.isMobileApplication = true;
- if (isTargetSelected(Core::Id(Constants::MAEMO5_DEVICE_TARGET_ID))
- || isTargetSelected(Core::Id(Constants::HARMATTAN_DEVICE_TARGET_ID))
- || isTargetSelected(Core::Id(Constants::MEEGO_DEVICE_TARGET_ID))
- || isTargetSelected(Core::Id(Constants::ANDROID_DEVICE_TARGET_ID))) {
+ if (isQtPlatformSelected(QLatin1String(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM))
+ || isQtPlatformSelected(QLatin1String(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM))
+ || isQtPlatformSelected(QLatin1String(QtSupport::Constants::MEEGO_PLATFORM))
+ || isQtPlatformSelected(QLatin1String(QtSupport::Constants::ANDROID_PLATFORM))) {
rc.widgetWidth = 800;
rc.widgetHeight = 480;
- } else if (isTargetSelected(Core::Id(Constants::S60_DEVICE_TARGET_ID))) {
+ } else if (isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM)) {
rc.widgetWidth = 360;
rc.widgetHeight = 640;
} else {
diff --git a/src/plugins/qt4projectmanager/wizards/importwidget.cpp b/src/plugins/qt4projectmanager/wizards/importwidget.cpp
new file mode 100644
index 0000000000..4a3b8393e4
--- /dev/null
+++ b/src/plugins/qt4projectmanager/wizards/importwidget.cpp
@@ -0,0 +1,93 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "importwidget.h"
+
+#include <utils/detailswidget.h>
+#include <utils/pathchooser.h>
+
+#include <QFileInfo>
+
+#include <QPushButton>
+#include <QVBoxLayout>
+
+namespace Qt4ProjectManager {
+namespace Internal {
+
+ImportWidget::ImportWidget(QWidget *parent) :
+ QWidget(parent),
+ m_pathChooser(new Utils::PathChooser)
+{
+ setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
+ QVBoxLayout *vboxLayout = new QVBoxLayout();
+ setLayout(vboxLayout);
+ vboxLayout->setContentsMargins(0, 0, 0, 0);
+ Utils::DetailsWidget *detailsWidget = new Utils::DetailsWidget(this);
+ detailsWidget->setUseCheckBox(false);
+ detailsWidget->setSummaryText(tr("Import Build from..."));
+ detailsWidget->setSummaryFontBold(true);
+ // m_detailsWidget->setIcon(); // FIXME: Set icon!
+ vboxLayout->addWidget(detailsWidget);
+
+ QWidget *widget = new QWidget;
+ QVBoxLayout *layout = new QVBoxLayout(widget);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->addWidget(m_pathChooser);
+
+ m_pathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
+ QPushButton *importButton = new QPushButton(tr("Import"), widget);
+ layout->addWidget(importButton);
+
+ connect(importButton, SIGNAL(clicked()), this, SLOT(handleImportRequest()));
+
+ detailsWidget->setWidget(widget);
+}
+
+ImportWidget::~ImportWidget()
+{ }
+
+void ImportWidget::setCurrentDirectory(const Utils::FileName &dir)
+{
+ m_pathChooser->setBaseFileName(dir);
+ m_pathChooser->setFileName(dir);
+}
+
+void ImportWidget::handleImportRequest()
+{
+ Utils::FileName dir = m_pathChooser->fileName();
+ emit importFrom(dir);
+
+ m_pathChooser->setFileName(m_pathChooser->baseFileName());
+}
+
+} // namespace Internal
+} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptarget.h b/src/plugins/qt4projectmanager/wizards/importwidget.h
index e572c979df..be7f71f78e 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptarget.h
+++ b/src/plugins/qt4projectmanager/wizards/importwidget.h
@@ -30,36 +30,39 @@
**
**************************************************************************/
-#ifndef QT4DESKTOPTARGET_H
-#define QT4DESKTOPTARGET_H
+#ifndef IMPORTWIDGET_H
+#define IMPORTWIDGET_H
-#include "qt4target.h"
+#include <QWidget>
-namespace Qt4ProjectManager {
+#include <utils/fileutils.h>
-class Qt4Project;
-class Qt4BuildConfigurationFactory;
+namespace Utils { class PathChooser; }
+namespace Qt4ProjectManager {
namespace Internal {
-class Qt4DesktopTarget : public Qt4BaseTarget
+class ImportWidget : public QWidget
{
- friend class Qt4DesktopTargetFactory;
Q_OBJECT
+
public:
- Qt4DesktopTarget(Qt4Project *parent, const Core::Id id);
- ~Qt4DesktopTarget();
+ explicit ImportWidget(QWidget *parent = 0);
+ ~ImportWidget();
- static QString defaultDisplayName();
- ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
+ void setCurrentDirectory(const Utils::FileName &dir);
- void createApplicationProFiles(bool reparse);
- QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
+signals:
+ void importFrom(const Utils::FileName &dir);
+
+private slots:
+ void handleImportRequest();
private:
- Qt4BuildConfigurationFactory *m_buildConfigurationFactory;
+ Utils::PathChooser *m_pathChooser;
};
} // namespace Internal
} // namespace Qt4ProjectManager
-#endif // QT4DESKTOPTARGET_H
+
+#endif // IMPORTWIDGET_H
diff --git a/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp
index 02927a41fd..62e8ff464f 100644
--- a/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp
+++ b/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp
@@ -39,6 +39,8 @@
#include "abstractmobileapp.h"
#include "qt4projectmanagerconstants.h"
+#include <qtsupport/qtsupportconstants.h>
+
#include <utils/projectintropage.h>
#include <QDebug>
@@ -235,7 +237,7 @@ int LibraryWizardDialog::nextId() const
int next = m_modulesPageId;
- const bool symbianTargetEnabled = isTargetSelected(Core::Id(Constants::S60_DEVICE_TARGET_ID));
+ const bool symbianTargetEnabled = isQtPlatformSelected(QtSupport::Constants::SYMBIAN_PLATFORM);
// If there was no Symbian target defined we omit "Symbian specific" step
// We also omit this step if the library type is not dll
diff --git a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp
index 511e6e13fd..c2b8e78363 100644
--- a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp
+++ b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp
@@ -35,7 +35,6 @@
#include "qt4project.h"
#include "qt4projectmanager.h"
#include "qt4projectmanagerconstants.h"
-#include "qt4target.h"
#include "modulespage.h"
#include "targetsetuppage.h"
@@ -44,8 +43,11 @@
#include <cpptools/cpptoolsconstants.h>
+#include <projectexplorer/profile.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/task.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
#include <extensionsystem/pluginmanager.h>
@@ -172,7 +174,7 @@ CustomQt4ProjectWizard::CustomQt4ProjectWizard(const Core::BaseFileWizardParamet
initProjectWizardDialog(wizard, wizardDialogParameters.defaultPath(), wizardDialogParameters.extensionPages());
if (wizard->pageIds().contains(targetPageId))
qWarning("CustomQt4ProjectWizard: Unable to insert target page at %d", int(targetPageId));
- wizard->addTargetSetupPage(QSet<QString>(), false, targetPageId);
+ wizard->addTargetSetupPage(false, targetPageId);
return wizard;
}
@@ -237,19 +239,20 @@ int BaseQt4ProjectWizardDialog::addModulesPage(int id)
return newId;
}
-int BaseQt4ProjectWizardDialog::addTargetSetupPage(QSet<QString> targets, bool mobile, int id)
+int BaseQt4ProjectWizardDialog::addTargetSetupPage(bool mobile, int id)
{
m_targetSetupPage = new TargetSetupPage;
- m_targetSetupPage->setSelectedPlatform(selectedPlatform());
- m_targetSetupPage->setRequiredQtFeatures(requiredFeatures());
- m_targets = targets;
- resize(900, 450);
+ const QString platform = selectedPlatform();
+ Core::FeatureSet features = mobile ? Core::FeatureSet(QtSupport::Constants::FEATURE_MOBILE)
+ : Core::FeatureSet(QtSupport::Constants::FEATURE_DESKTOP);
+ if (platform.isEmpty())
+ m_targetSetupPage->setPreferredProfileMatcher(new QtSupport::QtVersionProfileMatcher(features));
+ else
+ m_targetSetupPage->setPreferredProfileMatcher(new QtSupport::QtPlatformProfileMatcher(platform));
- if (mobile) {
- m_targetSetupPage->setPreferredFeatures(QSet<QString>() << QLatin1String(Constants::MOBILE_TARGETFEATURE_ID));
- } else {
- m_targetSetupPage->setPreferredFeatures(QSet<QString>() << QLatin1String(Constants::DESKTOP_TARGETFEATURE_ID));
- }
+ m_targetSetupPage->setRequiredProfileMatcher(new QtSupport::QtVersionProfileMatcher(requiredFeatures()));
+
+ resize(900, 450);
if (id >= 0)
setPage(id, m_targetSetupPage);
@@ -315,9 +318,9 @@ bool BaseQt4ProjectWizardDialog::setupProject(Qt4Project *project) const
return m_targetSetupPage->setupProject(project);
}
-bool BaseQt4ProjectWizardDialog::isTargetSelected(Core::Id targetid) const
+bool BaseQt4ProjectWizardDialog::isQtPlatformSelected(const QString &platform) const
{
- return m_targetSetupPage->isTargetSelected(targetid);
+ return m_targetSetupPage->isQtPlatformSelected(platform);
}
void BaseQt4ProjectWizardDialog::addExtensionPages(const QList<QWizardPage *> &wizardPageList)
@@ -333,10 +336,3 @@ void BaseQt4ProjectWizardDialog::generateProfileName(const QString &name, const
+ name + QLatin1String(".pro"));
m_targetSetupPage->setProFilePath(proFile);
}
-
-QSet<QString> BaseQt4ProjectWizardDialog::desktopTarget()
-{
- QSet<QString> rc;
- rc.insert(QLatin1String(Constants::DESKTOP_TARGET_ID));
- return rc;
-}
diff --git a/src/plugins/qt4projectmanager/wizards/qtwizard.h b/src/plugins/qt4projectmanager/wizards/qtwizard.h
index e1f5aac2e3..1882fc98e3 100644
--- a/src/plugins/qt4projectmanager/wizards/qtwizard.h
+++ b/src/plugins/qt4projectmanager/wizards/qtwizard.h
@@ -41,6 +41,8 @@
#include <QSet>
+namespace ProjectExplorer { class Profile; }
+
namespace Qt4ProjectManager {
class Qt4Project;
@@ -130,9 +132,7 @@ public:
virtual ~BaseQt4ProjectWizardDialog();
int addModulesPage(int id = -1);
- int addTargetSetupPage(QSet<QString> targets = QSet<QString>(), bool mobile = false, int id = -1);
-
- static QSet<QString> desktopTarget();
+ int addTargetSetupPage(bool mobile = false, int id = -1);
QStringList selectedModulesList() const;
void setSelectedModules(const QString &, bool lock = false);
@@ -142,7 +142,7 @@ public:
bool writeUserFile(const QString &proFileName) const;
bool setupProject(Qt4Project *project) const;
- bool isTargetSelected(Core::Id targetid) const;
+ bool isQtPlatformSelected(const QString &platform) const;
void addExtensionPages(const QList<QWizardPage *> &wizardPageList);
@@ -156,7 +156,6 @@ private:
TargetSetupPage *m_targetSetupPage;
QStringList m_selectedModules;
QStringList m_deselectedModules;
- QSet<QString> m_targets;
};
} // namespace Internal
diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp
index 1706cd37e3..96865f4e2b 100644
--- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp
+++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp
@@ -31,212 +31,170 @@
**************************************************************************/
#include "targetsetuppage.h"
+#include "importwidget.h"
#include "ui_targetsetuppage.h"
#include "buildconfigurationinfo.h"
+#include "qt4buildconfiguration.h"
#include "qt4project.h"
-#include "qt4projectmanager.h"
#include "qt4projectmanagerconstants.h"
-#include "qt4target.h"
-#include "qt4basetargetfactory.h"
+#include "qmakeprofileinformation.h"
-#include <extensionsystem/pluginmanager.h>
-#include <projectexplorer/task.h>
-#include <projectexplorer/taskhub.h>
-#include <projectexplorer/toolchainmanager.h>
+#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
+#include <qtsupport/qtprofileinformation.h>
+#include <qtsupport/qtsupportconstants.h>
#include <qtsupport/qtversionfactory.h>
-#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <QLabel>
-#include <QLayout>
+#include <QMessageBox>
using namespace Qt4ProjectManager;
+static const Core::Id QT_IS_TEMPORARY("Qt4PM.TempQt");
+static const Core::Id PROFILE_IS_TEMPORARY("Qt4PM.TempProfile");
+static const Core::Id TEMPORARY_OF_PROJECTS("Qt4PM.TempProject");
+
TargetSetupPage::TargetSetupPage(QWidget *parent) :
QWizardPage(parent),
+ m_requiredMatcher(0),
+ m_preferredMatcher(0),
+ m_baseLayout(0),
m_importSearch(false),
- m_useScrollArea(true),
- m_maximumQtVersionNumber(INT_MAX, INT_MAX, INT_MAX),
- m_spacer(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)),
- m_ignoreQtVersionChange(false),
- m_ui(new Internal::Ui::TargetSetupPage)
+ m_firstWidget(0),
+ m_ui(new Internal::Ui::TargetSetupPage),
+ m_importWidget(new Internal::ImportWidget),
+ m_spacer(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding))
{
+ setObjectName(QLatin1String("TargetSetupPage"));
m_ui->setupUi(this);
+
QWidget *centralWidget = new QWidget(this);
m_ui->scrollArea->setWidget(centralWidget);
centralWidget->setLayout(new QVBoxLayout);
m_ui->centralWidget->setLayout(new QVBoxLayout);
m_ui->centralWidget->layout()->setMargin(0);
+ setUseScrollArea(true);
+ setImportSearch(false);
+
setTitle(tr("Target Setup"));
connect(m_ui->descriptionLabel, SIGNAL(linkActivated(QString)),
this, SIGNAL(noteTextLinkActivated()));
- connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
- this, SLOT(qtVersionsChanged(QList<int>,QList<int>,QList<int>)));
+ ProjectExplorer::ProfileManager *sm = ProjectExplorer::ProfileManager::instance();
+ connect(sm, SIGNAL(profileAdded(ProjectExplorer::Profile*)),
+ this, SLOT(handleProfileAddition(ProjectExplorer::Profile*)));
+ connect(sm, SIGNAL(profileRemoved(ProjectExplorer::Profile*)),
+ this, SLOT(handleProfileRemoval(ProjectExplorer::Profile*)));
+ connect(sm, SIGNAL(profileUpdated(ProjectExplorer::Profile*)),
+ this, SLOT(handleProfileUpdate(ProjectExplorer::Profile*)));
+ connect(m_importWidget, SIGNAL(importFrom(Utils::FileName)),
+ this, SLOT(import(Utils::FileName)));
}
void TargetSetupPage::initializePage()
{
- cleanupImportInfos();
- deleteWidgets();
+ reset();
- setupImportInfos();
setupWidgets();
+ setupImports();
+ selectAtLeastOneTarget();
}
-TargetSetupPage::~TargetSetupPage()
+void TargetSetupPage::setRequiredProfileMatcher(ProjectExplorer::ProfileMatcher *matcher)
{
- deleteWidgets();
- delete m_ui;
- cleanupImportInfos();
+ m_requiredMatcher = matcher;
}
-bool TargetSetupPage::isTargetSelected(Core::Id id) const
+void TargetSetupPage::setPreferredProfileMatcher(ProjectExplorer::ProfileMatcher *matcher)
{
- Qt4TargetSetupWidget *widget = m_widgets.value(id);
- return widget && widget->isTargetSelected();
+ m_preferredMatcher = matcher;
}
-bool TargetSetupPage::isComplete() const
-{
- foreach (Qt4TargetSetupWidget *widget, m_widgets)
- if (widget->isTargetSelected())
- return true;
- return false;
-}
-
-void TargetSetupPage::setPreferredFeatures(const QSet<QString> &featureIds)
-{
- m_preferredFeatures = featureIds;
-}
-
-void TargetSetupPage::setRequiredTargetFeatures(const QSet<QString> &featureIds)
+TargetSetupPage::~TargetSetupPage()
{
- m_requiredTargetFeatures = featureIds;
+ reset();
+ delete m_ui;
+ delete m_preferredMatcher;
+ delete m_requiredMatcher;
}
-void TargetSetupPage::setRequiredQtFeatures(const Core::FeatureSet &features)
+bool TargetSetupPage::isProfileSelected(Core::Id id) const
{
- m_requiredQtFeatures = features;
+ Qt4TargetSetupWidget *widget = m_widgets.value(id);
+ return widget && widget->isTargetSelected();
}
-void TargetSetupPage::setSelectedPlatform(const QString &platform)
+void TargetSetupPage::setProfileSelected(Core::Id id, bool selected)
{
- m_selectedPlatform = platform;
+ Qt4TargetSetupWidget *widget = m_widgets.value(id);
+ if (widget)
+ widget->setTargetSelected(selected);
}
-void TargetSetupPage::setMinimumQtVersion(const QtSupport::QtVersionNumber &number)
+bool TargetSetupPage::isQtPlatformSelected(const QString &platform) const
{
- m_minimumQtVersionNumber = number;
+ QtSupport::QtPlatformProfileMatcher matcher(platform);
+ QList<ProjectExplorer::Profile *> profileList = ProjectExplorer::ProfileManager::instance()->profiles(&matcher);
+ foreach (ProjectExplorer::Profile *p, profileList) {
+ if (isProfileSelected(p->id()))
+ return true;
+ }
+ return false;
}
-void TargetSetupPage::setMaximumQtVersion(const QtSupport::QtVersionNumber &number)
+bool TargetSetupPage::isComplete() const
{
- m_maximumQtVersionNumber = number;
+ foreach (Qt4TargetSetupWidget *widget, m_widgets.values())
+ if (widget->isTargetSelected())
+ return true;
+ return false;
}
void TargetSetupPage::setImportSearch(bool b)
{
m_importSearch = b;
+ m_importWidget->setVisible(b);
}
void TargetSetupPage::setupWidgets()
{
- QLayout *layout = 0;
- if (m_useScrollArea)
- layout = m_ui->scrollArea->widget()->layout();
- else
- layout = m_ui->centralWidget->layout();
-
- // Target Page setup
- QList<Qt4BaseTargetFactory *> factories = ExtensionSystem::PluginManager::getObjects<Qt4BaseTargetFactory>();
- bool atLeastOneTargetSelected = false;
- foreach (Qt4BaseTargetFactory *factory, factories) {
- QList<Core::Id> ids = factory->supportedTargetIds();
- foreach (Core::Id id, ids) {
- if (!factory->targetFeatures(id).contains(m_requiredTargetFeatures))
- continue;
+ // Known profiles:
+ foreach (ProjectExplorer::Profile *p, ProjectExplorer::ProfileManager::instance()->profiles(m_requiredMatcher))
+ addWidget(p);
+
+ // Setup import widget:
+ m_baseLayout->addWidget(m_importWidget);
+ Utils::FileName path = Utils::FileName::fromString(m_proFilePath);
+ path = path.parentDir(); // base dir
+ path = path.parentDir(); // parent dir
+ m_importWidget->setCurrentDirectory(path);
+
+ updateVisibility();
+}
- QList<BuildConfigurationInfo> infos = BuildConfigurationInfo::filterBuildConfigurationInfos(m_importInfos, id);
- const QList<BuildConfigurationInfo> platformFilteredInfos =
- BuildConfigurationInfo::filterBuildConfigurationInfosByPlatform(factory->availableBuildConfigurations(id,
- m_proFilePath,
- m_minimumQtVersionNumber,
- m_maximumQtVersionNumber,
- m_requiredQtFeatures),
- m_selectedPlatform);
-
-
- Qt4TargetSetupWidget *widget =
- factory->createTargetSetupWidget(id, m_proFilePath,
- m_minimumQtVersionNumber,
- m_maximumQtVersionNumber,
- m_requiredQtFeatures,
- m_importSearch, infos);
- if (widget) {
- bool selectTarget = false;
- if (!m_importInfos.isEmpty()) {
- selectTarget = !infos.isEmpty();
- } else {
- if (!m_preferredFeatures.isEmpty()) {
- selectTarget = factory->targetFeatures(id).contains(m_preferredFeatures)
- && factory->selectByDefault(id);
- }
- if (!m_selectedPlatform.isEmpty()) {
- selectTarget = !platformFilteredInfos.isEmpty();
- }
- }
- widget->setTargetSelected(selectTarget);
- atLeastOneTargetSelected |= selectTarget;
- m_widgets.insert(id, widget);
- m_factories.insert(widget, factory);
- layout->addWidget(widget);
- connect(widget, SIGNAL(selectedToggled()),
- this, SIGNAL(completeChanged()));
- connect(widget, SIGNAL(newImportBuildConfiguration(BuildConfigurationInfo)),
- this, SLOT(newImportBuildConfiguration(BuildConfigurationInfo)));
+void TargetSetupPage::reset()
+{
+ foreach (Qt4TargetSetupWidget *widget, m_widgets.values()) {
+ ProjectExplorer::Profile *p = widget->profile();
+ Q_ASSERT(p);
+ if (p->hasValue(PROFILE_IS_TEMPORARY) && !m_proFilePath.isEmpty()) {
+ QStringList projects = p->value(TEMPORARY_OF_PROJECTS, QStringList()).toStringList();
+ if (projects.contains(m_proFilePath)) {
+ projects.removeOne(m_proFilePath);
+ p->setValue(TEMPORARY_OF_PROJECTS, projects);
+ if (projects.isEmpty())
+ ProjectExplorer::ProfileManager::instance()->deregisterProfile(p);
}
}
+ delete widget;
}
- if (!atLeastOneTargetSelected) {
- Qt4TargetSetupWidget *widget = m_widgets.value(Core::Id(Constants::DESKTOP_TARGET_ID));
- if (widget)
- widget->setTargetSelected(true);
- }
-
- if (m_useScrollArea)
- layout->addItem(m_spacer);
- if (m_widgets.isEmpty()) {
- // Oh no one can create any targets
- m_ui->scrollArea->setVisible(false);
- m_ui->centralWidget->setVisible(false);
- m_ui->descriptionLabel->setVisible(false);
- m_ui->noValidQtVersionsLabel->setVisible(true);
- } else {
- m_ui->scrollArea->setVisible(m_useScrollArea);
- m_ui->centralWidget->setVisible(!m_useScrollArea);
- m_ui->descriptionLabel->setVisible(true);
- m_ui->noValidQtVersionsLabel->setVisible(false);
- }
-}
-void TargetSetupPage::deleteWidgets()
-{
- QLayout *layout = 0;
- if (m_useScrollArea)
- layout = m_ui->scrollArea->widget()->layout();
- else
- layout = m_ui->centralWidget->layout();
- foreach (Qt4TargetSetupWidget *widget, m_widgets)
- delete widget;
m_widgets.clear();
- m_factories.clear();
- if (m_useScrollArea)
- layout->removeItem(m_spacer);
+ m_firstWidget = 0;
}
void TargetSetupPage::setProFilePath(const QString &path)
@@ -247,7 +205,7 @@ void TargetSetupPage::setProFilePath(const QString &path)
"%1: Project name").arg(QFileInfo(m_proFilePath).baseName()));
}
- deleteWidgets();
+ reset();
setupWidgets();
}
@@ -256,153 +214,290 @@ void TargetSetupPage::setNoteText(const QString &text)
m_ui->descriptionLabel->setText(text);
}
-void TargetSetupPage::setupImportInfos()
+void TargetSetupPage::import(const Utils::FileName &path)
{
- if (m_importSearch)
- m_importInfos = BuildConfigurationInfo::importBuildConfigurations(m_proFilePath);
+ import(path, false);
}
-void TargetSetupPage::cleanupImportInfos()
+void TargetSetupPage::import(const Utils::FileName &path, const bool silent)
{
- // The same qt version can be twice in the list, for the following case
- // A Project with two import build using the same already existing qt version
- // If that qt version is deleted, it is replaced by ONE temporary qt version
- // So two entries in m_importInfos refer to the same qt version
- QSet<QtSupport::BaseQtVersion *> alreadyDeleted;
- foreach (const BuildConfigurationInfo &info, m_importInfos) {
- if (info.temporaryQtVersion) {
- if (!alreadyDeleted.contains(info.temporaryQtVersion)) {
- alreadyDeleted << info.temporaryQtVersion;
- delete info.temporaryQtVersion;
+ QFileInfo fi = path.toFileInfo();
+ if (!fi.exists() && !fi.isDir())
+ return;
+
+ QStringList makefiles = QDir(path.toString()).entryList(QStringList(QLatin1String("Makefile*")));
+
+ QtSupport::BaseQtVersion *version = 0;
+ bool temporaryVersion = false;
+ ProjectExplorer::Profile *profile = 0;
+
+ QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
+ ProjectExplorer::ProfileManager *pm = ProjectExplorer::ProfileManager::instance();
+ bool found = false;
+
+ foreach (const QString &file, makefiles) {
+ // find interesting makefiles
+ QString makefile = path.toString() + QLatin1Char('/') + file;
+ Utils::FileName qmakeBinary = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
+ if (qmakeBinary.isEmpty())
+ continue;
+ if (QtSupport::QtVersionManager::makefileIsFor(makefile, m_proFilePath) != QtSupport::QtVersionManager::SameProject)
+ continue;
+
+ // Find version:
+ version = vm->qtVersionForQMakeBinary(qmakeBinary);
+ if (!version) {
+ version = QtSupport::QtVersionFactory::createQtVersionFromQMakePath(qmakeBinary);
+ if (!version)
+ continue;
+
+ vm->addVersion(version);
+ temporaryVersion = true;
+ }
+
+ // find qmake arguments and mkspec
+ QPair<QtSupport::BaseQtVersion::QmakeBuildConfigs, QString> makefileBuildConfig =
+ QtSupport::QtVersionManager::scanMakeFile(makefile, version->defaultBuildConfig());
+
+ QString additionalArguments = makefileBuildConfig.second;
+ Utils::FileName parsedSpec =
+ Qt4BuildConfiguration::extractSpecFromArguments(&additionalArguments, path.toString(), version);
+ Utils::FileName versionSpec = version->mkspec();
+
+ QString specArgument;
+ // Compare mkspecs and add to additional arguments
+ if (parsedSpec.isEmpty() || parsedSpec == versionSpec
+ || parsedSpec == Utils::FileName::fromString(QLatin1String("default"))) {
+ // using the default spec, don't modify additional arguments
+ } else {
+ specArgument = QLatin1String("-spec ") + Utils::QtcProcess::quoteArg(parsedSpec.toUserOutput());
+ }
+ Utils::QtcProcess::addArgs(&specArgument, additionalArguments);
+
+ // Find profile:
+ foreach (ProjectExplorer::Profile *p, pm->profiles()) {
+ QtSupport::BaseQtVersion *profileVersion = QtSupport::QtProfileInformation::qtVersion(p);
+ Utils::FileName profileSpec = QmakeProfileInformation::mkspec(p);
+ if (profileVersion == version
+ && profileSpec == parsedSpec) {
+ Q_ASSERT(!temporaryVersion);
+ profile = p;
}
}
+ if (!profile) {
+ profile = new ProjectExplorer::Profile;
+ profile->setDisplayName(version->displayName());
+ QtSupport::QtProfileInformation::setQtVersion(profile, version);
+ QmakeProfileInformation::setMkspec(profile, parsedSpec);
+ ProjectExplorer::ToolChainProfileInformation::setToolChain(profile,
+ version->preferredToolChain(parsedSpec));
+
+ profile->setValue(PROFILE_IS_TEMPORARY, true);
+ profile->setValue(TEMPORARY_OF_PROJECTS, QStringList() << m_proFilePath);
+ if (temporaryVersion)
+ profile->setValue(QT_IS_TEMPORARY, version->uniqueId());
+
+ pm->registerProfile(profile);
+ } else if (profile->hasValue(PROFILE_IS_TEMPORARY)) {
+ QStringList profiles = profile->value(TEMPORARY_OF_PROJECTS, QStringList()).toStringList();
+ Q_ASSERT(!profiles.contains(m_proFilePath));
+ profiles.append(m_proFilePath);
+ profile->setValue(PROFILE_IS_TEMPORARY, profiles);
+ }
+
+ // Create widget:
+ Qt4TargetSetupWidget *widget = m_widgets.value(profile->id(), 0);
+ if (!widget)
+ addWidget(profile);
+ widget = m_widgets.value(profile->id(), 0);
+ if (!widget)
+ continue;
+
+ // create info:
+ BuildConfigurationInfo info = BuildConfigurationInfo(makefileBuildConfig.first,
+ specArgument,
+ path.toString(),
+ true,
+ file);
+
+ widget->addBuildConfigurationInfo(info, true);
+ widget->setTargetSelected(true);
+ found = true;
}
- m_importInfos.clear();
+
+ updateVisibility();
+
+ if (!found && !silent)
+ QMessageBox::critical(this,
+ tr("No Build Found"),
+ tr("No build found in %1 matching project %2.").arg(path.toUserOutput()).arg(m_proFilePath));
}
-void TargetSetupPage::newImportBuildConfiguration(const BuildConfigurationInfo &info)
+void TargetSetupPage::handleQtUpdate(const QList<int> &add, const QList<int> &rm, const QList<int> &mod)
{
- m_importInfos.append(info);
+ Q_UNUSED(add);
+ // Update Profile to no longer claim a Qt version is temporary once it is modified/removed.
+ foreach (ProjectExplorer::Profile *p, ProjectExplorer::ProfileManager::instance()->profiles()) {
+ if (!p->hasValue(QT_IS_TEMPORARY))
+ continue;
+ int qtVersion = p->value(QT_IS_TEMPORARY, -1).toInt();
+ if (rm.contains(qtVersion) || mod.contains(qtVersion))
+ p->removeKey(QT_IS_TEMPORARY);
+ }
}
-void TargetSetupPage::qtVersionsChanged(const QList<int> &added, const QList<int> &removed, const QList<int> &changed)
+void TargetSetupPage::setupImports()
{
- Q_UNUSED(added)
- if (m_ignoreQtVersionChange)
+ if (!m_importSearch || m_proFilePath.isEmpty())
return;
- QMap<Core::Id, Qt4TargetSetupWidget *>::iterator it, end;
- end = m_widgets.end();
- it = m_widgets.begin();
- for ( ; it != end; ++it) {
- Qt4BaseTargetFactory *factory = m_factories.value(it.value());
- it.value()->updateBuildConfigurationInfos(factory->availableBuildConfigurations(it.key(),
- m_proFilePath,
- m_minimumQtVersionNumber,
- m_maximumQtVersionNumber,
- m_requiredQtFeatures));
- }
- QtSupport::QtVersionManager *mgr = QtSupport::QtVersionManager::instance();
- for (int i = 0; i < m_importInfos.size(); ++i) {
- if (QtSupport::BaseQtVersion *tmpVersion = m_importInfos[i].temporaryQtVersion) {
- // Check whether we have a qt version now
- QtSupport::BaseQtVersion *version =
- mgr->qtVersionForQMakeBinary(tmpVersion->qmakeCommand());
- if (version)
- replaceTemporaryQtVersion(tmpVersion, version->uniqueId());
- } else {
- // Check whether we need to replace the qt version id
- int oldId = m_importInfos[i].qtVersionId;
- if (removed.contains(oldId) || changed.contains(oldId)) {
- QString makefile = m_importInfos[i].directory + QLatin1Char('/') + m_importInfos[i].makefile;
- Utils::FileName qmakeBinary = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
- QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::instance()->qtVersionForQMakeBinary(qmakeBinary);
- if (version) {
- replaceQtVersionWithQtVersion(oldId, version->uniqueId());
- } else {
- version = QtSupport::QtVersionFactory::createQtVersionFromQMakePath(qmakeBinary);
- replaceQtVersionWithTemporaryQtVersion(oldId, version);
- }
- }
+ QString sourceDir = QFileInfo(m_proFilePath).absolutePath();
+ import(Utils::FileName::fromString(sourceDir), true);
+
+ QList<ProjectExplorer::Profile *> profiles = ProjectExplorer::ProfileManager::instance()->profiles();
+ foreach (ProjectExplorer::Profile *p, profiles) {
+ QFileInfo fi(Qt4Project::shadowBuildDirectory(m_proFilePath, p, QString()));
+ const QString baseDir = fi.absolutePath();
+ const QString prefix = fi.baseName();
+
+ foreach (const QString &dir, QDir(baseDir).entryList()) {
+ if (dir.startsWith(prefix))
+ import(Utils::FileName::fromString(baseDir + QLatin1Char('/') + dir), true);
}
}
}
-void TargetSetupPage::replaceQtVersionWithQtVersion(int oldId, int newId)
+void TargetSetupPage::handleProfileAddition(ProjectExplorer::Profile *p)
{
- for (int i = 0; i < m_importInfos.size(); ++i) {
- if (m_importInfos[i].qtVersionId == oldId) {
- m_importInfos[i].qtVersionId = newId;
- }
- }
- QMap<Core::Id, Qt4TargetSetupWidget *>::const_iterator it, end;
- it = m_widgets.constBegin();
- end = m_widgets.constEnd();
- for ( ; it != end; ++it)
- (*it)->replaceQtVersionWithQtVersion(oldId, newId);
+ Q_ASSERT(!m_widgets.contains(p->id()));
+ addWidget(p);
+ updateVisibility();
}
-void TargetSetupPage::replaceQtVersionWithTemporaryQtVersion(int id, QtSupport::BaseQtVersion *version)
+void TargetSetupPage::handleProfileRemoval(ProjectExplorer::Profile *p)
{
- for (int i = 0; i < m_importInfos.size(); ++i) {
- if (m_importInfos[i].qtVersionId == id) {
- m_importInfos[i].temporaryQtVersion = version;
- m_importInfos[i].qtVersionId = -1;
+ QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
+ QtSupport::BaseQtVersion *version = vm->version(p->value(QT_IS_TEMPORARY, -1).toInt());
+ if (version)
+ vm->removeVersion(version);
+
+ removeWidget(p);
+ updateVisibility();
+}
+
+void TargetSetupPage::handleProfileUpdate(ProjectExplorer::Profile *p)
+{
+ p->removeKey(PROFILE_IS_TEMPORARY);
+ p->removeKey(QT_IS_TEMPORARY);
+ p->removeKey(TEMPORARY_OF_PROJECTS);
+
+ Qt4TargetSetupWidget *widget = m_widgets.value(p->id());
+
+ bool acceptable = true;
+ if (m_requiredMatcher && !m_requiredMatcher->matches(p))
+ acceptable = false;
+
+ if (widget && !acceptable)
+ removeWidget(p);
+ else if (!widget && acceptable)
+ addWidget(p);
+
+ updateVisibility();
+}
+
+void TargetSetupPage::selectAtLeastOneTarget()
+{
+ bool atLeastOneTargetSelected = false;
+ foreach (Qt4TargetSetupWidget *w, m_widgets.values()) {
+ if (w->isTargetSelected()) {
+ atLeastOneTargetSelected = true;
+ break;
}
}
- QMap<Core::Id, Qt4TargetSetupWidget *>::const_iterator it, end;
- it = m_widgets.constBegin();
- end = m_widgets.constEnd();
- for ( ; it != end; ++it)
- (*it)->replaceQtVersionWithTemporaryQtVersion(id, version);
+
+ if (!atLeastOneTargetSelected) {
+ Qt4TargetSetupWidget *widget = m_firstWidget;
+ ProjectExplorer::Profile *defaultProfile = ProjectExplorer::ProfileManager::instance()->defaultProfile();
+ widget = m_widgets.value(defaultProfile->id(), m_firstWidget);
+ if (widget)
+ widget->setTargetSelected(true);
+ m_firstWidget = 0;
+ }
+ emit completeChanged(); // Is this necessary?
}
-void TargetSetupPage::replaceTemporaryQtVersion(QtSupport::BaseQtVersion *version, int id)
+void TargetSetupPage::updateVisibility()
{
- for (int i = 0; i < m_importInfos.size(); ++i) {
- if (m_importInfos[i].temporaryQtVersion == version) {
- m_importInfos[i].temporaryQtVersion = 0;
- m_importInfos[i].qtVersionId = id;
- }
+ if (m_widgets.isEmpty()) {
+ // Oh no one can create any targets
+ m_ui->scrollAreaWidget->setVisible(false);
+ m_ui->centralWidget->setVisible(false);
+ m_ui->descriptionLabel->setVisible(false);
+ m_ui->noValidProfileLabel->setVisible(true);
+ } else {
+ m_ui->scrollAreaWidget->setVisible(m_baseLayout == m_ui->scrollArea->widget()->layout());
+ m_ui->centralWidget->setVisible(m_baseLayout == m_ui->centralWidget->layout());
+ m_ui->descriptionLabel->setVisible(true);
+ m_ui->noValidProfileLabel->setVisible(false);
}
- QMap<Core::Id, Qt4TargetSetupWidget *>::const_iterator it, end;
- it = m_widgets.constBegin();
- end = m_widgets.constEnd();
- for ( ; it != end; ++it)
- (*it)->replaceTemporaryQtVersionWithQtVersion(version, id);
+
+ emit completeChanged();
+}
+
+void TargetSetupPage::removeWidget(ProjectExplorer::Profile *p)
+{
+ Qt4TargetSetupWidget *widget = m_widgets.value(p->id());
+ if (!widget)
+ return;
+ if (widget == m_firstWidget)
+ m_firstWidget = 0;
+ widget->deleteLater();
+ m_widgets.remove(p->id());
+}
+
+Qt4TargetSetupWidget *TargetSetupPage::addWidget(ProjectExplorer::Profile *p)
+{
+ if (m_requiredMatcher && !m_requiredMatcher->matches(p))
+ return 0;
+
+ QList<BuildConfigurationInfo> infoList = Qt4BuildConfigurationFactory::availableBuildConfigurations(p, m_proFilePath);
+ Qt4TargetSetupWidget *widget = infoList.isEmpty() ? 0 : new Qt4TargetSetupWidget(p, m_proFilePath, infoList);
+ if (!widget)
+ return 0;
+
+ m_baseLayout->removeWidget(m_importWidget);
+ m_baseLayout->removeItem(m_spacer);
+
+ widget->setTargetSelected(m_preferredMatcher && m_preferredMatcher->matches(p));
+ m_widgets.insert(p->id(), widget);
+ m_baseLayout->addWidget(widget);
+
+ m_baseLayout->addWidget(m_importWidget);
+ m_baseLayout->addItem(m_spacer);
+
+ connect(widget, SIGNAL(selectedToggled()),
+ this, SIGNAL(completeChanged()));
+
+ if (!m_firstWidget)
+ m_firstWidget = widget;
+
+ return widget;
}
bool TargetSetupPage::setupProject(Qt4ProjectManager::Qt4Project *project)
{
- m_ignoreQtVersionChange = true;
- QtSupport::QtVersionManager *mgr = QtSupport::QtVersionManager::instance();
- QMap<Core::Id, Qt4TargetSetupWidget *>::const_iterator it, end;
- end = m_widgets.constEnd();
- it = m_widgets.constBegin();
-
- QSet<QtSupport::BaseQtVersion *> temporaryQtVersions;
- for ( ; it != end; ++it)
- foreach (QtSupport::BaseQtVersion *tempVersion, it.value()->usedTemporaryQtVersions())
- temporaryQtVersions.insert(tempVersion);
-
- foreach (QtSupport::BaseQtVersion *tempVersion, temporaryQtVersions) {
- QtSupport::BaseQtVersion *version = mgr->qtVersionForQMakeBinary(tempVersion->qmakeCommand());
- if (version) {
- replaceTemporaryQtVersion(tempVersion, version->uniqueId());
- delete tempVersion;
- } else {
- mgr->addVersion(tempVersion);
- replaceTemporaryQtVersion(tempVersion, tempVersion->uniqueId());
- }
- }
+ foreach (Qt4TargetSetupWidget *widget, m_widgets.values()) {
+ if (!widget->isTargetSelected())
+ continue;
+
+ ProjectExplorer::Profile *p = widget->profile();
- m_ignoreQtVersionChange = false;
+ // Persist profile:
+ p->removeKey(PROFILE_IS_TEMPORARY);
+ p->removeKey(QT_IS_TEMPORARY);
+ p->removeKey(TEMPORARY_OF_PROJECTS);
- it = m_widgets.constBegin();
- for ( ; it != end; ++it) {
- Qt4BaseTargetFactory *factory = m_factories.value(it.value());
- if (ProjectExplorer::Target *target = factory->create(project, it.key(), it.value()))
- project->addTarget(target);
+ project->addTarget(project->createTarget(p, widget->selectedBuildConfigurationInfoList()));
}
// Select active target
@@ -412,9 +507,10 @@ bool TargetSetupPage::setupProject(Qt4ProjectManager::Qt4Project *project)
ProjectExplorer::Target *activeTarget = 0;
QList<ProjectExplorer::Target *> targets = project->targets();
foreach (ProjectExplorer::Target *t, targets) {
- if (t->id() == Core::Id(Constants::QT_SIMULATOR_TARGET_ID))
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(t->profile());
+ if (version && version->type() == QLatin1String(QtSupport::Constants::SIMULATORQT))
activeTarget = t;
- else if (!activeTarget && t->id() == Core::Id(Constants::DESKTOP_TARGET_ID))
+ else if (!activeTarget && version && version->type() == QLatin1String(QtSupport::Constants::DESKTOPQT))
activeTarget = t;
}
if (!activeTarget && !targets.isEmpty())
@@ -427,5 +523,7 @@ bool TargetSetupPage::setupProject(Qt4ProjectManager::Qt4Project *project)
void TargetSetupPage::setUseScrollArea(bool b)
{
- m_useScrollArea = b;
+ m_baseLayout = b ? m_ui->scrollArea->widget()->layout() : m_ui->centralWidget->layout();
+ m_ui->scrollAreaWidget->setVisible(b);
+ m_ui->centralWidget->setVisible(!b);
}
diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.h b/src/plugins/qt4projectmanager/wizards/targetsetuppage.h
index 1ff858eb79..6658fd4d47 100644
--- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.h
+++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.h
@@ -33,33 +33,26 @@
#ifndef TARGETSETUPPAGE_H
#define TARGETSETUPPAGE_H
-#include "../qt4target.h"
#include "../qt4projectmanager_global.h"
-#include <qtsupport/qtversionmanager.h>
+#include "../qt4targetsetupwidget.h"
+
#include <coreplugin/featureprovider.h>
+#include <projectexplorer/profilemanager.h>
+#include <qtsupport/qtversionmanager.h>
#include <QString>
-#include <QWizard>
-
-
-QT_BEGIN_NAMESPACE
-class QLabel;
-class QMenu;
-class QPushButton;
-class QSpacerItem;
-class QTreeWidget;
-class QTreeWidgetItem;
-class QVBoxLayout;
-QT_END_NAMESPACE
+#include <QWizardPage>
namespace Qt4ProjectManager {
class Qt4Project;
namespace Internal {
+class ImportWidget;
+
namespace Ui {
class TargetSetupPage;
-}
-}
+} // namespace Ui
+} // namespace Internal
/// \internal
class QT4PROJECTMANAGER_EXPORT TargetSetupPage : public QWizardPage
@@ -73,25 +66,10 @@ public:
/// Initializes the TargetSetupPage
/// \note The import information is gathered in initializePage(), make sure that the right proFilePath is set before
void initializePage();
- /// Changes the default set of checked targets.
- /// call this before \sa initializePage()
- void setPreferredFeatures(const QSet<QString> &featureIds);
- /// Sets the features a target must support
- /// call this before \sa initializePage()
- void setRequiredTargetFeatures(const QSet<QString> &featureIds);
- /// Sets the features a qt version must support
- /// call this before \sa initializePage()
- void setRequiredQtFeatures(const Core::FeatureSet &features);
- /// Sets the platform that was selected in the wizard
- void setSelectedPlatform(const QString &platform);
- /// Sets the minimum qt version
- /// calls this before \sa initializePage()
- void setMinimumQtVersion(const QtSupport::QtVersionNumber &number);
- /// Sets the maximum qt version
- /// calls this before \sa initializePage()
- void setMaximumQtVersion(const QtSupport::QtVersionNumber &number);
- /// Sets whether the TargetSetupPage looks on disk for builds of this project
- /// call this before \sa initializePage()
+
+ // Call these before initializePage!
+ void setRequiredProfileMatcher(ProjectExplorer::ProfileMatcher *matcher);
+ void setPreferredProfileMatcher(ProjectExplorer::ProfileMatcher *matcher);
void setImportSearch(bool b);
/// Sets whether the targetsetupage uses a scrollarea
@@ -101,7 +79,9 @@ public:
bool isComplete() const;
bool setupProject(Qt4ProjectManager::Qt4Project *project);
- bool isTargetSelected(Core::Id id) const;
+ bool isProfileSelected(Core::Id id) const;
+ void setProfileSelected(Core::Id id, bool selected);
+ bool isQtPlatformSelected(const QString &type) const;
void setProFilePath(const QString &dir);
/// Overrides the summary text of the targetsetuppage
@@ -110,35 +90,38 @@ signals:
void noteTextLinkActivated();
private slots:
- void newImportBuildConfiguration(const BuildConfigurationInfo &info);
- void qtVersionsChanged(const QList<int> &added, const QList<int> &removed, const QList<int> &changed);
+ void import(const Utils::FileName &path);
+ void handleQtUpdate(const QList<int> &add, const QList<int> &rm, const QList<int> &mod);
+ void handleProfileAddition(ProjectExplorer::Profile *p);
+ void handleProfileRemoval(ProjectExplorer::Profile *p);
+ void handleProfileUpdate(ProjectExplorer::Profile *p);
+ void updateVisibility();
private:
- void setupImportInfos();
- void cleanupImportInfos();
- void replaceQtVersionWithQtVersion(int oldId, int newId);
- void replaceTemporaryQtVersion(QtSupport::BaseQtVersion *version, int id);
- void replaceQtVersionWithTemporaryQtVersion(int id, QtSupport::BaseQtVersion *version);
+ void selectAtLeastOneTarget();
+ void import(const Utils::FileName &path, const bool silent);
+ void removeWidget(ProjectExplorer::Profile *p);
+ Qt4TargetSetupWidget *addWidget(ProjectExplorer::Profile *p);
+
+ void setupImports();
+
void setupWidgets();
- void deleteWidgets();
+ void reset();
- QSet<QString> m_preferredFeatures;
- QSet<QString> m_requiredTargetFeatures;
- Core::FeatureSet m_requiredQtFeatures;
- QString m_selectedPlatform;
+ ProjectExplorer::ProfileMatcher *m_requiredMatcher;
+ ProjectExplorer::ProfileMatcher *m_preferredMatcher;
+ QLayout *m_baseLayout;
bool m_importSearch;
bool m_useScrollArea;
- QtSupport::QtVersionNumber m_minimumQtVersionNumber;
- QtSupport::QtVersionNumber m_maximumQtVersionNumber;
QString m_proFilePath;
QString m_defaultShadowBuildLocation;
QMap<Core::Id, Qt4TargetSetupWidget *> m_widgets;
- QHash<Qt4TargetSetupWidget *, Qt4BaseTargetFactory *> m_factories;
+ Qt4TargetSetupWidget *m_firstWidget;
- QSpacerItem *m_spacer;
- bool m_ignoreQtVersionChange;
Internal::Ui::TargetSetupPage *m_ui;
- QList<BuildConfigurationInfo> m_importInfos; // This owns the temporary qt versions
+
+ Internal::ImportWidget *m_importWidget;
+ QSpacerItem *m_spacer;
};
} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.ui b/src/plugins/qt4projectmanager/wizards/targetsetuppage.ui
index 5a47515cce..b1f9009f57 100644
--- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.ui
+++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>230</width>
- <height>218</height>
+ <width>256</width>
+ <height>297</height>
</rect>
</property>
<property name="sizePolicy">
@@ -20,15 +20,18 @@
<string>Set up Targets for Your Project</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
- <property name="margin">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="setupTargetPage" native="true">
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="margin">
- <number>0</number>
- </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="descriptionLabel">
<property name="sizePolicy">
@@ -49,9 +52,9 @@
</widget>
</item>
<item>
- <widget class="QLabel" name="noValidQtVersionsLabel">
+ <widget class="QLabel" name="noValidProfileLabel">
<property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;No valid Qt versions found.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Please add a Qt version in &lt;span style=&quot; font-style:italic;&quot;&gt;Tools &amp;gt; Options &amp;gt; Build &amp;amp; Run&lt;/span&gt; (&lt;span style=&quot; font-style:italic;&quot;&gt;Qt Creator &amp;gt; Preferences &amp;gt; Build &amp;amp; Run&lt;/span&gt; on Mac OS) or via the maintenance tool of the SDK.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;No valid Profiles found.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Please add a profile in &lt;span style=&quot; font-style:italic;&quot;&gt;Tools &amp;gt; Options &amp;gt; Build &amp;amp; Run&lt;/span&gt; (&lt;span style=&quot; font-style:italic;&quot;&gt;Qt Creator &amp;gt; Preferences &amp;gt; Build &amp;amp; Run&lt;/span&gt; on Mac OS) or via the maintenance tool of the SDK.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -69,20 +72,32 @@
</widget>
</item>
<item>
- <widget class="QScrollArea" name="scrollArea">
- <property name="widgetResizable">
- <bool>true</bool>
- </property>
- <widget class="QWidget" name="scrollAreaWidgetContents">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>224</width>
- <height>66</height>
- </rect>
+ <widget class="QWidget" name="scrollAreaWidget" native="true">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
</property>
- </widget>
+ <item>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>242</width>
+ <height>147</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
</layout>
diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp
index 5fdcb0241a..751436eb36 100644
--- a/src/plugins/qtsupport/baseqtversion.cpp
+++ b/src/plugins/qtsupport/baseqtversion.cpp
@@ -34,12 +34,14 @@
#include "qmlobservertool.h"
#include "qmldumptool.h"
#include "qmldebugginglibrary.h"
+#include "qtprofileinformation.h"
#include "qtversionmanager.h"
#include "profilereader.h"
#include <projectexplorer/toolchainmanager.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/gnumakeparser.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/toolchainmanager.h>
@@ -292,6 +294,28 @@ bool BaseQtVersion::supportsPlatform(const QString &platform) const
return platform == platformName();
}
+QList<ProjectExplorer::Task> BaseQtVersion::validateProfile(const ProjectExplorer::Profile *p)
+{
+ QList<ProjectExplorer::Task> result;
+
+ BaseQtVersion *version = QtProfileInformation::qtVersion(p);
+ Q_ASSERT(version == this);
+
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(p);
+ if (!tc)
+ result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
+ QCoreApplication::translate("BaseQtVersion", "No tool chain set up in profile."),
+ Utils::FileName(), -1,
+ Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
+
+ if (tc && !version->qtAbis().contains(tc->targetAbi()))
+ result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
+ QCoreApplication::translate("BaseQtVersion", "Tool chain can not produce code for the Qt version."),
+ Utils::FileName(), -1,
+ Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
+ return result;
+}
+
void BaseQtVersion::setId(int id)
{
m_id = id;
@@ -366,20 +390,24 @@ QString BaseQtVersion::warningReason() const
return QString();
}
-Utils::FileName BaseQtVersion::qmakeCommand() const
+ProjectExplorer::ToolChain *BaseQtVersion::preferredToolChain(const Utils::FileName &ms) const
{
- return m_qmakeCommand;
+ const Utils::FileName spec = ms.isEmpty() ? mkspec() : ms;
+ QList<ProjectExplorer::ToolChain *> tcList = ProjectExplorer::ToolChainManager::instance()->toolChains();
+ ProjectExplorer::ToolChain *possibleTc = 0;
+ foreach (ProjectExplorer::ToolChain *tc, tcList) {
+ if (!qtAbis().contains(tc->targetAbi()))
+ continue;
+ if (tc->suggestedMkspecList().contains(spec))
+ return tc; // perfect match
+ possibleTc = tc; // possible match
+ }
+ return possibleTc;
}
-bool BaseQtVersion::toolChainAvailable(const Core::Id id) const
+Utils::FileName BaseQtVersion::qmakeCommand() const
{
- Q_UNUSED(id)
- if (!isValid())
- return false;
- foreach (const ProjectExplorer::Abi &abi, qtAbis())
- if (!ProjectExplorer::ToolChainManager::instance()->findToolChains(abi).isEmpty())
- return true;
- return false;
+ return m_qmakeCommand;
}
QList<ProjectExplorer::Abi> BaseQtVersion::qtAbis() const
@@ -655,11 +683,6 @@ QString BaseQtVersion::uicCommand() const
return m_uicCommand;
}
-QString BaseQtVersion::systemRoot() const
-{
- return QString();
-}
-
void BaseQtVersion::updateMkspec() const
{
if (uniqueId() == -1 || m_mkspecUpToDate)
@@ -906,15 +929,17 @@ QString BaseQtVersion::examplesPath() const
return m_versionInfo.value(QLatin1String("QT_INSTALL_EXAMPLES"));
}
-QList<ProjectExplorer::HeaderPath> BaseQtVersion::systemHeaderPathes() const
+QList<ProjectExplorer::HeaderPath> BaseQtVersion::systemHeaderPathes(const ProjectExplorer::Profile *p) const
{
+ Q_UNUSED(p);
QList<ProjectExplorer::HeaderPath> result;
result.append(ProjectExplorer::HeaderPath(mkspecPath().toString(), ProjectExplorer::HeaderPath::GlobalHeaderPath));
return result;
}
-void BaseQtVersion::addToEnvironment(Utils::Environment &env) const
+void BaseQtVersion::addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const
{
+ Q_UNUSED(p);
env.set(QLatin1String("QTDIR"), QDir::toNativeSeparators(versionInfo().value(QLatin1String("QT_INSTALL_DATA"))));
env.prependOrSetPath(versionInfo().value(QLatin1String("QT_INSTALL_BINS")));
}
@@ -960,7 +985,9 @@ Utils::Environment BaseQtVersion::qmlToolsEnvironment() const
{
// FIXME: This seems broken!
Utils::Environment environment = Utils::Environment::systemEnvironment();
+#if 0 // FIXME: Fix this!
addToEnvironment(environment);
+#endif
// add preferred tool chain, as that is how the tools are built, compare QtVersion::buildDebuggingHelperLibrary
if (!qtAbis().isEmpty()) {
@@ -1032,7 +1059,7 @@ bool BaseQtVersion::supportsShadowBuilds() const
return true;
}
-QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proFile, const QString &buildDir)
+QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proFile, const QString &buildDir) const
{
QList<ProjectExplorer::Task> results;
@@ -1078,7 +1105,7 @@ QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proF
}
QList<ProjectExplorer::Task>
-BaseQtVersion::reportIssues(const QString &proFile, const QString &buildDir)
+BaseQtVersion::reportIssues(const QString &proFile, const QString &buildDir) const
{
QList<ProjectExplorer::Task> results = reportIssuesImpl(proFile, buildDir);
qSort(results);
diff --git a/src/plugins/qtsupport/baseqtversion.h b/src/plugins/qtsupport/baseqtversion.h
index 049b842c8e..1606fd8963 100644
--- a/src/plugins/qtsupport/baseqtversion.h
+++ b/src/plugins/qtsupport/baseqtversion.h
@@ -51,6 +51,8 @@ class Environment;
namespace ProjectExplorer {
class IOutputParser;
+class Profile;
+class ToolChain;
} // namespace ProjectExplorer
QT_BEGIN_NAMESPACE
@@ -121,19 +123,17 @@ public:
virtual QString invalidReason() const;
virtual QString warningReason() const;
- virtual bool toolChainAvailable(const Core::Id id) const;
+ virtual ProjectExplorer::ToolChain *preferredToolChain(const Utils::FileName &ms) const;
virtual QString description() const = 0;
virtual QString toHtml(bool verbose) const;
- virtual bool supportsTargetId(const Core::Id id) const = 0;
- virtual QSet<Core::Id> supportedTargetIds() const = 0;
QList<ProjectExplorer::Abi> qtAbis() const;
virtual QList<ProjectExplorer::Abi> detectQtAbis() const = 0;
// Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information
virtual QHash<QString,QString> versionInfo() const;
- virtual void addToEnvironment(Utils::Environment &env) const;
+ virtual void addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const;
virtual Utils::FileName sourcePath() const;
// used by QtUiCodeModelSupport
@@ -154,12 +154,11 @@ public:
bool hasDemos() const;
QString demosPath() const;
- virtual QList<ProjectExplorer::HeaderPath> systemHeaderPathes() const;
+ virtual QList<ProjectExplorer::HeaderPath> systemHeaderPathes(const ProjectExplorer::Profile *p) const;
virtual QString frameworkInstallPath() const;
// former local functions
Utils::FileName qmakeCommand() const;
- virtual QString systemRoot() const;
/// @returns the name of the mkspec
Utils::FileName mkspec() const;
@@ -185,7 +184,7 @@ public:
/// Check a .pro-file/Qt version combination on possible issues
/// @return a list of tasks, ordered on severity (errors first, then
/// warnings and finally info items.
- QList<ProjectExplorer::Task> reportIssues(const QString &proFile, const QString &buildDir);
+ QList<ProjectExplorer::Task> reportIssues(const QString &proFile, const QString &buildDir) const;
virtual ProjectExplorer::IOutputParser *createOutputParser() const;
@@ -221,11 +220,13 @@ public:
virtual QString platformDisplayName() const;
virtual bool supportsPlatform(const QString &platformName) const;
+ virtual QList<ProjectExplorer::Task> validateProfile(const ProjectExplorer::Profile *p);
+
protected:
BaseQtVersion();
BaseQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString());
- virtual QList<ProjectExplorer::Task> reportIssuesImpl(const QString &proFile, const QString &buildDir);
+ virtual QList<ProjectExplorer::Task> reportIssuesImpl(const QString &proFile, const QString &buildDir) const;
// helper function for desktop and simulator to figure out the supported abis based on the libraries
static Utils::FileName qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString);
diff --git a/src/plugins/qtsupport/customexecutablerunconfiguration.cpp b/src/plugins/qtsupport/customexecutablerunconfiguration.cpp
index ddd678155c..bca770ac66 100644
--- a/src/plugins/qtsupport/customexecutablerunconfiguration.cpp
+++ b/src/plugins/qtsupport/customexecutablerunconfiguration.cpp
@@ -35,6 +35,7 @@
#include "debugginghelper.h"
#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <projectexplorer/abi.h>
@@ -352,18 +353,16 @@ ProjectExplorer::Abi CustomExecutableRunConfiguration::abi() const
CustomExecutableRunConfigurationFactory::CustomExecutableRunConfigurationFactory(QObject *parent) :
ProjectExplorer::IRunConfigurationFactory(parent)
-{
-}
+{ setObjectName(QLatin1String("CustomExecutableRunConfigurationFactory")); }
CustomExecutableRunConfigurationFactory::~CustomExecutableRunConfigurationFactory()
-{
-
-}
+{ }
bool CustomExecutableRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent,
const Core::Id id) const
{
- Q_UNUSED(parent);
+ if (!canHandle(parent))
+ return false;
return id == Core::Id(CUSTOM_EXECUTABLE_ID);
}
@@ -379,6 +378,8 @@ CustomExecutableRunConfigurationFactory::create(ProjectExplorer::Target *parent,
bool CustomExecutableRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent,
const QVariantMap &map) const
{
+ if (!canHandle(parent))
+ return false;
Core::Id id(ProjectExplorer::idFromMap(map));
return canCreate(parent, id);
}
@@ -410,9 +411,15 @@ CustomExecutableRunConfigurationFactory::clone(ProjectExplorer::Target *parent,
return new CustomExecutableRunConfiguration(parent, static_cast<CustomExecutableRunConfiguration*>(source));
}
+bool CustomExecutableRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const
+{
+ return parent->project()->supportsProfile(parent->profile());
+}
+
QList<Core::Id> CustomExecutableRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
{
- Q_UNUSED(parent)
+ if (!canHandle(parent))
+ return QList<Core::Id>();
return QList<Core::Id>() << Core::Id(CUSTOM_EXECUTABLE_ID);
}
diff --git a/src/plugins/qtsupport/customexecutablerunconfiguration.h b/src/plugins/qtsupport/customexecutablerunconfiguration.h
index 17542ba38b..ca20068dcf 100644
--- a/src/plugins/qtsupport/customexecutablerunconfiguration.h
+++ b/src/plugins/qtsupport/customexecutablerunconfiguration.h
@@ -148,6 +148,8 @@ public:
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const;
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent,
ProjectExplorer::RunConfiguration *source);
+
+ bool canHandle(ProjectExplorer::Target *parent) const;
};
} // namespace QtSupport
diff --git a/src/plugins/qtsupport/debugginghelperbuildtask.cpp b/src/plugins/qtsupport/debugginghelperbuildtask.cpp
index bf7c7ae1f9..ae3e1e26f0 100644
--- a/src/plugins/qtsupport/debugginghelperbuildtask.cpp
+++ b/src/plugins/qtsupport/debugginghelperbuildtask.cpp
@@ -88,7 +88,9 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version,
}
m_environment = Utils::Environment::systemEnvironment();
+#if 0 // FIXME: Reenable this!
version->addToEnvironment(m_environment);
+#endif
toolChain->addToEnvironment(m_environment);
diff --git a/src/plugins/qtsupport/qtprofileconfigwidget.cpp b/src/plugins/qtsupport/qtprofileconfigwidget.cpp
new file mode 100644
index 0000000000..4130fe0b58
--- /dev/null
+++ b/src/plugins/qtsupport/qtprofileconfigwidget.cpp
@@ -0,0 +1,173 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "qtprofileconfigwidget.h"
+
+#include "qtsupportconstants.h"
+#include "qtprofileinformation.h"
+#include "qtversionmanager.h"
+
+#include <coreplugin/icore.h>
+#include <projectexplorer/projectexplorerconstants.h>
+
+#include <utils/qtcassert.h>
+
+#include <QComboBox>
+#include <QHBoxLayout>
+#include <QPushButton>
+
+namespace QtSupport {
+namespace Internal {
+
+QtProfileConfigWidget::QtProfileConfigWidget(ProjectExplorer::Profile *p,
+ QWidget *parent) :
+ ProjectExplorer::ProfileConfigWidget(parent),
+ m_profile(p),
+ m_combo(new QComboBox),
+ m_manageButton(new QPushButton)
+{
+ QHBoxLayout *layout = new QHBoxLayout(this);
+ layout->setMargin(0);
+
+ m_combo->setContentsMargins(0, 0, 0, 0);
+ m_combo->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
+ layout->addWidget(m_combo);
+
+ m_manageButton->setContentsMargins(0, 0, 0, 0);
+ m_manageButton->setText(tr("Manage..."));
+ layout->addWidget(m_manageButton);
+
+ QtVersionManager *mgr = QtVersionManager::instance();
+
+ // initially populate combobox:
+ m_combo->addItem(tr("None"), -1);
+ QList<BaseQtVersion *> versions = mgr->validVersions();
+ QList<int> versionIds;
+ foreach (BaseQtVersion *v, versions)
+ versionIds.append(v->uniqueId());
+ versionsChanged(versionIds, QList<int>(), QList<int>());
+
+ discard();
+ connect(m_combo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dirty()));
+
+ connect(mgr, SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
+ this, SLOT(versionsChanged(QList<int>,QList<int>,QList<int>)));
+ connect(ProjectExplorer::ProfileManager::instance(), SIGNAL(profileUpdated(ProjectExplorer::Profile*)),
+ this, SLOT(profileUpdated(ProjectExplorer::Profile*)));
+
+ connect(m_manageButton, SIGNAL(clicked()), this, SLOT(manageQtVersions()));
+}
+
+QString QtProfileConfigWidget::displayName() const
+{
+ return tr("Qt version:");
+}
+
+void QtProfileConfigWidget::makeReadOnly()
+{
+ m_combo->setEnabled(false);
+}
+
+void QtProfileConfigWidget::apply()
+{
+ int id = m_combo->itemData(m_combo->currentIndex()).toInt();
+ QtProfileInformation::setQtVersionId(m_profile, id);
+}
+
+void QtProfileConfigWidget::discard()
+{
+ m_combo->setCurrentIndex(findQtVersion(QtProfileInformation::qtVersionId(m_profile)));
+}
+
+bool QtProfileConfigWidget::isDirty() const
+{
+ int id = m_combo->itemData(m_combo->currentIndex()).toInt();
+ return id != QtProfileInformation::qtVersionId(m_profile);
+}
+
+void QtProfileConfigWidget::versionsChanged(const QList<int> &added, const QList<int> &removed,
+ const QList<int> &changed)
+{
+ QtVersionManager *mgr = QtVersionManager::instance();
+
+ foreach (const int id, added) {
+ BaseQtVersion *v = mgr->version(id);
+ QTC_CHECK(v);
+ QTC_CHECK(findQtVersion(id) < 0);
+ m_combo->addItem(v->displayName(), id);
+ }
+ foreach (const int id, removed) {
+ int pos = findQtVersion(id);
+ QTC_CHECK(pos >= 0);
+ m_combo->removeItem(pos);
+
+ }
+ foreach (const int id, changed) {
+ BaseQtVersion *v = mgr->version(id);
+ int pos = findQtVersion(id);
+ QTC_CHECK(pos >= 0);
+ m_combo->setItemText(pos, v->displayName());
+ }
+}
+
+void QtProfileConfigWidget::profileUpdated(ProjectExplorer::Profile *p)
+{
+ if (p != m_profile)
+ return;
+
+ int id = QtProfileInformation::qtVersionId(p);
+
+ for (int i = 0; i < m_combo->count(); ++i) {
+ if (m_combo->itemData(i).toInt() == id) {
+ m_combo->setCurrentIndex(i);
+ break;
+ }
+ }
+}
+
+void QtProfileConfigWidget::manageQtVersions()
+{
+ Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
+ QLatin1String(QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID));
+}
+
+int QtProfileConfigWidget::findQtVersion(const int id) const
+{
+ for (int i = 0; i < m_combo->count(); ++i) {
+ if (id == m_combo->itemData(i).toInt())
+ return i;
+ }
+ return -1;
+}
+
+} // namespace Internal
+} // namespace QtSupport
diff --git a/src/plugins/qtsupport/qtprofileconfigwidget.h b/src/plugins/qtsupport/qtprofileconfigwidget.h
new file mode 100644
index 0000000000..a0c2078133
--- /dev/null
+++ b/src/plugins/qtsupport/qtprofileconfigwidget.h
@@ -0,0 +1,79 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef QTSUPPORT_QTPROFILECONFIGWIDGET_H
+#define QTSUPPORT_QTPROFILECONFIGWIDGET_H
+
+#include <projectexplorer/profileconfigwidget.h>
+
+QT_FORWARD_DECLARE_CLASS(QComboBox)
+QT_FORWARD_DECLARE_CLASS(QPushButton)
+
+namespace ProjectExplorer { class Profile; }
+
+namespace QtSupport {
+class BaseQtVersion;
+
+namespace Internal {
+
+class QtProfileConfigWidget : public ProjectExplorer::ProfileConfigWidget
+{
+ Q_OBJECT
+
+public:
+ QtProfileConfigWidget(ProjectExplorer::Profile *p, QWidget *parent = 0);
+
+ QString displayName() const;
+
+ void makeReadOnly();
+
+ void apply();
+ void discard();
+ bool isDirty() const;
+
+private slots:
+ void versionsChanged(const QList<int> &added, const QList<int> &removed, const QList<int> &changed);
+ void profileUpdated(ProjectExplorer::Profile *p);
+ void manageQtVersions();
+
+private:
+ int findQtVersion(const int id) const;
+
+ ProjectExplorer::Profile *m_profile;
+ QComboBox *m_combo;
+ QPushButton *m_manageButton;
+};
+
+} // namespace Internal
+} // namespace Debugger
+
+#endif // QTSUPPORT_QTYSTEMCONFIGWIDGET_H
diff --git a/src/plugins/qtsupport/qtprofileinformation.cpp b/src/plugins/qtsupport/qtprofileinformation.cpp
new file mode 100644
index 0000000000..4a20304741
--- /dev/null
+++ b/src/plugins/qtsupport/qtprofileinformation.cpp
@@ -0,0 +1,179 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "qtprofileinformation.h"
+
+#include "qtprofileconfigwidget.h"
+#include "qtversionmanager.h"
+
+#include <utils/environment.h>
+
+namespace QtSupport {
+namespace Internal {
+const char QT_INFORMATION[] = "QtSupport.QtInformation";
+} // namespace Internal
+
+QtProfileInformation::QtProfileInformation()
+{
+ setObjectName(QLatin1String("QtProfileInformation"));
+ connect(QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
+ this, SIGNAL(validationNeeded()));
+}
+
+Core::Id QtProfileInformation::dataId() const
+{
+ static Core::Id id = Core::Id(Internal::QT_INFORMATION);
+ return id;
+}
+
+unsigned int QtProfileInformation::priority() const
+{
+ return 26000;
+}
+
+QVariant QtProfileInformation::defaultValue(ProjectExplorer::Profile *p) const
+{
+ Q_UNUSED(p);
+ QtVersionManager *mgr = QtVersionManager::instance();
+
+ // find "Qt in PATH":
+ Utils::Environment env = Utils::Environment::systemEnvironment();
+ Utils::FileName qmake = Utils::FileName::fromString(env.searchInPath(QLatin1String("qmake")));
+
+ if (qmake.isEmpty())
+ return -1;
+
+ QList<BaseQtVersion *> versionList = mgr->versions();
+ foreach (BaseQtVersion *v, versionList) {
+ if (qmake == v->qmakeCommand())
+ return v->uniqueId();
+ }
+
+ return -1;
+}
+
+QList<ProjectExplorer::Task> QtProfileInformation::validate(ProjectExplorer::Profile *p) const
+{
+ int id = qtVersionId(p);
+ if (id == -1)
+ return QList<ProjectExplorer::Task>();
+ BaseQtVersion *version = QtVersionManager::instance()->version(id);
+ if (!version) {
+ setQtVersionId(p, -1);
+ return QList<ProjectExplorer::Task>();
+ }
+ return version->validateProfile(p);
+}
+
+ProjectExplorer::ProfileConfigWidget *
+QtProfileInformation::createConfigWidget(ProjectExplorer::Profile *p) const
+{
+ return new Internal::QtProfileConfigWidget(p);
+}
+
+ProjectExplorer::ProfileInformation::ItemList
+QtProfileInformation::toUserOutput(ProjectExplorer::Profile *p) const
+{
+ BaseQtVersion *version = qtVersion(p);
+ return ItemList() << qMakePair(tr("Qt version"), version ? version->displayName() : tr("None"));
+}
+
+void QtProfileInformation::addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const
+{
+ BaseQtVersion *version = qtVersion(p);
+ if (version)
+ version->addToEnvironment(p, env);
+}
+
+int QtProfileInformation::qtVersionId(const ProjectExplorer::Profile *p)
+{
+ if (!p)
+ return -1;
+ bool ok = false;
+ int id = p->value(Core::Id(Internal::QT_INFORMATION), -1).toInt(&ok);
+ if (!ok)
+ id = -1;
+ return id;
+}
+
+void QtProfileInformation::setQtVersionId(ProjectExplorer::Profile *p, const int id)
+{
+ p->setValue(Core::Id(Internal::QT_INFORMATION), id);
+}
+
+BaseQtVersion *QtProfileInformation::qtVersion(const ProjectExplorer::Profile *p)
+{
+ return QtVersionManager::instance()->version(qtVersionId(p));
+}
+
+void QtProfileInformation::setQtVersion(ProjectExplorer::Profile *p, BaseQtVersion *v)
+{
+ if (!v)
+ setQtVersionId(p, -1);
+ else
+ setQtVersionId(p, v->uniqueId());
+}
+
+QtTypeProfileMatcher::QtTypeProfileMatcher(const QString &type) :
+ m_type(type)
+{ }
+
+bool QtTypeProfileMatcher::matches(const ProjectExplorer::Profile *p) const
+{
+ BaseQtVersion *version = QtProfileInformation::qtVersion(p);
+ return version && version->type() == m_type;
+}
+
+QtPlatformProfileMatcher::QtPlatformProfileMatcher(const QString &platform) :
+ m_platform(platform)
+{ }
+
+bool QtPlatformProfileMatcher::matches(const ProjectExplorer::Profile *p) const
+{
+ BaseQtVersion *version = QtProfileInformation::qtVersion(p);
+ return version && version->platformName() == m_platform;
+}
+
+bool QtVersionProfileMatcher::matches(const ProjectExplorer::Profile *p) const
+{
+ BaseQtVersion *version = QtProfileInformation::qtVersion(p);
+ if (!version)
+ return false;
+ QtVersionNumber current = version->qtVersion();
+ if (m_min.majorVersion > -1 && current < m_min)
+ return false;
+ if (m_max.majorVersion > -1 && current > m_max)
+ return false;
+ return version->availableFeatures().contains(m_features);
+}
+
+} // namespace QtSupport
diff --git a/src/plugins/qtsupport/qtprofileinformation.h b/src/plugins/qtsupport/qtprofileinformation.h
new file mode 100644
index 0000000000..55be3bd090
--- /dev/null
+++ b/src/plugins/qtsupport/qtprofileinformation.h
@@ -0,0 +1,112 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef QTSUPPORT_QTPROFILEINFORMATION_H
+#define QTSUPPORT_QTPROFILEINFORMATION_H
+
+#include "qtsupport_global.h"
+
+#include <projectexplorer/profileinformation.h>
+
+#include "baseqtversion.h"
+
+namespace QtSupport {
+
+class QTSUPPORT_EXPORT QtProfileInformation : public ProjectExplorer::ProfileInformation
+{
+ Q_OBJECT
+
+public:
+ QtProfileInformation();
+
+ Core::Id dataId() const;
+
+ unsigned int priority() const; // the higher the closer to the top.
+
+ QVariant defaultValue(ProjectExplorer::Profile *p) const;
+
+ QList<ProjectExplorer::Task> validate(ProjectExplorer::Profile *p) const;
+
+ ProjectExplorer::ProfileConfigWidget *createConfigWidget(ProjectExplorer::Profile *p) const;
+
+ ItemList toUserOutput(ProjectExplorer::Profile *p) const;
+
+ void addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const;
+
+ static int qtVersionId(const ProjectExplorer::Profile *p);
+ static void setQtVersionId(ProjectExplorer::Profile *p, const int id);
+ static BaseQtVersion *qtVersion(const ProjectExplorer::Profile *p);
+ static void setQtVersion(ProjectExplorer::Profile *p, BaseQtVersion *v);
+};
+
+class QTSUPPORT_EXPORT QtTypeProfileMatcher : public ProjectExplorer::ProfileMatcher
+{
+public:
+ QtTypeProfileMatcher(const QString &type);
+
+ bool matches(const ProjectExplorer::Profile *p) const;
+
+private:
+ QString m_type;
+};
+
+class QTSUPPORT_EXPORT QtPlatformProfileMatcher : public ProjectExplorer::ProfileMatcher
+{
+public:
+ QtPlatformProfileMatcher(const QString &platform);
+
+ bool matches(const ProjectExplorer::Profile *p) const;
+
+private:
+ QString m_platform;
+};
+
+class QTSUPPORT_EXPORT QtVersionProfileMatcher : public ProjectExplorer::ProfileMatcher
+{
+public:
+ explicit QtVersionProfileMatcher(const Core::FeatureSet &required = Core::FeatureSet(),
+ const QtVersionNumber &min = QtVersionNumber(0, 0, 0),
+ const QtVersionNumber &max = QtVersionNumber(INT_MAX, INT_MAX, INT_MAX)) :
+ m_min(min), m_max(max), m_features(required)
+ { }
+
+ bool matches(const ProjectExplorer::Profile *p) const;
+
+private:
+ QtVersionNumber m_min;
+ QtVersionNumber m_max;
+ Core::FeatureSet m_features;
+};
+
+} // namespace QtSupport
+
+#endif // QTSUPPORT_QTPROFILEINFORMATION_H
diff --git a/src/plugins/qtsupport/qtsupport.pro b/src/plugins/qtsupport/qtsupport.pro
index e225359e54..26cbceaae8 100644
--- a/src/plugins/qtsupport/qtsupport.pro
+++ b/src/plugins/qtsupport/qtsupport.pro
@@ -18,6 +18,8 @@ include(../../shared/proparser/proparser.pri)
HEADERS += \
qtsupportplugin.h \
qtsupport_global.h \
+ qtprofileconfigwidget.h \
+ qtprofileinformation.h \
qtoutputformatter.h \
qtversionmanager.h \
qtversionfactory.h \
@@ -39,6 +41,8 @@ HEADERS += \
SOURCES += \
qtsupportplugin.cpp \
+ qtprofileconfigwidget.cpp \
+ qtprofileinformation.cpp \
qtoutputformatter.cpp \
qtversionmanager.cpp \
qtversionfactory.cpp \
diff --git a/src/plugins/qtsupport/qtsupport.qbs b/src/plugins/qtsupport/qtsupport.qbs
index 835d9987b7..a60f22490a 100644
--- a/src/plugins/qtsupport/qtsupport.qbs
+++ b/src/plugins/qtsupport/qtsupport.qbs
@@ -62,6 +62,10 @@ QtcPlugin {
"qtoutputformatter.cpp",
"qtoutputformatter.h",
"qtparser.h",
+ "qtprofileconfigwidget.cpp",
+ "qtprofileconfigwidget.h",
+ "qtprofileinformation.cpp",
+ "qtprofileinformation.h",
"qtsupport_global.h",
"qtsupportconstants.h",
"qtsupportplugin.cpp",
diff --git a/src/plugins/qtsupport/qtsupportconstants.h b/src/plugins/qtsupport/qtsupportconstants.h
index df367c1fe2..0753f5e7b4 100644
--- a/src/plugins/qtsupport/qtsupportconstants.h
+++ b/src/plugins/qtsupport/qtsupportconstants.h
@@ -37,7 +37,7 @@ namespace QtSupport {
namespace Constants {
// Qt4 settings pages
-const char QTVERSION_SETTINGS_PAGE_ID[] = "B.Qt Versions";
+const char QTVERSION_SETTINGS_PAGE_ID[] = "H.Qt Versions";
const char QTVERSION_SETTINGS_PAGE_NAME[] = QT_TRANSLATE_NOOP("Qt4ProjectManager", "Qt Versions");
// QtVersions
@@ -64,17 +64,22 @@ const char FEATURE_DESKTOP[] = "QtSupport.Wizards.FeatureDesktop";
// Platforms
const char MEEGO_HARMATTAN_PLATFORM[] = "MeeGo/Harmattan";
+const char MAEMO_FREMANTLE_PLATFORM[] = "Maemo/Fremantle";
+const char MEEGO_PLATFORM[] = "Meego";
const char SYMBIAN_PLATFORM[] = "Symbian";
const char DESKTOP_PLATFORM[] = "Desktop";
const char EMBEDDED_LINUX_PLATFORM[] = "Embedded Linux";
const char WINDOWS_CE_PLATFORM[] = "Windows CE";
+const char ANDROID_PLATFORM[] = "Android";
const char MEEGO_HARMATTAN_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "MeeGo/Harmattan");
+const char MAEMO_FREMANTLE_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Maemo/Fremantle");
+const char MEEGO_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Meego");
const char SYMBIAN_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Symbian");
const char DESKTOP_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Desktop");
const char EMBEDDED_LINUX_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Embedded Linux");
const char WINDOWS_CE_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Windows CE");
-
+const char ANDROID_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Android");
// QML wizard icon
// both the qt4projectmanager and the qmlprojectmanager do have qt quick wizards
diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp
index d1f0872196..1456a97593 100644
--- a/src/plugins/qtsupport/qtsupportplugin.cpp
+++ b/src/plugins/qtsupport/qtsupportplugin.cpp
@@ -34,6 +34,7 @@
#include "customexecutablerunconfiguration.h"
#include "qtoptionspage.h"
+#include "qtprofileinformation.h"
#include "qtversionmanager.h"
#include "profilereader.h"
@@ -41,6 +42,7 @@
#include "gettingstartedwelcomepage.h"
#include <extensionsystem/pluginmanager.h>
+#include <projectexplorer/profilemanager.h>
#include <QtPlugin>
#include <QMenu>
@@ -83,6 +85,7 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes
void QtSupportPlugin::extensionsInitialized()
{
QtVersionManager::instance()->extensionsInitialized();
+ ProjectExplorer::ProfileManager::instance()->registerProfileInformation(new QtProfileInformation);
}
bool QtSupportPlugin::delayedInitialize()
diff --git a/src/plugins/qtsupport/qtsupportplugin.h b/src/plugins/qtsupport/qtsupportplugin.h
index 0400e313e9..405f51b9be 100644
--- a/src/plugins/qtsupport/qtsupportplugin.h
+++ b/src/plugins/qtsupport/qtsupportplugin.h
@@ -36,7 +36,6 @@
#include <extensionsystem/iplugin.h>
#include <coreplugin/icontext.h>
-
namespace QtSupport {
namespace Internal {
diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp
index 79c3a7de93..10f36d3d72 100644
--- a/src/plugins/qtsupport/qtversionmanager.cpp
+++ b/src/plugins/qtsupport/qtversionmanager.cpp
@@ -32,6 +32,7 @@
#include "qtversionmanager.h"
+#include "qtprofileinformation.h"
#include "qtversionfactory.h"
#include "qtsupportconstants.h"
@@ -77,7 +78,8 @@ static const char OLDQTVERSION_DATA_KEY[] = "QtVersion.Old.";
static const char OLDQTVERSION_SDKSOURCE[] = "QtVersion.Old.SdkSource";
static const char OLDQTVERSION_PATH[] = "QtVersion.Old.Path";
static const char QTVERSION_FILE_VERSION_KEY[] = "Version";
-static const char QTVERSION_FILENAME[] = "/qtversion.xml";
+static const char QTVERSION_FILENAME[] = "/qtcreator/qtversion.xml";
+static const char QTVERSION_SDK_FILENAME[] = "/qtversion.xml";
// legacy settings
static const char QtVersionsSectionName[] = "QtVersions";
@@ -100,14 +102,16 @@ static T *createToolChain(const QString &id)
static QString globalSettingsFileName()
{
- return QFileInfo(ExtensionSystem::PluginManager::globalSettings()->fileName()).absolutePath()
- + QLatin1String(QTVERSION_FILENAME);
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ return QFileInfo(pm->globalSettings()->fileName()).absolutePath()
+ + QLatin1String(QTVERSION_SDK_FILENAME);
}
-static QString settingsFileName()
+static QString settingsFileName(const QString &path)
{
- QFileInfo settingsLocation(ExtensionSystem::PluginManager::settings()->fileName());
- return settingsLocation.absolutePath() + QLatin1String(QTVERSION_FILENAME);
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ QFileInfo settingsLocation(pm->settings()->fileName());
+ return settingsLocation.absolutePath() + path;
}
@@ -183,7 +187,11 @@ bool QtVersionManager::restoreQtVersions()
QList<QtVersionFactory *> factories = ExtensionSystem::PluginManager::getObjects<QtVersionFactory>();
Utils::PersistentSettingsReader reader;
- if (!reader.load(settingsFileName()))
+ QString filename = settingsFileName(QLatin1String(QTVERSION_FILENAME));
+ // Read Qt Creator 2.5 qtversions.xml once:
+ if (!QFileInfo(filename).exists())
+ filename = settingsFileName(QLatin1String(QTVERSION_SDK_FILENAME));
+ if (!reader.load(filename))
return false;
QVariantMap data = reader.restoreValues();
@@ -222,7 +230,7 @@ bool QtVersionManager::restoreQtVersions()
if (!restored)
qWarning("Warning: Unable to restore Qt version '%s' stored in %s.",
qPrintable(type),
- qPrintable(QDir::toNativeSeparators(settingsFileName())));
+ qPrintable(QDir::toNativeSeparators(filename)));
}
++m_idcount;
return true;
@@ -402,7 +410,7 @@ void QtVersionManager::saveQtVersions()
}
writer.saveValue(QLatin1String(QTVERSION_COUNT_KEY), count);
- writer.save(settingsFileName(), QLatin1String("QtCreatorQtVersions"), Core::ICore::mainWindow());
+ writer.save(settingsFileName(QLatin1String(QTVERSION_FILENAME)), QLatin1String("QtCreatorQtVersions"), Core::ICore::mainWindow());
}
void QtVersionManager::findSystemQt()
@@ -499,37 +507,6 @@ void QtVersionManager::removeVersion(BaseQtVersion *version)
delete version;
}
-bool QtVersionManager::supportsTargetId(Core::Id id) const
-{
- QList<BaseQtVersion *> versions = QtVersionManager::instance()->versionsForTargetId(id);
- foreach (BaseQtVersion *v, versions)
- if (v->isValid() && v->toolChainAvailable(id))
- return true;
- return false;
-}
-
-QList<BaseQtVersion *> QtVersionManager::versionsForTargetId(Core::Id id,
- const QtVersionNumber &minimumQtVersion,
- const QtVersionNumber &maximumQtVersion) const
-{
- QList<BaseQtVersion *> targetVersions;
- foreach (BaseQtVersion *version, m_versions) {
- if (version->supportsTargetId(id) && version->qtVersion() >= minimumQtVersion
- && version->qtVersion() <= maximumQtVersion)
- targetVersions.append(version);
- }
- qSort(targetVersions.begin(), targetVersions.end(), &qtVersionNumberCompare);
- return targetVersions;
-}
-
-QSet<Core::Id> QtVersionManager::supportedTargetIds() const
-{
- QSet<Core::Id> results;
- foreach (BaseQtVersion *version, m_versions)
- results.unite(version->supportedTargetIds());
- return results;
-}
-
void QtVersionManager::updateDocumentation()
{
Core::HelpManager *helpManager = Core::HelpManager::instance();
diff --git a/src/plugins/qtsupport/qtversionmanager.h b/src/plugins/qtsupport/qtversionmanager.h
index 5c39a288eb..c2b96e8f43 100644
--- a/src/plugins/qtsupport/qtversionmanager.h
+++ b/src/plugins/qtsupport/qtversionmanager.h
@@ -40,6 +40,7 @@
#include <QStringList>
namespace Utils { class FileSystemWatcher; }
+namespace ProjectExplorer { class ProfileInformation; }
namespace QtSupport {
namespace Internal {
@@ -81,16 +82,6 @@ public:
void addVersion(BaseQtVersion *version);
void removeVersion(BaseQtVersion *version);
- // Target Support:
- bool supportsTargetId(Core::Id id) const;
- // This returns a list of versions that support the target with the given id.
- // @return A list of QtVersions that supports a target. This list may be empty!
-
- QList<BaseQtVersion *> versionsForTargetId(Core::Id id,
- const QtVersionNumber &minimumQtVersion = QtVersionNumber(),
- const QtVersionNumber &maximumQtVersion = QtVersionNumber(INT_MAX, INT_MAX, INT_MAX)) const;
- QSet<Core::Id> supportedTargetIds() const;
-
// Static Methods
enum MakefileCompatible { CouldNotParse, DifferentProject, SameProject };
static MakefileCompatible makefileIsFor(const QString &makefile, const QString &proFile);
diff --git a/src/plugins/qtsupport/qtversionmanager.ui b/src/plugins/qtsupport/qtversionmanager.ui
index 2f6134be33..d78f79639b 100644
--- a/src/plugins/qtsupport/qtversionmanager.ui
+++ b/src/plugins/qtsupport/qtversionmanager.ui
@@ -12,82 +12,94 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <widget class="QTreeWidget" name="qtdirList">
+ <property name="uniformRowHeights">
+ <bool>true</bool>
+ </property>
+ <property name="columnCount">
+ <number>2</number>
+ </property>
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>qmake Location</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item row="0" column="1" rowspan="3">
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="addButton">
+ <property name="minimumSize">
+ <size>
+ <width>21</width>
+ <height>23</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Add...</string>
+ </property>
+ </widget>
+ </item>
<item>
- <widget class="QTreeWidget" name="qtdirList">
- <property name="uniformRowHeights">
- <bool>true</bool>
+ <widget class="QPushButton" name="delButton">
+ <property name="minimumSize">
+ <size>
+ <width>21</width>
+ <height>23</height>
+ </size>
</property>
- <property name="columnCount">
- <number>2</number>
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>10</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cleanUpButton">
+ <property name="text">
+ <string>Clean up</string>
</property>
- <column>
- <property name="text">
- <string>Name</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>qmake Location</string>
- </property>
- </column>
</widget>
</item>
<item>
- <layout class="QVBoxLayout">
- <property name="spacing">
- <number>6</number>
+ <spacer name="spacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
</property>
- <property name="margin">
- <number>0</number>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>77</width>
+ <height>37</height>
+ </size>
</property>
- <item>
- <widget class="QPushButton" name="addButton">
- <property name="minimumSize">
- <size>
- <width>21</width>
- <height>23</height>
- </size>
- </property>
- <property name="text">
- <string>Add...</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="delButton">
- <property name="minimumSize">
- <size>
- <width>21</width>
- <height>23</height>
- </size>
- </property>
- <property name="text">
- <string>Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>10</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="cleanUpButton">
- <property name="text">
- <string>Clean up</string>
- </property>
- </widget>
- </item>
- </layout>
+ </spacer>
</item>
</layout>
</item>
diff --git a/src/plugins/remotelinux/abstractembeddedlinuxtarget.h b/src/plugins/remotelinux/abstractembeddedlinuxtarget.h
deleted file mode 100644
index 4f60678d9a..0000000000
--- a/src/plugins/remotelinux/abstractembeddedlinuxtarget.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-#ifndef ABSTRACTEMBEDDEDLINUXTARGET_H
-#define ABSTRACTEMBEDDEDLINUXTARGET_H
-
-#include "remotelinux_export.h"
-
-#include <qt4projectmanager/qt4target.h>
-
-#include <QSharedPointer>
-#include <QString>
-
-namespace ProjectExplorer {
-class IBuildConfigurationFactory;
-class IDevice;
-}
-namespace Qt4ProjectManager { class Qt4BuildConfigurationFactory; }
-
-namespace RemoteLinux {
-class DeploymentInfo;
-namespace Internal { class TypeSpecificDeviceConfigurationListModel; }
-
-class REMOTELINUX_EXPORT AbstractEmbeddedLinuxTarget : public Qt4ProjectManager::Qt4BaseTarget
-{
- Q_OBJECT
-public:
- AbstractEmbeddedLinuxTarget(Qt4ProjectManager::Qt4Project *parent, const Core::Id id);
-
- ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
-
- DeploymentInfo *deploymentInfo() const { return m_deploymentInfo; }
- Internal::TypeSpecificDeviceConfigurationListModel *deviceConfigModel() const {
- return m_deviceConfigModel;
- }
- virtual bool supportsDevice(const QSharedPointer<const ProjectExplorer::IDevice> &device) const = 0;
-
-signals:
- void supportedDevicesChanged();
-
-private:
- Qt4ProjectManager::Qt4BuildConfigurationFactory * const m_buildConfigurationFactory;
- DeploymentInfo * const m_deploymentInfo;
- Internal::TypeSpecificDeviceConfigurationListModel * const m_deviceConfigModel;
-};
-
-} // namespace RemoteLinux
-
-#endif // ABSTRACTEMBEDDEDLINUXTARGET_H
diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp
index 7f84926544..a534857da2 100644
--- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp
+++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp
@@ -34,7 +34,9 @@
#include "deployablefile.h"
#include "linuxdeviceconfiguration.h"
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
+#include <qtsupport/qtprofileinformation.h>
#include <utils/qtcassert.h>
#include <ssh/sshconnection.h>
#include <ssh/sshconnectionmanager.h>
@@ -127,23 +129,32 @@ void AbstractRemoteLinuxDeployService::saveDeploymentTimeStamp(const DeployableF
{
if (!d->buildConfiguration)
return;
- const QtSupport::BaseQtVersion * const qtVersion = d->buildConfiguration->qtVersion();
+ const QtSupport::BaseQtVersion *const qtVersion
+ = QtSupport::QtProfileInformation::qtVersion(d->buildConfiguration->target()->profile());
+ QString systemRoot;
+ if (ProjectExplorer::SysRootProfileInformation::hasSysRoot(d->buildConfiguration->target()->profile()))
+ systemRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(d->buildConfiguration->target()->profile()).toString();
if (!qtVersion || !qtVersion->isValid())
return;
d->lastDeployed.insert(DeployParameters(deployableFile,
- deviceConfiguration()->sshParameters().host,
- qtVersion->systemRoot()), QDateTime::currentDateTime());
+ deviceConfiguration()->sshParameters().host,
+ systemRoot),
+ QDateTime::currentDateTime());
}
bool AbstractRemoteLinuxDeployService::hasChangedSinceLastDeployment(const DeployableFile &deployableFile) const
{
if (!d->buildConfiguration)
return true;
- const QtSupport::BaseQtVersion * const qtVersion = d->buildConfiguration->qtVersion();
+ const QtSupport::BaseQtVersion *const qtVersion
+ = QtSupport::QtProfileInformation::qtVersion(d->buildConfiguration->target()->profile());
if (!qtVersion || !qtVersion->isValid())
return true;
+ QString systemRoot;
+ if (ProjectExplorer::SysRootProfileInformation::hasSysRoot(d->buildConfiguration->target()->profile()))
+ systemRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(d->buildConfiguration->target()->profile()).toString();
const QDateTime &lastDeployed = d->lastDeployed.value(DeployParameters(deployableFile,
- deviceConfiguration()->sshParameters().host, qtVersion->systemRoot()));
+ deviceConfiguration()->sshParameters().host, systemRoot));
return !lastDeployed.isValid()
|| QFileInfo(deployableFile.localFilePath).lastModified() > lastDeployed;
}
diff --git a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp
index 68a8f9fc92..4acbe663f5 100644
--- a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp
+++ b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp
@@ -32,9 +32,12 @@
#include "abstractremotelinuxdeploystep.h"
#include "abstractremotelinuxdeployservice.h"
+#include "linuxdeviceconfiguration.h"
#include "remotelinuxdeployconfiguration.h"
+#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
@@ -79,7 +82,8 @@ QVariantMap AbstractRemoteLinuxDeployStep::toMap() const
bool AbstractRemoteLinuxDeployStep::init()
{
QString error;
- deployService()->setDeviceConfiguration(deployConfiguration()->deviceConfiguration());
+ deployService()->setDeviceConfiguration(ProjectExplorer::DeviceProfileInformation::device(target()->profile())
+ .dynamicCast<const LinuxDeviceConfiguration>());
deployService()->setBuildConfiguration(qobject_cast<Qt4ProjectManager::Qt4BuildConfiguration *>(target()->activeBuildConfiguration()));
const bool canDeploy = initInternal(&error);
if (!canDeploy)
diff --git a/src/plugins/remotelinux/deploymentinfo.cpp b/src/plugins/remotelinux/deploymentinfo.cpp
index e599b754be..dddd7bf101 100644
--- a/src/plugins/remotelinux/deploymentinfo.cpp
+++ b/src/plugins/remotelinux/deploymentinfo.cpp
@@ -31,13 +31,15 @@
#include "deploymentinfo.h"
-#include "abstractembeddedlinuxtarget.h"
#include "deployablefile.h"
#include "deployablefilesperprofile.h"
+#include "remotelinuxdeployconfiguration.h"
#include <projectexplorer/buildstep.h>
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4project.h>
+#include <qtsupport/qtprofileinformation.h>
#include <QList>
#include <QTimer>
@@ -49,20 +51,20 @@ namespace Internal {
class DeploymentInfoPrivate
{
public:
- DeploymentInfoPrivate(const AbstractEmbeddedLinuxTarget *target) : target(target) {}
+ DeploymentInfoPrivate(const Qt4ProjectManager::Qt4Project *p) : project(p) {}
QList<DeployableFilesPerProFile *> listModels;
- const AbstractEmbeddedLinuxTarget * const target;
+ const Qt4ProjectManager::Qt4Project *const project;
QString installPrefix;
};
} // namespace Internal
using namespace Internal;
-DeploymentInfo::DeploymentInfo(AbstractEmbeddedLinuxTarget *target, const QString &installPrefix)
- : QAbstractListModel(target), d(new DeploymentInfoPrivate(target))
+DeploymentInfo::DeploymentInfo(Qt4ProjectManager::Qt4Project *project, const QString &installPrefix)
+ : QAbstractListModel(project), d(new DeploymentInfoPrivate(project))
{
- connect (d->target->qt4Project(), SIGNAL(proParsingDone()), SLOT(createModels()));
+ connect(project, SIGNAL(buildSystemEvaluated()), SLOT(createModels()));
setInstallPrefix(installPrefix);
}
@@ -73,27 +75,30 @@ DeploymentInfo::~DeploymentInfo()
void DeploymentInfo::createModels()
{
- if (d->target->project()->activeTarget() != d->target)
+ ProjectExplorer::Target *target = d->project->activeTarget();
+ if (!target
+ || !target->activeDeployConfiguration()
+ || !qobject_cast<RemoteLinuxDeployConfiguration *>(target->activeDeployConfiguration()))
return;
- const Qt4BuildConfiguration *bc = d->target->activeQt4BuildConfiguration();
- if (!bc || !bc->qtVersion() || !bc->qtVersion()->isValid()) {
+
+ QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
+ if (!version || !version->isValid()) {
beginResetModel();
qDeleteAll(d->listModels);
d->listModels.clear();
endResetModel();
return;
}
- const Qt4ProFileNode *const rootNode
- = d->target->qt4Project()->rootQt4ProjectNode();
+ const Qt4ProFileNode *const rootNode = d->project->rootQt4ProjectNode();
if (!rootNode || rootNode->parseInProgress()) // Can be null right after project creation by wizard.
return;
- disconnect(d->target->qt4Project(), SIGNAL(proParsingDone()), this, SLOT(createModels()));
+ disconnect(d->project, SIGNAL(buildSystemEvaluated()), this, SLOT(createModels()));
beginResetModel();
qDeleteAll(d->listModels);
d->listModels.clear();
createModels(rootNode);
endResetModel();
- connect (d->target->qt4Project(), SIGNAL(proParsingDone()), SLOT(createModels()));
+ connect (d->project, SIGNAL(buildSystemEvaluated()), SLOT(createModels()));
}
void DeploymentInfo::createModels(const Qt4ProFileNode *proFileNode)
diff --git a/src/plugins/remotelinux/deploymentinfo.h b/src/plugins/remotelinux/deploymentinfo.h
index fffa093ac0..a7cb01bb07 100644
--- a/src/plugins/remotelinux/deploymentinfo.h
+++ b/src/plugins/remotelinux/deploymentinfo.h
@@ -36,10 +36,13 @@
#include <QAbstractListModel>
-namespace Qt4ProjectManager { class Qt4ProFileNode; }
+namespace ProjectExplorer { class Target; }
+namespace Qt4ProjectManager {
+class Qt4ProFileNode;
+class Qt4Project;
+} // namespace Qt4ProjectManager
namespace RemoteLinux {
-class AbstractEmbeddedLinuxTarget;
class DeployableFile;
class DeployableFilesPerProFile;
@@ -51,7 +54,7 @@ class REMOTELINUX_EXPORT DeploymentInfo : public QAbstractListModel
{
Q_OBJECT
public:
- DeploymentInfo(AbstractEmbeddedLinuxTarget *target, const QString &installPrefix = QString());
+ DeploymentInfo(Qt4ProjectManager::Qt4Project *project, const QString &installPrefix = QString());
~DeploymentInfo();
void setUnmodified();
diff --git a/src/plugins/remotelinux/deploymentsettingsassistant.cpp b/src/plugins/remotelinux/deploymentsettingsassistant.cpp
index 23270136a0..e87c571883 100644
--- a/src/plugins/remotelinux/deploymentsettingsassistant.cpp
+++ b/src/plugins/remotelinux/deploymentsettingsassistant.cpp
@@ -34,9 +34,12 @@
#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>
@@ -60,14 +63,11 @@ typedef QHash<QString, ProFileUpdateSetting> UpdateSettingsMap;
class DeploymentSettingsAssistantInternal
{
public:
- DeploymentSettingsAssistantInternal(const QString &qmakeScope, const QString &installPrefix,
- DeploymentInfo *deploymentInfo)
- : qmakeScope(qmakeScope), installPrefix(installPrefix), deploymentInfo(deploymentInfo)
+ DeploymentSettingsAssistantInternal(DeploymentInfo *deploymentInfo)
+ : deploymentInfo(deploymentInfo)
{
}
- const QString qmakeScope;
- const QString installPrefix;
DeploymentInfo * const deploymentInfo;
UpdateSettingsMap updateSettings;
};
@@ -76,10 +76,10 @@ public:
using namespace Internal;
-DeploymentSettingsAssistant::DeploymentSettingsAssistant(const QString &qmakeScope,
- const QString &installPrefix, DeploymentInfo *deploymentInfo, QObject *parent)
+DeploymentSettingsAssistant::DeploymentSettingsAssistant(DeploymentInfo *deploymentInfo,
+ ProjectExplorer::Project *parent)
: QObject(parent),
- d(new DeploymentSettingsAssistantInternal(qmakeScope, installPrefix, deploymentInfo))
+ d(new DeploymentSettingsAssistantInternal(deploymentInfo))
{
connect(d->deploymentInfo, SIGNAL(modelReset()), SLOT(handleDeploymentInfoUpdated()));
}
@@ -89,23 +89,26 @@ DeploymentSettingsAssistant::~DeploymentSettingsAssistant()
delete d;
}
-bool DeploymentSettingsAssistant::addDeployableToProFile(const DeployableFilesPerProFile *proFileInfo,
- const QString &variableName, const DeployableFile &deployable)
+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(proFileInfo, QStringList() << filesLine << pathLine << installsLine);
+ return addLinesToProFile(qmakeScope, proFileInfo,
+ QStringList() << filesLine << pathLine << installsLine);
}
-bool DeploymentSettingsAssistant::addLinesToProFile(const DeployableFilesPerProFile *proFileInfo,
- const QStringList &lines)
+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') + d->qmakeScope + QLatin1String(" {")
+ 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());
@@ -114,6 +117,24 @@ bool DeploymentSettingsAssistant::addLinesToProFile(const DeployableFilesPerProF
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) {
@@ -144,11 +165,13 @@ void DeploymentSettingsAssistant::handleDeploymentInfoUpdated()
foreach (const DeployableFilesPerProFile * const proFileInfo, proFilesToUpdate) {
const QString remoteDirSuffix = QLatin1String(proFileInfo->projectType() == LibraryTemplate
? "/lib" : "/bin");
- const QString remoteDir = QLatin1String("target.path = ") + d->installPrefix
- + QLatin1Char('/') + proFileInfo->projectName() + remoteDirSuffix;
- const QStringList deployInfo = QStringList() << remoteDir
- << QLatin1String("INSTALLS += target");
- addLinesToProFile(proFileInfo, deployInfo);
+ 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);
+ }
}
}
diff --git a/src/plugins/remotelinux/deploymentsettingsassistant.h b/src/plugins/remotelinux/deploymentsettingsassistant.h
index d2912845bb..4a7ad0956d 100644
--- a/src/plugins/remotelinux/deploymentsettingsassistant.h
+++ b/src/plugins/remotelinux/deploymentsettingsassistant.h
@@ -36,32 +36,32 @@
#include <QObject>
#include <QStringList>
+namespace ProjectExplorer { class Project; }
+
namespace RemoteLinux {
class DeployableFile;
class DeployableFilesPerProFile;
class DeploymentInfo;
-namespace Internal {
-class DeploymentSettingsAssistantInternal;
-} // namespace Internal
+namespace Internal { class DeploymentSettingsAssistantInternal; }
class REMOTELINUX_EXPORT DeploymentSettingsAssistant : public QObject
{
Q_OBJECT
- Q_DISABLE_COPY(DeploymentSettingsAssistant)
+
public:
- DeploymentSettingsAssistant(const QString &qmakeScope, const QString &installPrefix,
- DeploymentInfo *deploymentInfo, QObject *parent = 0);
+ DeploymentSettingsAssistant(DeploymentInfo *deploymentInfo, ProjectExplorer::Project *parent);
~DeploymentSettingsAssistant();
- bool addDeployableToProFile(const DeployableFilesPerProFile *proFileInfo,
- const QString &variableName, const DeployableFile &deployable);
+ bool addDeployableToProFile(const QString &qmakeScope,
+ const DeployableFilesPerProFile *proFileInfo,
+ const QString &variableName, const DeployableFile &deployable);
private slots:
void handleDeploymentInfoUpdated();
private:
- bool addLinesToProFile(const DeployableFilesPerProFile *proFileInfo, const QStringList &lines);
+ bool addLinesToProFile(const QString &qmakeScope, const DeployableFilesPerProFile *proFileInfo, const QStringList &lines);
Internal::DeploymentSettingsAssistantInternal * const d;
};
diff --git a/src/plugins/remotelinux/embeddedlinuxqtversion.cpp b/src/plugins/remotelinux/embeddedlinuxqtversion.cpp
index b08ee8a4f2..e6b8c17518 100644
--- a/src/plugins/remotelinux/embeddedlinuxqtversion.cpp
+++ b/src/plugins/remotelinux/embeddedlinuxqtversion.cpp
@@ -74,16 +74,6 @@ QList<ProjectExplorer::Abi> EmbeddedLinuxQtVersion::detectQtAbis() const
return qtAbisFromLibrary(qtCorePath(versionInfo(), qtVersionString()));
}
-bool EmbeddedLinuxQtVersion::supportsTargetId(const Core::Id id) const
-{
- return id == Core::Id(Constants::EMBEDDED_LINUX_TARGET_ID);
-}
-
-QSet<Core::Id> EmbeddedLinuxQtVersion::supportedTargetIds() const
-{
- return QSet<Core::Id>() << Core::Id(Constants::EMBEDDED_LINUX_TARGET_ID);
-}
-
QString EmbeddedLinuxQtVersion::description() const
{
return QCoreApplication::translate("QtVersion", "Embedded Linux", "Qt Version is used for embedded Linux development");
diff --git a/src/plugins/remotelinux/embeddedlinuxqtversion.h b/src/plugins/remotelinux/embeddedlinuxqtversion.h
index c7d4181676..e548acb0b2 100644
--- a/src/plugins/remotelinux/embeddedlinuxqtversion.h
+++ b/src/plugins/remotelinux/embeddedlinuxqtversion.h
@@ -52,9 +52,6 @@ public:
QList<ProjectExplorer::Abi> detectQtAbis() const;
- bool supportsTargetId(const Core::Id id) const;
- QSet<Core::Id> supportedTargetIds() const;
-
QString description() const;
QString platformName() const;
diff --git a/src/plugins/remotelinux/embeddedlinuxtargetfactory.cpp b/src/plugins/remotelinux/embeddedlinuxtargetfactory.cpp
deleted file mode 100644
index a9eb98b01d..0000000000
--- a/src/plugins/remotelinux/embeddedlinuxtargetfactory.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "embeddedlinuxtargetfactory.h"
-
-#include "remotelinuxdeployconfiguration.h"
-#include "remotelinuxdeployconfigurationfactory.h"
-#include "genericembeddedlinuxtarget.h"
-#include "remotelinux_constants.h"
-
-#include <qt4projectmanager/buildconfigurationinfo.h>
-#include <qt4projectmanager/qt4project.h>
-#include <qt4projectmanager/qt4projectmanagerconstants.h>
-
-#include <qtsupport/customexecutablerunconfiguration.h>
-#include <qtsupport/qtversionmanager.h>
-
-#include <QIcon>
-
-namespace RemoteLinux {
-namespace Internal {
-
-EmbeddedLinuxTargetFactory::EmbeddedLinuxTargetFactory(QObject *parent) :
- Qt4ProjectManager::Qt4BaseTargetFactory(parent)
-{ }
-
-EmbeddedLinuxTargetFactory::~EmbeddedLinuxTargetFactory()
-{ }
-
-QIcon EmbeddedLinuxTargetFactory::iconForId(const Core::Id id) const
-{
- if (id == Core::Id(Constants::EMBEDDED_LINUX_TARGET_ID))
- return QIcon(":/remotelinux/images/embeddedtarget.png");
- return QIcon();
-}
-
-QString EmbeddedLinuxTargetFactory::buildNameForId(const Core::Id id) const
-{
- if (supportsTargetId(id))
- return tr("embedded");
- return QString();
-}
-
-QSet<QString> EmbeddedLinuxTargetFactory::targetFeatures(const Core::Id id) const
-{
- Q_UNUSED(id);
- QSet<QString> features;
- features << Qt4ProjectManager::Constants::MOBILE_TARGETFEATURE_ID;
- features << Qt4ProjectManager::Constants::SHADOWBUILD_TARGETFEATURE_ID;
-
- return features;
-}
-
-QList<Core::Id> EmbeddedLinuxTargetFactory::supportedTargetIds() const
-{
- return QList<Core::Id>() << Core::Id(RemoteLinux::Constants::EMBEDDED_LINUX_TARGET_ID);
-}
-
-bool EmbeddedLinuxTargetFactory::supportsTargetId(const Core::Id id) const
-{
- return id == Core::Id(RemoteLinux::Constants::EMBEDDED_LINUX_TARGET_ID);
-}
-
-QString EmbeddedLinuxTargetFactory::displayNameForId(const Core::Id id) const
-{
- if (id == Core::Id(RemoteLinux::Constants::EMBEDDED_LINUX_TARGET_ID))
- return tr("Embedded Linux");
- return QString();
-}
-
-bool EmbeddedLinuxTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const
-{
- return qobject_cast<Qt4ProjectManager::Qt4Project *>(parent) && supportsTargetId(ProjectExplorer::idFromMap(map));
-}
-
-ProjectExplorer::Target *EmbeddedLinuxTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map)
-{
- Q_ASSERT(canRestore(parent, map));
-
- GenericEmbeddedLinuxTarget *t =
- new GenericEmbeddedLinuxTarget(static_cast<Qt4ProjectManager::Qt4Project *>(parent), Core::Id());
- if (t->fromMap(map))
- return t;
-
- delete t;
- return 0;
-}
-
-bool EmbeddedLinuxTargetFactory::canCreate(ProjectExplorer::Project *parent, const Core::Id id) const
-{
- Qt4ProjectManager::Qt4Project *project = qobject_cast<Qt4ProjectManager::Qt4Project *>(parent);
- if (!project)
- return false;
-
- if (!supportsTargetId(id))
- return false;
-
- return QtSupport::QtVersionManager::instance()->supportsTargetId(id);
-}
-
-ProjectExplorer::Target *EmbeddedLinuxTargetFactory::create(ProjectExplorer::Project *parent,
- const Core::Id id)
-{
- if (!canCreate(parent, id))
- return 0;
-
- QList<QtSupport::BaseQtVersion *> knownVersions =
- QtSupport::QtVersionManager::instance()->versionsForTargetId(id);
- QtSupport::BaseQtVersion *qtVersion = knownVersions.first();
- QtSupport::BaseQtVersion::QmakeBuildConfigs config = qtVersion->defaultBuildConfig();
-
- QList<Qt4ProjectManager::BuildConfigurationInfo> infos;
- infos.append(Qt4ProjectManager::BuildConfigurationInfo(qtVersion->uniqueId(), config, QString(), QString()));
- infos.append(Qt4ProjectManager::BuildConfigurationInfo(qtVersion->uniqueId(),
- config ^ QtSupport::BaseQtVersion::DebugBuild,
- QString(), QString()));
-
- return create(parent, id, infos);
-}
-
-ProjectExplorer::Target *EmbeddedLinuxTargetFactory::create(ProjectExplorer::Project *parent,
- const Core::Id id,
- const QList<Qt4ProjectManager::BuildConfigurationInfo> &infos)
-{
- if (!canCreate(parent, id) || infos.isEmpty())
- return 0;
-
- GenericEmbeddedLinuxTarget *t = new GenericEmbeddedLinuxTarget(static_cast<Qt4ProjectManager::Qt4Project *>(parent), id);
-
- foreach (const Qt4ProjectManager::BuildConfigurationInfo &info, infos)
- t->addQt4BuildConfiguration(msgBuildConfigurationName(info), QString(),
- info.version(), info.buildConfig,
- info.additionalArguments, info.directory, info.importing);
-
- t->addDeployConfiguration(
- t->createDeployConfiguration(
- RemoteLinuxDeployConfigurationFactory::genericDeployConfigurationId()));
-
- t->createApplicationProFiles(false);
-
- if (t->runConfigurations().isEmpty())
- t->addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(t));
- return t;
-}
-
-} // namespace Internal
-} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/embeddedlinuxtargetfactory.h b/src/plugins/remotelinux/embeddedlinuxtargetfactory.h
deleted file mode 100644
index 77f4d80803..0000000000
--- a/src/plugins/remotelinux/embeddedlinuxtargetfactory.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef EMBEDDEDLINUXTARGETFACTORY_H
-#define EMBEDDEDLINUXTARGETFACTORY_H
-
-#include <qt4projectmanager/qt4basetargetfactory.h>
-
-namespace RemoteLinux {
-namespace Internal {
-
-class EmbeddedLinuxTargetFactory : public Qt4ProjectManager::Qt4BaseTargetFactory
-{
- Q_OBJECT
-
-public:
- explicit EmbeddedLinuxTargetFactory(QObject *parent = 0);
- ~EmbeddedLinuxTargetFactory();
-
- QIcon iconForId(const Core::Id id) const;
- QString buildNameForId(const Core::Id id) const;
-
- QSet<QString> targetFeatures(const Core::Id id) const;
-
- QList<Core::Id> supportedTargetIds() const;
- bool supportsTargetId(const Core::Id id) const;
-
- QString displayNameForId(const Core::Id id) const;
-
- bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
- ProjectExplorer::Target *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
-
- bool canCreate(ProjectExplorer::Project *parent, const Core::Id id) const;
- ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id);
- ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const Core::Id id,
- const QList<Qt4ProjectManager::BuildConfigurationInfo> &infos);
-};
-
-} // namespace Internal
-} // namespace RemoteLinux
-
-#endif // EMBEDDEDLINUXTARGETFACTORY_H
diff --git a/src/plugins/remotelinux/genericembeddedlinuxtarget.cpp b/src/plugins/remotelinux/genericembeddedlinuxtarget.cpp
deleted file mode 100644
index 4cd46186b8..0000000000
--- a/src/plugins/remotelinux/genericembeddedlinuxtarget.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "genericembeddedlinuxtarget.h"
-
-#include "remotelinux_constants.h"
-#include "remotelinuxrunconfiguration.h"
-
-#include <projectexplorer/devicesupport/idevice.h>
-#include <qt4projectmanager/qt4buildconfiguration.h>
-#include <qt4projectmanager/qt4nodes.h>
-#include <qt4projectmanager/qt4project.h>
-#include <qtsupport/baseqtversion.h>
-#include <qtsupport/customexecutablerunconfiguration.h>
-
-#include <QCoreApplication>
-
-namespace RemoteLinux {
-namespace Internal {
-
-GenericEmbeddedLinuxTarget::GenericEmbeddedLinuxTarget(Qt4ProjectManager::Qt4Project *parent,
- const Core::Id id) :
- AbstractEmbeddedLinuxTarget(parent, id)
-{
- setDisplayName(tr("Embedded Linux"));
-}
-
-QList<ProjectExplorer::RunConfiguration *> GenericEmbeddedLinuxTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
-{
- QList<ProjectExplorer::RunConfiguration *> result;
- foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
- if (RemoteLinuxRunConfiguration *qt4c = qobject_cast<RemoteLinuxRunConfiguration *>(rc))
- if (qt4c->proFilePath() == n->path())
- result << rc;
- return result;
-}
-
-Utils::FileName GenericEmbeddedLinuxTarget::mkspec(const Qt4ProjectManager::Qt4BuildConfiguration *bc) const
-{
- QtSupport::BaseQtVersion *version = bc->qtVersion();
- if (!version)
- return Utils::FileName();
- return version->mkspec();
-}
-
-bool GenericEmbeddedLinuxTarget::supportsDevice(const ProjectExplorer::IDevice::ConstPtr &device) const
-{
- return device->type() == Core::Id(Constants::GenericLinuxOsType);
-}
-
-void GenericEmbeddedLinuxTarget::createApplicationProFiles(bool reparse)
-{
- if (!reparse)
- removeUnconfiguredCustomExectutableRunConfigurations();
-
- // We use the list twice
- QList<Qt4ProjectManager::Qt4ProFileNode *> profiles = qt4Project()->applicationProFiles();
- QStringList pathes;
- foreach (Qt4ProjectManager::Qt4ProFileNode *pro, profiles)
- pathes.append(pro->path());
-
- foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) {
- if (RemoteLinuxRunConfiguration *qt4rc = qobject_cast<RemoteLinuxRunConfiguration *>(rc))
- pathes.removeAll(qt4rc->proFilePath());
- }
-
- // Only add new runconfigurations if there are none.
- foreach (const QString &path, pathes) {
- RemoteLinuxRunConfiguration *qt4rc =
- new RemoteLinuxRunConfiguration(this, Core::Id(RemoteLinuxRunConfiguration::Id), path);
- addRunConfiguration(qt4rc);
- }
-
- // Oh still none? Add a custom executable runconfiguration
- if (runConfigurations().isEmpty())
- addRunConfiguration(new QtSupport::CustomExecutableRunConfiguration(this));
-}
-
-} // namespace Internal
-} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/genericremotelinuxdeploystepfactory.cpp b/src/plugins/remotelinux/genericremotelinuxdeploystepfactory.cpp
index 93d7159044..1aebf376fd 100644
--- a/src/plugins/remotelinux/genericremotelinuxdeploystepfactory.cpp
+++ b/src/plugins/remotelinux/genericremotelinuxdeploystepfactory.cpp
@@ -33,13 +33,15 @@
#include "genericdirectuploadstep.h"
#include "remotelinuxcheckforfreediskspacestep.h"
+#include "remotelinuxdeployconfiguration.h"
#include "remotelinuxdeployconfigurationfactory.h"
#include "remotelinuxcustomcommanddeploymentstep.h"
#include "tarpackagecreationstep.h"
#include "uploadandinstalltarpackagestep.h"
#include <projectexplorer/buildsteplist.h>
-#include <projectexplorer/deployconfiguration.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/target.h>
using namespace ProjectExplorer;
@@ -54,8 +56,7 @@ GenericRemoteLinuxDeployStepFactory::GenericRemoteLinuxDeployStepFactory(QObject
QList<Core::Id> GenericRemoteLinuxDeployStepFactory::availableCreationIds(BuildStepList *parent) const
{
QList<Core::Id> ids;
- const DeployConfiguration * const dc = qobject_cast<DeployConfiguration *>(parent->parent());
- if (!dc || dc->id() != RemoteLinuxDeployConfigurationFactory::genericDeployConfigurationId())
+ if (!qobject_cast<RemoteLinuxDeployConfiguration *>(parent->parent()))
return ids;
ids << TarPackageCreationStep::stepId() << UploadAndInstallTarPackageStep::stepId()
<< GenericDirectUploadStep::stepId()
diff --git a/src/plugins/remotelinux/linuxdeviceconfiguration.cpp b/src/plugins/remotelinux/linuxdeviceconfiguration.cpp
index 1a192ecd5a..fd0d12b8b0 100644
--- a/src/plugins/remotelinux/linuxdeviceconfiguration.cpp
+++ b/src/plugins/remotelinux/linuxdeviceconfiguration.cpp
@@ -29,6 +29,7 @@
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
+
#include "linuxdeviceconfiguration.h"
#include "genericlinuxdeviceconfigurationwidget.h"
@@ -39,6 +40,9 @@
#include "remotelinux_constants.h"
#include <coreplugin/id.h>
+
+#include <utils/portlist.h>
+#include <ssh/sshconnection.h>
#include <utils/qtcassert.h>
namespace RemoteLinux {
diff --git a/src/plugins/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro
index 834306880b..b20e68f78b 100644
--- a/src/plugins/remotelinux/remotelinux.pro
+++ b/src/plugins/remotelinux/remotelinux.pro
@@ -6,8 +6,6 @@ include(../../qtcreatorplugin.pri)
include(remotelinux_dependencies.pri)
HEADERS += \
- genericembeddedlinuxtarget.h \
- embeddedlinuxtargetfactory.h \
embeddedlinuxqtversion.h \
embeddedlinuxqtversionfactory.h \
remotelinuxplugin.h \
@@ -56,14 +54,11 @@ HEADERS += \
startgdbserverdialog.h \
remotelinuxcustomcommanddeployservice.h \
remotelinuxcustomcommanddeploymentstep.h \
- abstractembeddedlinuxtarget.h \
genericlinuxdeviceconfigurationwidget.h \
remotelinuxcheckforfreediskspaceservice.h \
remotelinuxcheckforfreediskspacestep.h
SOURCES += \
- genericembeddedlinuxtarget.cpp \
- embeddedlinuxtargetfactory.cpp \
embeddedlinuxqtversion.cpp \
embeddedlinuxqtversionfactory.cpp \
remotelinuxplugin.cpp \
@@ -109,7 +104,6 @@ SOURCES += \
startgdbserverdialog.cpp \
remotelinuxcustomcommanddeployservice.cpp \
remotelinuxcustomcommanddeploymentstep.cpp \
- abstractembeddedlinuxtarget.cpp \
genericlinuxdeviceconfigurationwidget.cpp \
remotelinuxcheckforfreediskspaceservice.cpp \
remotelinuxcheckforfreediskspacestep.cpp
diff --git a/src/plugins/remotelinux/remotelinux.qbs b/src/plugins/remotelinux/remotelinux.qbs
index bad03535f8..5c6bdf04bf 100644
--- a/src/plugins/remotelinux/remotelinux.qbs
+++ b/src/plugins/remotelinux/remotelinux.qbs
@@ -28,10 +28,6 @@ QtcPlugin {
"abstractremotelinuxdeploystep.h",
"abstractuploadandinstallpackageservice.cpp",
"abstractuploadandinstallpackageservice.h",
- "abstractembeddedlinuxtarget.cpp",
- "abstractembeddedlinuxtarget.h",
- "genericembeddedlinuxtarget.cpp",
- "genericembeddedlinuxtarget.h",
"deployablefile.h",
"deployablefilesperprofile.cpp",
"deployablefilesperprofile.h",
@@ -43,8 +39,6 @@ QtcPlugin {
"embeddedlinuxqtversion.h",
"embeddedlinuxqtversionfactory.cpp",
"embeddedlinuxqtversionfactory.h",
- "embeddedlinuxtargetfactory.cpp",
- "embeddedlinuxtargetfactory.h",
"genericdirectuploadservice.cpp",
"genericdirectuploadstep.h",
"genericlinuxdeviceconfigurationfactory.cpp",
diff --git a/src/plugins/remotelinux/remotelinux_constants.h b/src/plugins/remotelinux/remotelinux_constants.h
index dc7c90df81..ae7049f593 100644
--- a/src/plugins/remotelinux/remotelinux_constants.h
+++ b/src/plugins/remotelinux/remotelinux_constants.h
@@ -42,7 +42,6 @@ const char GenericDeployKeyToDeviceActionId[] = "RemoteLinux.GenericDeployKeyToD
const char GenericRemoteProcessesActionId[] = "RemoteLinux.GenericRemoteProcessesAction";
const char EMBEDDED_LINUX_QT[] = "RemoteLinux.EmbeddedLinuxQt";
-const char EMBEDDED_LINUX_TARGET_ID[] = "RemoteLinux.EmbeddedLinuxTarget";
} // Constants
} // RemoteLinux
diff --git a/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp b/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp
index f8cb42f094..5744373eea 100644
--- a/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp
+++ b/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp
@@ -35,6 +35,9 @@
#include "remotelinuxrunconfiguration.h"
#include "remotelinuxusedportsgatherer.h"
+#include <projectexplorer/target.h>
+#include <projectexplorer/profileinformation.h>
+
#include <utils/portlist.h>
#include <utils/qtcassert.h>
#include <ssh/sshconnection.h>
@@ -63,16 +66,16 @@ class AbstractRemoteLinuxApplicationRunnerPrivate
{
public:
AbstractRemoteLinuxApplicationRunnerPrivate(const RemoteLinuxRunConfiguration *runConfig)
- : devConfig(runConfig->deviceConfig()),
+ : devConfig(ProjectExplorer::DeviceProfileInformation::device(runConfig->target()->profile())
+ .dynamicCast<const LinuxDeviceConfiguration>()),
remoteExecutable(runConfig->remoteExecutableFilePath()),
appArguments(runConfig->arguments()),
commandPrefix(runConfig->commandPrefix()),
- initialFreePorts(runConfig->freePorts()),
+ initialFreePorts(devConfig->freePorts()),
connection(0),
stopRequested(false),
state(Inactive)
- {
- }
+ { }
RemoteLinuxUsedPortsGatherer portsGatherer;
LinuxDeviceConfiguration::ConstPtr devConfig;
diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp
index 0e75c07a25..a561bda67a 100644
--- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp
+++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp
@@ -37,11 +37,14 @@
#include <debugger/debuggerengine.h>
#include <debugger/debuggerstartparameters.h>
+#include <debugger/debuggerprofileinformation.h>
#include <projectexplorer/abi.h>
+#include <projectexplorer/profile.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
+#include <qtsupport/qtprofileinformation.h>
#include <utils/qtcassert.h>
#include <QPointer>
@@ -94,29 +97,35 @@ using namespace Internal;
DebuggerStartParameters AbstractRemoteLinuxDebugSupport::startParameters(const RemoteLinuxRunConfiguration *runConfig)
{
DebuggerStartParameters params;
- const IDevice::ConstPtr &devConf = runConfig->deviceConfig();
+ const LinuxDeviceConfiguration::ConstPtr devConf
+ = ProjectExplorer::DeviceProfileInformation::device(runConfig->target()->profile())
+ .dynamicCast<const RemoteLinux::LinuxDeviceConfiguration>();
if (runConfig->debuggerAspect()->useQmlDebugger()) {
params.languages |= QmlLanguage;
- params.qmlServerAddress = runConfig->deviceConfig()->sshParameters().host;
+ params.qmlServerAddress = devConf->sshParameters().host;
params.qmlServerPort = 0; // port is selected later on
}
if (runConfig->debuggerAspect()->useCppDebugger()) {
params.languages |= CppLanguage;
params.processArgs = runConfig->arguments();
- if (runConfig->activeQt4BuildConfiguration()->qtVersion())
- params.sysroot = runConfig->activeQt4BuildConfiguration()->qtVersion()->systemRoot();
+ QString systemRoot;
+ if (ProjectExplorer::SysRootProfileInformation::hasSysRoot(runConfig->target()->profile()))
+ systemRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(runConfig->target()->profile()).toString();
+ params.sysroot = systemRoot;
params.toolChainAbi = runConfig->abi();
params.startMode = AttachToRemoteServer;
params.executable = runConfig->localExecutableFilePath();
- params.debuggerCommand = runConfig->gdbCmd();
+ params.debuggerCommand = Debugger::DebuggerProfileInformation::debuggerCommand(runConfig->target()->profile()).toString();
params.remoteChannel = devConf->sshParameters().host + QLatin1String(":-1");
// TODO: This functionality should be inside the debugger.
- const ProjectExplorer::Abi &abi = runConfig->target()
- ->activeBuildConfiguration()->toolChain()->targetAbi();
- params.remoteArchitecture = abi.toString();
- params.gnuTarget = QLatin1String(abi.architecture() == ProjectExplorer::Abi::ArmArchitecture
- ? "arm-none-linux-gnueabi": "i386-unknown-linux-gnu");
+ ToolChain *tc = ToolChainProfileInformation::toolChain(runConfig->target()->profile());
+ if (tc) {
+ const ProjectExplorer::Abi &abi = tc->targetAbi();
+ params.remoteArchitecture = abi.toString();
+ params.gnuTarget = QLatin1String(abi.architecture() == ProjectExplorer::Abi::ArmArchitecture
+ ? "arm-none-linux-gnueabi": "i386-unknown-linux-gnu");
+ }
} else {
params.startMode = AttachToRemoteServer;
}
diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp
index 788777f591..91f3dc365d 100644
--- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp
+++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp
@@ -31,109 +31,62 @@
**************************************************************************/
#include "remotelinuxdeployconfiguration.h"
-#include "abstractembeddedlinuxtarget.h"
#include "deploymentinfo.h"
#include "remotelinuxdeployconfigurationwidget.h"
#include "typespecificdeviceconfigurationlistmodel.h"
#include <coreplugin/id.h>
#include <projectexplorer/devicesupport/devicemanager.h>
-#include <qt4projectmanager/qt4target.h>
+#include <projectexplorer/target.h>
+#include <qt4projectmanager/qt4project.h>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
-namespace RemoteLinux {
-namespace Internal {
namespace {
-const char DeviceIdKey[] = "Qt4ProjectManager.MaemoRunConfiguration.DeviceId";
-} // anonymous namespace
-
-class RemoteLinuxDeployConfigurationPrivate
-{
-public:
- QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration;
-};
+const char DEPLOYMENT_INFO_SETTING[] = "RemoteLinux.DeploymentInfo";
+} // namespace
-} // namespace Internal
+namespace RemoteLinux {
using namespace Internal;
RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
const Core::Id id, const QString &defaultDisplayName)
- : DeployConfiguration(target, id), d(new RemoteLinuxDeployConfigurationPrivate)
+ : DeployConfiguration(target, id)
{
setDefaultDisplayName(defaultDisplayName);
- initialize();
+ // 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,
RemoteLinuxDeployConfiguration *source)
- : DeployConfiguration(target, source), d(new RemoteLinuxDeployConfigurationPrivate)
-{
- initialize();
-}
-
-RemoteLinuxDeployConfiguration::~RemoteLinuxDeployConfiguration()
-{
- delete d;
-}
-
-void RemoteLinuxDeployConfiguration::initialize()
-{
- d->deviceConfiguration = target()->deviceConfigModel()->defaultDeviceConfig();
- connect(target()->deviceConfigModel(), SIGNAL(modelReset()),
- SLOT(handleDeviceConfigurationListUpdated()));
-}
-
-void RemoteLinuxDeployConfiguration::handleDeviceConfigurationListUpdated()
-{
- setDeviceConfig(DeviceManager::instance()->deviceId(d->deviceConfiguration));
-}
+ : DeployConfiguration(target, source)
+{ }
-void RemoteLinuxDeployConfiguration::setDeviceConfig(Core::Id id)
-{
- d->deviceConfiguration = target()->deviceConfigModel()->find(id);
- emit deviceConfigurationListChanged();
- emit currentDeviceConfigurationChanged();
-}
-
-bool RemoteLinuxDeployConfiguration::fromMap(const QVariantMap &map)
-{
- if (!DeployConfiguration::fromMap(map))
- return false;
- const QString idString = map.value(QLatin1String(DeviceIdKey)).toString();
- setDeviceConfig(!idString.isEmpty() ? Core::Id(idString) : IDevice::invalidId());
- return true;
-}
-
-QVariantMap RemoteLinuxDeployConfiguration::toMap() const
-{
- QVariantMap map = DeployConfiguration::toMap();
- map.insert(QLatin1String(DeviceIdKey),
- DeviceManager::instance()->deviceId(d->deviceConfiguration).toString());
- return map;
-}
-
-void RemoteLinuxDeployConfiguration::setDeviceConfiguration(int index)
+DeploymentInfo *RemoteLinuxDeployConfiguration::deploymentInfo() const
{
- const LinuxDeviceConfiguration::ConstPtr &newDevConf
- = target()->deviceConfigModel()->deviceAt(index);
- if (d->deviceConfiguration != newDevConf) {
- d->deviceConfiguration = newDevConf;
- emit currentDeviceConfigurationChanged();
- }
+ DeploymentInfo *info
+ = qobject_cast<DeploymentInfo *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING)).value<QObject *>());
+ return info;
}
-AbstractEmbeddedLinuxTarget *RemoteLinuxDeployConfiguration::target() const
+QString RemoteLinuxDeployConfiguration::qmakeScope() const
{
- return qobject_cast<AbstractEmbeddedLinuxTarget *>(DeployConfiguration::target());
+ return QLatin1String("unix");
}
-DeploymentInfo *RemoteLinuxDeployConfiguration::deploymentInfo() const
+QString RemoteLinuxDeployConfiguration::installPrefix() const
{
- return target()->deploymentInfo();
+ return QString();
}
DeployConfigurationWidget *RemoteLinuxDeployConfiguration::configurationWidget() const
@@ -141,9 +94,4 @@ DeployConfigurationWidget *RemoteLinuxDeployConfiguration::configurationWidget()
return new RemoteLinuxDeployConfigurationWidget;
}
-LinuxDeviceConfiguration::ConstPtr RemoteLinuxDeployConfiguration::deviceConfiguration() const
-{
- return d->deviceConfiguration;
-}
-
} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.h b/src/plugins/remotelinux/remotelinuxdeployconfiguration.h
index b000e2023e..55ee42421d 100644
--- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.h
+++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.h
@@ -29,24 +29,25 @@
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
+
#ifndef REMOTELINUXDEPLOYCONFIGURATION_H
#define REMOTELINUXDEPLOYCONFIGURATION_H
#include "linuxdeviceconfiguration.h"
+
#include "remotelinux_export.h"
+#include <coreplugin/id.h>
#include <projectexplorer/buildstep.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/deployconfiguration.h>
-#include <QSharedPointer>
-
namespace RemoteLinux {
class AbstractEmbeddedLinuxTarget;
class DeploymentInfo;
namespace Internal {
-class RemoteLinuxDeployConfigurationPrivate;
+class RemoteLinuxDeployConfigurationFactory;
class TypeSpecificDeviceConfigurationListModel;
} // namespace Internal
@@ -54,22 +55,16 @@ class REMOTELINUX_EXPORT RemoteLinuxDeployConfiguration
: public ProjectExplorer::DeployConfiguration
{
Q_OBJECT
- Q_DISABLE_COPY(RemoteLinuxDeployConfiguration)
+
public:
RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target, const Core::Id id,
const QString &defaultDisplayName);
RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
RemoteLinuxDeployConfiguration *source);
- ~RemoteLinuxDeployConfiguration();
-
- bool fromMap(const QVariantMap &map);
ProjectExplorer::DeployConfigurationWidget *configurationWidget() const;
- void setDeviceConfiguration(int index);
- AbstractEmbeddedLinuxTarget *target() const;
DeploymentInfo *deploymentInfo() const;
- QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration() const;
template<class T> T *earlierBuildStep(const ProjectExplorer::BuildStep *laterBuildStep) const
{
@@ -83,20 +78,14 @@ public:
return 0;
}
-protected:
- QVariantMap toMap() const;
+ virtual QString qmakeScope() const;
+ virtual QString installPrefix() const;
signals:
- void deviceConfigurationListChanged();
- void currentDeviceConfigurationChanged();
+ void packagingChanged();
private:
-
- void initialize();
- void setDeviceConfig(Core::Id id);
- Q_SLOT void handleDeviceConfigurationListUpdated();
-
- Internal::RemoteLinuxDeployConfigurationPrivate * const d;
+ friend class Internal::RemoteLinuxDeployConfigurationFactory;
};
} // namespace RemoteLinux
diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp b/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp
index 7ff2c34c30..5d7590be6f 100644
--- a/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp
+++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp
@@ -31,11 +31,17 @@
**************************************************************************/
#include "remotelinuxdeployconfigurationfactory.h"
-#include "genericembeddedlinuxtarget.h"
#include "genericdirectuploadstep.h"
#include "remotelinuxcheckforfreediskspacestep.h"
+#include "remotelinux_constants.h"
#include "remotelinuxdeployconfiguration.h"
+#include <projectexplorer/abi.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
+#include <qt4projectmanager/qt4project.h>
+
#include <QCoreApplication>
using namespace ProjectExplorer;
@@ -50,12 +56,23 @@ QString genericLinuxDisplayName() {
RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory(QObject *parent)
: DeployConfigurationFactory(parent)
-{ }
+{ setObjectName(QLatin1String("RemoteLinuxDeployConfiguration"));}
QList<Core::Id> RemoteLinuxDeployConfigurationFactory::availableCreationIds(Target *parent) const
{
QList<Core::Id> ids;
- if (qobject_cast<GenericEmbeddedLinuxTarget *>(parent))
+ if (!qobject_cast<Qt4ProjectManager::Qt4Project *>(parent->project()))
+ return ids;
+ ProjectExplorer::ToolChain *tc
+ = ProjectExplorer::ToolChainProfileInformation::toolChain(parent->profile());
+ if (!tc || tc->targetAbi().os() != ProjectExplorer::Abi::LinuxOS)
+ return ids;
+ if (ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->profile())
+ == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
+ return ids;
+
+ ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceProfileInformation::device(parent->profile());
+ if (!dev.isNull() && dev->type() == Core::Id(Constants::GenericLinuxOsType))
ids << genericDeployConfigurationId();
return ids;
}
diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp
index 818221ffcc..d5440c2a43 100644
--- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp
+++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp
@@ -31,7 +31,6 @@
#include "remotelinuxdeployconfigurationwidget.h"
#include "ui_remotelinuxdeployconfigurationwidget.h"
-#include "abstractembeddedlinuxtarget.h"
#include "deployablefilesperprofile.h"
#include "deploymentinfo.h"
#include "remotelinuxdeployconfiguration.h"
@@ -42,6 +41,7 @@
#include <coreplugin/id.h>
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
#include <QTreeView>
@@ -102,17 +102,8 @@ void RemoteLinuxDeployConfigurationWidget::init(DeployConfiguration *dc)
d->deployConfiguration = qobject_cast<RemoteLinuxDeployConfiguration *>(dc);
Q_ASSERT(d->deployConfiguration);
- connect(d->ui.manageDevConfsLabel, SIGNAL(linkActivated(QString)),
- SLOT(showDeviceConfigurations()));
connect(&d->treeView, SIGNAL(doubleClicked()), SLOT(openProjectFile()));
- d->ui.deviceConfigsComboBox->setModel(d->deployConfiguration->target()->deviceConfigModel());
- connect(d->ui.deviceConfigsComboBox, SIGNAL(activated(int)),
- SLOT(handleSelectedDeviceConfigurationChanged(int)));
- connect(d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()),
- SLOT(handleDeviceConfigurationListChanged()));
- handleDeviceConfigurationListChanged();
-
d->ui.projectsComboBox->setModel(d->deployConfiguration->deploymentInfo());
connect(d->deployConfiguration->deploymentInfo(), SIGNAL(modelAboutToBeReset()),
SLOT(handleModelListToBeReset()));
@@ -170,32 +161,6 @@ void RemoteLinuxDeployConfigurationWidget::setModel(int row)
emit currentModelChanged(proFileInfo);
}
-void RemoteLinuxDeployConfigurationWidget::handleSelectedDeviceConfigurationChanged(int index)
-{
- disconnect(d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()), this,
- SLOT(handleDeviceConfigurationListChanged()));
- d->deployConfiguration->setDeviceConfiguration(index);
- connect(d->deployConfiguration, SIGNAL(deviceConfigurationListChanged()),
- SLOT(handleDeviceConfigurationListChanged()));
-}
-
-void RemoteLinuxDeployConfigurationWidget::handleDeviceConfigurationListChanged()
-{
- const LinuxDeviceConfiguration::ConstPtr &devConf
- = d->deployConfiguration->deviceConfiguration();
- const Core::Id id = DeviceManager::instance()->deviceId(devConf);
- const int newIndex
- = d->deployConfiguration->target()->deviceConfigModel()->indexForId(id);
- d->ui.deviceConfigsComboBox->setCurrentIndex(newIndex);
-}
-
-void RemoteLinuxDeployConfigurationWidget::showDeviceConfigurations()
-{
- Core::ICore::showOptionsDialog(
- QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY),
- QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_PAGE_ID));
-}
-
void RemoteLinuxDeployConfigurationWidget::openProjectFile()
{
const int row = d->ui.projectsComboBox->currentIndex();
diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h
index b28e7f707f..0d0036a43a 100644
--- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h
+++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h
@@ -64,9 +64,6 @@ private slots:
void handleModelListToBeReset();
void handleModelListReset();
void setModel(int row);
- void handleSelectedDeviceConfigurationChanged(int index);
- void handleDeviceConfigurationListChanged();
- void showDeviceConfigurations();
void openProjectFile();
private:
diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui
index caba98032e..2bfa1bd8a6 100644
--- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui
+++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui
@@ -16,41 +16,10 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ </property>
<item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Device configuration:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QComboBox" name="deviceConfigsComboBox"/>
- </item>
- <item>
- <widget class="QLabel" name="manageDevConfsLabel">
- <property name="text">
- <string>&lt;a href=&quot;irrelevant&quot;&gt;Manage device configurations&lt;/a&gt;</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 row="1" column="0">
<widget class="QLabel" name="installLabel">
<property name="toolTip">
<string>These show the INSTALLS settings from the project file(s).</string>
@@ -60,7 +29,7 @@
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="projectsComboBox">
diff --git a/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp b/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp
index 5b51621fca..97fdd7c1d6 100644
--- a/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp
+++ b/src/plugins/remotelinux/remotelinuxenvironmentreader.cpp
@@ -34,6 +34,8 @@
#include "remotelinuxrunconfiguration.h"
#include <ssh/sshremoteprocessrunner.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/target.h>
namespace RemoteLinux {
namespace Internal {
@@ -42,11 +44,11 @@ RemoteLinuxEnvironmentReader::RemoteLinuxEnvironmentReader(RemoteLinuxRunConfigu
QObject *parent)
: QObject(parent)
, m_stop(false)
- , m_devConfig(config->deviceConfig())
+ , m_devConfig(ProjectExplorer::DeviceProfileInformation::device(config->target()->profile()))
, m_runConfig(config)
, m_remoteProcessRunner(0)
{
- connect(config, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
+ connect(config->target(), SIGNAL(profileChanged()),
this, SLOT(handleCurrentDeviceConfigChanged()));
}
@@ -87,7 +89,7 @@ void RemoteLinuxEnvironmentReader::handleConnectionFailure()
void RemoteLinuxEnvironmentReader::handleCurrentDeviceConfigChanged()
{
- m_devConfig = m_runConfig->deviceConfig();
+ m_devConfig = ProjectExplorer::DeviceProfileInformation::device(m_runConfig->target()->profile());
if (m_remoteProcessRunner)
disconnect(m_remoteProcessRunner, 0, this, 0);
diff --git a/src/plugins/remotelinux/remotelinuxenvironmentreader.h b/src/plugins/remotelinux/remotelinuxenvironmentreader.h
index acda6147d9..d1c78dada2 100644
--- a/src/plugins/remotelinux/remotelinuxenvironmentreader.h
+++ b/src/plugins/remotelinux/remotelinuxenvironmentreader.h
@@ -32,10 +32,11 @@
#ifndef REMOTELINUXENVIRONMENTREADER_H
#define REMOTELINUXENVIRONMENTREADER_H
+#include <projectexplorer/devicesupport/idevice.h>
#include <utils/environment.h>
#include <QObject>
-#include <QSharedPointer>
+
namespace QSsh {
class SshRemoteProcessRunner;
@@ -74,7 +75,7 @@ private:
bool m_stop;
Utils::Environment m_env;
- QSharedPointer<const LinuxDeviceConfiguration> m_devConfig;
+ ProjectExplorer::IDevice::ConstPtr m_devConfig;
RemoteLinuxRunConfiguration *m_runConfig;
QSsh::SshRemoteProcessRunner *m_remoteProcessRunner;
};
diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp
index 0cf91f4fdf..f037a30768 100644
--- a/src/plugins/remotelinux/remotelinuxplugin.cpp
+++ b/src/plugins/remotelinux/remotelinuxplugin.cpp
@@ -33,7 +33,6 @@
#include "remotelinuxplugin.h"
#include "embeddedlinuxqtversionfactory.h"
-#include "embeddedlinuxtargetfactory.h"
#include "deployablefile.h"
#include "genericlinuxdeviceconfigurationfactory.h"
#include "genericremotelinuxdeploystepfactory.h"
@@ -76,7 +75,6 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments,
addAutoReleasedObject(new RemoteLinuxDeployConfigurationFactory);
addAutoReleasedObject(new GenericRemoteLinuxDeployStepFactory);
- addAutoReleasedObject(new EmbeddedLinuxTargetFactory);
addAutoReleasedObject(new EmbeddedLinuxQtVersionFactory);
qRegisterMetaType<RemoteLinux::DeployableFile>("RemoteLinux::DeployableFile");
diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp
index 50c1a714e0..a46252a62c 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp
+++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp
@@ -39,12 +39,12 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
+#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <qtsupport/qtoutputformatter.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4nodes.h>
#include <qt4projectmanager/qt4project.h>
-#include <qt4projectmanager/qt4target.h>
#include <utils/portlist.h>
#include <utils/qtcassert.h>
@@ -70,13 +70,15 @@ const char WorkingDirectoryKey[] = "RemoteLinux.RunConfig.WorkingDirectory";
class RemoteLinuxRunConfigurationPrivate {
public:
- RemoteLinuxRunConfigurationPrivate(const QString &proFilePath, const Qt4BaseTarget *target)
+ RemoteLinuxRunConfigurationPrivate(const QString &proFilePath, const ProjectExplorer::Target *target)
: proFilePath(proFilePath),
baseEnvironmentType(RemoteLinuxRunConfiguration::RemoteBaseEnvironment),
- validParse(target->qt4Project()->validParse(proFilePath)),
- parseInProgress(target->qt4Project()->parseInProgress(proFilePath)),
+ 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)
@@ -110,7 +112,7 @@ public:
using namespace Internal;
-RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent, const Core::Id id,
+RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, const Core::Id id,
const QString &proFilePath)
: RunConfiguration(parent, id),
d(new RemoteLinuxRunConfigurationPrivate(proFilePath, parent))
@@ -118,7 +120,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent,
init();
}
-RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Qt4BaseTarget *parent,
+RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(ProjectExplorer::Target *parent,
RemoteLinuxRunConfiguration *source)
: RunConfiguration(parent, source),
d(new RemoteLinuxRunConfigurationPrivate(source->d))
@@ -136,14 +138,11 @@ void RemoteLinuxRunConfiguration::init()
this, SLOT(handleDeployConfigChanged()));
handleDeployConfigChanged();
- Qt4Project *pro = qt4Target()->qt4Project();
+ Qt4Project *pro = static_cast<Qt4Project *>(target()->project());
connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)),
this, SLOT(proFileUpdate(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
-}
-
-Qt4BaseTarget *RemoteLinuxRunConfiguration::qt4Target() const
-{
- return static_cast<Qt4BaseTarget *>(target());
+ connect(target(), SIGNAL(profileChanged()),
+ this, SLOT(handleDeployablesUpdated())); // Handles device changes, etc.
}
Qt4BuildConfiguration *RemoteLinuxRunConfiguration::activeQt4BuildConfiguration() const
@@ -159,7 +158,7 @@ bool RemoteLinuxRunConfiguration::isEnabled() const
return false;
}
if (!d->validParse) {
- Qt4Project *project = qt4Target()->qt4Project();
+ Qt4Project *project = static_cast<Qt4Project *>(target()->project());
d->disabledReason = project->disabledReasonForRunConfiguration(d->proFilePath);
return false;
}
@@ -187,7 +186,7 @@ QWidget *RemoteLinuxRunConfiguration::createConfigurationWidget()
OutputFormatter *RemoteLinuxRunConfiguration::createOutputFormatter() const
{
- return new QtSupport::QtOutputFormatter(qt4Target()->qt4Project());
+ return new QtSupport::QtOutputFormatter(target()->project());
}
void RemoteLinuxRunConfiguration::proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress)
@@ -236,8 +235,9 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map)
d->alternateRemoteExecutable = map.value(QLatin1String(AlternateExeKey)).toString();
d->workingDirectory = map.value(QLatin1String(WorkingDirectoryKey)).toString();
- d->validParse = qt4Target()->qt4Project()->validParse(d->proFilePath);
- d->parseInProgress = qt4Target()->qt4Project()->parseInProgress(d->proFilePath);
+ Qt4Project *project = static_cast<Qt4Project *>(target()->project());
+ d->validParse = project->validParse(d->proFilePath);
+ d->parseInProgress = project->parseInProgress(d->proFilePath);
setDefaultDisplayName(defaultDisplayName());
@@ -253,17 +253,6 @@ QString RemoteLinuxRunConfiguration::defaultDisplayName()
return tr("Run on Remote Device");
}
-LinuxDeviceConfiguration::ConstPtr RemoteLinuxRunConfiguration::deviceConfig() const
-{
- return deployConfig()
- ? deployConfig()->deviceConfiguration() : LinuxDeviceConfiguration::ConstPtr();
-}
-
-QString RemoteLinuxRunConfiguration::gdbCmd() const
-{
- return activeBuildConfiguration()->toolChain()->debuggerCommand().toUserOutput();
-}
-
RemoteLinuxDeployConfiguration *RemoteLinuxRunConfiguration::deployConfig() const
{
return qobject_cast<RemoteLinuxDeployConfiguration *>(target()->activeDeployConfiguration());
@@ -296,7 +285,7 @@ QString RemoteLinuxRunConfiguration::commandPrefix() const
QString RemoteLinuxRunConfiguration::localExecutableFilePath() const
{
- TargetInformation ti = qt4Target()->qt4Project()->rootQt4ProjectNode()
+ TargetInformation ti = static_cast<Qt4Project *>(target()->project())->rootQt4ProjectNode()
->targetInformation(d->proFilePath);
if (!ti.valid)
return QString();
@@ -317,14 +306,6 @@ QString RemoteLinuxRunConfiguration::remoteExecutableFilePath() const
? alternateRemoteExecutable() : defaultRemoteExecutableFilePath();
}
-PortList RemoteLinuxRunConfiguration::freePorts() const
-{
- const LinuxDeviceConfiguration::ConstPtr &devConf = deviceConfig();
- if (!devConf)
- return PortList();
- return devConf->freePorts();
-}
-
void RemoteLinuxRunConfiguration::setArguments(const QString &args)
{
d->arguments = args;
@@ -371,23 +352,12 @@ int RemoteLinuxRunConfiguration::portsUsedByDebuggers() const
return ports;
}
-void RemoteLinuxRunConfiguration::updateDeviceConfigurations()
-{
- emit deviceConfigurationChanged(target());
- updateEnabledState();
-}
-
void RemoteLinuxRunConfiguration::handleDeployConfigChanged()
{
RemoteLinuxDeployConfiguration * const activeDeployConf = deployConfig();
- if (activeDeployConf) {
+ if (activeDeployConf)
connect(activeDeployConf->deploymentInfo(), SIGNAL(modelReset()),
- SLOT(handleDeployablesUpdated()), Qt::UniqueConnection);
- connect(activeDeployConf, SIGNAL(currentDeviceConfigurationChanged()),
- SLOT(updateDeviceConfigurations()), Qt::UniqueConnection);
- }
-
- updateDeviceConfigurations();
+ SLOT(handleDeployablesUpdated()), Qt::UniqueConnection);
}
void RemoteLinuxRunConfiguration::handleDeployablesUpdated()
diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.h b/src/plugins/remotelinux/remotelinuxrunconfiguration.h
index e374d9c71f..1fe6d639eb 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfiguration.h
+++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.h
@@ -35,19 +35,19 @@
#include "remotelinux_export.h"
+#include "linuxdeviceconfiguration.h"
+
#include <projectexplorer/runconfiguration.h>
#include <utils/environment.h>
namespace Qt4ProjectManager {
class Qt4BuildConfiguration;
-class Qt4BaseTarget;
class Qt4ProFileNode;
} // namespace Qt4ProjectManager
namespace Utils { class PortList; }
namespace RemoteLinux {
-class LinuxDeviceConfiguration;
class RemoteLinuxRunConfigurationWidget;
class RemoteLinuxDeployConfiguration;
@@ -71,21 +71,20 @@ public:
enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml };
- RemoteLinuxRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, const Core::Id id,
+ RemoteLinuxRunConfiguration(ProjectExplorer::Target *parent, const Core::Id id,
const QString &proFilePath);
bool isEnabled() const;
QString disabledReason() const;
QWidget *createConfigurationWidget();
Utils::OutputFormatter *createOutputFormatter() const;
- Qt4ProjectManager::Qt4BaseTarget *qt4Target() const;
Qt4ProjectManager::Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
RemoteLinuxDeployConfiguration *deployConfig() const;
+ LinuxDeviceConfiguration::ConstPtr device() const;
virtual QString environmentPreparationCommand() const;
virtual QString commandPrefix() const;
- virtual Utils::PortList freePorts() const;
QString localExecutableFilePath() const;
QString defaultRemoteExecutableFilePath() const;
@@ -98,8 +97,6 @@ public:
QString alternateRemoteExecutable() const;
void setUseAlternateExecutable(bool useAlternate);
bool useAlternateExecutable() const;
- QSharedPointer<const LinuxDeviceConfiguration> deviceConfig() const;
- QString gdbCmd() const;
virtual QVariantMap toMap() const;
@@ -117,7 +114,6 @@ public:
static const QString Id;
signals:
- void deviceConfigurationChanged(ProjectExplorer::Target *target);
void deploySpecsChanged();
void targetInformationChanged() const;
void baseEnvironmentChanged();
@@ -125,7 +121,7 @@ signals:
void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &diff);
protected:
- RemoteLinuxRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent,
+ RemoteLinuxRunConfiguration(ProjectExplorer::Target *parent,
RemoteLinuxRunConfiguration *source);
virtual bool fromMap(const QVariantMap &map);
QString defaultDisplayName();
@@ -137,7 +133,6 @@ protected slots:
private slots:
void proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress);
- void updateDeviceConfigurations();
void handleDeployConfigChanged();
void handleDeployablesUpdated();
diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp
index 921461bf23..fe0be28a81 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp
+++ b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp
@@ -31,12 +31,16 @@
**************************************************************************/
#include "remotelinuxrunconfigurationfactory.h"
+#include "remotelinux_constants.h"
#include "remotelinuxdeployconfigurationfactory.h"
#include "remotelinuxrunconfiguration.h"
#include "remotelinuxutils.h"
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4project.h>
-#include <qt4projectmanager/qt4target.h>
+#include <qt4projectmanager/qt4nodes.h>
+#include <qtsupport/customexecutablerunconfiguration.h>
#include <utils/qtcassert.h>
#include <QFileInfo>
@@ -61,50 +65,45 @@ QString pathFromId(Core::Id id)
} // namespace
RemoteLinuxRunConfigurationFactory::RemoteLinuxRunConfigurationFactory(QObject *parent)
- : IRunConfigurationFactory(parent)
-{
-}
+ : Qt4ProjectManager::QmakeRunConfigurationFactory(parent)
+{ setObjectName(QLatin1String("RemoteLinuxRunConfigurationFactory")); }
RemoteLinuxRunConfigurationFactory::~RemoteLinuxRunConfigurationFactory()
{
}
-bool RemoteLinuxRunConfigurationFactory::canCreate(Target *parent,
- const Core::Id id) const
+bool RemoteLinuxRunConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
{
- if (!QString::fromUtf8(id.name()).startsWith(RemoteLinuxRunConfiguration::Id))
+ if (!canHandle(parent))
return false;
- return qobject_cast<Qt4BaseTarget *>(parent)->qt4Project()
- ->hasApplicationProFile(pathFromId(id));
+ return static_cast<Qt4Project *>(parent->project())->hasApplicationProFile(pathFromId(id));
}
bool RemoteLinuxRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
{
- Q_UNUSED(parent);
- return QString::fromLatin1(ProjectExplorer::idFromMap(map).name()).startsWith(RemoteLinuxRunConfiguration::Id);
+ if (!canHandle(parent))
+ return false;
+ return ProjectExplorer::idFromMap(map).toString().startsWith(RemoteLinuxRunConfiguration::Id);
}
bool RemoteLinuxRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
{
const RemoteLinuxRunConfiguration * const rlrc
= qobject_cast<RemoteLinuxRunConfiguration *>(source);
- const QString idStr = QString::fromLatin1(source->id().name()) + QLatin1Char('.') + rlrc->proFilePath();
- return rlrc && canCreate(parent, Core::Id(idStr.toUtf8().constData()));
+ const QString idStr = source->id().toString() + QLatin1Char('.') + rlrc->proFilePath();
+ return rlrc && canCreate(parent, Core::Id(idStr));
}
QList<Core::Id> RemoteLinuxRunConfigurationFactory::availableCreationIds(Target *parent) const
{
QList<Core::Id> result;
- const QList<DeployConfiguration *> &depConfs = parent->deployConfigurations();
- foreach (const DeployConfiguration * const dc, depConfs) {
- if (dc->id() == RemoteLinuxDeployConfigurationFactory::genericDeployConfigurationId()) {
- QStringList proFiles = qobject_cast<Qt4BaseTarget *>(parent)->qt4Project()
- ->applicationProFilePathes(RemoteLinuxRunConfiguration::Id);
- foreach (const QString &pf, proFiles)
- result << Core::Id(pf);
- return result;
- }
- }
+ if (!canHandle(parent))
+ return result;
+
+ QStringList proFiles = static_cast<Qt4Project *>(parent->project())
+ ->applicationProFilePathes(RemoteLinuxRunConfiguration::Id);
+ foreach (const QString &pf, proFiles)
+ result << Core::Id(pf);
return result;
}
@@ -117,15 +116,15 @@ QString RemoteLinuxRunConfigurationFactory::displayNameForId(const Core::Id id)
RunConfiguration *RemoteLinuxRunConfigurationFactory::create(Target *parent, const Core::Id id)
{
QTC_ASSERT(canCreate(parent, id), return 0);
- return new RemoteLinuxRunConfiguration(qobject_cast<Qt4BaseTarget *>(parent), id, pathFromId(id));
+ return new RemoteLinuxRunConfiguration(parent, id, pathFromId(id));
}
RunConfiguration *RemoteLinuxRunConfigurationFactory::restore(Target *parent,
const QVariantMap &map)
{
QTC_ASSERT(canRestore(parent, map), return 0);
- RemoteLinuxRunConfiguration *rc = new RemoteLinuxRunConfiguration(qobject_cast<Qt4BaseTarget *>(parent),
- Core::Id(RemoteLinuxRunConfiguration::Id), QString());
+ RemoteLinuxRunConfiguration *rc
+ = new RemoteLinuxRunConfiguration(parent, Core::Id(RemoteLinuxRunConfiguration::Id), QString());
if (rc->fromMap(map))
return rc;
@@ -138,7 +137,28 @@ RunConfiguration *RemoteLinuxRunConfigurationFactory::clone(Target *parent,
{
QTC_ASSERT(canClone(parent, source), return 0);
RemoteLinuxRunConfiguration *old = static_cast<RemoteLinuxRunConfiguration *>(source);
- return new RemoteLinuxRunConfiguration(static_cast<Qt4BaseTarget *>(parent), old);
+ return new RemoteLinuxRunConfiguration(parent, old);
+}
+
+bool RemoteLinuxRunConfigurationFactory::canHandle(Target *t) const
+{
+ if (!t->project()->supportsProfile(t->profile()))
+ return false;
+ if (!qobject_cast<Qt4Project *>(t->project()))
+ return false;
+
+ Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(t->profile());
+ return deviceType == Core::Id(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
diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h
index a2704a23a1..988b76447d 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h
+++ b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h
@@ -33,11 +33,14 @@
#define REMOTELINUXRUNCONFIGURATIONFACTORY_H
#include <projectexplorer/runconfiguration.h>
+#include <qt4projectmanager/qmakerunconfigurationfactory.h>
+
+namespace ProjectExplorer { class Node; }
namespace RemoteLinux {
namespace Internal {
-class RemoteLinuxRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
+class RemoteLinuxRunConfigurationFactory : public Qt4ProjectManager::QmakeRunConfigurationFactory
{
Q_OBJECT
@@ -58,6 +61,10 @@ public:
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
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);
};
} // namespace Internal
diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp
index bf30a70ff5..7ee46a0459 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp
+++ b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp
@@ -41,7 +41,6 @@
#include <projectexplorer/environmentwidget.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
-#include <qt4projectmanager/qt4target.h>
#include <utils/detailswidget.h>
#include <QCoreApplication>
@@ -111,9 +110,6 @@ RemoteLinuxRunConfigurationWidget::RemoteLinuxRunConfigurationWidget(RemoteLinux
addGenericWidgets(mainLayout);
addEnvironmentWidgets(mainLayout);
- connect(d->runConfiguration, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
- SLOT(handleCurrentDeviceConfigChanged()));
- handleCurrentDeviceConfigChanged();
connect(d->runConfiguration, SIGNAL(enabledChanged()),
SLOT(runConfigurationEnabledChange()));
runConfigurationEnabledChange();
@@ -163,21 +159,6 @@ void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayou
d->genericWidgetsLayout.setFormAlignment(Qt::AlignLeft | Qt::AlignVCenter);
- QWidget * const devConfWidget = new QWidget;
- QHBoxLayout * const devConfLayout = new QHBoxLayout(devConfWidget);
- devConfLayout->setMargin(0);
- devConfLayout->addWidget(&d->devConfLabel);
- QLabel * const addDevConfLabel= new QLabel(tr("<a href=\"%1\">Manage device configurations</a>")
- .arg(QLatin1String("deviceconfig")));
- addDevConfLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
- devConfLayout->addWidget(addDevConfLabel);
-
- QLabel * const debuggerConfLabel = new QLabel(tr("<a href=\"%1\">Set Debugger</a>")
- .arg(QLatin1String("debugger")));
- debuggerConfLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
- devConfLayout->addWidget(debuggerConfLabel);
-
- d->genericWidgetsLayout.addRow(new QLabel(tr("Device configuration:")), devConfWidget);
d->localExecutableLabel.setText(d->runConfiguration->localExecutableFilePath());
d->genericWidgetsLayout.addRow(tr("Executable on host:"), &d->localExecutableLabel);
d->genericWidgetsLayout.addRow(tr("Executable on device:"), &d->remoteExecutableLabel);
@@ -198,10 +179,6 @@ void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayou
d->workingDirLineEdit.setText(d->runConfiguration->workingDirectory());
d->genericWidgetsLayout.addRow(tr("Working directory:"), &d->workingDirLineEdit);
- connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this,
- SLOT(showDeviceConfigurationsDialog(QString)));
- connect(debuggerConfLabel, SIGNAL(linkActivated(QString)), this,
- SLOT(showDeviceConfigurationsDialog(QString)));
connect(&d->argsLineEdit, SIGNAL(textEdited(QString)), SLOT(argumentsEdited(QString)));
connect(d->runConfiguration, SIGNAL(targetInformationChanged()), this,
SLOT(updateTargetInformation()));
@@ -287,23 +264,6 @@ void RemoteLinuxRunConfigurationWidget::handleWorkingDirectoryChanged()
d->runConfiguration->setWorkingDirectory(d->workingDirLineEdit.text().trimmed());
}
-void RemoteLinuxRunConfigurationWidget::showDeviceConfigurationsDialog(const QString &link)
-{
- if (link == QLatin1String("deviceconfig")) {
- Core::ICore::showOptionsDialog(
- QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY),
- QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_PAGE_ID));
- } else if (link == QLatin1String("debugger")) {
- Core::ICore::showOptionsDialog(QLatin1String("O.Debugger"),
- QLatin1String("M.Gdb"));
- }
-}
-
-void RemoteLinuxRunConfigurationWidget::handleCurrentDeviceConfigChanged()
-{
- d->devConfLabel.setText(RemoteLinuxUtils::deviceConfigurationName(d->runConfiguration->deviceConfig()));
-}
-
void RemoteLinuxRunConfigurationWidget::fetchEnvironment()
{
disconnect(&d->fetchEnvButton, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h
index 840c3b54f1..1cbed48b31 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h
+++ b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h
@@ -64,9 +64,7 @@ public:
private slots:
void argumentsEdited(const QString &args);
- void showDeviceConfigurationsDialog(const QString &link);
void updateTargetInformation();
- void handleCurrentDeviceConfigChanged();
void fetchEnvironment();
void fetchEnvironmentFinished();
void fetchEnvironmentError(const QString &error);
diff --git a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp
index 28b40a4e87..470eb289fc 100644
--- a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp
+++ b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp
@@ -39,7 +39,9 @@
#include <debugger/debuggerplugin.h>
#include <debugger/debuggerrunner.h>
#include <debugger/debuggerstartparameters.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
#include <utils/portlist.h>
using namespace Debugger;
@@ -63,17 +65,23 @@ bool RemoteLinuxRunControlFactory::canRun(RunConfiguration *runConfiguration, Ru
return false;
const QString idStr = QString::fromLatin1(runConfiguration->id().name());
- if (!runConfiguration->isEnabled()
- || !idStr.startsWith(RemoteLinuxRunConfiguration::Id)) {
+ if (!runConfiguration->isEnabled() || !idStr.startsWith(RemoteLinuxRunConfiguration::Id))
return false;
- }
if (mode == NormalRunMode)
return true;
const RemoteLinuxRunConfiguration * const remoteRunConfig
- = qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration);
- return remoteRunConfig->portsUsedByDebuggers() <= remoteRunConfig->freePorts().count();
+ = qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration);
+ if (mode == DebugRunMode) {
+ LinuxDeviceConfiguration::ConstPtr dev =
+ ProjectExplorer::DeviceProfileInformation::device(runConfiguration->target()->profile())
+ .dynamicCast<const LinuxDeviceConfiguration>();
+ if (dev.isNull())
+ return false;
+ return remoteRunConfig->portsUsedByDebuggers() <= dev->freePorts().count();
+ }
+ return true;
}
RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, RunMode mode)
diff --git a/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.cpp b/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.cpp
index bf740bf56f..84aa089179 100644
--- a/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.cpp
+++ b/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.cpp
@@ -31,9 +31,9 @@
**************************************************************************/
#include "typespecificdeviceconfigurationlistmodel.h"
-#include "abstractembeddedlinuxtarget.h"
-
#include <projectexplorer/devicesupport/devicemanager.h>
+#include <projectexplorer/profileinformation.h>
+#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
@@ -41,12 +41,12 @@ using namespace ProjectExplorer;
namespace RemoteLinux {
namespace Internal {
-TypeSpecificDeviceConfigurationListModel::TypeSpecificDeviceConfigurationListModel(AbstractEmbeddedLinuxTarget *target)
+TypeSpecificDeviceConfigurationListModel::TypeSpecificDeviceConfigurationListModel(ProjectExplorer::Target *target)
: QAbstractListModel(target)
{
const DeviceManager * const devConfs = DeviceManager::instance();
connect(devConfs, SIGNAL(updated()), this, SIGNAL(modelReset()));
- connect(target, SIGNAL(supportedDevicesChanged()), this, SIGNAL(modelReset()));
+ connect(target, SIGNAL(profileChanged()), this, SIGNAL(modelReset()));
}
TypeSpecificDeviceConfigurationListModel::~TypeSpecificDeviceConfigurationListModel()
@@ -61,7 +61,7 @@ int TypeSpecificDeviceConfigurationListModel::rowCount(const QModelIndex &parent
const DeviceManager * const devConfs = DeviceManager::instance();
const int devConfsCount = devConfs->deviceCount();
for (int i = 0; i < devConfsCount; ++i) {
- if (target()->supportsDevice(devConfs->deviceAt(i)))
+ if (deviceMatches(devConfs->deviceAt(i)))
++count;
}
return count;
@@ -75,8 +75,8 @@ QVariant TypeSpecificDeviceConfigurationListModel::data(const QModelIndex &index
const LinuxDeviceConfiguration::ConstPtr &devConf = deviceAt(index.row());
Q_ASSERT(devConf);
QString displayedName = devConf->displayName();
- if (target()->supportsDevice(devConf) && DeviceManager::instance()
- ->defaultDevice(devConf->type()) == devConf) {
+ if (deviceMatches(devConf)
+ && DeviceManager::instance()->defaultDevice(devConf->type()) == devConf) {
displayedName = tr("%1 (default)").arg(displayedName);
}
return displayedName;
@@ -89,7 +89,7 @@ LinuxDeviceConfiguration::ConstPtr TypeSpecificDeviceConfigurationListModel::dev
const int devConfsCount = devConfs->deviceCount();
for (int i = 0; i < devConfsCount; ++i) {
const IDevice::ConstPtr device = devConfs->deviceAt(i);
- if (target()->supportsDevice(device) && ++currentRow == idx)
+ if (deviceMatches(device) && ++currentRow == idx)
return device.staticCast<const LinuxDeviceConfiguration>();
}
QTC_CHECK(false);
@@ -102,7 +102,7 @@ LinuxDeviceConfiguration::ConstPtr TypeSpecificDeviceConfigurationListModel::def
const int deviceCount = deviceManager->deviceCount();
for (int i = 0; i < deviceCount; ++i) {
const IDevice::ConstPtr device = deviceManager->deviceAt(i);
- if (target()->supportsDevice(device)
+ if (deviceMatches(device)
&& deviceManager->defaultDevice(device->type()) == device) {
return device.staticCast<const LinuxDeviceConfiguration>();
}
@@ -113,7 +113,7 @@ LinuxDeviceConfiguration::ConstPtr TypeSpecificDeviceConfigurationListModel::def
LinuxDeviceConfiguration::ConstPtr TypeSpecificDeviceConfigurationListModel::find(Core::Id id) const
{
const IDevice::ConstPtr &devConf = DeviceManager::instance()->find(id);
- if (devConf && target()->supportsDevice(devConf))
+ if (deviceMatches(devConf))
return devConf.staticCast<const LinuxDeviceConfiguration>();
return defaultDeviceConfig();
}
@@ -128,9 +128,17 @@ int TypeSpecificDeviceConfigurationListModel::indexForId(Core::Id id) const
return -1;
}
-AbstractEmbeddedLinuxTarget *TypeSpecificDeviceConfigurationListModel::target() const
+ProjectExplorer::Target *TypeSpecificDeviceConfigurationListModel::target() const
+{
+ return qobject_cast<ProjectExplorer::Target *>(QObject::parent());
+}
+
+bool TypeSpecificDeviceConfigurationListModel::deviceMatches(ProjectExplorer::IDevice::ConstPtr dev) const
{
- return qobject_cast<AbstractEmbeddedLinuxTarget *>(QObject::parent());
+ if (dev.isNull())
+ return false;
+ Core::Id typeId = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target()->profile());
+ return dev->type() == typeId;
}
} // namespace Internal
diff --git a/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.h b/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.h
index e240bcd07f..d7ad4f3e1d 100644
--- a/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.h
+++ b/src/plugins/remotelinux/typespecificdeviceconfigurationlistmodel.h
@@ -37,15 +37,16 @@
#include <QAbstractListModel>
#include <QSharedPointer>
+namespace ProjectExplorer { class Target; }
+
namespace RemoteLinux {
-class AbstractEmbeddedLinuxTarget;
namespace Internal {
class TypeSpecificDeviceConfigurationListModel : public QAbstractListModel
{
Q_OBJECT
public:
- explicit TypeSpecificDeviceConfigurationListModel(AbstractEmbeddedLinuxTarget *target);
+ explicit TypeSpecificDeviceConfigurationListModel(ProjectExplorer::Target *target);
~TypeSpecificDeviceConfigurationListModel();
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
@@ -58,7 +59,8 @@ public:
int indexForId(Core::Id id) const;
private:
- AbstractEmbeddedLinuxTarget * target() const;
+ ProjectExplorer::Target *target() const;
+ bool deviceMatches(ProjectExplorer::IDevice::ConstPtr dev) const;
};
} // namespace Internal
diff --git a/src/plugins/valgrind/valgrindtool.cpp b/src/plugins/valgrind/valgrindtool.cpp
index 46a9bbe805..013dd6c132 100644
--- a/src/plugins/valgrind/valgrindtool.cpp
+++ b/src/plugins/valgrind/valgrindtool.cpp
@@ -36,7 +36,9 @@
#include <remotelinux/linuxdeviceconfiguration.h>
#include <projectexplorer/applicationrunconfiguration.h>
+#include <projectexplorer/profileinformation.h>
#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/target.h>
using namespace ProjectExplorer;
using namespace RemoteLinux;
@@ -75,7 +77,7 @@ Analyzer::AnalyzerStartParameters ValgrindTool::createStartParameters(
sp.startMode = Analyzer::StartRemote;
sp.debuggee = rc2->remoteExecutableFilePath();
sp.debuggeeArgs = rc2->arguments();
- sp.connParams = rc2->deviceConfig()->sshParameters();
+ sp.connParams = ProjectExplorer::DeviceProfileInformation::device(rc2->target()->profile())->sshParameters();
sp.analyzerCmdPrefix = rc2->commandPrefix();
sp.displayName = rc2->displayName();
} else {