Skip to content

Recording duration widget#1221

Merged
daschuer merged 5 commits intomixxxdj:masterfrom
ronso0:RecordingDuration-widget
Mar 25, 2017
Merged

Recording duration widget#1221
daschuer merged 5 commits intomixxxdj:masterfrom
ronso0:RecordingDuration-widget

Conversation

@ronso0
Copy link
Copy Markdown
Member

@ronso0 ronso0 commented Mar 22, 2017

[messed up #1220 with local production branch, so I start over here]

I'd like to introduce a simple label widget called with <RecordingDuration>.
It displays the duration of a running recording in the skin, apart from Recording section in Library.

A while ago I filed a wishlist bug but noone with more C++ experience & spare time picked this up so far.
Newbie that I am, I couldn't make something from the hints @daschuer posted there, so I tried to learn from WTime widget (simple widget) and dlgrecording.cpp (queries recordingmanager for recDurationString).

@ronso0
Copy link
Copy Markdown
Member Author

ronso0 commented Mar 22, 2017

Woohoo, it's working! Can't tell if the code okay, as well.
To test it, I put it behind Rec button in Tango.

Last recordings duration is visible for a second when new recording is started.
Seconds seem to flip over irregularly, like in Library > Recording.

Now that I tried it a few times, I think it might be handy to have a all-in-one widget, actually a dynamic button that handles [Recording],toggle_recording, displays [custom_text][recording duration] when recording and would clear when the recording is stopped. Text could be defined with <InactiveLabel>, <ActivatingLabel> and <RecordingLabel>, that way the button could be designed for available space or even be translated. Would this be possible, like WNumberPos but with different click connection?
@daschuer Would your CO approach work better than adapting from WNumberPos?

If at all, it won't happen in this PR. The Label is useful already.

@ronso0 ronso0 mentioned this pull request Mar 22, 2017
Comment thread src/skin/legacyskinparser.cpp Outdated
} else if (nodeName == "Time") {
result = wrapWidget(parseLabelWidget<WTime>(node));
} else if (nodeName == "RecordingDuration") {
// result = wrapWidget(parseLabelWidget<WRecordingDuration>(node));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove unused code

Comment thread src/widget/wrecordingduration.cpp Outdated
}

void WRecordingDuration::refreshLabelText(QString durationRecorded) {
m_durationRecordedStr = durationRecorded;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

m_durationRecordedStr is unused

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will change. As I learned durationRecorded can be passed to setText directly if it shouldn't be stored for any other purpose.
Also I would like to clear the label when recording is stopped, so it doesn't show last duration when started again.

@daschuer
Copy link
Copy Markdown
Member

I have added some minor comments. The rest LGTM.
The update behavior is an issue of the recording manager signaling the updates.

@ronso0
Copy link
Copy Markdown
Member Author

ronso0 commented Mar 24, 2017

Okay, done.

New widget <RecordingDuration> is a Label that shows current recording's duration.
When no recording is active it shows --:--, then it takes 1-2 seconds until duration is shown.

@ronso0
Copy link
Copy Markdown
Member Author

ronso0 commented Mar 24, 2017

I will add info to the wiki when this is merged.

Comment thread src/widget/wrecordingduration.cpp Outdated
void WRecordingDuration::refreshLabelText(QString durationRecorded) {
m_durationRecordedStr = durationRecorded;
setText(m_durationRecordedStr);
void WRecordingDuration::clearLabel(bool toggle) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Th function name is misleading. It is more like "clearLebleIfInactive()" or "slotRecordingActivChanged()"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

because it's not really cleared, just cleared from rec duration. okay.
slotReccordingInactive?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes!

@daschuer
Copy link
Copy Markdown
Member

LGTM. Thank you.

@daschuer daschuer merged commit 8f06a2b into mixxxdj:master Mar 25, 2017
@ronso0 ronso0 deleted the RecordingDuration-widget branch March 25, 2017 15:31
@ronso0
Copy link
Copy Markdown
Member Author

ronso0 commented Mar 25, 2017

Cool! Added the info to the wiki.

connect(m_pRecordingManager, SIGNAL(durationRecorded(QString)),
this, SLOT(refreshLabel(QString)));
connect(m_pRecordingManager, SIGNAL(isRecording(bool)),
this, SLOT(slotReccordingInactive(bool)));
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.

Typo? slotReccordingInactive -> slotRecordingInactive

void WRecordingDuration::slotReccordingInactive(bool isRecording) {
// If recording is stopped/inactive
if(!isRecording) {
setText("--:--");
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.

Our other text widgets provide translatable tooltips, can you add one for <RecordingDuration> too?


private slots:
void refreshLabel(QString);
void slotReccordingInactive(bool);
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.

Typo?

@@ -0,0 +1,28 @@
// wrecordingduration.h
// WRecordingDuration is a widget showing the duration of running recoding
Copy link
Copy Markdown
Contributor

@esbrandt esbrandt Mar 25, 2017

Choose a reason for hiding this comment

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

Typo? recoding-> recording

this, SLOT(slotReccordingInactive(bool)));
}

void WRecordingDuration::slotReccordingInactive(bool isRecording) {
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.

Typo?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, same typo as above, that's why it compiles fine...
Noticed it doesn't have a tooltip when adding wiki info.
Will add one and correct the typos.

@esbrandt esbrandt mentioned this pull request Jun 24, 2017
37 tasks
@Be-ing
Copy link
Copy Markdown
Contributor

Be-ing commented Nov 20, 2017

Thanks for working on this. It serves as a nice timer to let me know how long my set has gone. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants