Commit 8606345a authored by Alessandro Portale's avatar Alessandro Portale
Browse files

Android Settings: Download buttons for Android Toolkit parts



Show little toolButtons next to the path input fields for SDK,
NDK, Ant and OpenJDK. The latter two only for Windows. These
buttons open the system Web browser with the according download
page.

We hope this saves the user a bit of time understanding what to
download where when setting up an Android development environ-
ment.

The download icon was drawn by me.

Change-Id: I0079059deca8d0f07d53b914900cb34b8f0489e0
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent a85f64a7
<RCC>
<qresource prefix="/android">
<file>images/QtAndroid.png</file>
<file>images/download.png</file>
<file>Java.mimetypes.xml</file>
</qresource>
</RCC>
......@@ -47,9 +47,11 @@
#include <QTextStream>
#include <QProcess>
#include <QDesktopServices>
#include <QFileDialog>
#include <QMessageBox>
#include <QModelIndex>
#include <QtCore/QUrl>
namespace Android {
namespace Internal {
......@@ -131,6 +133,8 @@ AndroidSettingsWidget::AndroidSettingsWidget(QWidget *parent)
m_ui->AVDTableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
m_ui->AVDTableView->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
m_ui->downloadAntToolButton->setVisible(Utils::HostOsInfo::isWindowsHost());
m_ui->downloadOpenJDKToolButton->setVisible(Utils::HostOsInfo::isWindowsHost());
check(All);
applyToUi(All);
......@@ -421,6 +425,26 @@ void AndroidSettingsWidget::browseOpenJDKLocation()
openJDKLocationEditingFinished();
}
void AndroidSettingsWidget::openSDKDownloadUrl()
{
QDesktopServices::openUrl(QUrl::fromUserInput(QLatin1String("http://developer.android.com/sdk")));
}
void AndroidSettingsWidget::openNDKDownloadUrl()
{
QDesktopServices::openUrl(QUrl::fromUserInput(QLatin1String("http://developer.android.com/tools/sdk/ndk/index.html#Downloads")));
}
void AndroidSettingsWidget::openAntDownloadUrl()
{
QDesktopServices::openUrl(QUrl::fromUserInput(QLatin1String("http://ant.apache.org/bindownload.cgi")));
}
void AndroidSettingsWidget::openOpenJDKDownloadUrl()
{
QDesktopServices::openUrl(QUrl::fromUserInput(QLatin1String("http://www.oracle.com/technetwork/java/javase/downloads")));
}
void AndroidSettingsWidget::addAVD()
{
m_androidConfig.createAVD(this);
......
......@@ -81,6 +81,10 @@ private slots:
void browseNDKLocation();
void browseAntLocation();
void browseOpenJDKLocation();
void openSDKDownloadUrl();
void openNDKDownloadUrl();
void openAntDownloadUrl();
void openOpenJDKDownloadUrl();
void addAVD();
void removeAVD();
void startAVD();
......
......@@ -31,26 +31,27 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="SDKLocationLineEdit">
<property name="text">
<string/>
</property>
</widget>
<widget class="QLineEdit" name="SDKLocationLineEdit"/>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="SDKLocationPushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="3">
<widget class="QToolButton" name="downloadSDKToolButton">
<property name="toolTip">
<string>Download Android SDK</string>
</property>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="sdkWarningIconLabel">
......@@ -112,7 +113,18 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="2" column="3">
<widget class="QToolButton" name="downloadNDKToolButton">
<property name="toolTip">
<string>Download Android NDK</string>
</property>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>2</number>
......@@ -148,7 +160,7 @@
</item>
</layout>
</item>
<item row="4" column="1">
<item row="4" column="1" colspan="3">
<widget class="QCheckBox" name="CreateKitCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
......@@ -164,7 +176,7 @@
</property>
</widget>
</item>
<item row="5" column="1">
<item row="5" column="1" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>2</number>
......@@ -229,6 +241,17 @@
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QToolButton" name="downloadAntToolButton">
<property name="toolTip">
<string>Download Ant</string>
</property>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="OpenJDKLocationLabel">
<property name="sizePolicy">
......@@ -255,7 +278,18 @@
</property>
</widget>
</item>
<item row="8" column="1">
<item row="7" column="3">
<widget class="QToolButton" name="downloadOpenJDKToolButton">
<property name="toolTip">
<string>Download JDK</string>
</property>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
</item>
<item row="8" column="1" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="jdkWarningIconLabel">
......@@ -291,7 +325,7 @@
</item>
</layout>
</item>
<item row="9" column="0" colspan="3">
<item row="9" column="0" colspan="4">
<widget class="QFrame" name="AVDManagerFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
......@@ -413,7 +447,7 @@
</layout>
</widget>
<resources>
<include location="../projectexplorer/projectexplorer.qrc"/>
<include location="android.qrc"/>
</resources>
<connections>
<connection>
......@@ -672,6 +706,30 @@
</hint>
</hints>
</connection>
<connection>
<sender>downloadSDKToolButton</sender>
<signal>clicked()</signal>
<receiver>AndroidSettingsWidget</receiver>
<slot>openSDKDownloadUrl()</slot>
</connection>
<connection>
<sender>downloadNDKToolButton</sender>
<signal>clicked()</signal>
<receiver>AndroidSettingsWidget</receiver>
<slot>openNDKDownloadUrl()</slot>
</connection>
<connection>
<sender>downloadAntToolButton</sender>
<signal>clicked()</signal>
<receiver>AndroidSettingsWidget</receiver>
<slot>openAntDownloadUrl()</slot>
</connection>
<connection>
<sender>downloadOpenJDKToolButton</sender>
<signal>clicked()</signal>
<receiver>AndroidSettingsWidget</receiver>
<slot>openOpenJDKDownloadUrl()</slot>
</connection>
</connections>
<slots>
<slot>sdkLocationEditingFinished()</slot>
......@@ -689,5 +747,9 @@
<slot>browseOpenJDKLocation()</slot>
<slot>manageAVD()</slot>
<slot>createKitToggled()</slot>
<slot>openSDKDownloadUrl()</slot>
<slot>openNDKDownloadUrl()</slot>
<slot>openAntDownloadUrl()</slot>
<slot>openOpenJDKDownloadUrl()</slot>
</slots>
</ui>
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