// static LLPreviewGesture* LLPreviewGesture::show(const std::string& title, const LLUUID& item_id, const LLUUID& object_id, BOOL take_focus) { LLPreviewGesture* previewp = (LLPreviewGesture*)LLPreview::find(item_id); if (previewp) { previewp->open(); /*Flawfinder: ignore*/ if (take_focus) { previewp->setFocus(TRUE); } return previewp; } LLPreviewGesture* self = new LLPreviewGesture(); // Finish internal construction self->init(item_id, object_id); // Builds and adds to gFloaterView gUICtrlFactory->buildFloater(self, "floater_preview_gesture.xml"); self->setTitle(title); // Move window to top-left of screen LLMultiFloater* hostp = self->getHost(); if (hostp == NULL) { LLRect r = self->getRect(); LLRect screen = gFloaterView->getRect(); r.setLeftTopAndSize(0, screen.getHeight(), r.getWidth(), r.getHeight()); self->setRect(r); } else { // re-add to host to update title hostp->addFloater(self, TRUE); } // this will call refresh when we have everything. LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem(); if(item && !item->isComplete()) { LLInventoryGestureAvailable* observer; observer = new LLInventoryGestureAvailable(); observer->watchItem(item_id); gInventory.addObserver(observer); item->fetchFromServer(); } else { // not sure this is necessary. self->refresh(); } if (take_focus) { self->setFocus(TRUE); } return self; }
BOOL LLFloaterNewIM::canClose() { if (getHost()) { LLMultiFloater* hostp = (LLMultiFloater*)getHost(); // if we are the only tab in the im view, go ahead and close return hostp->getFloaterCount() == 1; } return TRUE; }
void LLFloaterIMPanel::setVisible(BOOL b) { LLPanel::setVisible(b); LLMultiFloater* hostp = getHost(); if( b && hostp ) { hostp->setFloaterFlashing(this, FALSE); } }
void LLFloaterNewIM::close(bool app_quitting) { if (getHost()) { LLMultiFloater* hostp = (LLMultiFloater*)getHost(); hostp->close(); } else { LLFloater::close(app_quitting); } }
void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4& color, bool log_to_file, const LLUUID& source, const std::string& name) { // start tab flashing when receiving im for background session from user if (source != LLUUID::null) { LLMultiFloater* hostp = getHost(); if( !isInVisibleChain() && hostp && source != gAgent.getID()) { hostp->setFloaterFlashing(this, TRUE); } } // Now we're adding the actual line of text, so erase the // "Foo is typing..." text segment, and the optional timestamp // if it was present. JC removeTypingIndicator(NULL); // Actually add the line std::string timestring; bool prepend_newline = true; if (gSavedSettings.getBOOL("IMShowTimestamps")) { timestring = mHistoryEditor->appendTime(prepend_newline); prepend_newline = false; } std::string separator_string(": "); // 'name' is a sender name that we want to hotlink so that clicking on it opens a profile. if (!name.empty()) // If name exists, then add it to the front of the message. { // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. if (name == SYSTEM_FROM) { mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyle::Params().color(color)); } else { // Convert the name to a hotlink and add to message. mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyleMap::instance().lookupAgent(source)); } prepend_newline = false; } mHistoryEditor->appendText(utf8msg, prepend_newline, LLStyle::Params().color(color)); mHistoryEditor->blockUndo(); if (!isInVisibleChain()) { mNumUnreadMessages++; } }
// <FS:Ansariel> Script debug icon //LLFloater* LLFloaterScriptDebug::addOutputWindow(const LLUUID &object_id) LLFloater* LLFloaterScriptDebug::addOutputWindow(const LLUUID& object_id, bool show /* = false */) // </FS:Ansariel> Script debug icon { LLMultiFloater* host = LLFloaterReg::showTypedInstance<LLMultiFloater>("script_debug", LLSD()); if (!host) return NULL; LLFloater::setFloaterHost(host); // prevent stealing focus, see EXT-8040 LLFloater* floaterp = LLFloaterReg::showInstance("script_debug_output", object_id, FALSE); LLFloater::setFloaterHost(NULL); // <FS:Ansariel> Script debug icon if (gSavedSettings.getS32("ShowScriptErrorsLocation") == 0 && !show) { host->closeFloater(); } // </FS:Ansariel> Script debug icon return floaterp; }
// static LLPreviewGesture* LLPreviewGesture::show(const std::string& title, const LLUUID& item_id, const LLUUID& object_id, BOOL take_focus) { LLPreviewGesture* previewp = (LLPreviewGesture*)LLPreview::find(item_id); if (previewp) { previewp->open(); /*Flawfinder: ignore*/ if (take_focus) { previewp->setFocus(TRUE); } return previewp; } LLPreviewGesture* self = new LLPreviewGesture(); // Finish internal construction self->init(item_id, object_id); // Builds and adds to gFloaterView LLUICtrlFactory::getInstance()->buildFloater(self, "floater_preview_gesture.xml"); self->setTitle(title); // Move window to top-left of screen LLMultiFloater* hostp = self->getHost(); if (hostp == NULL) { LLRect r = self->getRect(); LLRect screen = gFloaterView->getRect(); r.setLeftTopAndSize(0, screen.getHeight(), r.getWidth(), r.getHeight()); self->setRect(r); } else { // re-add to host to update title hostp->addFloater(self, TRUE); } // Start speculative download of sounds and animations const LLUUID animation_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_ANIMATION); LLInventoryModelBackgroundFetch::instance().start(animation_folder_id); const LLUUID sound_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SOUND); LLInventoryModelBackgroundFetch::instance().start(sound_folder_id); // this will call refresh when we have everything. LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem(); if(item && !item->isFinished()) { LLInventoryGestureAvailable* observer; observer = new LLInventoryGestureAvailable(); observer->watchItem(item_id); gInventory.addObserver(observer); item->fetchFromServer(); } else { // not sure this is necessary. self->refresh(); } if (take_focus) { self->setFocus(TRUE); } return self; }
void FSFloaterNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args) { LLChat& tmp_chat = const_cast<LLChat&>(chat); bool use_plain_text_chat_history = gSavedSettings.getBOOL("PlainTextChatHistory"); bool show_timestamps_nearby_chat = gSavedSettings.getBOOL("FSShowTimestampsNearbyChat"); // [FIRE-1641 : SJ]: Option to hide timestamps in nearby chat - add Timestamp when show_timestamps_nearby_chat is TRUE if (show_timestamps_nearby_chat) { if (tmp_chat.mTimeStr.empty()) { tmp_chat.mTimeStr = appendTime(); } } // <FS:Ansariel> Optional muted chat history tmp_chat.mFromName = chat.mFromName; LLSD chat_args = args; chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history; chat_args["show_time"] = show_timestamps_nearby_chat; chat_args["is_local"] = true; mChatHistoryMuted->appendMessage(chat, chat_args); // </FS:Ansariel> Optional muted chat history if (!chat.mMuted) { // <FS:Ansariel> Optional muted chat history //tmp_chat.mFromName = chat.mFromName; //LLSD chat_args = args; //chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history; //chat_args["show_timestamps_nearby_chat"] = show_timestamps_nearby_chat; // <(FS:Ansariel> Optional muted chat history mChatHistory->appendMessage(chat, chat_args); } if (archive) { mMessageArchive.push_back(chat); if (mMessageArchive.size() > 200) { mMessageArchive.erase(mMessageArchive.begin()); } } // <FS:Ansariel> Optional muted chat history //if (args["do_not_log"].asBoolean()) if (args["do_not_log"].asBoolean() || chat.mMuted) // </FS:Ansariel> Optional muted chat history { return; } // AO: IF tab mode active, flash our tab if (isChatMultiTab()) { LLMultiFloater* hostp = getHost(); // KC: Don't flash tab on system messages if (!isInVisibleChain() && hostp && (chat.mSourceType == CHAT_SOURCE_AGENT || chat.mSourceType == CHAT_SOURCE_OBJECT)) { hostp->setFloaterFlashing(this, TRUE); } } if (gSavedPerAccountSettings.getBOOL("LogNearbyChat")) { std::string from_name = chat.mFromName; if (chat.mSourceType == CHAT_SOURCE_AGENT) { // if the chat is coming from an agent, log the complete name LLAvatarName av_name; LLAvatarNameCache::get(chat.mFromID, &av_name); if (!av_name.isDisplayNameDefault()) { from_name = av_name.getCompleteName(); } // Ansariel: Handle IMs in nearby chat // FS:LO FIRE-5230 - Chat Console Improvement: Replacing the "IM" in front of group chat messages with the actual group name if (gSavedSettings.getBOOL("FSShowIMInChatHistory")) { if (chat.mChatType == CHAT_TYPE_IM_GROUP && !chat.mFromNameGroup.empty()) { from_name = "IM: " + chat.mFromNameGroup + from_name; } else if (chat.mChatType == CHAT_TYPE_IM) { from_name = "IM: " + from_name; } // <FS:LO> hack to prevent chat logs from containing lines like "TIMESTANMP IM:: friend is on/offline" (aka the double ":" ) if (from_name == "IM:") { from_name = "IM"; } // </FS:LO> } // FS:LO FIRE-5230 - Chat Console Improvement: Replacing the "IM" in front of group chat messages with the actual group name } // <FS:LO> Make logging IMs to the chat history file toggleable again if (!(chat.mChatType == CHAT_TYPE_IM || chat.mChatType == CHAT_TYPE_IM_GROUP) || (chat.mChatType == CHAT_TYPE_IM && chat.mSourceType == CHAT_SOURCE_OBJECT) || gSavedSettings.getBOOL("FSLogIMInChatHistory")) { LLLogChat::saveHistory("chat", from_name, chat.mFromID, chat.mText); } } }
void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, LLColor4 incolor, bool log_to_file, const LLUUID& source, const std::string& name) { static const LLCachedControl<bool> mKeywordsChangeColor(gSavedPerAccountSettings, "KeywordsChangeColor", false); static const LLCachedControl<LLColor4> mKeywordsColor(gSavedPerAccountSettings, "KeywordsColor", LLColor4(1.f, 1.f, 1.f, 1.f)); if (gAgentID != source) { if (mKeywordsChangeColor) { if (AscentKeyword::hasKeyword(utf8msg, 2)) { incolor = mKeywordsColor; } } if (mDing && (!hasFocus() || !gFocusMgr.getAppHasFocus())) { static const LLCachedControl<std::string> ding("LiruNewMessageSound"); static const LLCachedControl<std::string> dong("LiruNewMessageSoundForSystemMessages"); LLUI::sAudioCallback(LLUUID(source.notNull() ? ding : dong)); } } const LLColor4& color = incolor; // start tab flashing when receiving im for background session from user if (source.notNull()) { LLMultiFloater* hostp = getHost(); if( !isInVisibleChain() && hostp && source != gAgentID) { hostp->setFloaterFlashing(this, TRUE); } } // Now we're adding the actual line of text, so erase the // "Foo is typing..." text segment, and the optional timestamp // if it was present. JC removeTypingIndicator(NULL); // Actually add the line bool prepend_newline = true; if (gSavedSettings.getBOOL("IMShowTimestamps")) { mHistoryEditor->appendTime(prepend_newline); prepend_newline = false; } std::string show_name = name; bool is_irc = false; // 'name' is a sender name that we want to hotlink so that clicking on it opens a profile. if (!name.empty()) // If name exists, then add it to the front of the message. { // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. if (name == SYSTEM_FROM) { mHistoryEditor->appendColoredText(name,false,prepend_newline,color); } else { // IRC style text starts with a colon here; empty names and system messages aren't irc style. static const LLCachedControl<bool> italicize("LiruItalicizeActions"); is_irc = italicize && utf8msg[0] != ':'; if (source.notNull()) LLAvatarNameCache::getPNSName(source, show_name); // Convert the name to a hotlink and add to message. LLStyleSP source_style = LLStyleMap::instance().lookupAgent(source); source_style->mItalic = is_irc; mHistoryEditor->appendStyledText(show_name,false,prepend_newline,source_style); } prepend_newline = false; } // Append the chat message in style { LLStyleSP style(new LLStyle); style->setColor(color); style->mItalic = is_irc; style->mBold = gSavedSettings.getBOOL("SingularityBoldGroupModerator") && isModerator(source); mHistoryEditor->appendStyledText(utf8msg, false, prepend_newline, style); } if (log_to_file && gSavedPerAccountSettings.getBOOL("LogInstantMessages") ) { std::string histstr; if (gSavedPerAccountSettings.getBOOL("IMLogTimestamp")) histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + show_name + utf8msg; else histstr = show_name + utf8msg; // [Ansariel: Display name support] // Floater title contains display name -> bad idea to use that as filename // mLogLabel, however, is the old legacy name //LLLogChat::saveHistory(getTitle(),histstr); LLLogChat::saveHistory(mLogLabel, histstr); // [/Ansariel: Display name support] } if (source.notNull()) { if (!isInVisibleChain() || (!hasFocus() && getParent() == gFloaterView)) { mNumUnreadMessages++; } mSpeakers->speakerChatted(source); mSpeakers->setSpeakerTyping(source, FALSE); } }