mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Desktop/remember DCs: hook up the shortcut buttons
The straight forward code to update the currentIndex of the combobox doesn't appear to work on macOS (but works fine on Linux). Calling the event loop and then calling update afterwards seems very unintuitive, but it appears to fix the issue in my testing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
99261775ce
commit
4eb8ed1b29
2 changed files with 28 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -50,6 +50,11 @@ slots:
|
|||
void checkDumpFile(int state);
|
||||
void pickDumpFile();
|
||||
void pickLogFile();
|
||||
void DC1Clicked();
|
||||
void DC2Clicked();
|
||||
void DC3Clicked();
|
||||
void DC4Clicked();
|
||||
|
||||
#if defined(BT_SUPPORT)
|
||||
void enableBluetoothMode(int state);
|
||||
void selectRemoteBluetoothDevice();
|
||||
|
|
Loading…
Reference in a new issue