Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9c658a0
Implement switchable duration format
poelzi Apr 26, 2018
66fc9d1
Cleanup and Hectoseconds
poelzi May 2, 2018
f987e3d
add simple second display.
poelzi May 14, 2018
f6f2a78
fixup tests. Try some unrelated character as seperator in hectoseconds.
poelzi May 15, 2018
b8b0076
Merge remote-tracking branch 'origin/master' into feature/seconds
poelzi May 15, 2018
c77bd6a
Merge commit 'f325270ee31bcdad96e1f206637f059ad72e6b01' into seconds
daschuer Jan 6, 2019
22a2b4c
Implement switchable time format for decks by @poelzi - #1652
benis Oct 13, 2018
a87dc95
Comment to identify separator characters
benis Nov 4, 2018
5f1196c
Fix issues identified by CodeFactor
benis Nov 22, 2018
5dc62e6
Replace if with VERIFY_OR_DEBUG_ASSERT in src/util/duration.cpp
benis Jan 6, 2019
7685e0a
reintroduce the lost "?" for negative durations
daschuer Jan 6, 2019
3efd74d
Add 'Traditional (Coarse)' time format option
benis Jan 10, 2019
c0d3cae
Minor formatting corrections to duration.cpp
benis Jan 10, 2019
5fe1f0f
Re-format dlgprefdeck.cpp:120 onwards to make more readable
benis Jan 10, 2019
341242a
Remove 'hh:' from descrptions in time format drop-down in Deck Prefer…
benis Jan 11, 2019
f27e92d
Clean up deck time formatting logic
benis Jan 12, 2019
66c48cd
Fix entries in deck time prefs drop-down
benis Jan 12, 2019
d356226
Amend durationutiltest.cpp following previous 2 commits
benis Jan 12, 2019
407164a
Merge remote-tracking branch 'upstream/master' into hectoseconds
daschuer Jan 12, 2019
9977df3
Refactor DisplayMode enum for consistency
benis Jan 13, 2019
5ba36de
Return const QString for invalid duration value
benis Jan 13, 2019
19cf23d
Merge pull request #38 from benis/hectoseconds2
daschuer Jan 14, 2019
5d357b2
make time formats more like SI
daschuer Jan 19, 2019
43aeb9e
Replace hectoseconds format by seconds long. Hectosends fromat was to…
daschuer Jan 19, 2019
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
2 changes: 1 addition & 1 deletion src/library/basesqltablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ QVariant BaseSqlTableModel::data(const QModelIndex& index, int role) const {
if (column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_DURATION)) {
int duration = value.toInt();
if (duration > 0) {
value = mixxx::Duration::formatSeconds(duration);
value = mixxx::Duration::formatTime(duration);
} else {
value = QString();
}
Expand Down
2 changes: 1 addition & 1 deletion src/library/crate/cratesummary.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CrateSummary: public Crate {
}
// Returns the duration formatted as a string H:MM:SS
QString getTrackDurationText() const {
return mixxx::Duration::formatSeconds(getTrackDuration(), mixxx::Duration::Precision::SECONDS);
return mixxx::Duration::formatTime(getTrackDuration(), mixxx::Duration::Precision::SECONDS);
}

private:
Expand Down
81 changes: 69 additions & 12 deletions src/preferences/dialog/dlgprefdeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "control/controlobject.h"
#include "mixxx.h"
#include "defs_urls.h"
#include "util/duration.h"

namespace {
constexpr int kDefaultRateRangePercent = 8;
Expand Down Expand Up @@ -82,30 +83,74 @@ DlgPrefDeck::DlgPrefDeck(QWidget * parent, MixxxMainWindow * mixxx,
// If not present in the config, set the default value
if (!m_pConfig->exists(ConfigKey("[Controls]","PositionDisplay"))) {
m_pConfig->set(ConfigKey("[Controls]","PositionDisplay"),
QString::number(static_cast<int>(TrackTime::DisplayMode::Remaining)));
QString::number(static_cast<int>(TrackTime::DisplayMode::REMAINING)));
}

double positionDisplayType = m_pConfig->getValue(
ConfigKey("[Controls]", "PositionDisplay"),
static_cast<double>(TrackTime::DisplayMode::Elapsed));
static_cast<double>(TrackTime::DisplayMode::ELAPSED));
if (positionDisplayType ==
static_cast<double>(TrackTime::DisplayMode::Remaining)) {
static_cast<double>(TrackTime::DisplayMode::REMAINING)) {
radioButtonRemaining->setChecked(true);
m_pControlTrackTimeDisplay->set(
static_cast<double>(TrackTime::DisplayMode::Remaining));
static_cast<double>(TrackTime::DisplayMode::REMAINING));
} else if (positionDisplayType ==
static_cast<double>(TrackTime::DisplayMode::ElapsedAndRemaining)) {
static_cast<double>(TrackTime::DisplayMode::ELAPSED_AND_REMAINING)) {
radioButtonElapsedAndRemaining->setChecked(true);
m_pControlTrackTimeDisplay->set(
static_cast<double>(TrackTime::DisplayMode::ElapsedAndRemaining));
static_cast<double>(TrackTime::DisplayMode::ELAPSED_AND_REMAINING));
} else {
radioButtonElapsed->setChecked(true);
m_pControlTrackTimeDisplay->set(
static_cast<double>(TrackTime::DisplayMode::Elapsed));
static_cast<double>(TrackTime::DisplayMode::ELAPSED));
}
connect(buttonGroupTrackTime, SIGNAL(buttonClicked(QAbstractButton*)),
this, SLOT(slotSetTrackTimeDisplay(QAbstractButton *)));

