Commit aec12ca0 authored by Daniel Teske's avatar Daniel Teske
Browse files

AndroidDeviceDialog: Show a hint if we found no device



Task-number: QTCREATORBUG-11437
Change-Id: Ib08cd6c7fd60d9973eb4022a2519a30bd0570496
Reviewed-by: default avatarEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
parent e568d14b
......@@ -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 &quot;adb devices&quot;.</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 &quot;adb devices&quot;.</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">
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="defaultDeviceCheckBox">
<property name="text">
<string>Refresh Device List</string>
<string>Always use this device for architecture %1</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" 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">
<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="4" column="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -45,14 +38,62 @@
</property>
</widget>
</item>
<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="QTreeView" name="deviceView">
<property name="minimumSize">
<size>
<width>600</width>
<height>300</height>
</size>
<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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;aaa&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;My device is missing&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>
......
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