From 0738aff2bfef6e7c59e2ba03c8cc0e4996fdf19b Mon Sep 17 00:00:00 2001 From: wh201906 Date: Tue, 27 Jun 2023 17:46:25 +0800 Subject: [PATCH] Check 125k/134k radiobutton when getting lf config --- src/module/lf.cpp | 1 + src/module/lf.h | 2 +- src/ui/mainwindow.cpp | 13 +++++++++---- src/ui/mainwindow.h | 3 ++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/module/lf.cpp b/src/module/lf.cpp index 98a2899..0f6f3cb 100644 --- a/src/module/lf.cpp +++ b/src/module/lf.cpp @@ -151,6 +151,7 @@ void LF::syncWithUI() ui->LF_LFConf_averagingBox->setChecked(currLFConfig.averaging); ui->LF_LFConf_thresholdBox->setValue(currLFConfig.triggerThreshold); ui->LF_LFConf_skipsBox->setValue(currLFConfig.samplesToSkip); + emit LFfreqConfChanged(currLFConfig.divisor, false); } void LF::setConfigMap(const QVariantMap& configMap) diff --git a/src/module/lf.h b/src/module/lf.h index fd909fe..31de33d 100644 --- a/src/module/lf.h +++ b/src/module/lf.h @@ -53,7 +53,7 @@ private: void syncWithUI(); bool getLFConfig_helper(const QVariantMap& map, QString& str, int* result); signals: - + void LFfreqConfChanged(int divisor, bool isCustomized); }; #endif // LF_H diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 3ac32da..2a183d7 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -43,6 +43,7 @@ MainWindow::MainWindow(QWidget *parent): mifare = new Mifare(ui, util, this); lf = new LF(ui, util, this); t55xxTab = new T55xxTab(util); + connect(lf, &LF::LFfreqConfChanged, this, &MainWindow::onLFfreqConfChanged); connect(t55xxTab, &T55xxTab::setParentGUIState, this, &MainWindow::setState); ui->funcTab->insertTab(2, t55xxTab, tr("T55xx")); @@ -1511,16 +1512,20 @@ void MainWindow::on_LF_LFConf_freqSlider_valueChanged(int value) onLFfreqConfChanged(value, true); } -void MainWindow::onLFfreqConfChanged(int value, bool isCustomized) +void MainWindow::onLFfreqConfChanged(int divisor, bool isCustomized) { ui->LF_LFConf_freqDivisorBox->blockSignals(true); ui->LF_LFConf_freqSlider->blockSignals(true); if(isCustomized) ui->LF_LFConf_freqOtherButton->setChecked(true); - ui->LF_LFConf_freqLabel->setText(tr("Actural Freq: ") + QString("%1kHz").arg(LF::divisor2Freq(value), 0, 'f', 3)); - ui->LF_LFConf_freqDivisorBox->setValue(value); - ui->LF_LFConf_freqSlider->setValue(value); + else if(divisor == 95) + ui->LF_LFConf_freq125kButton->setChecked(true); + else if(divisor == 88) + ui->LF_LFConf_freq134kButton->setChecked(true); + ui->LF_LFConf_freqLabel->setText(tr("Actural Freq: ") + QString("%1kHz").arg(LF::divisor2Freq(divisor), 0, 'f', 3)); + ui->LF_LFConf_freqDivisorBox->setValue(divisor); + ui->LF_LFConf_freqSlider->setValue(divisor); ui->LF_LFConf_freqDivisorBox->blockSignals(false); ui->LF_LFConf_freqSlider->blockSignals(false); diff --git a/src/ui/mainwindow.h b/src/ui/mainwindow.h index bf4bcb4..b28a70b 100644 --- a/src/ui/mainwindow.h +++ b/src/ui/mainwindow.h @@ -220,6 +220,8 @@ private slots: void on_Set_UI_CMDFont_setButton_clicked(); + void onLFfreqConfChanged(int divisor, bool isCustomized); + private: Ui::MainWindow* ui; QButtonGroup* MFCardTypeBtnGroup; @@ -268,7 +270,6 @@ private: void addClientPath(const QString& path); void loadClientPathList(); void saveClientPathList(); - void onLFfreqConfChanged(int value, bool isCustomized); void dockInit(); void loadConfig(); protected: