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).
merge-requests/4/merge
Elliott Liggett 2021-07-24 22:53:36 -07:00
rodzic b512c3e306
commit 6c27f44ccc
3 zmienionych plików z 28 dodań i 32 usunięć

Wyświetl plik

@ -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; i<mXstart+213; i+=(10*dnPerWatt))
int k=0;
for(i=mXstart+143; i<mXstart+213; i+=(5*dnPerWatt))
{
qp->drawText(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; i<mXstart+255; i+=(10*dnPerWatt))
{
qp->drawText(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:

Wyświetl plik

@ -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();
// }
}

Wyświetl plik

@ -18,7 +18,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
<number>3</number>
</property>
<widget class="QWidget" name="mainTab">
<attribute name="title">