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

show beats and time until next marker #12994

Merged
merged 30 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3e95b90
show beats until next marker, using digitsrenderer with digits textur…
Mar 23, 2024
d7ea74f
also show time until marker
Mar 25, 2024
9daeef7
float instead of double to fix ubuntu compilation
Mar 26, 2024
dcb6baa
until next marker prefs
Apr 7, 2024
7f0f60a
settings for until next marker display
Apr 7, 2024
c238422
use int for font pixel size
Apr 7, 2024
6d999c8
fix compilation on ubuntu
Apr 7, 2024
441b190
fixes post rebase
Apr 19, 2024
8d3a559
comments and code clarity in response to review
Apr 19, 2024
2784567
removed unused var
Apr 19, 2024
3e61386
avoid -Wclazy-range-loop-detach
Apr 20, 2024
1d07cc1
decide which markers should be included in the beats/time until next …
Apr 20, 2024
bd80bb1
show until next marker options only when waveform type supports it
Apr 20, 2024
afcc1bf
added isValid check
Apr 20, 2024
e9fe5b7
improve timeSecToString function and arg name, typo fix, using asprin…
m0dB May 3, 2024
eeb092d
use make_unique
m0dB May 3, 2024
007a19e
improved naming UntilMarkTextPixelSize
May 3, 2024
9d34e3f
waveform untilmark preference improvements
May 4, 2024
7ea994e
formatting
May 4, 2024
26c80c1
deal with markers that are not on the beat
May 4, 2024
0346eb6
Qt::Literals::StringLiterals available since Qt 6.4
May 4, 2024
b426bea
fix clazy
May 4, 2024
3429891
prefs layout tweak
May 4, 2024
0a79895
use constexpr and debug_assert
m0dB May 5, 2024
d320fa5
use pointsize instead of pixelsize, keep text below third of waveform…
May 5, 2024
28f8493
remove unused var
May 5, 2024
884cad8
remove debug output
May 5, 2024
18ebb1c
formatting
May 5, 2024
feaa340
added static_assert as suggested by daschuer
May 6, 2024
362ace2
post-rebase fixes
May 6, 2024
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,7 @@ if(QOPENGL)
src/shaders/unicolorshader.cpp
src/shaders/vinylqualityshader.cpp
src/util/opengltexture2d.cpp
src/waveform/renderers/allshader/digitsrenderer.cpp
src/waveform/renderers/allshader/matrixforwidgetgeometry.cpp
src/waveform/renderers/allshader/waveformrenderbackground.cpp
src/waveform/renderers/allshader/waveformrenderbeat.cpp
Expand Down
60 changes: 60 additions & 0 deletions src/preferences/dialog/dlgprefwaveform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ DlgPrefWaveform::DlgPrefWaveform(
defaultZoomComboBox->addItem(QString::number(100 / static_cast<double>(i), 'f', 1) + " %");
}

// Populate untilMark options
untilMarkAlignComboBox->addItem(tr("Top"));
untilMarkAlignComboBox->addItem(tr("Center"));
untilMarkAlignComboBox->addItem(tr("Bottom"));

// The GUI is not fully setup so connecting signals before calling
// slotUpdate can generate rebootMixxxView calls.
// TODO(XXX): Improve this awkwardness.
Expand Down Expand Up @@ -131,6 +136,22 @@ DlgPrefWaveform::DlgPrefWaveform(
&QSlider::valueChanged,
this,
&DlgPrefWaveform::slotSetPlayMarkerPosition);
connect(untilMarkShowBeatsCheckBox,
&QCheckBox::toggled,
this,
&DlgPrefWaveform::slotSetUntilMarkShowBeats);
connect(untilMarkShowTimeCheckBox,
&QCheckBox::toggled,
this,
&DlgPrefWaveform::slotSetUntilMarkShowTime);
connect(untilMarkAlignComboBox,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
&DlgPrefWaveform::slotSetUntilMarkAlign);
connect(untilMarkTextPointSizeSpinBox,
QOverload<int>::of(&QSpinBox::valueChanged),
this,
&DlgPrefWaveform::slotSetUntilMarkTextPointSize);

setScrollSafeGuardForAllInputWidgets(this);
}
Expand All @@ -153,6 +174,8 @@ void DlgPrefWaveform::slotUpdate() {
waveformTypeComboBox->setCurrentIndex(currentIndex);
}

updateEnableUntilMark();

frameRateSpinBox->setValue(factory->getFrameRate());
frameRateSlider->setValue(factory->getFrameRate());
endOfTrackWarningTimeSpinBox->setValue(factory->getEndOfTrackWarningTime());
Expand All @@ -169,6 +192,13 @@ void DlgPrefWaveform::slotUpdate() {
beatGridAlphaSpinBox->setValue(factory->getBeatGridAlpha());
beatGridAlphaSlider->setValue(factory->getBeatGridAlpha());

untilMarkShowBeatsCheckBox->setChecked(factory->getUntilMarkShowBeats());
untilMarkShowTimeCheckBox->setChecked(factory->getUntilMarkShowTime());
untilMarkAlignComboBox->setCurrentIndex(
WaveformWidgetFactory::toUntilMarkAlignIndex(
factory->getUntilMarkAlign()));
untilMarkTextPointSizeSpinBox->setValue(factory->getUntilMarkTextPointSize());

// By default we set RGB woverview = "2"
int overviewType = m_pConfig->getValue(
ConfigKey("[Waveform]","WaveformOverviewType"), 2);
Expand Down Expand Up @@ -252,6 +282,19 @@ void DlgPrefWaveform::slotSetWaveformType(int index) {
}
int handleIndex = waveformTypeComboBox->itemData(index).toInt();
WaveformWidgetFactory::instance()->setWidgetTypeFromHandle(handleIndex);

updateEnableUntilMark();
}

