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;
|
||||
Core::Id deviceId(int pos) const;
|
||||
int indexOf(IDevice::ConstPtr dev) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
|
||||
private slots:
|
||||
void handleDeviceAdded(Core::Id id);
|
||||
@@ -64,7 +65,6 @@ private slots:
|
||||
void handleDeviceListChanged();
|
||||
|
||||
private:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
|
||||
int indexForId(Core::Id id) const;
|
||||
|
@@ -87,8 +87,7 @@ public:
|
||||
|
||||
LinuxDeviceConfiguration::ConstPtr currentDevice() const
|
||||
{
|
||||
DeviceManager *devices = DeviceManager::instance();
|
||||
return devices->deviceAt(deviceComboBox->currentIndex())
|
||||
return deviceManagerModel->device(deviceComboBox->currentIndex())
|
||||
.dynamicCast<const LinuxDeviceConfiguration>();
|
||||
}
|
||||
|
||||
@@ -96,6 +95,7 @@ public:
|
||||
bool startServerOnly;
|
||||
AbstractRemoteLinuxProcessList *processList;
|
||||
QSortFilterProxyModel proxyModel;
|
||||
DeviceManagerModel *deviceManagerModel;
|
||||
|
||||
QComboBox *deviceComboBox;
|
||||
QLineEdit *processFilterLineEdit;
|
||||
@@ -175,16 +175,15 @@ StartGdbServerDialog::StartGdbServerDialog(QWidget *parent) :
|
||||
{
|
||||
setWindowTitle(tr("List of Remote Processes"));
|
||||
|
||||
DeviceManager *devices = DeviceManager::instance();
|
||||
DeviceManagerModel * const model = new DeviceManagerModel(devices, this);
|
||||
d->deviceManagerModel = new DeviceManagerModel(DeviceManager::instance(), this);
|
||||
|
||||
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());
|
||||
connect(&d->gatherer, SIGNAL(error(QString)), SLOT(portGathererError(QString)));
|
||||
connect(&d->gatherer, SIGNAL(portListReady()), SLOT(portListReady()));
|
||||
if (devices->deviceCount() == 0) {
|
||||
if (d->deviceManagerModel->rowCount() == 0) {
|
||||
d->tableView->setEnabled(false);
|
||||
} else {
|
||||
d->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
@@ -217,11 +216,12 @@ StartGdbServerDialog::~StartGdbServerDialog()
|
||||
delete d;
|
||||
}
|
||||
|
||||
void StartGdbServerDialog::attachToDevice(int index)
|
||||
void StartGdbServerDialog::attachToDevice(int modelIndex)
|
||||
{
|
||||
DeviceManager *devices = DeviceManager::instance();
|
||||
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)
|
||||
return;
|
||||
delete d->processList;
|
||||
|
@@ -56,7 +56,7 @@ signals:
|
||||
void processAborted();
|
||||
|
||||
private slots:
|
||||
void attachToDevice(int index);
|
||||
void attachToDevice(int modelIndex);
|
||||
void handleRemoteError(const QString &errorMessage);
|
||||
void handleProcessListUpdated();
|
||||
void updateProcessList();
|
||||
|
Reference in New Issue
Block a user