Several fixes to the volume pulldown panel / floater:

* Fixed warning about missing callback "Pref.setControlFalse"
* Fixed warning about missing callback "Pref.SetSounds"
* Fixed warning about missing callback "Pref.updateMediaAutoPlayCheckbox"
* Added FSFloaterVolumeControl class
* Renamed floater_volume_controls.xml to floater_fs_volume_controls.xml to adhere FS naming scheme since it's a Firestorm specific file
* Fixed volume expand button show correct chevron depending on visibility of volume control floater in Vintage skin
Ansariel 2013-03-15 11:43:18 +01:00
parent 174a6b33dd
commit 683e0ef604
15 changed files with 203 additions and 50 deletions

View File

@ -131,6 +131,7 @@ set(viewer_SOURCE_FILES
fsfloaterprofile.cpp
fsfloatersearch.cpp
fsfloaterteleporthistory.cpp
fsfloatervolumecontrols.cpp
fsfloaterwsassetblacklist.cpp
fsgrouptitles.cpp
fskeywords.cpp
@ -781,6 +782,7 @@ set(viewer_HEADER_FILES
fsfloaterprofile.h
fsfloatersearch.h
fsfloaterteleporthistory.h
fsfloatervolumecontrols.h
fsfloaterwsassetblacklist.h
fsgridhandler.h
fsgrouptitles.h

View File

@ -0,0 +1,99 @@
/**
* @file fsfloatervolumecontrols.cpp
* @brief Class for the standalone volume controls floater in Firestorm
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Phoenix Firestorm Viewer Source Code
* Copyright (c) 2013 Ansariel Hiller @ Second Life
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
* http://www.firestormviewer.org
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "fsfloatervolumecontrols.h"
#include "llcheckboxctrl.h"
#include "llfloaterreg.h"
#include "llpanel.h"
#include "lltabcontainer.h"
#include "llfloaterpreference.h"
#include "utilitybar.h"
#include "llviewercontrol.h"
FSFloaterVolumeControls::FSFloaterVolumeControls(const LLSD& key)
: LLFloater(key)
{
mCommitCallbackRegistrar.add("Vol.GoAudioPrefs", boost::bind(&FSFloaterVolumeControls::onAudioPrefsButtonClicked, this));
mCommitCallbackRegistrar.add("Vol.setControlFalse", boost::bind(&FSFloaterVolumeControls::setControlFalse, this, _2));
mCommitCallbackRegistrar.add("Vol.SetSounds", boost::bind(&FSFloaterVolumeControls::setSounds, this));
}
FSFloaterVolumeControls::~FSFloaterVolumeControls()
{
}
BOOL FSFloaterVolumeControls::postBuild()
{
return TRUE;
}
// virtual
void FSFloaterVolumeControls::handleVisibilityChange(BOOL new_visibility)
{
UtilityBar::instance().setVolumeControlsButtonExpanded(new_visibility);
LLFloater::handleVisibilityChange(new_visibility);
}
void FSFloaterVolumeControls::onAudioPrefsButtonClicked()
{
// bring up the prefs floater
LLFloaterPreference* prefsfloater = LLFloaterReg::showTypedInstance<LLFloaterPreference>("preferences");
if (prefsfloater)
{
// grab the 'audio' panel from the preferences floater and
// bring it the front!
LLTabContainer* tabcontainer = prefsfloater->getChild<LLTabContainer>("pref core");
LLPanel* audiopanel = prefsfloater->getChild<LLPanel>("audio");
if (tabcontainer && audiopanel)
{
tabcontainer->selectTabPanel(audiopanel);
}
}
}
void FSFloaterVolumeControls::setControlFalse(const LLSD& user_data)
{
std::string control_name = user_data.asString();
LLControlVariable* control = findControl(control_name);
if (control)
{
control->set(LLSD(FALSE));
}
}
void FSFloaterVolumeControls::setSounds()
{
// Disable Enable gesture/collisions sounds checkbox if the master sound is disabled
// or if sound effects are disabled.
getChild<LLCheckBoxCtrl>("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds"));
getChild<LLCheckBoxCtrl>("collisions_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds"));
}

View File

@ -0,0 +1,49 @@
/**
* @file fsfloatervolumecontrols.cpp
* @brief Class for the standalone volume controls floater in Firestorm
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Phoenix Firestorm Viewer Source Code
* Copyright (c) 2013 Ansariel Hiller @ Second Life
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
* http://www.firestormviewer.org
* $/LicenseInfo$
*/
#ifndef FS_FLOATERVOLUMECONTROLS_H
#define FS_FLOATERVOLUMECONTROLS_H
#include "llfloater.h"
class FSFloaterVolumeControls
: public LLFloater
{
public:
FSFloaterVolumeControls(const LLSD& key);
BOOL postBuild();
private:
~FSFloaterVolumeControls();
/*virtual*/ void handleVisibilityChange(BOOL new_visibility);
void onAudioPrefsButtonClicked();
void setControlFalse(const LLSD& user_data);
void setSounds();
};
#endif // FS_FLOATERVOLUMECONTROLS_H

View File

@ -40,6 +40,9 @@
#include "llfloaterpreference.h"
#include "llsliderctrl.h"
#include "llcheckboxctrl.h"
#include "llviewercontrol.h"
/* static */ const F32 LLPanelVolumePulldown::sAutoCloseFadeStartTimeSec = 4.0f;
/* static */ const F32 LLPanelVolumePulldown::sAutoCloseTotalTimeSec = 5.0f;
@ -54,6 +57,9 @@ LLPanelVolumePulldown::LLPanelVolumePulldown()
mCommitCallbackRegistrar.add("Vol.setControlFalse", boost::bind(&LLPanelVolumePulldown::setControlFalse, this, _2));
mCommitCallbackRegistrar.add("Vol.GoAudioPrefs", boost::bind(&LLPanelVolumePulldown::onAdvancedButtonClick, this, _2));
// <FS:Ansariel> Missing callback function
mCommitCallbackRegistrar.add("Vol.SetSounds", boost::bind(&LLPanelVolumePulldown::setSounds, this));
buildFromFile( "panel_volume_pulldown.xml");
}
@ -148,3 +154,12 @@ void LLPanelVolumePulldown::draw()
}
}
// <FS:Ansariel> Missing callback function
void LLPanelVolumePulldown::setSounds()
{
// Disable Enable gesture/collisions sounds checkbox if the master sound is disabled
// or if sound effects are disabled.
getChild<LLCheckBoxCtrl>("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds"));
getChild<LLCheckBoxCtrl>("collisions_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds"));
}
// </FS:Ansariel> Missing callback function

