forked from qt-creator/qt-creator
remotelinux: fix index computation in the presence of hidden devices
Change-Id: I65bb3854003783ad36dfad76c35535c83ab6d427 Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
@@ -56,6 +56,7 @@ public:
|
|||||||
IDevice::ConstPtr device(int pos) const;
|
IDevice::ConstPtr device(int pos) const;
|
||||||
Core::Id deviceId(int pos) const;
|
Core::Id deviceId(int pos) const;
|
||||||
int indexOf(IDevice::ConstPtr dev) const;
|
int indexOf(IDevice::ConstPtr dev) const;
|
||||||
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleDeviceAdded(Core::Id id);
|
void handleDeviceAdded(Core::Id id);
|
||||||
@@ -64,7 +65,6 @@ private slots:
|
|||||||
void handleDeviceListChanged();
|
void handleDeviceListChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
|
|
||||||
int indexForId(Core::Id id) const;
|
int indexForId(Core::Id id) const;
|
||||||
|
@@ -87,8 +87,7 @@ public:
|
|||||||
|
|
||||||
LinuxDeviceConfiguration::ConstPtr currentDevice() const
|
LinuxDeviceConfiguration::ConstPtr currentDevice() const
|
||||||
{
|
{
|
||||||
DeviceManager *devices = DeviceManager::instance();
|
return deviceManagerModel->device(deviceComboBox->currentIndex())
|
||||||
return devices->deviceAt(deviceComboBox->currentIndex())
|
|
||||||
.dynamicCast<const LinuxDeviceConfiguration>();
|
.dynamicCast<const LinuxDeviceConfiguration>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,6 +95,7 @@ public:
|
|||||||
bool startServerOnly;
|
bool startServerOnly;
|
||||||
AbstractRemoteLinuxProcessList *processList;
|
AbstractRemoteLinuxProcessList *processList;
|
||||||
QSortFilterProxyModel proxyModel;
|
QSortFilterProxyModel proxyModel;
|
||||||
|
DeviceManagerModel *deviceManagerModel;
|
||||||
|
|
||||||
QComboBox *deviceComboBox;
|
QComboBox *deviceComboBox;
|
||||||
QLineEdit *processFilterLineEdit;
|
QLineEdit *processFilterLineEdit;
|
||||||
@@ -175,16 +175,15 @@ StartGdbServerDialog::StartGdbServerDialog(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
setWindowTitle(tr("List of Remote Processes"));
|
setWindowTitle(tr("List of Remote Processes"));
|
||||||
|
|
||||||
DeviceManager *devices = DeviceManager::instance();
|
d->deviceManagerModel = new DeviceManagerModel(DeviceManager::instance(), this);
|
||||||
DeviceManagerModel * const model = new DeviceManagerModel(devices, this);
|
|
||||||
|
|
||||||
QObject::connect(d->closeButton, SIGNAL(clicked()), this, SLOT(reject()));
|
QObject::connect(d->closeButton, SIGNAL(clicked()), this, SLOT(reject()));
|
||||||
|
|
||||||
d->deviceComboBox->setModel(model);
|
d->deviceComboBox->setModel(d->deviceManagerModel);
|
||||||
d->deviceComboBox->setCurrentIndex(d->settings->value(LastDevice).toInt());
|
d->deviceComboBox->setCurrentIndex(d->settings->value(LastDevice).toInt());
|
||||||
connect(&d->gatherer, SIGNAL(error(QString)), SLOT(portGathererError(QString)));
|
connect(&d->gatherer, SIGNAL(error(QString)), SLOT(portGathererError(QString)));
|
||||||
connect(&d->gatherer, SIGNAL(portListReady()), SLOT(portListReady()));
|
connect(&d->gatherer, SIGNAL(portListReady()), SLOT(portListReady()));
|
||||||
if (devices->deviceCount() == 0) {
|
if (d->deviceManagerModel->rowCount() == 0) {
|
||||||
d->tableView->setEnabled(false);
|
d->tableView->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
d->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
d->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
@@ -217,11 +216,12 @@ StartGdbServerDialog::~StartGdbServerDialog()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartGdbServerDialog::attachToDevice(int index)
|
void StartGdbServerDialog::attachToDevice(int modelIndex)
|
||||||
{
|
{
|
||||||
DeviceManager *devices = DeviceManager::instance();
|
|
||||||
LinuxDeviceConfiguration::ConstPtr device
|
LinuxDeviceConfiguration::ConstPtr device
|
||||||
= devices->deviceAt(index).dynamicCast<const LinuxDeviceConfiguration>();
|
= d->deviceManagerModel->device(modelIndex)
|
||||||
|
.dynamicCast<const LinuxDeviceConfiguration>();
|
||||||
|
// TODO: display error on non-matching device.
|
||||||
if (!device)
|
if (!device)
|
||||||
return;
|
return;
|
||||||
delete d->processList;
|
delete d->processList;
|
||||||
|
@@ -56,7 +56,7 @@ signals:
|
|||||||
void processAborted();
|
void processAborted();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void attachToDevice(int index);
|
void attachToDevice(int modelIndex);
|
||||||
void handleRemoteError(const QString &errorMessage);
|
void handleRemoteError(const QString &errorMessage);
|
||||||
void handleProcessListUpdated();
|
void handleProcessListUpdated();
|
||||||
void updateProcessList();
|
void updateProcessList();
|
||||||
|
Reference in New Issue
Block a user