From 29b3c319ac8658a18d4531ea68536b484f3d19c4 Mon Sep 17 00:00:00 2001 From: Ladislav Foldyna Date: Sat, 29 Jun 2024 13:35:57 +0200 Subject: [PATCH] Bandmap: code optimalization --- ui/BandmapWidget.cpp | 8 +------- ui/MainWindow.cpp | 2 ++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/ui/BandmapWidget.cpp b/ui/BandmapWidget.cpp index 08b97034..7bf37a99 100644 --- a/ui/BandmapWidget.cpp +++ b/ui/BandmapWidget.cpp @@ -67,12 +67,6 @@ BandmapWidget::BandmapWidget(QWidget *parent) : ui->clearSpotOlderSpin->setValue(settings.value("bandmap/spot_aging", 0).toInt()); - Rig* rig = Rig::instance(); - connect(rig, &Rig::frequencyChanged, - this, &BandmapWidget::updateTunedFrequency); - connect(rig, &Rig::modeChanged, - this, &BandmapWidget::updateMode); - update_timer = new QTimer; connect(update_timer, &QTimer::timeout, this, &BandmapWidget::updateStationTimer); update_timer->start(BANDMAP_MAX_REFRESH_TIME); @@ -144,7 +138,7 @@ void BandmapWidget::update() } } - QString endFreqDigits= QString::number(currentBand.end + step*steps, 'f', digits); + const QString &endFreqDigits= QString::number(currentBand.end + step*steps, 'f', digits); bandmapScene->setSceneRect(160 - (endFreqDigits.size() * PIXELSPERSTEP), 0, 0, diff --git a/ui/MainWindow.cpp b/ui/MainWindow.cpp index 3ace6180..733d996a 100644 --- a/ui/MainWindow.cpp +++ b/ui/MainWindow.cpp @@ -139,6 +139,8 @@ MainWindow::MainWindow(QWidget* parent) : connect(Rig::instance(), &Rig::rigCWKeyOpenRequest, this, &MainWindow::cwKeyerConnectProfile); connect(Rig::instance(), &Rig::rigCWKeyCloseRequest, this, &MainWindow::cwKeyerDisconnectProfile); connect(Rig::instance(), &Rig::frequencyChanged, ui->onlineMapWidget, &OnlineMapWidget::setIBPBand); + connect(Rig::instance(), &Rig::frequencyChanged, ui->bandmapWidget , &BandmapWidget::updateTunedFrequency); + connect(Rig::instance(), &Rig::modeChanged, ui->bandmapWidget, &BandmapWidget::updateMode); connect(Rotator::instance(), &Rotator::rotErrorPresent, this, &MainWindow::rotErrorHandler); connect(Rotator::instance(), &Rotator::positionChanged, ui->onlineMapWidget, &OnlineMapWidget::antPositionChanged);