Commit f10afe69 authored by David Kaspar's avatar David Kaspar

Qnx: Terminology and UI update of BlackBerry NDK options page

NDK renamed to API Level
Button group may extend vertically along the whole height of page
API Level Information area polished

Change-Id: Ie09faa76b966c0aea8918e746bd1bac9a7891f5c
Reviewed-by: default avatarRafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: Nicolas Arnaud-Cormos's avatarNicolas Arnaud-Cormos <nicolas@kdab.com>
Reviewed-by: default avatarDavid Kaspar <dkaspar@blackberry.com>
parent eb467f14
......@@ -296,6 +296,9 @@ QList<BlackBerryConfiguration *> BlackBerryConfigurationManager::activeConfigura
BlackBerryConfiguration *BlackBerryConfigurationManager::configurationFromEnvFile(const Utils::FileName &envFile) const
{
if (envFile.isEmpty())
return 0;
foreach (BlackBerryConfiguration *config, m_configs) {
if (config->ndkEnvFile() == envFile)
return config;
......
......@@ -45,7 +45,7 @@ BlackBerryNDKSettingsPage::BlackBerryNDKSettingsPage(QObject *parent) :
Core::IOptionsPage(parent)
{
setId(Core::Id(Constants::QNX_BB_NDK_SETTINGS_ID));
setDisplayName(tr("NDK"));
setDisplayName(tr("API Level"));
setCategory(Constants::QNX_BB_CATEGORY);
setDisplayCategory(QCoreApplication::translate("BlackBerry",
Constants::QNX_BB_CATEGORY_TR));
......
......@@ -60,14 +60,13 @@ BlackBerryNDKSettingsWidget::BlackBerryNDKSettingsWidget(QWidget *parent) :
m_bbConfigManager = &BlackBerryConfigurationManager::instance();
m_ui->setupUi(this);
m_ui->activateNdkTargetButton->setEnabled(false);
m_ui->deactivateNdkTargetButton->setEnabled(false);
updateInfoTable(0);
m_activatedTargets << m_bbConfigManager->activeConfigurations();
m_ui->ndksTreeWidget->header()->setResizeMode(QHeaderView::Stretch);
m_ui->ndksTreeWidget->header()->setStretchLastSection(false);
m_ui->ndksTreeWidget->setHeaderItem(new QTreeWidgetItem(QStringList() << tr("NDK") << tr("NDK Environment File")));
m_ui->ndksTreeWidget->setHeaderItem(new QTreeWidgetItem(QStringList() << tr("API Level") << tr("Environment File")));
m_ui->ndksTreeWidget->setTextElideMode(Qt::ElideNone);
m_ui->ndksTreeWidget->setColumnCount(2);
m_autoDetectedNdks = new QTreeWidgetItem(m_ui->ndksTreeWidget);
......@@ -81,14 +80,14 @@ BlackBerryNDKSettingsWidget::BlackBerryNDKSettingsWidget(QWidget *parent) :
m_ui->ndksTreeWidget->expandAll();
updateNdkList();
connect(m_ui->wizardButton, SIGNAL(clicked()), this, SLOT(launchBlackBerrySetupWizard()));
connect(m_ui->addNdkButton, SIGNAL(clicked()), this, SLOT(addNdkTarget()));
connect(m_ui->removeNdkButton, SIGNAL(clicked()), this, SLOT(removeNdkTarget()));
connect(m_ui->activateNdkTargetButton, SIGNAL(clicked()), this, SLOT(activateNdkTarget()));
connect(m_ui->deactivateNdkTargetButton, SIGNAL(clicked()), this, SLOT(deactivateNdkTarget()));
connect(m_ui->ndksTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(updateInfoTable(QTreeWidgetItem*)));
updateNdkList();
}
void BlackBerryNDKSettingsWidget::setWizardMessageVisible(bool visible)
......@@ -130,28 +129,17 @@ void BlackBerryNDKSettingsWidget::launchBlackBerrySetupWizard() const
void BlackBerryNDKSettingsWidget::updateInfoTable(QTreeWidgetItem* currentItem)
{
if (!currentItem)
return;
BlackBerryConfiguration *config = m_bbConfigManager->configurationFromEnvFile(
Utils::FileName::fromString(currentItem ? currentItem->text(1) : QString()));
updateUi(currentItem, config);
QString envFilePath = currentItem->text(1);
if (envFilePath.isEmpty()) {
m_ui->removeNdkButton->setEnabled(false);
m_ui->activateNdkTargetButton->setEnabled(false);
m_ui->deactivateNdkTargetButton->setEnabled(false);
return;
m_ui->informationBox->setVisible(config);
if (config) {
m_ui->baseNameLabel->setText(config->displayName());
m_ui->hostLabel->setText(QDir::toNativeSeparators(config->qnxHost()));
m_ui->targetLabel->setText(QDir::toNativeSeparators(config->sysRoot().toString()));
m_ui->versionLabel->setText(config->version().toString());
}
BlackBerryConfiguration *config = m_bbConfigManager->configurationFromEnvFile(Utils::FileName::fromString(envFilePath));
if (!config)
return;
m_ui->baseNameLabel->setText(config->displayName());
m_ui->ndkPathLabel->setText(QDir::toNativeSeparators(config->ndkPath()));
m_ui->hostLabel->setText(QDir::toNativeSeparators(config->qnxHost()));
m_ui->targetLabel->setText(QDir::toNativeSeparators(config->sysRoot().toString()));
m_ui->versionLabel->setText(config->version().toString());
updateUi(currentItem, config);
}
void BlackBerryNDKSettingsWidget::updateNdkList()
......@@ -170,10 +158,7 @@ void BlackBerryNDKSettingsWidget::updateNdkList()
item->setFont(1, font);
}
if (m_autoDetectedNdks->child(0)) {
m_autoDetectedNdks->child(0)->setSelected(true);
updateInfoTable(m_autoDetectedNdks->child(0));
}
m_ui->ndksTreeWidget->setCurrentItem(m_autoDetectedNdks->child(0));
}
void BlackBerryNDKSettingsWidget::addNdkTarget()
......@@ -251,17 +236,21 @@ void BlackBerryNDKSettingsWidget::deactivateNdkTarget()
void BlackBerryNDKSettingsWidget::updateUi(QTreeWidgetItem *item, BlackBerryConfiguration *config)
{
if (!item || !config)
if (!item || !config) {
m_ui->removeNdkButton->setEnabled(false);
m_ui->activateNdkTargetButton->setEnabled(false);
m_ui->deactivateNdkTargetButton->setEnabled(false);
return;
}
const bool contains = m_activatedTargets.contains(config);
QFont font;
font.setBold(m_activatedTargets.contains(config));
font.setBold(contains);
item->setFont(0, font);
item->setFont(1, font);
m_ui->activateNdkTargetButton->setEnabled(!m_activatedTargets.contains(config));
m_ui->deactivateNdkTargetButton->setEnabled(m_activatedTargets.contains(config)
&& m_activatedTargets.size() > 1);
m_ui->activateNdkTargetButton->setEnabled(!contains);
m_ui->deactivateNdkTargetButton->setEnabled(contains && m_activatedTargets.size() > 1);
// Disable remove button for auto detected pre-10.2 NDKs (uninstall wizard doesn't handle them)
m_ui->removeNdkButton->setEnabled(!(config->isAutoDetected()
&& QnxUtils::sdkInstallerPath(config->ndkPath()).isEmpty()));
......
......@@ -150,13 +150,82 @@
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QTreeWidget" name="ndksTreeWidget">
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QTreeWidget" name="ndksTreeWidget">
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QGroupBox" name="informationBox">
<property name="title">
<string>API Level Information</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="2" column="1">
<widget class="QLabel" name="versionLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Version:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="hostLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="baseNameLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Host:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Target:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="targetLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
......@@ -175,11 +244,20 @@
</widget>
</item>
<item>
<widget class="Line" name="line">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Vertical</enum>
</property>
</widget>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="activateNdkTargetButton">
......@@ -214,170 +292,6 @@
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>BlackBerry NDK Information</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;NDK Base Name:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="baseNameLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;NDK Path:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="ndkPathLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Version:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="versionLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Host:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="hostLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Target:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="targetLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment