void URLLabel::enterEvent(QEvent* e) { QLabel::enterEvent(e); if(!d->AltPixmap.isNull() && pixmap()) { d->RealPixmap = *pixmap(); setPixmap(d->AltPixmap); } if(d->Glow || d->Float) { d->Timer->stop(); setLinkColor(d->HighlightedLinkColor); d->RealUnderline = d->Underline; if(d->Float) setUnderline(true); } emit enteredURL(); emit enteredURL(d->URL); }
void URLLabel::setHighlightedColor(const QColor& highcolor) { d->LinkColor = highcolor; if(!d->Timer->isActive()) setLinkColor(highcolor); }
void URLLabel::setSelectedColor(const QColor& selcolor) { d->HighlightedLinkColor = selcolor; if(d->Timer->isActive()) setLinkColor(selcolor); }
void URLLabel::mouseReleaseEvent( QMouseEvent* e ) { // QLabel::mouseReleaseEvent( e ); setLinkColor( d->HighlightedLinkColor ); d->Timer->start( 300 ); switch( e->button() ) { case Qt::LeftButton: emit leftClickedURL(); emit leftClickedURL( d->URL ); break; case Qt::MidButton: emit middleClickedURL(); emit middleClickedURL( d->URL.toString() ); break; case Qt::RightButton: // commented: Angius Fabrizio (2005-02-14) emit rightClickedURL(); emit rightClickedURL( d->URL.toString() ); break; default: ; // nothing } }
void URLLabel::updateColor() { d->Timer->stop(); if(!(d->Glow || d->Float) || !rect().contains(mapFromGlobal(QCursor::pos()))) setLinkColor(d->LinkColor); }
void updateColor() { timer->stop(); if ( !(glowEnabled || floatEnabled) || !parent->rect().contains( parent->mapFromGlobal( QCursor::pos() ) ) ) setLinkColor( linkColor ); }
URLLabel::URLLabel( const QUrl& url, const QString& text, QWidget* parent, const char* /*name*/ ) : QLabel( !text.isNull() ? text : url.toString(), parent, 0 ), d( new Private( url, this ) ) { setFont( font() ); setCursor( QCursor( Qt::PointingHandCursor ) ); setLinkColor( d->LinkColor ); }
URLLabel::URLLabel( QWidget* parent, const char* /*name*/ ) : QLabel( parent, 0 ), d( new Private( QUrl(), this ) ) { setFont( font() ); setCursor( QCursor( Qt::PointingHandCursor ) ); setLinkColor( d->LinkColor ); }
void PlanningSceneDisplay::setGroupColor(rviz::Robot* robot, const std::string& group_name, const QColor &color) { if (getRobotModel()) { const robot_model::JointModelGroup *jmg = getRobotModel()->getJointModelGroup(group_name); if (jmg) { const std::vector<std::string> &links = jmg->getLinkModelNamesWithCollisionGeometry(); for (std::size_t i = 0 ; i < links.size() ; ++i) setLinkColor(robot, links[i], color); } } }
void URLLabel::leaveEvent(QEvent* e) { QLabel::leaveEvent(e); if(!d->AltPixmap.isNull() && pixmap()) setPixmap(d->RealPixmap); if((d->Glow || d->Float) && !d->Timer->isActive()) setLinkColor(d->LinkColor); setUnderline(d->RealUnderline); emit leftURL(); emit leftURL(d->URL.toString()); }
void PlanningSceneDisplay::setLinkColor(const std::string& link_name, const QColor &color) { setLinkColor(&planning_scene_robot_->getRobot(), link_name, color ); }
void BtStyle::setCurrentStyle(int style) { if (style == BtStyle::darkTheme) { currentStyle = style; BtModuleTextModel::setLinkColor(QColor(0,191,255)); BtModuleTextModel::setHighlightColor(QColor(255,255,0)); BtModuleTextModel::setJesusWordsColor(QColor(255,0,0)); setTextColor(QColor(255,255,255)); setLinkColor(QColor(0,0,80)); setTextBackgroundColor(QColor(0,0,0)); setTextBackgroundHighlightColor(QColor(184,135,11)); setButtonColor(QColor(0,0,0)); setButtonBackground(QColor(35,35,100)); setButtonTextColor(QColor(255,210,0)); setButtonHighlightedText(QColor(255,255,0)); setButtonBorder(QColor(110,110,110)); setButtonRadius(3); setButtonGradient0(QColor(125,125,125)); setButtonGradient1(QColor(60,60,60)); setButtonGradient2(QColor(50,50,50)); setButtonGradient3(QColor(20,20,20)); setWindowTab(QColor(100,100,100)); setWindowTabSelected(QColor(218,165,3)); setWindowTabText(QColor(255,255,255)); setWindowTabTextSelected(QColor(0,0,0)); setMenu(QColor(255,255,255)); setMenuBorder(QColor(60,60,60)); setMenuText(QColor(0,0,0)); setMenuHeight(34); setToolbarColor(QColor(0,0,0)); setToolbarTextColor(QColor(218,165,3)); setToolbarButtonText(QColor(255,255,255)); setToolbarTextPointSize(10); } else if (style == BtStyle::lightBlueTheme) { currentStyle = style; BtModuleTextModel::setLinkColor(QColor(0,0,255)); BtModuleTextModel::setHighlightColor(QColor(0,0,255)); BtModuleTextModel::setJesusWordsColor(QColor(255,0,0)); setTextColor(QColor(0,0,0)); setLinkColor(QColor(0,0,220)); setTextBackgroundColor(QColor(255,255,255)); setTextBackgroundHighlightColor(QColor(255,240,170)); setButtonColor(QColor(0,0,0)); setButtonBackground(QColor(190,220,255)); setButtonTextColor(QColor(0,0,0)); setButtonHighlightedText(QColor(0,0,255)); setButtonBorder(QColor(80,80,0)); setButtonRadius(3); setButtonGradient0(QColor(180,180,255)); setButtonGradient1(QColor(255,255,255)); setButtonGradient2(QColor(255,255,255)); setButtonGradient3(QColor(180,180,255)); setWindowTab(QColor(245,245,245)); setWindowTabSelected(QColor(65,105,225)); setWindowTabText(QColor(100,100,100)); setWindowTabTextSelected(QColor(255,255,255)); setMenu(QColor(255,255,255)); setMenuBorder(QColor(220,220,220)); setMenuText(QColor(0,0,0)); setMenuHeight(40); setToolbarColor(QColor(190,220,255)); setToolbarTextColor(QColor(0,0,0)); setToolbarButtonText(QColor(0,0,0)); setToolbarTextPointSize(10); } else if (style == BtStyle::crimsonTheme) { currentStyle = style; BtModuleTextModel::setLinkColor(QColor(0,0,255)); BtModuleTextModel::setHighlightColor(QColor(0,0,255)); BtModuleTextModel::setJesusWordsColor(QColor(170,0,0)); setTextColor(QColor(0,0,0)); setLinkColor(QColor(0,0,220)); setTextBackgroundColor(QColor(255,255,255)); setTextBackgroundHighlightColor(QColor(255,240,170)); setButtonColor(QColor(0,0,0)); setButtonBackground(QColor(190,220,255)); setButtonTextColor(QColor(0,0,0)); setButtonHighlightedText(QColor(0,0,255)); setButtonBorder(QColor(80,80,0)); setButtonRadius(3); setButtonGradient0(QColor(180,180,255)); setButtonGradient1(QColor(255,255,255)); setButtonGradient2(QColor(255,255,255)); setButtonGradient3(QColor(180,180,255)); setWindowTab(QColor(245,245,245)); setWindowTabSelected(QColor(218,165,3)); setWindowTabText(QColor(100,100,100)); setWindowTabTextSelected(QColor(0,0,0)); setMenu(QColor(255,255,255)); setMenuBorder(QColor(220,220,220)); setMenuText(QColor(0,0,0)); setMenuHeight(40); setToolbarColor(QColor(99,0,0)); setToolbarTextColor(QColor(255,255,255)); setToolbarButtonText(QColor(0,0,0)); setToolbarTextPointSize(10); } }
//--------------------------------------------------------------------------- // 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); } }
void RobotStateDisplay::setLinkColor(const std::string& link_name, const QColor &color) { setLinkColor(&robot_->getRobot(), link_name, color ); }