#3758 clean up: move EUnderlineLink

master
Mnikolenko Productengine 2025-04-25 20:22:33 +03:00
parent f450b42acf
commit 1eb34b43fb
8 changed files with 27 additions and 26 deletions

View File

@ -37,7 +37,7 @@ bool LLChatMentionHelper::isActive(const LLUICtrl* ctrl) const
return mHostHandle.get() == ctrl; return mHostHandle.get() == ctrl;
} }
bool LLChatMentionHelper::isCursorInNameMention(const LLWString& wtext, S32 cursor_pos, S32* mention_start_pos) bool LLChatMentionHelper::isCursorInNameMention(const LLWString& wtext, S32 cursor_pos, S32* mention_start_pos) const
{ {
if (cursor_pos <= 0 || cursor_pos > static_cast<S32>(wtext.size())) if (cursor_pos <= 0 || cursor_pos > static_cast<S32>(wtext.size()))
return false; return false;

View File

@ -42,7 +42,7 @@ class LLChatMentionHelper : public LLSingleton<LLChatMentionHelper>
public: public:
bool isActive(const LLUICtrl* ctrl) const; bool isActive(const LLUICtrl* ctrl) const;
bool isCursorInNameMention(const LLWString& wtext, S32 cursor_pos, S32* mention_start_pos = nullptr); bool isCursorInNameMention(const LLWString& wtext, S32 cursor_pos, S32* mention_start_pos = nullptr) const;
void showHelper(LLUICtrl* host_ctrl, S32 local_x, S32 local_y, const std::string& av_name, std::function<void(std::string)> commit_cb); void showHelper(LLUICtrl* host_ctrl, S32 local_x, S32 local_y, const std::string& av_name, std::function<void(std::string)> commit_cb);
void hideHelper(const LLUICtrl* ctrl = nullptr); void hideHelper(const LLUICtrl* ctrl = nullptr);

View File

@ -54,6 +54,14 @@ public:
Params(); Params();
}; };
LLStyle(const Params& p = Params()); LLStyle(const Params& p = Params());
enum EUnderlineLink
{
UNDERLINE_ALWAYS = 0,
UNDERLINE_ON_HOVER,
UNDERLINE_NEVER
};
public: public:
const LLUIColor& getColor() const { return mColor; } const LLUIColor& getColor() const { return mColor; }
void setColor(const LLUIColor &color) { mColor = color; } void setColor(const LLUIColor &color) { mColor = color; }

View File

@ -611,7 +611,7 @@ protected:
bool operator()(const LLTextSegmentPtr& a, const LLTextSegmentPtr& b) const; bool operator()(const LLTextSegmentPtr& a, const LLTextSegmentPtr& b) const;
}; };
typedef std::multiset<LLTextSegmentPtr, compare_segment_end> segment_set_t; typedef std::multiset<LLTextSegmentPtr, compare_segment_end> segment_set_t;
typedef LLUrlMatch::EUnderlineLink e_underline; typedef LLStyle::EUnderlineLink e_underline;
// member functions // member functions
LLTextBase(const Params &p); LLTextBase(const Params &p);

View File

@ -666,14 +666,14 @@ std::string LLUrlEntryAgent::getTooltip(const std::string &string) const
return LLTrans::getString("TooltipAgentUrl"); return LLTrans::getString("TooltipAgentUrl");
} }
LLUrlMatch::EUnderlineLink LLUrlEntryAgent::getUnderline(const std::string& string) const LLStyle::EUnderlineLink LLUrlEntryAgent::getUnderline(const std::string& string) const
{ {
std::string url = getUrl(string); std::string url = getUrl(string);
if (LLStringUtil::endsWith(url, "/about") || LLStringUtil::endsWith(url, "/inspect")) if (LLStringUtil::endsWith(url, "/about") || LLStringUtil::endsWith(url, "/inspect"))
{ {
return LLUrlMatch::EUnderlineLink::UNDERLINE_ON_HOVER; return LLStyle::EUnderlineLink::UNDERLINE_ON_HOVER;
} }
return LLUrlMatch::EUnderlineLink::UNDERLINE_ALWAYS; return LLStyle::EUnderlineLink::UNDERLINE_ALWAYS;
} }
std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCallback &cb) std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
@ -781,9 +781,9 @@ LLUrlEntryAgentMention::LLUrlEntryAgentMention()
mIcon = std::string(); mIcon = std::string();
} }
LLUrlMatch::EUnderlineLink LLUrlEntryAgentMention::getUnderline(const std::string& string) const LLStyle::EUnderlineLink LLUrlEntryAgentMention::getUnderline(const std::string& string) const
{ {
return LLUrlMatch::EUnderlineLink::UNDERLINE_NEVER; return LLStyle::EUnderlineLink::UNDERLINE_NEVER;
} }
LLStyle::Params LLUrlEntryAgentMention::getStyle(const std::string& url) const LLStyle::Params LLUrlEntryAgentMention::getStyle(const std::string& url) const
@ -1406,7 +1406,7 @@ std::string LLUrlEntrySLLabel::getTooltip(const std::string &string) const
return LLUrlEntryBase::getTooltip(string); return LLUrlEntryBase::getTooltip(string);
} }
LLUrlMatch::EUnderlineLink LLUrlEntrySLLabel::getUnderline(const std::string& string) const LLStyle::EUnderlineLink LLUrlEntrySLLabel::getUnderline(const std::string& string) const
{ {
std::string url = getUrl(string); std::string url = getUrl(string);
LLUrlMatch match; LLUrlMatch match;

View File

@ -34,7 +34,6 @@
#include "llavatarname.h" #include "llavatarname.h"
#include "llhost.h" // for resolving parcel name by parcel id #include "llhost.h" // for resolving parcel name by parcel id
#include "llurlmatch.h"
#include <boost/signals2.hpp> #include <boost/signals2.hpp>
#include <boost/regex.hpp> #include <boost/regex.hpp>
@ -97,7 +96,7 @@ public:
/// Return the name of a SL location described by this Url, if any /// Return the name of a SL location described by this Url, if any
virtual std::string getLocation(const std::string &url) const { return ""; } virtual std::string getLocation(const std::string &url) const { return ""; }
virtual LLUrlMatch::EUnderlineLink getUnderline(const std::string& string) const { return LLUrlMatch::EUnderlineLink::UNDERLINE_ALWAYS; } virtual LLStyle::EUnderlineLink getUnderline(const std::string& string) const { return LLStyle::EUnderlineLink::UNDERLINE_ALWAYS; }
virtual bool isTrusted() const { return false; } virtual bool isTrusted() const { return false; }
@ -233,7 +232,7 @@ public:
/*virtual*/ LLStyle::Params getStyle(const std::string &url) const; /*virtual*/ LLStyle::Params getStyle(const std::string &url) const;
/*virtual*/ LLUUID getID(const std::string &string) const; /*virtual*/ LLUUID getID(const std::string &string) const;
LLUrlMatch::EUnderlineLink getUnderline(const std::string& string) const; LLStyle::EUnderlineLink getUnderline(const std::string& string) const;
protected: protected:
/*virtual*/ void callObservers(const std::string &id, const std::string &label, const std::string& icon); /*virtual*/ void callObservers(const std::string &id, const std::string &label, const std::string& icon);
@ -253,7 +252,7 @@ public:
LLUrlEntryAgentMention(); LLUrlEntryAgentMention();
LLStyle::Params getStyle(const std::string& url) const; LLStyle::Params getStyle(const std::string& url) const;
LLUrlMatch::EUnderlineLink getUnderline(const std::string& string) const; LLStyle::EUnderlineLink getUnderline(const std::string& string) const;
bool getSkipProfileIcon(const std::string& string) const { return true; }; bool getSkipProfileIcon(const std::string& string) const { return true; };
}; };
@ -505,7 +504,7 @@ public:
/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
/*virtual*/ std::string getUrl(const std::string &string) const; /*virtual*/ std::string getUrl(const std::string &string) const;
/*virtual*/ std::string getTooltip(const std::string &string) const; /*virtual*/ std::string getTooltip(const std::string &string) const;
LLUrlMatch::EUnderlineLink getUnderline(const std::string& string) const; LLStyle::EUnderlineLink getUnderline(const std::string& string) const;
}; };
/// ///

