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

XML config files for Live Broadcasting preferences #1283

Closed
wants to merge 40 commits into from
Closed

XML config files for Live Broadcasting preferences #1283

wants to merge 40 commits into from

Conversation

Palakis
Copy link
Contributor

@Palakis Palakis commented Jun 15, 2017

These contributions add an XML settings system for Live Broadcasting settings which allows management of several named sets of settings (a.k.a "profiles").

This is phase 1 out of 2 of my GSoC project for Mixxx to add multi-broadcasting to Mixxx (being able to stream to several servers simultaneously). Each broadcasting output will have its own profile

This PR aims to implement this subsystem into Mixxx while keep the current Live Broadcasting preferences UI, which will be refactored in phase 2. Settings are saved in an XML document named Default Profile.bcp.xml located in the broadcast_profiles subfolder of Mixxx's settings folder.

Tasks:

  • Implement the BroadcastProfile class:
    • Basic structure
    • XML read/write code
    • Validate proper functioning
    • Write unit tests
  • Refactor the BroadcastSettings class
    • Make sure only one instance of BroadcastSettings exists
    • QList of BroadcastProfile instances
    • List profiles from filesystem
  • Automatic upgrade from legacy Live Broadcasting preferences format (in mixxx.cfg) to new XML engine

Palakis added 12 commits June 2, 2017 14:45
I initially forgot to add broadcastprofile.cpp into the list
of source files in build/depends.py, so I didn't noticed all the
errors and mistakes I've made while writing this earlier.
This commit aims to fix these errors and have the BroadcastProfile
class to build.
No idea if this works. I just want to make sure it is saved
somewhere out of my computer.
I may squash this with other commits later.
Both ways didn't handled the document's root tag.
Now, profile values are saved properly.
@Palakis Palakis mentioned this pull request Jun 15, 2017
9 tasks
@Palakis Palakis changed the title [WIP] XML engine to save Live Broadcasting settings [WIP] XML config files for Live Broadcasting preferences Jun 15, 2017
@@ -6,14 +6,15 @@
#include "engine/sidechain/enginesidechain.h"
#include "soundio/soundmanager.h"

BroadcastManager::BroadcastManager(UserSettingsPointer pConfig,
BroadcastManager::BroadcastManager(SettingsManagerPointer pSettingsManager,
Copy link
Member

@daschuer daschuer Jun 15, 2017

Choose a reason for hiding this comment

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

since you do not store the pointer, you should pass it as plain pointer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@daschuer Same when passing it to DlgPreferences?

Copy link
Member

Choose a reason for hiding this comment

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

Yes. Shard pointer for shared ownership. With a plain pointer parameter, the function promises not to store the pointer.

Copy link
Contributor Author

@Palakis Palakis Jun 15, 2017

Choose a reason for hiding this comment

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

@daschuer Okay. If thinking this way, I think I should use shared pointers for BroadcastProfile instances.

{
EncoderBroadcastSettings::EncoderBroadcastSettings(
BroadcastSettingsPointer settings) :
m_settings(settings) {
Copy link
Member

Choose a reason for hiding this comment

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

Style nit:

EncoderBroadcastSettings::EncoderBroadcastSettings(
        BroadcastSettingsPointer settings) 
        : m_settings(settings) {

Palakis added 6 commits June 15, 2017 22:00
This isn't needed in the current state of the code.
These additions automatically fetches existing
Live Broadcasting preferences from mixxx.cfg, puts
them in the Default Profile and removes the now
useless keys from mixxx.cfg
@daschuer
Copy link
Member

Nice, please give a hint when this is worth to test manually.

@sblaisot
Copy link
Member

sblaisot commented Jun 16, 2017

probably you need to take a look at upgrade.cpp/.h.
This is where migrating from old preference style to new ones should reside.

return nullptr;

QString profileName = xmlFile.baseName();
BroadcastProfile* profile = new BroadcastProfile(profileName);
Copy link
Member

Choose a reason for hiding this comment

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

here you should use std::make_unique<> and return the BroadcastProfilePtr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

@daschuer
Copy link
Member

daschuer commented Jun 21, 2017 via email

@Palakis
Copy link
Contributor Author

Palakis commented Jun 21, 2017

I forgot to connect BroadcastProfile::profileNameChanged to BroadcastSettings::onProfileNameChanged. Since std::unique_ptr is not compatible with Qt's object system, I replaced it with QSharedPointer, as it is easy to pass around.

Palakis added 2 commits June 21, 2017 11:58
…t call

BroadcastProfile notifies name changes to BroadcastSettings with Qt's signals &
slots system. However Qt is not compatible with the std::unique_ptr smart
pointer. A refactor of BroadcastProfilePtr is required to make it compatible.
std::unique_ptr has been replaced with QSharedPointer, as this type is easy
to pass around in the code while keeping a reference to the original pointer
and deleting it when not used anymore.
@daschuer
Copy link
Member

daschuer commented Jun 21, 2017

Loading resources from "/home/daniel/workspace/advanced_autodj_2/res/"
src/test/broadcastprofile_test.cpp:47: Failure
Value of: BroadcastProfile::validName( invalidProfile.getProfileName())
Actual: false
Expected: true
[ FAILED ] BroadcastProfileTest.ForbiddenChars (1 ms)

Else it works nice. Thank you.

@Palakis
Copy link
Contributor Author

Palakis commented Jun 21, 2017

@daschuer Did you tried with the latest changes? This assert call was removed in one of them.

@daschuer
Copy link
Member

I have rebuid and tested it again, and it still fails. Is it a linux only issue?

@Palakis
Copy link
Contributor Author

Palakis commented Jun 22, 2017

My bad, I was supposed to remove validProfile and invalidProfile in the previous commit, since those are deprecated because the profile name isn't stripped of forbidden chars anymore.

@daschuer
Copy link
Member

This looks goo to me so far, is there anything left to do in this branch?

@Palakis
Copy link
Contributor Author

Palakis commented Jun 22, 2017

@daschuer Not much left to do: making sure it is ready for handling several broadcasting outputs/profiles.
One way I can come up with is to remove setCurrentProfile and getCurrentProfile (which won't be of use for multi-broadcasting), turn BroadcastSettings into a Qt read-only model and implement an overload of QAbstractItemModel::data that directly returns a BroadcastProfilePtr instead of a QVariant. This way I can get profiles by index and replace calls to getCurrentProfile with data.

@Palakis Palakis changed the title [WIP] XML config files for Live Broadcasting preferences XML config files for Live Broadcasting preferences Jun 23, 2017
@Palakis
Copy link
Contributor Author

Palakis commented Jun 24, 2017

I believe there's nothing left to do on this. As usual, I'm open for comments on these contributions!
More additions are needed in BroadcastSettings for multi-broadcasting (e.g. : a method to rename a profile), but I believe those will come during phase 2 of GSoC. I'll also work on unit tests for BroadcastSettings.

@daschuer
Copy link
Member

Fine, am happy with this as well so you can merge it to your GSoC branch and advance to the next PR.
Thank you for the work so far. :-)

@Palakis Palakis mentioned this pull request Jul 3, 2017
19 tasks
@Be-ing
Copy link
Contributor

Be-ing commented Jul 25, 2017

Should this PR be closed?

@Palakis
Copy link
Contributor Author

Palakis commented Jul 25, 2017

Yes, absolutely. Work continues in #1300.

@Palakis Palakis closed this Jul 25, 2017
@Palakis Palakis deleted the xml-broadcasting-settings branch July 25, 2017 16:55
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