Commit 4d111568 authored by NiranV's avatar NiranV
Browse files

Removed: Obsolete files.

parent 40b47102
......@@ -507,12 +507,6 @@ set(viewer_SOURCE_FILES
llpanelprofileclassifieds.cpp
llpanelprofilepicks.cpp
llpanelpulldown.cpp
llpanelsnapshot.cpp
llpanelsnapshotinventory.cpp
llpanelsnapshotlocal.cpp
llpanelsnapshotoptions.cpp
llpanelsnapshotpostcard.cpp
llpanelsnapshotprofile.cpp
llpanelteleporthistory.cpp
llpaneltiptoast.cpp
llpanelvoiceeffect.cpp
......@@ -1158,7 +1152,6 @@ set(viewer_HEADER_FILES
llpanelprofileclassifieds.h
llpanelprofilepicks.h
llpanelpulldown.h
llpanelsnapshot.h
llpanelteleporthistory.h
llpaneltiptoast.h
llpanelvoiceeffect.h
......
/**
* @file llpanelsnapshot.cpp
* @brief Snapshot panel base class
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
*
* 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
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llpanelsnapshot.h"
// libs
#include "llcombobox.h"
#include "llfloater.h"
#include "llfloatersnapshot.h"
#include "llsliderctrl.h"
#include "llspinctrl.h"
#include "lltrans.h"
// newview
#include "llsidetraypanelcontainer.h"
#include "llviewercontrol.h" // gSavedSettings
#include "llagentbenefits.h"
const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512
S32 power_of_two(S32 sz, S32 upper)
{
S32 res = upper;
while( upper >= sz)
{
res = upper;
upper >>= 1;
}
return res;
}
LLPanelSnapshot::LLPanelSnapshot()
: mSnapshotFloater(NULL)
{}
// virtual
BOOL LLPanelSnapshot::postBuild()
{
getChild<LLUICtrl>("save_btn")->setLabelArg("[UPLOAD_COST]", std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()));
getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onResolutionComboCommit, this, _1));
if (!getWidthSpinnerName().empty())
{
getChild<LLUICtrl>(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onCustomResolutionCommit, this));
}
if (!getHeightSpinnerName().empty())
{
getChild<LLUICtrl>(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onCustomResolutionCommit, this));
}
if (!getAspectRatioCBName().empty())
{
getChild<LLUICtrl>(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onKeepAspectRatioCommit, this, _1));
}
updateControls(LLSD());
mSnapshotFloater = getParentByType<LLFloaterSnapshot>();
return TRUE;
}
// virtual
void LLPanelSnapshot::onOpen(const LLSD& key)
{
//BD
S32 old_format = gSavedSettings.getS32("SnapshotFormat");
S32 new_format = (S32) getImageFormat();
setCtrlsEnabled(true);
// Switching panels will likely change image format.
// Not updating preview right away may lead to errors,
// e.g. attempt to send a large BMP image by email.
if (old_format != new_format)
{
getParentByType<LLFloater>()->notify(LLSD().with("image-format-change", true));
}
}
LLSnapshotModel::ESnapshotFormat LLPanelSnapshot::getImageFormat() const
{
return LLSnapshotModel::SNAPSHOT_FORMAT_JPEG;
}
void LLPanelSnapshot::enableControls(BOOL enable)
{
setCtrlsEnabled(enable);
}
LLSpinCtrl* LLPanelSnapshot::getWidthSpinner()
{
llassert(!getWidthSpinnerName().empty());
return getChild<LLSpinCtrl>(getWidthSpinnerName());
}
LLSpinCtrl* LLPanelSnapshot::getHeightSpinner()
{
llassert(!getHeightSpinnerName().empty());
return getChild<LLSpinCtrl>(getHeightSpinnerName());
}
S32 LLPanelSnapshot::getTypedPreviewWidth() const
{
llassert(!getWidthSpinnerName().empty());
return getChild<LLUICtrl>(getWidthSpinnerName())->getValue().asInteger();
}
S32 LLPanelSnapshot::getTypedPreviewHeight() const
{
llassert(!getHeightSpinnerName().empty());
return getChild<LLUICtrl>(getHeightSpinnerName())->getValue().asInteger();
}
void LLPanelSnapshot::enableAspectRatioCheckbox(BOOL enable)
{
llassert(!getAspectRatioCBName().empty());
getChild<LLUICtrl>(getAspectRatioCBName())->setEnabled(enable);
}
LLSideTrayPanelContainer* LLPanelSnapshot::getParentContainer()
{
LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent());
if (!parent)
{
LL_WARNS() << "Cannot find panel container" << LL_ENDL;
return NULL;
}
return parent;
}
void LLPanelSnapshot::updateImageQualityLevel()
{
LLSliderCtrl* quality_slider = getChild<LLSliderCtrl>("image_quality_slider");
S32 quality_val = llfloor((F32) quality_slider->getValue().asReal());
std::string quality_lvl;
if (quality_val < 20)
{
quality_lvl = LLTrans::getString("snapshot_quality_very_low");
}
else if (quality_val < 40)
{
quality_lvl = LLTrans::getString("snapshot_quality_low");
}
else if (quality_val < 60)
{
quality_lvl = LLTrans::getString("snapshot_quality_medium");
}
else if (quality_val < 80)
{
quality_lvl = LLTrans::getString("snapshot_quality_high");
}
else
{
quality_lvl = LLTrans::getString("snapshot_quality_very_high");
}
getChild<LLTextBox>("image_quality_level")->setTextArg("[QLVL]", quality_lvl);
}
void LLPanelSnapshot::cancel()
{
LLSideTrayPanelContainer* parent = getParentContainer();
if (parent)
{
parent->openPreviousPanel();
parent->getCurrentPanel()->onOpen(LLSD());
}
getParentByType<LLFloater>()->notify(LLSD().with("set-ready", true));
}
void LLPanelSnapshot::onCustomResolutionCommit()
{
LLSD info;
std::string widthSpinnerName = getWidthSpinnerName();
std::string heightSpinnerName = getHeightSpinnerName();
llassert(!widthSpinnerName.empty() && !heightSpinnerName.empty());
LLSpinCtrl *widthSpinner = getChild<LLSpinCtrl>(widthSpinnerName);
LLSpinCtrl *heightSpinner = getChild<LLSpinCtrl>(heightSpinnerName);
if (getName() == "panel_snapshot_inventory")
{
S32 width = widthSpinner->getValue().asInteger();
width = power_of_two(width, MAX_TEXTURE_SIZE);
info["w"] = width;
widthSpinner->setIncrement(width >> 1);
widthSpinner->forceSetValue(width);
S32 height = heightSpinner->getValue().asInteger();
height = power_of_two(height, MAX_TEXTURE_SIZE);
heightSpinner->setIncrement(height >> 1);
heightSpinner->forceSetValue(height);
info["h"] = height;
}
else
{
info["w"] = widthSpinner->getValue().asInteger();
info["h"] = heightSpinner->getValue().asInteger();
}
getParentByType<LLFloater>()->notify(LLSD().with("custom-res-change", info));
}
void LLPanelSnapshot::onResolutionComboCommit(LLUICtrl* ctrl)
{
LLSD info;
info["combo-res-change"]["control-name"] = ctrl->getName();
getParentByType<LLFloater>()->notify(info);
}
void LLPanelSnapshot::onKeepAspectRatioCommit(LLUICtrl* ctrl)
{
getParentByType<LLFloater>()->notify(LLSD().with("keep-aspect-change", ctrl->getValue().asBoolean()));
}
LLSnapshotModel::ESnapshotType LLPanelSnapshot::getSnapshotType()
{
return LLSnapshotModel::SNAPSHOT_WEB;
}
/**
* @file llpanelsnapshot.h
* @brief Snapshot panel base class
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
*
* 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
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLPANELSNAPSHOT_H
#define LL_LLPANELSNAPSHOT_H
//#include "llfloatersnapshot.h"
#include "llpanel.h"
#include "llsnapshotmodel.h"
class LLSpinCtrl;
class LLSideTrayPanelContainer;
class LLFloaterSnapshot;
/**
* Snapshot panel base class.
*/
class LLPanelSnapshot: public LLPanel
{
public:
LLPanelSnapshot();
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
virtual std::string getWidthSpinnerName() const = 0;
virtual std::string getHeightSpinnerName() const = 0;
virtual std::string getAspectRatioCBName() const = 0;
virtual std::string getImageSizeComboName() const = 0;
virtual std::string getImageSizePanelName() const = 0;
virtual S32 getTypedPreviewWidth() const;
virtual S32 getTypedPreviewHeight() const;
virtual LLSpinCtrl* getWidthSpinner();
virtual LLSpinCtrl* getHeightSpinner();
virtual void enableAspectRatioCheckbox(BOOL enable);
virtual LLSnapshotModel::ESnapshotFormat getImageFormat() const;
virtual LLSnapshotModel::ESnapshotType getSnapshotType();
virtual void updateControls(const LLSD& info) = 0; ///< Update controls from saved settings
void enableControls(BOOL enable);
protected:
LLSideTrayPanelContainer* getParentContainer();
void updateImageQualityLevel();
void goBack(); ///< Switch to the default (Snapshot Options) panel
virtual void cancel();
// common UI callbacks
void onCustomResolutionCommit();
void onResolutionComboCommit(LLUICtrl* ctrl);
void onKeepAspectRatioCommit(LLUICtrl* ctrl);
LLFloaterSnapshot* mSnapshotFloater;
};
#endif // LL_LLPANELSNAPSHOT_H
/**
* @file llpanelsnapshotinventory.cpp
* @brief The panel provides UI for saving snapshot as an inventory texture.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
*
* 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
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llcombobox.h"
#include "llsidetraypanelcontainer.h"
#include "llspinctrl.h"
#include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model
#include "llpanelsnapshot.h"
#include "llsnapshotlivepreview.h"
#include "llviewercontrol.h" // gSavedSettings
#include "llstatusbar.h" // can_afford_transaction()
#include "llnotificationsutil.h"
#include "llagentbenefits.h"
/**
* The panel provides UI for saving snapshot as an inventory texture.
*/
class LLPanelSnapshotInventoryBase
: public LLPanelSnapshot
{
LOG_CLASS(LLPanelSnapshotInventoryBase);
public:
LLPanelSnapshotInventoryBase();
/*virtual*/ BOOL postBuild();
protected:
void onSend();
/*virtual*/ LLSnapshotModel::ESnapshotType getSnapshotType();
};
class LLPanelSnapshotInventory
: public LLPanelSnapshotInventoryBase
{
LOG_CLASS(LLPanelSnapshotInventory);
public:
LLPanelSnapshotInventory();
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
void onResolutionCommit(LLUICtrl* ctrl);
private:
/*virtual*/ std::string getWidthSpinnerName() const { return "inventory_snapshot_width"; }
/*virtual*/ std::string getHeightSpinnerName() const { return "inventory_snapshot_height"; }
/*virtual*/ std::string getAspectRatioCBName() const { return "inventory_keep_aspect_check"; }
/*virtual*/ std::string getImageSizeComboName() const { return "texture_size_combo"; }
/*virtual*/ std::string getImageSizePanelName() const { return LLStringUtil::null; }
/*virtual*/ void updateControls(const LLSD& info);
};
class LLPanelOutfitSnapshotInventory
: public LLPanelSnapshotInventoryBase
{
LOG_CLASS(LLPanelOutfitSnapshotInventory);
public:
LLPanelOutfitSnapshotInventory();
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
private:
/*virtual*/ std::string getWidthSpinnerName() const { return ""; }
/*virtual*/ std::string getHeightSpinnerName() const { return ""; }
/*virtual*/ std::string getAspectRatioCBName() const { return ""; }
/*virtual*/ std::string getImageSizeComboName() const { return "texture_size_combo"; }
/*virtual*/ std::string getImageSizePanelName() const { return LLStringUtil::null; }
/*virtual*/ void updateControls(const LLSD& info);
/*virtual*/ void cancel();
};
static LLPanelInjector<LLPanelSnapshotInventory> panel_class1("llpanelsnapshotinventory");
static LLPanelInjector<LLPanelOutfitSnapshotInventory> panel_class2("llpaneloutfitsnapshotinventory");
LLPanelSnapshotInventoryBase::LLPanelSnapshotInventoryBase()
{
}
BOOL LLPanelSnapshotInventoryBase::postBuild()
{
return LLPanelSnapshot::postBuild();
}
LLSnapshotModel::ESnapshotType LLPanelSnapshotInventoryBase::getSnapshotType()
{
return LLSnapshotModel::SNAPSHOT_TEXTURE;
}
LLPanelSnapshotInventory::LLPanelSnapshotInventory()
{
mCommitCallbackRegistrar.add("Inventory.Save", boost::bind(&LLPanelSnapshotInventory::onSend, this));
mCommitCallbackRegistrar.add("Inventory.Cancel", boost::bind(&LLPanelSnapshotInventory::cancel, this));
}
// virtual
BOOL LLPanelSnapshotInventory::postBuild()
{
getChild<LLSpinCtrl>(getWidthSpinnerName())->setAllowEdit(FALSE);
getChild<LLSpinCtrl>(getHeightSpinnerName())->setAllowEdit(FALSE);
getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onResolutionCommit, this, _1));
return LLPanelSnapshotInventoryBase::postBuild();
}
// virtual
void LLPanelSnapshotInventory::onOpen(const LLSD& key)
{
LLPanelSnapshot::onOpen(key);
}
// virtual
void LLPanelSnapshotInventory::updateControls(const LLSD& info)
{
const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true;
getChild<LLUICtrl>("save_btn")->setEnabled(have_snapshot);
}
void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl)
{
BOOL current_window_selected = (getChild<LLComboBox>(getImageSizeComboName())->getCurrentIndex() == 3);
getChild<LLSpinCtrl>(getWidthSpinnerName())->setVisible(!current_window_selected);
getChild<LLSpinCtrl>(getHeightSpinnerName())->setVisible(!current_window_selected);
}
void LLPanelSnapshotInventoryBase::onSend()
{
S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
if (can_afford_transaction(expected_upload_cost))
{
if (mSnapshotFloater)
{
mSnapshotFloater->saveTexture();
mSnapshotFloater->postSave();
}
}
else
{
LLSD args;
args["COST"] = llformat("%d", expected_upload_cost);
LLNotificationsUtil::add("ErrorPhotoCannotAfford", args);
if (mSnapshotFloater)
{
mSnapshotFloater->inventorySaveFailed();
}
}
}
LLPanelOutfitSnapshotInventory::LLPanelOutfitSnapshotInventory()
{
mCommitCallbackRegistrar.add("Inventory.SaveOutfitPhoto", boost::bind(&LLPanelOutfitSnapshotInventory::onSend, this));
mCommitCallbackRegistrar.add("Inventory.SaveOutfitCancel", boost::bind(&LLPanelOutfitSnapshotInventory::cancel, this));
}
// virtual
BOOL LLPanelOutfitSnapshotInventory::postBuild()
{
return LLPanelSnapshotInventoryBase::postBuild();
}
// virtual
void LLPanelOutfitSnapshotInventory::onOpen(const LLSD& key)
{
getChild<LLUICtrl>("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost()));
LLPanelSnapshot::onOpen(key);
}
// virtual
void LLPanelOutfitSnapshotInventory::updateControls(const LLSD& info)
{
const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true;
getChild<LLUICtrl>("save_btn")->setEnabled(have_snapshot);
}
void LLPanelOutfitSnapshotInventory::cancel()
{
if (mSnapshotFloater)
{
mSnapshotFloater->closeFloater();
}
}
/**
* @file llpanelsnapshotlocal.cpp
* @brief The panel provides UI for saving snapshot to a local folder.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
*
* 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
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llcombobox.h"
#include "llsidetraypanelcontainer.h"
#include "llsliderctrl.h"
#include "llspinctrl.h"
#include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model
#include "llpanelsnapshot.h"
#include "llsnapshotlivepreview.h"
#include "llviewercontrol.h" // gSavedSettings
#include "llviewerwindow.h"
/**
* The panel provides UI for saving snapshot to a local folder.
*/
class LLPanelSnapshotLocal
: public LLPanelSnapshot
{
LOG_CLASS(LLPanelSnapshotLocal);
public:
LLPanelSnapshotLocal();
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
private:
/*virtual*/ std::string getWidthSpinnerName() const { return "local_snapshot_width"; }
/*virtual*/ std::string getHeightSpinnerName() const { return "local_snapshot_height"; }
/*virtual*/ std::string getAspectRatioCBName() const { return "local_keep_aspect_check"; }