diff --git a/CMakeLists.txt b/CMakeLists.txt index bbf34936ec9..aa980daf570 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1281,6 +1281,7 @@ else() src/waveform/renderers/allshader/waveformrenderer.cpp src/waveform/renderers/allshader/waveformrendererendoftrack.cpp src/waveform/renderers/allshader/waveformrendererfiltered.cpp + src/waveform/renderers/allshader/waveformrendererhsv.cpp src/waveform/renderers/allshader/waveformrendererlrrgb.cpp src/waveform/renderers/allshader/waveformrendererpreroll.cpp src/waveform/renderers/allshader/waveformrendererrgb.cpp @@ -1289,6 +1290,7 @@ else() src/waveform/renderers/allshader/waveformrendermark.cpp src/waveform/renderers/allshader/waveformrendermarkrange.cpp src/waveform/widgets/allshader/filteredwaveformwidget.cpp + src/waveform/widgets/allshader/hsvwaveformwidget.cpp src/waveform/widgets/allshader/lrrgbwaveformwidget.cpp src/waveform/widgets/allshader/rgbwaveformwidget.cpp src/waveform/widgets/allshader/simplewaveformwidget.cpp diff --git a/src/preferences/upgrade.cpp b/src/preferences/upgrade.cpp index 2af0b02b1fd..c03ee8b48b8 100644 --- a/src/preferences/upgrade.cpp +++ b/src/preferences/upgrade.cpp @@ -20,6 +20,7 @@ #include "util/db/dbconnectionpooler.h" #include "util/math.h" #include "util/versionstore.h" +#include "waveform/widgets/waveformwidgettype.h" Upgrade::Upgrade() : m_bFirstRun(false), @@ -29,6 +30,45 @@ Upgrade::Upgrade() Upgrade::~Upgrade() { } +namespace { +// mapping to proactively move users to the new all-shader waveform types +WaveformWidgetType::Type upgradeToAllShaders(WaveformWidgetType::Type waveformType) { + // TODO: convert `WaveformWidgetType::Type` to an enum class then shorten more `using enum ...` + using WWT = WaveformWidgetType; + switch (waveformType) { + case WWT::EmptyWaveform: + case WWT::SoftwareSimpleWaveform: + case WWT::SoftwareWaveform: + case WWT::GLVSyncTest: + case WWT::QtVSyncTest: + case WWT::AllShaderRGBWaveform: + case WWT::AllShaderLRRGBWaveform: + case WWT::AllShaderFilteredWaveform: + case WWT::AllShaderSimpleWaveform: + case WWT::AllShaderHSVWaveform: + case WWT::Count_WaveformwidgetType: + return waveformType; + case WWT::QtSimpleWaveform: + case WWT::GLSimpleWaveform: + return WaveformWidgetType::AllShaderSimpleWaveform; + case WWT::GLFilteredWaveform: + case WWT::GLSLFilteredWaveform: + return WaveformWidgetType::AllShaderFilteredWaveform; + case WWT::QtWaveform: + case WWT::RGBWaveform: + case WWT::GLRGBWaveform: + case WWT::GLSLRGBWaveform: + case WWT::QtRGBWaveform: + case WWT::GLSLRGBStackedWaveform: + return WWT::AllShaderRGBWaveform; + case WWT::HSVWaveform: + case WWT::QtHSVWaveform: + return WWT::AllShaderHSVWaveform; + } + return WWT::AllShaderRGBWaveform; +} +} // namespace + // We return the UserSettings here because we have to make changes to the // configuration and the location of the file may change between releases. UserSettingsPointer Upgrade::versionUpgrade(const QString& settingsPath) { @@ -426,8 +466,9 @@ UserSettingsPointer Upgrade::versionUpgrade(const QString& settingsPath) { // if everything until here worked fine we can mark the configuration as // updated if (successful) { - configVersion = VersionStore::version(); - config->set(ConfigKey("[Config]", "Version"), ConfigValue(VersionStore::version())); + configVersion = "1.12.0"; + config->set(ConfigKey("[Config]", "Version"), + ConfigValue(configVersion)); } else { qDebug() << "Upgrade failed!\n"; @@ -436,9 +477,36 @@ UserSettingsPointer Upgrade::versionUpgrade(const QString& settingsPath) { const auto configFileVersion = QVersionNumber::fromString(configVersion); + // When upgrading from 2.3.x or older to 2.4, or when upgrading + // from 2.4.0-beta once we are out of beta + if (QVersionNumber::fromString(configVersion) < QVersionNumber(2, 4, 0) || + (VersionStore::version() != "2.4.0-beta" && + configVersion.startsWith("2.4.0-"))) { + // Proactively move users to an all-shader waveform widget type and set the + // framerate to 60 fps + bool ok = false; + auto waveformType = + config->getValueString(ConfigKey("[Waveform]", "WaveformType")) + .toInt(&ok); + if (ok) { + config->set(ConfigKey("[Waveform]", "WaveformType"), + ConfigValue(upgradeToAllShaders( + static_cast( + waveformType)))); + } + config->set(ConfigKey("[Waveform]", "FrameRate"), ConfigValue(60)); + + // mark the configuration as updated + configVersion = "2.4.0"; + config->set(ConfigKey("[Config]", "Version"), + ConfigValue(configVersion)); + } + // This variable indicates the first known version that requires no changes. - const QVersionNumber cleanVersion(1, 12, 0); - if (configFileVersion >= cleanVersion) { + // If additional upgrades are added for later versions, they should go before + // this block and cleanVersion should be bumped to the latest version. + const QVersionNumber cleanVersion(2, 4, 0); + if (QVersionNumber::fromString(configVersion) >= cleanVersion) { // No special upgrade required, just update the value. configVersion = VersionStore::version(); config->set(ConfigKey("[Config]", "Version"), ConfigValue(VersionStore::version())); diff --git a/src/waveform/renderers/allshader/waveformrenderbackground.cpp b/src/waveform/renderers/allshader/waveformrenderbackground.cpp index c848b8f72b0..6f04a7fa791 100644 --- a/src/waveform/renderers/allshader/waveformrenderbackground.cpp +++ b/src/waveform/renderers/allshader/waveformrenderbackground.cpp @@ -10,9 +10,6 @@ WaveformRenderBackground::WaveformRenderBackground( m_backgroundColor(0, 0, 0) { } -WaveformRenderBackground::~WaveformRenderBackground() { -} - void WaveformRenderBackground::setup(const QDomNode& node, const SkinContext& context) { m_backgroundColor = m_waveformRenderer->getWaveformSignalColors()->getBgColor(); diff --git a/src/waveform/renderers/allshader/waveformrenderbackground.h b/src/waveform/renderers/allshader/waveformrenderbackground.h index 654261d1dd4..8a913e27742 100644 --- a/src/waveform/renderers/allshader/waveformrenderbackground.h +++ b/src/waveform/renderers/allshader/waveformrenderbackground.h @@ -12,7 +12,6 @@ class WaveformRenderBackground; class allshader::WaveformRenderBackground final : public allshader::WaveformRenderer { public: explicit WaveformRenderBackground(WaveformWidgetRenderer* waveformWidgetRenderer); - ~WaveformRenderBackground() override; void setup(const QDomNode& node, const SkinContext& context) override; void paintGL() override; diff --git a/src/waveform/renderers/allshader/waveformrenderbeat.cpp b/src/waveform/renderers/allshader/waveformrenderbeat.cpp index 7d21cd38c1e..0153504855e 100644 --- a/src/waveform/renderers/allshader/waveformrenderbeat.cpp +++ b/src/waveform/renderers/allshader/waveformrenderbeat.cpp @@ -16,9 +16,6 @@ WaveformRenderBeat::WaveformRenderBeat(WaveformWidgetRenderer* waveformWidget) : WaveformRenderer(waveformWidget) { } -WaveformRenderBeat::~WaveformRenderBeat() { -} - void WaveformRenderBeat::initializeGL() { WaveformRenderer::initializeGL(); m_shader.init(); diff --git a/src/waveform/renderers/allshader/waveformrenderbeat.h b/src/waveform/renderers/allshader/waveformrenderbeat.h index 30324719a8b..46411fe7372 100644 --- a/src/waveform/renderers/allshader/waveformrenderbeat.h +++ b/src/waveform/renderers/allshader/waveformrenderbeat.h @@ -17,7 +17,6 @@ class WaveformRenderBeat; class allshader::WaveformRenderBeat final : public allshader::WaveformRenderer { public: explicit WaveformRenderBeat(WaveformWidgetRenderer* waveformWidget); - ~WaveformRenderBeat() override; void setup(const QDomNode& node, const SkinContext& context) override; void paintGL() override; diff --git a/src/waveform/renderers/allshader/waveformrenderer.cpp b/src/waveform/renderers/allshader/waveformrenderer.cpp index f418eb4ee0e..297b28765e7 100644 --- a/src/waveform/renderers/allshader/waveformrenderer.cpp +++ b/src/waveform/renderers/allshader/waveformrenderer.cpp @@ -8,8 +8,6 @@ WaveformRenderer::WaveformRenderer(WaveformWidgetRenderer* widget) : ::WaveformRendererAbstract(widget) { } -WaveformRenderer::~WaveformRenderer() = default; - void WaveformRenderer::draw(QPainter* painter, QPaintEvent* event) { DEBUG_ASSERT(false); } diff --git a/src/waveform/renderers/allshader/waveformrenderer.h b/src/waveform/renderers/allshader/waveformrenderer.h index cb8d09e06e6..04b4b427935 100644 --- a/src/waveform/renderers/allshader/waveformrenderer.h +++ b/src/waveform/renderers/allshader/waveformrenderer.h @@ -13,7 +13,6 @@ class allshader::WaveformRenderer : public ::WaveformRendererAbstract, public allshader::WaveformRendererAbstract { public: explicit WaveformRenderer(WaveformWidgetRenderer* widget); - ~WaveformRenderer(); // Pure virtual from allshader::WaveformRendererAbstract. // Renderers that use QPainter functionality implement this. diff --git a/src/waveform/renderers/allshader/waveformrendererendoftrack.cpp b/src/waveform/renderers/allshader/waveformrendererendoftrack.cpp index 320585bfe54..42351ec1ad1 100644 --- a/src/waveform/renderers/allshader/waveformrendererendoftrack.cpp +++ b/src/waveform/renderers/allshader/waveformrendererendoftrack.cpp @@ -29,9 +29,6 @@ WaveformRendererEndOfTrack::WaveformRendererEndOfTrack( m_pTimeRemainingControl(nullptr) { } -WaveformRendererEndOfTrack::~WaveformRendererEndOfTrack() { -} - bool WaveformRendererEndOfTrack::init() { m_timer.restart(); diff --git a/src/waveform/renderers/allshader/waveformrendererendoftrack.h b/src/waveform/renderers/allshader/waveformrendererendoftrack.h index 8bc8e60903c..a1d0af135f3 100644 --- a/src/waveform/renderers/allshader/waveformrendererendoftrack.h +++ b/src/waveform/renderers/allshader/waveformrendererendoftrack.h @@ -21,7 +21,6 @@ class allshader::WaveformRendererEndOfTrack final : public allshader::WaveformRe public: explicit WaveformRendererEndOfTrack( WaveformWidgetRenderer* waveformWidget); - ~WaveformRendererEndOfTrack() override; void setup(const QDomNode& node, const SkinContext& context) override; diff --git a/src/waveform/renderers/allshader/waveformrendererfiltered.cpp b/src/waveform/renderers/allshader/waveformrendererfiltered.cpp index 3b3353dc022..8ef50728d91 100644 --- a/src/waveform/renderers/allshader/waveformrendererfiltered.cpp +++ b/src/waveform/renderers/allshader/waveformrendererfiltered.cpp @@ -16,9 +16,6 @@ WaveformRendererFiltered::WaveformRendererFiltered( : WaveformRendererSignalBase(waveformWidget) { } -WaveformRendererFiltered::~WaveformRendererFiltered() { -} - void WaveformRendererFiltered::onSetup(const QDomNode& node) { Q_UNUSED(node); } diff --git a/src/waveform/renderers/allshader/waveformrendererfiltered.h b/src/waveform/renderers/allshader/waveformrendererfiltered.h index 7b1ef5efec8..076b4f9af3f 100644 --- a/src/waveform/renderers/allshader/waveformrendererfiltered.h +++ b/src/waveform/renderers/allshader/waveformrendererfiltered.h @@ -12,7 +12,6 @@ class WaveformRendererFiltered; class allshader::WaveformRendererFiltered final : public allshader::WaveformRendererSignalBase { public: explicit WaveformRendererFiltered(WaveformWidgetRenderer* waveformWidget); - ~WaveformRendererFiltered() override; // override ::WaveformRendererSignalBase void onSetup(const QDomNode& node) override; diff --git a/src/waveform/renderers/allshader/waveformrendererhsv.cpp b/src/waveform/renderers/allshader/waveformrendererhsv.cpp new file mode 100644 index 00000000000..82d2e08a461 --- /dev/null +++ b/src/waveform/renderers/allshader/waveformrendererhsv.cpp @@ -0,0 +1,213 @@ +#include "waveform/renderers/allshader/waveformrendererhsv.h" + +#include "track/track.h" +#include "util/colorcomponents.h" +#include "util/math.h" +#include "waveform/renderers/allshader/matrixforwidgetgeometry.h" +#include "waveform/waveform.h" +#include "waveform/waveformwidgetfactory.h" +#include "waveform/widgets/allshader/waveformwidget.h" +#include "widget/wskincolor.h" +#include "widget/wwidget.h" + +using namespace allshader; + +WaveformRendererHSV::WaveformRendererHSV( + WaveformWidgetRenderer* waveformWidget) + : WaveformRendererSignalBase(waveformWidget) { +} + +void WaveformRendererHSV::onSetup(const QDomNode& node) { + Q_UNUSED(node); +} + +void WaveformRendererHSV::initializeGL() { + WaveformRendererSignalBase::initializeGL(); + m_shader.init(); +} + +void WaveformRendererHSV::paintGL() { + TrackPointer pTrack = m_waveformRenderer->getTrackInfo(); + if (!pTrack) { + return; + } + + ConstWaveformPointer waveform = pTrack->getWaveform(); + if (waveform.isNull()) { + return; + } + + const int dataSize = waveform->getDataSize(); + if (dataSize <= 1) { + return; + } + + const WaveformData* data = waveform->data(); + if (data == nullptr) { + return; + } + + const float devicePixelRatio = m_waveformRenderer->getDevicePixelRatio(); + const int length = static_cast(m_waveformRenderer->getLength() * devicePixelRatio); + + // Not multiplying with devicePixelRatio will also work. In that case, on + // High-DPI-Display the lines will be devicePixelRatio pixels wide (which is + // also what is used for the beat grid and the markers), or in other words + // each block of samples is represented by devicePixelRatio pixels (width). + + const double firstVisualIndex = m_waveformRenderer->getFirstDisplayedPosition() * dataSize; + const double lastVisualIndex = m_waveformRenderer->getLastDisplayedPosition() * dataSize; + + // Represents the # of waveform data points per horizontal pixel. + const double visualIncrementPerPixel = + (lastVisualIndex - firstVisualIndex) / static_cast(length); + + float allGain(1.0); + getGains(&allGain, nullptr, nullptr, nullptr); + + // Get base color of waveform in the HSV format (s and v isn't use) + float h, s, v; + getHsvF(m_pColors->getLowColor(), &h, &s, &v); + + const float breadth = static_cast(m_waveformRenderer->getBreadth()) * devicePixelRatio; + const float halfBreadth = breadth / 2.0f; + + const float heightFactor = allGain * halfBreadth / 256.f; + + // Effective visual index of x + double xVisualSampleIndex = firstVisualIndex; + + const int numVerticesPerLine = 6; // 2 triangles + + const int reserved = numVerticesPerLine * (length + 1); + + m_vertices.clear(); + m_vertices.reserve(reserved); + m_colors.clear(); + m_colors.reserve(reserved); + + m_vertices.addRectangle(0.f, + halfBreadth - 0.5f * devicePixelRatio, + static_cast(length), + halfBreadth + 0.5f * devicePixelRatio); + m_colors.addForRectangle( + static_cast(m_axesColor_r), + static_cast(m_axesColor_g), + static_cast(m_axesColor_b)); + + for (int pos = 0; pos < length; ++pos) { + // Our current pixel (x) corresponds to a number of visual samples + // (visualSamplerPerPixel) in our waveform object. We take the max of + // all the data points on either side of xVisualSampleIndex within a + // window of 'maxSamplingRange' visual samples to measure the maximum + // data point contained by this pixel. + double maxSamplingRange = visualIncrementPerPixel / 2.0; + + // Since xVisualSampleIndex is in visual-samples (e.g. R,L,R,L) we want + // to check +/- maxSamplingRange frames, not samples. To do this, divide + // xVisualSampleIndex by 2. Since frames indices are integers, we round + // to the nearest integer by adding 0.5 before casting to int. + int visualFrameStart = int(xVisualSampleIndex / 2.0 - maxSamplingRange + 0.5); + int visualFrameStop = int(xVisualSampleIndex / 2.0 + maxSamplingRange + 0.5); + const int lastVisualFrame = dataSize / 2 - 1; + + // We now know that some subset of [visualFrameStart, visualFrameStop] + // lies within the valid range of visual frames. Clamp + // visualFrameStart/Stop to within [0, lastVisualFrame]. + visualFrameStart = math_clamp(visualFrameStart, 0, lastVisualFrame); + visualFrameStop = math_clamp(visualFrameStop, 0, lastVisualFrame); + + int visualIndexStart = visualFrameStart * 2; + int visualIndexStop = visualFrameStop * 2; + + visualIndexStart = std::max(visualIndexStart, 0); + visualIndexStop = std::min(visualIndexStop, dataSize); + + const float fpos = static_cast(pos); + + // per channel + float maxLow[2]{}; + float maxMid[2]{}; + float maxHigh[2]{}; + float maxAll[2]{}; + + for (int chn = 0; chn < 2; chn++) { + // data is interleaved left / right + for (int i = visualIndexStart + chn; i < visualIndexStop + chn; i += 2) { + const WaveformData& waveformData = data[i]; + + const float filteredLow = static_cast(waveformData.filtered.low); + const float filteredMid = static_cast(waveformData.filtered.mid); + const float filteredHigh = static_cast(waveformData.filtered.high); + const float filteredAll = static_cast(waveformData.filtered.all); + + maxLow[chn] = math_max(maxLow[chn], filteredLow); + maxMid[chn] = math_max(maxMid[chn], filteredMid); + maxHigh[chn] = math_max(maxHigh[chn], filteredHigh); + maxAll[chn] = math_max(maxAll[chn], filteredAll); + } + } + + float total{}; + float lo{}; + float hi{}; + + if (maxAll[0] != 0.f && maxAll[1] != 0.f) { + // Calculate sum, to normalize + // Also multiply on 1.2 to prevent very dark or light color + total = (maxLow[0] + maxLow[1] + maxMid[0] + maxMid[1] + + maxHigh[0] + maxHigh[1]) * + 1.2f; + + // prevent division by zero + if (total != 0.f) { + // 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; + } + } + + // Set color + QColor color; + color.setHsvF(h, 1.0f - hi, 1.0f - lo); + + // lines are thin rectangles + // maxAll[0] is for left channel, maxAll[1] is for right channel + m_vertices.addRectangle(fpos - 0.5f, + halfBreadth - heightFactor * maxAll[0], + fpos + 0.5f, + halfBreadth + heightFactor * maxAll[1]); + m_colors.addForRectangle( + static_cast(color.redF()), + static_cast(color.greenF()), + static_cast(color.blueF())); + + xVisualSampleIndex += visualIncrementPerPixel; + } + + DEBUG_ASSERT(reserved == m_vertices.size()); + DEBUG_ASSERT(reserved == m_colors.size()); + + const QMatrix4x4 matrix = matrixForWidgetGeometry(m_waveformRenderer, true); + + const int matrixLocation = m_shader.uniformLocation("matrix"); + const int positionLocation = m_shader.attributeLocation("position"); + const int colorLocation = m_shader.attributeLocation("color"); + + m_shader.bind(); + m_shader.enableAttributeArray(positionLocation); + m_shader.enableAttributeArray(colorLocation); + + m_shader.setUniformValue(matrixLocation, matrix); + + m_shader.setAttributeArray( + positionLocation, GL_FLOAT, m_vertices.constData(), 2); + m_shader.setAttributeArray( + colorLocation, GL_FLOAT, m_colors.constData(), 3); + + glDrawArrays(GL_TRIANGLES, 0, m_vertices.size()); + + m_shader.disableAttributeArray(positionLocation); + m_shader.disableAttributeArray(colorLocation); + m_shader.release(); +} diff --git a/src/waveform/renderers/allshader/waveformrendererhsv.h b/src/waveform/renderers/allshader/waveformrendererhsv.h new file mode 100644 index 00000000000..0fa0b6bf863 --- /dev/null +++ b/src/waveform/renderers/allshader/waveformrendererhsv.h @@ -0,0 +1,29 @@ +#pragma once + +#include "shaders/rgbshader.h" +#include "util/class.h" +#include "waveform/renderers/allshader/rgbdata.h" +#include "waveform/renderers/allshader/vertexdata.h" +#include "waveform/renderers/allshader/waveformrenderersignalbase.h" + +namespace allshader { +class WaveformRendererHSV; +} + +class allshader::WaveformRendererHSV final : public allshader::WaveformRendererSignalBase { + public: + explicit WaveformRendererHSV(WaveformWidgetRenderer* waveformWidget); + + // override ::WaveformRendererSignalBase + void onSetup(const QDomNode& node) override; + + void initializeGL() override; + void paintGL() override; + + private: + mixxx::RGBShader m_shader; + VertexData m_vertices; + RGBData m_colors; + + DISALLOW_COPY_AND_ASSIGN(WaveformRendererHSV); +}; diff --git a/src/waveform/renderers/allshader/waveformrendererlrrgb.cpp b/src/waveform/renderers/allshader/waveformrendererlrrgb.cpp index ed996342354..ecebbaacddb 100644 --- a/src/waveform/renderers/allshader/waveformrendererlrrgb.cpp +++ b/src/waveform/renderers/allshader/waveformrendererlrrgb.cpp @@ -22,9 +22,6 @@ WaveformRendererLRRGB::WaveformRendererLRRGB( : WaveformRendererSignalBase(waveformWidget) { } -WaveformRendererLRRGB::~WaveformRendererLRRGB() { -} - void WaveformRendererLRRGB::onSetup(const QDomNode& node) { Q_UNUSED(node); } diff --git a/src/waveform/renderers/allshader/waveformrendererlrrgb.h b/src/waveform/renderers/allshader/waveformrendererlrrgb.h index 4a98a30ef3c..e1d55071739 100644 --- a/src/waveform/renderers/allshader/waveformrendererlrrgb.h +++ b/src/waveform/renderers/allshader/waveformrendererlrrgb.h @@ -13,7 +13,6 @@ class WaveformRendererLRRGB; class allshader::WaveformRendererLRRGB final : public allshader::WaveformRendererSignalBase { public: explicit WaveformRendererLRRGB(WaveformWidgetRenderer* waveformWidget); - ~WaveformRendererLRRGB() override; // override ::WaveformRendererSignalBase void onSetup(const QDomNode& node) override; diff --git a/src/waveform/renderers/allshader/waveformrendererpreroll.cpp b/src/waveform/renderers/allshader/waveformrendererpreroll.cpp index 81947692e24..1b4c0ebad02 100644 --- a/src/waveform/renderers/allshader/waveformrendererpreroll.cpp +++ b/src/waveform/renderers/allshader/waveformrendererpreroll.cpp @@ -15,9 +15,6 @@ WaveformRendererPreroll::WaveformRendererPreroll(WaveformWidgetRenderer* wavefor : WaveformRenderer(waveformWidget) { } -WaveformRendererPreroll::~WaveformRendererPreroll() { -} - void WaveformRendererPreroll::setup( const QDomNode& node, const SkinContext& context) { m_color.setNamedColor(context.selectString(node, "SignalColor")); diff --git a/src/waveform/renderers/allshader/waveformrendererpreroll.h b/src/waveform/renderers/allshader/waveformrendererpreroll.h index 488a66047b5..b374b424791 100644 --- a/src/waveform/renderers/allshader/waveformrendererpreroll.h +++ b/src/waveform/renderers/allshader/waveformrendererpreroll.h @@ -17,7 +17,6 @@ class WaveformRendererPreroll; class allshader::WaveformRendererPreroll final : public allshader::WaveformRenderer { public: explicit WaveformRendererPreroll(WaveformWidgetRenderer* waveformWidgetRenderer); - ~WaveformRendererPreroll() override; void setup(const QDomNode& node, const SkinContext& context) override; void paintGL() override; diff --git a/src/waveform/renderers/allshader/waveformrendererrgb.cpp b/src/waveform/renderers/allshader/waveformrendererrgb.cpp index 6e0da40d550..7d67adbbba7 100644 --- a/src/waveform/renderers/allshader/waveformrendererrgb.cpp +++ b/src/waveform/renderers/allshader/waveformrendererrgb.cpp @@ -22,9 +22,6 @@ WaveformRendererRGB::WaveformRendererRGB( : WaveformRendererSignalBase(waveformWidget) { } -WaveformRendererRGB::~WaveformRendererRGB() { -} - void WaveformRendererRGB::onSetup(const QDomNode& node) { Q_UNUSED(node); } diff --git a/src/waveform/renderers/allshader/waveformrendererrgb.h b/src/waveform/renderers/allshader/waveformrendererrgb.h index b556507207c..49178842d33 100644 --- a/src/waveform/renderers/allshader/waveformrendererrgb.h +++ b/src/waveform/renderers/allshader/waveformrendererrgb.h @@ -13,7 +13,6 @@ class WaveformRendererRGB; class allshader::WaveformRendererRGB final : public allshader::WaveformRendererSignalBase { public: explicit WaveformRendererRGB(WaveformWidgetRenderer* waveformWidget); - ~WaveformRendererRGB() override; // override ::WaveformRendererSignalBase void onSetup(const QDomNode& node) override; diff --git a/src/waveform/renderers/allshader/waveformrenderersignalbase.h b/src/waveform/renderers/allshader/waveformrenderersignalbase.h index e38e8416c7d..b8fad2a5c6b 100644 --- a/src/waveform/renderers/allshader/waveformrenderersignalbase.h +++ b/src/waveform/renderers/allshader/waveformrenderersignalbase.h @@ -14,7 +14,6 @@ class allshader::WaveformRendererSignalBase : public ::WaveformRendererSignalBas public allshader::WaveformRendererAbstract { public: explicit WaveformRendererSignalBase(WaveformWidgetRenderer* waveformWidget); - ~WaveformRendererSignalBase() override = default; void draw(QPainter* painter, QPaintEvent* event) override { } diff --git a/src/waveform/renderers/allshader/waveformrenderersimple.cpp b/src/waveform/renderers/allshader/waveformrenderersimple.cpp index 83502732ab2..0fde0374a5f 100644 --- a/src/waveform/renderers/allshader/waveformrenderersimple.cpp +++ b/src/waveform/renderers/allshader/waveformrenderersimple.cpp @@ -16,9 +16,6 @@ WaveformRendererSimple::WaveformRendererSimple( : WaveformRendererSignalBase(waveformWidget) { } -WaveformRendererSimple::~WaveformRendererSimple() { -} - void WaveformRendererSimple::onSetup(const QDomNode& node) { Q_UNUSED(node); } diff --git a/src/waveform/renderers/allshader/waveformrenderersimple.h b/src/waveform/renderers/allshader/waveformrenderersimple.h index 7a0c7f4fa6e..a1e92c8d2f0 100644 --- a/src/waveform/renderers/allshader/waveformrenderersimple.h +++ b/src/waveform/renderers/allshader/waveformrenderersimple.h @@ -12,7 +12,6 @@ class WaveformRendererSimple; class allshader::WaveformRendererSimple final : public allshader::WaveformRendererSignalBase { public: explicit WaveformRendererSimple(WaveformWidgetRenderer* waveformWidget); - ~WaveformRendererSimple() override; // override ::WaveformRendererSignalBase void onSetup(const QDomNode& node) override; diff --git a/src/waveform/renderers/allshader/waveformrendermarkrange.cpp b/src/waveform/renderers/allshader/waveformrendermarkrange.cpp index ad5c35ce0d7..1deb113c34a 100644 --- a/src/waveform/renderers/allshader/waveformrendermarkrange.cpp +++ b/src/waveform/renderers/allshader/waveformrendermarkrange.cpp @@ -16,9 +16,6 @@ allshader::WaveformRenderMarkRange::WaveformRenderMarkRange(WaveformWidgetRender : WaveformRenderer(waveformWidget) { } -allshader::WaveformRenderMarkRange::~WaveformRenderMarkRange() { -} - void allshader::WaveformRenderMarkRange::initializeGL() { WaveformRenderer::initializeGL(); m_shader.init(); diff --git a/src/waveform/renderers/allshader/waveformrendermarkrange.h b/src/waveform/renderers/allshader/waveformrendermarkrange.h index 2cebc686232..0c46a8dd5b8 100644 --- a/src/waveform/renderers/allshader/waveformrendermarkrange.h +++ b/src/waveform/renderers/allshader/waveformrendermarkrange.h @@ -18,7 +18,6 @@ class WaveformRenderMarkRange; class allshader::WaveformRenderMarkRange final : public allshader::WaveformRenderer { public: explicit WaveformRenderMarkRange(WaveformWidgetRenderer* waveformWidget); - ~WaveformRenderMarkRange() override; void setup(const QDomNode& node, const SkinContext& context) override; diff --git a/src/waveform/waveformwidgetfactory.cpp b/src/waveform/waveformwidgetfactory.cpp index 4837354ee95..a2822b821fe 100644 --- a/src/waveform/waveformwidgetfactory.cpp +++ b/src/waveform/waveformwidgetfactory.cpp @@ -29,6 +29,7 @@ #include "waveform/vsyncthread.h" #ifdef MIXXX_USE_QOPENGL #include "waveform/widgets/allshader/filteredwaveformwidget.h" +#include "waveform/widgets/allshader/hsvwaveformwidget.h" #include "waveform/widgets/allshader/lrrgbwaveformwidget.h" #include "waveform/widgets/allshader/rgbwaveformwidget.h" #include "waveform/widgets/allshader/simplewaveformwidget.h" @@ -110,7 +111,7 @@ WaveformWidgetFactory::WaveformWidgetFactory() m_configType(WaveformWidgetType::EmptyWaveform), m_config(nullptr), m_skipRender(false), - m_frameRate(30), + m_frameRate(60), m_endOfTrackWarningTime(30), m_defaultZoom(WaveformWidgetRenderer::s_waveformDefaultZoom), m_zoomSync(true), @@ -819,7 +820,11 @@ void WaveformWidgetFactory::swap() { WaveformWidgetType::Type WaveformWidgetFactory::autoChooseWidgetType() const { if (m_openGlAvailable) { if (m_openGLShaderAvailable) { +#ifndef MIXXX_USE_QOPENGL return WaveformWidgetType::GLSLRGBWaveform; +#else + return WaveformWidgetType::AllShaderRGBWaveform; +#endif } else { return WaveformWidgetType::GLRGBWaveform; } @@ -834,7 +839,7 @@ void WaveformWidgetFactory::evaluateWidgets() { bool useOpenGl; bool useOpenGles; bool useOpenGLShaders; - bool developerOnly; + WaveformWidgetCategory category; switch(type) { case WaveformWidgetType::EmptyWaveform: @@ -842,7 +847,7 @@ void WaveformWidgetFactory::evaluateWidgets() { useOpenGl = EmptyWaveformWidget::useOpenGl(); useOpenGles = EmptyWaveformWidget::useOpenGles(); useOpenGLShaders = EmptyWaveformWidget::useOpenGLShaders(); - developerOnly = EmptyWaveformWidget::developerOnly(); + category = EmptyWaveformWidget::category(); break; case WaveformWidgetType::SoftwareSimpleWaveform: continue; // //TODO(vrince): @@ -858,7 +863,7 @@ void WaveformWidgetFactory::evaluateWidgets() { useOpenGl = SoftwareWaveformWidget::useOpenGl(); useOpenGles = SoftwareWaveformWidget::useOpenGles(); useOpenGLShaders = SoftwareWaveformWidget::useOpenGLShaders(); - developerOnly = SoftwareWaveformWidget::developerOnly(); + category = SoftwareWaveformWidget::category(); break; #endif case WaveformWidgetType::HSVWaveform: @@ -869,7 +874,7 @@ void WaveformWidgetFactory::evaluateWidgets() { useOpenGl = HSVWaveformWidget::useOpenGl(); useOpenGles = HSVWaveformWidget::useOpenGles(); useOpenGLShaders = HSVWaveformWidget::useOpenGLShaders(); - developerOnly = HSVWaveformWidget::developerOnly(); + category = HSVWaveformWidget::category(); break; #endif case WaveformWidgetType::RGBWaveform: @@ -880,7 +885,7 @@ void WaveformWidgetFactory::evaluateWidgets() { useOpenGl = RGBWaveformWidget::useOpenGl(); useOpenGles = RGBWaveformWidget::useOpenGles(); useOpenGLShaders = RGBWaveformWidget::useOpenGLShaders(); - developerOnly = RGBWaveformWidget::developerOnly(); + category = RGBWaveformWidget::category(); break; #endif case WaveformWidgetType::QtSimpleWaveform: @@ -891,7 +896,7 @@ void WaveformWidgetFactory::evaluateWidgets() { useOpenGl = QtSimpleWaveformWidget::useOpenGl(); useOpenGles = QtSimpleWaveformWidget::useOpenGles(); useOpenGLShaders = QtSimpleWaveformWidget::useOpenGLShaders(); - developerOnly = QtSimpleWaveformWidget::developerOnly(); + category = QtSimpleWaveformWidget::category(); break; #endif case WaveformWidgetType::QtWaveform: @@ -902,7 +907,7 @@ void WaveformWidgetFactory::evaluateWidgets() { useOpenGl = QtWaveformWidget::useOpenGl(); useOpenGles = QtWaveformWidget::useOpenGles(); useOpenGLShaders = QtWaveformWidget::useOpenGLShaders(); - developerOnly = QtWaveformWidget::developerOnly(); + category = QtWaveformWidget::category(); break; #endif case WaveformWidgetType::GLSimpleWaveform: @@ -910,49 +915,49 @@ void WaveformWidgetFactory::evaluateWidgets() { useOpenGl = GLSimpleWaveformWidget::useOpenGl(); useOpenGles = GLSimpleWaveformWidget::useOpenGles(); useOpenGLShaders = GLSimpleWaveformWidget::useOpenGLShaders(); - developerOnly = GLSimpleWaveformWidget::developerOnly(); + category = GLSimpleWaveformWidget::category(); break; case WaveformWidgetType::GLFilteredWaveform: widgetName = GLWaveformWidget::getWaveformWidgetName(); useOpenGl = GLWaveformWidget::useOpenGl(); useOpenGles = GLWaveformWidget::useOpenGles(); useOpenGLShaders = GLWaveformWidget::useOpenGLShaders(); - developerOnly = GLWaveformWidget::developerOnly(); + category = GLWaveformWidget::category(); break; case WaveformWidgetType::GLSLFilteredWaveform: widgetName = GLSLFilteredWaveformWidget::getWaveformWidgetName(); useOpenGl = GLSLFilteredWaveformWidget::useOpenGl(); useOpenGles = GLSLFilteredWaveformWidget::useOpenGles(); useOpenGLShaders = GLSLFilteredWaveformWidget::useOpenGLShaders(); - developerOnly = GLSLFilteredWaveformWidget::developerOnly(); + category = GLSLFilteredWaveformWidget::category(); break; case WaveformWidgetType::GLSLRGBWaveform: widgetName = GLSLRGBWaveformWidget::getWaveformWidgetName(); useOpenGl = GLSLRGBWaveformWidget::useOpenGl(); useOpenGles = GLSLRGBWaveformWidget::useOpenGles(); useOpenGLShaders = GLSLRGBWaveformWidget::useOpenGLShaders(); - developerOnly = GLSLRGBWaveformWidget::developerOnly(); + category = GLSLRGBWaveformWidget::category(); break; case WaveformWidgetType::GLSLRGBStackedWaveform: widgetName = GLSLRGBStackedWaveformWidget::getWaveformWidgetName(); useOpenGl = GLSLRGBStackedWaveformWidget::useOpenGl(); useOpenGles = GLSLRGBStackedWaveformWidget::useOpenGles(); useOpenGLShaders = GLSLRGBStackedWaveformWidget::useOpenGLShaders(); - developerOnly = GLSLRGBStackedWaveformWidget::developerOnly(); + category = GLSLRGBStackedWaveformWidget::category(); break; case WaveformWidgetType::GLVSyncTest: widgetName = GLVSyncTestWidget::getWaveformWidgetName(); useOpenGl = GLVSyncTestWidget::useOpenGl(); useOpenGles = GLVSyncTestWidget::useOpenGles(); useOpenGLShaders = GLVSyncTestWidget::useOpenGLShaders(); - developerOnly = GLVSyncTestWidget::developerOnly(); + category = GLVSyncTestWidget::category(); break; case WaveformWidgetType::GLRGBWaveform: widgetName = GLRGBWaveformWidget::getWaveformWidgetName(); useOpenGl = GLRGBWaveformWidget::useOpenGl(); useOpenGles = GLRGBWaveformWidget::useOpenGles(); useOpenGLShaders = GLRGBWaveformWidget::useOpenGLShaders(); - developerOnly = GLRGBWaveformWidget::developerOnly(); + category = GLRGBWaveformWidget::category(); break; case WaveformWidgetType::QtVSyncTest: #ifdef MIXXX_USE_QOPENGL @@ -962,7 +967,7 @@ void WaveformWidgetFactory::evaluateWidgets() { useOpenGl = QtVSyncTestWidget::useOpenGl(); useOpenGles = QtVSyncTestWidget::useOpenGles(); useOpenGLShaders = QtVSyncTestWidget::useOpenGLShaders(); - developerOnly = QtVSyncTestWidget::developerOnly(); + category = QtVSyncTestWidget::category(); #endif break; case WaveformWidgetType::QtHSVWaveform: @@ -973,7 +978,7 @@ void WaveformWidgetFactory::evaluateWidgets() { useOpenGl = QtHSVWaveformWidget::useOpenGl(); useOpenGles = QtHSVWaveformWidget::useOpenGles(); useOpenGLShaders = QtHSVWaveformWidget::useOpenGLShaders(); - developerOnly = QtHSVWaveformWidget::developerOnly(); + category = QtHSVWaveformWidget::category(); break; #endif case WaveformWidgetType::QtRGBWaveform: @@ -984,7 +989,7 @@ void WaveformWidgetFactory::evaluateWidgets() { useOpenGl = QtRGBWaveformWidget::useOpenGl(); useOpenGles = QtRGBWaveformWidget::useOpenGles(); useOpenGLShaders = QtRGBWaveformWidget::useOpenGLShaders(); - developerOnly = QtRGBWaveformWidget::developerOnly(); + category = QtRGBWaveformWidget::category(); break; #endif case WaveformWidgetType::AllShaderRGBWaveform: @@ -995,7 +1000,7 @@ void WaveformWidgetFactory::evaluateWidgets() { useOpenGl = allshader::RGBWaveformWidget::useOpenGl(); useOpenGles = allshader::RGBWaveformWidget::useOpenGles(); useOpenGLShaders = allshader::RGBWaveformWidget::useOpenGLShaders(); - developerOnly = allshader::RGBWaveformWidget::developerOnly(); + category = allshader::RGBWaveformWidget::category(); break; #endif case WaveformWidgetType::AllShaderLRRGBWaveform: @@ -1006,7 +1011,7 @@ void WaveformWidgetFactory::evaluateWidgets() { useOpenGl = allshader::LRRGBWaveformWidget::useOpenGl(); useOpenGles = allshader::LRRGBWaveformWidget::useOpenGles(); useOpenGLShaders = allshader::LRRGBWaveformWidget::useOpenGLShaders(); - developerOnly = allshader::LRRGBWaveformWidget::developerOnly(); + category = allshader::LRRGBWaveformWidget::category(); break; #endif case WaveformWidgetType::AllShaderFilteredWaveform: @@ -1017,7 +1022,7 @@ void WaveformWidgetFactory::evaluateWidgets() { useOpenGl = allshader::FilteredWaveformWidget::useOpenGl(); useOpenGles = allshader::FilteredWaveformWidget::useOpenGles(); useOpenGLShaders = allshader::FilteredWaveformWidget::useOpenGLShaders(); - developerOnly = allshader::FilteredWaveformWidget::developerOnly(); + category = allshader::FilteredWaveformWidget::category(); break; #endif case WaveformWidgetType::AllShaderSimpleWaveform: @@ -1028,7 +1033,18 @@ void WaveformWidgetFactory::evaluateWidgets() { useOpenGl = allshader::SimpleWaveformWidget::useOpenGl(); useOpenGles = allshader::SimpleWaveformWidget::useOpenGles(); useOpenGLShaders = allshader::SimpleWaveformWidget::useOpenGLShaders(); - developerOnly = allshader::SimpleWaveformWidget::developerOnly(); + category = allshader::SimpleWaveformWidget::category(); + break; +#endif + case WaveformWidgetType::AllShaderHSVWaveform: +#ifndef MIXXX_USE_QOPENGL + continue; +#else + widgetName = allshader::HSVWaveformWidget::getWaveformWidgetName(); + useOpenGl = allshader::HSVWaveformWidget::useOpenGl(); + useOpenGles = allshader::HSVWaveformWidget::useOpenGles(); + useOpenGLShaders = allshader::HSVWaveformWidget::useOpenGLShaders(); + category = allshader::HSVWaveformWidget::category(); break; #endif default: @@ -1036,6 +1052,10 @@ void WaveformWidgetFactory::evaluateWidgets() { continue; } + if (category == WaveformWidgetCategory::Legacy) { + widgetName += QStringLiteral(" (%1)").arg(QObject::tr("legacy")); + } + bool active = true; if (isOpenGlAvailable()) { if (useOpenGles && !useOpenGl) { @@ -1068,7 +1088,8 @@ void WaveformWidgetFactory::evaluateWidgets() { } } - if (developerOnly && !CmdlineArgs::Instance().getDeveloper()) { + if (category == WaveformWidgetCategory::DeveloperOnly && + !CmdlineArgs::Instance().getDeveloper()) { active = false; } @@ -1135,6 +1156,9 @@ WaveformWidgetAbstract* WaveformWidgetFactory::createWaveformWidget( case WaveformWidgetType::AllShaderSimpleWaveform: widget = new allshader::SimpleWaveformWidget(viewer->getGroup(), viewer); break; + case WaveformWidgetType::AllShaderHSVWaveform: + widget = new allshader::HSVWaveformWidget(viewer->getGroup(), viewer); + break; #else case WaveformWidgetType::QtSimpleWaveform: widget = new QtSimpleWaveformWidget(viewer->getGroup(), viewer); diff --git a/src/waveform/widgets/allshader/filteredwaveformwidget.cpp b/src/waveform/widgets/allshader/filteredwaveformwidget.cpp index b47c9d107ed..0ff4a733703 100644 --- a/src/waveform/widgets/allshader/filteredwaveformwidget.cpp +++ b/src/waveform/widgets/allshader/filteredwaveformwidget.cpp @@ -24,9 +24,6 @@ FilteredWaveformWidget::FilteredWaveformWidget(const QString& group, QWidget* pa m_initSuccess = init(); } -FilteredWaveformWidget::~FilteredWaveformWidget() { -} - void FilteredWaveformWidget::castToQWidget() { m_widget = this; } diff --git a/src/waveform/widgets/allshader/filteredwaveformwidget.h b/src/waveform/widgets/allshader/filteredwaveformwidget.h index 43c8ea09b4d..f18bd1c657a 100644 --- a/src/waveform/widgets/allshader/filteredwaveformwidget.h +++ b/src/waveform/widgets/allshader/filteredwaveformwidget.h @@ -12,14 +12,12 @@ class FilteredWaveformWidget; class allshader::FilteredWaveformWidget final : public allshader::WaveformWidget { Q_OBJECT public: - ~FilteredWaveformWidget() override; - WaveformWidgetType::Type getType() const override { return WaveformWidgetType::AllShaderFilteredWaveform; } static inline QString getWaveformWidgetName() { - return tr("Filtered (all-shaders)"); + return tr("Filtered"); } static constexpr bool useOpenGl() { return true; @@ -30,8 +28,8 @@ class allshader::FilteredWaveformWidget final : public allshader::WaveformWidget static constexpr bool useOpenGLShaders() { return true; } - static constexpr bool developerOnly() { - return false; + static constexpr WaveformWidgetCategory category() { + return WaveformWidgetCategory::AllShader; } protected: diff --git a/src/waveform/widgets/allshader/hsvwaveformwidget.cpp b/src/waveform/widgets/allshader/hsvwaveformwidget.cpp new file mode 100644 index 00000000000..bc8b8099be9 --- /dev/null +++ b/src/waveform/widgets/allshader/hsvwaveformwidget.cpp @@ -0,0 +1,33 @@ +#include "waveform/widgets/allshader/hsvwaveformwidget.h" + +#include "waveform/renderers/allshader/waveformrenderbackground.h" +#include "waveform/renderers/allshader/waveformrenderbeat.h" +#include "waveform/renderers/allshader/waveformrendererendoftrack.h" +#include "waveform/renderers/allshader/waveformrendererhsv.h" +#include "waveform/renderers/allshader/waveformrendererpreroll.h" +#include "waveform/renderers/allshader/waveformrendermark.h" +#include "waveform/renderers/allshader/waveformrendermarkrange.h" +#include "waveform/widgets/allshader/moc_hsvwaveformwidget.cpp" + +using namespace allshader; + +HSVWaveformWidget::HSVWaveformWidget(const QString& group, QWidget* parent) + : WaveformWidget(group, parent) { + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(); + addRenderer(); + + m_initSuccess = init(); +} + +void HSVWaveformWidget::castToQWidget() { + m_widget = this; +} + +void HSVWaveformWidget::paintEvent(QPaintEvent* event) { + Q_UNUSED(event); +} diff --git a/src/waveform/widgets/allshader/hsvwaveformwidget.h b/src/waveform/widgets/allshader/hsvwaveformwidget.h new file mode 100644 index 00000000000..e6a3f5214fb --- /dev/null +++ b/src/waveform/widgets/allshader/hsvwaveformwidget.h @@ -0,0 +1,44 @@ +#pragma once + +#include "util/class.h" +#include "waveform/widgets/allshader/waveformwidget.h" + +class WaveformWidgetFactory; + +namespace allshader { +class HSVWaveformWidget; +} + +class allshader::HSVWaveformWidget final : public allshader::WaveformWidget { + Q_OBJECT + public: + WaveformWidgetType::Type getType() const override { + return WaveformWidgetType::AllShaderHSVWaveform; + } + + static inline QString getWaveformWidgetName() { + return tr("HSV"); + } + static constexpr bool useOpenGl() { + return true; + } + static constexpr bool useOpenGles() { + return false; + } + static constexpr bool useOpenGLShaders() { + return true; + } + static constexpr WaveformWidgetCategory category() { + return WaveformWidgetCategory::AllShader; + } + + protected: + void castToQWidget() override; + void paintEvent(QPaintEvent* event) override; + + private: + HSVWaveformWidget(const QString& group, QWidget* parent); + friend class ::WaveformWidgetFactory; + + DISALLOW_COPY_AND_ASSIGN(HSVWaveformWidget); +}; diff --git a/src/waveform/widgets/allshader/lrrgbwaveformwidget.cpp b/src/waveform/widgets/allshader/lrrgbwaveformwidget.cpp index cd536263cde..4f7c3ed9b41 100644 --- a/src/waveform/widgets/allshader/lrrgbwaveformwidget.cpp +++ b/src/waveform/widgets/allshader/lrrgbwaveformwidget.cpp @@ -24,9 +24,6 @@ LRRGBWaveformWidget::LRRGBWaveformWidget(const QString& group, QWidget* parent) m_initSuccess = init(); } -LRRGBWaveformWidget::~LRRGBWaveformWidget() { -} - void LRRGBWaveformWidget::castToQWidget() { m_widget = this; } diff --git a/src/waveform/widgets/allshader/lrrgbwaveformwidget.h b/src/waveform/widgets/allshader/lrrgbwaveformwidget.h index 67e30f9f734..b5960e6e9b7 100644 --- a/src/waveform/widgets/allshader/lrrgbwaveformwidget.h +++ b/src/waveform/widgets/allshader/lrrgbwaveformwidget.h @@ -12,14 +12,12 @@ class LRRGBWaveformWidget; class allshader::LRRGBWaveformWidget final : public allshader::WaveformWidget { Q_OBJECT public: - ~LRRGBWaveformWidget() override; - WaveformWidgetType::Type getType() const override { return WaveformWidgetType::AllShaderLRRGBWaveform; } static inline QString getWaveformWidgetName() { - return tr("RGB L/R (all-shaders)"); + return tr("RGB L/R"); } static constexpr bool useOpenGl() { return true; @@ -30,8 +28,8 @@ class allshader::LRRGBWaveformWidget final : public allshader::WaveformWidget { static constexpr bool useOpenGLShaders() { return true; } - static constexpr bool developerOnly() { - return false; + static constexpr WaveformWidgetCategory category() { + return WaveformWidgetCategory::AllShader; } protected: diff --git a/src/waveform/widgets/allshader/rgbwaveformwidget.cpp b/src/waveform/widgets/allshader/rgbwaveformwidget.cpp index b1a1f90cb66..952929ef375 100644 --- a/src/waveform/widgets/allshader/rgbwaveformwidget.cpp +++ b/src/waveform/widgets/allshader/rgbwaveformwidget.cpp @@ -24,9 +24,6 @@ RGBWaveformWidget::RGBWaveformWidget(const QString& group, QWidget* parent) m_initSuccess = init(); } -RGBWaveformWidget::~RGBWaveformWidget() { -} - void RGBWaveformWidget::castToQWidget() { m_widget = this; } diff --git a/src/waveform/widgets/allshader/rgbwaveformwidget.h b/src/waveform/widgets/allshader/rgbwaveformwidget.h index 105d903025b..10c946e2bc2 100644 --- a/src/waveform/widgets/allshader/rgbwaveformwidget.h +++ b/src/waveform/widgets/allshader/rgbwaveformwidget.h @@ -12,14 +12,12 @@ class RGBWaveformWidget; class allshader::RGBWaveformWidget final : public allshader::WaveformWidget { Q_OBJECT public: - ~RGBWaveformWidget() override; - WaveformWidgetType::Type getType() const override { return WaveformWidgetType::AllShaderRGBWaveform; } static inline QString getWaveformWidgetName() { - return tr("RGB (all-shaders)"); + return tr("RGB"); } static constexpr bool useOpenGl() { return true; @@ -30,8 +28,8 @@ class allshader::RGBWaveformWidget final : public allshader::WaveformWidget { static constexpr bool useOpenGLShaders() { return true; } - static constexpr bool developerOnly() { - return false; + static constexpr WaveformWidgetCategory category() { + return WaveformWidgetCategory::AllShader; } protected: diff --git a/src/waveform/widgets/allshader/simplewaveformwidget.cpp b/src/waveform/widgets/allshader/simplewaveformwidget.cpp index 8650cdf032e..87528af16ce 100644 --- a/src/waveform/widgets/allshader/simplewaveformwidget.cpp +++ b/src/waveform/widgets/allshader/simplewaveformwidget.cpp @@ -24,9 +24,6 @@ SimpleWaveformWidget::SimpleWaveformWidget(const QString& group, QWidget* parent m_initSuccess = init(); } -SimpleWaveformWidget::~SimpleWaveformWidget() { -} - void SimpleWaveformWidget::castToQWidget() { m_widget = this; } diff --git a/src/waveform/widgets/allshader/simplewaveformwidget.h b/src/waveform/widgets/allshader/simplewaveformwidget.h index 7ea03c943c2..cbfa64690ff 100644 --- a/src/waveform/widgets/allshader/simplewaveformwidget.h +++ b/src/waveform/widgets/allshader/simplewaveformwidget.h @@ -12,14 +12,12 @@ class SimpleWaveformWidget; class allshader::SimpleWaveformWidget final : public allshader::WaveformWidget { Q_OBJECT public: - ~SimpleWaveformWidget() override; - WaveformWidgetType::Type getType() const override { return WaveformWidgetType::AllShaderSimpleWaveform; } static inline QString getWaveformWidgetName() { - return tr("Simple (all-shaders)"); + return tr("Simple"); } static constexpr bool useOpenGl() { return true; @@ -30,8 +28,8 @@ class allshader::SimpleWaveformWidget final : public allshader::WaveformWidget { static constexpr bool useOpenGLShaders() { return true; } - static constexpr bool developerOnly() { - return false; + static constexpr WaveformWidgetCategory category() { + return WaveformWidgetCategory::AllShader; } protected: diff --git a/src/waveform/widgets/emptywaveformwidget.h b/src/waveform/widgets/emptywaveformwidget.h index 29b4dd712c7..3c2bb45ccc0 100644 --- a/src/waveform/widgets/emptywaveformwidget.h +++ b/src/waveform/widgets/emptywaveformwidget.h @@ -18,7 +18,9 @@ class EmptyWaveformWidget : public NonGLWaveformWidgetAbstract { static inline bool useOpenGl() { return false; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } - static inline bool developerOnly() { return false; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::Default; + } protected: virtual void castToQWidget(); diff --git a/src/waveform/widgets/glrgbwaveformwidget.h b/src/waveform/widgets/glrgbwaveformwidget.h index ed6ec0371c0..45940e3b189 100644 --- a/src/waveform/widgets/glrgbwaveformwidget.h +++ b/src/waveform/widgets/glrgbwaveformwidget.h @@ -14,7 +14,9 @@ class GLRGBWaveformWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } - static inline bool developerOnly() { return false; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::Legacy; + } protected: virtual void castToQWidget(); diff --git a/src/waveform/widgets/glsimplewaveformwidget.h b/src/waveform/widgets/glsimplewaveformwidget.h index d3f75949a5d..0b5ab77200a 100644 --- a/src/waveform/widgets/glsimplewaveformwidget.h +++ b/src/waveform/widgets/glsimplewaveformwidget.h @@ -14,7 +14,9 @@ class GLSimpleWaveformWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } - static inline bool developerOnly() { return false; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::Legacy; + } protected: virtual void castToQWidget(); diff --git a/src/waveform/widgets/glslwaveformwidget.h b/src/waveform/widgets/glslwaveformwidget.h index 12b8ea3630e..a0a77a1da18 100644 --- a/src/waveform/widgets/glslwaveformwidget.h +++ b/src/waveform/widgets/glslwaveformwidget.h @@ -44,7 +44,9 @@ class GLSLFilteredWaveformWidget : public GLSLWaveformWidget { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return true; } - static inline bool developerOnly() { return false; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::Legacy; + } }; class GLSLRGBWaveformWidget : public GLSLWaveformWidget { @@ -59,7 +61,9 @@ class GLSLRGBWaveformWidget : public GLSLWaveformWidget { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return true; } - static inline bool developerOnly() { return false; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::Legacy; + } }; class GLSLRGBStackedWaveformWidget : public GLSLWaveformWidget { @@ -84,7 +88,7 @@ class GLSLRGBStackedWaveformWidget : public GLSLWaveformWidget { static inline bool useOpenGLShaders() { return true; } - static inline bool developerOnly() { - return false; + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::Legacy; } }; diff --git a/src/waveform/widgets/glvsynctestwidget.h b/src/waveform/widgets/glvsynctestwidget.h index 13b1749d1ee..7a6b322cdff 100644 --- a/src/waveform/widgets/glvsynctestwidget.h +++ b/src/waveform/widgets/glvsynctestwidget.h @@ -14,7 +14,9 @@ class GLVSyncTestWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } - static inline bool developerOnly() { return true; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::DeveloperOnly; + } protected: virtual void castToQWidget(); diff --git a/src/waveform/widgets/glwaveformwidget.h b/src/waveform/widgets/glwaveformwidget.h index 5f6d6673f8d..f2548817f0d 100644 --- a/src/waveform/widgets/glwaveformwidget.h +++ b/src/waveform/widgets/glwaveformwidget.h @@ -14,7 +14,9 @@ class GLWaveformWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } - static inline bool developerOnly() { return false; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::Legacy; + } protected: virtual void castToQWidget(); diff --git a/src/waveform/widgets/hsvwaveformwidget.h b/src/waveform/widgets/hsvwaveformwidget.h index 9e9adae50db..e94cee89c99 100644 --- a/src/waveform/widgets/hsvwaveformwidget.h +++ b/src/waveform/widgets/hsvwaveformwidget.h @@ -15,7 +15,9 @@ class HSVWaveformWidget : public NonGLWaveformWidgetAbstract { static inline bool useOpenGl() { return false; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } - static inline bool developerOnly() { return false; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::Legacy; + } protected: virtual void castToQWidget(); diff --git a/src/waveform/widgets/qthsvwaveformwidget.h b/src/waveform/widgets/qthsvwaveformwidget.h index 1e0c7f0a65e..181509b6d0e 100644 --- a/src/waveform/widgets/qthsvwaveformwidget.h +++ b/src/waveform/widgets/qthsvwaveformwidget.h @@ -13,7 +13,9 @@ class QtHSVWaveformWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return true; } static inline bool useOpenGLShaders() { return false; } - static inline bool developerOnly() { return false; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::Legacy; + } protected: virtual void castToQWidget(); diff --git a/src/waveform/widgets/qtrgbwaveformwidget.h b/src/waveform/widgets/qtrgbwaveformwidget.h index da2d7a2ac2e..28c963fa974 100644 --- a/src/waveform/widgets/qtrgbwaveformwidget.h +++ b/src/waveform/widgets/qtrgbwaveformwidget.h @@ -13,7 +13,9 @@ class QtRGBWaveformWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return true; } static inline bool useOpenGLShaders() { return false; } - static inline bool developerOnly() { return false; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::Legacy; + } protected: virtual void castToQWidget(); diff --git a/src/waveform/widgets/qtsimplewaveformwidget.h b/src/waveform/widgets/qtsimplewaveformwidget.h index 9332681fe6b..2ae336c96be 100644 --- a/src/waveform/widgets/qtsimplewaveformwidget.h +++ b/src/waveform/widgets/qtsimplewaveformwidget.h @@ -11,11 +11,15 @@ class QtSimpleWaveformWidget : public GLWaveformWidgetAbstract { virtual WaveformWidgetType::Type getType() const { return WaveformWidgetType::GLSimpleWaveform; } - static inline QString getWaveformWidgetName() { return tr("Simple") + " - Qt"; } + static inline QString getWaveformWidgetName() { + return tr("Simple") + "- Qt"; + } static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return true; } static inline bool useOpenGLShaders() { return false; } - static inline bool developerOnly() { return false; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::Legacy; + } protected: virtual void castToQWidget(); diff --git a/src/waveform/widgets/qtvsynctestwidget.h b/src/waveform/widgets/qtvsynctestwidget.h index d01f3aadfdd..ae46ab887c9 100644 --- a/src/waveform/widgets/qtvsynctestwidget.h +++ b/src/waveform/widgets/qtvsynctestwidget.h @@ -14,7 +14,9 @@ class QtVSyncTestWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return true; } static inline bool useOpenGLShaders() { return false; } - static inline bool developerOnly() { return true; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::DeveloperOnly; + } protected: virtual void castToQWidget(); diff --git a/src/waveform/widgets/qtwaveformwidget.h b/src/waveform/widgets/qtwaveformwidget.h index 6dad4333be7..ee50f559f00 100644 --- a/src/waveform/widgets/qtwaveformwidget.h +++ b/src/waveform/widgets/qtwaveformwidget.h @@ -14,7 +14,9 @@ class QtWaveformWidget : public GLWaveformWidgetAbstract { static inline bool useOpenGl() { return true; } static inline bool useOpenGles() { return true; } static inline bool useOpenGLShaders() { return false; } - static inline bool developerOnly() { return false; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::Legacy; + } protected: virtual void castToQWidget(); diff --git a/src/waveform/widgets/rgbwaveformwidget.h b/src/waveform/widgets/rgbwaveformwidget.h index e146a51618d..d9457edc74b 100644 --- a/src/waveform/widgets/rgbwaveformwidget.h +++ b/src/waveform/widgets/rgbwaveformwidget.h @@ -15,7 +15,9 @@ class RGBWaveformWidget : public NonGLWaveformWidgetAbstract { static inline bool useOpenGl() { return false; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } - static inline bool developerOnly() { return false; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::Legacy; + } protected: virtual void castToQWidget(); diff --git a/src/waveform/widgets/softwarewaveformwidget.h b/src/waveform/widgets/softwarewaveformwidget.h index 097455035e7..dbb60189257 100644 --- a/src/waveform/widgets/softwarewaveformwidget.h +++ b/src/waveform/widgets/softwarewaveformwidget.h @@ -15,7 +15,9 @@ class SoftwareWaveformWidget : public NonGLWaveformWidgetAbstract { static inline bool useOpenGl() { return false; } static inline bool useOpenGles() { return false; } static inline bool useOpenGLShaders() { return false; } - static inline bool developerOnly() { return false; } + static inline WaveformWidgetCategory category() { + return WaveformWidgetCategory::Legacy; + } protected: virtual void castToQWidget(); diff --git a/src/waveform/widgets/waveformwidgetabstract.h b/src/waveform/widgets/waveformwidgetabstract.h index 0276184f3a6..b7f5b9fc606 100644 --- a/src/waveform/widgets/waveformwidgetabstract.h +++ b/src/waveform/widgets/waveformwidgetabstract.h @@ -5,6 +5,7 @@ #include "util/duration.h" #include "waveform/renderers/waveformwidgetrenderer.h" +#include "waveformwidgetcategory.h" #include "waveformwidgettype.h" #include "widget/wglwidget.h" diff --git a/src/waveform/widgets/waveformwidgetcategory.h b/src/waveform/widgets/waveformwidgetcategory.h new file mode 100644 index 00000000000..7f324df1f64 --- /dev/null +++ b/src/waveform/widgets/waveformwidgetcategory.h @@ -0,0 +1,8 @@ +#pragma once + +enum class WaveformWidgetCategory { + Default, + Legacy, + AllShader, + DeveloperOnly +}; diff --git a/src/waveform/widgets/waveformwidgettype.h b/src/waveform/widgets/waveformwidgettype.h index a46199d9998..9a3fcfcb416 100644 --- a/src/waveform/widgets/waveformwidgettype.h +++ b/src/waveform/widgets/waveformwidgettype.h @@ -26,6 +26,7 @@ class WaveformWidgetType { AllShaderLRRGBWaveform, // 18 L/R RGB (all-shaders) AllShaderFilteredWaveform, // 19 Filtered (all-shaders) AllShaderSimpleWaveform, // 20 Simple (all-shaders) + AllShaderHSVWaveform, // 21 HSV (all-shaders) Count_WaveformwidgetType // Also used as invalid value }; };