team-phoenix / Phoenix

A multi-system emulator and library manager designed to be both powerful and easy to use.
http://phoenix.vg
GNU General Public License v2.0
377 stars 39 forks source link

Fix [ISSUE #242] - Store volume level when muting #250

Closed MaxMansfield closed 8 years ago

MaxMansfield commented 8 years ago

Brief:

This commit addresses issue #242 by allowing the original volume to be restored after a game is muted.

Changes:

1. Added `id:` of volumeItem to the Item
   which controls volume

2. Added 'muted' and 'unmuted' states to
   the volumeItem

3. Allowed the `onClicked:` signal of the
   volumeItem to switch between the two
   new states

4. Directly linked the slider to the volume
   of coreControl

5. Stored the value of the slider in volumeValue
   when it is changed and the volumeItem is not
   in the 'muted' state

6. Made the `width:` of the volumeItem more dynamic

Data:

Here's what it looks like

phoenix_issue242

athairus commented 8 years ago

Try dragging the volume handle. It causes some weird behavior! This is because setting coreControl.volume doesn't immediately result in the property changed notifier CoreControlProxy::volumeChanged() being fired. A setter is sent to another thread, and only once the other thread acknowledges it will the notifier signal get fired. So, what you get when dragging the handle is it flickering between the value set by your mouse moves and the value being set by the property binding, which is from a few ms ago.

We've avoided this bug so far because Slider won't update the value property until you let go of the handle. Please change the binding for volumeSlider.value back to volumeValue. You'll have to make another property to hold the saved volume value for when mute is activated. Might need to rework some other stuff, too.

Also on a code style note, please put semicolons at the end of your statements and pad parentheses like this: ("no") should be ( "yes" ).

athairus commented 8 years ago

This PR will no longer apply once #249 is merged.