add combobox to select device type

This commit is contained in:
Sean Rhea
2009-08-09 15:04:17 -07:00
parent 47cdc3b62d
commit e2e4513647
2 changed files with 12 additions and 1 deletions

View File

@@ -25,6 +25,7 @@
#include <errno.h>
#include <QtGui>
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
DownloadRideDialog::DownloadRideDialog(MainWindow *mainWindow,
const QDir &home) :
@@ -42,6 +43,13 @@ DownloadRideDialog::DownloadRideDialog(MainWindow *mainWindow,
label = new QLabel(this);
label->setIndent(10);
deviceCombo = new QComboBox();
QList<QString> deviceTypes = Device::deviceTypes();
assert(deviceTypes.size() > 0);
BOOST_FOREACH(QString device, deviceTypes) {
deviceCombo->addItem(device);
}
downloadButton = new QPushButton(tr("&Download"), this);
rescanButton = new QPushButton(tr("&Rescan"), this);
cancelButton = new QPushButton(tr("&Cancel"), this);
@@ -62,6 +70,8 @@ DownloadRideDialog::DownloadRideDialog(MainWindow *mainWindow,
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(availLabel);
mainLayout->addWidget(listWidget);
mainLayout->addWidget(new QLabel(tr("Select device type:"), this));
mainLayout->addWidget(deviceCombo);
mainLayout->addWidget(instructLabel);
mainLayout->addWidget(label);
mainLayout->addLayout(buttonLayout);
@@ -139,7 +149,7 @@ DownloadRideDialog::downloadClicked()
assert(dev);
QString err;
QString tmpname, filename;
Device &device = Device::device("PowerTap");
Device &device = Device::device(deviceCombo->currentText());
if (!device.download(
dev, home, tmpname, filename,
boost::bind(&DownloadRideDialog::statusCallback, this, _1), err))