From 4783abcbedf0fe62885e1f0ce65ebe4fe32fd5a2 Mon Sep 17 00:00:00 2001 From: "Sean C. Rhea" Date: Sun, 29 Apr 2007 17:27:48 +0000 Subject: [PATCH] fixed problem with download ride button not hilighting when more than one device is available --- src/gui/DownloadRideDialog.cpp | 35 ++++++++++++++++++++++++++-------- src/gui/DownloadRideDialog.h | 2 +- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/gui/DownloadRideDialog.cpp b/src/gui/DownloadRideDialog.cpp index 7ee9ae083..51c52968a 100644 --- a/src/gui/DownloadRideDialog.cpp +++ b/src/gui/DownloadRideDialog.cpp @@ -52,8 +52,7 @@ DownloadRideDialog::DownloadRideDialog(MainWindow *mainWindow, connect(rescanButton, SIGNAL(clicked()), this, SLOT(scanDevices())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked())); connect(listWidget, - SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), - this, SLOT(setReadyInstruct())); + SIGNAL(currentRowChanged(int)), this, SLOT(setReadyInstruct(int))); connect(listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(downloadClicked())); @@ -83,11 +82,26 @@ DownloadRideDialog::~DownloadRideDialog() } void -DownloadRideDialog::setReadyInstruct() +DownloadRideDialog::setReadyInstruct(int row) { - label->setText(tr("Make sure the PowerTap unit is turned on,\n" - "and that the screen display says, \"Host\",\n" - "then click Download to begin downloading.")); + if (row == -1) { + if (listWidget->count() > 1) { + label->setText(tr("Select the device from the above list from\n" + "which you would like to download a ride.")); + } + else { + label->setText(tr("No devices found. Make sure the PowerTap\n" + "unit is plugged into the computer's USB port,\n" + "then click \"Rescan\" to check again.")); + } + downloadButton->setEnabled(false); + } + else { + label->setText(tr("Make sure the PowerTap unit is turned on,\n" + "and that the screen display says, \"Host\",\n" + "then click Download to begin downloading.")); + downloadButton->setEnabled(true); + } } void @@ -102,10 +116,14 @@ DownloadRideDialog::scanDevices() } if (listWidget->count() == 1) { listWidget->setCurrentRow(0); - setReadyInstruct(); - downloadButton->setEnabled(true); + setReadyInstruct(0); + // downloadButton->setEnabled(true); downloadButton->setFocus(); } + else { + setReadyInstruct(-1); + } + /* else { downloadButton->setEnabled(false); if (listWidget->count() > 1) { @@ -118,6 +136,7 @@ DownloadRideDialog::scanDevices() "then click \"Rescan\" to check again.")); } } + */ } static void diff --git a/src/gui/DownloadRideDialog.h b/src/gui/DownloadRideDialog.h index 0c3efb7a7..2f30c97df 100644 --- a/src/gui/DownloadRideDialog.h +++ b/src/gui/DownloadRideDialog.h @@ -42,7 +42,7 @@ class DownloadRideDialog : public QDialog private slots: void downloadClicked(); void cancelClicked(); - void setReadyInstruct(); + void setReadyInstruct(int row); void scanDevices(); void readVersion(); void readData();