From 7518e830c3b948f876fb89c1f4584629626a6844 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Mon, 17 Jul 2023 17:04:02 +0300 Subject: [PATCH] implemented missing repeat interval setting (requires latest libspnav) --- src/spnavcfg.c | 2 ++ src/ui.cc | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/spnavcfg.c b/src/spnavcfg.c index d1220a5..929b91c 100644 --- a/src/spnavcfg.c +++ b/src/spnavcfg.c @@ -82,6 +82,8 @@ int read_cfg(struct config *cfg) } } + cfg->repeat = spnav_cfg_get_repeat(); + update_ui(); return 0; } diff --git a/src/ui.cc b/src/ui.cc index a979fdf..62afa09 100644 --- a/src/ui.cc +++ b/src/ui.cc @@ -162,6 +162,9 @@ bool MainWin::init() connect(ui->ed_serpath, SIGNAL(editingFinished()), this, SLOT(serpath_changed())); connect(ui->chk_serial, SIGNAL(stateChanged(int)), this, SLOT(chk_changed(int))); + connect(ui->chk_repeat, SIGNAL(stateChanged(int)), this, SLOT(chk_changed(int))); + connect(ui->spin_repeat, SIGNAL(valueChanged(int)), this, SLOT(spin_changed(int))); + /* connect(ui->bn_loaddef, SIGNAL(clicked()), this, SLOT(bn_clicked())); connect(ui->bn_loadcfg, SIGNAL(clicked()), this, SLOT(bn_clicked())); @@ -219,7 +222,7 @@ void MainWin::updateui() } else { ui->chk_serial->setChecked(false); } - if(cfg.repeat > 0) { + if(cfg.repeat >= 0) { ui->chk_repeat->setChecked(true); ui->spin_repeat->setValue(cfg.repeat); } else { @@ -457,6 +460,13 @@ void MainWin::spin_changed(int val) if(mask_events) return; QObject *src = QObject::sender(); + + if(src == ui->spin_repeat) { + cfg.repeat = ui->spin_repeat->value(); + spnav_cfg_set_repeat(cfg.repeat); + return; + } + if(src == ui->spin_dead) { for(int i=0; ichk_repeat) { + if(checked) { + cfg.repeat = ui->spin_repeat->value(); + } else { + cfg.repeat = -1; + } + spnav_cfg_set_repeat(cfg.repeat); } if(src == ui->chk_swapyz) {