Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use WaveformWidgetType::AllShaderRGBWaveform as autoChooseWidgetType #11822

Merged
merged 9 commits into from
Sep 2, 2023
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
83 changes: 81 additions & 2 deletions src/preferences/upgrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -29,6 +30,61 @@ Upgrade::Upgrade()
Upgrade::~Upgrade() {
}

namespace {
// mapping to proactively move users to the new all-shader waveform types
WaveformWidgetType::Type upgradeToAllShaders(WaveformWidgetType::Type waveformType) {
switch (waveformType) {
case WaveformWidgetType::EmptyWaveform:
return waveformType;
case WaveformWidgetType::SoftwareSimpleWaveform:
return waveformType;
case WaveformWidgetType::SoftwareWaveform:
return waveformType;
case WaveformWidgetType::QtSimpleWaveform:
return WaveformWidgetType::AllShaderSimpleWaveform;
case WaveformWidgetType::QtWaveform:
return WaveformWidgetType::AllShaderRGBWaveform;
case WaveformWidgetType::GLSimpleWaveform:
return WaveformWidgetType::AllShaderSimpleWaveform;
case WaveformWidgetType::GLFilteredWaveform:
return WaveformWidgetType::AllShaderFilteredWaveform;
case WaveformWidgetType::GLSLFilteredWaveform:
return WaveformWidgetType::AllShaderFilteredWaveform;
case WaveformWidgetType::HSVWaveform:
return WaveformWidgetType::AllShaderHSVWaveform;
case WaveformWidgetType::GLVSyncTest:
return waveformType;
case WaveformWidgetType::RGBWaveform:
return WaveformWidgetType::AllShaderRGBWaveform;
case WaveformWidgetType::GLRGBWaveform:
return WaveformWidgetType::AllShaderRGBWaveform;
case WaveformWidgetType::GLSLRGBWaveform:
return WaveformWidgetType::AllShaderRGBWaveform;
case WaveformWidgetType::QtVSyncTest:
return waveformType;
case WaveformWidgetType::QtHSVWaveform:
return WaveformWidgetType::AllShaderHSVWaveform;
case WaveformWidgetType::QtRGBWaveform:
return WaveformWidgetType::AllShaderRGBWaveform;
case WaveformWidgetType::GLSLRGBStackedWaveform:
return WaveformWidgetType::AllShaderRGBWaveform;
case WaveformWidgetType::AllShaderRGBWaveform:
return waveformType;
case WaveformWidgetType::AllShaderLRRGBWaveform:
return waveformType;
case WaveformWidgetType::AllShaderFilteredWaveform:
return waveformType;
case WaveformWidgetType::AllShaderSimpleWaveform:
return waveformType;
case WaveformWidgetType::AllShaderHSVWaveform:
return waveformType;
case WaveformWidgetType::Count_WaveformwidgetType:
return waveformType;
}
return WaveformWidgetType::AllShaderRGBWaveform;
}
m0dB marked this conversation as resolved.
Show resolved Hide resolved
} // 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) {
Expand Down Expand Up @@ -329,6 +385,29 @@ UserSettingsPointer Upgrade::versionUpgrade(const QString& settingsPath) {
configVersion = "1.9.0";
config->set(ConfigKey("[Config]","Version"), ConfigValue("1.9.0"));
}

Swiftb0y marked this conversation as resolved.
Show resolved Hide resolved
auto configVersionNumber = 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 (configVersionNumber < QVersionNumber::fromString("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<WaveformWidgetType::Type>(
waveformType))));
}
config->set(ConfigKey("[Waveform]", "FrameRate"), ConfigValue(60));
}

if (configVersion.startsWith("1.9") || configVersion.startsWith("1.10")) {
qDebug() << "Upgrading from v1.9.x/1.10.x...";

Expand Down Expand Up @@ -434,11 +513,11 @@ UserSettingsPointer Upgrade::versionUpgrade(const QString& settingsPath) {
}
}

const auto configFileVersion = QVersionNumber::fromString(configVersion);
configVersionNumber = QVersionNumber::fromString(configVersion);

// This variable indicates the first known version that requires no changes.
const QVersionNumber cleanVersion(1, 12, 0);
if (configFileVersion >= cleanVersion) {
if (configVersionNumber >= cleanVersion) {
// No special upgrade required, just update the value.
configVersion = VersionStore::version();
config->set(ConfigKey("[Config]", "Version"), ConfigValue(VersionStore::version()));
Expand Down
3 changes: 0 additions & 3 deletions src/waveform/renderers/allshader/waveformrenderbackground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions src/waveform/renderers/allshader/waveformrenderbeat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ WaveformRenderBeat::WaveformRenderBeat(WaveformWidgetRenderer* waveformWidget)
: WaveformRenderer(waveformWidget) {
}

WaveformRenderBeat::~WaveformRenderBeat() {
}

void WaveformRenderBeat::initializeGL() {
WaveformRenderer::initializeGL();
m_shader.init();
Expand Down
1 change: 0 additions & 1 deletion src/waveform/renderers/allshader/waveformrenderbeat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/waveform/renderers/allshader/waveformrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ WaveformRenderer::WaveformRenderer(WaveformWidgetRenderer* widget)
: ::WaveformRendererAbstract(widget) {
}

WaveformRenderer::~WaveformRenderer() = default;

void WaveformRenderer::draw(QPainter* painter, QPaintEvent* event) {
DEBUG_ASSERT(false);
}
1 change: 0 additions & 1 deletion src/waveform/renderers/allshader/waveformrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ WaveformRendererEndOfTrack::WaveformRendererEndOfTrack(
m_pTimeRemainingControl(nullptr) {
}

WaveformRendererEndOfTrack::~WaveformRendererEndOfTrack() {
}

bool WaveformRendererEndOfTrack::init() {
m_timer.restart();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 0 additions & 3 deletions src/waveform/renderers/allshader/waveformrendererfiltered.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ WaveformRendererFiltered::WaveformRendererFiltered(
: WaveformRendererSignalBase(waveformWidget) {
}

WaveformRendererFiltered::~WaveformRendererFiltered() {
}

void WaveformRendererFiltered::onSetup(const QDomNode& node) {
Q_UNUSED(node);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading
Loading