forked from qt-creator/qt-creator
AndroidDeviceDialog: Show a hint if we found no device
Task-number: QTCREATORBUG-11437 Change-Id: Ib08cd6c7fd60d9973eb4022a2519a30bd0570496 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QToolTip>
|
||||
|
||||
using namespace Android;
|
||||
using namespace Android::Internal;
|
||||
@@ -386,6 +387,17 @@ AndroidDeviceDialog::AndroidDeviceDialog(int apiLevel, const QString &abi, QWidg
|
||||
|
||||
m_ui->defaultDeviceCheckBox->setText(tr("Always use this device for architecture %1").arg(abi));
|
||||
|
||||
m_ui->noDeviceFoundLabel->setText(tr("<p align=\"center\"><span style=\" font-size:16pt;\">"
|
||||
"No Device Found</span></p>"
|
||||
"<br/>"
|
||||
"<p>Connect an Android device via USB and activate developer mode on it. "
|
||||
"Some devices require the installation of a USB driver.</p>"
|
||||
"<br/>"
|
||||
"<p>The adb tool in the Android SDK lists all connected devices if run via "adb devices".</p>"
|
||||
));
|
||||
connect(m_ui->missingLabel, SIGNAL(linkActivated(QString)),
|
||||
this, SLOT(showHelp()));
|
||||
|
||||
connect(m_ui->refreshDevicesButton, SIGNAL(clicked()),
|
||||
this, SLOT(refreshDeviceList()));
|
||||
|
||||
@@ -445,6 +457,8 @@ void AndroidDeviceDialog::refreshDeviceList()
|
||||
newIndex = m_model->indexFor(devices.first().serialNumber);
|
||||
|
||||
m_ui->deviceView->setCurrentIndex(newIndex);
|
||||
|
||||
m_ui->stackedWidget->setCurrentIndex(devices.isEmpty() ? 1 : 0);
|
||||
}
|
||||
|
||||
void AndroidDeviceDialog::createAvd()
|
||||
@@ -470,3 +484,13 @@ void AndroidDeviceDialog::clickedOnView(const QModelIndex &idx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidDeviceDialog::showHelp()
|
||||
{
|
||||
QPoint pos = m_ui->missingLabel->pos();
|
||||
pos = m_ui->missingLabel->parentWidget()->mapToGlobal(pos);
|
||||
QToolTip::showText(pos, tr("<p>Connect an Android device via USB and activate developer mode on it. "
|
||||
"Some devices require the installation of a USB driver.</p>"
|
||||
"<p>The adb tool in the Android SDK lists all connected devices if run via "adb devices".</p>"),
|
||||
this);
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ private slots:
|
||||
void refreshDeviceList();
|
||||
void createAvd();
|
||||
void clickedOnView(const QModelIndex &idx);
|
||||
void showHelp();
|
||||
private:
|
||||
AndroidDeviceModel *m_model;
|
||||
Ui::AndroidDeviceDialog *m_ui;
|
||||
|
||||
@@ -6,36 +6,29 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>618</width>
|
||||
<height>400</height>
|
||||
<width>636</width>
|
||||
<height>438</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Select Android Device</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="refreshDevicesButton">
|
||||
<property name="text">
|
||||
<string>Refresh Device List</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="createAVDButton">
|
||||
<property name="text">
|
||||
<string>Create Android Virtual Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="defaultDeviceCheckBox">
|
||||
<property name="text">
|
||||
<string>Always use this device for architecture %1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="createAVDButton">
|
||||
<property name="text">
|
||||
<string>Create Android Virtual Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -45,16 +38,64 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QTreeView" name="deviceView">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>600</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="refreshDevicesButton">
|
||||
<property name="text">
|
||||
<string>Refresh Device List</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="devicesPage">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="0">
|
||||
<widget class="QTreeView" name="deviceView">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>600</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="missingLabel">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><a href="aaa"><span style=" text-decoration: underline; color:#0057ae;">My device is missing</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="noDevicesPage">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="noDeviceFoundLabel">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
||||
Reference in New Issue
Block a user