diff options
-rw-r--r-- | indra/llcommon/llfasttimer.h | 10 | ||||
-rw-r--r-- | indra/llcommon/llfasttimer_class.cpp | 6 | ||||
-rw-r--r-- | indra/llui/lltextbase.cpp | 46 | ||||
-rw-r--r-- | indra/llui/lltextbase.h | 8 | ||||
-rw-r--r-- | indra/newview/llappearancemgr.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llfloaterabout.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewerhelp.cpp | 28 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_login.xml | 2 |
8 files changed, 107 insertions, 17 deletions
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 32f3561616..48461df6ae 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -113,7 +113,7 @@ inline U64 LLFastTimer::getCPUClockCount64() struct timespec tp; #ifdef CLOCK_MONOTONIC // MONOTONIC supported at build-time? - if (-1 == clock_gettime(CLOCK_MONOTONIC,&tp)) // if MONOTONIC isn't supported at runtime, try REALTIME + if (-1 == clock_gettime(CLOCK_MONOTONIC,&tp)) // if MONOTONIC isn't supported at runtime then ouch, try REALTIME #endif clock_gettime(CLOCK_REALTIME,&tp); @@ -122,7 +122,7 @@ inline U64 LLFastTimer::getCPUClockCount64() inline U32 LLFastTimer::getCPUClockCount32() { - return (U32)LLFastTimer::getCPUClockCount64(); + return (U32)(LLFastTimer::getCPUClockCount64() >> 8); } #endif // (LL_LINUX || LL_SOLARIS)) @@ -134,14 +134,14 @@ inline U32 LLFastTimer::getCPUClockCount32() { U64 x; __asm__ volatile (".byte 0x0f, 0x31": "=A"(x)); - return (U32)x >> 8; + return (U32)(x >> 8); } inline U64 LLFastTimer::getCPUClockCount64() { U64 x; __asm__ volatile (".byte 0x0f, 0x31": "=A"(x)); - return x >> 8; + return x; } #endif @@ -154,7 +154,7 @@ inline U64 LLFastTimer::getCPUClockCount64() inline U32 LLFastTimer::getCPUClockCount32() { - return (U32)get_clock_count(); + return (U32)(get_clock_count()>>8); } inline U64 LLFastTimer::getCPUClockCount64() diff --git a/indra/llcommon/llfasttimer_class.cpp b/indra/llcommon/llfasttimer_class.cpp index abcaee673e..fae0a66873 100644 --- a/indra/llcommon/llfasttimer_class.cpp +++ b/indra/llcommon/llfasttimer_class.cpp @@ -226,12 +226,12 @@ void LLFastTimer::DeclareTimer::updateCachedPointers() //static #if LL_LINUX || LL_SOLARIS || ( LL_DARWIN && !(defined(__i386__) || defined(__amd64__)) ) -U64 LLFastTimer::countsPerSecond() +U64 LLFastTimer::countsPerSecond() // counts per second for the *32-bit* timer { - return sClockResolution; + return sClockResolution >> 8; } #else // windows or x86-mac -U64 LLFastTimer::countsPerSecond() +U64 LLFastTimer::countsPerSecond() // counts per second for the *32-bit* timer { static U64 sCPUClockFrequency = U64(CProcessor().GetCPUFrequency(50)); diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index f7da9f089a..8abbc833e5 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1512,6 +1512,25 @@ void LLTextBase::setText(const LLStringExplicit &utf8str, const LLStyle::Params& onValueChange(0, getLength()); } +void LLTextBase::addBlackListUrl(const std::string &url) +{ + mBlackListUrls.push_back(url); +} + +bool LLTextBase::isBlackListUrl(const std::string &url) const +{ + std::vector<std::string>::const_iterator it; + for (it = mBlackListUrls.begin(); it != mBlackListUrls.end(); ++it) + { + const std::string &blacklist_url = *it; + if (url.find(blacklist_url) != std::string::npos) + { + return true; + } + } + return false; +} + //virtual std::string LLTextBase::getText() const { @@ -1586,20 +1605,29 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c prepend_newline = false; } } - // output the styled Url - appendAndHighlightText(match.getLabel(), prepend_newline, part, link_params); - prepend_newline = false; - // set the tooltip for the Url label - if (! match.getTooltip().empty()) + // output the styled Url (unless we've been asked to suppress it) + if (isBlackListUrl(match.getUrl())) + { + std::string orig_url = text.substr(start, end-start); + appendAndHighlightText(orig_url, prepend_newline, part, style_params); + } + else { - segment_set_t::iterator it = getSegIterContaining(getLength()-1); - if (it != mSegments.end()) + appendAndHighlightText(match.getLabel(), prepend_newline, part, link_params); + + // set the tooltip for the Url label + if (! match.getTooltip().empty()) { - LLTextSegmentPtr segment = *it; - segment->setToolTip(match.getTooltip()); + segment_set_t::iterator it = getSegIterContaining(getLength()-1); + if (it != mSegments.end()) + { + LLTextSegmentPtr segment = *it; + segment->setToolTip(match.getTooltip()); + } } } + prepend_newline = false; // move on to the rest of the text after the Url if (end < (S32)text.length()) diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 038b9eaa62..e1c6cc36ab 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -41,6 +41,7 @@ #include "llpanel.h" #include <string> +#include <vector> #include <set> #include <boost/signals2.hpp> @@ -186,6 +187,9 @@ public: const LLFontGL* getDefaultFont() const { return mDefaultFont; } LLStyle::Params getDefaultStyle(); + // tell the text object to suppress auto highlighting of a specific URL + void addBlackListUrl(const std::string &url); + public: // Fired when a URL link is clicked commit_signal_t mURLClickSignal; @@ -308,6 +312,7 @@ protected: void updateRects(); void needsScroll() { mScrollNeeded = TRUE; } void replaceUrlLabel(const std::string &url, const std::string &label); + bool isBlackListUrl(const std::string &url) const; protected: // text segmentation and flow @@ -359,6 +364,9 @@ protected: LLView* mDocumentView; class LLScrollContainer* mScroller; + // list of URLs to suppress from automatic hyperlinking + std::vector<std::string> mBlackListUrls; + // transient state bool mReflowNeeded; // need to reflow text because of change to text contents or display region bool mScrollNeeded; // need to change scroll region because of change to cursor position diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 03180b6a9d..1dec8c7bd8 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -35,6 +35,7 @@ #include "llagent.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llcommandhandler.h" #include "llfloatercustomize.h" #include "llgesturemgr.h" #include "llinventorybridge.h" @@ -47,6 +48,23 @@ #include "llviewerregion.h" #include "llwearablelist.h" +// support for secondlife:///app/appearance SLapps +class LLAppearanceHandler : public LLCommandHandler +{ +public: + // requests will be throttled from a non-trusted browser + LLAppearanceHandler() : LLCommandHandler("appearance", UNTRUSTED_THROTTLE) {} + + bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) + { + // support secondlife:///app/appearance/show, but for now we just + // make all secondlife:///app/appearance SLapps behave this way + LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD()); + return true; + } +}; +LLAppearanceHandler gAppearanceHandler; + class LLWearInventoryCategoryCallback : public LLInventoryCallback { public: diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index ef69f39ad2..04f4ddf996 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -187,6 +187,12 @@ BOOL LLFloaterAbout::postBuild() support << '\n' << getString("AboutTraffic", args); } + // don't make the sim hostname be a hyperlink + if (info.has("HOSTNAME")) + { + support_widget->addBlackListUrl(info["HOSTNAME"].asString()); + } + support_widget->appendText(support.str(), FALSE, LLStyle::Params() diff --git a/indra/newview/llviewerhelp.cpp b/indra/newview/llviewerhelp.cpp index 7c491ad154..b82538dacb 100644 --- a/indra/newview/llviewerhelp.cpp +++ b/indra/newview/llviewerhelp.cpp @@ -33,6 +33,7 @@ #include "llviewerprecompiledheaders.h" +#include "llcommandhandler.h" #include "llfloaterhelpbrowser.h" #include "llfloaterreg.h" #include "llfocusmgr.h" @@ -43,6 +44,33 @@ #include "llviewerhelputil.h" #include "llviewerhelp.h" +// support for secondlife:///app/help/{TOPIC} SLapps +class LLHelpHandler : public LLCommandHandler +{ +public: + // requests will be throttled from a non-trusted browser + LLHelpHandler() : LLCommandHandler("help", UNTRUSTED_THROTTLE) {} + + bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) + { + LLViewerHelp* vhelp = LLViewerHelp::getInstance(); + if (! vhelp) + { + return false; + } + + // get the requested help topic name, or use the fallback if none + std::string help_topic = vhelp->defaultTopic(); + if (params.size() >= 1) + { + help_topic = params[0].asString(); + } + + vhelp->showTopic(help_topic); + return true; + } +}; +LLHelpHandler gHelpHandler; ////////////////////////////// // implement LLHelp interface diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml index a0dec346a4..5f38522758 100644 --- a/indra/newview/skins/default/xui/en/menu_login.xml +++ b/indra/newview/skins/default/xui/en/menu_login.xml @@ -10,6 +10,7 @@ <menu create_jump_keys="true" label="Me" + tear_off="true" name="File"> <menu_item_call label="Preferences" @@ -39,6 +40,7 @@ <menu create_jump_keys="true" label="Help" + tear_off="true" name="Help"> <menu_item_call label="[SECOND_LIFE] Help" |