From 2c2dda97818b4a16af411ae6f1001b9b786fd4d2 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Wed, 8 Jan 2025 14:31:21 +0100 Subject: [PATCH] remove obsolete woverview files (again) probably reintroduced during merge of 2.5 --- src/widget/woverviewhsv.cpp | 146 ---------------------------------- src/widget/woverviewlmh.cpp | 137 -------------------------------- src/widget/woverviewrgb.cpp | 152 ------------------------------------ 3 files changed, 435 deletions(-) delete mode 100644 src/widget/woverviewhsv.cpp delete mode 100644 src/widget/woverviewlmh.cpp delete mode 100644 src/widget/woverviewrgb.cpp diff --git a/src/widget/woverviewhsv.cpp b/src/widget/woverviewhsv.cpp deleted file mode 100644 index c818bcf7094..00000000000 --- a/src/widget/woverviewhsv.cpp +++ /dev/null @@ -1,146 +0,0 @@ -#include "widget/woverviewhsv.h" - -#include -#include - -#include "moc_woverviewhsv.cpp" -#include "util/colorcomponents.h" -#include "util/math.h" -#include "util/timer.h" -#include "waveform/waveform.h" - -WOverviewHSV::WOverviewHSV( - const QString& group, - PlayerManager* pPlayerManager, - UserSettingsPointer pConfig, - QWidget* parent) - : WOverview(group, pPlayerManager, pConfig, parent) { -} - -bool WOverviewHSV::drawNextPixmapPart() { - ScopedTimer t(QStringLiteral("WOverviewHSV::drawNextPixmapPart")); - - //qDebug() << "WOverview::drawNextPixmapPart()"; - - int currentCompletion; - - ConstWaveformPointer pWaveform = getWaveform(); - if (!pWaveform) { - return false; - } - - const int dataSize = pWaveform->getDataSize(); - const double audioVisualRatio = pWaveform->getAudioVisualRatio(); - const double trackSamples = getTrackSamples(); - if (dataSize <= 0 || audioVisualRatio <= 0 || trackSamples <= 0) { - return false; - } - - if (m_waveformSourceImage.isNull()) { - // Waveform pixmap twice the height of the viewport to be scalable - // by total_gain - // We keep full range waveform data to scale it on paint - m_waveformSourceImage = QImage( - static_cast(trackSamples / audioVisualRatio / 2) + 1, - 2 * 255, - QImage::Format_ARGB32_Premultiplied); - m_waveformSourceImage.fill(QColor(0, 0, 0, 0).value()); - if (dataSize / 2 != m_waveformSourceImage.width()) { - qWarning() << "Track duration has changed since last analysis" - << m_waveformSourceImage.width() << "!=" << dataSize / 2; - } - } - DEBUG_ASSERT(!m_waveformSourceImage.isNull()); - - // Always multiple of 2 - const int waveformCompletion = pWaveform->getCompletion(); - // Test if there is some new to draw (at least of pixel width) - const int completionIncrement = waveformCompletion - m_actualCompletion; - - int visiblePixelIncrement = completionIncrement * length() / dataSize; - if (waveformCompletion < (dataSize - 2) && - (completionIncrement < 2 || visiblePixelIncrement == 0)) { - return false; - } - - const int nextCompletion = m_actualCompletion + completionIncrement; - - //qDebug() << "WOverview::drawNextPixmapPart() - nextCompletion:" - // << nextCompletion - // << "m_actualCompletion:" << m_actualCompletion - // << "waveformCompletion:" << waveformCompletion - // << "completionIncrement:" << completionIncrement; - - - QPainter painter(&m_waveformSourceImage); - painter.translate(0.0, static_cast(m_waveformSourceImage.height()) / 2.0); - - // Get HSV of low color. - float h, s, v; - getHsvF(m_signalColors.getLowColor(), &h, &s, &v); - - QColor color; - float lo, hi, total; - - unsigned char maxLow[2] = {0, 0}; - unsigned char maxHigh[2] = {0, 0}; - unsigned char maxMid[2] = {0, 0}; - unsigned char maxAll[2] = {0, 0}; - - for (currentCompletion = m_actualCompletion; - currentCompletion < nextCompletion; currentCompletion += 2) { - maxAll[0] = pWaveform->getAll(currentCompletion); - maxAll[1] = pWaveform->getAll(currentCompletion+1); - if (maxAll[0] || maxAll[1]) { - maxLow[0] = pWaveform->getLow(currentCompletion); - maxLow[1] = pWaveform->getLow(currentCompletion+1); - maxMid[0] = pWaveform->getMid(currentCompletion); - maxMid[1] = pWaveform->getMid(currentCompletion+1); - maxHigh[0] = pWaveform->getHigh(currentCompletion); - maxHigh[1] = pWaveform->getHigh(currentCompletion+1); - - total = (maxLow[0] + maxLow[1] + maxMid[0] + maxMid[1] + - maxHigh[0] + maxHigh[1]) * - 1.2f; - - // Prevent division by zero - if (total > 0) { - // Normalize low and high - // (mid not need, because it not change the color) - lo = (maxLow[0] + maxLow[1]) / total; - hi = (maxHigh[0] + maxHigh[1]) / total; - } else { - lo = hi = 0.0; - } - - // Set color - color.setHsvF(h, 1.0f - hi, 1.0f - lo); - - painter.setPen(color); - painter.drawLine(QPoint(currentCompletion / 2, -maxAll[0]), - QPoint(currentCompletion / 2, maxAll[1])); - } - } - - // Evaluate waveform ratio peak - - for (currentCompletion = m_actualCompletion; - currentCompletion < nextCompletion; currentCompletion += 2) { - m_waveformPeak = math_max3( - m_waveformPeak, - static_cast(pWaveform->getAll(currentCompletion)), - static_cast(pWaveform->getAll(currentCompletion + 1))); - } - - m_actualCompletion = nextCompletion; - m_waveformImageScaled = QImage(); - m_diffGain = 0; - - // Test if the complete waveform is done - if (m_actualCompletion >= dataSize - 2) { - m_pixmapDone = true; - //qDebug() << "m_waveformPeakRatio" << m_waveformPeak; - } - - return true; -} diff --git a/src/widget/woverviewlmh.cpp b/src/widget/woverviewlmh.cpp deleted file mode 100644 index 30f2f4aad01..00000000000 --- a/src/widget/woverviewlmh.cpp +++ /dev/null @@ -1,137 +0,0 @@ -#include "widget/woverviewlmh.h" - -#include -#include -#include - -#include "moc_woverviewlmh.cpp" -#include "util/math.h" -#include "util/timer.h" -#include "waveform/waveform.h" - -WOverviewLMH::WOverviewLMH( - const QString& group, - PlayerManager* pPlayerManager, - UserSettingsPointer pConfig, - QWidget* parent) - : WOverview(group, pPlayerManager, pConfig, parent) { -} - -bool WOverviewLMH::drawNextPixmapPart() { - ScopedTimer t(QStringLiteral("WOverviewLMH::drawNextPixmapPart")); - - //qDebug() << "WOverview::drawNextPixmapPart()"; - - int currentCompletion; - - ConstWaveformPointer pWaveform = getWaveform(); - if (!pWaveform) { - return false; - } - - const int dataSize = pWaveform->getDataSize(); - const double audioVisualRatio = pWaveform->getAudioVisualRatio(); - const double trackSamples = getTrackSamples(); - if (dataSize <= 0 || audioVisualRatio <= 0 || trackSamples <= 0) { - return false; - } - - if (m_waveformSourceImage.isNull()) { - // Waveform pixmap twice the height of the viewport to be scalable - // by total_gain - // We keep full range waveform data to scale it on paint - m_waveformSourceImage = QImage( - static_cast(trackSamples / audioVisualRatio / 2) + 1, - 2 * 255, - QImage::Format_ARGB32_Premultiplied); - m_waveformSourceImage.fill(QColor(0, 0, 0, 0).value()); - if (dataSize / 2 != m_waveformSourceImage.width()) { - qWarning() << "Track duration has changed since last analysis" - << m_waveformSourceImage.width() << "!=" << dataSize / 2; - } - } - DEBUG_ASSERT(!m_waveformSourceImage.isNull()); - - // Always multiple of 2 - const int waveformCompletion = pWaveform->getCompletion(); - // Test if there is some new to draw (at least of pixel width) - const int completionIncrement = waveformCompletion - m_actualCompletion; - - int visiblePixelIncrement = completionIncrement * length() / dataSize; - if (waveformCompletion < (dataSize - 2) && - (completionIncrement < 2 || visiblePixelIncrement == 0)) { - return false; - } - - const int nextCompletion = m_actualCompletion + completionIncrement; - - //qDebug() << "WOverview::drawNextPixmapPart() - nextCompletion:" - // << nextCompletion - // << "m_actualCompletion:" << m_actualCompletion - // << "waveformCompletion:" << waveformCompletion - // << "completionIncrement:" << completionIncrement; - - - QPainter painter(&m_waveformSourceImage); - painter.translate(0.0, static_cast(m_waveformSourceImage.height()) / 2.0); - - QColor lowColor = m_signalColors.getLowColor(); - QPen lowColorPen(QBrush(lowColor), 1); - - QColor midColor = m_signalColors.getMidColor(); - QPen midColorPen(QBrush(midColor), 1); - - QColor highColor = m_signalColors.getHighColor(); - QPen highColorPen(QBrush(highColor), 1); - - for (currentCompletion = m_actualCompletion; - currentCompletion < nextCompletion; currentCompletion += 2) { - unsigned char lowNeg = pWaveform->getLow(currentCompletion); - unsigned char lowPos = pWaveform->getLow(currentCompletion+1); - if (lowPos || lowNeg) { - painter.setPen(lowColorPen); - painter.drawLine(QPoint(currentCompletion / 2, -lowNeg), - QPoint(currentCompletion / 2, lowPos)); - } - } - - for (currentCompletion = m_actualCompletion; - currentCompletion < nextCompletion; currentCompletion += 2) { - painter.setPen(midColorPen); - painter.drawLine(QPoint(currentCompletion / 2, - -pWaveform->getMid(currentCompletion)), - QPoint(currentCompletion / 2, - pWaveform->getMid(currentCompletion+1))); - } - - for (currentCompletion = m_actualCompletion; - currentCompletion < nextCompletion; currentCompletion += 2) { - painter.setPen(highColorPen); - painter.drawLine(QPoint(currentCompletion / 2, - -pWaveform->getHigh(currentCompletion)), - QPoint(currentCompletion / 2, - pWaveform->getHigh(currentCompletion+1))); - } - - // Evaluate waveform ratio peak - - for (currentCompletion = m_actualCompletion; - currentCompletion < nextCompletion; currentCompletion += 2) { - m_waveformPeak = math_max3( - m_waveformPeak, - static_cast(pWaveform->getAll(currentCompletion)), - static_cast(pWaveform->getAll(currentCompletion + 1))); - } - - m_actualCompletion = nextCompletion; - m_waveformImageScaled = QImage(); - m_diffGain = 0; - - // Test if the complete waveform is done - if (m_actualCompletion >= dataSize - 2) { - m_pixmapDone = true; - //qDebug() << "m_waveformPeakRatio" << m_waveformPeak; - } - - return true; -} diff --git a/src/widget/woverviewrgb.cpp b/src/widget/woverviewrgb.cpp deleted file mode 100644 index e9e03145377..00000000000 --- a/src/widget/woverviewrgb.cpp +++ /dev/null @@ -1,152 +0,0 @@ -#include "widget/woverviewrgb.h" - -#include - -#include "moc_woverviewrgb.cpp" -#include "util/colorcomponents.h" -#include "util/math.h" -#include "util/timer.h" -#include "waveform/waveform.h" - -WOverviewRGB::WOverviewRGB( - const QString& group, - PlayerManager* pPlayerManager, - UserSettingsPointer pConfig, - QWidget* parent) - : WOverview(group, pPlayerManager, pConfig, parent) { -} - -bool WOverviewRGB::drawNextPixmapPart() { - ScopedTimer t(QStringLiteral("WOverviewRGB::drawNextPixmapPart")); - - //qDebug() << "WOverview::drawNextPixmapPart()"; - - int currentCompletion; - - ConstWaveformPointer pWaveform = getWaveform(); - if (!pWaveform) { - return false; - } - - const int dataSize = pWaveform->getDataSize(); - const double audioVisualRatio = pWaveform->getAudioVisualRatio(); - const double trackSamples = getTrackSamples(); - if (dataSize <= 0 || audioVisualRatio <= 0 || trackSamples <= 0) { - return false; - } - - if (m_waveformSourceImage.isNull()) { - // Waveform pixmap twice the height of the viewport to be scalable - // by total_gain - // We keep full range waveform data to scale it on paint - m_waveformSourceImage = QImage( - static_cast(trackSamples / audioVisualRatio / 2) + 1, - 2 * 255, - QImage::Format_ARGB32_Premultiplied); - m_waveformSourceImage.fill(QColor(0, 0, 0, 0).value()); - if (dataSize / 2 != m_waveformSourceImage.width()) { - qWarning() << "Track duration has changed since last analysis" - << m_waveformSourceImage.width() << "!=" << dataSize / 2; - } - } - DEBUG_ASSERT(!m_waveformSourceImage.isNull()); - - // Always multiple of 2 - const int waveformCompletion = pWaveform->getCompletion(); - // Test if there is some new to draw (at least of pixel width) - const int completionIncrement = waveformCompletion - m_actualCompletion; - - int visiblePixelIncrement = completionIncrement * length() / dataSize; - if (waveformCompletion < (dataSize - 2) && - (completionIncrement < 2 || visiblePixelIncrement == 0)) { - return false; - } - - const int nextCompletion = m_actualCompletion + completionIncrement; - - //qDebug() << "WOverview::drawNextPixmapPart() - nextCompletion:" - // << nextCompletion - // << "m_actualCompletion:" << m_actualCompletion - // << "waveformCompletion:" << waveformCompletion - // << "completionIncrement:" << completionIncrement; - - QPainter painter(&m_waveformSourceImage); - painter.translate(0.0, static_cast(m_waveformSourceImage.height()) / 2.0); - - QColor color; - - float lowColor_r, lowColor_g, lowColor_b; - getRgbF(m_signalColors.getRgbLowColor(), &lowColor_r, &lowColor_g, &lowColor_b); - - float midColor_r, midColor_g, midColor_b; - getRgbF(m_signalColors.getRgbMidColor(), &midColor_r, &midColor_g, &midColor_b); - - float highColor_r, highColor_g, highColor_b; - getRgbF(m_signalColors.getRgbHighColor(), &highColor_r, &highColor_g, &highColor_b); - - for (currentCompletion = m_actualCompletion; - currentCompletion < nextCompletion; currentCompletion += 2) { - - unsigned char left = pWaveform->getAll(currentCompletion); - unsigned char right = pWaveform->getAll(currentCompletion + 1); - - // Retrieve "raw" LMH values from waveform - float low = static_cast(pWaveform->getLow(currentCompletion)); - float mid = static_cast(pWaveform->getMid(currentCompletion)); - float high = static_cast(pWaveform->getHigh(currentCompletion)); - - // Do matrix multiplication - float red = low * lowColor_r + mid * midColor_r + high * highColor_r; - float green = low * lowColor_g + mid * midColor_g + high * highColor_g; - float blue = low * lowColor_b + mid * midColor_b + high * highColor_b; - - // Normalize and draw - float max = math_max3(red, green, blue); - if (max > 0.0) { - color.setRgbF(red / max, green / max, blue / max); - painter.setPen(color); - painter.drawLine(QPointF(currentCompletion / 2, -left), - QPointF(currentCompletion / 2, 0)); - } - - // Retrieve "raw" LMH values from waveform - low = static_cast(pWaveform->getLow(currentCompletion + 1)); - mid = static_cast(pWaveform->getMid(currentCompletion + 1)); - high = static_cast(pWaveform->getHigh(currentCompletion + 1)); - - // Do matrix multiplication - red = low * lowColor_r + mid * midColor_r + high * highColor_r; - green = low * lowColor_g + mid * midColor_g + high * highColor_g; - blue = low * lowColor_b + mid * midColor_b + high * highColor_b; - - // Normalize and draw - max = math_max3(red, green, blue); - if (max > 0.0) { - color.setRgbF(red / max, green / max, blue / max); - painter.setPen(color); - painter.drawLine(QPointF(currentCompletion / 2, 0), - QPointF(currentCompletion / 2, right)); - } - } - - // Evaluate waveform ratio peak - for (currentCompletion = m_actualCompletion; - currentCompletion < nextCompletion; currentCompletion += 2) { - m_waveformPeak = math_max3( - m_waveformPeak, - static_cast(pWaveform->getAll(currentCompletion)), - static_cast(pWaveform->getAll(currentCompletion + 1))); - } - - m_actualCompletion = nextCompletion; - m_waveformImageScaled = QImage(); - m_diffGain = 0; - - // Test if the complete waveform is done - if (m_actualCompletion >= dataSize - 2) { - m_pixmapDone = true; - //qDebug() << "m_waveformPeakRatio" << m_waveformPeak; - } - - return true; -}