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

allow changing the waveform overview type without reloading the skin #13273

Merged
merged 4 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1298,9 +1298,6 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/widget/wnumberpos.cpp
src/widget/wnumberrate.cpp
src/widget/woverview.cpp
src/widget/woverviewhsv.cpp
src/widget/woverviewlmh.cpp
src/widget/woverviewrgb.cpp
src/widget/wpixmapstore.cpp
src/widget/wpushbutton.cpp
src/widget/wraterange.cpp
Expand Down
8 changes: 1 addition & 7 deletions src/preferences/dialog/dlgpreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,11 @@ DlgPreferences::DlgPreferences(

// ugly proxy for determining whether this is being instantiated for QML or legacy QWidgets GUI
if (pSkinLoader) {
DlgPrefWaveform* pWaveformPage = new DlgPrefWaveform(this, m_pConfig, pLibrary);
addPageWidget(PreferencesPage(
pWaveformPage,
new DlgPrefWaveform(this, m_pConfig, pLibrary),
new QTreeWidgetItem(contentsTreeWidget, QTreeWidgetItem::Type)),
tr("Waveforms"),
"ic_preferences_waveforms.svg");
connect(pWaveformPage,
&DlgPrefWaveform::reloadUserInterface,
this,
&DlgPreferences::reloadUserInterface,
Qt::DirectConnection);
}

addPageWidget(PreferencesPage(
Expand Down
8 changes: 7 additions & 1 deletion src/preferences/dialog/dlgprefwaveform.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "preferences/dialog/dlgprefwaveform.h"

#include "control/controlobject.h"
#include "library/dao/analysisdao.h"
#include "library/library.h"
#include "moc_dlgprefwaveform.cpp"
Expand All @@ -21,6 +22,10 @@ DlgPrefWaveform::DlgPrefWaveform(
waveformOverviewComboBox->addItem(tr("Filtered")); // "0"
waveformOverviewComboBox->addItem(tr("HSV")); // "1"
waveformOverviewComboBox->addItem(tr("RGB")); // "2"
m_pTypeControl = std::make_unique<ControlObject>(
ConfigKey(QStringLiteral("[Waveform]"),
QStringLiteral("WaveformOverviewType")));
m_pTypeControl->setReadOnly();

// Populate waveform options.
WaveformWidgetFactory* factory = WaveformWidgetFactory::instance();
Expand Down Expand Up @@ -205,6 +210,7 @@ void DlgPrefWaveform::slotUpdate() {
if (overviewType != waveformOverviewComboBox->currentIndex()) {
waveformOverviewComboBox->setCurrentIndex(overviewType);
}
slotSetWaveformOverviewType(overviewType);

WaveformSettings waveformSettings(m_pConfig);
enableWaveformCaching->setChecked(waveformSettings.waveformCachingEnabled());
Expand Down Expand Up @@ -299,7 +305,7 @@ void DlgPrefWaveform::updateEnableUntilMark() {

void DlgPrefWaveform::slotSetWaveformOverviewType(int index) {
m_pConfig->set(ConfigKey("[Waveform]","WaveformOverviewType"), ConfigValue(index));
emit reloadUserInterface();
m_pTypeControl->forceSet(index);
}

void DlgPrefWaveform::slotSetDefaultZoom(int index) {
Expand Down
5 changes: 3 additions & 2 deletions src/preferences/dialog/dlgprefwaveform.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "preferences/dialog/ui_dlgprefwaveformdlg.h"
#include "preferences/usersettings.h"

class ControlObject;
class Library;

class DlgPrefWaveform : public DlgPreferencePage, public Ui::DlgPrefWaveformDlg {
Expand Down Expand Up @@ -42,15 +43,15 @@ class DlgPrefWaveform : public DlgPreferencePage, public Ui::DlgPrefWaveformDlg
void slotSetUntilMarkShowTime(bool checked);
void slotSetUntilMarkAlign(int index);
void slotSetUntilMarkTextPointSize(int value);
signals:
void reloadUserInterface();

private:
void initWaveformControl();
void calculateCachedWaveformDiskUsage();
void notifyRebootNecessary();
void updateEnableUntilMark();

std::unique_ptr<ControlObject> m_pTypeControl;

UserSettingsPointer m_pConfig;
std::shared_ptr<Library> m_pLibrary;
};
17 changes: 3 additions & 14 deletions src/skin/legacy/legacyskinparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@
#include "widget/wnumberdb.h"
#include "widget/wnumberpos.h"
#include "widget/wnumberrate.h"
#include "widget/woverviewhsv.h"
#include "widget/woverviewlmh.h"
#include "widget/woverviewrgb.h"
#include "widget/woverview.h"
#include "widget/wpixmapstore.h"
#include "widget/wpushbutton.h"
#include "widget/wraterange.h"
Expand Down Expand Up @@ -984,17 +982,8 @@ QWidget* LegacySkinParser::parseOverview(const QDomElement& node) {
return nullptr;
}

WOverview* overviewWidget = nullptr;

// "RGB" = "2", "HSV" = "1" or "Filtered" = "0" (LMH) waveform overview type
int type = m_pConfig->getValue(ConfigKey("[Waveform]","WaveformOverviewType"), 2);
if (type == 0) {
overviewWidget = new WOverviewLMH(group, m_pPlayerManager, m_pConfig, m_pParent);
} else if (type == 1) {
overviewWidget = new WOverviewHSV(group, m_pPlayerManager, m_pConfig, m_pParent);
} else {
overviewWidget = new WOverviewRGB(group, m_pPlayerManager, m_pConfig, m_pParent);
}
WOverview* overviewWidget =
new WOverview(group, m_pPlayerManager, m_pConfig, m_pParent);

connect(overviewWidget,
&WOverview::trackDropped,
Expand Down
Loading
Loading