2012-04-18 20:30:57 +03:00
/**************************************************************************
* *
2014-01-07 13:27:11 +01:00
* * Copyright ( c ) 2014 BogDan Vatra < bog_dan_ro @ yahoo . com >
2012-10-02 09:12:39 +02:00
* * Contact : http : //www.qt-project.org/legal
2012-04-18 20:30:57 +03:00
* *
2012-10-02 09:12:39 +02:00
* * This file is part of Qt Creator .
2012-04-18 20:30:57 +03:00
* *
2012-10-02 09:12:39 +02:00
* * Commercial License Usage
* * Licensees holding valid commercial Qt licenses may use this file in
* * accordance with the commercial license agreement provided with the
* * Software or , alternatively , in accordance with the terms contained in
* * a written agreement between you and Digia . For licensing terms and
* * conditions see http : //qt.digia.com/licensing. For further information
* * use the contact form at http : //qt.digia.com/contact-us.
2012-04-18 20:30:57 +03:00
* *
* * GNU Lesser General Public License Usage
2012-10-02 09:12:39 +02:00
* * Alternatively , this file may be used under the terms of the GNU Lesser
* * General Public License version 2.1 as published by the Free Software
* * Foundation and appearing in the file LICENSE . LGPL included in the
* * packaging of this file . Please review the following information to
* * ensure the GNU Lesser General Public License version 2.1 requirements
* * will be met : http : //www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
* *
* * In addition , as a special exception , Digia gives you certain additional
* * rights . These rights are described in the Digia Qt LGPL Exception
2012-04-18 20:30:57 +03:00
* * version 1.1 , included in the file LGPL_EXCEPTION . txt in this package .
* *
2012-10-02 09:12:39 +02:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2012-04-18 20:30:57 +03:00
# include "androidsettingswidget.h"
# include "ui_androidsettingswidget.h"
# include "androidconfigurations.h"
# include "androidconstants.h"
2013-02-14 15:51:59 +01:00
# include "androidtoolchain.h"
2012-04-18 20:30:57 +03:00
2013-11-19 17:25:32 +01:00
# ifdef Q_OS_WIN
# include <utils/winutils.h>
# endif
# include <utils/environment.h>
2012-08-23 15:53:58 +02:00
# include <utils/hostosinfo.h>
2013-02-14 15:51:59 +01:00
# include <projectexplorer/toolchainmanager.h>
# include <projectexplorer/kitmanager.h>
# include <projectexplorer/kitinformation.h>
# include <qtsupport/qtkitinformation.h>
# include <qtsupport/qtversionmanager.h>
2012-08-23 15:53:58 +02:00
2012-04-18 20:30:57 +03:00
# include <QFile>
# include <QTextStream>
# include <QProcess>
# include <QFileDialog>
# include <QMessageBox>
# include <QModelIndex>
namespace Android {
namespace Internal {
2012-08-09 01:56:51 +02:00
void AvdModel : : setAvdList ( const QVector < AndroidDeviceInfo > & list )
2012-04-18 20:30:57 +03:00
{
2012-09-20 10:31:34 +02:00
beginResetModel ( ) ;
2012-04-18 20:30:57 +03:00
m_list = list ;
2012-09-20 10:31:34 +02:00
endResetModel ( ) ;
2012-04-18 20:30:57 +03:00
}
2012-08-09 01:56:51 +02:00
QString AvdModel : : avdName ( const QModelIndex & index )
2012-04-18 20:30:57 +03:00
{
return m_list [ index . row ( ) ] . serialNumber ;
}
2012-08-09 01:56:51 +02:00
QVariant AvdModel : : data ( const QModelIndex & index , int role ) const
2012-04-18 20:30:57 +03:00
{
if ( role ! = Qt : : DisplayRole | | ! index . isValid ( ) )
return QVariant ( ) ;
switch ( index . column ( ) ) {
case 0 :
return m_list [ index . row ( ) ] . serialNumber ;
case 1 :
return QString : : fromLatin1 ( " API %1 " ) . arg ( m_list [ index . row ( ) ] . sdk ) ;
2013-10-15 13:44:11 +02:00
case 2 : {
QStringList cpuAbis = m_list [ index . row ( ) ] . cpuAbi ;
return cpuAbis . isEmpty ( ) ? QVariant ( ) : QVariant ( cpuAbis . first ( ) ) ;
}
2012-04-18 20:30:57 +03:00
}
return QVariant ( ) ;
}
2012-08-09 01:56:51 +02:00
QVariant AvdModel : : headerData ( int section , Qt : : Orientation orientation , int role ) const
2012-04-18 20:30:57 +03:00
{
if ( orientation = = Qt : : Horizontal & & role = = Qt : : DisplayRole ) {
switch ( section ) {
case 0 :
2012-08-01 15:25:05 +02:00
//: AVD - Android Virtual Device
2012-04-18 20:30:57 +03:00
return tr ( " AVD Name " ) ;
case 1 :
return tr ( " AVD Target " ) ;
case 2 :
return tr ( " CPU/ABI " ) ;
}
}
return QAbstractItemModel : : headerData ( section , orientation , role ) ;
}
2012-08-09 01:56:51 +02:00
int AvdModel : : rowCount ( const QModelIndex & /*parent*/ ) const
2012-04-18 20:30:57 +03:00
{
return m_list . size ( ) ;
}
2012-08-09 01:56:51 +02:00
int AvdModel : : columnCount ( const QModelIndex & /*parent*/ ) const
2012-04-18 20:30:57 +03:00
{
return 3 ;
}
AndroidSettingsWidget : : AndroidSettingsWidget ( QWidget * parent )
: QWidget ( parent ) ,
m_ui ( new Ui_AndroidSettingsWidget ) ,
m_androidConfig ( AndroidConfigurations : : instance ( ) . config ( ) ) ,
m_saveSettingsRequested ( false )
{
initGui ( ) ;
}
AndroidSettingsWidget : : ~ AndroidSettingsWidget ( )
{
if ( m_saveSettingsRequested )
AndroidConfigurations : : instance ( ) . setConfig ( m_androidConfig ) ;
delete m_ui ;
}
void AndroidSettingsWidget : : initGui ( )
{
m_ui - > setupUi ( this ) ;
2013-11-11 13:14:10 +01:00
if ( checkSDK ( m_androidConfig . sdkLocation ) ) {
2012-04-24 15:49:09 +02:00
m_ui - > SDKLocationLineEdit - > setText ( m_androidConfig . sdkLocation . toUserOutput ( ) ) ;
2013-11-11 13:14:10 +01:00
} else {
2012-04-18 20:30:57 +03:00
m_androidConfig . sdkLocation . clear ( ) ;
2013-11-11 13:14:10 +01:00
m_ui - > AVDManagerFrame - > setEnabled ( false ) ;
}
2012-04-18 20:30:57 +03:00
if ( checkNDK ( m_androidConfig . ndkLocation ) )
2012-04-24 15:49:09 +02:00
m_ui - > NDKLocationLineEdit - > setText ( m_androidConfig . ndkLocation . toUserOutput ( ) ) ;
2012-04-18 20:30:57 +03:00
else
m_androidConfig . ndkLocation . clear ( ) ;
2012-04-24 15:49:09 +02:00
m_ui - > AntLocationLineEdit - > setText ( m_androidConfig . antLocation . toUserOutput ( ) ) ;
m_ui - > OpenJDKLocationLineEdit - > setText ( m_androidConfig . openJDKLocation . toUserOutput ( ) ) ;
2012-04-18 20:30:57 +03:00
m_ui - > DataPartitionSizeSpinBox - > setValue ( m_androidConfig . partitionSize ) ;
2013-02-14 15:51:59 +01:00
m_ui - > CreateKitCheckBox - > setChecked ( m_androidConfig . automaticKitCreation ) ;
2012-04-18 20:30:57 +03:00
m_ui - > AVDTableView - > setModel ( & m_AVDModel ) ;
m_AVDModel . setAvdList ( AndroidConfigurations : : instance ( ) . androidVirtualDevices ( ) ) ;
m_ui - > AVDTableView - > horizontalHeader ( ) - > setResizeMode ( QHeaderView : : Stretch ) ;
m_ui - > AVDTableView - > horizontalHeader ( ) - > setResizeMode ( 1 , QHeaderView : : ResizeToContents ) ;
}
void AndroidSettingsWidget : : saveSettings ( bool saveNow )
{
// We must defer this step because of a stupid bug on MacOS. See QTCREATORBUG-1675.
if ( saveNow ) {
AndroidConfigurations : : instance ( ) . setConfig ( m_androidConfig ) ;
m_saveSettingsRequested = false ;
} else {
m_saveSettingsRequested = true ;
}
}
2012-04-24 15:49:09 +02:00
bool AndroidSettingsWidget : : checkSDK ( const Utils : : FileName & location )
2012-04-18 20:30:57 +03:00
{
2013-08-01 14:48:16 +02:00
if ( location . isEmpty ( ) ) {
m_ui - > sdkWarningIconLabel - > setVisible ( false ) ;
m_ui - > sdkWarningLabel - > setVisible ( false ) ;
2012-04-18 20:30:57 +03:00
return false ;
2013-08-01 14:48:16 +02:00
}
2012-04-24 15:49:09 +02:00
Utils : : FileName adb = location ;
Utils : : FileName androidExe = location ;
Utils : : FileName androidBat = location ;
Utils : : FileName emulator = location ;
2012-08-31 16:39:20 +02:00
if ( ! adb . appendPath ( QLatin1String ( " platform-tools/adb " QTC_HOST_EXE_SUFFIX ) ) . toFileInfo ( ) . exists ( )
| | ( ! androidExe . appendPath ( QLatin1String ( " /tools/android " QTC_HOST_EXE_SUFFIX ) ) . toFileInfo ( ) . exists ( )
2012-04-24 15:49:09 +02:00
& & ! androidBat . appendPath ( QLatin1String ( " /tools/android " ANDROID_BAT_SUFFIX ) ) . toFileInfo ( ) . exists ( ) )
2012-08-31 16:39:20 +02:00
| | ! emulator . appendPath ( QLatin1String ( " /tools/emulator " QTC_HOST_EXE_SUFFIX ) ) . toFileInfo ( ) . exists ( ) ) {
2013-07-05 13:09:06 +02:00
m_ui - > sdkWarningIconLabel - > setVisible ( true ) ;
m_ui - > sdkWarningLabel - > setVisible ( true ) ;
m_ui - > sdkWarningLabel - > setText ( tr ( " \" %1 \" does not seem to be an Android SDK top folder. " ) . arg ( location . toUserOutput ( ) ) ) ;
2012-04-18 20:30:57 +03:00
return false ;
2013-07-05 13:09:06 +02:00
} else {
m_ui - > sdkWarningIconLabel - > setVisible ( false ) ;
m_ui - > sdkWarningLabel - > setVisible ( false ) ;
2012-04-18 20:30:57 +03:00
}
return true ;
}
2013-02-14 15:51:59 +01:00
int indexOf ( const QList < AndroidToolChainFactory : : AndroidToolChainInformation > & list , const Utils : : FileName & f )
{
int end = list . count ( ) ;
for ( int i = 0 ; i < end ; + + i ) {
if ( list . at ( i ) . compilerCommand = = f )
return i ;
}
return - 1 ;
}
2012-04-24 15:49:09 +02:00
bool AndroidSettingsWidget : : checkNDK ( const Utils : : FileName & location )
2012-04-18 20:30:57 +03:00
{
2013-02-14 15:51:59 +01:00
if ( location . isEmpty ( ) ) {
m_ui - > ndkWarningIconLabel - > setVisible ( false ) ;
m_ui - > toolchainFoundLabel - > setVisible ( false ) ;
m_ui - > kitWarningIconLabel - > setVisible ( false ) ;
m_ui - > kitWarningLabel - > setVisible ( false ) ;
2012-04-18 20:30:57 +03:00
return false ;
2013-02-14 15:51:59 +01:00
}
2012-04-24 15:49:09 +02:00
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 ( ) ) {
2013-02-14 15:51:59 +01:00
m_ui - > toolchainFoundLabel - > setText ( tr ( " \" %1 \" does not seem to be an Android NDK top folder. " ) . arg ( location . toUserOutput ( ) ) ) ;
m_ui - > toolchainFoundLabel - > setVisible ( true ) ;
m_ui - > ndkWarningIconLabel - > setVisible ( true ) ;
2012-04-18 20:30:57 +03:00
return false ;
}
2013-02-14 15:51:59 +01:00
// Check how many toolchains we could add...
QList < AndroidToolChainFactory : : AndroidToolChainInformation > compilerPaths = AndroidToolChainFactory : : toolchainPathsForNdk ( location ) ;
if ( compilerPaths . isEmpty ( ) ) {
m_ui - > ndkWarningIconLabel - > setVisible ( false ) ;
m_ui - > toolchainFoundLabel - > setVisible ( false ) ;
} else {
m_ui - > ndkWarningIconLabel - > setVisible ( false ) ;
2013-02-22 11:02:14 +01:00
m_ui - > toolchainFoundLabel - > setText ( tr ( " Found %n toolchains for this NDK. " , 0 , compilerPaths . count ( ) ) ) ;
2013-02-14 15:51:59 +01:00
m_ui - > toolchainFoundLabel - > setVisible ( true ) ;
}
// See if we have qt versions for those toolchains
QSet < ProjectExplorer : : Abi : : Architecture > toolchainsForArch ;
foreach ( const AndroidToolChainFactory : : AndroidToolChainInformation & ati , compilerPaths )
toolchainsForArch . insert ( ati . architecture ) ;
QSet < ProjectExplorer : : Abi : : Architecture > qtVersionsForArch ;
2013-08-29 14:11:29 +02:00
foreach ( QtSupport : : BaseQtVersion * qtVersion , QtSupport : : QtVersionManager : : versions ( ) ) {
2013-03-21 09:59:26 +02:00
if ( qtVersion - > type ( ) ! = QLatin1String ( Constants : : ANDROIDQT ) | | qtVersion - > qtAbis ( ) . isEmpty ( ) )
2013-02-14 15:51:59 +01:00
continue ;
qtVersionsForArch . insert ( qtVersion - > qtAbis ( ) . first ( ) . architecture ( ) ) ;
}
QSet < ProjectExplorer : : Abi : : Architecture > missingQtArchs = toolchainsForArch . subtract ( qtVersionsForArch ) ;
if ( missingQtArchs . isEmpty ( ) ) {
m_ui - > kitWarningIconLabel - > setVisible ( false ) ;
m_ui - > kitWarningLabel - > setVisible ( false ) ;
} else {
m_ui - > kitWarningIconLabel - > setVisible ( true ) ;
m_ui - > kitWarningLabel - > setVisible ( true ) ;
if ( missingQtArchs . count ( ) = = 1 ) {
2013-02-20 17:05:00 +01:00
m_ui - > kitWarningLabel - > setText ( tr ( " Qt version for architecture %1 is missing. \n To add the Qt version, select Options > Build & Run > Qt Versions. " )
2013-02-14 15:51:59 +01:00
. arg ( ProjectExplorer : : Abi : : toString ( ( * missingQtArchs . constBegin ( ) ) ) ) ) ;
} else {
QStringList missingArchs ;
foreach ( ProjectExplorer : : Abi : : Architecture arch , missingQtArchs )
missingArchs . append ( ProjectExplorer : : Abi : : toString ( arch ) ) ;
2013-02-20 17:05:00 +01:00
m_ui - > kitWarningLabel - > setText ( tr ( " Qt versions for architectures %1 are missing. \n To add the Qt versions, select Options > Build & Run > Qt Versions. " )
2013-02-14 15:51:59 +01:00
. arg ( missingArchs . join ( QLatin1String ( " , " ) ) ) ) ;
}
}
2012-06-23 12:24:44 +03:00
m_androidConfig . ndkLocation = location ;
2012-04-18 20:30:57 +03:00
return true ;
}
void AndroidSettingsWidget : : sdkLocationEditingFinished ( )
{
2012-04-24 15:49:09 +02:00
Utils : : FileName location = Utils : : FileName : : fromUserInput ( m_ui - > SDKLocationLineEdit - > text ( ) ) ;
2012-04-18 20:30:57 +03:00
if ( ! checkSDK ( location ) ) {
m_ui - > AVDManagerFrame - > setEnabled ( false ) ;
return ;
}
m_androidConfig . sdkLocation = location ;
2013-04-17 11:52:16 +02:00
searchForAnt ( location . toString ( ) ) ;
2012-04-18 20:30:57 +03:00
saveSettings ( true ) ;
m_AVDModel . setAvdList ( AndroidConfigurations : : instance ( ) . androidVirtualDevices ( ) ) ;
m_ui - > AVDManagerFrame - > setEnabled ( true ) ;
}
void AndroidSettingsWidget : : ndkLocationEditingFinished ( )
{
2012-04-24 15:49:09 +02:00
Utils : : FileName location = Utils : : FileName : : fromUserInput ( m_ui - > NDKLocationLineEdit - > text ( ) ) ;
2013-04-04 01:29:47 -07:00
m_androidConfig . toolchainHost . clear ( ) ; // force toolchain host detection
2012-06-23 12:24:44 +03:00
if ( ! checkNDK ( location ) )
2012-04-18 20:30:57 +03:00
return ;
2013-04-17 11:52:16 +02:00
searchForAnt ( location . toString ( ) ) ;
2012-04-18 20:30:57 +03:00
saveSettings ( true ) ;
}
2013-04-17 11:52:16 +02:00
void AndroidSettingsWidget : : searchForAnt ( const QString & location )
{
if ( ! m_androidConfig . antLocation . isEmpty ( ) )
return ;
if ( location . isEmpty ( ) )
return ;
QDir parentFolder = QFileInfo ( location ) . absoluteDir ( ) ;
foreach ( const QString & file , parentFolder . entryList ( ) ) {
if ( file . startsWith ( QLatin1String ( " apache-ant " ) ) ) {
2013-10-30 13:23:11 +01:00
Utils : : FileName ant = Utils : : FileName : : fromString ( parentFolder . absolutePath ( ) ) ;
2013-11-15 14:12:46 +01:00
ant . appendPath ( file ) . appendPath ( QLatin1String ( " bin " ) ) ;
if ( Utils : : HostOsInfo : : isWindowsHost ( ) )
ant . appendPath ( QLatin1String ( " ant.bat " ) ) ;
else
ant . appendPath ( QLatin1String ( " ant " ) ) ;
2013-10-30 13:23:11 +01:00
if ( ant . toFileInfo ( ) . exists ( ) ) {
m_androidConfig . antLocation = ant ;
m_ui - > AntLocationLineEdit - > setText ( ant . toUserOutput ( ) ) ;
2013-04-17 11:52:16 +02:00
}
}
}
}
2012-04-18 20:30:57 +03:00
void AndroidSettingsWidget : : antLocationEditingFinished ( )
{
2012-04-24 15:49:09 +02:00
Utils : : FileName location = Utils : : FileName : : fromUserInput ( m_ui - > AntLocationLineEdit - > text ( ) ) ;
if ( location . isEmpty ( ) | | ! location . toFileInfo ( ) . exists ( ) )
2012-04-18 20:30:57 +03:00
return ;
m_androidConfig . antLocation = location ;
}
void AndroidSettingsWidget : : openJDKLocationEditingFinished ( )
{
2012-04-24 15:49:09 +02:00
Utils : : FileName location = Utils : : FileName : : fromUserInput ( m_ui - > OpenJDKLocationLineEdit - > text ( ) ) ;
if ( location . isEmpty ( ) | | ! location . toFileInfo ( ) . exists ( ) )
2012-04-18 20:30:57 +03:00
return ;
m_androidConfig . openJDKLocation = location ;
}
void AndroidSettingsWidget : : browseSDKLocation ( )
{
2013-02-27 13:00:04 +01:00
Utils : : FileName dir = Utils : : FileName : : fromString (
QFileDialog : : getExistingDirectory ( this , tr ( " Select Android SDK folder " ) ,
m_ui - > SDKLocationLineEdit - > text ( ) ) ) ;
2012-04-18 20:30:57 +03:00
if ( ! checkSDK ( dir ) )
return ;
2012-04-24 15:49:09 +02:00
m_ui - > SDKLocationLineEdit - > setText ( dir . toUserOutput ( ) ) ;
2012-04-18 20:30:57 +03:00
sdkLocationEditingFinished ( ) ;
}
void AndroidSettingsWidget : : browseNDKLocation ( )
{
2013-02-27 13:00:04 +01:00
Utils : : FileName dir = Utils : : FileName : : fromString (
QFileDialog : : getExistingDirectory ( this , tr ( " Select Android NDK folder " ) ,
m_ui - > NDKLocationLineEdit - > text ( ) ) ) ;
2012-04-18 20:30:57 +03:00
if ( ! checkNDK ( dir ) )
return ;
2012-04-24 15:49:09 +02:00
m_ui - > NDKLocationLineEdit - > setText ( dir . toUserOutput ( ) ) ;
2012-04-18 20:30:57 +03:00
ndkLocationEditingFinished ( ) ;
}
void AndroidSettingsWidget : : browseAntLocation ( )
{
2012-08-23 15:53:58 +02:00
QString dir ;
QString antApp ;
if ( Utils : : HostOsInfo : : isWindowsHost ( ) ) {
dir = QDir : : homePath ( ) ;
antApp = QLatin1String ( " ant.bat " ) ;
} else {
dir = QLatin1String ( " /usr/bin/ant " ) ;
antApp = QLatin1String ( " ant " ) ;
}
2012-05-25 16:21:19 +02:00
const QString file =
QFileDialog : : getOpenFileName ( this , tr ( " Select ant Script " ) , dir , antApp ) ;
2012-04-18 20:30:57 +03:00
if ( ! file . length ( ) )
return ;
m_ui - > AntLocationLineEdit - > setText ( file ) ;
antLocationEditingFinished ( ) ;
}
void AndroidSettingsWidget : : browseOpenJDKLocation ( )
{
2012-04-24 15:49:09 +02:00
Utils : : FileName openJDKPath = AndroidConfigurations : : instance ( ) . openJDKPath ( ) ;
2013-07-01 13:44:29 +02:00
Utils : : FileName file = Utils : : FileName : : fromString ( QFileDialog : : getExistingDirectory ( this , tr ( " Select OpenJDK Path " ) , openJDKPath . toString ( ) ) ) ;
2012-04-24 15:49:09 +02:00
if ( file . isEmpty ( ) )
2012-04-18 20:30:57 +03:00
return ;
2012-04-24 15:49:09 +02:00
m_ui - > OpenJDKLocationLineEdit - > setText ( file . toUserOutput ( ) ) ;
2012-04-18 20:30:57 +03:00
openJDKLocationEditingFinished ( ) ;
}
void AndroidSettingsWidget : : addAVD ( )
{
2013-11-21 18:09:53 +01:00
AndroidConfigurations : : instance ( ) . createAVD ( this ) ;
2012-04-18 20:30:57 +03:00
m_AVDModel . setAvdList ( AndroidConfigurations : : instance ( ) . androidVirtualDevices ( ) ) ;
2013-11-20 15:51:42 +01:00
avdActivated ( m_ui - > AVDTableView - > currentIndex ( ) ) ;
2012-04-18 20:30:57 +03:00
}
void AndroidSettingsWidget : : removeAVD ( )
{
AndroidConfigurations : : instance ( ) . removeAVD ( m_AVDModel . avdName ( m_ui - > AVDTableView - > currentIndex ( ) ) ) ;
m_AVDModel . setAvdList ( AndroidConfigurations : : instance ( ) . androidVirtualDevices ( ) ) ;
2013-11-20 15:51:42 +01:00
avdActivated ( m_ui - > AVDTableView - > currentIndex ( ) ) ;
2012-04-18 20:30:57 +03:00
}
void AndroidSettingsWidget : : startAVD ( )
{
2013-07-05 18:54:42 +02:00
AndroidConfigurations : : instance ( ) . startAVDAsync ( m_AVDModel . avdName ( m_ui - > AVDTableView - > currentIndex ( ) ) ) ;
2012-04-18 20:30:57 +03:00
}
void AndroidSettingsWidget : : avdActivated ( QModelIndex index )
{
m_ui - > AVDRemovePushButton - > setEnabled ( index . isValid ( ) ) ;
m_ui - > AVDStartPushButton - > setEnabled ( index . isValid ( ) ) ;
}
void AndroidSettingsWidget : : dataPartitionSizeEditingFinished ( )
{
m_androidConfig . partitionSize = m_ui - > DataPartitionSizeSpinBox - > value ( ) ;
}
2013-02-14 15:51:59 +01:00
void AndroidSettingsWidget : : createKitToggled ( )
{
m_androidConfig . automaticKitCreation = m_ui - > CreateKitCheckBox - > isChecked ( ) ;
}
2012-04-18 20:30:57 +03:00
void AndroidSettingsWidget : : manageAVD ( )
{
QProcess * avdProcess = new QProcess ( ) ;
connect ( this , SIGNAL ( destroyed ( ) ) , avdProcess , SLOT ( deleteLater ( ) ) ) ;
connect ( avdProcess , SIGNAL ( finished ( int ) ) , avdProcess , SLOT ( deleteLater ( ) ) ) ;
2013-11-19 17:25:32 +01:00
avdProcess - > setProcessEnvironment ( AndroidConfigurations : : instance ( ) . androidToolEnvironment ( ) . toProcessEnvironment ( ) ) ;
QString executable = AndroidConfigurations : : instance ( ) . androidToolPath ( ) . toString ( ) ;
QStringList arguments = QStringList ( ) < < QLatin1String ( " avd " ) ;
avdProcess - > start ( executable , arguments ) ;
2012-04-18 20:30:57 +03:00
}
} // namespace Internal
} // namespace Android