Beispiel #1
0
int scanDirCallback(char *dirName){
    oslStartDrawing();
    drawCommonGraphics();
    drawButtonBar(MODE_MEDIA_LIBRARY);

    int startX = (480 - scanBkg->sizeX) / 2;
    int startY = (272 - scanBkg->sizeY) / 2;
    oslDrawImageXY(scanBkg, startX, startY);
    skinGetColor("RGBA_POPUP_TITLE_TEXT", tempColor);
    skinGetColor("RGBA_POPUP_TITLE_TEXT_SHADOW", tempColorShadow);
    setFontStyle(fontNormal, defaultTextSize, RGBA(tempColor[0], tempColor[1], tempColor[2], tempColor[3]), RGBA(tempColorShadow[0], tempColorShadow[1], tempColorShadow[2], tempColorShadow[3]), INTRAFONT_ALIGN_LEFT);
    oslDrawString((480 - oslGetStringWidth(langGetString("SCANNING"))) / 2, startY + 3, langGetString("SCANNING"));
    skinGetColor("RGBA_POPUP_MESSAGE_TEXT", tempColor);
    skinGetColor("RGBA_POPUP_MESSAGE_TEXT_SHADOW", tempColorShadow);
    setFontStyle(fontNormal, defaultTextSize, RGBA(tempColor[0], tempColor[1], tempColor[2], tempColor[3]), RGBA(tempColorShadow[0], tempColorShadow[1], tempColorShadow[2], tempColorShadow[3]), INTRAFONT_ALIGN_LEFT);
    getFileName(dirName, buffer);
    if (strlen(buffer) > 70)
       buffer[70] = '\0';
    oslDrawString((480 - oslGetStringWidth(buffer)) / 2, startY + 30, buffer);

    oslReadKeys();
    oslEndDrawing();
    oslEndFrame();
    oslSyncFrame();
    return 0;
}
Beispiel #2
0
void FontModel::set(std::shared_ptr<FontModel> data)
{
	setFamilyName (data->getFamilyName());
	setFontSize (data->getFontSize());
	setFontStyle (data->getFontStyle());
	setFontWeight (data->getFontWeight());
}
Beispiel #3
0
		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") );
		}
