move MediaPlaylist to C++
ClosedPublic

Authored by astippich on Feb 3 2018, 11:49 AM.

Details

Summary

first step of optimization after the introduction of the dedicated proxy model.
already cleans up a lot of the interface and makes the Qml code easier. Performance does not seem to change much.
no functional change intended. all tests pass

Diff Detail

Repository
R255 Elisa
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
astippich requested review of this revision.Feb 3 2018, 11:49 AM
astippich created this revision.

Next step is to move ManageAudioPlayer and maybe the persistent settings to c++. One question inline.

src/qml/ElisaMainWindow.qml
99

Is this a leftover or actually needed somewhere?

astippich updated this revision to Diff 26430.Feb 3 2018, 12:34 PM
  • bring back adding files via command line
astippich updated this revision to Diff 26527.Feb 4 2018, 7:54 PM
  • properly setup random generator

This is a quite big review. I would be able to review faster if they were smaller.
I am not quite convinced by the way we go from replaceAndPlay to asking the audio player to play. As said in my comment, we should strive to avoid crossing the c++/qml frontier as much as possible. This is more efficient and better for the performance and reactivity.

src/mediaplaylist.cpp
521–537

You changed the position of the methods. This makes it very hard to review in Phabricator. Could you move it to their old positions ?

src/qml/ElisaMainWindow.qml
99

This was needed by the UPnP support. It is probably safe to remove it.

src/qml/MediaAllTracksView.qml
83–87

I am not very happy of this change. It may be a good idea to move some event handling code to c++ only but this modification goes from qml to c++ and back to qml and back to c++. This is not very efficient. It would probably be a good idea to keep this away from this diff and do it in a next review.

I'll try to reduce the scope of changes for next reviews, but it's really hard if moving complete class from Qml to C++ (with the exception of the code reordering).

src/mediaplaylist.cpp
521–537

Yeah, sorry about that. But I will do the opposite. Reorder it in master and then update this diff, since the methods should really be grouped like this.

src/qml/MediaAllTracksView.qml
83–87

My aim with this change is actually to avoid exactly that. Before, the proxy models were in C++, and the media playlist constructed in Qml.
Since the proxy models can call the enqueue method several thousand times, I think it is a good idea to move everything to C++. Currently, there is one ensurePlay signal emitted at the end and passed onto the managemediaplayercontrol in Qml. I also think that this doesn't hurt much since it is only emitted once per user interaction, e.g. if a user uses a button. It is not emitted several thousand times.

Note that I would like to move the audio control manager also to C++ as stated in the first post. Then this would be in pure C++.

astippich updated this revision to Diff 26812.Feb 9 2018, 8:33 AM
  • Merge branch 'master' into model_tuning
mgallien requested changes to this revision.Feb 9 2018, 11:16 PM

I have compiled it with clazy and it reported one problem:

../src/models/abstractmediaproxymodel.cpp:85:5: warning: Missing emit keyword on signal call MediaPlayList::ensurePlay [-Wclazy-incorrect-emit]

this->mediaPlayList()->ensurePlay();

Can you fix it ?

This revision now requires changes to proceed.Feb 9 2018, 11:16 PM
astippich planned changes to this revision.Feb 13 2018, 5:52 PM

I will put this on hold until D10402 and D10451 have landed

I will put this on hold until D10402 and D10451 have landed

Sorry for the delay. I had thought about doing it the other way. D10271 before D10402. It is your call.

I will put this on hold until D10402 and D10451 have landed

Sorry for the delay. I had thought about doing it the other way. D10271 before D10402. It is your call.

If you're fine with the approach, sure. I think it is somewhat incompatible with the changes ahead but it probably just makes a difference to who does the adaption :)

astippich updated this revision to Diff 27462.Feb 18 2018, 12:00 PM
  • fix missing Q_EMIT
  • do not emit ensurePlay signal twice
  • merge master
mgallien accepted this revision.Feb 18 2018, 4:56 PM
This revision is now accepted and ready to land.Feb 18 2018, 4:56 PM
This revision was automatically updated to reflect the committed changes.