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

FIX(client): Properly show currently selected audio device in settings dialog #4974

Conversation

davidebeatrici
Copy link
Member

Every audio backend implementation was moving the current device at the top.

This commit replaces that logic by selecting the current device in the combobox.


Before

Before

After

After

@mweinelt

This comment has been minimized.

@mweinelt
Copy link

mweinelt commented May 9, 2021

Works for me with the ALSA Backend. 👍

Copy link
Member

@Krzmbrzl Krzmbrzl left a comment

Choose a reason for hiding this comment

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

  1. Imo auto is used way too often in this PR as in many places it completely hides the type of variables. This is an important information that I want to see immediately when reading through the code.
    Using this for iterators is fine and also using it for the result of casts or as a loop variable in a ranged for. Using it for storing the value of a function is not appropriate (imo).
  2. The functions should be marked with the override keyword. Potentially this makes it necessary to prepend a REFAC commit that marks other functions with override already.

src/mumble/AudioConfigDialog.cpp Outdated Show resolved Hide resolved
src/mumble/AudioInput.h Show resolved Hide resolved
@davidebeatrici davidebeatrici force-pushed the settings-show-current-audio-device-properly branch from a761ba1 to e9a5f12 Compare May 9, 2021 18:34
@davidebeatrici
Copy link
Member Author

davidebeatrici commented May 9, 2021

  1. The functions should be marked with the override keyword. Potentially this makes it necessary to prepend a REFAC commit that marks other functions with override already.

Let's do it in a dedicated pull request, because I would also like to replace all Q_DECL_OVERRIDE instances with override.

For reference: qt/qtspeech@aa24a10

src/mumble/ASIOInput.cpp Show resolved Hide resolved
src/mumble/AudioConfigDialog.cpp Outdated Show resolved Hide resolved
src/mumble/AudioConfigDialog.cpp Outdated Show resolved Hide resolved
@@ -138,6 +138,7 @@ class AudioInputRegistrar {
AudioInputRegistrar(const QString &n, int priority = 0);
virtual ~AudioInputRegistrar();
virtual AudioInput *create() = 0;
virtual const QVariant getDeviceChoice() = 0;
Copy link
Member

Choose a reason for hiding this comment

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

We return QVariant by value, so why do we make it const?

Copy link
Member Author

Choose a reason for hiding this comment

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

For consistency with getDeviceChoices(), which returns a const list.

Copy link
Member

Choose a reason for hiding this comment

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

That also returns by value, right? In that case that doesn't seem to make too much sense either 👀

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed.

@@ -65,6 +65,7 @@ class AudioOutputRegistrar {
AudioOutputRegistrar(const QString &n, int priority = 0);
virtual ~AudioOutputRegistrar();
virtual AudioOutput *create() = 0;
virtual const QVariant getDeviceChoice() = 0;
Copy link
Member

Choose a reason for hiding this comment

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

See above

…s dialog

Every audio backend implementation was moving the current device at the top.

This commit replaces that logic by selecting the current device in the combobox.
@davidebeatrici davidebeatrici force-pushed the settings-show-current-audio-device-properly branch from e9a5f12 to 4627a83 Compare May 10, 2021 06:31
Copy link
Member

@Krzmbrzl Krzmbrzl left a comment

Choose a reason for hiding this comment

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

Ideally I think the const thing should be fixed as well (separate commit) though this is not strictly related to the changes in this PR

@davidebeatrici
Copy link
Member Author

davidebeatrici commented May 10, 2021

I honestly would leave it as it is, we don't have to change the returned variable's value anyway.

@davidebeatrici davidebeatrici merged commit 8e89110 into mumble-voip:master May 10, 2021
@davidebeatrici davidebeatrici deleted the settings-show-current-audio-device-properly branch May 10, 2021 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants