BOOL LLOverlayBar::postBuild() { childSetAction("New IM",onClickIMReceived,this); childSetAction("Set Not Busy",onClickSetNotBusy,this); childSetAction("Mouselook",onClickMouselook,this); childSetAction("Stand Up",onClickStandUp,this); childSetAction("Cancel TP",onClickCancelTP,this); childSetAction("Flycam",onClickFlycam,this); childSetVisible("chat_bar", gSavedSettings.getBOOL("ChatVisible")); mCancelBtn = getChild<LLButton>("Cancel TP"); setFocusRoot(TRUE); mBuilt = true; mOriginalIMLabel = getChild<LLButton>("New IM")->getLabelSelected(); layoutButtons(); sAdvSettingsPopup = gSavedSettings.getBOOL("wlfAdvSettingsPopup"); sChatVisible = gSavedSettings.getBOOL("ChatVisible"); gSavedSettings.getControl("wlfAdvSettingsPopup")->getSignal()->connect(boost::bind(&updateAdvSettingsPopup,_2)); gSavedSettings.getControl("ChatVisible")->getSignal()->connect(boost::bind(&updateChatVisible,_2)); gSavedSettings.getControl("EnableAORemote")->getSignal()->connect(boost::bind(&updateAORemote,_2)); childSetVisible("AdvSettings_container", !sAdvSettingsPopup); childSetVisible("AdvSettings_container_exp", sAdvSettingsPopup); childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote")); return TRUE; }
LLToolBar::LLToolBar() : LLLayoutPanel() { setIsChrome(TRUE); setFocusRoot(TRUE); mCommitCallbackRegistrar.add("ShowFloater", boost::bind(show_floater, _2)); }
LLMediaRemoteCtrl::LLMediaRemoteCtrl() { setIsChrome(TRUE); setFocusRoot(TRUE); mFactoryMap["Volume Panel"] = LLCallbackMap(createVolumePanel, NULL); build(); }
void LLPanel::initFromParams(const LLPanel::Params& p) { //setting these here since panel constructor not called with params //and LLView::initFromParams will use them to set visible and enabled setVisible(p.visible); setEnabled(p.enabled); setFocusRoot(p.focus_root); setSoundFlags(p.sound_flags); // control_name, tab_stop, focus_lost_callback, initial_value, rect, enabled, visible LLUICtrl::initFromParams(p); // visible callback if (p.visible_callback.isProvided()) { setVisibleCallback(initCommitCallback(p.visible_callback)); } for (LLInitParam::ParamIterator<LocalizedString>::const_iterator it = p.strings.begin(); it != p.strings.end(); ++it) { mUIStrings[it->name] = it->value; } setLabel(p.label()); setHelpTopic(p.help_topic); setShape(p.rect); parseFollowsFlags(p); setToolTip(p.tool_tip()); setFromXUI(p.from_xui); mHoverCursor = getCursorFromString(p.hover_cursor); if (p.has_border) { addBorder(p.border); } // let constructors set this value if not provided if (p.use_bounding_rect.isProvided()) { setUseBoundingRect(p.use_bounding_rect); } setDefaultTabGroup(p.default_tab_group); setMouseOpaque(p.mouse_opaque); setBackgroundVisible(p.background_visible); setBackgroundOpaque(p.background_opaque); setBackgroundColor(p.bg_opaque_color().get()); setTransparentColor(p.bg_alpha_color().get()); mBgOpaqueImage = p.bg_opaque_image(); mBgAlphaImage = p.bg_alpha_image(); mBgOpaqueImageOverlay = p.bg_opaque_image_overlay; mBgAlphaImageOverlay = p.bg_alpha_image_overlay; mAcceptsBadge = p.accepts_badge; }
wlfPanel_AdvSettings::wlfPanel_AdvSettings() : mExpanded(false) { setVisible(false); setIsChrome(TRUE); setFocusRoot(TRUE); mCommitCallbackRegistrar.add("Wlf.ChangeCameraPreset", boost::bind(&wlfPanel_AdvSettings::onChangeCameraPreset, this, _1, _2)); if(rlv_handler_t::isEnabled()) gRlvHandler.setBehaviourToggleCallback(boost::bind(&wlfPanel_AdvSettings::onRlvBehaviorChange, this, _1, _2)); }
LLWindlightRemoteCtrl::LLWindlightRemoteCtrl() : mObserver(NULL) { setIsChrome(TRUE); build(); setFocusRoot(TRUE); }
LLToolBar::LLToolBar() : LLPanel() #if LL_DARWIN , mResizeHandle(NULL) #endif // LL_DARWIN { setIsChrome(TRUE); setFocusRoot(TRUE); }
LLWindlightRemoteCtrl::LLWindlightRemoteCtrl() { mPresetsCombo = NULL; mObserver = NULL; setIsChrome(TRUE); build(); setFocusRoot(TRUE); }
LLToolBar::LLToolBar() : LLPanel(), mInventoryAutoOpen(FALSE), mNumUnreadIMs(0) #if LL_DARWIN , mResizeHandle(NULL) #endif // LL_DARWIN { setIsChrome(TRUE); setFocusRoot(TRUE); mCommitCallbackRegistrar.add("HandleCommunicate", &LLToolBar::onClickCommunicate); }
BOOL LLOverlayBar::postBuild() { childSetAction("IM Received",onClickIMReceived,this); childSetAction("Set Not Busy",onClickSetNotBusy,this); childSetAction("Mouselook",onClickMouselook,this); childSetAction("Stand Up",onClickStandUp,this); childSetVisible("chat_bar", gSavedSettings.getBOOL("ChatVisible")); setFocusRoot(TRUE); mBuilt = true; layoutButtons(); return TRUE; }
LLVoiceRemoteCtrl::LLVoiceRemoteCtrl (const std::string& name) : LLPanel(name) { setIsChrome(TRUE); if (gSavedSettings.getBOOL("ShowVoiceChannelPopup")) { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_voice_remote_expanded.xml"); } else { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_voice_remote.xml"); } setFocusRoot(TRUE); }
BOOL LLOverlayBar::postBuild() { childSetAction("New IM",onClickIMReceived,this); childSetAction("Set Not Busy",onClickSetNotBusy,this); childSetAction("Mouselook",onClickMouselook,this); childSetAction("Stand Up",onClickStandUp,this); childSetAction("Cancel TP",onClickCancelTP,this); childSetAction("Flycam",onClickFlycam,this); mCancelBtn = getChild<LLButton>("Cancel TP"); setFocusRoot(TRUE); mBuilt = true; mUnreadCountStringPlural = getString("unread_count_string_plural"); mChatbarAndButtons.connect(this,"chatbar_and_buttons"); mNewIM.connect(this,"New IM"); mNotBusy.connect(this,"Set Not Busy"); mMouseLook.connect(this,"Mouselook"); mStandUp.connect(this,"Stand Up"); mFlyCam.connect(this,"Flycam"); mChatBar.connect(this,"chat_bar"); mVoiceRemoteContainer.connect(this,"voice_remote_container"); mStateManagementContainer.connect(this,"state_management_buttons_container"); mAORemoteContainer.connect(this,"ao_remote_container"); mAdvSettingsContainer.connect(this,"AdvSettings_container"); mMediaRemoteContainer.connect(this,"media_remote_container"); updateAdvSettingsPopup(gSavedSettings.getBOOL("wlfAdvSettingsPopup")); updateChatVisible(gSavedSettings.getBOOL("ChatVisible")); updateAORemoteVisible(gSavedSettings.getBOOL("EnableAORemote")); mOriginalIMLabel = mNewIM->getLabelSelected(); layoutButtons(); gSavedSettings.getControl("wlfAdvSettingsPopup")->getSignal()->connect(boost::bind(&LLOverlayBar::updateAdvSettingsPopup,this,_2)); gSavedSettings.getControl("ChatVisible")->getSignal()->connect(boost::bind(&LLOverlayBar::updateChatVisible,this,_2)); gSavedSettings.getControl("EnableAORemote")->getSignal()->connect(boost::bind(&LLOverlayBar::updateAORemoteVisible,this,_2)); gSavedSettings.getControl("ShowNearbyMediaFloater")->getSignal()->connect(boost::bind(&updateNearbyMediaFloater,_2)); mAORemoteContainer->setVisible(gSavedSettings.getBOOL("EnableAORemote")); return TRUE; }
BOOL LLOverlayBar::postBuild() { childSetAction("IM Received",onClickIMReceived,this); childSetAction("Set Not Busy",onClickSetNotBusy,this); childSetAction("Mouselook",onClickMouselook,this); childSetAction("Stand Up",onClickStandUp,this); childSetAction("Flycam",onClickFlycam,this); childSetVisible("chat_bar", gSavedSettings.getBOOL("ChatVisible")); setFocusRoot(TRUE); mBuilt = true; mOriginalIMLabel = getChild<LLButton>("IM Received")->getLabelSelected(); layoutButtons(); return TRUE; }
LLNavigationBar::LLNavigationBar() : mTeleportHistoryMenu(NULL), mBtnBack(NULL), mBtnForward(NULL), mBtnHome(NULL), mCmbLocation(NULL), mSearchComboBox(NULL), mPurgeTPHistoryItems(false), mSaveToLocationHistory(false) { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_navigation_bar.xml"); // set a listener function for LoginComplete event LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLNavigationBar::handleLoginComplete, this)); // Necessary for focus movement among child controls setFocusRoot(TRUE); }
//--------------------------------------------------------------------------- // Public methods //--------------------------------------------------------------------------- LLPanelLogin::LLPanelLogin(const LLRect &rect, void (*callback)(S32 option, void* user_data), void *cb_data) : LLPanel(std::string("panel_login"), LLRect(0,600,800,0), FALSE), // not bordered mLogoImage(), mCallback(callback), mCallbackData(cb_data), mHtmlAvailable( TRUE ) { setFocusRoot(TRUE); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); // instance management if (LLPanelLogin::sInstance) { llwarns << "Duplicate instance of login view deleted" << llendl; delete LLPanelLogin::sInstance; // Don't leave bad pointer in gFocusMgr gFocusMgr.setDefaultKeyboardFocus(NULL); } LLPanelLogin::sInstance = this; // add to front so we are the bottom-most child gViewerWindow->getRootView()->addChildAtEnd(this); // Logo mLogoImage = LLUI::getUIImage("startup_logo.j2c"); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml"); #if USE_VIEWER_AUTH //leave room for the login menu bar setRect(LLRect(0, rect.getHeight()-18, rect.getWidth(), 0)); #endif reshape(rect.getWidth(), rect.getHeight()); #if !USE_VIEWER_AUTH LLComboBox* name_combo = sInstance->getChild<LLComboBox>("name_combo"); name_combo->setCommitCallback(onSelectLoginEntry); name_combo->setFocusLostCallback(onLoginComboLostFocus); name_combo->setPrevalidate(LLLineEditor::prevalidatePrintableNotPipe); name_combo->setSuppressTentative(true); name_combo->setSuppressAutoComplete(true); childSetCommitCallback("remember_name_check", onNameCheckChanged); childSetCommitCallback("password_edit", mungePassword); childSetKeystrokeCallback("password_edit", onPassKey, this); childSetUserData("password_edit", this); // change z sort of clickable text to be behind buttons sendChildToBack(getChildView("channel_text")); sendChildToBack(getChildView("forgot_password_text")); LLLineEditor* edit = getChild<LLLineEditor>("password_edit"); if (edit) edit->setDrawAsterixes(TRUE); //OGPX : This keeps the uris in a history file //OGPX TODO: should this be inside an OGP only check? LLComboBox* regioncombo = getChild<LLComboBox>("regionuri_edit"); regioncombo->setAllowTextEntry(TRUE, 256, FALSE); std::string current_regionuri = gSavedSettings.getString("CmdLineRegionURI"); // iterate on uri list adding to combobox (couldn't figure out how to add them all in one call) // ... and also append the command line value we might have gotten to the URLHistory LLSD regionuri_history = LLURLHistory::getURLHistory("regionuri"); LLSD::array_iterator iter_history = regionuri_history.beginArray(); LLSD::array_iterator iter_end = regionuri_history.endArray(); for (; iter_history != iter_end; ++iter_history) { regioncombo->addSimpleElement((*iter_history).asString()); } if ( LLURLHistory::appendToURLCollection("regionuri",current_regionuri)) { // since we are in login, another read of urlhistory file is going to happen // so we need to persist the new value we just added (or maybe we should do it in startup.cpp?) // since URL history only populated on create of sInstance, add to combo list directly regioncombo->addSimpleElement(current_regionuri); } // select which is displayed if we have a current URL. regioncombo->setSelectedByValue(LLSD(current_regionuri),TRUE); //llinfos << " url history: " << LLSDOStreamer<LLSDXMLFormatter>(LLURLHistory::getURLHistory("regionuri")) << llendl; LLComboBox* combo = getChild<LLComboBox>("start_location_combo"); combo->setAllowTextEntry(TRUE, 128, FALSE); // The XML file loads the combo with the following labels: // 0 - "My Home" // 1 - "My Last Location" // 2 - "<Type region name>" BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); std::string sim_string = LLURLSimString::sInstance.mSimString; if (!sim_string.empty()) { // Replace "<Type region name>" with this region name combo->remove(2); combo->add( sim_string ); combo->setTextEntry(sim_string); combo->setCurrentByIndex( 2 ); } else if (login_last) { combo->setCurrentByIndex( 1 ); } else { combo->setCurrentByIndex( 0 ); } combo->setCommitCallback( &set_start_location ); childSetAction("connect_btn", onClickConnect, this); setDefaultBtn("connect_btn"); // childSetAction("quit_btn", onClickQuit, this); childSetAction("grids_btn", onClickGrids, this); childSetCommitCallback("grids_combo", onSelectGrid, this); std::string channel = LL_CHANNEL; std::string version = llformat("%d.%d.%d (%d)", LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD ); LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); channel_text->setTextArg("[CHANNEL]", channel); // though not displayed channel_text->setTextArg("[VERSION]", version); channel_text->setClickedCallback(onClickVersion); channel_text->setCallbackUserData(this); LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text"); forgot_password_text->setClickedCallback(onClickForgotPassword); LLTextBox* create_new_account_text = getChild<LLTextBox>("create_new_account_text"); create_new_account_text->setClickedCallback(onClickNewAccount); #endif // get the web browser control LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("login_html"); web_browser->addObserver(this); // Need to handle login secondlife:///app/ URLs web_browser->setTrusted( true ); // don't make it a tab stop until SL-27594 is fixed web_browser->setTabStop(FALSE); // web_browser->navigateToLocalPage( "loading", "loading.html" ); // make links open in external browser web_browser->setOpenInExternalBrowser( true ); // force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through) LLRect htmlRect = getRect(); #if USE_VIEWER_AUTH htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY(), getRect().getWidth() + 6, getRect().getHeight()); #else htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY() + 40, getRect().getWidth() + 6, getRect().getHeight() - 78 ); #endif web_browser->setRect( htmlRect ); web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); reshape( getRect().getWidth(), getRect().getHeight(), 1 ); updateGridCombo(); childSetVisible("create_new_account_text", !gHippoGridManager->getConnectedGrid()->getRegisterUrl().empty()); childSetVisible("forgot_password_text", !gHippoGridManager->getConnectedGrid()->getPasswordUrl().empty()); loadLoginPage(); #if !USE_VIEWER_AUTH // Initialize visibility (and don't force visibility - use prefs) refreshLocation( false ); #endif }
LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) : LLPanel(name, LLRect(), FALSE), // not mouse opaque mBalance(0), mHealth(100), mSquareMetersCredit(0), mSquareMetersCommitted(0) { // status bar can possible overlay menus? mMouseOpaque = FALSE; setIsChrome(TRUE); mBalanceTimer = new LLFrameTimer(); mHealthTimer = new LLFrameTimer(); gUICtrlFactory->buildPanel(this,"panel_status_bar.xml"); // status bar can never get a tab setFocusRoot(FALSE); mBtnScriptOut = LLUICtrlFactory::getButtonByName( this, "scriptout" ); mBtnHealth = LLUICtrlFactory::getButtonByName( this, "health" ); mBtnFly = LLUICtrlFactory::getButtonByName( this, "fly" ); mBtnBuild = LLUICtrlFactory::getButtonByName( this, "build" ); mBtnScripts = LLUICtrlFactory::getButtonByName( this, "scripts" ); mBtnPush = LLUICtrlFactory::getButtonByName( this, "restrictpush" ); mBtnBuyLand = LLUICtrlFactory::getButtonByName( this, "buyland" ); mBtnBuyCurrency = LLUICtrlFactory::getButtonByName( this, "buycurrency" ); mTextParcelName = LLUICtrlFactory::getTextBoxByName( this, "ParcelNameText" ); mTextBalance = LLUICtrlFactory::getTextBoxByName( this, "BalanceText" ); mTextHealth = LLUICtrlFactory::getTextBoxByName( this, "HealthText" ); mTextTime = LLUICtrlFactory::getTextBoxByName( this, "TimeText" ); S32 x = mRect.getWidth() - 2; S32 y = 0; LLRect r; r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); mSGBandwidth = new LLStatGraph("BandwidthGraph", r); mSGBandwidth->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); mSGBandwidth->setStat(&gViewerStats->mKBitStat); LLString text = childGetText("bandwidth_tooltip") + " "; LLUIString bandwidth_tooltip = text; // get the text from XML until this widget is XML driven mSGBandwidth->setLabel(bandwidth_tooltip.getString().c_str()); mSGBandwidth->setUnits("Kbps"); mSGBandwidth->setPrecision(0); addChild(mSGBandwidth); x -= SIM_STAT_WIDTH + 2; r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); mSGPacketLoss = new LLStatGraph("PacketLossPercent", r); mSGPacketLoss->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); mSGPacketLoss->setStat(&gViewerStats->mPacketsLostPercentStat); text = childGetText("packet_loss_tooltip") + " "; LLUIString packet_loss_tooltip = text; // get the text from XML until this widget is XML driven mSGPacketLoss->setLabel(packet_loss_tooltip.getString().c_str()); mSGPacketLoss->setUnits("%"); mSGPacketLoss->setMin(0.f); mSGPacketLoss->setMax(5.f); mSGPacketLoss->setThreshold(0, 0.5f); mSGPacketLoss->setThreshold(1, 1.f); mSGPacketLoss->setThreshold(2, 3.f); mSGPacketLoss->setPrecision(1); mSGPacketLoss->mPerSec = FALSE; addChild(mSGPacketLoss); }
//--------------------------------------------------------------------------- // Singu Note: We could clean a lot of this up by creating derived classes for Notifications and NotificationTips. LLNotifyBox::LLNotifyBox(LLNotificationPtr notification) : LLPanel(notification->getName(), LLRect(), BORDER_NO), LLEventTimer(notification->getExpiration() == LLDate() ? LLDate(LLDate::now().secondsSinceEpoch() + (F64)gSavedSettings.getF32("NotifyTipDuration")) : notification->getExpiration()), LLInstanceTracker<LLNotifyBox, LLUUID>(notification->getID()), mNotification(notification), mIsTip(notification->getType() == "notifytip"), mAnimating(gNotifyBoxView->getChildCount() == 0), // Only animate first window mNextBtn(NULL), mNumOptions(0), mNumButtons(0), mAddedDefaultBtn(false), mUserInputBox(NULL) { std::string edit_text_name; std::string edit_text_contents; // setup paramaters const std::string& message(notification->getMessage()); // initialize setFocusRoot(!mIsTip); // caution flag can be set explicitly by specifying it in the // notification payload, or it can be set implicitly if the // notify xml template specifies that it is a caution // // tip-style notification handle 'caution' differently - // they display the tip in a different color mIsCaution = notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH; LLNotificationFormPtr form(notification->getForm()); mNumOptions = form->getNumElements(); bool is_textbox = form->getElement("message").isDefined(); bool layout_script_dialog(notification->getName() == "ScriptDialog" || notification->getName() == "ScriptDialogGroup"); LLRect rect = mIsTip ? getNotifyTipRect(message) : getNotifyRect(is_textbox ? 10 : mNumOptions, layout_script_dialog, mIsCaution); setRect(rect); setFollows(mIsTip ? (FOLLOWS_BOTTOM|FOLLOWS_RIGHT) : (FOLLOWS_TOP|FOLLOWS_RIGHT)); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); LLIconCtrl* icon; LLTextEditor* text; const S32 TOP = getRect().getHeight() - (mIsTip ? (S32)sFont->getLineHeight() : 32); const S32 BOTTOM = (S32)sFont->getLineHeight(); S32 x = HPAD + HPAD; S32 y = TOP; if (mIsTip) { // use the tip notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_tip_icon.tga")); } else if (mIsCaution) { // use the caution notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_caution_icon.tga")); } else { // use the default notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_box_icon.tga")); } icon->setMouseOpaque(FALSE); addChild(icon); x += HPAD + HPAD + 32; // add a caution textbox at the top of a caution notification LLTextBox* caution_box = NULL; if (mIsCaution && !mIsTip) { S32 caution_height = ((S32)sFont->getLineHeight() * 2) + VPAD; caution_box = new LLTextBox( std::string("caution_box"), LLRect(x, y, getRect().getWidth() - 2, caution_height), LLStringUtil::null, sFont, FALSE); caution_box->setFontStyle(LLFontGL::BOLD); caution_box->setColor(gColors.getColor("NotifyCautionWarnColor")); caution_box->setBackgroundColor(gColors.getColor("NotifyCautionBoxColor")); caution_box->setBorderVisible(FALSE); caution_box->setWrappedText(notification->getMessage()); addChild(caution_box); // adjust the vertical position of the next control so that // it appears below the caution textbox y = y - caution_height; } else if (mIsCaution && mIsTip) { const S32 BTN_TOP = BOTTOM_PAD + (((mNumOptions-1+2)/3)) * (BTN_HEIGHT+VPAD); // Tokenization on \n is handled by LLTextBox const S32 MAX_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB_LAST_NAME_BUF_SIZE + DB_INV_ITEM_NAME_BUF_SIZE; // For script dialogs: add space for title. text = new LLTextEditor(std::string("box"), LLRect(x, y, getRect().getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16), MAX_LENGTH, message, sFont, FALSE); text->setWordWrap(TRUE); text->setTabStop(FALSE); text->setMouseOpaque(FALSE); text->setBorderVisible(FALSE); text->setTakesNonScrollClicks(FALSE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( LLColor4::transparent ); // the background color of the box is manually // rendered under the text box, therefore we want // the actual text box to be transparent text->setReadOnlyFgColor ( gColors.getColor("NotifyCautionWarnColor") ); //sets caution text color for tip notifications text->setEnabled(FALSE); // makes it read-only text->setTabStop(FALSE); // can't tab to it (may be a problem for scrolling via keyboard) addChild(text); } else { const S32 BTN_TOP = BOTTOM_PAD + (((mNumOptions-1+2)/3)) * (BTN_HEIGHT+VPAD); // Tokenization on \n is handled by LLTextBox const S32 MAX_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB_LAST_NAME_BUF_SIZE + DB_INV_ITEM_NAME_BUF_SIZE; // For script dialogs: add space for title. text = new LLTextEditor(std::string("box"), LLRect(x, y, getRect().getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16), MAX_LENGTH, message, sFont, FALSE); text->setWordWrap(TRUE); text->setTabStop(FALSE); text->setMouseOpaque(FALSE); text->setBorderVisible(FALSE); text->setTakesNonScrollClicks(FALSE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( LLColor4::transparent ); // the background color of the box is manually // rendered under the text box, therefore we want // the actual text box to be transparent text->setReadOnlyFgColor ( gColors.getColor("NotifyTextColor") ); text->setEnabled(FALSE); // makes it read-only text->setTabStop(FALSE); // can't tab to it (may be a problem for scrolling via keyboard) addChild(text); } if (mIsTip) { chat_notification(mNotification); } else { mNextBtn = new LLButton(std::string("next"), LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, boost::bind(&LLNotifyBox::moveToBack, this, true), sFont); mNextBtn->setScaleImage(TRUE); mNextBtn->setToolTip(LLTrans::getString("next")); addChild(mNextBtn); for (S32 i = 0; i < mNumOptions; i++) { LLSD form_element = form->getElement(i); std::string element_type = form_element["type"].asString(); if (element_type == "button") { addButton(form_element["name"].asString(), form_element["text"].asString(), TRUE, form_element["default"].asBoolean(), layout_script_dialog); } else if (element_type == "input") { edit_text_contents = form_element["value"].asString(); edit_text_name = form_element["name"].asString(); } } if (is_textbox) { S32 button_rows = layout_script_dialog ? 2 : 1; LLRect input_rect; input_rect.setOriginAndSize(x, BOTTOM_PAD + button_rows * (BTN_HEIGHT + VPAD), 3 * 80 + 4 * HPAD, button_rows * (BTN_HEIGHT + VPAD) + BTN_HEIGHT); mUserInputBox = new LLTextEditor(edit_text_name, input_rect, 254, edit_text_contents, sFont, FALSE); mUserInputBox->setBorderVisible(TRUE); mUserInputBox->setTakesNonScrollClicks(TRUE); mUserInputBox->setHideScrollbarForShortDocs(TRUE); mUserInputBox->setWordWrap(TRUE); mUserInputBox->setTabsToNextField(FALSE); mUserInputBox->setCommitOnFocusLost(FALSE); mUserInputBox->setAcceptCallingCardNames(FALSE); mUserInputBox->setHandleEditKeysDirectly(TRUE); addChild(mUserInputBox, -1); } else { setIsChrome(TRUE); } if (mNumButtons == 0) { addButton("OK", "OK", false, true, layout_script_dialog); mAddedDefaultBtn = true; } if (++sNotifyBoxCount <= 0) LL_WARNS() << "A notification was mishandled. sNotifyBoxCount = " << sNotifyBoxCount << LL_ENDL; // If this is the only notify box, don't show the next button else if (sNotifyBoxCount == 1 && mNextBtn) mNextBtn->setVisible(false); } }
AORemoteCtrl::AORemoteCtrl() { setIsChrome(TRUE); build(); setFocusRoot(TRUE); }
LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, const std::string& message, const std::string& from_name, const LLUUID& group_id, const LLUUID& group_insignia, const std::string& group_name, const U32& t, const bool& has_inventory, const std::string& inventory_name, LLOfferInfo* inventory_offer) : LLPanel(std::string("groupnotify"), LLGroupNotifyBox::getGroupNotifyRect(), BORDER_YES), mAnimating(TRUE), mTimer(), mGroupID(group_id), mHasInventory(has_inventory), mInventoryOffer(inventory_offer) { setFocusRoot(TRUE); time_t timestamp = (time_t)t; std::string time_buf = g_formatted_time(timestamp); setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); // TODO: add a color for group notices setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); LLIconCtrl* icon; LLTextEditor* text; const S32 VPAD = 2; const S32 TOP = getRect().getHeight() - 32; // Get past the top menu bar const S32 BOTTOM_PAD = VPAD * 2; const S32 BTN_TOP = BOTTOM_PAD + BTN_HEIGHT + VPAD; const S32 RIGHT = getRect().getWidth() - HPAD - HPAD; const S32 LINE_HEIGHT = 16; const S32 LABEL_WIDTH = 64; const S32 ICON_WIDTH = 64; S32 y = TOP; S32 x = HPAD + HPAD; class NoticeText : public LLTextBox { public: NoticeText(const std::string& name, const LLRect& rect, const std::string& text = LLStringUtil::null, const LLFontGL* font = NULL) : LLTextBox(name, rect, text, font) { setHAlign(LLFontGL::RIGHT); setFontStyle(LLFontGL::DROP_SHADOW_SOFT); setBorderVisible(FALSE); setColor( gColors.getColor("GroupNotifyTextColor") ); setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); } }; // Title addChild(new NoticeText(std::string("title"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),std::string("Group Notice"),LLFontGL::sSansSerifHuge)); y -= llfloor(1.5f*LINE_HEIGHT); x += HPAD + HPAD + ICON_WIDTH; std::stringstream from; from << "Sent by " << from_name << ", " << group_name; addChild(new NoticeText(std::string("group"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),from.str(),LLFontGL::sSansSerif)); y -= (LINE_HEIGHT + VPAD); x = HPAD + HPAD; // TODO: change this to be the group icon. if (!group_insignia.isNull()) { icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), group_insignia); } else { icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), std::string("notify_box_icon.tga")); } icon->setMouseOpaque(FALSE); addChild(icon); x += HPAD + HPAD + ICON_WIDTH; // If we have inventory with this message, leave room for the name. S32 box_bottom = BTN_TOP + (mHasInventory ? (LINE_HEIGHT + 2*VPAD) : 0); text = new LLViewerTextEditor(std::string("box"), LLRect(x, y, RIGHT, box_bottom), DB_GROUP_NOTICE_MSG_STR_LEN, LLStringUtil::null, LLFontGL::sSansSerif, FALSE); static const LLStyleSP headerstyle(new LLStyle(true,LLColor4::black,"SansSerifBig")); static const LLStyleSP datestyle(new LLStyle(true,LLColor4::black,"serif")); text->appendStyledText(subject,false,false,&headerstyle); text->appendStyledText(time_buf,false,false,&datestyle); // Sadly, our LLTextEditor can't handle both styled and unstyled text // at the same time. Hence this space must be styled. JC text->appendColoredText(std::string(" "),false,false,LLColor4::grey4); text->appendColoredText(message,false,false,LLColor4::grey4); LLColor4 semi_transparent(1.0f,1.0f,1.0f,0.8f); text->setCursor(0,0); text->setEnabled(FALSE); text->setWordWrap(TRUE); //text->setTabStop(FALSE); // was interfering with copy-and-paste text->setTabsToNextField(TRUE); text->setMouseOpaque(TRUE); text->setBorderVisible(TRUE); text->setTakesNonScrollClicks(TRUE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( semi_transparent ); text->setWriteableBgColor ( semi_transparent ); addChild(text); y = box_bottom - VPAD; if (mHasInventory) { addChild(new NoticeText(std::string("subjecttitle"),LLRect(x,y,x + LABEL_WIDTH,y - LINE_HEIGHT),std::string("Attached: "),LLFontGL::sSansSerif)); LLUIImagePtr item_icon = get_item_icon(mInventoryOffer->mType, LLInventoryType::IT_TEXTURE, 0, FALSE); x += LABEL_WIDTH + HPAD; std::stringstream ss; ss << " " << inventory_name; LLTextBox *line = new LLTextBox(std::string("object_name"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),ss.str(),LLFontGL::sSansSerif); line->setEnabled(FALSE); line->setBorderVisible(TRUE); line->setDisabledColor(LLColor4::blue4); line->setFontStyle(LLFontGL::NORMAL); line->setBackgroundVisible(true); line->setBackgroundColor( semi_transparent ); addChild(line); icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+16, y-16), item_icon->getName()); icon->setMouseOpaque(FALSE); addChild(icon); } LLButton* btn; btn = new LLButton(std::string("next"), LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, onClickNext, this, LLFontGL::sSansSerif); btn->setToolTip(std::string("Next")); // *TODO: Translate btn->setScaleImage(TRUE); addChild(btn); mNextBtn = btn; S32 btn_width = 80; S32 wide_btn_width = 120; LLRect btn_rect; x = 3 * HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, btn_width, BTN_HEIGHT); btn = new LLButton(std::string("OK"), btn_rect, LLStringUtil::null, onClickOk, this); addChild(btn, -1); setDefaultBtn(btn); x += btn_width + HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, wide_btn_width, BTN_HEIGHT); btn = new LLButton(std::string("Group Notices"), btn_rect, LLStringUtil::null, onClickGroupInfo, this); btn->setToolTip(std::string("View past notices or opt-out of receiving these messages here.")); // TODO: Translate addChild(btn, -1); if (mHasInventory && mInventoryOffer) { x += wide_btn_width + HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, wide_btn_width, BTN_HEIGHT); std::string btn_lbl(""); if(is_openable(mInventoryOffer->mType)) { btn_lbl = "Open Attachment"; } else { btn_lbl = "Save Attachment"; } mSaveInventoryBtn = new LLButton(btn_lbl, btn_rect, LLStringUtil::null, onClickSaveInventory, this); mSaveInventoryBtn->setVisible(mHasInventory); addChild(mSaveInventoryBtn); } sGroupNotifyBoxCount++; // If this is the only notify box, don't show the next button if (sGroupNotifyBoxCount == 1) { mNextBtn->setVisible(FALSE); } }
//--------------------------------------------------------------------------- // Public methods //--------------------------------------------------------------------------- LLPanelLogin::LLPanelLogin(const LLRect &rect, void (*callback)(S32 option, void* user_data), void *cb_data) : LLPanel(std::string("panel_login"), LLRect(0,600,800,0), FALSE), // not bordered mLogoImage(), mCallback(callback), mCallbackData(cb_data) { setFocusRoot(TRUE); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); gViewerWindow->abortShowProgress(); //Kill previous instance. It might still be alive, and if so, its probably pending //deletion via the progressviews idle callback. Kill it now and unregister said idle callback. LLPanelLogin::sInstance = this; // add to front so we are the bottom-most child gViewerWindow->getRootView()->addChildInBack(this); // Logo mLogoImage = LLUI::getUIImage("startup_logo.j2c"); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml"); reshape(rect.getWidth(), rect.getHeight()); LLComboBox* name_combo = sInstance->getChild<LLComboBox>("name_combo"); name_combo->setCommitCallback(boost::bind(LLPanelLogin::onSelectLoginEntry, _1, this)); name_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLoginComboLostFocus, this, name_combo)); name_combo->setPrevalidate(LLLineEditor::prevalidatePrintableNotPipe); name_combo->setSuppressTentative(true); name_combo->setSuppressAutoComplete(true); childSetCommitCallback("remember_name_check", onNameCheckChanged); LLLineEditor* password_edit(getChild<LLLineEditor>("password_edit")); password_edit->setKeystrokeCallback(onPassKey); // STEAM-14: When user presses Enter with this field in focus, initiate login password_edit->setCommitCallback(mungePassword, this); password_edit->setDrawAsterixes(TRUE); // change z sort of clickable text to be behind buttons sendChildToBack(getChildView("channel_text")); sendChildToBack(getChildView("forgot_password_text")); //llinfos << " url history: " << LLSDOStreamer<LLSDXMLFormatter>(LLURLHistory::getURLHistory("regionuri")) << llendl; LLComboBox* location_combo = getChild<LLComboBox>("start_location_combo"); updateLocationSelectorsVisibility(); // separate so that it can be called from preferences location_combo->setAllowTextEntry(TRUE, 128, FALSE); location_combo->setFocusLostCallback( boost::bind(&LLPanelLogin::onLocationSLURL, this) ); LLComboBox *server_choice_combo = getChild<LLComboBox>("grids_combo"); server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectGrid, _1)); // Load all of the grids, sorted, and then add a bar and the current grid at the top updateGridCombo(); LLSLURL start_slurl(LLStartUp::getStartSLURL()); if ( !start_slurl.isSpatial() ) // has a start been established by the command line or NextLoginLocation ? { // no, so get the preference setting std::string defaultStartLocation = gSavedSettings.getString("LoginLocation"); LL_INFOS("AppInit")<<"default LoginLocation '"<<defaultStartLocation<<"'"<<LL_ENDL; LLSLURL defaultStart(defaultStartLocation); if ( defaultStart.isSpatial() ) { LLStartUp::setStartSLURL(defaultStart); // calls onUpdateStartSLURL } else { LL_INFOS("AppInit")<<"no valid LoginLocation, using home"<<LL_ENDL; LLSLURL homeStart(LLSLURL::SIM_LOCATION_HOME); LLStartUp::setStartSLURL(homeStart); // calls onUpdateStartSLURL } } else { LLPanelLogin::onUpdateStartSLURL(start_slurl); // updates grid if needed } childSetAction("connect_btn", onClickConnect, this); setDefaultBtn("connect_btn"); childSetAction("grids_btn", onClickGrids, this); std::string channel = gVersionChannel; std::string version = llformat("%d.%d.%d (%d)", gVersionMajor, gVersionMinor, gVersionPatch, LL_VIEWER_BUILD ); LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); channel_text->setTextArg("[CHANNEL]", channel); // though not displayed channel_text->setTextArg("[VERSION]", version); channel_text->setClickedCallback(boost::bind(&LLPanelLogin::onClickVersion,(void*)NULL)); LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text"); forgot_password_text->setClickedCallback(boost::bind(&onClickForgotPassword)); LLTextBox* create_new_account_text = getChild<LLTextBox>("create_new_account_text"); create_new_account_text->setClickedCallback(boost::bind(&onClickNewAccount)); // get the web browser control LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("login_html"); web_browser->addObserver(this); web_browser->setBackgroundColor(LLColor4::black); reshapeBrowser(); refreshLoginPage(); gHippoGridManager->setCurrentGridChangeCallback(boost::bind(&LLPanelLogin::onCurGridChange,this,_1,_2)); }
//--------------------------------------------------------------------------- // Public methods //--------------------------------------------------------------------------- LLPanelLogin::LLPanelLogin(const LLRect& rect) : LLPanel(std::string("panel_login"), rect, FALSE), // not bordered mLogoImage(LLUI::getUIImage("startup_logo.j2c")) { setFocusRoot(TRUE); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); LLPanelLogin::sInstance = this; // add to front so we are the bottom-most child gViewerWindow->getRootView()->addChildInBack(this); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml"); reshape(rect.getWidth(), rect.getHeight()); LLComboBox* username_combo(getChild<LLComboBox>("username_combo")); username_combo->setCommitCallback(boost::bind(LLPanelLogin::onSelectLoginEntry, _1, this)); username_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLoginComboLostFocus, this, username_combo)); username_combo->setPrevalidate(LLLineEditor::prevalidatePrintableNotPipe); username_combo->setSuppressTentative(true); username_combo->setSuppressAutoComplete(true); childSetCommitCallback("remember_name_check", onNameCheckChanged); LLLineEditor* password_edit(getChild<LLLineEditor>("password_edit")); password_edit->setKeystrokeCallback(onPassKey); // STEAM-14: When user presses Enter with this field in focus, initiate login password_edit->setCommitCallback(mungePassword, this); password_edit->setDrawAsterixes(TRUE); getChild<LLUICtrl>("remove_login")->setCommitCallback(boost::bind(&LLPanelLogin::confirmDelete, this)); // change z sort of clickable text to be behind buttons sendChildToBack(getChildView("channel_text")); sendChildToBack(getChildView("forgot_password_text")); //llinfos << " url history: " << LLSDOStreamer<LLSDXMLFormatter>(LLURLHistory::getURLHistory("regionuri")) << llendl; LLComboBox* location_combo = getChild<LLComboBox>("start_location_combo"); updateLocationSelectorsVisibility(); // separate so that it can be called from preferences location_combo->setAllowTextEntry(TRUE, 128, FALSE); location_combo->setFocusLostCallback( boost::bind(&LLPanelLogin::onLocationSLURL, this) ); LLComboBox *server_choice_combo = getChild<LLComboBox>("grids_combo"); server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectGrid, _1)); server_choice_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onSelectGrid, server_choice_combo)); // Load all of the grids, sorted, and then add a bar and the current grid at the top updateGridCombo(); LLSLURL start_slurl(LLStartUp::getStartSLURL()); if ( !start_slurl.isSpatial() ) // has a start been established by the command line or NextLoginLocation ? { // no, so get the preference setting std::string defaultStartLocation = gSavedSettings.getString("LoginLocation"); LL_INFOS("AppInit")<<"default LoginLocation '"<<defaultStartLocation<<"'"<<LL_ENDL; LLSLURL defaultStart(defaultStartLocation); if ( defaultStart.isSpatial() ) { LLStartUp::setStartSLURL(defaultStart); // calls onUpdateStartSLURL } else { LL_INFOS("AppInit")<<"no valid LoginLocation, using home"<<LL_ENDL; LLSLURL homeStart(LLSLURL::SIM_LOCATION_HOME); LLStartUp::setStartSLURL(homeStart); // calls onUpdateStartSLURL } } else { LLPanelLogin::onUpdateStartSLURL(start_slurl); // updates grid if needed } // Also set default button for subpanels, otherwise hitting enter in text entry fields won't login { LLButton* connect_btn(findChild<LLButton>("connect_btn")); connect_btn->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnect, this)); setDefaultBtn(connect_btn); findChild<LLPanel>("name_panel")->setDefaultBtn(connect_btn); findChild<LLPanel>("password_panel")->setDefaultBtn(connect_btn); findChild<LLPanel>("grids_panel")->setDefaultBtn(connect_btn); findChild<LLPanel>("location_panel")->setDefaultBtn(connect_btn); findChild<LLPanel>("login_html")->setDefaultBtn(connect_btn); } childSetAction("grids_btn", onClickGrids, this); std::string channel = gVersionChannel; std::string version = llformat("%d.%d.%d (%d)", gVersionMajor, gVersionMinor, gVersionPatch, gVersionBuild ); LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); channel_text->setTextArg("[CHANNEL]", channel); // though not displayed channel_text->setTextArg("[VERSION]", version); channel_text->setClickedCallback(boost::bind(&LLPanelLogin::onClickVersion,(void*)NULL)); LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text"); forgot_password_text->setClickedCallback(boost::bind(&onClickForgotPassword)); LLTextBox* create_new_account_text = getChild<LLTextBox>("create_new_account_text"); create_new_account_text->setClickedCallback(boost::bind(&onClickNewAccount)); // get the web browser control LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("login_html"); web_browser->addObserver(this); web_browser->setBackgroundColor(LLColor4::black); reshapeBrowser(); refreshLoginPage(); gHippoGridManager->setCurrentGridChangeCallback(boost::bind(&LLPanelLogin::onCurGridChange,this,_1,_2)); // Load login history std::string login_hist_filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "saved_logins_sg2.xml"); mLoginHistoryData = LLSavedLogins::loadFile(login_hist_filepath); const LLSavedLoginsList& saved_login_entries(mLoginHistoryData.getEntries()); for (LLSavedLoginsList::const_reverse_iterator i = saved_login_entries.rbegin(); i != saved_login_entries.rend(); ++i) { LLSD e = i->asLLSD(); if (e.isMap() && gHippoGridManager->getGrid(i->getGrid())) username_combo->add(getDisplayString(*i), e); } if (saved_login_entries.size() > 0) { setFields(*saved_login_entries.rbegin()); } }
//--------------------------------------------------------------------------- LLNotifyBox::LLNotifyBox(LLNotificationPtr notification, BOOL layout_script_dialog) : LLPanel(notification->getName(), LLRect(), BORDER_NO), LLEventTimer(notification->getExpiration() == LLDate() ? LLDate(LLDate::now().secondsSinceEpoch() + (F64)gSavedSettings.getF32("NotifyTipDuration")) : notification->getExpiration()), LLInstanceTracker<LLNotifyBox, LLUUID>(notification->getID()), mNotification(notification), mIsTip(notification->getType() == "notifytip"), mAnimating(TRUE), mNextBtn(NULL), mNumOptions(0), mNumButtons(0), mAddedDefaultBtn(FALSE), mLayoutScriptDialog(layout_script_dialog) { // clicking on a button does not steal current focus setIsChrome(TRUE); // class init if (!sFont) { sFont = LLFontGL::getFontSansSerif(); sFontSmall = LLFontGL::getFontSansSerifSmall(); } // setup paramaters mMessage = notification->getMessage(); // initialize setFocusRoot(!mIsTip); // caution flag can be set explicitly by specifying it in the // notification payload, or it can be set implicitly if the // notify xml template specifies that it is a caution // // tip-style notification handle 'caution' differently - // they display the tip in a different color mIsCaution = notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH; // Only animate first window if( gNotifyBoxView->getChildCount() > 0 ) mAnimating = FALSE; else mAnimating = TRUE; LLNotificationFormPtr form(notification->getForm()); mNumOptions = form->getNumElements(); LLRect rect = mIsTip ? getNotifyTipRect(mMessage) : getNotifyRect(mNumOptions, layout_script_dialog, mIsCaution); setRect(rect); setFollows(mIsTip ? (FOLLOWS_BOTTOM|FOLLOWS_RIGHT) : (FOLLOWS_TOP|FOLLOWS_RIGHT)); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); LLIconCtrl* icon; LLTextEditor* text; const S32 TOP = getRect().getHeight() - (mIsTip ? (S32)sFont->getLineHeight() : 32); const S32 BOTTOM = (S32)sFont->getLineHeight(); S32 x = HPAD + HPAD; S32 y = TOP; if (mIsTip) { // use the tip notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_tip_icon.tga")); } else if (mIsCaution) { // use the caution notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_caution_icon.tga")); } else { // use the default notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_box_icon.tga")); } icon->setMouseOpaque(FALSE); addChild(icon); x += HPAD + HPAD + 32; // add a caution textbox at the top of a caution notification LLTextBox* caution_box = NULL; if (mIsCaution && !mIsTip) { S32 caution_height = ((S32)sFont->getLineHeight() * 2) + VPAD; caution_box = new LLTextBox( std::string("caution_box"), LLRect(x, y, getRect().getWidth() - 2, caution_height), LLStringUtil::null, sFont, FALSE); caution_box->setFontStyle(LLFontGL::BOLD); caution_box->setColor(gColors.getColor("NotifyCautionWarnColor")); caution_box->setBackgroundColor(gColors.getColor("NotifyCautionBoxColor")); caution_box->setBorderVisible(FALSE); caution_box->setWrappedText(notification->getMessage()); addChild(caution_box); // adjust the vertical position of the next control so that // it appears below the caution textbox y = y - caution_height; } else { const S32 BTN_TOP = BOTTOM_PAD + (((mNumOptions-1+2)/3)) * (BTN_HEIGHT+VPAD); // Tokenization on \n is handled by LLTextBox const S32 MAX_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB_LAST_NAME_BUF_SIZE + DB_INV_ITEM_NAME_BUF_SIZE; // For script dialogs: add space for title. text = new LLTextEditor(std::string("box"), LLRect(x, y, getRect().getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16), MAX_LENGTH, mMessage, sFont, FALSE); text->setWordWrap(TRUE); text->setTabStop(FALSE); text->setMouseOpaque(FALSE); text->setBorderVisible(FALSE); text->setTakesNonScrollClicks(FALSE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( LLColor4::transparent ); // the background color of the box is manually // rendered under the text box, therefore we want // the actual text box to be transparent text->setReadOnlyFgColor ( gColors.getColor("NotifyTextColor") ); text->setEnabled(FALSE); // makes it read-only text->setTabStop(FALSE); // can't tab to it (may be a problem for scrolling via keyboard) addChild(text); } if (mIsTip) { // TODO: Make a separate archive for these. LLChat chat(mMessage); chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::getInstance(LLSD())->addChatHistory(chat); } else { LLButton* btn; btn = new LLButton(std::string("next"), LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, onClickNext, this, sFont); btn->setScaleImage(TRUE); btn->setToolTip(std::string("Next")); // *TODO: Translate addChild(btn); mNextBtn = btn; for (S32 i = 0; i < mNumOptions; i++) { LLSD form_element = form->getElement(i); if (form_element["type"].asString() != "button") { continue; } addButton(form_element["name"].asString(), form_element["text"].asString(), TRUE, form_element["default"].asBoolean()); } if (mNumButtons == 0) { addButton("OK", "OK", FALSE, TRUE); mAddedDefaultBtn = TRUE; } sNotifyBoxCount++; if (sNotifyBoxCount <= 0) { llwarns << "A notification was mishandled. sNotifyBoxCount = " << sNotifyBoxCount << llendl; } // If this is the only notify box, don't show the next button if (sNotifyBoxCount == 1 && mNextBtn) { mNextBtn->setVisible(FALSE); } } }
wlfPanel_AdvSettings::wlfPanel_AdvSettings() { setIsChrome(TRUE); setFocusRoot(TRUE); build(); }
LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) : LLPanel(name, LLRect(), FALSE), // not mouse opaque mBalance(0), mHealth(100), mSquareMetersCredit(0), mSquareMetersCommitted(0) { // status bar can possible overlay menus? setMouseOpaque(FALSE); setIsChrome(TRUE); mBalanceTimer = new LLFrameTimer(); mHealthTimer = new LLFrameTimer(); LLUICtrlFactory::getInstance()->buildPanel(this,"panel_status_bar.xml"); // status bar can never get a tab setFocusRoot(FALSE); mTextParcelName = getChild<LLTextBox>("ParcelNameText" ); mTextBalance = getChild<LLTextBox>("BalanceText" ); mTextHealth = getChild<LLTextBox>("HealthText" ); mTextTime = getChild<LLTextBox>("TimeText" ); childSetAction("scriptout", onClickScriptDebug, this); childSetAction("health", onClickHealth, this); childSetAction("no_fly", onClickFly, this); childSetAction("buyland", onClickBuyLand, this ); childSetAction("no_build", onClickBuild, this ); childSetAction("no_scripts", onClickScripts, this ); childSetAction("restrictpush", onClickPush, this ); childSetAction("status_no_voice", onClickVoice, this ); childSetCommitCallback("search_editor", onCommitSearch, this); childSetAction("search_btn", onClickSearch, this); childSetVisible("search_editor", gSavedSettings.getBOOL("ShowSearchBar")); childSetVisible("search_btn", gSavedSettings.getBOOL("ShowSearchBar")); childSetVisible("menubar_search_bevel_bg", gSavedSettings.getBOOL("ShowSearchBar")); childSetAction("buycurrency", onClickBuyCurrency, this ); childSetActionTextbox("BalanceText", onClickBalance ); childSetActionTextbox("ParcelNameText", onClickParcelInfo ); // TODO: Disable buying currency when connected to non-SL grids // that don't support currency yet -- MC LLButton* buybtn = getChild<LLButton>("buycurrency"); buybtn->setLabelArg("[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); // Adding Net Stat Graph S32 x = getRect().getWidth() - 2; S32 y = 0; LLRect r; r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); mSGBandwidth = new LLStatGraph("BandwidthGraph", r); mSGBandwidth->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); mSGBandwidth->setStat(&LLViewerStats::getInstance()->mKBitStat); std::string text = childGetText("bandwidth_tooltip") + " "; LLUIString bandwidth_tooltip = text; // get the text from XML until this widget is XML driven mSGBandwidth->setLabel(bandwidth_tooltip.getString()); mSGBandwidth->setUnits("Kbps"); mSGBandwidth->setPrecision(0); mSGBandwidth->setMouseOpaque(FALSE); addChild(mSGBandwidth); x -= SIM_STAT_WIDTH + 2; r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); mSGPacketLoss = new LLStatGraph("PacketLossPercent", r); mSGPacketLoss->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); mSGPacketLoss->setStat(&LLViewerStats::getInstance()->mPacketsLostPercentStat); text = childGetText("packet_loss_tooltip") + " "; LLUIString packet_loss_tooltip = text; // get the text from XML until this widget is XML driven mSGPacketLoss->setLabel(packet_loss_tooltip.getString()); mSGPacketLoss->setUnits("%"); mSGPacketLoss->setMin(0.f); mSGPacketLoss->setMax(5.f); mSGPacketLoss->setThreshold(0, 0.5f); mSGPacketLoss->setThreshold(1, 1.f); mSGPacketLoss->setThreshold(2, 3.f); mSGPacketLoss->setPrecision(1); mSGPacketLoss->setMouseOpaque(FALSE); mSGPacketLoss->mPerSec = FALSE; addChild(mSGPacketLoss); childSetActionTextbox("stat_btn", onClickStatGraph); }
//--------------------------------------------------------------------------- // Public methods //--------------------------------------------------------------------------- LLPanelLogin::LLPanelLogin(const LLRect &rect, BOOL show_server, void (*callback)(S32 option, void* user_data), void *cb_data) : LLPanel(), mLogoImage(), mCallback(callback), mCallbackData(cb_data), mHtmlAvailable( TRUE ), mListener(new LLPanelLoginListener(this)) { setFocusRoot(TRUE); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); // instance management if (LLPanelLogin::sInstance) { llwarns << "Duplicate instance of login view deleted" << llendl; // Don't leave bad pointer in gFocusMgr gFocusMgr.setDefaultKeyboardFocus(NULL); delete LLPanelLogin::sInstance; } mPasswordModified = FALSE; LLPanelLogin::sInstance = this; // add to front so we are the bottom-most child gViewerWindow->getRootView()->addChildInBack(this); // Logo mLogoImage = LLUI::getUIImage("startup_logo"); buildFromFile( "panel_login.xml"); #if USE_VIEWER_AUTH //leave room for the login menu bar setRect(LLRect(0, rect.getHeight()-18, rect.getWidth(), 0)); #endif // Legacy login web page is hidden under the menu bar. // Adjust reg-in-client web browser widget to not be hidden. if (gSavedSettings.getBOOL("RegInClient")) { reshape(rect.getWidth(), rect.getHeight() - MENU_BAR_HEIGHT); } else { reshape(rect.getWidth(), rect.getHeight()); } #if !USE_VIEWER_AUTH getChild<LLLineEditor>("username_edit")->setPrevalidate(LLTextValidate::validateASCIIPrintableNoPipe); getChild<LLLineEditor>("password_edit")->setKeystrokeCallback(onPassKey, this); // change z sort of clickable text to be behind buttons //sendChildToBack(getChildView("channel_text")); sendChildToBack(getChildView("forgot_password_text")); LLLineEditor* edit = getChild<LLLineEditor>("password_edit"); if (edit) edit->setDrawAsterixes(TRUE); if(LLStartUp::getStartSLURL().getType() != LLSLURL::LOCATION) { LLSLURL slurl(gSavedSettings.getString("LoginLocation")); LLStartUp::setStartSLURL(slurl); } updateLocationCombo(false); LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo"); server_choice_combo->setCommitCallback(onSelectServer, NULL); server_choice_combo->setFocusLostCallback(boost::bind(onServerComboLostFocus, _1)); updateServerCombo(); childSetAction("connect_btn", onClickConnect, this); getChild<LLPanel>("login")->setDefaultBtn("connect_btn"); std::string channel = gSavedSettings.getString("VersionChannelName"); std::string version = llformat("%s (%d)", LLVersionInfo::getShortVersion().c_str(), LLVersionInfo::getBuild()); //LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); //channel_text->setTextArg("[CHANNEL]", channel); // though not displayed //channel_text->setTextArg("[VERSION]", version); //channel_text->setClickedCallback(onClickVersion, this); LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text"); forgot_password_text->setClickedCallback(onClickForgotPassword, NULL); LLTextBox* create_new_account_text = getChild<LLTextBox>("create_new_account_text"); create_new_account_text->setClickedCallback(onClickNewAccount, NULL); LLTextBox* need_help_text = getChild<LLTextBox>("login_help"); need_help_text->setClickedCallback(onClickHelp, NULL); #endif // get the web browser control LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("login_html"); web_browser->addObserver(this); // Clear the browser's cache to avoid any potential for the cache messing up the login screen. web_browser->clearCache(); reshapeBrowser(); // kick off a request to grab the url manually gResponsePtr = LLIamHereLogin::build( this ); LLHTTPClient::head( LLGridManager::getInstance()->getLoginPage(), gResponsePtr ); updateLocationCombo(false); }
LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) : LLPanel(name, LLRect(), FALSE), // not mouse opaque mBalance(0), mUPC(0), mHealth(100), mSquareMetersCredit(0), mSquareMetersCommitted(0), mRegionCrossingSlot(), mNavMeshSlot(), mIsNavMeshDirty(false) { mUPCSupported = gHippoGridManager->getConnectedGrid()->getUPCSupported(); if (mUPCSupported) gGenericDispatcher.addHandler("upcbalance", &sDispatchUPCBalance); // status bar can possible overlay menus? setMouseOpaque(FALSE); setIsChrome(TRUE); // size of day of the weeks and year sDays.reserve(7); sMonths.reserve(12); mBalanceTimer = new LLFrameTimer(); mHealthTimer = new LLFrameTimer(); LLUICtrlFactory::getInstance()->buildPanel(this,"panel_status_bar.xml"); // status bar can never get a tab setFocusRoot(FALSE); // build date necessary data (must do after panel built) setupDate(); mTextParcelName = getChild<LLTextBox>("ParcelNameText" ); mTextBalance = getChild<LLTextBox>("BalanceText" ); mTextUPC = getChild<LLTextBox>("UPCText" ); mTextHealth = getChild<LLTextBox>("HealthText" ); mTextTime = getChild<LLTextBox>("TimeText" ); if (!mUPCSupported) mTextUPC->setVisible(false); childSetAction("scriptout", onClickScriptDebug, this); childSetAction("health", onClickHealth, this); childSetAction("no_fly", onClickFly, this); childSetAction("buyland", onClickBuyLand, this ); childSetAction("buycurrency", onClickBuyCurrency, this ); childSetAction("no_build", onClickBuild, this ); childSetAction("pf_dirty", onClickPFDirty, this); childSetAction("pf_disabled", onClickPFDisabled, this); childSetAction("status_SeeAV", onClickSeeAV, this ); childSetAction("no_scripts", onClickScripts, this ); childSetAction("restrictpush", onClickPush, this ); childSetAction("status_no_voice", onClickVoice, this ); childSetCommitCallback("search_editor", onCommitSearch, this); childSetAction("search_btn", onClickSearch, this); childSetVisible("search_editor", gSavedSettings.getBOOL("ShowSearchBar")); childSetVisible("search_btn", gSavedSettings.getBOOL("ShowSearchBar")); childSetVisible("menubar_search_bevel_bg", gSavedSettings.getBOOL("ShowSearchBar")); childSetActionTextbox("ParcelNameText", onClickParcelInfo ); childSetActionTextbox("BalanceText", onClickBalance ); // TODO: Disable buying currency when connected to non-SL grids // that don't support currency yet -- MC LLButton* buybtn = getChild<LLButton>("buycurrency"); buybtn->setLabelArg("[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); mRegionCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLStatusBar::createNavMeshStatusListenerForCurrentRegion, this)); createNavMeshStatusListenerForCurrentRegion(); // Adding Net Stat Graph S32 x = getRect().getWidth() - 2; S32 y = 0; LLRect r; r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); mSGBandwidth = new LLStatGraph("BandwidthGraph", r); mSGBandwidth->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); mSGBandwidth->setStat(&LLViewerStats::getInstance()->mKBitStat); mSGBandwidth->setLabel(getString("bandwidth_tooltip") + " "); mSGBandwidth->setUnits("Kbps"); mSGBandwidth->setPrecision(0); mSGBandwidth->setMouseOpaque(FALSE); addChild(mSGBandwidth); x -= SIM_STAT_WIDTH + 2; r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); mSGPacketLoss = new LLStatGraph("PacketLossPercent", r); mSGPacketLoss->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); mSGPacketLoss->setStat(&LLViewerStats::getInstance()->mPacketsLostPercentStat); mSGPacketLoss->setLabel(getString("packet_loss_tooltip") + " "); mSGPacketLoss->setUnits("%"); mSGPacketLoss->setMin(0.f); mSGPacketLoss->setMax(5.f); mSGPacketLoss->setThreshold(0, 0.5f); mSGPacketLoss->setThreshold(1, 1.f); mSGPacketLoss->setThreshold(2, 3.f); mSGPacketLoss->setPrecision(1); mSGPacketLoss->setMouseOpaque(FALSE); mSGPacketLoss->mPerSec = FALSE; addChild(mSGPacketLoss); childSetActionTextbox("stat_btn", onClickStatGraph); }
LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect) : LLToastPanel(notification), mTextBox(NULL), mInfoPanel(NULL), mControlPanel(NULL), mNumOptions(0), mNumButtons(0), mAddedDefaultBtn(false), mCloseNotificationOnDestroy(true) { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_notification.xml"); if(rect != LLRect::null) { this->setShape(rect); } mInfoPanel = getChild<LLPanel>("info_panel"); mControlPanel = getChild<LLPanel>("control_panel"); BUTTON_WIDTH = gSavedSettings.getS32("ToastButtonWidth"); // customize panel's attributes // is it intended for displaying a tip mIsTip = notification->getType() == "notifytip"; // is it a script dialog mIsScriptDialog = (notification->getName() == "ScriptDialog" || notification->getName() == "ScriptDialogGroup"); // is it a caution // // caution flag can be set explicitly by specifying it in the notification payload, or it can be set implicitly if the // notify xml template specifies that it is a caution // tip-style notification handle 'caution' differently -they display the tip in a different color mIsCaution = notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH; // setup parameters // get a notification message mMessage = notification->getMessage(); // init font variables if (!sFont) { sFont = LLFontGL::getFontSansSerif(); sFontSmall = LLFontGL::getFontSansSerifSmall(); } // clicking on a button does not steal current focus setIsChrome(TRUE); // initialize setFocusRoot(!mIsTip); // get a form for the notification LLNotificationFormPtr form(notification->getForm()); // get number of elements mNumOptions = form->getNumElements(); // customize panel's outfit // preliminary adjust panel's layout //move to the end //mIsTip ? adjustPanelForTipNotice() : adjustPanelForScriptNotice(form); // adjust text options according to the notification type // add a caution textbox at the top of a caution notification if (mIsCaution && !mIsTip) { mTextBox = getChild<LLTextBox>("caution_text_box"); } else { mTextBox = getChild<LLTextEditor>("text_editor_box"); } // *TODO: magic numbers(???) - copied from llnotify.cpp(250) const S32 MAX_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB_LAST_NAME_BUF_SIZE + DB_INV_ITEM_NAME_BUF_SIZE; mTextBox->setMaxTextLength(MAX_LENGTH); mTextBox->setVisible(TRUE); mTextBox->setValue(notification->getMessage()); // add buttons for a script notification if (mIsTip) { adjustPanelForTipNotice(); } else { std::vector<index_button_pair_t> buttons; buttons.reserve(mNumOptions); S32 buttons_width = 0; // create all buttons and accumulate they total width to reshape mControlPanel for (S32 i = 0; i < mNumOptions; i++) { LLSD form_element = form->getElement(i); if (form_element["type"].asString() != "button") { continue; } LLButton* new_button = createButton(form_element, TRUE); buttons_width += new_button->getRect().getWidth(); S32 index = form_element["index"].asInteger(); buttons.push_back(index_button_pair_t(index,new_button)); } if (buttons.empty()) { addDefaultButton(); } else { const S32 button_panel_width = mControlPanel->getRect().getWidth();// do not change width of the panel S32 button_panel_height = mControlPanel->getRect().getHeight(); //try get an average h_pad to spread out buttons S32 h_pad = (button_panel_width - buttons_width) / (S32(buttons.size())); if(h_pad < 2*HPAD) { /* * Probably it is a scriptdialog toast * for a scriptdialog toast h_pad can be < 2*HPAD if we have a lot of buttons. * In last case set default h_pad to avoid heaping of buttons */ S32 button_per_row = button_panel_width / BUTTON_WIDTH; h_pad = (button_panel_width % BUTTON_WIDTH) / (button_per_row - 1);// -1 because we do not need space after last button in a row if(h_pad < 2*HPAD) // still not enough space between buttons ? { h_pad = 2*HPAD; } } if (mIsScriptDialog) { // we are using default width for script buttons so we can determinate button_rows //to get a number of rows we divide the required width of the buttons to button_panel_width S32 button_rows = llceil(F32(buttons.size() - 1) * (BUTTON_WIDTH + h_pad) / button_panel_width); //S32 button_rows = (buttons.size() - 1) * (BUTTON_WIDTH + h_pad) / button_panel_width; //reserve one row for the ignore_btn button_rows++; //calculate required panel height for scripdialog notification. button_panel_height = button_rows * (BTN_HEIGHT + VPAD) + IGNORE_BTN_TOP_DELTA + BOTTOM_PAD; } else { // in common case buttons can have different widths so we need to calculate button_rows according to buttons_width //S32 button_rows = llceil(F32(buttons.size()) * (buttons_width + h_pad) / button_panel_width); S32 button_rows = llceil(F32((buttons.size() - 1) * h_pad + buttons_width) / button_panel_width); //calculate required panel height button_panel_height = button_rows * (BTN_HEIGHT + VPAD) + BOTTOM_PAD; } // we need to keep min width and max height to make visible all buttons, because width of the toast can not be changed adjustPanelForScriptNotice(button_panel_width, button_panel_height); updateButtonsLayout(buttons, h_pad); // save buttons for later use in disableButtons() mButtons.assign(buttons.begin(), buttons.end()); } } // adjust panel's height to the text size mInfoPanel->setFollowsAll(); snapToMessageHeight(mTextBox, MAX_LENGTH); if(notification->isReusable()) { mButtonClickConnection = sButtonClickSignal.connect( boost::bind(&LLToastNotifyPanel::onToastPanelButtonClicked, this, _1, _2)); if(notification->isRespondedTo()) { // User selected an option in toast, now disable required buttons in IM window disableRespondedOptions(notification); } } }
//--------------------------------------------------------------------------- // Public methods //--------------------------------------------------------------------------- LLPanelLogin::LLPanelLogin(const LLRect &rect, BOOL show_server, void (*callback)(S32 option, void* user_data), void *cb_data) : LLPanel(std::string("panel_login"), LLRect(0,600,800,0), FALSE), // not bordered mLogoImage(), mCallback(callback), mCallbackData(cb_data), mHtmlAvailable( TRUE ) { setFocusRoot(TRUE); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); // instance management if (LLPanelLogin::sInstance) { llwarns << "Duplicate instance of login view deleted" << llendl; delete LLPanelLogin::sInstance; // Don't leave bad pointer in gFocusMgr gFocusMgr.setDefaultKeyboardFocus(NULL); } LLPanelLogin::sInstance = this; // add to front so we are the bottom-most child gViewerWindow->getRootView()->addChildAtEnd(this); // Logo mLogoImage = LLUI::getUIImage("startup_logo.j2c"); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml"); #if USE_VIEWER_AUTH //leave room for the login menu bar setRect(LLRect(0, rect.getHeight()-18, rect.getWidth(), 0)); #endif reshape(rect.getWidth(), rect.getHeight()); #if !USE_VIEWER_AUTH childSetPrevalidate("first_name_edit", LLLineEditor::prevalidatePrintableNoSpace); childSetPrevalidate("last_name_edit", LLLineEditor::prevalidatePrintableNoSpace); LLComboBox* name_combo = getChild<LLComboBox>("name_combo"); // Only works as intended with this combination of flags, // and in this order of setting them, therefore overriding xui name_combo->setAllowTextEntry(TRUE); name_combo->setTextEntryVisible(FALSE); // Send it down the line, or the invisible text entry covers up our normal // input fields if placed after them in xui sendChildToBack(getChildView("name_combo")); bool mru_enabled = gSavedSettings.getBOOL("LoginMRUEnabled"); if (mru_enabled) { LLSD name_list = gSavedSettings.getLLSD("LoginMRUList"); if (name_list.isArray()) { for (LLSD::array_iterator iter = name_list.endArray() - 1; iter >= name_list.beginArray(); --iter) { if (iter->isMap() && iter->has("first") && iter->has("last")) { name_combo->add((*iter)["first"].asString() + " " + (*iter)["last"].asString(), *iter); } } } childSetCommitCallback("name_combo", onSelectLoginMRU, this); } setLoginMRUEnabled(mru_enabled); childSetCommitCallback("password_edit", mungePassword); childSetKeystrokeCallback("password_edit", onPassKey, this); childSetUserData("password_edit", this); // change z sort of clickable text to be behind buttons sendChildToBack(getChildView("channel_text")); sendChildToBack(getChildView("forgot_password_text")); LLLineEditor* edit = getChild<LLLineEditor>("password_edit"); if (edit) edit->setDrawAsterixes(TRUE); LLComboBox* combo = getChild<LLComboBox>("start_location_combo"); combo->setAllowTextEntry(TRUE, 128, FALSE); // The XML file loads the combo with the following labels: // 0 - "My Home" // 1 - "My Last Location" // 2 - "<Type region name>" BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); std::string sim_string = LLURLSimString::sInstance.mSimString; if (!sim_string.empty()) { // Replace "<Type region name>" with this region name combo->remove(2); combo->add( sim_string ); combo->setTextEntry(sim_string); combo->setCurrentByIndex( 2 ); } else if (login_last) { combo->setCurrentByIndex( 1 ); } else { combo->setCurrentByIndex( 0 ); } combo->setCommitCallback( &set_start_location ); LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo"); server_choice_combo->setCommitCallback(onSelectServer); server_choice_combo->setFocusLostCallback(onServerComboLostFocus); childSetAction("connect_btn", onClickConnect, this); setDefaultBtn("connect_btn"); // childSetAction("quit_btn", onClickQuit, this); std::string channel = llformat("(%s)", DX_CHANNEL ); // Kirsten uses version Viewer headers not saved settings! for channel info. std::string version = llformat("%d.%d.%d (%d)", LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD ); LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); channel_text->setTextArg("[CHANNEL]", channel); // though not displayed channel_text->setTextArg("[VERSION]", version); channel_text->setClickedCallback(onClickVersion); channel_text->setCallbackUserData(this); LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text"); forgot_password_text->setClickedCallback(onClickForgotPassword); LLTextBox* create_new_account_text = getChild<LLTextBox>("create_new_account_text"); create_new_account_text->setClickedCallback(onClickNewAccount); #endif // get the web browser control LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html"); // Need to handle login secondlife:///app/ URLs web_browser->setTrusted( true ); // observe browser events web_browser->addObserver( this ); // don't make it a tab stop until SL-27594 is fixed web_browser->setTabStop(FALSE); web_browser->navigateToLocalPage( "loading", "loading.html" ); // make links open in external browser web_browser->setOpenInExternalBrowser( true ); // force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through) LLRect htmlRect = getRect(); #if USE_VIEWER_AUTH htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY(), getRect().getWidth() + 6, getRect().getHeight()); #else htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY() + 40, getRect().getWidth() + 6, getRect().getHeight() - 78 ); #endif web_browser->setRect( htmlRect ); web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); reshape( getRect().getWidth(), getRect().getHeight(), 1 ); // kick off a request to grab the url manually gResponsePtr = LLIamHereLogin::build( this ); std::string login_page = gSavedSettings.getString("LoginPage"); if (login_page.empty()) { login_page = getString( "real_url" ); } LLHTTPClient::head( login_page, gResponsePtr ); #if !USE_VIEWER_AUTH // Initialize visibility (and don't force visibility - use prefs) refreshLocation( false ); #endif }
//--------------------------------------------------------------------------- // Public methods //--------------------------------------------------------------------------- LLPanelLogin::LLPanelLogin(const LLRect &rect, BOOL show_server, void (*callback)(S32 option, void* user_data), void *cb_data) : LLPanel(std::string("panel_login"), LLRect(0,600,800,0), FALSE), // not bordered mLogoImage(), mCallback(callback), mCallbackData(cb_data), mHtmlAvailable( TRUE ) { setFocusRoot(TRUE); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); // instance management if (LLPanelLogin::sInstance) { llwarns << "Duplicate instance of login view deleted" << llendl; delete LLPanelLogin::sInstance; // Don't leave bad pointer in gFocusMgr gFocusMgr.setDefaultKeyboardFocus(NULL); } LLPanelLogin::sInstance = this; // add to front so we are the bottom-most child gViewerWindow->getRootView()->addChildAtEnd(this); // Logo mLogoImage = LLUI::getUIImage("startup_logo.j2c"); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml"); #if USE_VIEWER_AUTH //leave room for the login menu bar setRect(LLRect(0, rect.getHeight()-18, rect.getWidth(), 0)); #endif reshape(rect.getWidth(), rect.getHeight()); #if !USE_VIEWER_AUTH childSetPrevalidate("first_name_edit", LLLineEditor::prevalidatePrintableNoSpace); childSetPrevalidate("last_name_edit", LLLineEditor::prevalidatePrintableNoSpace); childSetCommitCallback("password_edit", mungePassword); childSetKeystrokeCallback("password_edit", onPassKey, this); childSetUserData("password_edit", this); // change z sort of clickable text to be behind buttons sendChildToBack(getChildView("channel_text")); sendChildToBack(getChildView("forgot_password_text")); LLLineEditor* edit = getChild<LLLineEditor>("password_edit"); if (edit) edit->setDrawAsterixes(TRUE); LLComboBox* combo = getChild<LLComboBox>("start_location_combo"); combo->setAllowTextEntry(TRUE, 128, FALSE); // The XML file loads the combo with the following labels: // 0 - "My Home" // 1 - "My Last Location" // 2 - "<Type region name>" BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); std::string sim_string = LLURLSimString::sInstance.mSimString; if (!sim_string.empty()) { // Replace "<Type region name>" with this region name combo->remove(2); combo->add( sim_string ); combo->setTextEntry(sim_string); combo->setCurrentByIndex( 2 ); } else if (login_last) { combo->setCurrentByIndex( 1 ); } else { combo->setCurrentByIndex( 0 ); } LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo"); server_choice_combo->setCommitCallback(onSelectServer); //server_choice_combo->setFocusLostCallback(onServerComboLostFocus); childSetAction("connect_btn", onClickConnect, this); childSetAction("grid_btn", onClickGrid, this); setDefaultBtn("connect_btn"); // childSetAction("quit_btn", onClickQuit, this); std::string imp_channel = gSavedSettings.getString("VersionChannelName"); std::string imp_version = llformat("%d.%d.%d %s", ViewerVersion::getImpMajorVersion(), ViewerVersion::getImpMinorVersion(), ViewerVersion::getImpPatchVersion(), ViewerVersion::getImpTestVersion().c_str() ); std::string ll_channel = ViewerVersion::getLLViewerName(); std::string ll_version = llformat("%d.%d.%d (%d)", ViewerVersion::getLLMajorVersion(), ViewerVersion::getLLMinorVersion(), ViewerVersion::getLLPatchVersion(), ViewerVersion::getLLBuildVersion() ); LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); channel_text->setTextArg("[CHANNEL]", imp_channel); channel_text->setTextArg("[VERSION]", imp_version); channel_text->setTextArg("[ALT_CHANNEL]", ll_channel); channel_text->setTextArg("[ALT_VERSION]", ll_version); channel_text->setClickedCallback(onClickVersion); channel_text->setCallbackUserData(this); LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text"); forgot_password_text->setClickedCallback(onClickForgotPassword); LLTextBox* create_new_account_text = getChild<LLTextBox>("create_new_account_text"); create_new_account_text->setClickedCallback(onClickNewAccount); #endif // get the web browser control LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html"); // Need to handle login secondlife:///app/ URLs web_browser->setTrusted( true ); // observe browser events web_browser->addObserver( this ); // don't make it a tab stop until SL-27594 is fixed web_browser->setTabStop(FALSE); web_browser->navigateToLocalPage( "loading", "loading.html" ); // make links open in external browser web_browser->setOpenInExternalBrowser( true ); // force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through) LLRect htmlRect = getRect(); #if USE_VIEWER_AUTH htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY(), getRect().getWidth() + 6, getRect().getHeight()); #else htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY() + 40, getRect().getWidth() + 6, getRect().getHeight() - 78 ); #endif web_browser->setRect( htmlRect ); web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); reshape( getRect().getWidth(), getRect().getHeight(), 1 ); // kick off a request to grab the url manually gResponsePtr = LLIamHereLogin::build( this ); std::string login_page = gSavedSettings.getString("LoginPage"); if (login_page.empty()) { login_page = getString( "real_url" ); } LLHTTPClient::head( login_page, gResponsePtr ); #if !USE_VIEWER_AUTH // Initialize visibility (and don't force visibility - use prefs) refreshLocation( false ); #endif LLFirstUse::useLoginScreen(); }
//--------------------------------------------------------------------------- // Singu Note: We could clean a lot of this up by creating derived classes for Notifications and NotificationTips. LLNotifyBox::LLNotifyBox(LLNotificationPtr notification) : LLPanel(notification->getName(), LLRect(), BORDER_NO), LLEventTimer(notification->getExpiration() == LLDate() ? LLDate(LLDate::now().secondsSinceEpoch() + (F64)gSavedSettings.getF32("NotifyTipDuration")) : notification->getExpiration()), LLInstanceTracker<LLNotifyBox, LLUUID>(notification->getID()), mNotification(notification), mIsTip(notification->getType() == "notifytip"), mAnimating(gNotifyBoxView->getChildCount() == 0), // Only animate first window mNextBtn(NULL), mNumOptions(0), mNumButtons(0), mAddedDefaultBtn(false), mUserInputBox(NULL) { std::string edit_text_name; std::string edit_text_contents; // setup paramaters const std::string& message(notification->getMessage()); // initialize setFocusRoot(!mIsTip); // caution flag can be set explicitly by specifying it in the // notification payload, or it can be set implicitly if the // notify xml template specifies that it is a caution // // tip-style notification handle 'caution' differently - // they display the tip in a different color mIsCaution = notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH; LLNotificationFormPtr form(notification->getForm()); mNumOptions = form->getNumElements(); bool is_textbox = form->getElement("message").isDefined(); bool layout_script_dialog(notification->getName() == "ScriptDialog" || notification->getName() == "ScriptDialogGroup"); LLRect rect = mIsTip ? getNotifyTipRect(message) : getNotifyRect(is_textbox ? 10 : mNumOptions, layout_script_dialog, mIsCaution); if ((form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE || form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)) rect.mBottom -= BTN_HEIGHT; setRect(rect); setFollows(mIsTip ? (FOLLOWS_BOTTOM|FOLLOWS_RIGHT) : (FOLLOWS_TOP|FOLLOWS_RIGHT)); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); const S32 TOP = getRect().getHeight() - (mIsTip ? (S32)sFont->getLineHeight() : 32); const S32 BOTTOM = (S32)sFont->getLineHeight(); S32 x = HPAD + HPAD; S32 y = TOP; auto icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), mIsTip ? "notify_tip_icon.tga" : mIsCaution ? "notify_caution_icon.tga" : "notify_box_icon.tga"); icon->setMouseOpaque(FALSE); addChild(icon); x += HPAD + HPAD + 32; // add a caution textbox at the top of a caution notification if (mIsCaution && !mIsTip) { S32 caution_height = ((S32)sFont->getLineHeight() * 2) + VPAD; auto caution_box = new LLTextBox( std::string("caution_box"), LLRect(x, y, getRect().getWidth() - 2, caution_height), LLStringUtil::null, sFont, FALSE); caution_box->setFontStyle(LLFontGL::BOLD); caution_box->setColor(gColors.getColor("NotifyCautionWarnColor")); caution_box->setBackgroundColor(gColors.getColor("NotifyCautionBoxColor")); caution_box->setBorderVisible(FALSE); caution_box->setWrappedText(notification->getMessage()); addChild(caution_box); // adjust the vertical position of the next control so that // it appears below the caution textbox y = y - caution_height; } else { const S32 BTN_TOP = BOTTOM_PAD + (((mNumOptions-1+2)/3)) * (BTN_HEIGHT+VPAD); // Tokenization on \n is handled by LLTextBox const S32 MAX_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB_LAST_NAME_BUF_SIZE + DB_INV_ITEM_NAME_BUF_SIZE; // For script dialogs: add space for title. auto text = new LLTextEditor(std::string("box"), LLRect(x, y, getRect().getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16), MAX_LENGTH, LLStringUtil::null, sFont, FALSE, true); text->setWordWrap(TRUE); text->setMouseOpaque(TRUE); text->setBorderVisible(FALSE); text->setTakesNonScrollClicks(TRUE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( LLColor4::transparent ); // the background color of the box is manually // rendered under the text box, therefore we want // the actual text box to be transparent auto text_color = gColors.getColor(mIsCaution && mIsTip ? "NotifyCautionWarnColor" : "NotifyTextColor"); text->setReadOnlyFgColor(text_color); //sets caution text color for tip notifications if (!mIsCaution) // We could do some extra color math here to determine if bg's too close to link color, but let's just cross with the link color instead text->setLinkColor(new LLColor4(lerp(text_color, gSavedSettings.getColor4("HTMLLinkColor"), 0.4f))); text->setTabStop(FALSE); // can't tab to it (may be a problem for scrolling via keyboard) text->appendText(message,false,false,nullptr,!layout_script_dialog); // Now we can set the text, since colors have been set. addChild(text); } if (mIsTip) { chat_notification(mNotification); } else { mNextBtn = new LLButton(std::string("next"), LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, boost::bind(&LLNotifyBox::moveToBack, this, true), sFont); mNextBtn->setScaleImage(TRUE); mNextBtn->setToolTip(LLTrans::getString("next")); addChild(mNextBtn); for (S32 i = 0; i < mNumOptions; i++) { LLSD form_element = form->getElement(i); std::string element_type = form_element["type"].asString(); if (element_type == "button") { addButton(form_element["name"].asString(), form_element["text"].asString(), TRUE, form_element["default"].asBoolean(), layout_script_dialog); } else if (element_type == "input") { edit_text_contents = form_element["value"].asString(); edit_text_name = form_element["name"].asString(); } } if (is_textbox) { S32 button_rows = layout_script_dialog ? 2 : 1; LLRect input_rect; input_rect.setOriginAndSize(x, BOTTOM_PAD + button_rows * (BTN_HEIGHT + VPAD), 3 * 80 + 4 * HPAD, button_rows * (BTN_HEIGHT + VPAD) + BTN_HEIGHT); mUserInputBox = new LLTextEditor(edit_text_name, input_rect, 254, edit_text_contents, sFont, FALSE); mUserInputBox->setBorderVisible(TRUE); mUserInputBox->setTakesNonScrollClicks(TRUE); mUserInputBox->setHideScrollbarForShortDocs(TRUE); mUserInputBox->setWordWrap(TRUE); mUserInputBox->setTabsToNextField(FALSE); mUserInputBox->setCommitOnFocusLost(FALSE); mUserInputBox->setAcceptCallingCardNames(FALSE); mUserInputBox->setHandleEditKeysDirectly(TRUE); addChild(mUserInputBox, -1); } else { setIsChrome(TRUE); } if (mNumButtons == 0) { addButton("OK", "OK", false, true, layout_script_dialog); mAddedDefaultBtn = true; } std::string check_title; if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE) { check_title = LLNotificationTemplates::instance().getGlobalString("skipnexttime"); } else if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE) { check_title = LLNotificationTemplates::instance().getGlobalString("alwayschoose"); } if (!check_title.empty()) { const LLFontGL* font = LLResMgr::getInstance()->getRes(LLFONT_SANSSERIF); S32 line_height = llfloor(font->getLineHeight() + 0.99f); // Extend dialog for "check next time" S32 max_msg_width = getRect().getWidth() - HPAD * 9; S32 check_width = S32(font->getWidth(check_title) + 0.99f) + 16; max_msg_width = llmax(max_msg_width, check_width); S32 msg_x = (getRect().getWidth() - max_msg_width) / 2; LLRect check_rect; check_rect.setOriginAndSize(msg_x, BOTTOM_PAD + BTN_HEIGHT + VPAD*2 + (BTN_HEIGHT + VPAD) * (mNumButtons / 3), max_msg_width, line_height); LLCheckboxCtrl* check = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font, // Lambda abuse. [this](LLUICtrl* ctrl, const LLSD& param) { this->mNotification->setIgnored(ctrl->getValue()); }); check->setEnabledColor(LLUI::sColorsGroup->getColor(mIsCaution ? "AlertCautionTextColor" : "AlertTextColor")); if (mIsCaution) { check->setButtonColor(LLUI::sColorsGroup->getColor("ButtonCautionImageColor")); } addChild(check); } if (++sNotifyBoxCount <= 0) LL_WARNS() << "A notification was mishandled. sNotifyBoxCount = " << sNotifyBoxCount << LL_ENDL; // If this is the only notify box, don't show the next button else if (sNotifyBoxCount == 1 && mNextBtn) mNextBtn->setVisible(false); } }