diff options
| author | Merov Linden <merov@lindenlab.com> | 2014-01-28 19:00:46 -0800 | 
|---|---|---|
| committer | Merov Linden <merov@lindenlab.com> | 2014-01-28 19:00:46 -0800 | 
| commit | f7a90c680a007775efe0f8556c6712a08e489aab (patch) | |
| tree | c638e6ef916d01c063d1c4f873b0f80e2225009a | |
| parent | b35889a6510440692be4b7f1aa590cf645fbba90 (diff) | |
ACME-1275 : Implemented filters to the Twitter and Facebook panels
| -rw-r--r-- | indra/newview/llfloaterfacebook.cpp | 45 | ||||
| -rw-r--r-- | indra/newview/llfloaterfacebook.h | 1 | ||||
| -rw-r--r-- | indra/newview/llfloatertwitter.cpp | 45 | ||||
| -rw-r--r-- | indra/newview/llfloatertwitter.h | 1 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_facebook_photo.xml | 27 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_twitter_photo.xml | 27 | 
6 files changed, 84 insertions, 62 deletions
diff --git a/indra/newview/llfloaterfacebook.cpp b/indra/newview/llfloaterfacebook.cpp index 1cd7ecbcd8..f86b6d580a 100644 --- a/indra/newview/llfloaterfacebook.cpp +++ b/indra/newview/llfloaterfacebook.cpp @@ -36,6 +36,7 @@  #include "llfacebookconnect.h"  #include "llfloaterreg.h"  #include "lliconctrl.h" +#include "llimagefiltersmanager.h"  #include "llresmgr.h"		// LLLocale  #include "llsdserialize.h"  #include "llloadingindicator.h" @@ -207,6 +208,8 @@ BOOL LLFacebookPhotoPanel::postBuild()  	mSnapshotPanel = getChild<LLUICtrl>("snapshot_panel");  	mResolutionComboBox = getChild<LLUICtrl>("resolution_combobox");  	mResolutionComboBox->setCommitCallback(boost::bind(&LLFacebookPhotoPanel::updateResolution, this, TRUE)); +	mFilterComboBox = getChild<LLUICtrl>("filters_combobox"); +	mFilterComboBox->setCommitCallback(boost::bind(&LLFacebookPhotoPanel::updateResolution, this, TRUE));  	mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn");      mWorkingLabel = getChild<LLUICtrl>("working_lbl");  	mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder"); @@ -215,6 +218,14 @@ BOOL LLFacebookPhotoPanel::postBuild()  	mPostButton = getChild<LLUICtrl>("post_photo_btn");  	mCancelButton = getChild<LLUICtrl>("cancel_photo_btn"); +	// Update filter list +    std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList(); +	LLComboBox* filterbox = static_cast<LLComboBox *>(mFilterComboBox); +    for (U32 i = 0; i < filter_list.size(); i++) +	{ +        filterbox->add(filter_list[i]); +    } +  	return LLPanel::postBuild();  } @@ -398,33 +409,18 @@ void LLFacebookPhotoPanel::clearAndClose()  void LLFacebookPhotoPanel::updateControls()  {  	LLSnapshotLivePreview* previewp = getPreviewView(); -	BOOL got_bytes = previewp && previewp->getDataSize() > 0;  	BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); -	LLSnapshotLivePreview::ESnapshotType shot_type = (previewp ? previewp->getSnapshotType() : LLSnapshotLivePreview::SNAPSHOT_POSTCARD); - +      	// *TODO: Separate maximum size for Web images from postcards  	lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; - -	LLLocale locale(LLLocale::USER_LOCALE); -	std::string bytes_string; -	if (got_snap) -	{ -		LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); -	} - -	//getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : getString("unknown")); <---uses localized string -	getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : "unknown"); -	getChild<LLUICtrl>("file_size_label")->setColor( -		shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD  -		&& got_bytes -		&& previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); - +      	updateResolution(FALSE);  }  void LLFacebookPhotoPanel::updateResolution(BOOL do_update)  {  	LLComboBox* combobox = static_cast<LLComboBox *>(mResolutionComboBox); +	LLComboBox* filterbox = static_cast<LLComboBox *>(mFilterComboBox);  	std::string sdstring = combobox->getSelectedValue();  	LLSD sdres; @@ -434,6 +430,8 @@ void LLFacebookPhotoPanel::updateResolution(BOOL do_update)  	S32 width = sdres[0];  	S32 height = sdres[1]; +    const std::string& filter_name = filterbox->getSimple(); +  	LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get());  	if (previewp && combobox->getCurrentIndex() >= 0)  	{ @@ -470,6 +468,17 @@ void LLFacebookPhotoPanel::updateResolution(BOOL do_update)  				updateControls();  			}  		} +        // Get the old filter, compare to the current one "filter_name" and set if changed +        std::string original_filter = previewp->getFilter(); +		if (original_filter != filter_name) +		{ +            previewp->setFilter(filter_name); +			if (do_update) +			{ +                previewp->updateSnapshot(FALSE, TRUE); +				updateControls(); +			} +		}  	}  } diff --git a/indra/newview/llfloaterfacebook.h b/indra/newview/llfloaterfacebook.h index 0776f24034..04d9971332 100644 --- a/indra/newview/llfloaterfacebook.h +++ b/indra/newview/llfloaterfacebook.h @@ -81,6 +81,7 @@ private:  	LLUICtrl * mSnapshotPanel;  	LLUICtrl * mResolutionComboBox; +	LLUICtrl * mFilterComboBox;  	LLUICtrl * mRefreshBtn;  	LLUICtrl * mWorkingLabel;  	LLUICtrl * mThumbnailPlaceholder; diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp index 5e0f652264..0b20b77c19 100644 --- a/indra/newview/llfloatertwitter.cpp +++ b/indra/newview/llfloatertwitter.cpp @@ -36,6 +36,7 @@  #include "lltwitterconnect.h"  #include "llfloaterreg.h"  #include "lliconctrl.h" +#include "llimagefiltersmanager.h"  #include "llresmgr.h"		// LLLocale  #include "llsdserialize.h"  #include "llloadingindicator.h" @@ -91,6 +92,8 @@ BOOL LLTwitterPhotoPanel::postBuild()  	mSnapshotPanel = getChild<LLUICtrl>("snapshot_panel");  	mResolutionComboBox = getChild<LLUICtrl>("resolution_combobox");  	mResolutionComboBox->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::updateResolution, this, TRUE)); +	mFilterComboBox = getChild<LLUICtrl>("filters_combobox"); +	mFilterComboBox->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::updateResolution, this, TRUE));  	mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn");      mWorkingLabel = getChild<LLUICtrl>("working_lbl");  	mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder"); @@ -103,6 +106,14 @@ BOOL LLTwitterPhotoPanel::postBuild()  	mPostButton = getChild<LLUICtrl>("post_photo_btn");  	mCancelButton = getChild<LLUICtrl>("cancel_photo_btn"); +	// Update filter list +    std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList(); +	LLComboBox* filterbox = static_cast<LLComboBox *>(mFilterComboBox); +    for (U32 i = 0; i < filter_list.size(); i++) +	{ +        filterbox->add(filter_list[i]); +    } +  	return LLPanel::postBuild();  } @@ -356,33 +367,18 @@ void LLTwitterPhotoPanel::updateStatusTextLength(BOOL restore_old_status_text)  void LLTwitterPhotoPanel::updateControls()  {  	LLSnapshotLivePreview* previewp = getPreviewView(); -	BOOL got_bytes = previewp && previewp->getDataSize() > 0;  	BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); -	LLSnapshotLivePreview::ESnapshotType shot_type = (previewp ? previewp->getSnapshotType() : LLSnapshotLivePreview::SNAPSHOT_POSTCARD); - +      	// *TODO: Separate maximum size for Web images from postcards  	lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; - -	LLLocale locale(LLLocale::USER_LOCALE); -	std::string bytes_string; -	if (got_snap) -	{ -		LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); -	} - -	//getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : getString("unknown")); <---uses localized string -	getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : "unknown"); -	getChild<LLUICtrl>("file_size_label")->setColor( -		shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD  -		&& got_bytes -		&& previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); - +      	updateResolution(FALSE);  }  void LLTwitterPhotoPanel::updateResolution(BOOL do_update)  {  	LLComboBox* combobox = static_cast<LLComboBox *>(mResolutionComboBox); +	LLComboBox* filterbox = static_cast<LLComboBox *>(mFilterComboBox);  	std::string sdstring = combobox->getSelectedValue();  	LLSD sdres; @@ -392,6 +388,8 @@ void LLTwitterPhotoPanel::updateResolution(BOOL do_update)  	S32 width = sdres[0];  	S32 height = sdres[1]; +    const std::string& filter_name = filterbox->getSimple(); +  	LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get());  	if (previewp && combobox->getCurrentIndex() >= 0)  	{ @@ -424,6 +422,17 @@ void LLTwitterPhotoPanel::updateResolution(BOOL do_update)  				updateControls();  			}  		} +        // Get the old filter, compare to the current one "filter_name" and set if changed +        std::string original_filter = previewp->getFilter(); +		if (original_filter != filter_name) +		{ +            previewp->setFilter(filter_name); +			if (do_update) +			{ +                previewp->updateSnapshot(FALSE, TRUE); +				updateControls(); +			} +		}  	}  } diff --git a/indra/newview/llfloatertwitter.h b/indra/newview/llfloatertwitter.h index f267f76694..e62eda1a0e 100644 --- a/indra/newview/llfloatertwitter.h +++ b/indra/newview/llfloatertwitter.h @@ -66,6 +66,7 @@ private:  	LLUICtrl * mSnapshotPanel;  	LLUICtrl * mResolutionComboBox; +	LLUICtrl * mFilterComboBox;  	LLUICtrl * mRefreshBtn;  	LLUICtrl * mWorkingLabel;  	LLUICtrl * mThumbnailPlaceholder; diff --git a/indra/newview/skins/default/xui/en/panel_facebook_photo.xml b/indra/newview/skins/default/xui/en/panel_facebook_photo.xml index 2d46665bae..0a90d000bd 100644 --- a/indra/newview/skins/default/xui/en/panel_facebook_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_facebook_photo.xml @@ -44,19 +44,20 @@                 name="1200x630"                 value="[i1200,i630]" />              </combo_box> -            <text -             follows="left|top" -             font="SansSerifSmall" -             height="14" -             left="208" -             length="1" -             halign="right" -             name="file_size_label" -             top="9" -             type="string" -             width="50"> -              [SIZE] KB -            </text> +            <combo_box +                control_name="SocialPhotoFilters" +                follows="right|top" +                name="filters_combobox" +                tool_tip="Image filters" +                top="6" +                left="165" +                height="21" +                width="135"> +                <combo_box.item +                label="No Filter" +                name="NoFilter" +                value="NoFilter" /> +            </combo_box>              <panel                  height="150"                  width="250" diff --git a/indra/newview/skins/default/xui/en/panel_twitter_photo.xml b/indra/newview/skins/default/xui/en/panel_twitter_photo.xml index 14268c1bcf..e044dbdf55 100644 --- a/indra/newview/skins/default/xui/en/panel_twitter_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_twitter_photo.xml @@ -96,19 +96,20 @@                 name="1024x768"                 value="[i1024,i768]" />              </combo_box> -            <text -             follows="left|top" -             font="SansSerifSmall" -             height="14" -             left="208" -             length="1" -             halign="right" -             name="file_size_label" -             top="9" -             type="string" -             width="50"> -              [SIZE] KB -            </text> +              <combo_box +                  control_name="SocialPhotoFilters" +                  follows="right|top" +                  name="filters_combobox" +                  tool_tip="Image filters" +                  top="6" +                  left="165" +                  height="21" +                  width="135"> +                  <combo_box.item +                  label="No Filter" +                  name="NoFilter" +                  value="NoFilter" /> +              </combo_box>              <panel                  height="150"                  width="250"  | 