// display time format

m_pControlTrackTimeFormat = new ControlObject(
ConfigKey("[Controls]", "TimeFormat"));
connect(m_pControlTrackTimeDisplay, SIGNAL(valueChanged(double)),
this, SLOT(slotTimeFormatChanged(double)));

QLocale locale;
// Track Display model
comboBoxTimeFormat->clear();

comboBoxTimeFormat->addItem(tr("mm:ss%1zz - Traditional")
.arg(mixxx::DurationBase::kDecimalSeparator),
static_cast<int>
(TrackTime::DisplayFormat::TRADITIONAL));

comboBoxTimeFormat->addItem(tr("mm:ss - Traditional (Coarse)"),
static_cast<int>
(TrackTime::DisplayFormat::TRADITIONAL_COARSE));

comboBoxTimeFormat->addItem(tr("s%1zz - Seconds")
.arg(mixxx::DurationBase::kDecimalSeparator),
static_cast<int>
(TrackTime::DisplayFormat::SECONDS));

comboBoxTimeFormat->addItem(tr("sss%1zz - Seconds (Long)")
.arg(mixxx::DurationBase::kDecimalSeparator),
static_cast<int>
(TrackTime::DisplayFormat::SECONDS_LONG));

comboBoxTimeFormat->addItem(tr("s%1sss%2zz - Kiloseconds")
.arg(QString(mixxx::DurationBase::kDecimalSeparator),
QString(mixxx::DurationBase::kKiloGroupSeparator)),
static_cast<int>
(TrackTime::DisplayFormat::KILO_SECONDS));

double time_format = static_cast<double>(
m_pConfig->getValue(
ConfigKey("[Controls]", "TimeFormat"),
static_cast<int>(TrackTime::DisplayFormat::TRADITIONAL)));
m_pControlTrackTimeFormat->set(time_format);
comboBoxTimeFormat->setCurrentIndex(
comboBoxTimeFormat->findData(time_format));