View File

@ -37,7 +37,7 @@ LLUrlMatch::LLUrlMatch() :
mIcon(""), mIcon(""),
mMenuName(""), mMenuName(""),
mLocation(""), mLocation(""),
mUnderline(UNDERLINE_ALWAYS), mUnderline(e_underline::UNDERLINE_ALWAYS),
mTrusted(false), mTrusted(false),
mSkipProfileIcon(false) mSkipProfileIcon(false)
{ {
@ -47,7 +47,7 @@ void LLUrlMatch::setValues(U32 start, U32 end, const std::string &url, const std
const std::string& query, const std::string &tooltip, const std::string& query, const std::string &tooltip,
const std::string &icon, const LLStyle::Params& style, const std::string &icon, const LLStyle::Params& style,
const std::string &menu, const std::string &location, const std::string &menu, const std::string &location,
const LLUUID& id, EUnderlineLink underline, bool trusted, bool skip_icon) const LLUUID& id, e_underline underline, bool trusted, bool skip_icon)
{ {
mStart = start; mStart = start;
mEnd = end; mEnd = end;

View File

@ -46,13 +46,6 @@ class LLUrlMatch
public: public:
LLUrlMatch(); LLUrlMatch();
enum EUnderlineLink
{
UNDERLINE_ALWAYS = 0,
UNDERLINE_ON_HOVER,
UNDERLINE_NEVER
};
/// return true if this object does not contain a valid Url match yet /// return true if this object does not contain a valid Url match yet
bool empty() const { return mUrl.empty(); } bool empty() const { return mUrl.empty(); }
@ -86,7 +79,8 @@ public:
/// return the SL location that this Url describes, or "" if none. /// return the SL location that this Url describes, or "" if none.
std::string getLocation() const { return mLocation; } std::string getLocation() const { return mLocation; }
EUnderlineLink getUnderline() const { return mUnderline; } typedef LLStyle::EUnderlineLink e_underline;
e_underline getUnderline() const { return mUnderline; }
/// Return true if Url is trusted. /// Return true if Url is trusted.
bool isTrusted() const { return mTrusted; } bool isTrusted() const { return mTrusted; }
@ -98,7 +92,7 @@ public:
const std::string& query, const std::string &tooltip, const std::string &icon, const std::string& query, const std::string &tooltip, const std::string &icon,
const LLStyle::Params& style, const std::string &menu, const LLStyle::Params& style, const std::string &menu,
const std::string &location, const LLUUID& id, const std::string &location, const LLUUID& id,
EUnderlineLink underline = UNDERLINE_ALWAYS, bool trusted = false, bool skip_icon = false); e_underline underline = e_underline::UNDERLINE_ALWAYS, bool trusted = false, bool skip_icon = false);
const LLUUID& getID() const { return mID; } const LLUUID& getID() const { return mID; }
private: private:
@ -113,7 +107,7 @@ private:
std::string mLocation; std::string mLocation;
LLUUID mID; LLUUID mID;
LLStyle::Params mStyle; LLStyle::Params mStyle;
EUnderlineLink mUnderline; e_underline mUnderline;
bool mTrusted; bool mTrusted;
bool mSkipProfileIcon; bool mSkipProfileIcon;
}; };