void DlgPrefWaveform::updateEnableUntilMark() {
const bool enabled = WaveformWidgetFactory::instance()->widgetTypeSupportsUntilMark();
untilMarkShowBeatsCheckBox->setEnabled(enabled);
untilMarkShowTimeCheckBox->setEnabled(enabled);
untilMarkAlignLabel->setEnabled(enabled);
untilMarkAlignComboBox->setEnabled(enabled);
untilMarkTextPointSizeLabel->setEnabled(enabled);
untilMarkTextPointSizeSpinBox->setEnabled(enabled);
requiresGLSLLabel->setVisible(!enabled);
}

void DlgPrefWaveform::slotSetWaveformOverviewType(int index) {
Expand Down Expand Up @@ -312,6 +355,23 @@ void DlgPrefWaveform::slotSetPlayMarkerPosition(int position) {
WaveformWidgetFactory::instance()->setPlayMarkerPosition(position / 100.0);
}

void DlgPrefWaveform::slotSetUntilMarkShowBeats(bool checked) {
WaveformWidgetFactory::instance()->setUntilMarkShowBeats(checked);
}

void DlgPrefWaveform::slotSetUntilMarkShowTime(bool checked) {
WaveformWidgetFactory::instance()->setUntilMarkShowTime(checked);
}

void DlgPrefWaveform::slotSetUntilMarkAlign(int index) {
WaveformWidgetFactory::instance()->setUntilMarkAlign(
WaveformWidgetFactory::toUntilMarkAlign(index));
}

void DlgPrefWaveform::slotSetUntilMarkTextPointSize(int value) {
WaveformWidgetFactory::instance()->setUntilMarkTextPointSize(value);
}

void DlgPrefWaveform::calculateCachedWaveformDiskUsage() {
AnalysisDao analysisDao(m_pConfig);
QSqlDatabase dbConnection = mixxx::DbConnectionPooled(m_pLibrary->dbConnectionPool());
Expand Down
6 changes: 5 additions & 1 deletion src/preferences/dialog/dlgprefwaveform.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,18 @@ class DlgPrefWaveform : public DlgPreferencePage, public Ui::DlgPrefWaveformDlg
void slotClearCachedWaveforms();
void slotSetBeatGridAlpha(int alpha);
void slotSetPlayMarkerPosition(int position);

void slotSetUntilMarkShowBeats(bool checked);
void slotSetUntilMarkShowTime(bool checked);
void slotSetUntilMarkAlign(int index);
void slotSetUntilMarkTextPointSize(int value);
signals:
void reloadUserInterface();

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

UserSettingsPointer m_pConfig;
std::shared_ptr<Library> m_pLibrary;
Expand Down
86 changes: 84 additions & 2 deletions src/preferences/dialog/dlgprefwaveformdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,88 @@ Select from different types of displays for the waveform, which differ primarily
</item>

<item row="11" column="0">
<widget class="QLabel" name="untilMarkLabel">
<property name="text">
<string>Play marker hints</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QCheckBox" name="untilMarkShowBeatsCheckBox">
<property name="text">
<string>Beats until next marker</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QCheckBox" name="untilMarkShowTimeCheckBox">
<property name="text">
<string>Time until next marker</string>
</property>
</widget>
</item>
<item row="11" column="2">
<widget class="QLabel" name="untilMarkAlignLabel">
<property name="text">
<string>Placement</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>untilMarkAlignComboBox</cstring>
</property>
</widget>
</item>
<item row="12" column="2">
<widget class="QComboBox" name="untilMarkAlignComboBox"/>
</item>
<item row="11" column="3">
<widget class="QLabel" name="untilMarkTextPointSizeLabel">
<property name="text">
<string>Font size</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>untilMarkTextPointSizeSpinBox</cstring>
</property>
</widget>
</item>
<item row="12" column="3">
<widget class="QSpinBox" name="untilMarkTextPointSizeSpinBox">
<property name="toolTip">
<string/>
</property>
<property name="suffix">
<string> pt</string>
</property>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>50</number>
</property>
<property name="value">
<number>30</number>
</property>
</widget>
</item>
<item row="14" column="1" colspan="2">
<widget class="QLabel" name="requiresGLSLLabel">
<property name="text">
<string>This functionality requires a waveform type marked "(GLSL)".</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QLabel" name="cachedWaveforms">
<property name="text">
<string>Caching</string>
Expand All @@ -468,7 +550,7 @@ Select from different types of displays for the waveform, which differ primarily
</property>
</widget>
</item>
<item row="11" column="1" colspan="3">
<item row="15" column="1" colspan="3">
<layout class="QGridLayout" name="cachingGridLayout">
<item row="4" column="0">
<widget class="QPushButton" name="clearCachedWaveforms">
Expand Down Expand Up @@ -520,7 +602,7 @@ Select from different types of displays for the waveform, which differ primarily
</layout>
</item>

<item row="13" column="0" colspan="4">
<item row="17" column="0" colspan="4">
<widget class="QGroupBox" name="openGLStatus">
<property name="title">
<string>OpenGL status</string>
Expand Down
Loading