fixed problem with download ride button not hilighting when more than one

device is available
This commit is contained in:
Sean C. Rhea
2007-04-29 17:27:48 +00:00
parent 3cdc85e411
commit edd39b3d3b
2 changed files with 28 additions and 9 deletions

View File

@@ -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

View File

@@ -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();