mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-17 23:28:50 -05:00
PVS-Studio Analysis corrections for less serious issues
This commit is contained in:
parent
059228e39f
commit
f5357e9917
@ -135,7 +135,10 @@ void DaemonSink::feed(const SampleVector::const_iterator& begin, const SampleVec
|
|||||||
superBlock.m_header.m_blockIndex = m_txBlockIndex;
|
superBlock.m_header.m_blockIndex = m_txBlockIndex;
|
||||||
superBlock.m_header.m_sampleBytes = (SDR_RX_SAMP_SZ <= 16 ? 2 : 4);
|
superBlock.m_header.m_sampleBytes = (SDR_RX_SAMP_SZ <= 16 ? 2 : 4);
|
||||||
superBlock.m_header.m_sampleBits = SDR_RX_SAMP_SZ;
|
superBlock.m_header.m_sampleBits = SDR_RX_SAMP_SZ;
|
||||||
memcpy((void *) &superBlock.m_protectedBlock, (const void *) &metaData, sizeof(SDRDaemonMetaDataFEC));
|
|
||||||
|
SDRDaemonMetaDataFEC *destMeta = (SDRDaemonMetaDataFEC *) &superBlock.m_protectedBlock;
|
||||||
|
*destMeta = metaData;
|
||||||
|
//memcpy((void *) &superBlock.m_protectedBlock, (const void *) &metaData, sizeof(SDRDaemonMetaDataFEC));
|
||||||
|
|
||||||
if (!(metaData == m_currentMetaFEC))
|
if (!(metaData == m_currentMetaFEC))
|
||||||
{
|
{
|
||||||
|
@ -39,6 +39,7 @@ void DaemonSinkSettings::resetToDefaults()
|
|||||||
m_dataPort = 9090;
|
m_dataPort = 9090;
|
||||||
m_rgbColor = QColor(140, 4, 4).rgb();
|
m_rgbColor = QColor(140, 4, 4).rgb();
|
||||||
m_title = "Daemon sink";
|
m_title = "Daemon sink";
|
||||||
|
m_channelMarker = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray DaemonSinkSettings::serialize() const
|
QByteArray DaemonSinkSettings::serialize() const
|
||||||
|
@ -69,12 +69,8 @@ template<typename T> struct datvconstellation: runnable
|
|||||||
|
|
||||||
for (; p < pend; ++p)
|
for (; p < pend; ++p)
|
||||||
{
|
{
|
||||||
if (m_objDATVScreen != 0)
|
m_objDATVScreen->selectRow(256 * (p->re - xymin) / (xymax - xymin));
|
||||||
{
|
m_objDATVScreen->setDataColor(256 - 256 * ((p->im - xymin) / (xymax - xymin)), 255, 0, 255);
|
||||||
m_objDATVScreen->selectRow(256 * (p->re - xymin) / (xymax - xymin));
|
|
||||||
m_objDATVScreen->setDataColor(256 - 256 * ((p->im - xymin) / (xymax - xymin)), 255, 0, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cstln && (*cstln))
|
if (cstln && (*cstln))
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#define LEANSDR_FRAMEWORK_H
|
#define LEANSDR_FRAMEWORK_H
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -106,9 +108,10 @@ struct scheduler
|
|||||||
bool verbose, debug;
|
bool verbose, debug;
|
||||||
|
|
||||||
scheduler() :
|
scheduler() :
|
||||||
npipes(0), nrunnables(0), windows(NULL), verbose(false), debug(
|
npipes(0), nrunnables(0), windows(nullptr), verbose(false), debug(false)
|
||||||
false)
|
|
||||||
{
|
{
|
||||||
|
std::fill(pipes, pipes + MAX_PIPES, nullptr);
|
||||||
|
std::fill(runnables, runnables + MAX_RUNNABLES, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_pipe(pipebuf_common *p)
|
void add_pipe(pipebuf_common *p)
|
||||||
|
@ -162,7 +162,7 @@ struct rs_engine
|
|||||||
{
|
{
|
||||||
// TBD Avoid copying
|
// TBD Avoid copying
|
||||||
u8 p[204];
|
u8 p[204];
|
||||||
memcpy(p, msg, 188);
|
memcpy(p, msg, 204); // was 188 but causing underflow (PVS https://www.viva64.com/en/w/v512/)
|
||||||
memset(p + 188, 0, 16);
|
memset(p + 188, 0, 16);
|
||||||
// p = msg*X^16
|
// p = msg*X^16
|
||||||
#if DEBUG_RS
|
#if DEBUG_RS
|
||||||
|
@ -31,6 +31,7 @@ void DaemonSourceSettings::resetToDefaults()
|
|||||||
m_dataPort = 9090;
|
m_dataPort = 9090;
|
||||||
m_rgbColor = QColor(140, 4, 4).rgb();
|
m_rgbColor = QColor(140, 4, 4).rgb();
|
||||||
m_title = "Daemon source";
|
m_title = "Daemon source";
|
||||||
|
m_channelMarker = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray DaemonSourceSettings::serialize() const
|
QByteArray DaemonSourceSettings::serialize() const
|
||||||
|
@ -141,7 +141,10 @@ void UDPSinkFEC::write(const SampleVector::iterator& begin, uint32_t sampleChunk
|
|||||||
m_superBlock.m_header.m_blockIndex = m_txBlockIndex;
|
m_superBlock.m_header.m_blockIndex = m_txBlockIndex;
|
||||||
m_superBlock.m_header.m_sampleBytes = (SDR_RX_SAMP_SZ <= 16 ? 2 : 4);
|
m_superBlock.m_header.m_sampleBytes = (SDR_RX_SAMP_SZ <= 16 ? 2 : 4);
|
||||||
m_superBlock.m_header.m_sampleBits = SDR_RX_SAMP_SZ;
|
m_superBlock.m_header.m_sampleBits = SDR_RX_SAMP_SZ;
|
||||||
memcpy((char *) &m_superBlock.m_protectedBlock, (const char *) &metaData, sizeof(SDRDaemonMetaDataFEC));
|
|
||||||
|
SDRDaemonMetaDataFEC *destMeta = (SDRDaemonMetaDataFEC *) &m_superBlock.m_protectedBlock;
|
||||||
|
*destMeta = metaData;
|
||||||
|
//memcpy((char *) &m_superBlock.m_protectedBlock, (const char *) &metaData, sizeof(SDRDaemonMetaDataFEC));
|
||||||
|
|
||||||
if (!(metaData == m_currentMetaFEC))
|
if (!(metaData == m_currentMetaFEC))
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ int FileSourceSettings::getAccelerationValue(int accelerationIndex)
|
|||||||
|
|
||||||
unsigned int v = accelerationIndex - 1;
|
unsigned int v = accelerationIndex - 1;
|
||||||
int m = pow(10.0, v/3 > m_accelerationMaxScale ? m_accelerationMaxScale : v/3);
|
int m = pow(10.0, v/3 > m_accelerationMaxScale ? m_accelerationMaxScale : v/3);
|
||||||
int x;
|
int x = 1;
|
||||||
|
|
||||||
if (v % 3 == 0) {
|
if (v % 3 == 0) {
|
||||||
x = 2;
|
x = 2;
|
||||||
|
@ -38,13 +38,15 @@
|
|||||||
|
|
||||||
#define RTCPCOMPOUNDPACKETBUILDER_H
|
#define RTCPCOMPOUNDPACKETBUILDER_H
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "rtpconfig.h"
|
#include "rtpconfig.h"
|
||||||
#include "rtcpcompoundpacket.h"
|
#include "rtcpcompoundpacket.h"
|
||||||
#include "rtptimeutilities.h"
|
#include "rtptimeutilities.h"
|
||||||
#include "rtcpsdespacket.h"
|
#include "rtcpsdespacket.h"
|
||||||
#include "rtperrors.h"
|
#include "rtperrors.h"
|
||||||
#include "rtpendian.h"
|
#include "rtpendian.h"
|
||||||
#include <list>
|
|
||||||
|
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
|
|
||||||
@ -151,6 +153,7 @@ private:
|
|||||||
Report()
|
Report()
|
||||||
{
|
{
|
||||||
headerdata = (uint8_t *) headerdata32;
|
headerdata = (uint8_t *) headerdata32;
|
||||||
|
std::fill(&headerdata32[0], &headerdata32[0] + ((sizeof(uint32_t) + sizeof(RTCPSenderReport)) / sizeof(uint32_t)), 0U);
|
||||||
isSR = false;
|
isSR = false;
|
||||||
headerlength = 0;
|
headerlength = 0;
|
||||||
}
|
}
|
||||||
|
@ -130,14 +130,11 @@ void SDRDaemonDataReadQueue::readSample(Sample& s, bool scaleForTx)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_dataBlock)
|
delete m_dataBlock;
|
||||||
{
|
m_dataBlock = 0;
|
||||||
delete m_dataBlock;
|
|
||||||
m_dataBlock = 0;
|
|
||||||
|
|
||||||
if (length() == 0) {
|
if (length() == 0) {
|
||||||
qWarning("SDRDaemonDataReadQueue::readSample: try to pop new block but queue is empty");
|
qWarning("SDRDaemonDataReadQueue::readSample: try to pop new block but queue is empty");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length() > 0)
|
if (length() > 0)
|
||||||
|
@ -59,11 +59,7 @@ private:
|
|||||||
int samplebits = m_dataBlock->m_superBlocks[blockIndex].m_header.m_sampleBits; // I or Q sample size in bits
|
int samplebits = m_dataBlock->m_superBlocks[blockIndex].m_header.m_sampleBits; // I or Q sample size in bits
|
||||||
int32_t iconv, qconv;
|
int32_t iconv, qconv;
|
||||||
|
|
||||||
if (sizeof(Sample) == sampleSize) // generally 16->16 or 24->24 bits
|
if ((sizeof(Sample) == 4) && (sampleSize == 8)) // generally 24->16 bits
|
||||||
{
|
|
||||||
s = *((Sample*) &(m_dataBlock->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize]));
|
|
||||||
}
|
|
||||||
else if ((sizeof(Sample) == 4) && (sampleSize == 8)) // generally 24->16 bits
|
|
||||||
{
|
{
|
||||||
iconv = ((int32_t*) &(m_dataBlock->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize]))[0];
|
iconv = ((int32_t*) &(m_dataBlock->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize]))[0];
|
||||||
qconv = ((int32_t*) &(m_dataBlock->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize+4]))[0];
|
qconv = ((int32_t*) &(m_dataBlock->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize+4]))[0];
|
||||||
@ -81,7 +77,11 @@ private:
|
|||||||
s.setReal(iconv);
|
s.setReal(iconv);
|
||||||
s.setImag(qconv);
|
s.setImag(qconv);
|
||||||
}
|
}
|
||||||
else
|
else if ((sampleSize == 4) || (sampleSize == 8)) // generally 16->16 or 24->24 bits
|
||||||
|
{
|
||||||
|
s = *((Sample*) &(m_dataBlock->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize]));
|
||||||
|
}
|
||||||
|
else // invalid size
|
||||||
{
|
{
|
||||||
s = Sample{0, 0};
|
s = Sample{0, 0};
|
||||||
}
|
}
|
||||||
|
@ -1561,18 +1561,9 @@ void GLSpectrum::applyChanges()
|
|||||||
|
|
||||||
m_waterfallBuffer = new QImage(m_fftSize, waterfallHeight, QImage::Format_ARGB32);
|
m_waterfallBuffer = new QImage(m_fftSize, waterfallHeight, QImage::Format_ARGB32);
|
||||||
|
|
||||||
if(m_waterfallBuffer != 0)
|
m_waterfallBuffer->fill(qRgb(0x00, 0x00, 0x00));
|
||||||
{
|
m_glShaderWaterfall.initTexture(*m_waterfallBuffer);
|
||||||
m_waterfallBuffer->fill(qRgb(0x00, 0x00, 0x00));
|
m_waterfallBufferPos = 0;
|
||||||
m_glShaderWaterfall.initTexture(*m_waterfallBuffer);
|
|
||||||
m_waterfallBufferPos = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_fftSize = 0;
|
|
||||||
m_changesPending = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fftSizeChanged)
|
if(fftSizeChanged)
|
||||||
@ -1588,17 +1579,8 @@ void GLSpectrum::applyChanges()
|
|||||||
|
|
||||||
m_histogramBuffer = new QImage(m_fftSize, 100, QImage::Format_RGB32);
|
m_histogramBuffer = new QImage(m_fftSize, 100, QImage::Format_RGB32);
|
||||||
|
|
||||||
if(m_histogramBuffer != 0)
|
m_histogramBuffer->fill(qRgb(0x00, 0x00, 0x00));
|
||||||
{
|
m_glShaderHistogram.initTexture(*m_histogramBuffer, QOpenGLTexture::ClampToEdge);
|
||||||
m_histogramBuffer->fill(qRgb(0x00, 0x00, 0x00));
|
|
||||||
m_glShaderHistogram.initTexture(*m_histogramBuffer, QOpenGLTexture::ClampToEdge);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_fftSize = 0;
|
|
||||||
m_changesPending = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_histogram = new quint8[100 * m_fftSize];
|
m_histogram = new quint8[100 * m_fftSize];
|
||||||
memset(m_histogram, 0x00, 100 * m_fftSize);
|
memset(m_histogram, 0x00, 100 * m_fftSize);
|
||||||
|
@ -499,7 +499,7 @@ int GLSpectrumGUI::getAveragingValue(int averagingIndex) const
|
|||||||
|
|
||||||
int v = averagingIndex - 1;
|
int v = averagingIndex - 1;
|
||||||
int m = pow(10.0, v/3 > m_averagingMaxScale ? m_averagingMaxScale : v/3);
|
int m = pow(10.0, v/3 > m_averagingMaxScale ? m_averagingMaxScale : v/3);
|
||||||
int x;
|
int x = 1;
|
||||||
|
|
||||||
if (v % 3 == 0) {
|
if (v % 3 == 0) {
|
||||||
x = 2;
|
x = 2;
|
||||||
|
@ -182,13 +182,16 @@ void ValueDial::paintEvent(QPaintEvent*)
|
|||||||
|
|
||||||
painter.setPen(m_colorMapper.getBoundaryColor());
|
painter.setPen(m_colorMapper.getBoundaryColor());
|
||||||
painter.setBrush(Qt::NoBrush);
|
painter.setBrush(Qt::NoBrush);
|
||||||
for(int i = 1; i < m_numDigits + m_numDecimalPoints; i++) {
|
|
||||||
|
for (int i = 1; i < m_numDigits + m_numDecimalPoints; i++)
|
||||||
|
{
|
||||||
painter.setPen(m_colorMapper.getBoundaryColor());
|
painter.setPen(m_colorMapper.getBoundaryColor());
|
||||||
painter.drawLine(1 + i * m_digitWidth, 1, 1 + i * m_digitWidth, height() - 1);
|
painter.drawLine(1 + i * m_digitWidth, 1, 1 + i * m_digitWidth, height() - 1);
|
||||||
painter.setPen(m_colorMapper.getBoundaryAlphaColor());
|
painter.setPen(m_colorMapper.getBoundaryAlphaColor());
|
||||||
painter.drawLine(0 + i * m_digitWidth, 1, 0 + i * m_digitWidth, height() - 1);
|
painter.drawLine(0 + i * m_digitWidth, 1, 0 + i * m_digitWidth, height() - 1);
|
||||||
painter.drawLine(2 + i * m_digitWidth, 1, 2 + i * m_digitWidth, height() - 1);
|
painter.drawLine(2 + i * m_digitWidth, 1, 2 + i * m_digitWidth, height() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
painter.setPen(m_colorMapper.getBoundaryAlphaColor());
|
painter.setPen(m_colorMapper.getBoundaryAlphaColor());
|
||||||
painter.drawLine(1, 1, 1, height() - 1);
|
painter.drawLine(1, 1, 1, height() - 1);
|
||||||
painter.drawLine(width() - 2, 1, width() - 2, height() - 1);
|
painter.drawLine(width() - 2, 1, width() - 2, height() - 1);
|
||||||
@ -201,13 +204,15 @@ void ValueDial::paintEvent(QPaintEvent*)
|
|||||||
painter.drawLine(1, height() - 1, width() - 1, height() - 1);
|
painter.drawLine(1, height() - 1, width() - 1, height() - 1);
|
||||||
painter.drawLine(width() - 1, height() - 1, width() - 1, 0);
|
painter.drawLine(width() - 1, height() - 1, width() - 1, 0);
|
||||||
|
|
||||||
if(m_hightlightedDigit >= 0) {
|
if (m_hightlightedDigit >= 0)
|
||||||
|
{
|
||||||
painter.setPen(Qt::NoPen);
|
painter.setPen(Qt::NoPen);
|
||||||
painter.setBrush(m_colorMapper.getHighlightColor());
|
painter.setBrush(m_colorMapper.getHighlightColor());
|
||||||
painter.drawRect(2 + m_hightlightedDigit * m_digitWidth, 1, m_digitWidth - 1, height() - 1);
|
painter.drawRect(2 + m_hightlightedDigit * m_digitWidth, 1, m_digitWidth - 1, height() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_animationState == 0) {
|
if (m_animationState == 0)
|
||||||
|
{
|
||||||
for(int i = 0; i < m_text.length(); i++) {
|
for(int i = 0; i < m_text.length(); i++) {
|
||||||
painter.setClipRect(1 + i * m_digitWidth, 1, m_digitWidth, m_digitHeight * 2);
|
painter.setClipRect(1 + i * m_digitWidth, 1, m_digitWidth, m_digitHeight * 2);
|
||||||
painter.setPen(m_colorMapper.getSecondaryForegroundColor());
|
painter.setPen(m_colorMapper.getSecondaryForegroundColor());
|
||||||
@ -224,31 +229,39 @@ void ValueDial::paintEvent(QPaintEvent*)
|
|||||||
painter.setBrush(m_colorMapper.getSecondaryForegroundColor());
|
painter.setBrush(m_colorMapper.getSecondaryForegroundColor());
|
||||||
painter.drawRect(4 + m_cursor * m_digitWidth, 1 + m_digitHeight * 1.5, m_digitWidth - 5, m_digitHeight / 6);
|
painter.drawRect(4 + m_cursor * m_digitWidth, 1 + m_digitHeight * 1.5, m_digitWidth - 5, m_digitHeight / 6);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if(m_animationState != 0) {
|
else
|
||||||
for(int i = 0; i < m_text.length(); i++) {
|
{
|
||||||
if(m_text[i] == m_textNew[i]) {
|
for (int i = 0; i < m_text.length(); i++)
|
||||||
painter.setClipRect(1 + i * m_digitWidth, 1, m_digitWidth, m_digitHeight * 2);
|
{
|
||||||
painter.setPen(m_colorMapper.getSecondaryForegroundColor());
|
if (m_text[i] == m_textNew[i])
|
||||||
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * 0.6, m_digitWidth, m_digitHeight), Qt::AlignCenter, m_text.mid(i, 1));
|
{
|
||||||
if(m_text[i] != m_groupSeparator) {
|
painter.setClipRect(1 + i * m_digitWidth, 1, m_digitWidth, m_digitHeight * 2);
|
||||||
painter.setPen(m_colorMapper.getForegroundColor());
|
painter.setPen(m_colorMapper.getSecondaryForegroundColor());
|
||||||
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * -0.7, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], true));
|
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * 0.6, m_digitWidth, m_digitHeight), Qt::AlignCenter, m_text.mid(i, 1));
|
||||||
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * 1.9, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], false));
|
|
||||||
}
|
if (m_text[i] != m_groupSeparator)
|
||||||
} else {
|
{
|
||||||
int h = m_digitHeight * 0.6 + m_digitHeight * m_animationState / 2.0;
|
painter.setPen(m_colorMapper.getForegroundColor());
|
||||||
painter.setClipRect(1 + i * m_digitWidth, 1, m_digitWidth, m_digitHeight * 2);
|
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * -0.7, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], true));
|
||||||
painter.setPen(m_colorMapper.getSecondaryForegroundColor());
|
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * 1.9, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], false));
|
||||||
painter.drawText(QRect(1 + i * m_digitWidth, h, m_digitWidth, m_digitHeight), Qt::AlignCenter, m_text.mid(i, 1));
|
}
|
||||||
if(m_text[i] != m_groupSeparator) {
|
}
|
||||||
painter.setPen(m_colorMapper.getForegroundColor());
|
else
|
||||||
painter.drawText(QRect(1 + i * m_digitWidth, h + m_digitHeight * -0.7, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], true));
|
{
|
||||||
painter.drawText(QRect(1 + i * m_digitWidth, h + m_digitHeight * 1.9, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], false));
|
int h = m_digitHeight * 0.6 + m_digitHeight * m_animationState / 2.0;
|
||||||
}
|
painter.setClipRect(1 + i * m_digitWidth, 1, m_digitWidth, m_digitHeight * 2);
|
||||||
}
|
painter.setPen(m_colorMapper.getSecondaryForegroundColor());
|
||||||
}
|
painter.drawText(QRect(1 + i * m_digitWidth, h, m_digitWidth, m_digitHeight), Qt::AlignCenter, m_text.mid(i, 1));
|
||||||
}
|
|
||||||
|
if (m_text[i] != m_groupSeparator)
|
||||||
|
{
|
||||||
|
painter.setPen(m_colorMapper.getForegroundColor());
|
||||||
|
painter.drawText(QRect(1 + i * m_digitWidth, h + m_digitHeight * -0.7, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], true));
|
||||||
|
painter.drawText(QRect(1 + i * m_digitWidth, h + m_digitHeight * 1.9, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ void ValueDialZ::paintEvent(QPaintEvent*)
|
|||||||
painter.setPen(m_colorMapper.getSecondaryForegroundColor());
|
painter.setPen(m_colorMapper.getSecondaryForegroundColor());
|
||||||
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * 0.6, m_digitWidth, m_digitHeight), Qt::AlignCenter, m_text.mid(i, 1));
|
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * 0.6, m_digitWidth, m_digitHeight), Qt::AlignCenter, m_text.mid(i, 1));
|
||||||
|
|
||||||
if(m_text[i] != m_groupSeparator)
|
if (m_text[i] != m_groupSeparator)
|
||||||
{
|
{
|
||||||
painter.setPen(m_colorMapper.getForegroundColor());
|
painter.setPen(m_colorMapper.getForegroundColor());
|
||||||
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * -0.7, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], true));
|
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * -0.7, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], true));
|
||||||
@ -275,36 +275,33 @@ void ValueDialZ::paintEvent(QPaintEvent*)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(m_animationState != 0)
|
for(int i = 0; i < m_text.length(); i++)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < m_text.length(); i++)
|
if (m_text[i] == m_textNew[i])
|
||||||
{
|
{
|
||||||
if(m_text[i] == m_textNew[i])
|
painter.setClipRect(1 + i * m_digitWidth, 1, m_digitWidth, m_digitHeight * 2);
|
||||||
{
|
painter.setPen(m_colorMapper.getSecondaryForegroundColor());
|
||||||
painter.setClipRect(1 + i * m_digitWidth, 1, m_digitWidth, m_digitHeight * 2);
|
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * 0.6, m_digitWidth, m_digitHeight), Qt::AlignCenter, m_text.mid(i, 1));
|
||||||
painter.setPen(m_colorMapper.getSecondaryForegroundColor());
|
|
||||||
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * 0.6, m_digitWidth, m_digitHeight), Qt::AlignCenter, m_text.mid(i, 1));
|
|
||||||
|
|
||||||
if(m_text[i] != m_groupSeparator)
|
if (m_text[i] != m_groupSeparator)
|
||||||
{
|
{
|
||||||
painter.setPen(m_colorMapper.getForegroundColor());
|
painter.setPen(m_colorMapper.getForegroundColor());
|
||||||
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * -0.7, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], true));
|
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * -0.7, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], true));
|
||||||
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * 1.9, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], false));
|
painter.drawText(QRect(1 + i * m_digitWidth, m_digitHeight * 1.9, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], false));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
int h = m_digitHeight * 0.6 + m_digitHeight * m_animationState / 2.0;
|
{
|
||||||
painter.setClipRect(1 + i * m_digitWidth, 1, m_digitWidth, m_digitHeight * 2);
|
int h = m_digitHeight * 0.6 + m_digitHeight * m_animationState / 2.0;
|
||||||
painter.setPen(m_colorMapper.getSecondaryForegroundColor());
|
painter.setClipRect(1 + i * m_digitWidth, 1, m_digitWidth, m_digitHeight * 2);
|
||||||
painter.drawText(QRect(1 + i * m_digitWidth, h, m_digitWidth, m_digitHeight), Qt::AlignCenter, m_text.mid(i, 1));
|
painter.setPen(m_colorMapper.getSecondaryForegroundColor());
|
||||||
|
painter.drawText(QRect(1 + i * m_digitWidth, h, m_digitWidth, m_digitHeight), Qt::AlignCenter, m_text.mid(i, 1));
|
||||||
|
|
||||||
if(m_text[i] != m_groupSeparator)
|
if (m_text[i] != m_groupSeparator)
|
||||||
{
|
{
|
||||||
painter.setPen(m_colorMapper.getForegroundColor());
|
painter.setPen(m_colorMapper.getForegroundColor());
|
||||||
painter.drawText(QRect(1 + i * m_digitWidth, h + m_digitHeight * -0.7, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], true));
|
painter.drawText(QRect(1 + i * m_digitWidth, h + m_digitHeight * -0.7, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], true));
|
||||||
painter.drawText(QRect(1 + i * m_digitWidth, h + m_digitHeight * 1.9, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], false));
|
painter.drawText(QRect(1 + i * m_digitWidth, h + m_digitHeight * 1.9, m_digitWidth, m_digitHeight), Qt::AlignCenter, digitNeigh(m_text[i], false));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user