diff options
-rw-r--r-- | indra/newview/llfloaterfacebook.cpp | 67 | ||||
-rw-r--r-- | indra/newview/llfloaterfacebook.h | 11 | ||||
-rw-r--r-- | indra/newview/llfloaterflickr.cpp | 44 | ||||
-rw-r--r-- | indra/newview/llfloaterflickr.h | 6 | ||||
-rw-r--r-- | indra/newview/llfloatertwitter.cpp | 65 | ||||
-rw-r--r-- | indra/newview/llfloatertwitter.h | 9 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_facebook_photo.xml | 16 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_twitter_photo.xml | 16 |
8 files changed, 215 insertions, 19 deletions
diff --git a/indra/newview/llfloaterfacebook.cpp b/indra/newview/llfloaterfacebook.cpp index de849b6b3f..5589d4897d 100644 --- a/indra/newview/llfloaterfacebook.cpp +++ b/indra/newview/llfloaterfacebook.cpp @@ -34,6 +34,7 @@ #include "llcheckboxctrl.h" #include "llcombobox.h" #include "llfacebookconnect.h" +#include "llfloaterbigpreview.h" #include "llfloaterreg.h" #include "lliconctrl.h" #include "llimagefiltersmanager.h" @@ -185,15 +186,18 @@ LLFacebookPhotoPanel::LLFacebookPhotoPanel() : mSnapshotPanel(NULL), mResolutionComboBox(NULL), mRefreshBtn(NULL), +mBtnPreview(NULL), mWorkingLabel(NULL), mThumbnailPlaceholder(NULL), mCaptionTextBox(NULL), mLocationCheckbox(NULL), mPostButton(NULL), +mBigPreviewFloater(NULL), mQuality(MAX_QUALITY) { mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLFacebookPhotoPanel::onSend, this)); mCommitCallbackRegistrar.add("SocialSharing.RefreshPhoto", boost::bind(&LLFacebookPhotoPanel::onClickNewSnapshot, this)); + mCommitCallbackRegistrar.add("SocialSharing.BigPreview", boost::bind(&LLFacebookPhotoPanel::onClickBigPreview, this)); } LLFacebookPhotoPanel::~LLFacebookPhotoPanel() @@ -215,12 +219,14 @@ BOOL LLFacebookPhotoPanel::postBuild() mFilterComboBox = getChild<LLUICtrl>("filters_combobox"); mFilterComboBox->setCommitCallback(boost::bind(&LLFacebookPhotoPanel::updateResolution, this, TRUE)); mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn"); + mBtnPreview = getChild<LLButton>("big_preview_btn"); mWorkingLabel = getChild<LLUICtrl>("working_lbl"); mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder"); mCaptionTextBox = getChild<LLUICtrl>("photo_caption"); mLocationCheckbox = getChild<LLUICtrl>("add_location_cb"); mPostButton = getChild<LLUICtrl>("post_photo_btn"); mCancelButton = getChild<LLUICtrl>("cancel_photo_btn"); + mBigPreviewFloater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview")); // Update filter list std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList(); @@ -272,9 +278,20 @@ void LLFacebookPhotoPanel::draw() mResolutionComboBox->setEnabled(no_ongoing_connection); mFilterComboBox->setEnabled(no_ongoing_connection); mRefreshBtn->setEnabled(no_ongoing_connection); + mBtnPreview->setEnabled(no_ongoing_connection); mLocationCheckbox->setEnabled(no_ongoing_connection); + + // Reassign the preview floater if we have the focus and the preview exists + if (hasFocus() && isPreviewVisible()) + { + attachPreview(); + } + + // Toggle the button state as appropriate + bool preview_active = (isPreviewVisible() && mBigPreviewFloater->isFloaterOwner(getParentByType<LLFloater>())); + mBtnPreview->setToggleState(preview_active); - // Display the preview if one is available + // Display the thumbnail if one is available if (previewp && previewp->getThumbnailImage()) { const LLRect& thumbnail_rect = mThumbnailPlaceholder->getRect(); @@ -365,6 +382,35 @@ void LLFacebookPhotoPanel::onClickNewSnapshot() } } +void LLFacebookPhotoPanel::onClickBigPreview() +{ + // Toggle the preview + if (isPreviewVisible()) + { + LLFloaterReg::hideInstance("big_preview"); + } + else + { + attachPreview(); + LLFloaterReg::showInstance("big_preview"); + } +} + +bool LLFacebookPhotoPanel::isPreviewVisible() +{ + return (mBigPreviewFloater && mBigPreviewFloater->getVisible()); +} + +void LLFacebookPhotoPanel::attachPreview() +{ + if (mBigPreviewFloater) + { + LLSnapshotLivePreview* previewp = getPreviewView(); + mBigPreviewFloater->setPreview(previewp); + mBigPreviewFloater->setFloaterOwner(getParentByType<LLFloater>()); + } +} + void LLFacebookPhotoPanel::onSend() { LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookPhotoPanel"); // just in case it is already listening @@ -439,6 +485,10 @@ void LLFacebookPhotoPanel::clearAndClose() if (floater) { floater->closeFloater(); + if (mBigPreviewFloater) + { + mBigPreviewFloater->closeOnFloaterOwnerClosing(floater); + } } } @@ -964,8 +1014,23 @@ LLFloaterFacebook::LLFloaterFacebook(const LLSD& key) : LLFloater(key), mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterFacebook::onCancel, this)); } +void LLFloaterFacebook::onClose(bool app_quitting) +{ + LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview")); + if (big_preview_floater) + { + big_preview_floater->closeOnFloaterOwnerClosing(this); + } + LLFloater::onClose(app_quitting); +} + void LLFloaterFacebook::onCancel() { + LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview")); + if (big_preview_floater) + { + big_preview_floater->closeOnFloaterOwnerClosing(this); + } closeFloater(); } diff --git a/indra/newview/llfloaterfacebook.h b/indra/newview/llfloaterfacebook.h index 20c401d0c1..08c5f24e4d 100644 --- a/indra/newview/llfloaterfacebook.h +++ b/indra/newview/llfloaterfacebook.h @@ -35,6 +35,7 @@ class LLIconCtrl; class LLCheckBoxCtrl; class LLSnapshotLivePreview; class LLAvatarList; +class LLFloaterBigPreview; class LLFacebookStatusPanel : public LLPanel { @@ -65,6 +66,7 @@ public: LLSnapshotLivePreview* getPreviewView(); void onVisibilityChange(const LLSD& new_visibility); + void onClickBigPreview(); void onClickNewSnapshot(); void onSend(); S32 notify(const LLSD& info); @@ -79,6 +81,9 @@ public: LLUICtrl* getRefreshBtn(); private: + bool isPreviewVisible(); + void attachPreview(); + LLHandle<LLView> mPreviewHandle; LLUICtrl * mSnapshotPanel; @@ -90,7 +95,10 @@ private: LLUICtrl * mCaptionTextBox; LLUICtrl * mLocationCheckbox; LLUICtrl * mPostButton; - LLUICtrl* mCancelButton; + LLUICtrl * mCancelButton; + LLButton * mBtnPreview; + + LLFloaterBigPreview * mBigPreviewFloater; S32 mQuality; // Compression quality }; @@ -167,6 +175,7 @@ public: LLFloaterFacebook(const LLSD& key); BOOL postBuild(); void draw(); + void onClose(bool app_quitting); void onCancel(); void showPhotoPanel(); diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp index e93adf1570..16aab09396 100644 --- a/indra/newview/llfloaterflickr.cpp +++ b/indra/newview/llfloaterflickr.cpp @@ -74,6 +74,7 @@ mDescriptionTextBox(NULL), mLocationCheckbox(NULL), mTagsTextBox(NULL), mRatingComboBox(NULL), +mBigPreviewFloater(NULL), mPostButton(NULL) { mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLFlickrPhotoPanel::onSend, this)); @@ -110,6 +111,7 @@ BOOL LLFlickrPhotoPanel::postBuild() mRatingComboBox = getChild<LLUICtrl>("rating_combobox"); mPostButton = getChild<LLUICtrl>("post_photo_btn"); mCancelButton = getChild<LLUICtrl>("cancel_photo_btn"); + mBigPreviewFloater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview")); // Update filter list std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList(); @@ -167,9 +169,14 @@ void LLFlickrPhotoPanel::draw() mBtnPreview->setEnabled(no_ongoing_connection); mLocationCheckbox->setEnabled(no_ongoing_connection); + // Reassign the preview floater if we have the focus and the preview exists + if (hasFocus() && isPreviewVisible()) + { + attachPreview(); + } + // Toggle the button state as appropriate - LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview")); - bool preview_active = (big_preview_floater && big_preview_floater->getVisible() && big_preview_floater->isFloaterOwner(getParentByType<LLFloater>())); + bool preview_active = (isPreviewVisible() && mBigPreviewFloater->isFloaterOwner(getParentByType<LLFloater>())); mBtnPreview->setToggleState(preview_active); // Display the preview if one is available @@ -263,25 +270,33 @@ void LLFlickrPhotoPanel::onClickNewSnapshot() void LLFlickrPhotoPanel::onClickBigPreview() { - LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview")); - bool preview_active = (big_preview_floater && big_preview_floater->getVisible() && big_preview_floater->isFloaterOwner(getParentByType<LLFloater>())); // Toggle the preview - if (preview_active) + if (isPreviewVisible()) { LLFloaterReg::hideInstance("big_preview"); } else { - if (big_preview_floater) - { - LLSnapshotLivePreview* previewp = getPreviewView(); - big_preview_floater->setPreview(previewp); - big_preview_floater->setFloaterOwner(getParentByType<LLFloater>()); - } + attachPreview(); LLFloaterReg::showInstance("big_preview"); } } +bool LLFlickrPhotoPanel::isPreviewVisible() +{ + return (mBigPreviewFloater && mBigPreviewFloater->getVisible()); +} + +void LLFlickrPhotoPanel::attachPreview() +{ + if (mBigPreviewFloater) + { + LLSnapshotLivePreview* previewp = getPreviewView(); + mBigPreviewFloater->setPreview(previewp); + mBigPreviewFloater->setFloaterOwner(getParentByType<LLFloater>()); + } +} + void LLFlickrPhotoPanel::onSend() { LLEventPumps::instance().obtain("FlickrConnectState").stopListening("LLFlickrPhotoPanel"); // just in case it is already listening @@ -371,12 +386,11 @@ void LLFlickrPhotoPanel::clearAndClose() LLFloater* floater = getParentByType<LLFloater>(); if (floater) { - LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview")); - if (big_preview_floater) + floater->closeFloater(); + if (mBigPreviewFloater) { - big_preview_floater->closeOnFloaterOwnerClosing(floater); + mBigPreviewFloater->closeOnFloaterOwnerClosing(floater); } - floater->closeFloater(); } } diff --git a/indra/newview/llfloaterflickr.h b/indra/newview/llfloaterflickr.h index 8a346c3166..7a5453d32a 100644 --- a/indra/newview/llfloaterflickr.h +++ b/indra/newview/llfloaterflickr.h @@ -34,6 +34,7 @@ class LLIconCtrl; class LLCheckBoxCtrl; class LLSnapshotLivePreview; +class LLFloaterBigPreview; class LLFlickrPhotoPanel : public LLPanel { @@ -61,6 +62,9 @@ public: LLUICtrl* getRefreshBtn(); private: + bool isPreviewVisible(); + void attachPreview(); + LLHandle<LLView> mPreviewHandle; LLUICtrl * mSnapshotPanel; @@ -77,6 +81,8 @@ private: LLUICtrl * mPostButton; LLUICtrl * mCancelButton; LLButton * mBtnPreview; + + LLFloaterBigPreview * mBigPreviewFloater; }; class LLFlickrAccountPanel : public LLPanel diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp index e9db6e01dd..0b2987a3c1 100644 --- a/indra/newview/llfloatertwitter.cpp +++ b/indra/newview/llfloatertwitter.cpp @@ -34,6 +34,7 @@ #include "llcheckboxctrl.h" #include "llcombobox.h" #include "lltwitterconnect.h" +#include "llfloaterbigpreview.h" #include "llfloaterreg.h" #include "lliconctrl.h" #include "llimagefiltersmanager.h" @@ -66,16 +67,19 @@ LLTwitterPhotoPanel::LLTwitterPhotoPanel() : mSnapshotPanel(NULL), mResolutionComboBox(NULL), mRefreshBtn(NULL), +mBtnPreview(NULL), mWorkingLabel(NULL), mThumbnailPlaceholder(NULL), mStatusCounterLabel(NULL), mStatusTextBox(NULL), mLocationCheckbox(NULL), mPhotoCheckbox(NULL), +mBigPreviewFloater(NULL), mPostButton(NULL) { mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLTwitterPhotoPanel::onSend, this)); mCommitCallbackRegistrar.add("SocialSharing.RefreshPhoto", boost::bind(&LLTwitterPhotoPanel::onClickNewSnapshot, this)); + mCommitCallbackRegistrar.add("SocialSharing.BigPreview", boost::bind(&LLTwitterPhotoPanel::onClickBigPreview, this)); } LLTwitterPhotoPanel::~LLTwitterPhotoPanel() @@ -97,6 +101,7 @@ BOOL LLTwitterPhotoPanel::postBuild() mFilterComboBox = getChild<LLUICtrl>("filters_combobox"); mFilterComboBox->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::updateResolution, this, TRUE)); mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn"); + mBtnPreview = getChild<LLButton>("big_preview_btn"); mWorkingLabel = getChild<LLUICtrl>("working_lbl"); mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder"); mStatusCounterLabel = getChild<LLUICtrl>("status_counter_label"); @@ -108,6 +113,7 @@ BOOL LLTwitterPhotoPanel::postBuild() mPhotoCheckbox->setCommitCallback(boost::bind(&LLTwitterPhotoPanel::onAddPhotoToggled, this)); mPostButton = getChild<LLUICtrl>("post_photo_btn"); mCancelButton = getChild<LLUICtrl>("cancel_photo_btn"); + mBigPreviewFloater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview")); // Update filter list std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList(); @@ -160,6 +166,7 @@ void LLTwitterPhotoPanel::draw() mResolutionComboBox->setEnabled(no_ongoing_connection && photo_checked); mFilterComboBox->setEnabled(no_ongoing_connection && photo_checked); mRefreshBtn->setEnabled(no_ongoing_connection && photo_checked); + mBtnPreview->setEnabled(no_ongoing_connection); mLocationCheckbox->setEnabled(no_ongoing_connection); mPhotoCheckbox->setEnabled(no_ongoing_connection); @@ -167,6 +174,16 @@ void LLTwitterPhotoPanel::draw() bool add_photo = mPhotoCheckbox->getValue().asBoolean(); updateStatusTextLength(false); + // Reassign the preview floater if we have the focus and the preview exists + if (hasFocus() && isPreviewVisible()) + { + attachPreview(); + } + + // Toggle the button state as appropriate + bool preview_active = (isPreviewVisible() && mBigPreviewFloater->isFloaterOwner(getParentByType<LLFloater>())); + mBtnPreview->setToggleState(preview_active); + // Display the preview if one is available if (previewp && previewp->getThumbnailImage()) { @@ -268,6 +285,35 @@ void LLTwitterPhotoPanel::onClickNewSnapshot() } } +void LLTwitterPhotoPanel::onClickBigPreview() +{ + // Toggle the preview + if (isPreviewVisible()) + { + LLFloaterReg::hideInstance("big_preview"); + } + else + { + attachPreview(); + LLFloaterReg::showInstance("big_preview"); + } +} + +bool LLTwitterPhotoPanel::isPreviewVisible() +{ + return (mBigPreviewFloater && mBigPreviewFloater->getVisible()); +} + +void LLTwitterPhotoPanel::attachPreview() +{ + if (mBigPreviewFloater) + { + LLSnapshotLivePreview* previewp = getPreviewView(); + mBigPreviewFloater->setPreview(previewp); + mBigPreviewFloater->setFloaterOwner(getParentByType<LLFloater>()); + } +} + void LLTwitterPhotoPanel::onSend() { LLEventPumps::instance().obtain("TwitterConnectState").stopListening("LLTwitterPhotoPanel"); // just in case it is already listening @@ -359,6 +405,10 @@ void LLTwitterPhotoPanel::clearAndClose() if (floater) { floater->closeFloater(); + if (mBigPreviewFloater) + { + mBigPreviewFloater->closeOnFloaterOwnerClosing(floater); + } } } @@ -672,8 +722,23 @@ LLFloaterTwitter::LLFloaterTwitter(const LLSD& key) : LLFloater(key), mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterTwitter::onCancel, this)); } +void LLFloaterTwitter::onClose(bool app_quitting) +{ + LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview")); + if (big_preview_floater) + { + big_preview_floater->closeOnFloaterOwnerClosing(this); + } + LLFloater::onClose(app_quitting); +} + void LLFloaterTwitter::onCancel() { + LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview")); + if (big_preview_floater) + { + big_preview_floater->closeOnFloaterOwnerClosing(this); + } closeFloater(); } diff --git a/indra/newview/llfloatertwitter.h b/indra/newview/llfloatertwitter.h index bb88557ad8..659ab7779a 100644 --- a/indra/newview/llfloatertwitter.h +++ b/indra/newview/llfloatertwitter.h @@ -34,6 +34,7 @@ class LLIconCtrl; class LLCheckBoxCtrl; class LLSnapshotLivePreview; +class LLFloaterBigPreview; class LLTwitterPhotoPanel : public LLPanel { @@ -48,6 +49,7 @@ public: void onVisibilityChange(const LLSD& new_visibility); void onAddLocationToggled(); void onAddPhotoToggled(); + void onClickBigPreview(); void onClickNewSnapshot(); void onSend(); S32 notify(const LLSD& info); @@ -63,6 +65,9 @@ public: LLUICtrl* getRefreshBtn(); private: + bool isPreviewVisible(); + void attachPreview(); + LLHandle<LLView> mPreviewHandle; LLUICtrl * mSnapshotPanel; @@ -77,7 +82,10 @@ private: LLUICtrl * mPhotoCheckbox; LLUICtrl * mPostButton; LLUICtrl * mCancelButton; + LLButton * mBtnPreview; + LLFloaterBigPreview * mBigPreviewFloater; + std::string mOldStatusText; }; @@ -115,6 +123,7 @@ public: LLFloaterTwitter(const LLSD& key); BOOL postBuild(); void draw(); + void onClose(bool app_quitting); void onCancel(); void showPhotoPanel(); 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 0cde43a20c..1d826fdbe1 100644 --- a/indra/newview/skins/default/xui/en/panel_facebook_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_facebook_photo.xml @@ -86,7 +86,7 @@ text_color="EmphasisColor" height="14" top_pad="-19" - left_pad="-20" + left_pad="-30" length="1" halign="center" name="working_lbl" @@ -96,6 +96,20 @@ width="150"> Refreshing... </text> + <button + follows="right|top" + height="23" + label="Preview" + left="200" + top_pad="-19" + name="big_preview_btn" + tool_tip="Click to toggle preview" + is_toggle="true" + visible="true" + width="100" > + <button.commit_callback + function="SocialSharing.BigPreview" /> + </button> <text length="1" follows="top|left|right" 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 bcec09ebab..c2be56da21 100644 --- a/indra/newview/skins/default/xui/en/panel_twitter_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_twitter_photo.xml @@ -138,7 +138,7 @@ text_color="EmphasisColor" height="14" top_pad="-19" - left_pad="-20" + left_pad="-30" length="1" halign="center" name="working_lbl" @@ -148,6 +148,20 @@ width="150"> Refreshing... </text> + <button + follows="right|top" + height="23" + label="Preview" + left="200" + top_pad="-19" + name="big_preview_btn" + tool_tip="Click to toggle preview" + is_toggle="true" + visible="true" + width="100" > + <button.commit_callback + function="SocialSharing.BigPreview" /> + </button> </layout_panel> <layout_panel name="photo_button_panel" |