#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
+#include <projectexplorer/toolchain.h>
#include <QtGui/QAbstractButton>
S60PublishingBuildSettingsPageOvi::S60PublishingBuildSettingsPageOvi(S60PublisherOvi *publisher, const ProjectExplorer::Project *project, QWidget *parent) :
QWizardPage(parent),
+ m_bc(0),
+ m_toolchain(0),
m_ui(new Ui::S60PublishingBuildSettingsPageOvi),
m_publisher(publisher)
{
foreach (Qt4BuildConfiguration *qt4bc, list)
m_ui->chooseBuildConfigDropDown->addItem(qt4bc->displayName(), QVariant::fromValue(static_cast<ProjectExplorer::BuildConfiguration *>(qt4bc)));
-
- m_bc = 0;
-
// todo more intelligent selection? prefer newer versions?
foreach (Qt4BuildConfiguration *qt4bc, list)
if (!m_bc && !(qt4bc->qmakeBuildConfiguration() & BaseQtVersion::DebugBuild))
int focusedIndex = m_ui->chooseBuildConfigDropDown->findData(QVariant::fromValue(m_bc));
m_ui->chooseBuildConfigDropDown->setCurrentIndex(focusedIndex);
m_publisher->setBuildConfiguration(static_cast<Qt4BuildConfiguration *>(m_bc));
+
+ populateToolchainList(m_bc);
+
//change the build configuration if the user changes it
connect(m_ui->chooseBuildConfigDropDown, SIGNAL(currentIndexChanged(int)), this, SLOT(buildConfigChosen()));
- connect(this, SIGNAL(buildChosen()), SIGNAL(completeChanged()));
+ connect(this, SIGNAL(configurationChosen()), SIGNAL(completeChanged()));
+ connect(this, SIGNAL(toolchainConfigurationChosen()), SIGNAL(completeChanged()));
}
bool S60PublishingBuildSettingsPageOvi::isComplete() const
{
- return (m_bc != 0);
+ return m_bc && m_toolchain;
+}
+
+void S60PublishingBuildSettingsPageOvi::populateToolchainList(ProjectExplorer::BuildConfiguration *bc)
+{
+ if (!bc)
+ return;
+
+ disconnect(m_ui->chooseToolchainDropDown, SIGNAL(currentIndexChanged(int)), this, SLOT(toolchainChosen()));
+ m_ui->chooseToolchainDropDown->clear();
+ QList<ProjectExplorer::ToolChain *> toolchains = bc->target()->possibleToolChains(bc);
+
+ int index = 0;
+ bool toolchainChanged = true; // if the new build conf. doesn't contain previous toolchain
+ foreach (ProjectExplorer::ToolChain *toolchain, toolchains) {
+ m_ui->chooseToolchainDropDown->addItem(toolchain->displayName(),
+ qVariantFromValue(static_cast<void *>(toolchain)));
+ if (toolchainChanged && m_toolchain == toolchain) {
+ toolchainChanged = false;
+ m_ui->chooseToolchainDropDown->setCurrentIndex(index);
+ }
+ ++index;
+ }
+ connect(m_ui->chooseToolchainDropDown, SIGNAL(currentIndexChanged(int)), this, SLOT(toolchainChosen()));
+ m_ui->chooseToolchainDropDown->setEnabled(toolchains.size() > 1);
+ if (toolchainChanged)
+ toolchainChosen();
+ else
+ bc->setToolChain(m_toolchain);
}
void S60PublishingBuildSettingsPageOvi::buildConfigChosen()
if (currentIndex == -1)
return;
m_bc = m_ui->chooseBuildConfigDropDown->itemData(currentIndex).value<ProjectExplorer::BuildConfiguration *>();
+ populateToolchainList(m_bc);
m_publisher->setBuildConfiguration(static_cast<Qt4BuildConfiguration *>(m_bc));
- emit buildChosen();
+ emit configurationChosen();
+}
+
+void S60PublishingBuildSettingsPageOvi::toolchainChosen()
+{
+ const int currentIndex = m_ui->chooseToolchainDropDown->currentIndex();
+ if (currentIndex == -1) {
+ m_toolchain = 0;
+ emit toolchainConfigurationChosen();
+ return;
+ }
+
+ m_toolchain = static_cast<ProjectExplorer::ToolChain *>(m_ui->chooseToolchainDropDown->itemData(currentIndex, Qt::UserRole).value<void *>());
+
+ if (m_bc)
+ m_bc->setToolChain(m_toolchain);
+ emit toolchainConfigurationChosen();
}
S60PublishingBuildSettingsPageOvi::~S60PublishingBuildSettingsPageOvi()
</property>
</spacer>
</item>
- <item row="2" column="0" colspan="3">
+ <item row="3" column="0" colspan="3">
<widget class="QLabel" name="label">
<property name="text">
<string>Only Qt versions above 4.6.3 are made available in this wizard.
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="2" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</spacer>
</item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="chooseToolchainLabel">
+ <property name="text">
+ <string>Choose a tool chain:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="chooseToolchainDropDown"/>
+ </item>
+ <item row="1" column="2">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
<resources/>