View File

@ -48,6 +48,8 @@ class LLPanelVolumePulldown : public LLPanel
private:
void setControlFalse(const LLSD& user_data);
void onAdvancedButtonClick(const LLSD& user_data);
// <FS:Ansariel> Missing callback function
void setSounds();
LLFrameTimer mHoverTimer;
static const F32 sAutoCloseFadeStartTimeSec;

View File

@ -155,6 +155,7 @@
#include "fsfloaterprofile.h"
#include "fsfloatersearch.h"
#include "fsfloaterteleporthistory.h"
#include "fsfloatervolumecontrols.h"
#include "fsfloaterwsassetblacklist.h"
#include "fsgrouptitles.h"
#include "fsmoneytracker.h"
@ -375,6 +376,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("fs_posestand", "floater_fs_posestand.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSFloaterPoseStand>);
LLFloaterReg::add("fs_placedetails", "floater_fs_placedetails.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSFloaterPlaceDetails>);
LLFloaterReg::add("fs_teleporthistory", "floater_fs_teleporthistory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSFloaterTeleportHistory>);
LLFloaterReg::add("fs_volume_controls", "floater_fs_volume_controls.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSFloaterVolumeControls>);
LLFloaterReg::add("group_titles", "floater_fs_group_titles.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSGroupTitles>);
LLFloaterReg::add("imcontacts", "floater_fs_contacts.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSFloaterContacts>);
LLFloaterReg::add("lgg_beamcolormap", "floater_beamcolor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<lggBeamColorMapFloater>);
@ -390,7 +392,6 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("secondary_inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>);
LLFloaterReg::add("script_recover", "floater_script_recover.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptRecover>);
LLFloaterReg::add("sound_explorer", "floater_NACL_explore_sounds.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<NACLFloaterExploreSounds>);
LLFloaterReg::add("volume_controls", "floater_volume_controls.xml", &LLFloaterReg::build<LLFloater>);
LLFloaterReg::add("ws_asset_blacklist", "floater_asset_blacklist.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSFloaterWSAssetBlacklist>);
LLFloaterReg::registerControlVariables(); // Make sure visibility and rect controls get preserved when saving

View File

@ -43,7 +43,7 @@
top="10"
volume="true">
<slider.commit_callback
function="Pref.setControlFalse"
function="Vol.setControlFalse"
parameter="MuteAudio" />
</slider>
<button
@ -75,7 +75,7 @@
top_pad="4"
volume="true">
<slider.commit_callback
function="Pref.setControlFalse"
function="Vol.setControlFalse"
parameter="MuteUI" />
</slider>
<button
@ -108,7 +108,7 @@
top_pad="4"
volume="true">
<slider.commit_callback
function="Pref.setControlFalse"
function="Vol.setControlFalse"
parameter="MuteAmbient" />
</slider>
<button
@ -151,7 +151,7 @@
top_pad="4"
volume="true">
<slider.commit_callback
function="Pref.setControlFalse"
function="Vol.setControlFalse"
parameter="MuteSounds" />
</slider>
<button
@ -166,9 +166,9 @@
left_pad="5"
name="mute_audio"
tab_stop="false"
width="16">
width="16"/>
<button.commit_callback
function="Pref.SetSounds"/>
function="Vol.SetSounds"/>
</button>
<check_box
name="gesture_audio_play_btn"
@ -197,7 +197,7 @@
top_pad="4"
volume="true">
<slider.commit_callback
function="Pref.setControlFalse"
function="Vol.setControlFalse"
parameter="MuteMusic" />
</slider>
<button
@ -221,10 +221,7 @@
left_pad="5"
name="enable_music"
top_delta="2"
width="350">
<check_box.commit_callback
function="Pref.updateMediaAutoPlayCheckbox"/>
</check_box>
width="350"/>
<slider
control_name="AudioLevelMedia"
disabled_control="MuteAudio"
@ -242,7 +239,7 @@
top_pad="4"
volume="true">
<slider.commit_callback
function="Pref.setControlFalse"
function="Vol.setControlFalse"
parameter="MuteMedia" />
</slider>
<button
@ -268,10 +265,7 @@
top_delta="2"
left_pad="5"
name="enable_media"
width="110">
<check_box.commit_callback
function="Pref.updateMediaAutoPlayCheckbox"/>
</check_box>
width="110"/>
<slider
control_name="AudioLevelVoice"
disabled_control="MuteAudio"
@ -289,7 +283,7 @@
show_text="false"
volume="true">
<slider.commit_callback
function="Pref.setControlFalse"
function="Vol.setControlFalse"
parameter="MuteVoice" />
</slider>
<button

View File

@ -42,7 +42,7 @@
top="10"
volume="true">
<slider.commit_callback
function="Pref.setControlFalse"
function="Vol.setControlFalse"
parameter="MuteAudio" />
</slider>
<button
@ -74,7 +74,7 @@
top_pad="4"
volume="true">
<slider.commit_callback
function="Pref.setControlFalse"
function="Vol.setControlFalse"
parameter="MuteUI" />
</slider>
<button
@ -107,7 +107,7 @@
top_pad="4"
volume="true">
<slider.commit_callback
function="Pref.setControlFalse"
function="Vol.setControlFalse"
parameter="MuteAmbient" />
</slider>
<button
@ -150,7 +150,7 @@
top_pad="4"
volume="true">
<slider.commit_callback
function="Pref.setControlFalse"
function="Vol.setControlFalse"
parameter="MuteSounds" />
</slider>
<button
@ -167,7 +167,7 @@
tab_stop="false"
width="16">
<button.commit_callback
function="Pref.SetSounds"/>
function="Vol.SetSounds"/>
</button>
<check_box
name="gesture_audio_play_btn"
@ -196,7 +196,7 @@
top_pad="4"
volume="true">
<slider.commit_callback
function="Pref.setControlFalse"
function="Vol.setControlFalse"
parameter="MuteMusic" />
</slider>
<button
@ -220,10 +220,7 @@
left_pad="5"
name="enable_music"
top_delta="2"
width="350">
<check_box.commit_callback
function="Pref.updateMediaAutoPlayCheckbox"/>
</check_box>
width="350"/>
<slider
control_name="AudioLevelMedia"
disabled_control="MuteAudio"
@ -241,7 +238,7 @@
top_pad="4"
volume="true">
<slider.commit_callback
function="Pref.setControlFalse"
function="Vol.setControlFalse"
parameter="MuteMedia" />
</slider>
<button
@ -267,10 +264,7 @@
top_delta="2"
left_pad="5"
name="enable_media"
width="110">
<check_box.commit_callback
function="Pref.updateMediaAutoPlayCheckbox"/>
</check_box>
width="110"/>
<slider
control_name="AudioLevelVoice"
disabled_control="MuteAudio"
@ -288,7 +282,7 @@
show_text="false"
volume="true">
<slider.commit_callback
function="Pref.setControlFalse"
function="Vol.setControlFalse"
parameter="MuteVoice" />
</slider>
<button

View File

@ -368,7 +368,7 @@
width="22">
<button.commit_callback
function="Floater.ToggleOrBringToFront"
parameter="volume_controls" />
parameter="fs_volume_controls" />
</button>
<!-- Volume controls -->

View File

@ -32,7 +32,6 @@
#include "lltabcontainer.h"
#include "llagent.h"
#include "llfloaterpreference.h"
#include "llstatusbar.h"
#include "llviewercontrol.h"
#include "llviewermedia.h"
@ -57,6 +56,7 @@ void UtilityBar::init()
mParcelMediaPlayButton = rootView->findChild<LLButton>("utility_parcel_media_button");
mTalkButton = rootView->findChild<LLButton>("utility_talk_button");
mAOInterfaceButton = rootView->findChild<LLButton>("show_ao_interface_button");
mVolumeControlsInterfaceButton = rootView->findChild<LLButton>("show_volume_controls_button");
if(mParcelStreamPlayButton)
mParcelStreamPlayButton->setCommitCallback(boost::bind(&UtilityBar::onParcelStreamClicked,this));
@ -69,8 +69,6 @@ void UtilityBar::init()
mTalkButton->setMouseUpCallback(boost::bind(&LLAgent::releaseMicrophone, _2));
}
LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Vol.GoAudioPrefs", boost::bind(&UtilityBar::onAudioPrefsButtonClicked, this));
mEventTimer.start();
}
@ -147,19 +145,17 @@ void UtilityBar::setAOInterfaceButtonExpanded(bool expanded)
}
}
void UtilityBar::onAudioPrefsButtonClicked()
void UtilityBar::setVolumeControlsButtonExpanded(bool expanded)
{
// bring up the prefs floater
LLFloaterPreference* prefsfloater = LLFloaterReg::showTypedInstance<LLFloaterPreference>("preferences");
if (prefsfloater)
if (mVolumeControlsInterfaceButton)
{
// grab the 'audio' panel from the preferences floater and
// bring it the front!
LLTabContainer* tabcontainer = prefsfloater->getChild<LLTabContainer>("pref core");
LLPanel* audiopanel = prefsfloater->getChild<LLPanel>("audio");
if (tabcontainer && audiopanel)
if (expanded)
{
tabcontainer->selectTabPanel(audiopanel);
mVolumeControlsInterfaceButton->setImageOverlay("arrow_down.tga");
}
else
{
mVolumeControlsInterfaceButton->setImageOverlay("arrow_up.tga");
}
}
}
}

View File

@ -45,16 +45,17 @@ class UtilityBar
void init();
virtual BOOL tick();
void setAOInterfaceButtonExpanded(bool expanded);
void setVolumeControlsButtonExpanded(bool expanded);
protected:
void onParcelStreamClicked();
void onParcelMediaClicked();
void onAudioPrefsButtonClicked();
LLButton* mParcelStreamPlayButton;
LLButton* mParcelMediaPlayButton;
LLButton* mTalkButton;
LLButton* mAOInterfaceButton;
LLButton* mVolumeControlsInterfaceButton;
};
#endif // UTILITYBAR_H