diff options
Diffstat (limited to 'desktop-widgets/downloadfromdivecomputer.cpp')
-rw-r--r-- | desktop-widgets/downloadfromdivecomputer.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp index 41acae7c5..047d325f2 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -83,6 +83,7 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent, Qt::WindowFlags f) : if (!qPrefDiveComputer::vendor##num().isEmpty()) { \ ui.DC##num->setVisible(true); \ ui.DC##num->setText(qPrefDiveComputer::vendor##num() + " - " + qPrefDiveComputer::product##num()); \ + connect(ui.DC##num, &QPushButton::clicked, this, &DownloadFromDCWidget::DC##num##Clicked); \ } else { \ ui.DC##num->setVisible(false); \ } @@ -114,6 +115,28 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent, Qt::WindowFlags f) : ui.device->setEditText(deviceText); } +// DC button slots +#define DCBUTTON(num) \ +void DownloadFromDCWidget::DC##num##Clicked() \ +{ \ + ui.vendor->setCurrentIndex(ui.vendor->findText(qPrefDiveComputer::vendor##num())); \ + productModel.setStringList(productList[qPrefDiveComputer::vendor##num()]); \ + ui.product->setCurrentIndex(ui.product->findText(qPrefDiveComputer::product##num())); \ + ui.device->setCurrentIndex(ui.device->findText(qPrefDiveComputer::device##num())); \ + if (QSysInfo::kernelType() == "darwin") { \ + /* it makes no sense that this would be needed on macOS but not Linux */ \ + QCoreApplication::processEvents(); \ + ui.vendor->update(); \ + ui.product->update(); \ + ui.device->update(); \ + } \ +} + +DCBUTTON(1) +DCBUTTON(2) +DCBUTTON(3) +DCBUTTON(4) + void DownloadFromDCWidget::updateProgressBar() { static char *last_text = NULL; |