Beispiel #4
0
EditTextWidget::EditTextWidget(GuiObject *boss, const String &name, const String &text, const char *tooltip, uint32 cmd, uint32 finishCmd)
	: EditableWidget(boss, name, tooltip, cmd) {
	setFlags(WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE);
	_type = kEditTextWidget;
	_finishCmd = finishCmd;

	setEditString(text);
	setFontStyle(ThemeEngine::kFontStyleNormal);
}
Beispiel #5
0
void printDebugMsg(enum DEBUG_MESSAGES MESSAGE_TYPE,const char *fmt, ...) {
static char strDebugMsg[1024];
va_list pArguments;
    va_start(pArguments,fmt);
    vsnprintf(strDebugMsg,sizeof(strDebugMsg),fmt,pArguments);
    va_end(pArguments);
    switch(MESSAGE_TYPE) {
        case ERROR_DEBUG_MESSAGE:
            setFontStyle(CONSOLE_FONT_RED,DEFAULT_FONT_FGCOLOR,CONSOLE_FONT_NORMAL);
            printf("%s",strDebugMsg);
            break;
        default:
            setFontStyle(DEFAULT_FONT_BGCOLOR,DEFAULT_FONT_FGCOLOR,CONSOLE_FONT_NORMAL);
            printf("%s",strDebugMsg);
    }
    resetPreviousFontStyle();

}
Beispiel #6
0
void printAlignedStyledText(double dbColumn,double dbRow,u8 chMinRow,u8 chMinColumn,u8 chMaxRow,u8 chMaxColumn,enum CONSOLE_FONT_COLORS FONT_BGCOLOR,enum CONSOLE_FONT_COLORS FONT_FGCOLOR,enum CONSOLE_FONT_WEIGHTS FONT_WEIGHT,bool blnMultiLine,bool blnHideOverflowText,struct stConsoleCursorLocation *stTexteLocation,const char *strTexteFormat,...) {
static char strTextBuffer[1024];
va_list pArguments;
    va_start(pArguments,strTexteFormat);
    vsnprintf(strTextBuffer,sizeof(strTextBuffer),strTexteFormat,pArguments);
    va_end(pArguments);
    setFontStyle(FONT_BGCOLOR,FONT_FGCOLOR,FONT_WEIGHT);
    printAlignedText(dbColumn,dbRow,chMinRow,chMinColumn,chMaxRow,chMaxColumn,blnMultiLine,blnHideOverflowText,stTexteLocation,"%s",strTextBuffer);
    resetPreviousFontStyle();
}
Beispiel #7
0
void printStyledText(u8 chRow,u8 chColumn,enum CONSOLE_FONT_COLORS FONT_BGCOLOR,enum CONSOLE_FONT_COLORS FONT_FGCOLOR,enum CONSOLE_FONT_WEIGHTS FONT_WEIGHT,struct stConsoleCursorLocation *stTexteLocation,const char *fmt, ...) {
static char strTextBuffer[1024];
va_list pArguments;
    setFontStyle(FONT_BGCOLOR,FONT_FGCOLOR,FONT_WEIGHT);
    va_start(pArguments,fmt);
    vsnprintf(strTextBuffer,sizeof(strTextBuffer),fmt,pArguments);
    va_end(pArguments);
    printLocatedText(chRow,chColumn,stTexteLocation,"%s",strTextBuffer);
    resetPreviousFontStyle();
}
windowLayout::windowLayout(QWidget *parent)
    : QWidget(parent)
{

    QPixmap mask( ":/images/images/mask.png" );
    setMask( mask );
    createAllWidgets();
    setFontStyle(false);


}
Beispiel #9
0
EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, const char *tooltip, uint32 cmd, uint32 finishCmd)
	: EditableWidget(boss, x, y - 1, w, h + 2, tooltip, cmd) {
	setFlags(WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE);
	_type = kEditTextWidget;
	_finishCmd = finishCmd;

	setEditString(text);
	setFontStyle(ThemeEngine::kFontStyleNormal);

	_leftPadding = _rightPadding = 0;
}
void BtFontChooserWidget::styleChanged(QListWidgetItem* current, QListWidgetItem* /*previous*/) {
    if (current == nullptr)
        return;

    QString styleString = current->text();
    setFontStyle(styleString, &m_font);

    // Save style if the user choose it
    if (m_styleListWidget->hasFocus())
        m_choosenStyle = styleString;

    loadSizes(m_fontListWidget->currentItem()->text(), styleString);

    outputHtmlText();
    emit fontSelected(m_font);
}
Beispiel #11
0
void printLabel(u8 chRow,u8 chColumn,enum CONSOLE_FONT_COLORS FONT_BGCOLOR,enum CONSOLE_FONT_COLORS FONT_FGCOLOR,enum CONSOLE_FONT_WEIGHTS FONT_WEIGHT,unsigned char chLabelSize,struct stConsoleCursorLocation *stConcatLabelLocation,const char *strFormatLabel,...) {
static char strLabelText[256];
va_list pArguments;
unsigned char chLabelLength;
    saveCursorPosition();
    va_start(pArguments,strFormatLabel);
    vsnprintf(strLabelText,chLabelSize+1,strFormatLabel,pArguments);
    va_end(pArguments);
    setCursorPosition(getTextBoxRow(chRow),getTextBoxColumn(chColumn));
    setFontStyle(FONT_BGCOLOR,FONT_FGCOLOR,FONT_WEIGHT);
    printf("%.*s",(unsigned int) chLabelSize,strLabelText);
    CON_GetPosition(&stConcatLabelLocation->intColumn,&stConcatLabelLocation->intRow);
    resetPreviousFontStyle();
    chLabelLength=strlen(strLabelText);
    printf("%*s",(unsigned int) ((chLabelLength>chLabelSize)?0:chLabelSize-chLabelLength),"");
    resetSavedCursorPosition();
}
Beispiel #12
0
QQChatDlg::QQChatDlg(QString id, QString name, FriendInfo curr_user_info, 
                     CaptchaInfo cap_info, QWidget *parent) : 
    QDialog(parent),
    id_(id),
    msg_id_(4462000),
    name_(name),
    cap_info_(cap_info), 
    curr_user_info_(curr_user_info),
    img_loader_(NULL),
    img_sender_(NULL),
    qqface_panel_(NULL),
    msg_sender_(NULL)
{
    qRegisterMetaType<FileInfo>("FileInfo");
    setFontStyle(QFont(), Qt::black, 9);

    te_messages_.setReadOnly(true);
}
Beispiel #13
0
void drawSelectionFrame(u8 chMinRow,u8 chMinColumn,u8 chMaxRow,u8 chMaxColumn,enum BORDER_STYLES BORDER_STYLE,enum CONSOLE_FONT_COLORS BORDER_COLOR,enum CONSOLE_FONT_COLORS BORDER_BGCOLOR) {
u8 chColumnsCount;
    if (chMinColumn>chMaxColumn) {
        permutePointers((void *) &chMinColumn,(void *) &chMaxColumn);
    }
    if (chMinRow>chMaxRow) {
        permutePointers((void *) &chMinRow,(void *) &chMaxRow);
    }
    chColumnsCount=chMaxColumn-chMinColumn+1;
    saveCursorPosition();
    setFontStyle(BORDER_BGCOLOR,BORDER_COLOR,CONSOLE_FONT_BOLD);
    setCursorPosition(chMinRow,chMinColumn);
    printRepeatString(chColumnsCount,"%c",getBorderSymbol(BORDER_STYLE,HORIZONTAL_SINGLE_BORDER));
    if (chMinRow!=chMaxRow) {
        setCursorPosition(chMinRow,chMinColumn);
        printf("%c",getBorderSymbol(BORDER_STYLE,LEFT_TOP_SINGLE_CORNER));
        setCursorPosition(chMinRow,chMaxColumn);
        printf("%c",getBorderSymbol(BORDER_STYLE,RIGHT_TOP_SINGLE_CORNER));
    }
    while (chMinRow<chMaxRow) {
        chMinRow++;
        setCursorPosition(chMinRow,chMinColumn);
        printf("%c",getBorderSymbol(BORDER_STYLE,VERTICAL_SINGLE_BORDER));
        setCursorPosition(chMinRow,chMaxColumn);
        printf("%c",getBorderSymbol(BORDER_STYLE,VERTICAL_SINGLE_BORDER));
    }
    setCursorPosition(chMaxRow,chMinColumn);
    printRepeatString(chColumnsCount,"%c",getBorderSymbol(BORDER_STYLE,HORIZONTAL_SINGLE_BORDER));
    if (chMinColumn!=chMaxColumn) {
        setCursorPosition(chMaxRow,chMinColumn);
        printf("%c",getBorderSymbol(BORDER_STYLE,LEFT_BOTTOM_SINGLE_CORNER));
        setCursorPosition(chMaxRow,chMaxColumn);
        printf("%c",getBorderSymbol(BORDER_STYLE,RIGHT_BOTTOM_SINGLE_CORNER));
    }
    resetPreviousFontStyle();
    resetSavedCursorPosition();
}
Beispiel #14
0
void drawFrame(u8 chMinRow,u8 chMinColumn,u8 chMaxRow,u8 chMaxColumn,enum BORDERS BORDER_TYPE,enum BORDER_STYLES BORDER_STYLE,enum CONSOLE_FONT_COLORS BORDER_COLOR,enum CONSOLE_FONT_COLORS FRAME_COLOR,enum FRAME_JUNCTIONS TOP_LEFT_JUNCTION,enum FRAME_JUNCTIONS TOP_RIGHT_JUNCTION,enum FRAME_JUNCTIONS BOTTOM_LEFT_JUNCTION,enum FRAME_JUNCTIONS BOTTOM_RIGHT_JUNCTION) {
static char strLeftBorder[2],strRightBorder[2];
unsigned char chLeftBorder=VERTICAL_SINGLE_BORDER*(BORDER_TYPE & LEFT_BORDER)/LEFT_BORDER,chRightBorder=VERTICAL_SINGLE_BORDER *(BORDER_TYPE & RIGHT_BORDER)/RIGHT_BORDER;
s16 intFrameColumnsCount,intMinRow,intMaxRow;
struct stConsoleCursorLocation stTexteLocation;
    if (chMinColumn>chMaxColumn) {
        permutePointers((void *) &chMinColumn,(void *) &chMaxColumn);
    }
    if (chMinRow>chMaxRow) {
        permutePointers((void *) &chMinRow,(void *) &chMaxRow);
    }
    intMinRow=chMinRow;
    intMaxRow=chMaxRow;
    setFontStyle(FRAME_COLOR,BORDER_COLOR,CONSOLE_FONT_BOLD);
    intFrameColumnsCount=chMaxColumn-chMinColumn+1;
    saveCursorPosition();
    if (BORDER_TYPE & TOP_BORDER) {
        setCursorPosition(chMinRow,chMinColumn);
        printRepeatString(intFrameColumnsCount,"%c",getBorderSymbol(BORDER_STYLE,HORIZONTAL_SINGLE_BORDER));
        if (chLeftBorder) {
            switch ((unsigned char) (TOP_LEFT_JUNCTION)) {
                case HORIZONTAL_JUNCTION:
                    printLocatedText(chMinRow,chMinColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,MIDDLE_TOP_SINGLE_JUNCTION));
                    break;
                case VERTICAL_JUNCTION:
                    printLocatedText(chMinRow,chMinColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,LEFT_MIDDLE_SINGLE_JUNCTION));
                    break;
                case ALL_JUNCTIONS:
                    printLocatedText(chMinRow,chMinColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,CROSS_SINGLE_JUNCTION));
                    break;
                default:
                    printLocatedText(chMinRow,chMinColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,LEFT_TOP_SINGLE_CORNER));
            }
            resetSavedPreviousCursorPosition();
        }
        if (chRightBorder) {
            switch ((unsigned char) (TOP_RIGHT_JUNCTION)) {
                case HORIZONTAL_JUNCTION:
                    printLocatedText(chMinRow,chMaxColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,MIDDLE_TOP_SINGLE_JUNCTION));
                    break;
                case VERTICAL_JUNCTION:
                    printLocatedText(chMinRow,chMaxColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,RIGHT_MIDDLE_SINGLE_JUNCTION));
                    break;
                case ALL_JUNCTIONS:
                    printLocatedText(chMinRow,chMaxColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,CROSS_SINGLE_JUNCTION));
                    break;
                default:
                    printLocatedText(chMinRow,chMaxColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,RIGHT_TOP_SINGLE_CORNER));
            }
            resetSavedPreviousCursorPosition();
        }
        intMinRow++;
    }
    if (BORDER_TYPE & BOTTOM_BORDER) {
        setCursorPosition(chMaxRow,chMinColumn);
        printRepeatString(intFrameColumnsCount,"%c",getBorderSymbol(BORDER_STYLE,HORIZONTAL_SINGLE_BORDER));
        if (chLeftBorder) {
            switch ((unsigned char) (BOTTOM_LEFT_JUNCTION)) {
                case HORIZONTAL_JUNCTION:
                    printLocatedText(chMaxRow,chMinColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,MIDDLE_BOTTOM_SINGLE_JUNCTION));
                    break;
                case VERTICAL_JUNCTION:
                    printLocatedText(chMaxRow,chMinColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,LEFT_MIDDLE_SINGLE_JUNCTION));
                    break;
                case ALL_JUNCTIONS:
                    printLocatedText(chMaxRow,chMinColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,CROSS_SINGLE_JUNCTION));
                    break;
                default:
                    printLocatedText(chMaxRow,chMinColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,LEFT_BOTTOM_SINGLE_CORNER));
            }
            resetSavedPreviousCursorPosition();
        }
        if (chRightBorder) {
            switch ((unsigned char) (BOTTOM_RIGHT_JUNCTION)) {
                case HORIZONTAL_JUNCTION:
                    printLocatedText(chMaxRow,chMaxColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,MIDDLE_BOTTOM_SINGLE_JUNCTION));
                    break;
                case VERTICAL_JUNCTION:
                    printLocatedText(chMaxRow,chMaxColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,RIGHT_MIDDLE_SINGLE_JUNCTION));
                    break;
                case ALL_JUNCTIONS:
                    printLocatedText(chMaxRow,chMaxColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,CROSS_SINGLE_JUNCTION));
                    break;
                default:
                    printLocatedText(chMaxRow,chMaxColumn,&stTexteLocation,"%c",getBorderSymbol(BORDER_STYLE,RIGHT_BOTTOM_SINGLE_CORNER));
            }
            resetSavedPreviousCursorPosition();
        }
        intMaxRow--;
    }
    if ((intMaxRow-intMinRow+1)>0) {
        snprintf(strLeftBorder,sizeof(strLeftBorder),"%c",getBorderSymbol(BORDER_STYLE,chLeftBorder));
        snprintf(strRightBorder,sizeof(strRightBorder),"%c",getBorderSymbol(BORDER_STYLE,chRightBorder));
        intFrameColumnsCount=MAX(intFrameColumnsCount-strlen(strLeftBorder)-strlen(strRightBorder),0);
        while (intMinRow<=intMaxRow) {
            setCursorPosition(intMinRow,chMinColumn);
            printf("%s%*s%s",strLeftBorder,intFrameColumnsCount,"",strRightBorder);
            intMinRow++;
        }
    }
    resetSavedCursorPosition();
    resetPreviousFontStyle();
}
//---------------------------------------------------------------------------
// 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);
	}
}
Beispiel #16
0
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Draw info on selected item:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void drawMLinfo(){
	static u64 lastMenuChange = 0;
	static int lastSelected = -1;

	OSL_FONT *font = fontNormal;
	OSL_IMAGE *tmpCoverArt = NULL;

    if (mediaLibraryStatus != STATUS_QUERYMENU)
        return;

    skinGetPosition("POS_MEDIALIBRARY_INFO_BKG", tempPos);
    oslDrawImageXY(infoBkg, tempPos[0], tempPos[1]);
    oslSetFont(font);
    skinGetColor("RGBA_LABEL_TEXT", tempColor);
    skinGetColor("RGBA_LABEL_TEXT_SHADOW", tempColorShadow);
    setFontStyle(fontNormal, defaultTextSize, RGBA(tempColor[0], tempColor[1], tempColor[2], tempColor[3]), RGBA(tempColorShadow[0], tempColorShadow[1], tempColorShadow[2], tempColorShadow[3]), INTRAFONT_ALIGN_LEFT);

	switch (mlQueryType)
	{
	case QUERY_COUNT:
	case QUERY_COUNT_RATING:
	case QUERY_COUNT_ARTIST:
        skinGetPosition("POS_MEDIALIBRARY_TOTAL_TRACKS_LABEL", tempPos);
        oslDrawString(tempPos[0], tempPos[1], langGetString("TOTAL_TRACKS"));
        skinGetPosition("POS_MEDIALIBRARY_TOTAL_TIME_LABEL", tempPos);
        oslDrawString(tempPos[0], tempPos[1], langGetString("TOTAL_TIME"));
        skinGetColor("RGBA_TEXT", tempColor);
        skinGetColor("RGBA_TEXT_SHADOW", tempColorShadow);
        setFontStyle(fontNormal, defaultTextSize, RGBA(tempColor[0], tempColor[1], tempColor[2], tempColor[3]), RGBA(tempColorShadow[0], tempColorShadow[1], tempColorShadow[2], tempColorShadow[3]), INTRAFONT_ALIGN_LEFT);
        snprintf(buffer, sizeof(buffer), "%.f", MLresult[commonMenu.selected - mlBufferPosition]->intField01);
        skinGetPosition("POS_MEDIALIBRARY_TOTAL_TRACKS_VALUE", tempPos);
        oslDrawString(tempPos[0], tempPos[1], buffer);

        formatHHMMSS(MLresult[commonMenu.selected - mlBufferPosition]->intField02, buffer, sizeof(buffer));
        skinGetPosition("POS_MEDIALIBRARY_TOTAL_TIME_VALUE", tempPos);
        oslDrawString(tempPos[0], tempPos[1], buffer);
		break;
	case QUERY_SINGLE_ENTRY:
        skinGetPosition("POS_MEDIALIBRARY_GENRE_LABEL", tempPos);
        oslDrawString(tempPos[0], tempPos[1], langGetString("GENRE"));
        skinGetPosition("POS_MEDIALIBRARY_YEAR_LABEL", tempPos);
        oslDrawString(tempPos[0], tempPos[1], langGetString("YEAR"));
        skinGetPosition("POS_MEDIALIBRARY_TIME_LABEL", tempPos);
        oslDrawString(tempPos[0], tempPos[1], langGetString("TIME"));
        skinGetPosition("POS_MEDIALIBRARY_RATING_LABEL", tempPos);
        oslDrawString(tempPos[0], tempPos[1], langGetString("RATING"));
        skinGetPosition("POS_MEDIALIBRARY_PLAYED_LABEL", tempPos);
        oslDrawString(tempPos[0], tempPos[1], langGetString("PLAYED"));

        skinGetColor("RGBA_TEXT", tempColor);
        skinGetColor("RGBA_TEXT_SHADOW", tempColorShadow);
        setFontStyle(fontNormal, defaultTextSize, RGBA(tempColor[0], tempColor[1], tempColor[2], tempColor[3]), RGBA(tempColorShadow[0], tempColorShadow[1], tempColorShadow[2], tempColorShadow[3]), INTRAFONT_ALIGN_LEFT);
        skinGetPosition("POS_MEDIALIBRARY_GENRE_VALUE", tempPos);
        oslDrawString(tempPos[0], tempPos[1], MLresult[commonMenu.selected - mlBufferPosition]->genre);
        skinGetPosition("POS_MEDIALIBRARY_YEAR_VALUE", tempPos);
        oslDrawString(tempPos[0], tempPos[1], MLresult[commonMenu.selected - mlBufferPosition]->year);

        formatHHMMSS(MLresult[commonMenu.selected - mlBufferPosition]->seconds, buffer, sizeof(buffer));
        skinGetPosition("POS_MEDIALIBRARY_TIME_VALUE", tempPos);
        oslDrawString(tempPos[0], tempPos[1], buffer);

        skinGetPosition("POS_MEDIALIBRARY_RATING_VALUE", tempPos);
        drawRating(tempPos[0], tempPos[1], MLresult[commonMenu.selected - mlBufferPosition]->rating);

		skinGetPosition("POS_MEDIALIBRARY_PLAYED_VALUE", tempPos);
		snprintf(buffer, sizeof(buffer), "%i", MLresult[commonMenu.selected - mlBufferPosition]->played);
		oslDrawString(tempPos[0], tempPos[1], buffer);

		if (commonMenu.selected != lastSelected){
			sceRtcGetCurrentTick (&lastMenuChange);
			lastSelected = commonMenu.selected;
			if (coverArt){
				oslDeleteImage(coverArt);
				coverArt = NULL;
			}
			coverArtFailed = 0;
		}else if (!coverArt && !coverArtFailed){
			u64 currentTime;
			sceRtcGetCurrentTick(&currentTime);
			if (currentTime - lastMenuChange > COVERTART_DELAY){
				char dirName[264];
				int size = 0;

				cpuBoost();
				snprintf(dirName, sizeof(dirName), "%s", MLresult[commonMenu.selected - mlBufferPosition]->shortpath);
				directoryUp(dirName);
				//Look for folder.jpg in the same directory:
				snprintf(buffer, sizeof(buffer), "%s/%s", dirName, "folder.jpg");

				size = fileExists(buffer);
				if (size > 0 && size <= MAX_IMAGE_DIMENSION)
                {
					tmpCoverArt = oslLoadImageFileJPG(buffer, OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888);
                }
				else
                {
					//Look for cover.jpg in same directory:
					snprintf(buffer, sizeof(buffer), "%s/%s", dirName, "cover.jpg");
					size = fileExists(buffer);
					if (size > 0 && size <= MAX_IMAGE_DIMENSION)
						tmpCoverArt = oslLoadImageFileJPG(buffer, OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888);
				}
				if (tmpCoverArt){
    				int coverArtWidth  = skinGetParam("MEDIALIBRARY_COVERART_WIDTH");
    				int coverArtHeight = skinGetParam("MEDIALIBRARY_COVERART_HEIGHT");

					coverArt = oslScaleImageCreate(tmpCoverArt, OSL_IN_RAM | OSL_SWIZZLED, coverArtWidth, coverArtHeight, OSL_PF_8888);
					oslDeleteImage(tmpCoverArt);
					tmpCoverArt = NULL;

        			coverArt->stretchX = coverArtWidth;
        			coverArt->stretchY = coverArtHeight;
				}else{
					coverArtFailed = 1;
				}
				cpuRestore();
			}
		}

		if (coverArt){
			skinGetPosition("POS_MEDIALIBRARY_COVERART", tempPos);
			oslDrawImageXY(coverArt, tempPos[0], tempPos[1]);
		}
		break;
	}
}
Beispiel #17
0
//called by mainwindow to update the layout data
void windowLayout::updateCity( WeatherInfo currentInfo )
{

    qDebug()<<"windowLayout::updateCity->start.." ;

    setFontStyle(currentInfo.mCurrent.isNight);

        QPalette p = palette();
        QPixmap img( ":/images/images/"+currentInfo.mCurrent.mBackground);

        QPixmap mask( ":/images/images/mask.png" );
        p.setBrush( QPalette::Window, QBrush(img) );
        setPalette( p );
        setMask( mask );

        iSkyPic.load( ":/images/images/"+currentInfo.mCurrent.mSkyPicture );


/*
setStyleSheet(
        "background-image:url(:/images/images/undocked_windy.png)"
        "border-bottom-width: 100px;"
        "border-right-width: 100px;"
              );
*/

//***************************************************
//*
//*                  真实数据
//*
//***************************************************

        qDebug()<<"===========================================" ;
    //current
    iCurrentTemperature->setText(QString::number(currentInfo.mCurrent.mTemp)+0xB0);
    iCurrentSkyCode->setText(currentInfo.mCurrent.mSkycode);
    QString tempstr;
    tempstr = QString::number(currentInfo.mOneDay[0].mTempL)+0xB0+"~" + QString::number(currentInfo.mOneDay[0].mTempH)+0xB0;
    iTodayTemperature->setText(tempstr);
    iLocation->setText(currentInfo.mCurrent.mLocationName);


    //current day's temp and pic--------------------
tempstr = QString::number(currentInfo.mOneDay[1].mTempL)+0xB0+"\n" + QString::number(currentInfo.mOneDay[1].mTempH)+0xB0;
    iFirstTemp->setText(tempstr);
    iFirstDay->setText(currentInfo.mOneDay[1].mDay);
    QPixmap firstPic(":/images/images/"+currentInfo.mOneDay[1].mSkyCode);
    iFirstPic->setPixmap(firstPic);
    //tmorrow---------------------------------------
tempstr = QString::number(currentInfo.mOneDay[2].mTempL)+0xB0+"\n" + QString::number(currentInfo.mOneDay[2].mTempH)+0xB0;
    iSecondTemp->setText(tempstr);
    iSecondDay->setText(currentInfo.mOneDay[2].mDay);
    QPixmap secondPic(":/images/images/"+currentInfo.mOneDay[2].mSkyCode);
    iSecondPic->setPixmap(secondPic);
    //third day-------------------------------------
tempstr = QString::number(currentInfo.mOneDay[3].mTempL)+0xB0+"\n" + QString::number(currentInfo.mOneDay[3].mTempH)+0xB0;
    iThirdTemp->setText(tempstr);
    iThirdDay->setText(currentInfo.mOneDay[3].mDay);
    QPixmap thirdPic(":/images/images/"+currentInfo.mOneDay[3].mSkyCode );
    iThirdPic->setPixmap(thirdPic);

        qDebug()<<"===========================================" ;


//***************************************************
//*
//*                  假数据测试
//*
//***************************************************
/*
         qDebug()<<"fake data used updated";
    iCurrentTemperature->setText("32°");
    iCurrentSkyCode->setText("thunder");
    iTodayTemperature->setText("33°~35°");
    //city
    iLocation->setText("heaven");
    iFirstDay->setText("?");

    iSecondDay->setText("?");

    iThirdDay->setText("?");

    //current day's temp and pic--------------------
    iFirstTemp->setText(QString::number(18)+"°~"+QString::number(20)+"°");
 qDebug()<<"18~20" ;
    QPixmap firstPic(":/images/images/35.png");

    iFirstPic->setPixmap(firstPic);
    //tmorrow---------------------------------------
    iSecondTemp->setText("11°~18°");
    QPixmap secondPic(":/images/images/23.png");
    iSecondPic->setPixmap(secondPic);
    //third day-------------------------------------
    iThirdTemp->setText("21°~33°");
    QPixmap thirdPic(":/images/images/3.png");
    iThirdPic->setPixmap(thirdPic);
*/

    qDebug()<<"windowLayout::updateCity->has been done" ;
}
Beispiel #18
0
void resetPreviousFontStyle() {
    setFontStyle(PREVIOUS_FONT_BGCOLOR,PREVIOUS_FONT_FGCOLOR,PREVIOUS_FONT_WEIGHT);
}
Beispiel #19
0
void resetDefaultFontSyle() {
    setFontStyle(DEFAULT_FONT_BGCOLOR,DEFAULT_FONT_FGCOLOR,DEFAULT_FONT_WEIGHT);
}