From b512c3e306934dbecf7a79958b0f3cb4560daf1e Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Tue, 20 Jul 2021 11:11:51 -0700 Subject: [PATCH 1/3] Clear out meter values when type is switched. --- meter.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/meter.cpp b/meter.cpp index 4d51f97..34cfceb 100644 --- a/meter.cpp +++ b/meter.cpp @@ -48,6 +48,10 @@ void meter::setMeterType(meterKind type) meterType = type; // clear average and peak vectors: + current = 0; + average = 0; + peak = 0; + avgLevels.clear(); peakLevels.clear(); avgLevels.resize(averageBalisticLength, 0); @@ -56,6 +60,7 @@ void meter::setMeterType(meterKind type) peakPosition = 0; avgPosition = 0; // re-draw scale: + update(); } meterKind meter::getMeterType() From 6c27f44ccc937771e1d2ab29e358b51a89e93c3d Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sat, 24 Jul 2021 22:53:36 -0700 Subject: [PATCH 2/3] Meter now scales the meter bar to fit the avaliable depth. Text should scale to have the correct aspect ratio. Fixed minor bug in reporting connection type (always reported serial and then was replaced with connection status). --- meter.cpp | 23 ++++++++++++++++------- wfmain.cpp | 35 +++++++++++------------------------ wfmain.ui | 2 +- 3 files changed, 28 insertions(+), 32 deletions(-) diff --git a/meter.cpp b/meter.cpp index 34cfceb..a8d7dd9 100644 --- a/meter.cpp +++ b/meter.cpp @@ -93,8 +93,12 @@ void meter::paintEvent(QPaintEvent *) // Clamp down on stretching fonts. // TODO: Make this more elegant painter.setFont(QFont(this->fontInfo().family(), widgetWindowHeight/3.5)); - } else { - painter.setFont(QFont(this->fontInfo().family(), widgetWindowHeight/2.5)); + widgetWindowHeight = this->height(); + painter.setWindow(QRect(0, 0, 255+mXstart, widgetWindowHeight)); + barHeight = widgetWindowHeight / 2; + + + //painter.setFont(QFont(this->fontInfo().family(), widgetWindowHeight/2.5)); } switch(meterType) @@ -327,13 +331,16 @@ void meter::drawScalePo(QPainter *qp) // Here, P is now 60 watts: // Higher scale: i = i - (int)(10*dnPerWatt); // back one tick first. Otherwise i starts at 178. - qDebug() << "meter i: " << i; + //qDebug() << "meter i: " << i; dnPerWatt = (213-143.0) / 50.0; // 1.4 dn per watt - + // P=5 here. qp->setPen(Qt::yellow); - for(i=mXstart+143; idrawText(i,scaleTextYstart, QString("%1").arg(10*(p++)) ); + k = 50+(( i-mXstart-143 ) / dnPerWatt); + if(k==40||k==50||k==65||k==80) + qp->drawText(i,scaleTextYstart, QString("%1").arg(k) ); } // Now we're out past 100: @@ -341,7 +348,9 @@ void meter::drawScalePo(QPainter *qp) for(i=mXstart+213; idrawText(i,scaleTextYstart, QString("%1").arg(10*(p++)) ); + k = 50+(( i-mXstart-143 ) / dnPerWatt); + if(k==100) + qp->drawText(i,scaleTextYstart, QString("%1").arg(k) ); } // Now the lines: diff --git a/wfmain.cpp b/wfmain.cpp index e6855c6..e483948 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -207,9 +207,9 @@ void wfmain::openRig() } usingLAN = false; emit sendCommSetup(prefs.radioCIVAddr, serialPortRig, prefs.serialPortBaud,prefs.virtualSerialPort); + ui->statusBar->showMessage(QString("Connecting to rig using serial port ").append(serialPortRig), 1000); } - ui->statusBar->showMessage(QString("Connecting to rig using serial port ").append(serialPortRig), 1000); } @@ -670,6 +670,15 @@ void wfmain::setupMainUI() ui->meter2selectionCombo->addItem("Center", meterCenter); ui->meter2Widget->hide(); +#ifdef QT_DEBUG + // Experimental feature: + ui->meter2selectionCombo->show(); + ui->secondaryMeterSelectionLabel->show(); +#else + ui->meter2selectionCombo->hide(); + ui->secondaryMeterSelectionLabel->hide(); +#endif + // Future ideas: //ui->meter2selectionCombo->addItem("Transmit Audio", meterTxMod); //ui->meter2selectionCombo->addItem("Receive Audio", meterRxAudio); @@ -4143,7 +4152,7 @@ void wfmain::on_lanEnableBtn_clicked(bool checked) //ui->udpServerSetupBtn->setEnabled(false); if(checked) { - showStatusBarText("After filling in values, press Save Settings and re-start wfview."); + showStatusBarText("After filling in values, press Save Settings."); } } @@ -5200,26 +5209,4 @@ void wfmain::on_debugBtn_clicked() //wf->setInteraction(QCP::iRangeZoom, true); //wf->setInteraction(QCP::iRangeDrag, true); - // debug the fast queue: - qDebug(logSystem()) << "Size of fast command queue: " << periodicCmdQueue.size(); - - for (auto it = periodicCmdQueue.cbegin(); it != periodicCmdQueue.cend(); ++it) { - qDebug(logSystem()) << *it ; - } - -// bool ok = false; -// unsigned char level = (unsigned char) QInputDialog::getInt(this, "wfview simulated radio level", "Raw level (0-255)", 128, 1, 255, 1, &ok ); -// if(ok) -// { -// int peak = level*1.5; -// if(peak > 255) -// peak = 255; -// int average = peak / 2; - -// ui->meterSPoWidget->setMeterType(meterALC); -// ui->meterSPoWidget->setLevels(level, peak, average); -// ui->meterSPoWidget->update(); -// } - - } diff --git a/wfmain.ui b/wfmain.ui index 1677d86..aa855c7 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 1 + 3 From 459f15733ff1184887fe0cca306952619291bf6c Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sat, 24 Jul 2021 22:55:28 -0700 Subject: [PATCH 3/3] Version string to "1.1" --- aboutbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aboutbox.cpp b/aboutbox.cpp index 65e42c6..fa8a6c1 100644 --- a/aboutbox.cpp +++ b/aboutbox.cpp @@ -12,7 +12,7 @@ aboutbox::aboutbox(QWidget *parent) : ui->logoBtn->setIcon(QIcon(":resources/wfview.png")); ui->logoBtn->setStyleSheet("Text-align:left"); - ui->topText->setText("wfview version 1.1a"); + ui->topText->setText("wfview version 1.1"); QString head = QString(""); QString copyright = QString("Copyright 2017-2021 Elliott H. Liggett, W6EL. All rights reserved. wfview source code is licensed under the GNU GPLv3.");