// Override Playing Track on Track Load
// The check box reflects the opposite of the config value
m_bDisallowTrackLoadToPlayingDeck = !m_pConfig->getValue(
Expand Down Expand Up @@ -447,20 +492,20 @@ void DlgPrefDeck::slotJumpToCueOnTrackLoadCheckbox(bool checked) {

void DlgPrefDeck::slotSetTrackTimeDisplay(QAbstractButton* b) {
if (b == radioButtonRemaining) {
m_timeDisplayMode = TrackTime::DisplayMode::Remaining;
m_timeDisplayMode = TrackTime::DisplayMode::REMAINING;
} else if (b == radioButtonElapsedAndRemaining) {
m_timeDisplayMode = TrackTime::DisplayMode::ElapsedAndRemaining;
m_timeDisplayMode = TrackTime::DisplayMode::ELAPSED_AND_REMAINING;
} else {
m_timeDisplayMode = TrackTime::DisplayMode::Elapsed;
m_timeDisplayMode = TrackTime::DisplayMode::ELAPSED;
}
}

void DlgPrefDeck::slotSetTrackTimeDisplay(double v) {
m_timeDisplayMode = static_cast<TrackTime::DisplayMode>(static_cast<int>(v));
m_pConfig->set(ConfigKey("[Controls]","PositionDisplay"), ConfigValue(v));
if (m_timeDisplayMode == TrackTime::DisplayMode::Remaining) {
if (m_timeDisplayMode == TrackTime::DisplayMode::REMAINING) {
radioButtonRemaining->setChecked(true);
} else if (m_timeDisplayMode == TrackTime::DisplayMode::ElapsedAndRemaining) {
} else if (m_timeDisplayMode == TrackTime::DisplayMode::ELAPSED_AND_REMAINING) {
radioButtonElapsedAndRemaining->setChecked(true);
} else { // Elapsed
radioButtonElapsed->setChecked(true);
Expand Down Expand Up @@ -495,11 +540,23 @@ void DlgPrefDeck::slotRateRampingModeLinearButton(bool checked) {
}
}

void DlgPrefDeck::slotTimeFormatChanged(double v) {
int i = static_cast<int>(v);
m_pConfig->set(ConfigKey("[Controls]","TimeFormat"), ConfigValue(v));
comboBoxTimeFormat->setCurrentIndex(
comboBoxTimeFormat->findData(i));
}

void DlgPrefDeck::slotApply() {
double timeDisplay = static_cast<double>(m_timeDisplayMode);
m_pConfig->set(ConfigKey("[Controls]","PositionDisplay"), ConfigValue(timeDisplay));
m_pControlTrackTimeDisplay->set(timeDisplay);

// time format
double timeFormat = comboBoxTimeFormat->itemData(comboBoxTimeFormat->currentIndex()).toDouble();
m_pControlTrackTimeFormat->set(timeFormat);
m_pConfig->setValue(ConfigKey("[Controls]", "TimeFormat"), timeFormat);

// Set cue mode for every deck
for (ControlProxy* pControl : m_cueControls) {
pControl->set(m_iCueMode);
Expand Down
18 changes: 15 additions & 3 deletions src/preferences/dialog/dlgprefdeck.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,18 @@ class ControlObject;

namespace TrackTime {
enum class DisplayMode {
Elapsed,
Remaining,
ElapsedAndRemaining,
ELAPSED,
REMAINING,
ELAPSED_AND_REMAINING,
};

enum class DisplayFormat {
TRADITIONAL,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do DisplayMode and DisplayFormat use inconsistent naming conventions for their enum literals?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. You're referring to the fact that one is in Sentence Case and the other in SNAKE_CASE, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, it's obvious ;)

TRADITIONAL_COARSE,
SECONDS,
SECONDS_LONG,
KILO_SECONDS,
HECTO_SECONDS,
};
}

Expand Down Expand Up @@ -67,6 +76,8 @@ class DlgPrefDeck : public DlgPreferencePage, public Ui::DlgPrefDeckDlg {
void slotRateRampingModeLinearButton(bool);
void slotRateRampSensitivitySlider(int);

void slotTimeFormatChanged(double);

void slotNumDecksChanged(double, bool initializing=false);
void slotNumSamplersChanged(double, bool initializing=false);

Expand All @@ -85,6 +96,7 @@ class DlgPrefDeck : public DlgPreferencePage, public Ui::DlgPrefDeckDlg {

UserSettingsPointer m_pConfig;
ControlObject* m_pControlTrackTimeDisplay;
ControlObject* m_pControlTrackTimeFormat;
ControlProxy* m_pNumDecks;
ControlProxy* m_pNumSamplers;
QList<ControlProxy*> m_cueControls;
Expand Down
113 changes: 63 additions & 50 deletions src/preferences/dialog/dlgprefdeckdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -20,41 +20,16 @@
<string>Deck options</string>
</property>
<layout class="QGridLayout" name="GridLayout1">
<item row="0" column="0">
<widget class="QLabel" name="labelCueMode">
<property name="spacing">
<number>10</number>
</property>
<item row="3" column="0">
<widget class="QLabel" name="labelAutoCue">
<property name="text">
<string>Cue mode</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
<string>Auto cue</string>
</property>
<property name="buddy">
<cstring>ComboBoxCueMode</cstring>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="ComboBoxCueMode">
<property name="toolTip">
<string>Mixxx mode:
- Cue button while pause at cue point = preview
- Cue button while pause not at cue point = set cue point
- Cue button while playing = pause at cue point
Mixxx mode (no blinking):
- Same as Mixxx mode but with no blinking indicators
Pioneer mode:
- Same as Mixxx mode with a flashing play button
Denon mode:
- Cue button at cue point = preview
- Cue button not at cue point = pause at cue point
- Play = set cue point
Numark mode:
- Same as Denon mode, but without a flashing play button
CUP mode:
- Cue button while pause at cue point = play after release
- Cue button while pause not at cue point = set cue point and play after release
- Cue button while playing = go to cue point and play after release
</string>
<cstring>checkBoxSeekToCue</cstring>
</property>
</widget>
</item>
Expand All @@ -77,6 +52,24 @@ CUP mode:
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="checkBoxDisallowLoadToPlayingDeck">
<property name="text">
<string>Do not load tracks into playing decks</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QCheckBox" name="checkBoxSeekToCue">
<property name="toolTip">
<string>Automatically seeks to the first saved cue point on track load.
If none exists, seeks to the beginning of the track.</string>
</property>
<property name="text">
<string>Jump to main cue point on track load</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
Expand Down Expand Up @@ -111,44 +104,64 @@ CUP mode:
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelAutoCue">
<item row="0" column="0">
<widget class="QLabel" name="labelCueMode">
<property name="text">
<string>Auto cue</string>
<string>Cue mode</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>checkBoxSeekToCue</cstring>
<cstring>ComboBoxCueMode</cstring>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="checkBoxSeekToCue">
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="ComboBoxCueMode">
<property name="toolTip">
<string>Automatically seeks to the first saved cue point on track load.
If none exists, seeks to the beginning of the track.</string>
</property>
<property name="text">
<string>Jump to main cue point on track load</string>
<string>Mixxx mode:
- Cue button while pause at cue point = preview
- Cue button while pause not at cue point = set cue point
- Cue button while playing = pause at cue point
Mixxx mode (no blinking):
- Same as Mixxx mode but with no blinking indicators
Pioneer mode:
- Same as Mixxx mode with a flashing play button
Denon mode:
- Cue button at cue point = preview
- Cue button not at cue point = pause at cue point
- Play = set cue point
Numark mode:
- Same as Denon mode, but without a flashing play button
CUP mode:
- Cue button while pause at cue point = play after release
- Cue button while pause not at cue point = set cue point and play after release
- Cue button while playing = go to cue point and play after release
</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="labelPlayingTrackProtection">
<property name="text">
<string>Playing track protection</string>
<string>Pla&amp;ying track protection</string>
</property>
<property name="buddy">
<cstring>checkBoxDisallowLoadToPlayingDeck</cstring>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QCheckBox" name="checkBoxDisallowLoadToPlayingDeck">
<item row="2" column="0">
<widget class="QLabel" name="labelTimeDisplay">
<property name="text">
<string>Do not load tracks into playing decks</string>
<string>Time Format</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxTimeFormat"/>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -755,13 +768,13 @@ CUP mode:
</connection>
</connections>
<buttongroups>
<buttongroup name="buttonGroupKeyLockMode"/>
<buttongroup name="buttonGroupKeyUnlockMode"/>
<buttongroup name="buttonGroupSpeedPitchReset">
<property name="exclusive">
<bool>false</bool>
</property>
</buttongroup>
<buttongroup name="buttonGroupKeyLockMode"/>
<buttongroup name="buttonGroupKeyUnlockMode"/>
<buttongroup name="buttonGroupTrackTime"/>
<buttongroup name="buttonGroupSpeedBendBehavior"/>
</buttongroups>
Expand Down
Loading