fix DOS line endings
parent
ca3cea390c
commit
3369ebc8dd
|
|
@ -229,12 +229,12 @@ void LLFastTimer::DeclareTimer::updateCachedPointers()
|
|||
it->mFrameState = &it->mTimer.getFrameState();
|
||||
}
|
||||
|
||||
// also update frame states of timers on stack
|
||||
LLFastTimer* cur_timerp = LLFastTimer::sCurTimerData.mCurTimer;
|
||||
while(cur_timerp->mLastTimerData.mCurTimer != cur_timerp)
|
||||
{
|
||||
cur_timerp->mFrameState = &cur_timerp->mFrameState->mTimer->getFrameState();
|
||||
cur_timerp = cur_timerp->mLastTimerData.mCurTimer;
|
||||
// also update frame states of timers on stack
|
||||
LLFastTimer* cur_timerp = LLFastTimer::sCurTimerData.mCurTimer;
|
||||
while(cur_timerp->mLastTimerData.mCurTimer != cur_timerp)
|
||||
{
|
||||
cur_timerp->mFrameState = &cur_timerp->mFrameState->mTimer->getFrameState();
|
||||
cur_timerp = cur_timerp->mLastTimerData.mCurTimer;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,425 +1,425 @@
|
|||
/**
|
||||
* @file llpluginclassmedia.h
|
||||
* @brief LLPluginClassMedia handles interaction with a plugin which knows about the "media" message class.
|
||||
*
|
||||
* @cond
|
||||
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, 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$
|
||||
* @endcond
|
||||
*/
|
||||
|
||||
#ifndef LL_LLPLUGINCLASSMEDIA_H
|
||||
#define LL_LLPLUGINCLASSMEDIA_H
|
||||
|
||||
#include "llgltypes.h"
|
||||
#include "llpluginprocessparent.h"
|
||||
#include "llrect.h"
|
||||
#include "llpluginclassmediaowner.h"
|
||||
#include <queue>
|
||||
#include "v4color.h"
|
||||
|
||||
class LLPluginClassMedia : public LLPluginProcessParentOwner
|
||||
{
|
||||
LOG_CLASS(LLPluginClassMedia);
|
||||
public:
|
||||
LLPluginClassMedia(LLPluginClassMediaOwner *owner);
|
||||
virtual ~LLPluginClassMedia();
|
||||
|
||||
// local initialization, called by the media manager when creating a source
|
||||
virtual bool init(const std::string &launcher_filename,
|
||||
const std::string &plugin_dir,
|
||||
const std::string &plugin_filename,
|
||||
bool debug);
|
||||
|
||||
// undoes everything init() didm called by the media manager when destroying a source
|
||||
virtual void reset();
|
||||
|
||||
void idle(void);
|
||||
|
||||
// All of these may return 0 or an actual valid value.
|
||||
// Callers need to check the return for 0, and not use the values in that case.
|
||||
int getWidth() const { return (mMediaWidth > 0) ? mMediaWidth : 0; };
|
||||
int getHeight() const { return (mMediaHeight > 0) ? mMediaHeight : 0; };
|
||||
int getNaturalWidth() const { return mNaturalMediaWidth; };
|
||||
int getNaturalHeight() const { return mNaturalMediaHeight; };
|
||||
int getSetWidth() const { return mSetMediaWidth; };
|
||||
int getSetHeight() const { return mSetMediaHeight; };
|
||||
int getBitsWidth() const { return (mTextureWidth > 0) ? mTextureWidth : 0; };
|
||||
int getBitsHeight() const { return (mTextureHeight > 0) ? mTextureHeight : 0; };
|
||||
int getTextureWidth() const;
|
||||
int getTextureHeight() const;
|
||||
int getFullWidth() const { return mFullMediaWidth; };
|
||||
int getFullHeight() const { return mFullMediaHeight; };
|
||||
|
||||
// This may return NULL. Callers need to check for and handle this case.
|
||||
unsigned char* getBitsData();
|
||||
|
||||
// gets the format details of the texture data
|
||||
// These may return 0 if they haven't been set up yet. The caller needs to detect this case.
|
||||
int getTextureDepth() const { return mRequestedTextureDepth; };
|
||||
int getTextureFormatInternal() const { return mRequestedTextureInternalFormat; };
|
||||
int getTextureFormatPrimary() const { return mRequestedTextureFormat; };
|
||||
int getTextureFormatType() const { return mRequestedTextureType; };
|
||||
bool getTextureFormatSwapBytes() const { return mRequestedTextureSwapBytes; };
|
||||
bool getTextureCoordsOpenGL() const { return mRequestedTextureCoordsOpenGL; };
|
||||
|
||||
void setSize(int width, int height);
|
||||
void setAutoScale(bool auto_scale);
|
||||
|
||||
void setBackgroundColor(LLColor4 color) { mBackgroundColor = color; };
|
||||
|
||||
void setOwner(LLPluginClassMediaOwner *owner) { mOwner = owner; };
|
||||
|
||||
// Returns true if all of the texture parameters (depth, format, size, and texture size) are set up and consistent.
|
||||
// This will initially be false, and will also be false for some time after setSize while the resize is processed.
|
||||
// Note that if this returns true, it is safe to use all the get() functions above without checking for invalid return values
|
||||
// until you call idle() again.
|
||||
bool textureValid(void);
|
||||
|
||||
bool getDirty(LLRect *dirty_rect = NULL);
|
||||
void resetDirty(void);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MOUSE_EVENT_DOWN,
|
||||
MOUSE_EVENT_UP,
|
||||
MOUSE_EVENT_MOVE,
|
||||
MOUSE_EVENT_DOUBLE_CLICK
|
||||
}EMouseEventType;
|
||||
|
||||
void mouseEvent(EMouseEventType type, int button, int x, int y, MASK modifiers);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
KEY_EVENT_DOWN,
|
||||
KEY_EVENT_UP,
|
||||
KEY_EVENT_REPEAT
|
||||
}EKeyEventType;
|
||||
|
||||
bool keyEvent(EKeyEventType type, int key_code, MASK modifiers, LLSD native_key_data);
|
||||
|
||||
void scrollEvent(int x, int y, MASK modifiers);
|
||||
|
||||
// Javascript <-> viewer events
|
||||
void jsEnableObject( bool enable );
|
||||
void jsAgentLocationEvent( double x, double y, double z );
|
||||
void jsAgentGlobalLocationEvent( double x, double y, double z );
|
||||
void jsAgentOrientationEvent( double angle );
|
||||
void jsAgentLanguageEvent( const std::string& language );
|
||||
void jsAgentRegionEvent( const std::string& region_name );
|
||||
void jsAgentMaturityEvent( const std::string& maturity );
|
||||
|
||||
// Text may be unicode (utf8 encoded)
|
||||
bool textInput(const std::string &text, MASK modifiers, LLSD native_key_data);
|
||||
|
||||
void loadURI(const std::string &uri);
|
||||
|
||||
// "Loading" means uninitialized or any state prior to fully running (processing commands)
|
||||
bool isPluginLoading(void) { return mPlugin?mPlugin->isLoading():false; };
|
||||
|
||||
// "Running" means the steady state -- i.e. processing messages
|
||||
bool isPluginRunning(void) { return mPlugin?mPlugin->isRunning():false; };
|
||||
|
||||
// "Exited" means any regular or error state after "Running" (plugin may have crashed or exited normally)
|
||||
bool isPluginExited(void) { return mPlugin?mPlugin->isDone():false; };
|
||||
|
||||
std::string getPluginVersion() { return mPlugin?mPlugin->getPluginVersion():std::string(""); };
|
||||
|
||||
bool getDisableTimeout() { return mPlugin?mPlugin->getDisableTimeout():false; };
|
||||
void setDisableTimeout(bool disable) { if(mPlugin) mPlugin->setDisableTimeout(disable); };
|
||||
|
||||
// Inherited from LLPluginProcessParentOwner
|
||||
/* virtual */ void receivePluginMessage(const LLPluginMessage &message);
|
||||
/* virtual */ void pluginLaunchFailed();
|
||||
/* virtual */ void pluginDied();
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PRIORITY_UNLOADED, // media plugin isn't even loaded.
|
||||
PRIORITY_STOPPED, // media is not playing, shouldn't need to update at all.
|
||||
PRIORITY_HIDDEN, // media is not being displayed or is out of view, don't need to do graphic updates, but may still update audio, playhead, etc.
|
||||
PRIORITY_SLIDESHOW, // media is in the far distance, updates very infrequently
|
||||
PRIORITY_LOW, // media is in the distance, may be rendered at reduced size
|
||||
PRIORITY_NORMAL, // normal (default) priority
|
||||
PRIORITY_HIGH // media has user focus and/or is taking up most of the screen
|
||||
}EPriority;
|
||||
|
||||
static const char* priorityToString(EPriority priority);
|
||||
void setPriority(EPriority priority);
|
||||
void setLowPrioritySizeLimit(int size);
|
||||
|
||||
F64 getCPUUsage();
|
||||
|
||||
void sendPickFileResponse(const std::string &file);
|
||||
|
||||
void sendAuthResponse(bool ok, const std::string &username, const std::string &password);
|
||||
|
||||
// Valid after a MEDIA_EVENT_CURSOR_CHANGED event
|
||||
std::string getCursorName() const { return mCursorName; };
|
||||
|
||||
LLPluginClassMediaOwner::EMediaStatus getStatus() const { return mStatus; }
|
||||
|
||||
void cut();
|
||||
bool canCut() const { return mCanCut; };
|
||||
|
||||
void copy();
|
||||
bool canCopy() const { return mCanCopy; };
|
||||
|
||||
void paste();
|
||||
bool canPaste() const { return mCanPaste; };
|
||||
|
||||
// These can be called before init(), and they will be queued and sent before the media init message.
|
||||
void setUserDataPath(const std::string &user_data_path);
|
||||
void setLanguageCode(const std::string &language_code);
|
||||
void setPluginsEnabled(const bool enabled);
|
||||
void setJavascriptEnabled(const bool enabled);
|
||||
void setTarget(const std::string &target);
|
||||
|
||||
///////////////////////////////////
|
||||
// media browser class functions
|
||||
bool pluginSupportsMediaBrowser(void);
|
||||
|
||||
void focus(bool focused);
|
||||
void clear_cache();
|
||||
void clear_cookies();
|
||||
void set_cookies(const std::string &cookies);
|
||||
void enable_cookies(bool enable);
|
||||
void proxy_setup(bool enable, const std::string &host = LLStringUtil::null, int port = 0);
|
||||
void browse_stop();
|
||||
void browse_reload(bool ignore_cache = false);
|
||||
void browse_forward();
|
||||
void browse_back();
|
||||
void setBrowserUserAgent(const std::string& user_agent);
|
||||
void proxyWindowOpened(const std::string &target, const std::string &uuid);
|
||||
void proxyWindowClosed(const std::string &uuid);
|
||||
void ignore_ssl_cert_errors(bool ignore);
|
||||
void addCertificateFilePath(const std::string& path);
|
||||
|
||||
// This is valid after MEDIA_EVENT_NAVIGATE_BEGIN or MEDIA_EVENT_NAVIGATE_COMPLETE
|
||||
std::string getNavigateURI() const { return mNavigateURI; };
|
||||
|
||||
// These are valid after MEDIA_EVENT_NAVIGATE_COMPLETE
|
||||
S32 getNavigateResultCode() const { return mNavigateResultCode; };
|
||||
std::string getNavigateResultString() const { return mNavigateResultString; };
|
||||
bool getHistoryBackAvailable() const { return mHistoryBackAvailable; };
|
||||
bool getHistoryForwardAvailable() const { return mHistoryForwardAvailable; };
|
||||
|
||||
// This is valid after MEDIA_EVENT_PROGRESS_UPDATED
|
||||
int getProgressPercent() const { return mProgressPercent; };
|
||||
|
||||
// This is valid after MEDIA_EVENT_STATUS_TEXT_CHANGED
|
||||
std::string getStatusText() const { return mStatusText; };
|
||||
|
||||
// This is valid after MEDIA_EVENT_LOCATION_CHANGED
|
||||
std::string getLocation() const { return mLocation; };
|
||||
|
||||
// This is valid after MEDIA_EVENT_CLICK_LINK_HREF or MEDIA_EVENT_CLICK_LINK_NOFOLLOW
|
||||
std::string getClickURL() const { return mClickURL; };
|
||||
|
||||
// This is valid after MEDIA_EVENT_CLICK_LINK_NOFOLLOW
|
||||
std::string getClickNavType() const { return mClickNavType; };
|
||||
|
||||
// This is valid after MEDIA_EVENT_CLICK_LINK_HREF
|
||||
std::string getClickTarget() const { return mClickTarget; };
|
||||
|
||||
// This is valid during MEDIA_EVENT_CLICK_LINK_HREF and MEDIA_EVENT_GEOMETRY_CHANGE
|
||||
std::string getClickUUID() const { return mClickUUID; };
|
||||
|
||||
// This is valid after MEDIA_EVENT_NAVIGATE_ERROR_PAGE
|
||||
S32 getStatusCode() const { return mStatusCode; };
|
||||
|
||||
// These are valid during MEDIA_EVENT_GEOMETRY_CHANGE
|
||||
S32 getGeometryX() const { return mGeometryX; };
|
||||
S32 getGeometryY() const { return mGeometryY; };
|
||||
S32 getGeometryWidth() const { return mGeometryWidth; };
|
||||
S32 getGeometryHeight() const { return mGeometryHeight; };
|
||||
|
||||
// These are valid during MEDIA_EVENT_AUTH_REQUEST
|
||||
std::string getAuthURL() const { return mAuthURL; };
|
||||
std::string getAuthRealm() const { return mAuthRealm; };
|
||||
|
||||
// These are valid during MEDIA_EVENT_LINK_HOVERED
|
||||
std::string getHoverText() const { return mHoverText; };
|
||||
std::string getHoverLink() const { return mHoverLink; };
|
||||
|
||||
std::string getMediaName() const { return mMediaName; };
|
||||
std::string getMediaDescription() const { return mMediaDescription; };
|
||||
|
||||
// Crash the plugin. If you use this outside of a testbed, you will be punished.
|
||||
void crashPlugin();
|
||||
|
||||
// Hang the plugin. If you use this outside of a testbed, you will be punished.
|
||||
void hangPlugin();
|
||||
|
||||
///////////////////////////////////
|
||||
// media time class functions
|
||||
bool pluginSupportsMediaTime(void);
|
||||
void stop();
|
||||
void start(float rate = 0.0f);
|
||||
void pause();
|
||||
void seek(float time);
|
||||
void setLoop(bool loop);
|
||||
void setVolume(float volume);
|
||||
float getVolume();
|
||||
|
||||
F64 getCurrentTime(void) const { return mCurrentTime; };
|
||||
F64 getDuration(void) const { return mDuration; };
|
||||
F64 getCurrentPlayRate(void) { return mCurrentRate; };
|
||||
F64 getLoadedDuration(void) const { return mLoadedDuration; };
|
||||
|
||||
// Initialize the URL history of the plugin by sending
|
||||
// "init_history" message
|
||||
void initializeUrlHistory(const LLSD& url_history);
|
||||
|
||||
protected:
|
||||
|
||||
LLPluginClassMediaOwner *mOwner;
|
||||
|
||||
// Notify this object's owner that an event has occurred.
|
||||
void mediaEvent(LLPluginClassMediaOwner::EMediaEvent event);
|
||||
|
||||
void sendMessage(const LLPluginMessage &message); // Send message internally, either queueing or sending directly.
|
||||
std::queue<LLPluginMessage> mSendQueue; // Used to queue messages while the plugin initializes.
|
||||
|
||||
void setSizeInternal(void);
|
||||
|
||||
bool mTextureParamsReceived; // the mRequestedTexture* fields are only valid when this is true
|
||||
S32 mRequestedTextureDepth;
|
||||
LLGLenum mRequestedTextureInternalFormat;
|
||||
LLGLenum mRequestedTextureFormat;
|
||||
LLGLenum mRequestedTextureType;
|
||||
bool mRequestedTextureSwapBytes;
|
||||
bool mRequestedTextureCoordsOpenGL;
|
||||
|
||||
std::string mTextureSharedMemoryName;
|
||||
size_t mTextureSharedMemorySize;
|
||||
|
||||
// True to scale requested media up to the full size of the texture (i.e. next power of two)
|
||||
bool mAutoScaleMedia;
|
||||
|
||||
// default media size for the plugin, from the texture_params message.
|
||||
int mDefaultMediaWidth;
|
||||
int mDefaultMediaHeight;
|
||||
|
||||
// Size that has been requested by the plugin itself
|
||||
int mNaturalMediaWidth;
|
||||
int mNaturalMediaHeight;
|
||||
|
||||
// Size that has been requested with setSize()
|
||||
int mSetMediaWidth;
|
||||
int mSetMediaHeight;
|
||||
|
||||
// Full calculated media size (before auto-scale and downsample calculations)
|
||||
int mFullMediaWidth;
|
||||
int mFullMediaHeight;
|
||||
|
||||
// Actual media size being set (after auto-scale)
|
||||
int mRequestedMediaWidth;
|
||||
int mRequestedMediaHeight;
|
||||
|
||||
// Texture size calculated from actual media size
|
||||
int mRequestedTextureWidth;
|
||||
int mRequestedTextureHeight;
|
||||
|
||||
// Size that the plugin has acknowledged
|
||||
int mTextureWidth;
|
||||
int mTextureHeight;
|
||||
int mMediaWidth;
|
||||
int mMediaHeight;
|
||||
|
||||
float mRequestedVolume;
|
||||
|
||||
// Priority of this media stream
|
||||
EPriority mPriority;
|
||||
int mLowPrioritySizeLimit;
|
||||
|
||||
bool mAllowDownsample;
|
||||
int mPadding;
|
||||
|
||||
|
||||
LLPluginProcessParent *mPlugin;
|
||||
|
||||
LLRect mDirtyRect;
|
||||
|
||||
std::string translateModifiers(MASK modifiers);
|
||||
|
||||
std::string mCursorName;
|
||||
int mLastMouseX;
|
||||
int mLastMouseY;
|
||||
|
||||
LLPluginClassMediaOwner::EMediaStatus mStatus;
|
||||
|
||||
F64 mSleepTime;
|
||||
|
||||
bool mCanCut;
|
||||
bool mCanCopy;
|
||||
bool mCanPaste;
|
||||
|
||||
std::string mMediaName;
|
||||
std::string mMediaDescription;
|
||||
|
||||
LLColor4 mBackgroundColor;
|
||||
|
||||
std::string mTarget;
|
||||
|
||||
/////////////////////////////////////////
|
||||
// media_browser class
|
||||
std::string mNavigateURI;
|
||||
S32 mNavigateResultCode;
|
||||
std::string mNavigateResultString;
|
||||
bool mHistoryBackAvailable;
|
||||
bool mHistoryForwardAvailable;
|
||||
std::string mStatusText;
|
||||
int mProgressPercent;
|
||||
std::string mLocation;
|
||||
std::string mClickURL;
|
||||
std::string mClickNavType;
|
||||
std::string mClickTarget;
|
||||
std::string mClickUUID;
|
||||
S32 mGeometryX;
|
||||
S32 mGeometryY;
|
||||
S32 mGeometryWidth;
|
||||
S32 mGeometryHeight;
|
||||
S32 mStatusCode;
|
||||
std::string mAuthURL;
|
||||
std::string mAuthRealm;
|
||||
std::string mHoverText;
|
||||
std::string mHoverLink;
|
||||
|
||||
/////////////////////////////////////////
|
||||
// media_time class
|
||||
F64 mCurrentTime;
|
||||
F64 mDuration;
|
||||
F64 mCurrentRate;
|
||||
F64 mLoadedDuration;
|
||||
|
||||
//--------------------------------------
|
||||
//debug use only
|
||||
//
|
||||
private:
|
||||
bool mDeleteOK ;
|
||||
public:
|
||||
void setDeleteOK(bool flag) { mDeleteOK = flag ;}
|
||||
//--------------------------------------
|
||||
};
|
||||
|
||||
#endif // LL_LLPLUGINCLASSMEDIA_H
|
||||
/**
|
||||
* @file llpluginclassmedia.h
|
||||
* @brief LLPluginClassMedia handles interaction with a plugin which knows about the "media" message class.
|
||||
*
|
||||
* @cond
|
||||
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, 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$
|
||||
* @endcond
|
||||
*/
|
||||
|
||||
#ifndef LL_LLPLUGINCLASSMEDIA_H
|
||||
#define LL_LLPLUGINCLASSMEDIA_H
|
||||
|
||||
#include "llgltypes.h"
|
||||
#include "llpluginprocessparent.h"
|
||||
#include "llrect.h"
|
||||
#include "llpluginclassmediaowner.h"
|
||||
#include <queue>
|
||||
#include "v4color.h"
|
||||
|
||||
class LLPluginClassMedia : public LLPluginProcessParentOwner
|
||||
{
|
||||
LOG_CLASS(LLPluginClassMedia);
|
||||
public:
|
||||
LLPluginClassMedia(LLPluginClassMediaOwner *owner);
|
||||
virtual ~LLPluginClassMedia();
|
||||
|
||||
// local initialization, called by the media manager when creating a source
|
||||
virtual bool init(const std::string &launcher_filename,
|
||||
const std::string &plugin_dir,
|
||||
const std::string &plugin_filename,
|
||||
bool debug);
|
||||
|
||||
// undoes everything init() didm called by the media manager when destroying a source
|
||||
virtual void reset();
|
||||
|
||||
void idle(void);
|
||||
|
||||
// All of these may return 0 or an actual valid value.
|
||||
// Callers need to check the return for 0, and not use the values in that case.
|
||||
int getWidth() const { return (mMediaWidth > 0) ? mMediaWidth : 0; };
|
||||
int getHeight() const { return (mMediaHeight > 0) ? mMediaHeight : 0; };
|
||||
int getNaturalWidth() const { return mNaturalMediaWidth; };
|
||||
int getNaturalHeight() const { return mNaturalMediaHeight; };
|
||||
int getSetWidth() const { return mSetMediaWidth; };
|
||||
int getSetHeight() const { return mSetMediaHeight; };
|
||||
int getBitsWidth() const { return (mTextureWidth > 0) ? mTextureWidth : 0; };
|
||||
int getBitsHeight() const { return (mTextureHeight > 0) ? mTextureHeight : 0; };
|
||||
int getTextureWidth() const;
|
||||
int getTextureHeight() const;
|
||||
int getFullWidth() const { return mFullMediaWidth; };
|
||||
int getFullHeight() const { return mFullMediaHeight; };
|
||||
|
||||
// This may return NULL. Callers need to check for and handle this case.
|
||||
unsigned char* getBitsData();
|
||||
|
||||
// gets the format details of the texture data
|
||||
// These may return 0 if they haven't been set up yet. The caller needs to detect this case.
|
||||
int getTextureDepth() const { return mRequestedTextureDepth; };
|
||||
int getTextureFormatInternal() const { return mRequestedTextureInternalFormat; };
|
||||
int getTextureFormatPrimary() const { return mRequestedTextureFormat; };
|
||||
int getTextureFormatType() const { return mRequestedTextureType; };
|
||||
bool getTextureFormatSwapBytes() const { return mRequestedTextureSwapBytes; };
|
||||
bool getTextureCoordsOpenGL() const { return mRequestedTextureCoordsOpenGL; };
|
||||
|
||||
void setSize(int width, int height);
|
||||
void setAutoScale(bool auto_scale);
|
||||
|
||||
void setBackgroundColor(LLColor4 color) { mBackgroundColor = color; };
|
||||
|
||||
void setOwner(LLPluginClassMediaOwner *owner) { mOwner = owner; };
|
||||
|
||||
// Returns true if all of the texture parameters (depth, format, size, and texture size) are set up and consistent.
|
||||
// This will initially be false, and will also be false for some time after setSize while the resize is processed.
|
||||
// Note that if this returns true, it is safe to use all the get() functions above without checking for invalid return values
|
||||
// until you call idle() again.
|
||||
bool textureValid(void);
|
||||
|
||||
bool getDirty(LLRect *dirty_rect = NULL);
|
||||
void resetDirty(void);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MOUSE_EVENT_DOWN,
|
||||
MOUSE_EVENT_UP,
|
||||
MOUSE_EVENT_MOVE,
|
||||
MOUSE_EVENT_DOUBLE_CLICK
|
||||
}EMouseEventType;
|
||||
|
||||
void mouseEvent(EMouseEventType type, int button, int x, int y, MASK modifiers);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
KEY_EVENT_DOWN,
|
||||
KEY_EVENT_UP,
|
||||
KEY_EVENT_REPEAT
|
||||
}EKeyEventType;
|
||||
|
||||
bool keyEvent(EKeyEventType type, int key_code, MASK modifiers, LLSD native_key_data);
|
||||
|
||||
void scrollEvent(int x, int y, MASK modifiers);
|
||||
|
||||
// Javascript <-> viewer events
|
||||
void jsEnableObject( bool enable );
|
||||
void jsAgentLocationEvent( double x, double y, double z );
|
||||
void jsAgentGlobalLocationEvent( double x, double y, double z );
|
||||
void jsAgentOrientationEvent( double angle );
|
||||
void jsAgentLanguageEvent( const std::string& language );
|
||||
void jsAgentRegionEvent( const std::string& region_name );
|
||||
void jsAgentMaturityEvent( const std::string& maturity );
|
||||
|
||||
// Text may be unicode (utf8 encoded)
|
||||
bool textInput(const std::string &text, MASK modifiers, LLSD native_key_data);
|
||||
|
||||
void loadURI(const std::string &uri);
|
||||
|
||||
// "Loading" means uninitialized or any state prior to fully running (processing commands)
|
||||
bool isPluginLoading(void) { return mPlugin?mPlugin->isLoading():false; };
|
||||
|
||||
// "Running" means the steady state -- i.e. processing messages
|
||||
bool isPluginRunning(void) { return mPlugin?mPlugin->isRunning():false; };
|
||||
|
||||
// "Exited" means any regular or error state after "Running" (plugin may have crashed or exited normally)
|
||||
bool isPluginExited(void) { return mPlugin?mPlugin->isDone():false; };
|
||||
|
||||
std::string getPluginVersion() { return mPlugin?mPlugin->getPluginVersion():std::string(""); };
|
||||
|
||||
bool getDisableTimeout() { return mPlugin?mPlugin->getDisableTimeout():false; };
|
||||
void setDisableTimeout(bool disable) { if(mPlugin) mPlugin->setDisableTimeout(disable); };
|
||||
|
||||
// Inherited from LLPluginProcessParentOwner
|
||||
/* virtual */ void receivePluginMessage(const LLPluginMessage &message);
|
||||
/* virtual */ void pluginLaunchFailed();
|
||||
/* virtual */ void pluginDied();
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PRIORITY_UNLOADED, // media plugin isn't even loaded.
|
||||
PRIORITY_STOPPED, // media is not playing, shouldn't need to update at all.
|
||||
PRIORITY_HIDDEN, // media is not being displayed or is out of view, don't need to do graphic updates, but may still update audio, playhead, etc.
|
||||
PRIORITY_SLIDESHOW, // media is in the far distance, updates very infrequently
|
||||
PRIORITY_LOW, // media is in the distance, may be rendered at reduced size
|
||||
PRIORITY_NORMAL, // normal (default) priority
|
||||
PRIORITY_HIGH // media has user focus and/or is taking up most of the screen
|
||||
}EPriority;
|
||||
|
||||
static const char* priorityToString(EPriority priority);
|
||||
void setPriority(EPriority priority);
|
||||
void setLowPrioritySizeLimit(int size);
|
||||
|
||||
F64 getCPUUsage();
|
||||
|
||||
void sendPickFileResponse(const std::string &file);
|
||||
|
||||
void sendAuthResponse(bool ok, const std::string &username, const std::string &password);
|
||||
|
||||
// Valid after a MEDIA_EVENT_CURSOR_CHANGED event
|
||||
std::string getCursorName() const { return mCursorName; };
|
||||
|
||||
LLPluginClassMediaOwner::EMediaStatus getStatus() const { return mStatus; }
|
||||
|
||||
void cut();
|
||||
bool canCut() const { return mCanCut; };
|
||||
|
||||
void copy();
|
||||
bool canCopy() const { return mCanCopy; };
|
||||
|
||||
void paste();
|
||||
bool canPaste() const { return mCanPaste; };
|
||||
|
||||
// These can be called before init(), and they will be queued and sent before the media init message.
|
||||
void setUserDataPath(const std::string &user_data_path);
|
||||
void setLanguageCode(const std::string &language_code);
|
||||
void setPluginsEnabled(const bool enabled);
|
||||
void setJavascriptEnabled(const bool enabled);
|
||||
void setTarget(const std::string &target);
|
||||
|
||||
///////////////////////////////////
|
||||
// media browser class functions
|
||||
bool pluginSupportsMediaBrowser(void);
|
||||
|
||||
void focus(bool focused);
|
||||
void clear_cache();
|
||||
void clear_cookies();
|
||||
void set_cookies(const std::string &cookies);
|
||||
void enable_cookies(bool enable);
|
||||
void proxy_setup(bool enable, const std::string &host = LLStringUtil::null, int port = 0);
|
||||
void browse_stop();
|
||||
void browse_reload(bool ignore_cache = false);
|
||||
void browse_forward();
|
||||
void browse_back();
|
||||
void setBrowserUserAgent(const std::string& user_agent);
|
||||
void proxyWindowOpened(const std::string &target, const std::string &uuid);
|
||||
void proxyWindowClosed(const std::string &uuid);
|
||||
void ignore_ssl_cert_errors(bool ignore);
|
||||
void addCertificateFilePath(const std::string& path);
|
||||
|
||||
// This is valid after MEDIA_EVENT_NAVIGATE_BEGIN or MEDIA_EVENT_NAVIGATE_COMPLETE
|
||||
std::string getNavigateURI() const { return mNavigateURI; };
|
||||
|
||||
// These are valid after MEDIA_EVENT_NAVIGATE_COMPLETE
|
||||
S32 getNavigateResultCode() const { return mNavigateResultCode; };
|
||||
std::string getNavigateResultString() const { return mNavigateResultString; };
|
||||
bool getHistoryBackAvailable() const { return mHistoryBackAvailable; };
|
||||
bool getHistoryForwardAvailable() const { return mHistoryForwardAvailable; };
|
||||
|
||||
// This is valid after MEDIA_EVENT_PROGRESS_UPDATED
|
||||
int getProgressPercent() const { return mProgressPercent; };
|
||||
|
||||
// This is valid after MEDIA_EVENT_STATUS_TEXT_CHANGED
|
||||
std::string getStatusText() const { return mStatusText; };
|
||||
|
||||
// This is valid after MEDIA_EVENT_LOCATION_CHANGED
|
||||
std::string getLocation() const { return mLocation; };
|
||||
|
||||
// This is valid after MEDIA_EVENT_CLICK_LINK_HREF or MEDIA_EVENT_CLICK_LINK_NOFOLLOW
|
||||
std::string getClickURL() const { return mClickURL; };
|
||||
|
||||
// This is valid after MEDIA_EVENT_CLICK_LINK_NOFOLLOW
|
||||
std::string getClickNavType() const { return mClickNavType; };
|
||||
|
||||
// This is valid after MEDIA_EVENT_CLICK_LINK_HREF
|
||||
std::string getClickTarget() const { return mClickTarget; };
|
||||
|
||||
// This is valid during MEDIA_EVENT_CLICK_LINK_HREF and MEDIA_EVENT_GEOMETRY_CHANGE
|
||||
std::string getClickUUID() const { return mClickUUID; };
|
||||
|
||||
// This is valid after MEDIA_EVENT_NAVIGATE_ERROR_PAGE
|
||||
S32 getStatusCode() const { return mStatusCode; };
|
||||
|
||||
// These are valid during MEDIA_EVENT_GEOMETRY_CHANGE
|
||||
S32 getGeometryX() const { return mGeometryX; };
|
||||
S32 getGeometryY() const { return mGeometryY; };
|
||||
S32 getGeometryWidth() const { return mGeometryWidth; };
|
||||
S32 getGeometryHeight() const { return mGeometryHeight; };
|
||||
|
||||
// These are valid during MEDIA_EVENT_AUTH_REQUEST
|
||||
std::string getAuthURL() const { return mAuthURL; };
|
||||
std::string getAuthRealm() const { return mAuthRealm; };
|
||||
|
||||
// These are valid during MEDIA_EVENT_LINK_HOVERED
|
||||
std::string getHoverText() const { return mHoverText; };
|
||||
std::string getHoverLink() const { return mHoverLink; };
|
||||
|
||||
std::string getMediaName() const { return mMediaName; };
|
||||
std::string getMediaDescription() const { return mMediaDescription; };
|
||||
|
||||
// Crash the plugin. If you use this outside of a testbed, you will be punished.
|
||||
void crashPlugin();
|
||||
|
||||
// Hang the plugin. If you use this outside of a testbed, you will be punished.
|
||||
void hangPlugin();
|
||||
|
||||
///////////////////////////////////
|
||||
// media time class functions
|
||||
bool pluginSupportsMediaTime(void);
|
||||
void stop();
|
||||
void start(float rate = 0.0f);
|
||||
void pause();
|
||||
void seek(float time);
|
||||
void setLoop(bool loop);
|
||||
void setVolume(float volume);
|
||||
float getVolume();
|
||||
|
||||
F64 getCurrentTime(void) const { return mCurrentTime; };
|
||||
F64 getDuration(void) const { return mDuration; };
|
||||
F64 getCurrentPlayRate(void) { return mCurrentRate; };
|
||||
F64 getLoadedDuration(void) const { return mLoadedDuration; };
|
||||
|
||||
// Initialize the URL history of the plugin by sending
|
||||
// "init_history" message
|
||||
void initializeUrlHistory(const LLSD& url_history);
|
||||
|
||||
protected:
|
||||
|
||||
LLPluginClassMediaOwner *mOwner;
|
||||
|
||||
// Notify this object's owner that an event has occurred.
|
||||
void mediaEvent(LLPluginClassMediaOwner::EMediaEvent event);
|
||||
|
||||
void sendMessage(const LLPluginMessage &message); // Send message internally, either queueing or sending directly.
|
||||
std::queue<LLPluginMessage> mSendQueue; // Used to queue messages while the plugin initializes.
|
||||
|
||||
void setSizeInternal(void);
|
||||
|
||||
bool mTextureParamsReceived; // the mRequestedTexture* fields are only valid when this is true
|
||||
S32 mRequestedTextureDepth;
|
||||
LLGLenum mRequestedTextureInternalFormat;
|
||||
LLGLenum mRequestedTextureFormat;
|
||||
LLGLenum mRequestedTextureType;
|
||||
bool mRequestedTextureSwapBytes;
|
||||
bool mRequestedTextureCoordsOpenGL;
|
||||
|
||||
std::string mTextureSharedMemoryName;
|
||||
size_t mTextureSharedMemorySize;
|
||||
|
||||
// True to scale requested media up to the full size of the texture (i.e. next power of two)
|
||||
bool mAutoScaleMedia;
|
||||
|
||||
// default media size for the plugin, from the texture_params message.
|
||||
int mDefaultMediaWidth;
|
||||
int mDefaultMediaHeight;
|
||||
|
||||
// Size that has been requested by the plugin itself
|
||||
int mNaturalMediaWidth;
|
||||
int mNaturalMediaHeight;
|
||||
|
||||
// Size that has been requested with setSize()
|
||||
int mSetMediaWidth;
|
||||
int mSetMediaHeight;
|
||||
|
||||
// Full calculated media size (before auto-scale and downsample calculations)
|
||||
int mFullMediaWidth;
|
||||
int mFullMediaHeight;
|
||||
|
||||
// Actual media size being set (after auto-scale)
|
||||
int mRequestedMediaWidth;
|
||||
int mRequestedMediaHeight;
|
||||
|
||||
// Texture size calculated from actual media size
|
||||
int mRequestedTextureWidth;
|
||||
int mRequestedTextureHeight;
|
||||
|
||||
// Size that the plugin has acknowledged
|
||||
int mTextureWidth;
|
||||
int mTextureHeight;
|
||||
int mMediaWidth;
|
||||
int mMediaHeight;
|
||||
|
||||
float mRequestedVolume;
|
||||
|
||||
// Priority of this media stream
|
||||
EPriority mPriority;
|
||||
int mLowPrioritySizeLimit;
|
||||
|
||||
bool mAllowDownsample;
|
||||
int mPadding;
|
||||
|
||||
|
||||
LLPluginProcessParent *mPlugin;
|
||||
|
||||
LLRect mDirtyRect;
|
||||
|
||||
std::string translateModifiers(MASK modifiers);
|
||||
|
||||
std::string mCursorName;
|
||||
int mLastMouseX;
|
||||
int mLastMouseY;
|
||||
|
||||
LLPluginClassMediaOwner::EMediaStatus mStatus;
|
||||
|
||||
F64 mSleepTime;
|
||||
|
||||
bool mCanCut;
|
||||
bool mCanCopy;
|
||||
bool mCanPaste;
|
||||
|
||||
std::string mMediaName;
|
||||
std::string mMediaDescription;
|
||||
|
||||
LLColor4 mBackgroundColor;
|
||||
|
||||
std::string mTarget;
|
||||
|
||||
/////////////////////////////////////////
|
||||
// media_browser class
|
||||
std::string mNavigateURI;
|
||||
S32 mNavigateResultCode;
|
||||
std::string mNavigateResultString;
|
||||
bool mHistoryBackAvailable;
|
||||
bool mHistoryForwardAvailable;
|
||||
std::string mStatusText;
|
||||
int mProgressPercent;
|
||||
std::string mLocation;
|
||||
std::string mClickURL;
|
||||
std::string mClickNavType;
|
||||
std::string mClickTarget;
|
||||
std::string mClickUUID;
|
||||
S32 mGeometryX;
|
||||
S32 mGeometryY;
|
||||
S32 mGeometryWidth;
|
||||
S32 mGeometryHeight;
|
||||
S32 mStatusCode;
|
||||
std::string mAuthURL;
|
||||
std::string mAuthRealm;
|
||||
std::string mHoverText;
|
||||
std::string mHoverLink;
|
||||
|
||||
/////////////////////////////////////////
|
||||
// media_time class
|
||||
F64 mCurrentTime;
|
||||
F64 mDuration;
|
||||
F64 mCurrentRate;
|
||||
F64 mLoadedDuration;
|
||||
|
||||
//--------------------------------------
|
||||
//debug use only
|
||||
//
|
||||
private:
|
||||
bool mDeleteOK ;
|
||||
public:
|
||||
void setDeleteOK(bool flag) { mDeleteOK = flag ;}
|
||||
//--------------------------------------
|
||||
};
|
||||
|
||||
#endif // LL_LLPLUGINCLASSMEDIA_H
|
||||
|
|
|
|||
|
|
@ -1,248 +1,248 @@
|
|||
/**
|
||||
* @file llpanelmarketplaceinbox.cpp
|
||||
* @brief Panel for marketplace inbox
|
||||
*
|
||||
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, 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 "llpanelmarketplaceinbox.h"
|
||||
|
||||
#include "llappviewer.h"
|
||||
#include "llbutton.h"
|
||||
#include "llinventorypanel.h"
|
||||
#include "llfolderview.h"
|
||||
#include "llsidepanelinventory.h"
|
||||
|
||||
|
||||
#define SUPPORTING_FRESH_ITEM_COUNT 0
|
||||
|
||||
|
||||
static LLRegisterPanelClassWrapper<LLPanelMarketplaceInbox> t_panel_marketplace_inbox("panel_marketplace_inbox");
|
||||
|
||||
const LLPanelMarketplaceInbox::Params& LLPanelMarketplaceInbox::getDefaultParams()
|
||||
{
|
||||
return LLUICtrlFactory::getDefaultParams<LLPanelMarketplaceInbox>();
|
||||
}
|
||||
|
||||
// protected
|
||||
LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p)
|
||||
: LLPanel(p)
|
||||
, mInventoryPanel(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox()
|
||||
{
|
||||
}
|
||||
|
||||
// virtual
|
||||
BOOL LLPanelMarketplaceInbox::postBuild()
|
||||
{
|
||||
LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceInbox::handleLoginComplete, this));
|
||||
|
||||
LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LLPanelMarketplaceInbox::onSelectionChange()
|
||||
{
|
||||
LLSidepanelInventory* sidepanel_inventory = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory"));
|
||||
|
||||
sidepanel_inventory->updateVerbs();
|
||||
}
|
||||
|
||||
|
||||
void LLPanelMarketplaceInbox::handleLoginComplete()
|
||||
{
|
||||
// Set us up as the class to drive the badge value for the sidebar_inventory button
|
||||
LLSideTray::getInstance()->setTabButtonBadgeDriver("sidebar_inventory", this);
|
||||
}
|
||||
|
||||
void LLPanelMarketplaceInbox::setupInventoryPanel()
|
||||
{
|
||||
LLView * inbox_inventory_placeholder = getChild<LLView>("inbox_inventory_placeholder");
|
||||
LLView * inbox_inventory_parent = inbox_inventory_placeholder->getParent();
|
||||
|
||||
mInventoryPanel =
|
||||
LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_inbox_inventory.xml",
|
||||
inbox_inventory_parent,
|
||||
LLInventoryPanel::child_registry_t::instance());
|
||||
|
||||
// Reshape the inventory to the proper size
|
||||
LLRect inventory_placeholder_rect = inbox_inventory_placeholder->getRect();
|
||||
mInventoryPanel->setShape(inventory_placeholder_rect);
|
||||
|
||||
// Set the sort order newest to oldest, and a selection change callback
|
||||
mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE);
|
||||
mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this));
|
||||
|
||||
// Set up the note to display when the inbox is empty
|
||||
mInventoryPanel->getFilter()->setEmptyLookupMessage("InventoryInboxNoItems");
|
||||
|
||||
// Hide the placeholder text
|
||||
inbox_inventory_placeholder->setVisible(FALSE);
|
||||
}
|
||||
|
||||
void LLPanelMarketplaceInbox::onFocusReceived()
|
||||
{
|
||||
LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel<LLSidepanelInventory>("sidepanel_inventory");
|
||||
|
||||
if (sidepanel_inventory)
|
||||
{
|
||||
LLInventoryPanel * inv_panel = sidepanel_inventory->getActivePanel();
|
||||
|
||||
if (inv_panel)
|
||||
{
|
||||
inv_panel->clearSelection();
|
||||
}
|
||||
|
||||
LLInventoryPanel * outbox_panel = sidepanel_inventory->findChild<LLInventoryPanel>("inventory_outbox");
|
||||
|
||||
if (outbox_panel)
|
||||
{
|
||||
outbox_panel->clearSelection();
|
||||
}
|
||||
|
||||
sidepanel_inventory->updateVerbs();
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg)
|
||||
{
|
||||
*accept = ACCEPT_NO;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
U32 LLPanelMarketplaceInbox::getFreshItemCount() const
|
||||
{
|
||||
#if SUPPORTING_FRESH_ITEM_COUNT
|
||||
|
||||
//
|
||||
// NOTE: When turning this on, be sure to test the no inbox/outbox case because this code probably
|
||||
// will return "2" for the Inventory and LIBRARY top-levels when that happens.
|
||||
//
|
||||
|
||||
U32 fresh_item_count = 0;
|
||||
|
||||
if (mInventoryPanel)
|
||||
{
|
||||
const LLFolderViewFolder * inbox_folder = mInventoryPanel->getRootFolder();
|
||||
|
||||
if (inbox_folder)
|
||||
{
|
||||
LLFolderViewFolder::folders_t::const_iterator folders_it = inbox_folder->getFoldersBegin();
|
||||
LLFolderViewFolder::folders_t::const_iterator folders_end = inbox_folder->getFoldersEnd();
|
||||
|
||||
for (; folders_it != folders_end; ++folders_it)
|
||||
{
|
||||
const LLFolderViewFolder * folder = *folders_it;
|
||||
|
||||
// TODO: Replace this check with new "fresh" flag
|
||||
if (folder->getCreationDate() > 1500)
|
||||
{
|
||||
fresh_item_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fresh_item_count;
|
||||
#else
|
||||
return getTotalItemCount();
|
||||
#endif
|
||||
}
|
||||
|
||||
U32 LLPanelMarketplaceInbox::getTotalItemCount() const
|
||||
{
|
||||
U32 item_count = 0;
|
||||
|
||||
if (mInventoryPanel)
|
||||
{
|
||||
const LLFolderViewFolder * inbox_folder = mInventoryPanel->getRootFolder();
|
||||
|
||||
if (inbox_folder)
|
||||
{
|
||||
item_count += inbox_folder->getFoldersCount();
|
||||
}
|
||||
}
|
||||
|
||||
return item_count;
|
||||
}
|
||||
|
||||
std::string LLPanelMarketplaceInbox::getBadgeString() const
|
||||
{
|
||||
std::string item_count_str("");
|
||||
|
||||
// If the inbox is visible, and the side panel is collapsed or expanded and not the inventory panel
|
||||
if (getParent()->getVisible() &&
|
||||
(LLSideTray::getInstance()->getCollapsed() || !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory")))
|
||||
{
|
||||
U32 item_count = getFreshItemCount();
|
||||
|
||||
if (item_count)
|
||||
{
|
||||
item_count_str = llformat("%d", item_count);
|
||||
}
|
||||
}
|
||||
|
||||
return item_count_str;
|
||||
}
|
||||
|
||||
void LLPanelMarketplaceInbox::draw()
|
||||
{
|
||||
U32 item_count = getTotalItemCount();
|
||||
|
||||
LLView * fresh_new_count_view = getChildView("inbox_fresh_new_count");
|
||||
|
||||
if (item_count > 0)
|
||||
{
|
||||
std::string item_count_str = llformat("%d", item_count);
|
||||
|
||||
LLStringUtil::format_map_t args;
|
||||
args["[NUM]"] = item_count_str;
|
||||
getChild<LLButton>("inbox_btn")->setLabel(getString("InboxLabelWithArg", args));
|
||||
|
||||
#if SUPPORTING_FRESH_ITEM_COUNT
|
||||
// set green text to fresh item count
|
||||
U32 fresh_item_count = getFreshItemCount();
|
||||
fresh_new_count_view->setVisible((fresh_item_count > 0));
|
||||
|
||||
if (fresh_item_count > 0)
|
||||
{
|
||||
getChild<LLUICtrl>("inbox_fresh_new_count")->setTextArg("[NUM]", llformat("%d", fresh_item_count));
|
||||
}
|
||||
#else
|
||||
fresh_new_count_view->setVisible(FALSE);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
getChild<LLButton>("inbox_btn")->setLabel(getString("InboxLabelNoArg"));
|
||||
|
||||
fresh_new_count_view->setVisible(FALSE);
|
||||
}
|
||||
|
||||
LLPanel::draw();
|
||||
}
|
||||
/**
|
||||
* @file llpanelmarketplaceinbox.cpp
|
||||
* @brief Panel for marketplace inbox
|
||||
*
|
||||
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, 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 "llpanelmarketplaceinbox.h"
|
||||
|
||||
#include "llappviewer.h"
|
||||
#include "llbutton.h"
|
||||
#include "llinventorypanel.h"
|
||||
#include "llfolderview.h"
|
||||
#include "llsidepanelinventory.h"
|
||||
|
||||
|
||||
#define SUPPORTING_FRESH_ITEM_COUNT 0
|
||||
|
||||
|
||||
static LLRegisterPanelClassWrapper<LLPanelMarketplaceInbox> t_panel_marketplace_inbox("panel_marketplace_inbox");
|
||||
|
||||
const LLPanelMarketplaceInbox::Params& LLPanelMarketplaceInbox::getDefaultParams()
|
||||
{
|
||||
return LLUICtrlFactory::getDefaultParams<LLPanelMarketplaceInbox>();
|
||||
}
|
||||
|
||||
// protected
|
||||
LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p)
|
||||
: LLPanel(p)
|
||||
, mInventoryPanel(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox()
|
||||
{
|
||||
}
|
||||
|
||||
// virtual
|
||||
BOOL LLPanelMarketplaceInbox::postBuild()
|
||||
{
|
||||
LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceInbox::handleLoginComplete, this));
|
||||
|
||||
LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LLPanelMarketplaceInbox::onSelectionChange()
|
||||
{
|
||||
LLSidepanelInventory* sidepanel_inventory = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory"));
|
||||
|
||||
sidepanel_inventory->updateVerbs();
|
||||
}
|
||||
|
||||
|
||||
void LLPanelMarketplaceInbox::handleLoginComplete()
|
||||
{
|
||||
// Set us up as the class to drive the badge value for the sidebar_inventory button
|
||||
LLSideTray::getInstance()->setTabButtonBadgeDriver("sidebar_inventory", this);
|
||||
}
|
||||
|
||||
void LLPanelMarketplaceInbox::setupInventoryPanel()
|
||||
{
|
||||
LLView * inbox_inventory_placeholder = getChild<LLView>("inbox_inventory_placeholder");
|
||||
LLView * inbox_inventory_parent = inbox_inventory_placeholder->getParent();
|
||||
|
||||
mInventoryPanel =
|
||||
LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_inbox_inventory.xml",
|
||||
inbox_inventory_parent,
|
||||
LLInventoryPanel::child_registry_t::instance());
|
||||
|
||||
// Reshape the inventory to the proper size
|
||||
LLRect inventory_placeholder_rect = inbox_inventory_placeholder->getRect();
|
||||
mInventoryPanel->setShape(inventory_placeholder_rect);
|
||||
|
||||
// Set the sort order newest to oldest, and a selection change callback
|
||||
mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE);
|
||||
mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this));
|
||||
|
||||
// Set up the note to display when the inbox is empty
|
||||
mInventoryPanel->getFilter()->setEmptyLookupMessage("InventoryInboxNoItems");
|
||||
|
||||
// Hide the placeholder text
|
||||
inbox_inventory_placeholder->setVisible(FALSE);
|
||||
}
|
||||
|
||||
void LLPanelMarketplaceInbox::onFocusReceived()
|
||||
{
|
||||
LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel<LLSidepanelInventory>("sidepanel_inventory");
|
||||
|
||||
if (sidepanel_inventory)
|
||||
{
|
||||
LLInventoryPanel * inv_panel = sidepanel_inventory->getActivePanel();
|
||||
|
||||
if (inv_panel)
|
||||
{
|
||||
inv_panel->clearSelection();
|
||||
}
|
||||
|
||||
LLInventoryPanel * outbox_panel = sidepanel_inventory->findChild<LLInventoryPanel>("inventory_outbox");
|
||||
|
||||
if (outbox_panel)
|
||||
{
|
||||
outbox_panel->clearSelection();
|
||||
}
|
||||
|
||||
sidepanel_inventory->updateVerbs();
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg)
|
||||
{
|
||||
*accept = ACCEPT_NO;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
U32 LLPanelMarketplaceInbox::getFreshItemCount() const
|
||||
{
|
||||
#if SUPPORTING_FRESH_ITEM_COUNT
|
||||
|
||||
//
|
||||
// NOTE: When turning this on, be sure to test the no inbox/outbox case because this code probably
|
||||
// will return "2" for the Inventory and LIBRARY top-levels when that happens.
|
||||
//
|
||||
|
||||
U32 fresh_item_count = 0;
|
||||
|
||||
if (mInventoryPanel)
|
||||
{
|
||||
const LLFolderViewFolder * inbox_folder = mInventoryPanel->getRootFolder();
|
||||
|
||||
if (inbox_folder)
|
||||
{
|
||||
LLFolderViewFolder::folders_t::const_iterator folders_it = inbox_folder->getFoldersBegin();
|
||||
LLFolderViewFolder::folders_t::const_iterator folders_end = inbox_folder->getFoldersEnd();
|
||||
|
||||
for (; folders_it != folders_end; ++folders_it)
|
||||
{
|
||||
const LLFolderViewFolder * folder = *folders_it;
|
||||
|
||||
// TODO: Replace this check with new "fresh" flag
|
||||
if (folder->getCreationDate() > 1500)
|
||||
{
|
||||
fresh_item_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fresh_item_count;
|
||||
#else
|
||||
return getTotalItemCount();
|
||||
#endif
|
||||
}
|
||||
|
||||
U32 LLPanelMarketplaceInbox::getTotalItemCount() const
|
||||
{
|
||||
U32 item_count = 0;
|
||||
|
||||
if (mInventoryPanel)
|
||||
{
|
||||
const LLFolderViewFolder * inbox_folder = mInventoryPanel->getRootFolder();
|
||||
|
||||
if (inbox_folder)
|
||||
{
|
||||
item_count += inbox_folder->getFoldersCount();
|
||||
}
|
||||
}
|
||||
|
||||
return item_count;
|
||||
}
|
||||
|
||||
std::string LLPanelMarketplaceInbox::getBadgeString() const
|
||||
{
|
||||
std::string item_count_str("");
|
||||
|
||||
// If the inbox is visible, and the side panel is collapsed or expanded and not the inventory panel
|
||||
if (getParent()->getVisible() &&
|
||||
(LLSideTray::getInstance()->getCollapsed() || !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory")))
|
||||
{
|
||||
U32 item_count = getFreshItemCount();
|
||||
|
||||
if (item_count)
|
||||
{
|
||||
item_count_str = llformat("%d", item_count);
|
||||
}
|
||||
}
|
||||
|
||||
return item_count_str;
|
||||
}
|
||||
|
||||
void LLPanelMarketplaceInbox::draw()
|
||||
{
|
||||
U32 item_count = getTotalItemCount();
|
||||
|
||||
LLView * fresh_new_count_view = getChildView("inbox_fresh_new_count");
|
||||
|
||||
if (item_count > 0)
|
||||
{
|
||||
std::string item_count_str = llformat("%d", item_count);
|
||||
|
||||
LLStringUtil::format_map_t args;
|
||||
args["[NUM]"] = item_count_str;
|
||||
getChild<LLButton>("inbox_btn")->setLabel(getString("InboxLabelWithArg", args));
|
||||
|
||||
#if SUPPORTING_FRESH_ITEM_COUNT
|
||||
// set green text to fresh item count
|
||||
U32 fresh_item_count = getFreshItemCount();
|
||||
fresh_new_count_view->setVisible((fresh_item_count > 0));
|
||||
|
||||
if (fresh_item_count > 0)
|
||||
{
|
||||
getChild<LLUICtrl>("inbox_fresh_new_count")->setTextArg("[NUM]", llformat("%d", fresh_item_count));
|
||||
}
|
||||
#else
|
||||
fresh_new_count_view->setVisible(FALSE);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
getChild<LLButton>("inbox_btn")->setLabel(getString("InboxLabelNoArg"));
|
||||
|
||||
fresh_new_count_view->setVisible(FALSE);
|
||||
}
|
||||
|
||||
LLPanel::draw();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,8 +120,8 @@
|
|||
|
||||
// Library includes from llvfs
|
||||
#include "lldir.h"
|
||||
|
||||
// Library includes from llmessage project
|
||||
|
||||
// Library includes from llmessage project
|
||||
#include "llcachename.h"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue