Palette usage improvements.

This commit is contained in:
John Preston 2016-10-31 15:29:26 +03:00
parent dbb6371e67
commit e08f5437a6
101 changed files with 1105 additions and 1045 deletions

View file

@ -32,33 +32,19 @@ emojiImgSize: 18px; // exceptional value for retina
emojiSize: 18px;
emojiPadding: 0px;
counterBg: #f23c34;
counterMuteBg: #888888;
counterFg: #ffffff;
counterMacInvFg: #ffffff01;
lineWidth: 1px;
transparent: #ffffff00;
white: #ffffff;
black: #000000;
wndMinWidth: 380px;
adaptiveNormalWidth: 640px;
adaptiveWideWidth: 1366px;
semiboldButtonBlueText: #2b99d5;
wndMinHeight: 480px;
wndDefWidth: 800px;
wndDefHeight: 600px;
wndShadow: icon {{ "window_shadow", windowShadowFg }};
wndShadowShift: 1px;
layerAlpha: 0.5;
layerBg: black;
labelDefFlat: flatLabel {
font: font(fsize);
width: 0px;
@ -98,7 +84,6 @@ defaultBoxButton: RoundButton {
downTextTop: 9px;
font: boxButtonFont;
duration: 200;
}
cancelBoxButton: RoundButton(defaultBoxButton) {
textFg: #aeaeae;
@ -150,7 +135,8 @@ attentionLeftOutlineButton: OutlineButton(defaultLeftOutlineButton) {
}
defaultInputArea: InputArea {
textFg: black;
textBg: windowBg;
textFg: windowTextFg;
textMargins: margins(5px, 6px, 5px, 4px);
placeholderFg: #999999;
@ -174,8 +160,8 @@ defaultInputArea: InputArea {
heightMax: 128px;
}
defaultInputField: InputField {
textBg: white;
textFg: black;
textBg: windowBg;
textFg: windowTextFg;
textMargins: margins(0px, 6px, 0px, 4px);
textAlign: align(topleft);
@ -199,12 +185,13 @@ defaultInputField: InputField {
height: 32px;
}
defaultCheckbox: Checkbox {
textFg: black;
textBg: white;
textFg: windowTextFg;
textBg: windowBg;
checkBg: #ffffff;
checkFg: #b3b3b3;
checkFgOver: #b3b3b3;
checkFgActive: #40ace3;
checkFgActive: windowActiveFill;
width: -44px;
height: 22px;
@ -223,9 +210,10 @@ defaultBoxCheckbox: Checkbox(defaultCheckbox) {
font: boxTextFont;
}
defaultRadiobutton: Radiobutton {
textFg: black;
textBg: white;
textFg: windowTextFg;
textBg: windowBg;
checkBg: #ffffff;
checkFg: #b3b3b3;
checkFgOver: #bfbfbf;
checkFgActive: #4eb3ee;
@ -281,7 +269,6 @@ defaultTooltip: Tooltip {
linesMax: 12;
}
almostTransparent: #ffffff0d;
boxScroll: flatScroll(solidScroll) {
round: 3px;
width: 18px;
@ -312,7 +299,7 @@ shadowToggleDuration: 200;
slideDuration: 240;
slideShift: 100px;
slideFadeOut: 0.3;
slideFadeOutBg: #0000003c;
slideShadow: icon {{ "slide_shadow", #000000 }};
slideFunction: transition(easeOutCirc);
@ -347,8 +334,6 @@ sysUnlock: sysButton(sysUpd) {
icon: icon {{ "title_button_unlock", titleBg }};
}
btnWhiteHover: #f5f5f5;
btnBoxWhiteHover: #fafafa;
btnYesColor: #0080c0;
btnYesHover: #0073ad;
btnNoColor: #8b8b8b;
@ -375,37 +360,6 @@ titleTextButton: flatButton {
cursor: cursor(default);
}
btnDefFlat: flatButton {
duration: 200;
cursor: cursor(pointer);
}
btnDefBig: flatButton(btnDefFlat) {
textTop: 11px;
overTextTop: 11px;
downTextTop: 12px;
font: font(23px);
overFont: font(23px);
height: 56px;
}
btnNextBG: #2fa9e2;
btnDefNext: flatButton(btnDefFlat) {
color: white;
overColor: white;
downColor: white;
bgColor: btnNextBG;
overBgColor: #279ad0;
downBgColor: #279ad0;
}
btnDefBack: flatButton(btnDefFlat) {
color: white;
overColor: white;
downColor: white;
bgColor: #c7c7c7;
overBgColor: #b9b9b9;
downBgColor: #b9b9b9;
}
linkCropLimit: 360px;
linkFont: normalFont;
linkOverFont: font(fsize underline);
@ -430,9 +384,9 @@ inpDefFlat: flatInput {
cursor: cursor(text);
borderWidth: 0px;
borderColor: black;
borderActive: black;
borderError: black;
borderColor: transparent;
borderActive: transparent;
borderError: transparent;
phColor: #949494;
phFocusColor: #aaaaaa;
@ -454,25 +408,6 @@ inpDefGray: flatInput(inpDefFlat) {
phColor: #808080;
}
taDefFlat: flatTextarea {
textColor: #000000;
bgColor: #ffffff;
align: align(left);
textMrg: margins(5px, 5px, 5px, 5px);
font: inpDefFont;
cursor: cursor(text);
phColor: #999999;
phFocusColor: #aaaaaa;
phAlign: align(topleft);
phPos: point(2px, 0px);
phShift: 50px;
phDuration: 100;
phLeftFunc: transition(linear);
phAlphaFunc: transition(linear);
phColorFunc: transition(linear);
}
scrollDef: flatScroll {
barColor: #00000053;
bgColor: #0000001a;
@ -505,83 +440,9 @@ scrollCountries: flatScroll(scrollDef) {
lnkText: #0f7dc7;
introBtnTop: 288px;
introSkip: 45px;
introFinishSkip: 15px;
introPhotoSize: 98px;
introHeaderFont: font(24px);
introHeaderSkip: 14px;
introIconSkip: 54px;
introFont: font(16px);
introLink: linkButton(btnDefLink) {
font: introFont;
overFont: font(16px underline);
}
introColor: black;
introLabel: flatLabel(labelDefFlat) {
font: introFont;
align: align(center);
}
introStepSize: size(400px, 200px);
introSize: size(400px, 400px);
introSlideShift: 500px; // intro hiding animation
introSlideDuration: 200;
introSlideDelta: 0; // between hide start and show start
introHideFunc: transition(easeInCirc);
introShowFunc: transition(easeOutCirc);
introAlphaHideFunc: transition(easeOutCirc);
introAlphaShowFunc: transition(easeInCirc);
introTextTop: 22px;
introTextSize: size(400px, 93px);
introCallSkip: 15px;
introPwdTextSize: size(400px, 73px);
btnIntroSep: 12px;
btnIntroNext: flatButton(btnDefNext, btnDefBig) {
textTop: 16px;
overTextTop: 16px;
downTextTop: 17px;
font: font(17px);
overFont: font(17px);
width: 300px;
radius: buttonRadius;
}
boxShadow: icon {{ "box_shadow", windowShadowFg }};
boxShadowShift: 2px;
introPhoneTop: 8px;
inpIntroCountryCode: flatInput(inpDefGray) {
width: 70px;
height: 41px;
align: align(center);
}
inpIntroPhone: flatInput(inpDefGray) {
textMrg: margins(12px, 5px, 12px, 6px);
width: 225px;
height: 41px;
}
inpIntroCode: flatInput(inpDefGray) {
textMrg: margins(12px, 5px, 12px, 6px);
width: 106px;
height: 41px;
align: align(center);
phPos: point(0px, 0px);
phAlign: align(center);
phShift: 0px;
}
inpIntroName: flatInput(inpIntroPhone) {
width: 192px;
}
inpIntroPassword: flatInput(inpIntroPhone) {
width: 300px;
}
introSelectDelta: 30px;
btnSelectSep: #e0e0e0;
btnRedLink: linkButton(btnDefLink) {
color: #d15948;
@ -591,34 +452,24 @@ btnRedLink: linkButton(btnDefLink) {
countryRowHeight: 36px;
countryRowNameFont: semiboldFont;
countryRowNameFg: boxTextFg;
countryRowPadding: margins(22px, 9px, 8px, 0px);
countryRowCodeFont: font(fsize);
countryRowBg: windowBg;
countryRowBgOver: windowOverBg;
countryRowCodeFg: #808080;
countryRowCodeFgOver: #7c99b2;
countryRowCodeFg: windowSubTextFg;
countryRowCodeFgOver: windowSubTextFgOver;
countriesSkip: 12px;
countriesScroll: flatScroll(boxScroll) {
deltat: 9px;
deltab: 3px;
}
introErrWidth: 450px;
introErrDuration: 200;
introErrFunc: transition(linear);
introErrColor: black;
introErrTop: 15px;
introErrHeight: 40px;
introErrFont: font(16px);
setLittleSkip: 9px;
setScroll: flatScroll(scrollDef) {
bottomsh: 0px;
topsh: 0px;
}
setPhotoDuration: 150;
setErrColor: #d84d4d;
setGoodColor: #4ab44a;
noContactsHeight: 100px;
noContactsFont: font(fsize);
@ -638,7 +489,6 @@ dlgFilter: flatInput(inpDefGray) {
}
topBarHeight: 54px;
topBarBG: white;
topBarDuration: 200;
topBarForward: icon {{ "title_next", #a3a3a3 }};
topBarBackward: icon {{ "title_previous", #a3a3a3 }};
@ -650,10 +500,10 @@ topBarBackFont: font(16px);
topBarArrowPadding: margins(39px, 8px, 17px, 8px);
topBarMinPadding: 5px;
topBarButton: RoundButton {
textFg: #0084c4;
textFgOver: #0084c4;
secondaryTextFg: #0084c4;
secondaryTextFgOver: #0084c4;
textFg: btnYesColor;
textFgOver: btnYesColor;
secondaryTextFg: btnYesColor;
secondaryTextFgOver: btnYesColor;
textBg: windowBg;
textBgOver: #edf4f7;
@ -665,15 +515,14 @@ topBarButton: RoundButton {
downTextTop: 7px;
font: font(fsize);
duration: 200;
}
defaultActiveButton: RoundButton {
textFg: #ffffff;
textFgOver: #ffffff;
secondaryTextFg: #cceeff;
secondaryTextFgOver: #cceeff;
textBg: windowActiveFill;
textBgOver: #46b4eb;
textFg: activeButtonFg;
textFgOver: activeButtonFgOver;
secondaryTextFg: activeButtonSecondaryFg;
secondaryTextFgOver: activeButtonSecondaryFgOver;
textBg: activeButtonBg;
textBgOver: activeButtonBgOver;
secondarySkip: 7px;
@ -685,14 +534,14 @@ defaultActiveButton: RoundButton {
downTextTop: 9px;
font: semiboldFont;
duration: 200;
}
topBarClearButton: RoundButton(defaultActiveButton) {
textFg: semiboldButtonBlueText;
textFgOver: semiboldButtonBlueText;
textBg: #ffffff;
textBgOver: #f2f7fa;
defaultLightButton: RoundButton(defaultActiveButton) {
textFg: lightButtonFg;
textFgOver: lightButtonFgOver;
textBg: lightButtonBg;
textBgOver: lightButtonBgOver;
}
topBarClearButton: RoundButton(defaultLightButton) {
width: -18px;
}
topBarActionSkip: 10px;
@ -741,10 +590,11 @@ msgReplyBarSize: size(2px, 36px);
msgReplyBarSkip: 10px;
msgInReplyBarColor: #2fa9e2;
msgInReplyBarSelColor: #2fa9e2;
msgImgReplyBarColor: #ffffff;
msgBotKbDuration: 200;
msgBotKbFont: semiboldFont;
msgBotKbOverOpacity: 0.1;
msgBotKbOverBg: #fffffffc;
msgBotKbIconPadding: 2px;
msgBotKbUrlIcon: icon {{ "inline_button_url", #ffffff }};
msgBotKbSwitchPmIcon: icon {{ "inline_button_switch", #ffffff }};
@ -780,24 +630,6 @@ msgDateImgBgSelected: #1c4a7187;
msgDateImgPadding: point(8px, 2px);
msgDateImgCheckSpace: 4px;
collapseButton: flatButton(btnDefFlat) {
font: msgServiceFont;
overFont: msgServiceFont;
width: -24px;
bgColor: transparent;
downBgColor: transparent;
overBgColor: transparent;
color: white;
overColor: white;
downColor: white;
textTop: 3px;
overTextTop: 3px;
downTextTop: 3px;
height: 25px;
}
collapseHideDuration: 200;
collapseShowDuration: 200;
defaultTextStyle: textStyle {
linkFlags: font(fsize);
linkFlagsOver: font(fsize underline);
@ -853,13 +685,6 @@ medviewSaveAsTextStyle: textStyle(defaultTextStyle) {
linkFgDown: #91d9ff;
}
introLabelTextStyle: textStyle(defaultTextStyle) {
lineHeight: 30px;
}
introErrLabelTextStyle: textStyle(defaultTextStyle) {
lineHeight: 27px;
}
mediaPadding: margins(0px, 0px, 0px, 0px);//1px, 1px, 1px, 1px);//2px, 2px, 2px, 2px);
mediaCaptionSkip: 5px;
mediaInBubbleSkip: 5px;
@ -912,8 +737,8 @@ msgFileThumbPadding: margins(10px, 10px, 14px, 10px);
msgFileThumbNameTop: 12px;
msgFileThumbStatusTop: 32px;
msgFileThumbLinkTop: 60px;
msgFileThumbLinkInFg: semiboldButtonBlueText;
msgFileThumbLinkInFgSelected: semiboldButtonBlueText;
msgFileThumbLinkInFg: lightButtonFg;
msgFileThumbLinkInFgSelected: lightButtonFgOver;
msgFileThumbLinkOutFg: #5eba5b;
msgFileThumbLinkOutFgSelected: #31a298;
msgFileNameTop: 16px;
@ -945,14 +770,17 @@ msgWaveformOutInactive: #b3e2b4;
msgWaveformOutInactiveSelected: #91c3c3;
sendPadding: 9px;
btnSend: flatButton(btnDefFlat) {
btnSend: flatButton {
duration: 200;
cursor: cursor(pointer);
color: btnYesColor;
overColor: btnYesHover;
downColor: btnYesHover;
bgColor: white;
overBgColor: btnWhiteHover;
downBgColor: btnWhiteHover;
bgColor: historySendBg;
overBgColor: historySendBgOver;
downBgColor: historySendBgOver;
width: -32px;
height: 46px;
@ -987,13 +815,11 @@ historyScroll: flatScroll(scrollDef) {
bottomsh: -1px;
}
textRectMargins: margins(-2px, -1px, -2px, -1px);
taMsgField: flatTextarea(taDefFlat) {
font: msgFont;
}
maxFieldHeight: 224px;
// historyMinHeight: 56px;
reportSpamHide: flatButton(btnDefFlat) {
reportSpamHide: flatButton {
duration: 200;
cursor: cursor(pointer);
color: btnYesColor;
overColor: btnYesHover;
downColor: btnYesHover;
@ -1026,6 +852,7 @@ reportSpamButton: flatButton(reportSpamHide) {
}
reportSpamSeparator: 30px;
reportSpamBg: #fffffff0;
reportSpamFg: #000000;
newMsgSound: ":/gui/art/newmsg.wav";
@ -1059,7 +886,6 @@ contactsStatusFont: font(fsize);
contactsStatusFg: #999999;
contactsStatusFgOver: #7c99b2;
contactsStatusFgOnline: #3b8dcc;
contactsBgOver: windowOverBg;
contactsCheckPosition: point(8px, 16px);
contactsAboutBg: #f7f7f7;
contactsAboutShadow: #0000001F;
@ -1101,32 +927,7 @@ membersPadding: margins(0px, 10px, 0px, 10px);
forwardMargins: margins(30px, 10px, 30px, 10px);
forwardFont: font(16px);
forwardBg: #0000004c;
newGroupAboutFg: #808080;
newGroupPadding: margins(4px, 6px, 4px, 3px);
newGroupSkip: 17px;
newGroupInfoPadding: margins(0px, -4px, 0px, 1px);
newGroupLinkPadding: margins(4px, 27px, 4px, 12px);
newGroupLinkTop: 3px;
newGroupLinkFont: font(16px);
newGroupPhotoSize: 76px;
newGroupPhotoBg: #4eb5f0;
newGroupPhotoBgOver: #3fa9e7;
newGroupPhotoIcon: icon {{ "new_chat_photo", #ffffff }};
newGroupPhotoIconPosition: point(23px, 25px);
newGroupNamePosition: point(27px, 20px);
newGroupDescriptionPadding: margins(0px, 23px, 0px, 14px);
newGroupDescription: InputArea(defaultInputArea) {
textMargins: margins(1px, 6px, 1px, 4px);
heightMax: 115px;
}
newGroupPublicLinkPadding: margins(0px, 20px, 0px, 5px);
newGroupLinkFadeDuration: 5000;
forwardFg: #ffffff;
connectionHostInputField: InputField(defaultInputField) {
width: 160px;
@ -1171,6 +972,7 @@ connectingBG: #ffffffee;
connectingColor: #777777;
connectingPadding: margins(5px, 5px, 5px, 5px);
dragBg: #ffffff;
dragFont: font(28px semibold);
dragSubfont: font(20px semibold);
dragColor: #777777;
@ -1181,13 +983,6 @@ dragPadding: margins(20px, 10px, 20px, 10px);
dragHeight: 72px;
dpiActive: black;
dpiInactive: #999999;
dpiFont1: linkFont;
dpiFont2: linkFont;
dpiFont3: linkFont;
dpiFont4: linkFont;
botKbDuration: 200;
botKbBg: #edf1f5;
botKbOverBg: #d8e2ec;
@ -1225,8 +1020,6 @@ maxStickerSize: 256px;
maxGifSize: 320px;
maxSignatureSize: 144px;
mvBgColor: #222222;
mvBgOpacity: 0.92;
mvThickFont: semiboldFont;
mvFont: font(fsize);
@ -1234,13 +1027,13 @@ mvTextLeft: 16px;
mvTextSkip: 10px;
mvHeaderTop: 48px;
mvTextTop: 24px;
mvTextColor: white;
mvTextColor: #ffffff;
mvTextOpacity: 0.5;
mvTextOverOpacity: 1;
mvIconOpacity: 0.45;
mvIconOverOpacity: 1;
mvControlBgColor: black;
mvControlFg: #ffffff;
mvControlBgOpacity: 0.3;
mvControlMargin: 0px;
mvControlSize: 90px;
@ -1251,33 +1044,13 @@ mvHideDuration: 1000;
mvShowDuration: 200;
mvFadeDuration: 150;
mvDocPadding: 18px;
mvDocSize: size(340px, 116px);
mvDocBg: white;
mvDocNameTop: 4px;
mvDocNameFont: font(semibold 14px);
mvDocNameColor: black;
mvDocSizeTop: 29px;
mvDocSizeColor: #808080;
mvDocExtTop: 35px;
mvDocExtFont: font(semibold 18px);
mvDocExtColor: white;
mvDocExtPadding: 10px;
mvDocLinksTop: 57px;
mvDocIconSize: 80px;
mvDocLink: linkButton(btnDefLink) {
color: #4595d3;
overColor: #4595d3;
downColor: #4595d3;
}
mvDeltaFromLastAction: 5px;
mvSwipeDistance: 80px;
mvCaptionPadding: margins(18px, 10px, 18px, 10px);
mvCaptionMargin: size(11px, 11px);
mvCaptionRadius: 2px;
mvCaptionFg: #ffffff;
mvCaptionBg: #11111180;
mvCaptionFont: font(fsize);
@ -1288,6 +1061,7 @@ medviewSaveMsgCheckPos: point(23px, 21px);
medviewSaveMsgShowing: 200;
medviewSaveMsgShown: 2000;
medviewSaveMsgHiding: 2500;
medviewSaveMsgFg: #ffffff;
medviewSaveMsg: #000000b2;
// Mac specific
@ -1305,7 +1079,8 @@ radialSize: size(50px, 50px);
radialLine: 3px;
radialDuration: 350;
radialPeriod: 3000;
radialBgOpacity: 0.4;
radialFg: #ffffff;
radialBg: #00000056;
downloadPathSkip: 10px;
@ -1343,22 +1118,6 @@ backgroundScroll: flatScroll(boxScroll) {
deltab: 0px;
}
passcodeHeaderFont: font(19px);
passcodeHeaderHeight: 80px;
passcodeInput: flatInput(inpIntroPhone) {
}
passcodeSubmit: flatButton(btnIntroNext) {
textTop: 15px;
overTextTop: 15px;
downTextTop: 16px;
width: 225px;
font: font(19px);
overFont: font(19px);
}
passcodeSubmitSkip: 40px;
passcodePadding: margins(0px, 22px, 0px, 3px);
passcodeSkip: 31px;
mentionHeight: 40px;
mentionScroll: flatScroll(scrollDef) {
topsh: 0px;
@ -1367,7 +1126,9 @@ mentionScroll: flatScroll(scrollDef) {
mentionPadding: margins(8px, 5px, 8px, 5px);
mentionTop: 11px;
mentionFont: linkFont;
mentionNameFg: windowTextFg;
mentionPhotoSize: msgPhotoSize;
mentionBg: #ffffff;
mentionBgOver: #f5f5f5;
mentionFg: #777777;
mentionFgOver: #707070;
@ -1377,6 +1138,10 @@ mentionFgOverActive: #0077b3;
webPageLeft: 10px;
webPageBar: 2px;
webPageTitleFont: semiboldFont;
webPageTitleOutFg: historyTextOutFg;
webPageTitleInFg: historyTextInFg;
webPageDescriptionOutFg: historyTextOutFg;
webPageDescriptionInFg: historyTextInFg;
webPageDescriptionFont: normalFont;
webPagePhotoSize: 100px;
webPagePhotoDelta: 8px;
@ -1393,6 +1158,7 @@ inlineResultsSkip: 3px;
inlineMediaHeight: 96px;
inlineThumbSize: 64px;
inlineThumbSkip: 10px;
inlineTitleFg: windowTextFg;
inlineDescriptionFg: windowSubTextFg;
inlineRowMargin: 6px;
inlineRowBorder: 1px;
@ -1425,12 +1191,13 @@ infoButton: PeerAvatarButton {
profileTopBarBackIconFg: #0290d7;
profileTopBarBackIcon: icon {{ "title_previous", profileTopBarBackIconFg }};
boxCancelIcon: icon {{ "box_cancel", #000000 }};
historyReplyCancelIcon: icon {{ "box_cancel", #adadad }};
historyReplyCancelIcon: icon {{ "box_button_close", historyReplyBg }};
boxSearchCancelIcon: icon {{ "box_button_close", boxSearchBg }};
settingsFixedBarCloseIcon: icon {{ "box_button_close", settingsFixedBarBg }};
notifyBg: white;
notifyFadeRight: icon {{ "fade_horizontal_right", notifyBg }};
notifyFadeRight: icon {{ "fade_horizontal_right", notificationBg }};
emojiPanBg: #ffffff;
emojiPanCategories: #f7f7f7;
stickerIconLeft: icon {{ "fade_horizontal_left", emojiPanCategories }};
stickerIconRight: icon {{ "fade_horizontal_right", emojiPanCategories }};

View file

@ -192,13 +192,13 @@ RoundButton {
icon: icon;
font: font;
duration: int;
}
Checkbox {
textFg: color;
textBg: color;
checkBg: color;
checkFg: color;
checkFgOver: color;
checkFgActive: color;
@ -219,6 +219,7 @@ Radiobutton {
textFg: color;
textBg: color;
checkBg: color;
checkFg: color;
checkFgOver: color;
checkFgActive: color;
@ -236,6 +237,7 @@ Radiobutton {
}
InputArea {
textBg: color;
textFg: color;
textMargins: margins;

View file

@ -19,6 +19,7 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
// basic
windowBg: #ffffff; // white: fallback for background
windowTextFg: #000000; // black: fallback for text color
windowSubTextFg: #8a8a8a; // gray: fallback for subtext color
@ -28,5 +29,111 @@ windowSubTextFgOver: #7c99b2; // gray over light blue: fallback for subtext over
windowActiveTextFg: #1485c2; // online blue: fallback for active color
windowShadowFg: #000000; // black: fallback for shadow color
imageBg: #000000;
imageBgTransparent: #ffffff;
// tray icon
trayCounterBg: #f23c34;
trayCounterBgMute: #888888;
trayCounterFg: #ffffff;
trayCounterBgMacInvert: #ffffff;
trayCounterFgMacInvert: #ffffff01;
cancelIconFg: #a2a2a2;
cancelIconFgOver: #808080;
activeButtonBg: windowActiveFill;
activeButtonBgOver: #46b4eb | activeButtonBg;
activeButtonFg: #ffffff;
activeButtonFgOver: activeButtonFg;
activeButtonSecondaryFg: #cceeff;
activeButtonSecondaryFgOver: activeButtonSecondaryFg;
lightButtonBg: windowBg;
lightButtonBgOver: #f2f7fa | lightButtonBg;
lightButtonFg: #2b99d5;
lightButtonFgOver: lightButtonFg;
// window title
titleCounterBg: trayCounterBg;
titleCounterBgMute: trayCounterBgMute;
titleCounterFg: trayCounterFg;
// layers
layerBg: #0000007f;
// boxes
boxBg: windowBg;
boxTitleFg: #444444 | windowTextFg;
boxTextFg: windowTextFg;
boxTextFgGood: #4ab44a;
boxTextFgError: #d84d4d;
boxTitleFg: #404040 | windowTextFg;
boxSearchBg: boxBg;
boxSearchCancelIconFg: cancelIconFg;
boxSearchCancelIconFgOver: cancelIconFgOver;
membersAboutLimitFg: windowSubTextFg;
contactsBg: windowBg;
contactsBgOver: windowOverBg;
contactsNameFg: boxTextFg;
photoCropFadeBg: #0000007f;
photoCropPointFg: #ffffff7f;
// settings
settingsBg: windowBg;
settingsFixedBarBg: settingsBg;
settingsCloseFg: cancelIconFg;
settingsCloseFgOver: cancelIconFgOver;
notificationsBoxMonitorFg: windowTextFg;
notificationSampleUserpicFg: windowActiveFill;
notificationSampleCloseFg: #d7d7d7 | windowSubTextFg;
notificationSampleTextFg: #d7d7d7 | windowSubTextFg;
notificationSampleNameFg: #939393 | windowSubTextFg;
// intro
introHeaderFg: windowTextFg;
introErrorFg: windowTextFg;
// history
topBarBg: windowBg;
historyComposeAreaBg: windowBg;
historyPinnedBg: historyComposeAreaBg;
historyReplyBg: historyComposeAreaBg;
historyReplyCancelIconFg: cancelIconFg;
historyReplyCancelIconFgOver: cancelIconFgOver;
historySendBg: historyComposeAreaBg;
historySendBgOver: #f5f5f5 | historySendBg;
historyTextInFg: windowTextFg;
historyTextOutFg: windowTextFg;
historyCaptionInFg: historyTextInFg;
historyCaptionOutFg: historyTextOutFg;
historyFileNameInFg: historyTextInFg;
historyFileNameOutFg: historyTextOutFg;
// mediaview
mediaviewFileBg: windowBg;
mediaviewFileNameFg: windowTextFg;
mediaviewFileSizeFg: windowSubTextFg;
mediaviewFileRedCornerFg: #d55959;
mediaviewFileYellowCornerFg: #e8a659;
mediaviewFileGreenCornerFg: #49a957;
mediaviewFileBlueCornerFg: #599dcf;
mediaviewFileExtFg: activeButtonFg;
mediaviewMenuBg: #383838;
mediaviewMenuBgOver: #505050;
mediaviewMenuFg: #ffffff;
mediaviewBg: #222222eb;
mediaviewVideoBg: #000000;
mediaviewControlBg: #0000003c;
// notification
notificationBg: windowBg;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

View file

@ -774,6 +774,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_dialogs_text_from_wrapped" = "{from}:";
"lng_dialogs_text_media" = "{media_part} {caption}";
"lng_dialogs_text_media_wrapped" = "{media},";
"lng_dialogs_show_all_chats" = "Show all chats";
"lng_dialogs_hide_muted_chats" = "Hide muted chats";
"lng_open_this_link" = "Open this link?";
"lng_open_link" = "Open";

View file

@ -29,5 +29,80 @@ windowOverBg: #edf2f5;
windowSubTextFgOver: #7c99b2;
windowActiveTextFg: #1485c2;
windowShadowFg: #000000;
boxBg: #ffffff;
boxTitleFg: #444444; // windowTextFg;
imageBg: #000000;
imageBgTransparent: #ffffff;
trayCounterBg: #f23c34;
trayCounterBgMute: #888888;
trayCounterFg: #ffffff;
trayCounterBgMacInvert: #ffffff;
trayCounterFgMacInvert: #ffffff01;
cancelIconFg: #a2a2a2;
cancelIconFgOver: #808080;
activeButtonBg: windowActiveFill;
activeButtonBgOver: #46b4eb; // activeButtonBg;
activeButtonFg: #ffffff;
activeButtonFgOver: activeButtonFg;
activeButtonSecondaryFg: #cceeff;
activeButtonSecondaryFgOver: activeButtonSecondaryFg;
lightButtonBg: windowBg;
lightButtonBgOver: #f2f7fa; // lightButtonBg;
lightButtonFg: #2b99d5;
lightButtonFgOver: lightButtonFg;
titleCounterBg: trayCounterBg;
titleCounterBgMute: trayCounterBgMute;
titleCounterFg: trayCounterFg;
layerBg: #0000007f;
boxBg: windowBg;
boxTextFg: windowTextFg;
boxTextFgGood: #4ab44a;
boxTextFgError: #d84d4d;
boxTitleFg: #404040; // windowTextFg;
boxSearchBg: boxBg;
boxSearchCancelIconFg: cancelIconFg;
boxSearchCancelIconFgOver: cancelIconFgOver;
membersAboutLimitFg: windowSubTextFg;
contactsBg: windowBg;
contactsBgOver: windowOverBg;
contactsNameFg: boxTextFg;
photoCropFadeBg: #0000007f;
photoCropPointFg: #ffffff7f;
settingsBg: windowBg;
settingsFixedBarBg: settingsBg;
settingsCloseFg: cancelIconFg;
settingsCloseFgOver: cancelIconFgOver;
notificationsBoxMonitorFg: windowTextFg;
notificationSampleUserpicFg: windowActiveFill;
notificationSampleCloseFg: #d7d7d7; // windowSubTextFg;
notificationSampleTextFg: #d7d7d7; // windowSubTextFg;
notificationSampleNameFg: #939393; // windowSubTextFg;
introHeaderFg: windowTextFg;
introErrorFg: windowTextFg;
topBarBg: windowBg;
historyComposeAreaBg: windowBg;
historyPinnedBg: historyComposeAreaBg;
historyReplyBg: historyComposeAreaBg;
historyReplyCancelIconFg: cancelIconFg;
historyReplyCancelIconFgOver: cancelIconFgOver;
historySendBg: historyComposeAreaBg;
historySendBgOver: #f5f5f5; // historySendBg;
historyTextInFg: windowTextFg;
historyTextOutFg: windowTextFg;
historyCaptionInFg: historyTextInFg;
historyCaptionOutFg: historyTextOutFg;
historyFileNameInFg: historyTextInFg;
historyFileNameOutFg: historyTextOutFg;
mediaviewFileBg: windowBg;
mediaviewFileNameFg: windowTextFg;
mediaviewFileSizeFg: windowSubTextFg;
mediaviewFileRedCornerFg: #d55959;
mediaviewFileYellowCornerFg: #e8a659;
mediaviewFileGreenCornerFg: #49a957;
mediaviewFileBlueCornerFg: #599dcf;
mediaviewFileExtFg: activeButtonFg;
mediaviewMenuBg: #383838;
mediaviewMenuBgOver: #505050;
mediaviewMenuFg: #ffffff;
mediaviewBg: #222222eb;
mediaviewVideoBg: #000000;
mediaviewControlBg: #0000003c;
notificationBg: windowBg;

View file

@ -2171,7 +2171,7 @@ namespace {
{
QPainter p(&rect);
p.setCompositionMode(QPainter::CompositionMode_Source);
p.fillRect(QRect(0, 0, rect.width(), rect.height()), st::transparent->b);
p.fillRect(QRect(0, 0, rect.width(), rect.height()), Qt::transparent);
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.setPen(Qt::NoPen);
@ -2231,18 +2231,19 @@ namespace {
if (cRetina()) ::emojiLarge->setDevicePixelRatio(cRetinaFactor());
}
style::color white = { 255, 255, 255, 255 };
QImage mask[4];
prepareCorners(LargeMaskCorners, msgRadius(), st::white, nullptr, mask);
prepareCorners(LargeMaskCorners, msgRadius(), white, nullptr, mask);
for (int i = 0; i < 4; ++i) {
::cornersMaskLarge[i] = new QImage(mask[i].convertToFormat(QImage::Format_ARGB32_Premultiplied));
::cornersMaskLarge[i]->setDevicePixelRatio(cRetinaFactor());
}
prepareCorners(SmallMaskCorners, st::buttonRadius, st::white, nullptr, mask);
prepareCorners(SmallMaskCorners, st::buttonRadius, white, nullptr, mask);
for (int i = 0; i < 4; ++i) {
::cornersMaskSmall[i] = new QImage(mask[i].convertToFormat(QImage::Format_ARGB32_Premultiplied));
::cornersMaskSmall[i]->setDevicePixelRatio(cRetinaFactor());
}
prepareCorners(WhiteCorners, st::dateRadius, st::white);
prepareCorners(BotKbOverCorners, st::dateRadius, st::msgBotKbOverBg);
prepareCorners(StickerCorners, st::dateRadius, st::msgServiceBg);
prepareCorners(StickerSelectedCorners, st::dateRadius, st::msgServiceSelectBg);
prepareCorners(SelectedOverlaySmallCorners, st::buttonRadius, st::msgSelectOverlay);
@ -2379,7 +2380,7 @@ namespace {
}
const QPixmap &emojiSingle(EmojiPtr emoji, int32 fontHeight) {
EmojiMap *map = &(fontHeight == st::taDefFlat.font->height ? mainEmojiMap : otherEmojiMap[fontHeight]);
EmojiMap *map = &(fontHeight == st::msgFont->height ? mainEmojiMap : otherEmojiMap[fontHeight]);
EmojiMap::const_iterator i = map->constFind(emojiKey(emoji));
if (i == map->cend()) {
QImage img(ESize + st::emojiPadding * cIntRetinaFactor() * 2, fontHeight * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
@ -2519,7 +2520,7 @@ namespace {
#endif // OS_MAC_OLD
} else if (opaque && result.hasAlphaChannel()) {
QImage solid(result.width(), result.height(), QImage::Format_ARGB32_Premultiplied);
solid.fill(st::white->c);
solid.fill(st::imageBgTransparent->c);
{
QPainter(&solid).drawImage(0, 0, result);
}

View file

@ -19,11 +19,11 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
#include "lang.h"
#include "boxes/abstractbox.h"
#include "localstorage.h"
#include "abstractbox.h"
#include "lang.h"
#include "ui/buttons/icon_button.h"
#include "mainwidget.h"
#include "mainwindow.h"
#include "styles/style_boxes.h"
@ -35,45 +35,6 @@ void BlueTitleShadow::paintEvent(QPaintEvent *e) {
st::boxBlueTitleShadow.fill(p, QRect(r.left(), 0, r.width(), height()));
}
BlueTitleClose::BlueTitleClose(QWidget *parent) : Button(parent)
, a_iconFg(st::boxBlueCloseFg->c)
, _a_over(animation(this, &BlueTitleClose::step_over)) {
resize(st::boxTitleHeight, st::boxTitleHeight);
setCursor(style::cur_pointer);
connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));
}
void BlueTitleClose::onStateChange(int oldState, ButtonStateChangeSource source) {
if ((oldState & StateOver) != (_state & StateOver)) {
a_iconFg.start(((_state & StateOver) ? st::boxBlueCloseOverFg : st::boxBlueCloseFg)->c);
_a_over.start();
}
}
void BlueTitleClose::step_over(float64 ms, bool timer) {
float64 dt = ms / st::boxBlueCloseDuration;
if (dt >= 1) {
_a_over.stop();
a_iconFg.finish();
} else {
a_iconFg.update(dt, anim::linear);
}
if (timer) update((st::boxTitleHeight - st::boxBlueCloseIcon.width()) / 2, (st::boxTitleHeight - st::boxBlueCloseIcon.height()) / 2, st::boxBlueCloseIcon.width(), st::boxBlueCloseIcon.height());
}
void BlueTitleClose::paintEvent(QPaintEvent *e) {
Painter p(this);
QRect r(e->rect()), s((st::boxTitleHeight - st::boxBlueCloseIcon.width()) / 2, (st::boxTitleHeight - st::boxBlueCloseIcon.height()) / 2, st::boxBlueCloseIcon.width(), st::boxBlueCloseIcon.height());
if (!s.contains(r)) {
p.fillRect(r, st::boxBlueTitleBg);
}
if (s.intersects(r)) {
p.fillRect(s.intersected(r), a_iconFg.current());
st::boxBlueCloseIcon.paint(p, s.topLeft(), width());
}
}
AbstractBox::AbstractBox(int w) : LayerWidget() {
setAttribute(Qt::WA_OpaquePaintEvent);
resize(w, 0);
@ -116,8 +77,8 @@ bool AbstractBox::paint(QPainter &p) {
void AbstractBox::paintTitle(Painter &p, const QString &title, const QString &additional) {
p.setFont(st::boxTitleFont);
if (_blueTitle) {
p.fillRect(0, 0, width(), st::boxTitleHeight, st::boxBlueTitleBg->b);
p.setPen(st::white);
p.fillRect(0, 0, width(), st::boxTitleHeight, st::boxBlueTitleBg);
p.setPen(st::boxBlueTitleFg);
int32 titleWidth = st::boxTitleFont->width(title);
p.drawTextLeft(st::boxBlueTitlePosition.x(), st::boxBlueTitlePosition.y(), width(), title, titleWidth);
@ -175,12 +136,9 @@ void AbstractBox::onClose() {
void AbstractBox::setBlueTitle(bool blue) {
_blueTitle = blue;
delete _blueShadow;
_blueShadow = new BlueTitleShadow(this);
delete _blueClose;
_blueClose = new BlueTitleClose(this);
_blueClose->setAttribute(Qt::WA_OpaquePaintEvent);
connect(_blueClose, SIGNAL(clicked()), this, SLOT(onClose()));
_blueShadow.create(this);
_blueClose.create(this, st::boxBlueClose);
_blueClose->setClickedCallback([this] { onClose(); });
}
void AbstractBox::raiseShadow() {

View file

@ -23,6 +23,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "layerwidget.h"
#include "ui/widgets/shadow.h"
namespace Ui {
class MaskButton;
} // namespace Ui
class BlueTitleShadow : public TWidget {
public:
BlueTitleShadow(QWidget *parent) : TWidget(parent) {
@ -30,24 +34,6 @@ public:
void paintEvent(QPaintEvent *e);
};
class BlueTitleClose : public Button {
Q_OBJECT
public:
BlueTitleClose(QWidget *parent);
void paintEvent(QPaintEvent *e);
public slots:
void onStateChange(int oldState, ButtonStateChangeSource source);
private:
void step_over(float64 ms, bool timer);
anim::cvalue a_iconFg;
Animation _a_over;
};
class AbstractBox : public LayerWidget, protected base::Subscriber {
Q_OBJECT
@ -78,8 +64,6 @@ protected:
virtual void closePressed() {
}
virtual void showAll() {
if (_blueClose) _blueClose->show();
if (_blueShadow) _blueShadow->show();
}
private:
@ -89,8 +73,8 @@ private:
bool _closed = false;
bool _blueTitle = false;
BlueTitleClose *_blueClose = nullptr;
BlueTitleShadow *_blueShadow = nullptr;
ChildWidget<Ui::MaskButton> _blueClose = { nullptr };
ChildWidget<BlueTitleShadow> _blueShadow = { nullptr };
};

View file

@ -113,8 +113,8 @@ void AddContactBox::paintEvent(QPaintEvent *e) {
st::contactUserIcon.paint(p, st::boxPadding.left(), _first->y() + st::contactIconTop, width());
st::contactPhoneIcon.paint(p, st::boxPadding.left(), _phone->y() + st::contactIconTop, width());
} else {
p.setPen(st::black->p);
p.setFont(st::boxTextFont->f);
p.setPen(st::boxTextFg);
p.setFont(st::boxTextFont);
int32 h = height() - st::boxTitleHeight - st::contactPadding.top() - st::contactPadding.bottom() - st::boxPadding.bottom() - st::boxButtonPadding.top() - _retry->height() - st::boxButtonPadding.bottom();
p.drawText(QRect(st::boxPadding.left(), st::boxTitleHeight + st::contactPadding.top(), width() - st::boxPadding.left() - st::boxPadding.right(), h), lng_contact_not_joined(lt_name, _sentName), style::al_topleft);
}
@ -442,7 +442,7 @@ void GroupInfoBox::leaveEvent(QEvent *e) {
}
void GroupInfoBox::step_photoOver(float64 ms, bool timer) {
float64 dt = ms / st::setPhotoDuration;
float64 dt = ms / st::newGroupPhotoDuration;
if (dt >= 1) {
_a_photoOver.stop();
a_photoOver.finish();
@ -675,7 +675,7 @@ void SetupChannelBox::paintEvent(QPaintEvent *e) {
_aboutPrivate.drawLeft(p, aboutPrivate.x(), aboutPrivate.y(), aboutPrivate.width(), width());
if (!_channel->isMegagroup() || !_link->isHidden()) {
p.setPen(st::black);
p.setPen(st::boxTextFg);
p.setFont(st::newGroupLinkFont);
p.drawTextLeft(st::boxPadding.left() + st::newGroupPadding.left() + st::defaultInputField.textMargins.left(), _link->y() - st::newGroupLinkPadding.top() + st::newGroupLinkTop, width(), lang(_link->isHidden() ? lng_create_group_invite_link : lng_create_group_link));
}
@ -689,7 +689,7 @@ void SetupChannelBox::paintEvent(QPaintEvent *e) {
p.drawText(_invitationLink, _channel->inviteLink(), option);
if (!_goodTextLink.isEmpty() && a_goodOpacity.current() > 0) {
p.setOpacity(a_goodOpacity.current());
p.setPen(st::setGoodColor);
p.setPen(st::boxTextFgGood);
p.setFont(st::boxTextFont);
p.drawTextRight(st::boxPadding.right(), _link->y() - st::newGroupLinkPadding.top() + st::newGroupLinkTop + st::newGroupLinkFont->ascent - st::boxTextFont->ascent, width(), _goodTextLink);
p.setOpacity(1);
@ -697,11 +697,11 @@ void SetupChannelBox::paintEvent(QPaintEvent *e) {
}
} else {
if (!_errorText.isEmpty()) {
p.setPen(st::setErrColor);
p.setPen(st::boxTextFgError);
p.setFont(st::boxTextFont);
p.drawTextRight(st::boxPadding.right(), _link->y() - st::newGroupLinkPadding.top() + st::newGroupLinkTop + st::newGroupLinkFont->ascent - st::boxTextFont->ascent, width(), _errorText);
} else if (!_goodText.isEmpty()) {
p.setPen(st::setGoodColor);
p.setPen(st::boxTextFgGood);
p.setFont(st::boxTextFont);
p.drawTextRight(st::boxPadding.right(), _link->y() - st::newGroupLinkPadding.top() + st::newGroupLinkTop + st::newGroupLinkFont->ascent - st::boxTextFont->ascent, width(), _goodText);
}
@ -1454,7 +1454,7 @@ void RevokePublicLinkBox::paintChat(Painter &p, const ChatRow &row, bool selecte
auto peer = row.peer;
peer->paintUserpicLeft(p, st::contactsPhotoSize, st::contactsPadding.left(), st::contactsPadding.top(), width());
p.setPen(st::black);
p.setPen(st::contactsNameFg);
int32 namex = st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left();
int32 namew = width() - namex - st::contactsPadding.right() - (_revokeWidth + st::contactsCheckPosition.x() * 2);

View file

@ -20,16 +20,25 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
using "basic.style";
using "ui/widgets/widgets.style";
using "intro/intro.style";
boxBlueTitleBg: #6393b5;
boxBlueTitleFg: #ffffff;
boxBlueTitleAdditionalFg: #dae9f5;
boxBlueTitleAdditionalSkip: 12px;
boxBlueTitlePosition: point(23px, 18px);
boxBlueTitleShadow: icon {{ "box_title_shadow", windowShadowFg }};
boxBlueCloseFg: #c8e1f0;
boxBlueCloseOverFg: #ffffff;
boxBlueCloseIcon: icon {{ "box_button_close", boxBlueTitleBg }};
boxBlueCloseDuration: 150;
boxBlueClose: MaskButton(defaultMaskButton) {
width: boxTitleHeight;
height: boxTitleHeight;
bg: boxBlueTitleBg;
iconBg: #c8e1f0;
iconBgOver: #ffffff;
icon: icon {{ "box_button_close", boxBlueTitleBg }};
}
confirmInviteTitle: flatLabel(labelDefFlat) {
font: font(16px semibold);
@ -88,6 +97,7 @@ contactsNewItemTop: 18px;
contactsNewItemFg: #4b82af;
contactsMultiSelect: MultiSelect {
bg: boxSearchBg;
padding: margins(8px, 8px, 8px, 8px);
maxHeight: 104px;
scroll: flatScroll(solidScroll) {
@ -106,9 +116,9 @@ contactsMultiSelect: MultiSelect {
font: normalFont;
textBg: contactsBgOver;
textFg: windowTextFg;
textActiveBg: windowActiveFill;
textActiveFg: white;
deleteFg: white;
textActiveBg: activeButtonBg;
textActiveFg: activeButtonFg;
deleteFg: activeButtonFg;
deleteLeft: 10px;
deleteStroke: 2px;
duration: 150;
@ -136,16 +146,18 @@ contactsMultiSelect: MultiSelect {
fieldIcon: fieldSearchIcon;
fieldIconSkip: 36px;
fieldCancel: IconButton(defaultIconButton) {
fieldCancel: MaskButton(defaultMaskButton) {
width: 41px;
height: 48px;
opacity: 0.3;
overOpacity: 0.4;
bg: boxSearchBg;
icon: boxSearchCancelIcon;
iconBg: boxSearchCancelIconFg;
iconBgOver: boxSearchCancelIconFgOver;
icon: boxCancelIcon;
iconPosition: point(8px, 18px);
downIconPosition: point(8px, 19px);
downIconPosition: point(8px, 18px);
}
fieldCancelSkip: 34px;
}
@ -183,7 +195,7 @@ shareScrollDuration: 300;
notificationsBoxHeight: 450px;
notificationsBoxMonitorTop: 63px;
notificationsBoxMonitor: icon {{ "monitor", #000000 }};
notificationsBoxMonitor: icon {{ "monitor", notificationsBoxMonitorFg }};
notificationsBoxScreenTop: 10px;
notificationsBoxScreenSize: size(280px, 160px);
notificationsBoxScreenBg: titleBg;
@ -197,13 +209,8 @@ notificationsSampleMargin: 2px;
notificationSampleOpacity: 0.5;
notificationSampleSize: size(64px, 16px);
notificationSampleUserpicFg: #40ace3;
notificationSampleCloseFg: #d7d7d7;
notificationSampleTextFg: #d7d7d7;
notificationSampleNameFg: #939393;
membersAboutPadding: margins(0px, 12px, 0px, 12px);
membersAboutFg: #777777;
membersAboutLimitPadding: margins(0px, 12px, 0px, 12px);
sessionsScroll: flatScroll(boxScroll) {
round: 2px;
@ -216,10 +223,11 @@ sessionCurrentPadding: margins(0px, 7px, 0px, 4px);
sessionCurrentHeight: 118px;
sessionPadding: margins(21px, 10px, 21px, 0px);
sessionNameFont: msgNameFont;
sessionActiveFont: msgDateFont;
sessionActiveColor: #aaaaaa;
sessionNameFg: boxTextFg;
sessionWhenFont: msgDateFont;
sessionWhenFg: #aaaaaa;
sessionInfoFont: msgFont;
sessionInfoColor: #888888;
sessionInfoFg: #888888;
sessionTerminateTop: 30px;
sessionTerminateSkip: 18px;
sessionTerminate: IconButton(defaultIconButton) {
@ -230,3 +238,46 @@ sessionTerminate: IconButton(defaultIconButton) {
iconPosition: point(3px, 3px);
downIconPosition: point(3px, 4px);
}
passcodeHeaderFont: font(19px);
passcodeHeaderHeight: 80px;
passcodeInput: flatInput(inpIntroPhone) {
}
passcodeSubmit: flatButton(introNextButton) {
textTop: 15px;
overTextTop: 15px;
downTextTop: 16px;
width: 225px;
font: font(19px);
overFont: font(19px);
}
passcodeSubmitSkip: 40px;
passcodePadding: margins(0px, 22px, 0px, 3px);
passcodeSkip: 31px;
newGroupAboutFg: #808080;
newGroupPadding: margins(4px, 6px, 4px, 3px);
newGroupSkip: 17px;
newGroupInfoPadding: margins(0px, -4px, 0px, 1px);
newGroupLinkPadding: margins(4px, 27px, 4px, 12px);
newGroupLinkTop: 3px;
newGroupLinkFont: font(16px);
newGroupPhotoSize: 76px;
newGroupPhotoBg: #4eb5f0;
newGroupPhotoBgOver: #3fa9e7;
newGroupPhotoIcon: icon {{ "new_chat_photo", #ffffff }};
newGroupPhotoIconPosition: point(23px, 25px);
newGroupPhotoDuration: 150;
newGroupNamePosition: point(27px, 20px);
newGroupDescriptionPadding: margins(0px, 23px, 0px, 14px);
newGroupDescription: InputArea(defaultInputArea) {
textMargins: margins(1px, 6px, 1px, 4px);
heightMax: 115px;
}
newGroupPublicLinkPadding: margins(0px, 20px, 0px, 5px);
newGroupLinkFadeDuration: 5000;

View file

@ -165,7 +165,7 @@ void ConfirmBox::paintEvent(QPaintEvent *e) {
if (paint(p)) return;
// draw box title / text
p.setPen(st::black->p);
p.setPen(st::boxTextFg);
textstyleSet(&st::boxTextStyle);
_text.drawLeftElided(p, st::boxPadding.left(), st::boxPadding.top(), _textWidth, width(), 16, style::al_left);
textstyleRestore();
@ -276,7 +276,7 @@ void MaxInviteBox::paintEvent(QPaintEvent *e) {
if (paint(p)) return;
// draw box title / text
p.setPen(st::black->p);
p.setPen(st::boxTextFg);
_text.drawLeftElided(p, st::boxPadding.left(), st::boxPadding.top(), _textWidth, width(), 16, style::al_left);
QTextOption option(style::al_left);
@ -286,7 +286,7 @@ void MaxInviteBox::paintEvent(QPaintEvent *e) {
p.drawText(_invitationLink, _link, option);
if (!_goodTextLink.isEmpty() && a_goodOpacity.current() > 0) {
p.setOpacity(a_goodOpacity.current());
p.setPen(st::setGoodColor);
p.setPen(st::boxTextFgGood);
p.setFont(st::boxTextFont);
p.drawTextLeft(st::boxPadding.left(), height() - st::boxButtonPadding.bottom() - _close->height() + st::defaultBoxButton.textTop + st::defaultBoxButton.font->ascent - st::boxTextFont->ascent, width(), _goodTextLink);
p.setOpacity(1);
@ -380,7 +380,7 @@ void ConvertToSupergroupBox::paintEvent(QPaintEvent *e) {
paintTitle(p, lang(lng_profile_convert_title));
// draw box title / text
p.setPen(st::black);
p.setPen(st::boxTextFg);
textstyleSet(&st::boxTextStyle);
_text.drawLeft(p, st::boxPadding.left(), st::boxTitleHeight, _textWidth, width());
_note.drawLeft(p, st::boxPadding.left(), st::boxTitleHeight + _textHeight + st::boxPadding.bottom(), _textWidth, width());

View file

@ -264,7 +264,7 @@ void ConfirmPhoneBox::paintEvent(QPaintEvent *e) {
p.setPen(st::usernameDefaultFg);
errorText = lang(lng_confirm_phone_enter_code);
} else {
p.setPen(st::setErrColor);
p.setPen(st::boxTextFgError);
}
auto errorTextRectLeft = st::usernamePadding.left();
auto errorTextRectTop = _code->y() + _code->height();

View file

@ -250,7 +250,7 @@ void AutoDownloadBox::paintEvent(QPaintEvent *e) {
Painter p(this);
if (paint(p)) return;
p.setPen(st::black);
p.setPen(st::boxTextFg);
p.setFont(st::semiboldFont);
p.drawTextLeft(st::boxTitlePosition.x(), st::boxTitlePosition.y(), width(), lang(lng_media_auto_photo));
p.drawTextLeft(st::boxTitlePosition.x(), _sectionHeight + st::boxTitlePosition.y(), width(), lang(lng_media_auto_audio));

View file

@ -951,7 +951,7 @@ void ContactsBox::Inner::paintDialog(Painter &p, uint64 ms, PeerData *peer, Cont
}
auto checkedRatio = 0.;
p.fillRect(0, 0, width(), _rowHeight, sel ? st::contactsBgOver : st::white);
p.fillRect(0, 0, width(), _rowHeight, sel ? st::contactsBgOver : st::contactsBg);
if (paintDisabledCheck) {
paintDisabledCheckUserpic(p, peer, st::contactsPadding.left(), st::contactsPadding.top(), width());
} else if (usingMultiSelect()) {
@ -970,12 +970,12 @@ void ContactsBox::Inner::paintDialog(Painter &p, uint64 ms, PeerData *peer, Cont
}
if (checkedRatio > 0) {
if (checkedRatio < 1) {
p.setPen(style::interpolate(st::black, st::contactsNameCheckedFg, checkedRatio));
p.setPen(style::interpolate(st::contactsNameFg, st::contactsNameCheckedFg, checkedRatio));
} else {
p.setPen(st::contactsNameCheckedFg);
}
} else {
p.setPen(st::black);
p.setPen(st::contactsNameFg);
}
data->name.drawLeftElided(p, namex, st::contactsPadding.top() + st::contactsNameTop, namew, width());
@ -1047,7 +1047,7 @@ void ContactsBox::Inner::paintEvent(QPaintEvent *e) {
p.setClipRect(r);
_time = unixtime();
p.fillRect(r, st::white);
p.fillRect(r, st::contactsBg);
uint64 ms = getms();
int32 yFrom = r.y(), yTo = r.y() + r.height();
@ -1057,12 +1057,12 @@ void ContactsBox::Inner::paintEvent(QPaintEvent *e) {
if (_chat) {
p.fillRect(0, 0, width(), _newItemHeight - st::contactsPadding.bottom() - st::lineWidth, st::contactsAboutBg);
p.fillRect(0, _newItemHeight - st::contactsPadding.bottom() - st::lineWidth, width(), st::lineWidth, st::shadowColor);
p.setPen(st::black);
p.setPen(st::boxTextFg);
p.drawTextLeft(st::contactsPadding.left(), st::contactsNewItemTop, width(), lang(lng_chat_all_members_admins));
int aboutw = width() - st::contactsPadding.left() - st::contactsPadding.right();
(_allAdmins->checked() ? _aboutAllAdmins : _aboutAdmins).draw(p, st::contactsPadding.left(), st::contactsNewItemHeight + st::contactsAboutTop, aboutw);
} else {
p.fillRect(0, 0, width(), st::contactsNewItemHeight, (_newItemSel ? st::contactsBgOver : st::white)->b);
p.fillRect(0, 0, width(), st::contactsNewItemHeight, _newItemSel ? st::contactsBgOver : st::contactsBg);
p.setFont(st::contactsNameFont);
st::contactsNewItemIcon.paint(p, 0, 0, width());
p.setPen(st::contactsNewItemFg);
@ -1112,7 +1112,7 @@ void ContactsBox::Inner::paintEvent(QPaintEvent *e) {
text = lang(lng_contacts_loading);
p.fillRect(0, 0, width(), _newItemHeight - st::contactsPadding.bottom() - st::lineWidth, st::contactsAboutBg);
p.fillRect(0, _newItemHeight - st::contactsPadding.bottom() - st::lineWidth, width(), st::lineWidth, st::shadowColor);
p.setPen(st::black);
p.setPen(st::boxTextFg);
p.drawTextLeft(st::contactsPadding.left(), st::contactsNewItemTop, width(), lang(lng_chat_all_members_admins));
int aboutw = width() - st::contactsPadding.left() - st::contactsPadding.right();
(_allAdmins->checked() ? _aboutAllAdmins : _aboutAdmins).draw(p, st::contactsPadding.left(), st::contactsNewItemHeight + st::contactsAboutTop, aboutw);

View file

@ -77,7 +77,7 @@ EmojiBox::EmojiBox() : _esize(EmojiSizes[EIndex + 1]) {
fillBlocks();
_blockHeight = st::emojiReplaceInnerHeight;
resizeMaxHeight(_blocks[0].size() * st::emojiReplaceWidth + 2 * st::emojiReplacePadding, st::boxTitleHeight + st::emojiReplacePadding + _blocks.size() * st::emojiReplaceHeight + (st::emojiReplaceHeight - _blockHeight) + st::emojiReplacePadding);
prepare();
@ -127,8 +127,8 @@ void EmojiBox::paintEvent(QPaintEvent *e) {
paintTitle(p, lang(lng_settings_emoji_list));
p.setFont(st::emojiTextFont->f);
p.setPen(st::black->p);
p.setFont(st::emojiTextFont);
p.setPen(st::boxTextFg);
int32 top = st::boxTitleHeight + st::emojiReplacePadding + (st::emojiReplaceHeight - _blockHeight) / 2;
for (Blocks::const_iterator i = _blocks.cbegin(), e = _blocks.cend(); i != e; ++i) {
int32 rowSize = i->size(), left = (width() - rowSize * st::emojiReplaceWidth) / 2;

View file

@ -139,17 +139,17 @@ void MembersBox::Inner::paintEvent(QPaintEvent *e) {
Painter p(this);
_time = unixtime();
p.fillRect(r, st::white->b);
p.fillRect(r, st::contactsBg);
int32 yFrom = r.y() - st::membersPadding.top(), yTo = r.y() + r.height() - st::membersPadding.top();
p.translate(0, st::membersPadding.top());
if (_rows.isEmpty()) {
p.setFont(st::noContactsFont->f);
p.setPen(st::noContactsColor->p);
p.setFont(st::noContactsFont);
p.setPen(st::noContactsColor);
p.drawText(QRect(0, 0, width(), st::noContactsHeight), lang(lng_contacts_loading), style::al_center);
} else {
if (_newItemHeight) {
p.fillRect(0, 0, width(), _newItemHeight, (_newItemSel ? st::contactsBgOver : st::white)->b);
p.fillRect(0, 0, width(), _newItemHeight, _newItemSel ? st::contactsBgOver : st::contactsBg);
st::contactsNewItemIcon.paint(p, 0, 0, width());
p.setFont(st::contactsNameFont);
p.setPen(st::contactsNewItemFg);
@ -170,8 +170,8 @@ void MembersBox::Inner::paintEvent(QPaintEvent *e) {
p.translate(0, _rowHeight);
}
if (to == _rows.size() && _filter == MembersFilter::Recent && (_rows.size() < _channel->membersCount() || _rows.size() >= Global::ChatSizeMax())) {
p.setPen(st::membersAboutFg);
_about.draw(p, st::contactsPadding.left(), st::membersAboutPadding.top(), _aboutWidth, style::al_center);
p.setPen(st::membersAboutLimitFg);
_about.draw(p, st::contactsPadding.left(), st::membersAboutLimitPadding.top(), _aboutWidth, style::al_center);
}
}
}
@ -237,10 +237,10 @@ void MembersBox::Inner::onKickConfirm() {
void MembersBox::Inner::paintDialog(Painter &p, PeerData *peer, MemberData *data, bool sel, bool kickSel, bool kickDown) {
UserData *user = peer->asUser();
p.fillRect(0, 0, width(), _rowHeight, (sel ? st::contactsBgOver : st::white)->b);
p.fillRect(0, 0, width(), _rowHeight, sel ? st::contactsBgOver : st::contactsBg);
peer->paintUserpicLeft(p, st::contactsPhotoSize, st::contactsPadding.left(), st::contactsPadding.top(), width());
p.setPen(st::black);
p.setPen(st::contactsNameFg);
int32 namex = st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left();
int32 namew = width() - namex - st::contactsPadding.right() - (data->canKick ? (_kickWidth + st::contactsCheckPosition.x() * 2) : 0);
@ -348,7 +348,7 @@ void MembersBox::Inner::refresh() {
_aboutHeight = 0;
} else {
_about.setText(st::boxTextFont, lng_channel_only_last_shown(lt_count, _rows.size()));
_aboutHeight = st::membersAboutPadding.top() + _about.countHeight(_aboutWidth) + st::membersAboutPadding.bottom();
_aboutHeight = st::membersAboutLimitPadding.top() + _about.countHeight(_aboutWidth) + st::membersAboutLimitPadding.bottom();
if (_filter != MembersFilter::Recent || (_rows.size() >= _channel->membersCount() && _rows.size() < Global::ChatSizeMax())) {
_aboutHeight = 0;
}

View file

@ -220,7 +220,7 @@ void NotificationsBox::prepareNotificationSampleSmall() {
auto height = st::notificationSampleSize.height();
auto sampleImage = QImage(width * cIntRetinaFactor(), height * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
sampleImage.setDevicePixelRatio(cRetinaFactor());
sampleImage.fill(st::notifyBg->c);
sampleImage.fill(st::notificationBg->c);
{
Painter p(&sampleImage);
p.setPen(Qt::NoPen);
@ -263,7 +263,7 @@ void NotificationsBox::prepareNotificationSampleLarge() {
int w = st::notifyWidth, h = st::notifyMinHeight;
auto sampleImage = QImage(w * cIntRetinaFactor(), h * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
sampleImage.setDevicePixelRatio(cRetinaFactor());
sampleImage.fill(st::notifyBg->c);
sampleImage.fill(st::notificationBg->c);
{
Painter p(&sampleImage);
p.fillRect(0, 0, w - st::notifyBorderWidth, st::notifyBorderWidth, st::notifyBorder->b);

View file

@ -19,13 +19,13 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
#include "lang.h"
#include "boxes/passcodebox.h"
#include "passcodebox.h"
#include "lang.h"
#include "confirmbox.h"
#include "mainwindow.h"
#include "localstorage.h"
#include "styles/style_boxes.h"
PasscodeBox::PasscodeBox(bool turningOff) : AbstractBox(st::boxWidth)
, _replacedBy(0)
@ -204,26 +204,25 @@ void PasscodeBox::paintEvent(QPaintEvent *e) {
int32 w = st::boxWidth - st::boxPadding.left() * 1.5;
int32 abouty = (_passwordHint.isHidden() ? (_reenterPasscode.isHidden() ? (_oldPasscode.y() + (_hasRecovery && !_hintText.isEmpty() ? st::passcodeSkip : 0)) : _reenterPasscode.y()) + st::passcodeSkip : _passwordHint.y() + st::contactSkip) + _oldPasscode.height();
p.setPen(st::black);
p.setPen(st::boxTextFg);
_about.drawLeft(p, st::boxPadding.left(), abouty, w, width());
if (!_hintText.isEmpty() && _oldError.isEmpty()) {
p.setPen(st::black->p);
_hintText.drawLeftElided(p, st::boxPadding.left(), _oldPasscode.y() + _oldPasscode.height() + ((st::passcodeSkip - st::normalFont->height) / 2), w, width(), 1, style::al_topleft);
}
if (!_oldError.isEmpty()) {
p.setPen(st::setErrColor->p);
p.setPen(st::boxTextFgError);
p.drawText(QRect(st::boxPadding.left(), _oldPasscode.y() + _oldPasscode.height(), w, st::passcodeSkip), _oldError, style::al_left);
}
if (!_newError.isEmpty()) {
p.setPen(st::setErrColor->p);
p.setPen(st::boxTextFgError);
p.drawText(QRect(st::boxPadding.left(), _reenterPasscode.y() + _reenterPasscode.height(), w, st::passcodeSkip), _newError, style::al_left);
}
if (!_emailError.isEmpty()) {
p.setPen(st::setErrColor->p);
p.setPen(st::boxTextFgError);
p.drawText(QRect(st::boxPadding.left(), _recoverEmail.y() + _recoverEmail.height(), w, st::passcodeSkip), _emailError, style::al_left);
}
@ -525,12 +524,12 @@ void RecoverBox::paintEvent(QPaintEvent *e) {
paintTitle(p, lang(lng_signin_recover_title));
p.setFont(st::normalFont);
p.setPen(st::black);
p.setPen(st::boxTextFg);
int32 w = st::boxWidth - st::boxPadding.left() * 1.5;
p.drawText(QRect(st::boxPadding.left(), _recoverCode.y() - st::passcodeSkip - st::passcodePadding.top(), w, st::passcodePadding.top() + st::passcodeSkip), _pattern, style::al_left);
if (!_error.isEmpty()) {
p.setPen(st::setErrColor->p);
p.setPen(st::boxTextFgError);
p.drawText(QRect(st::boxPadding.left(), _recoverCode.y() + _recoverCode.height(), w, st::passcodeSkip), _error, style::al_left);
}
}

View file

@ -235,25 +235,25 @@ void PhotoCropBox::paintEvent(QPaintEvent *e) {
p.translate(_thumbx, _thumby);
p.drawPixmap(0, 0, _thumb);
p.setOpacity(0.5);
if (_cropy > 0) {
p.fillRect(QRect(0, 0, _cropx + _cropw, _cropy), st::black->b);
p.fillRect(QRect(0, 0, _cropx + _cropw, _cropy), st::photoCropFadeBg);
}
if (_cropx + _cropw < _thumbw) {
p.fillRect(QRect(_cropx + _cropw, 0, _thumbw - _cropx - _cropw, _cropy + _cropw), st::black->b);
p.fillRect(QRect(_cropx + _cropw, 0, _thumbw - _cropx - _cropw, _cropy + _cropw), st::photoCropFadeBg);
}
if (_cropy + _cropw < _thumbh) {
p.fillRect(QRect(_cropx, _cropy + _cropw, _thumbw - _cropx, _thumbh - _cropy - _cropw), st::black->b);
p.fillRect(QRect(_cropx, _cropy + _cropw, _thumbw - _cropx, _thumbh - _cropy - _cropw), st::photoCropFadeBg);
}
if (_cropx > 0) {
p.fillRect(QRect(0, _cropy, _cropx, _thumbh - _cropy), st::black->b);
p.fillRect(QRect(0, _cropy, _cropx, _thumbh - _cropy), st::photoCropFadeBg);
}
int32 delta = st::cropPointSize, mdelta(-delta / 2);
p.fillRect(QRect(_cropx + mdelta, _cropy + mdelta, delta, delta), st::white->b);
p.fillRect(QRect(_cropx + _cropw + mdelta, _cropy + mdelta, delta, delta), st::white->b);
p.fillRect(QRect(_cropx + _cropw + mdelta, _cropy + _cropw + mdelta, delta, delta), st::white->b);
p.fillRect(QRect(_cropx + mdelta, _cropy + _cropw + mdelta, delta, delta), st::white->b);
int delta = st::cropPointSize;
int mdelta = -delta / 2;
p.fillRect(QRect(_cropx + mdelta, _cropy + mdelta, delta, delta), st::photoCropPointFg);
p.fillRect(QRect(_cropx + _cropw + mdelta, _cropy + mdelta, delta, delta), st::photoCropPointFg);
p.fillRect(QRect(_cropx + _cropw + mdelta, _cropy + _cropw + mdelta, delta, delta), st::photoCropPointFg);
p.fillRect(QRect(_cropx + mdelta, _cropy + _cropw + mdelta, delta, delta), st::photoCropPointFg);
}
void PhotoCropBox::resizeEvent(QResizeEvent *e) {

View file

@ -281,7 +281,7 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) {
p.drawPixmapLeft(x + st::msgFilePadding.left(), y + st::msgFilePadding.top(), width(), userDefPhoto(1)->pixCircled(st::msgFileSize));
}
p.setFont(st::semiboldFont);
p.setPen(st::black);
p.setPen(st::historyFileNameOutFg);
_name.drawLeftElided(p, x + nameleft, y + nametop, namewidth, width());
style::color status(st::mediaOutFg);
@ -599,7 +599,7 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
icon->paintInCenter(p, inner);
}
p.setFont(st::semiboldFont);
p.setPen(st::black);
p.setPen(st::historyFileNameInFg);
_name.drawLeftElided(p, x + nameleft, y + nametop, namewidth, width());
style::color status(st::mediaInFg);
@ -608,13 +608,13 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
p.drawTextLeft(x + nameleft, y + statustop, width(), _status);
} else {
p.setFont(st::boxTitleFont);
p.setPen(st::black);
p.setPen(st::boxTextFg);
p.drawTextLeft(_field->x(), st::boxPhotoPadding.top(), width(), lang(lng_edit_message));
}
if (!_error.isEmpty()) {
p.setFont(st::normalFont);
p.setPen(st::setErrColor);
p.setPen(st::boxTextFgError);
p.drawTextLeft(_field->x(), _field->y() + _field->height() + (st::boxButtonPadding.top() / 2), width(), _error);
}
}

View file

@ -19,9 +19,10 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
#include "report_box.h"
#include "boxes/report_box.h"
#include "lang.h"
#include "styles/style_boxes.h"
#include "styles/style_profile.h"
#include "boxes/confirmbox.h"
#include "ui/buttons/checkbox.h"

View file

@ -139,7 +139,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
data.ip = qs(d.vip) + (country.isEmpty() ? QString() : QString::fromUtf8(" \xe2\x80\x93 ") + country);
if (!data.hash || (d.vflags.v & 1)) {
data.active = lang(lng_sessions_header);
data.activeWidth = st::sessionActiveFont->width(lang(lng_sessions_header));
data.activeWidth = st::sessionWhenFont->width(lang(lng_sessions_header));
int32 availForName = availCurrent - st::sessionPadding.right() - data.activeWidth;
if (data.nameWidth > availForName) {
data.name = st::sessionNameFont->elided(data.name, availForName);
@ -167,7 +167,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
} else {
data.active = lastDate.toString(qsl("d.MM.yy"));
}
data.activeWidth = st::sessionActiveFont->width(data.active);
data.activeWidth = st::sessionWhenFont->width(data.active);
int32 availForName = availOther - st::sessionPadding.right() - data.activeWidth;
if (data.nameWidth > availForName) {
data.name = st::sessionNameFont->elided(data.name, availForName);
@ -257,7 +257,7 @@ void SessionsBox::Inner::paintEvent(QPaintEvent *e) {
QRect r(e->rect());
Painter p(this);
p.fillRect(r, st::white->b);
p.fillRect(r, st::boxBg);
int32 x = st::sessionPadding.left(), xact = st::sessionTerminateSkip + st::sessionTerminate.iconPosition.x();// st::sessionTerminateSkip + st::sessionTerminate.width + st::sessionTerminateSkip;
int32 w = width();
@ -270,24 +270,24 @@ void SessionsBox::Inner::paintEvent(QPaintEvent *e) {
if (r.y() <= st::sessionCurrentHeight) {
p.translate(0, st::sessionCurrentPadding.top());
p.setFont(st::sessionNameFont->f);
p.setPen(st::black->p);
p.setFont(st::sessionNameFont);
p.setPen(st::sessionNameFg);
p.drawTextLeft(x, st::sessionPadding.top(), w, _current->name, _current->nameWidth);
p.setFont(st::sessionActiveFont->f);
p.setPen(st::sessionActiveColor->p);
p.setFont(st::sessionWhenFont);
p.setPen(st::sessionWhenFg);
p.drawTextRight(x, st::sessionPadding.top(), w, _current->active, _current->activeWidth);
p.setFont(st::sessionInfoFont->f);
p.setPen(st::black->p);
p.setFont(st::sessionInfoFont);
p.setPen(st::boxTextFg);
p.drawTextLeft(x, st::sessionPadding.top() + st::sessionNameFont->height, w, _current->info, _current->infoWidth);
p.setPen(st::sessionInfoColor->p);
p.setPen(st::sessionInfoFg);
p.drawTextLeft(x, st::sessionPadding.top() + st::sessionNameFont->height + st::sessionInfoFont->height, w, _current->ip, _current->ipWidth);
}
p.translate(0, st::sessionCurrentHeight - st::sessionCurrentPadding.top());
if (_list->isEmpty()) {
p.setFont(st::sessionInfoFont->f);
p.setPen(st::sessionInfoColor->p);
p.setFont(st::sessionInfoFont);
p.setPen(st::sessionInfoFg);
p.drawText(QRect(st::sessionPadding.left(), 0, width() - st::sessionPadding.left() - st::sessionPadding.right(), st::noContactsHeight), lang(lng_sessions_other_desc), style::al_topleft);
return;
}
@ -300,18 +300,18 @@ void SessionsBox::Inner::paintEvent(QPaintEvent *e) {
for (int32 i = from; i < to; ++i) {
const SessionsBox::Data &auth(_list->at(i));
p.setFont(st::sessionNameFont->f);
p.setPen(st::black->p);
p.setFont(st::sessionNameFont);
p.setPen(st::sessionNameFg);
p.drawTextLeft(x, st::sessionPadding.top(), w, auth.name, auth.nameWidth);
p.setFont(st::sessionActiveFont->f);
p.setPen(st::sessionActiveColor->p);
p.setFont(st::sessionWhenFont);
p.setPen(st::sessionWhenFg);
p.drawTextRight(xact, st::sessionPadding.top(), w, auth.active, auth.activeWidth);
p.setFont(st::sessionInfoFont->f);
p.setPen(st::black->p);
p.setFont(st::sessionInfoFont);
p.setPen(st::boxTextFg);
p.drawTextLeft(x, st::sessionPadding.top() + st::sessionNameFont->height, w, auth.info, auth.infoWidth);
p.setPen(st::sessionInfoColor->p);
p.setPen(st::sessionInfoFg);
p.drawTextLeft(x, st::sessionPadding.top() + st::sessionNameFont->height + st::sessionInfoFont->height, w, auth.ip, auth.ipWidth);
p.translate(0, st::sessionHeight);

View file

@ -532,7 +532,7 @@ void ShareBox::Inner::paintEvent(QPaintEvent *e) {
auto ms = getms();
auto r = e->rect();
p.setClipRect(r);
p.fillRect(r, st::white);
p.fillRect(r, st::boxBg);
auto yFrom = r.y(), yTo = r.y() + r.height();
auto rowFrom = yFrom / _rowHeight;
auto rowTo = (yTo + _rowHeight - 1) / _rowHeight;

View file

@ -561,7 +561,7 @@ void StickersBox::Inner::paintEvent(QPaintEvent *e) {
_a_shifting.step();
p.fillRect(r, st::white);
p.fillRect(r, st::boxBg);
p.setClipRect(r);
int y = st::membersPadding.top();
@ -632,7 +632,7 @@ void StickersBox::Inner::paintRow(Painter &p, int32 index) {
p.setOpacity(current);
QRect row(myrtlrect(_aboveShadow.getDimensions(st::boxShadowShift).left(), st::contactsPadding.top() / 2, width() - (st::contactsPadding.left() / 2) - _scrollbar - _aboveShadow.getDimensions(st::boxShadowShift).right(), _rowHeight - ((st::contactsPadding.top() + st::contactsPadding.bottom()) / 2)));
_aboveShadow.paint(p, row, st::boxShadowShift);
p.fillRect(row, st::white);
p.fillRect(row, st::boxBg);
p.setOpacity(1);
}
} else if (s->installed && !s->disabled) {
@ -669,7 +669,7 @@ void StickersBox::Inner::paintRow(Painter &p, int32 index) {
int statusy = st::contactsPadding.top() + st::contactsStatusTop;
p.setFont(st::contactsNameFont);
p.setPen(st::black);
p.setPen(st::contactsNameFg);
p.drawTextLeft(namex, namey, width(), s->title, s->titleWidth);
if (s->unread) {

View file

@ -79,16 +79,16 @@ void UsernameBox::paintEvent(QPaintEvent *e) {
p.setPen(st::usernameDefaultFg);
p.drawTextLeft(st::usernamePadding.left(), _username.y() + _username.height() + ((st::usernameSkip - st::boxTextFont->height) / 2), width(), _copiedTextLink);
} else if (!_errorText.isEmpty()) {
p.setPen(st::setErrColor);
p.setPen(st::boxTextFgError);
p.drawTextLeft(st::usernamePadding.left(), _username.y() + _username.height() + ((st::usernameSkip - st::boxTextFont->height) / 2), width(), _errorText);
} else if (!_goodText.isEmpty()) {
p.setPen(st::setGoodColor);
p.setPen(st::boxTextFgGood);
p.drawTextLeft(st::usernamePadding.left(), _username.y() + _username.height() + ((st::usernameSkip - st::boxTextFont->height) / 2), width(), _goodText);
} else {
p.setPen(st::usernameDefaultFg);
p.drawTextLeft(st::usernamePadding.left(), _username.y() + _username.height() + ((st::usernameSkip - st::boxTextFont->height) / 2), width(), lang(lng_username_choose));
}
p.setPen(st::black);
p.setPen(st::boxTextFg);
textstyleSet(&st::usernameTextStyle);
int32 availw = st::boxWidth - st::usernamePadding.left(), h = _about.countHeight(availw);
_about.drawLeft(p, st::usernamePadding.left(), _username.y() + _username.height() + st::usernameSkip, availw, width());

View file

@ -172,6 +172,14 @@ QString moduleBaseName(const structure::Module &module) {
return moduleIsPalette ? "palette" : "style_" + moduleInfo.baseName();
}
QString colorFallbackName(structure::Value value) {
auto copy = value.copyOf();
if (!copy.isEmpty()) {
return copy.back();
}
return value.Color().fallback;
}
QChar paletteColorPart(uchar part) {
part = (part & 0x0F);
if (part >= 10) {
@ -436,27 +444,24 @@ public:\n\
void finalize();\n\
\n";
QByteArray checksumString;
int indexInPalette = 0;
if (!module_.enumVariables([this, &indexInPalette, &checksumString](const Variable &value) -> bool {
auto name = value.name.back();
if (value.value.type().tag != structure::TypeTag::Color) {
if (!module_.enumVariables([this, &indexInPalette](const Variable &variable) -> bool {
auto name = variable.name.back();
if (variable.value.type().tag != structure::TypeTag::Color) {
return false;
}
auto type = typeToString(value.value.type());
auto type = typeToString(variable.value.type());
auto index = (indexInPalette++);
header_->stream() << "\tinline const " << type << " &" << name << "() const { return _colors[" << index << "]; };\n";
checksumString.append(':' + name);
return true;
})) return false;
auto checksum = hashCrc32(checksumString.constData(), checksumString.size());
auto count = indexInPalette;
auto type = typeToString({ structure::TypeTag::Color });
header_->stream() << "\
\n\
static constexpr int32 kChecksum = " << checksum << ";\n\
static int32 Checksum();\n\
\n\
private:\n\
struct TempColorData { uchar r, g, b, a; };\n\
@ -470,6 +475,7 @@ private:\n\
\n\
" << type << " _colors[" << count << "] = { Qt::Uninitialized };\n\
Status _status[" << count << "] = { Status::Initial };\n\
bool _ready = false;\n\
\n\
};\n\
\n\
@ -614,10 +620,14 @@ bool Generator::writeRefsDefinition() {
bool Generator::writeSetPaletteColor() {
source_->newline();
source_->stream() << "void palette::finalize() {\n";
source_->stream() << "\
void palette::finalize() {\n\
if (_ready) return;\n\
_ready = true;\n\n";
int indexInPalette = 0;
bool result = module_.enumVariables([this, &indexInPalette](const Variable &variable) -> bool {
QByteArray checksumString;
bool result = module_.enumVariables([this, &indexInPalette, &checksumString](const Variable &variable) -> bool {
auto name = variable.name.back();
auto index = indexInPalette++;
paletteIndices_[name] = index;
@ -625,15 +635,21 @@ bool Generator::writeSetPaletteColor() {
return false;
}
auto color = variable.value.Color();
auto fallbackIndex = paletteIndices_.value(variable.value.Color().fallback, -1);
auto fallbackIndex = paletteIndices_.value(colorFallbackName(variable.value), -1);
source_->stream() << "\tcompute(" << index << ", " << fallbackIndex << ", {" << color.red << ", " << color.green << ", " << color.blue << ", " << color.alpha << "});\n";
checksumString.append('&' + name + ':' + valueAssignmentCode(variable.value));
return true;
});
auto count = indexInPalette;
auto checksum = hashCrc32(checksumString.constData(), checksumString.size());
source_->stream() << "\
}\n\
\n\
int32 palette::Checksum() {\n\
return " << checksum << ";\n\
}\n\
\n\
void palette::compute(int index, int fallbackIndex, TempColorData data) {\n\
if (_status[index] == Status::Initial) {\n\
if (fallbackIndex >= 0 && _status[fallbackIndex] != Status::Initial) {\n\
@ -711,6 +727,8 @@ int getPaletteIndex(QLatin1String name) {\n\
source_->newline().popNamespace().newline();
source_->stream() << "\
QByteArray palette::save() const {\n\
if (!_ready) const_cast<palette*>(this)->finalize();\n\
\n\
auto result = QByteArray(" << (count * 4) << ", Qt::Uninitialized);\n\
for (auto i = 0, index = 0; i != " << count << "; ++i) {\n\
result[index++] = static_cast<uchar>(_colors[i]->c.red());\n\
@ -1100,7 +1118,7 @@ bool Generator::writeSampleTheme(const QString &filepath) {
}
auto color = variable.value.Color();
auto colorString = paletteColorValue(color);
auto fallbackIndex = paletteIndices_.value(variable.value.Color().fallback, -1);
auto fallbackIndex = paletteIndices_.value(colorFallbackName(variable.value), -1);
if (fallbackIndex >= 0) {
auto fallbackVariable = module_.findVariableInModule(names[fallbackIndex], module_);
if (!fallbackVariable || fallbackVariable->value.type().tag != structure::TypeTag::Color) {

View file

@ -534,7 +534,13 @@ structure::Value ParsedFile::readColorValue() {
} else {
logErrorUnexpectedToken() << "color value alias, unique color values are only allowed in palette module";
}
} else if (auto transparentName = file_.getToken(BasicType::Name)) {
if (tokenValue(transparentName) == "transparent") {
return { structure::data::color { 255, 255, 255, 0 } };
}
file_.putBack();
}
return {};
}

View file

@ -83,11 +83,12 @@ dialogsTextStyleDraftActive: textStyle(dialogsTextStyle) {
linkFgDown: #c6e1f7;
}
dialogsNewChatIcon: icon {{ "dialogs_new_chat", #b7b7b7 }};
dialogsNewChatButton: IconButton(defaultIconButton) {
width: 36px;
height: 36px;
icon: icon {{ "dialogs_new_chat", #b7b7b7 }};
icon: dialogsNewChatIcon;
iconPosition: point(9px, 10px);
downIconPosition: point(9px, 11px);
}
@ -128,5 +129,3 @@ historySendingIcon: icon {{ "dialogs_sending", #98d292, point(5px, 5px) }};
historySendingInvertedIcon: icon {{ "dialogs_sending", #ffffffc8, point(5px, 5px) }};
historyViewsSendingIcon: icon {{ "dialogs_sending", #a0adb5, point(3px, 0px) }};
historyViewsSendingInvertedIcon: icon {{ "dialogs_sending", #ffffffc8, point(3px, 0px) }};
settingsEditIcon: icon {{ "dialogs_new_chat", #b7b7b7, point(3px, 9px) }};

View file

@ -293,17 +293,17 @@ void RowPainter::paint(Painter &p, const FakeRow *row, int w, bool active, bool
}
void paintImportantSwitch(Painter &p, Mode current, int w, bool selected, bool onlyBackground) {
p.fillRect(0, 0, w, st::dialogsImportantBarHeight, selected ? st::dialogsBgOver : st::white);
p.fillRect(0, 0, w, st::dialogsImportantBarHeight, selected ? st::dialogsBgOver : st::dialogsBg);
if (onlyBackground) {
return;
}
p.setFont(st::semiboldFont);
p.setPen(st::black);
p.setPen(st::dialogsNameFg);
int unreadTop = (st::dialogsImportantBarHeight - st::dialogsUnreadHeight) / 2;
bool mutedHidden = (current == Dialogs::Mode::Important);
QString text = mutedHidden ? qsl("Show all chats") : qsl("Hide muted chats");
QString text = lang(mutedHidden ? lng_dialogs_show_all_chats : lng_dialogs_hide_muted_chats);
int textBaseline = unreadTop + (st::dialogsUnreadHeight - st::dialogsUnreadFont->height) / 2 + st::dialogsUnreadFont->ascent;
p.drawText(st::dialogsPadding.x(), textBaseline, text);

View file

@ -105,7 +105,7 @@ void DialogsInner::paintRegion(Painter &p, const QRegion &region, bool paintingO
shownDialogs()->all().paint(p, fullWidth(), dialogsClip.top(), dialogsClip.top() + dialogsClip.height(), active, selected, paintingOther);
}
if (!otherStart) {
p.fillRect(dialogsClip, st::white);
p.fillRect(dialogsClip, st::dialogsBg);
if (!paintingOther) {
p.setFont(st::noContactsFont);
p.setPen(st::noContactsColor);
@ -120,11 +120,10 @@ void DialogsInner::paintRegion(Painter &p, const QRegion &region, bool paintingO
if (from < _hashtagResults.size()) {
int32 w = fullWidth(), htagwidth = w - st::dialogsPadding.x() * 2;
p.setFont(st::mentionFont->f);
p.setPen(st::black->p);
p.setFont(st::mentionFont);
for (; from < to; ++from) {
bool selected = (from == _hashtagSel);
p.fillRect(0, 0, w, st::mentionHeight, (selected ? st::mentionBgOver : st::white)->b);
p.fillRect(0, 0, w, st::mentionHeight, selected ? st::mentionBgOver : st::dialogsBg);
if (!paintingOther) {
if (selected) {
int skip = (st::mentionHeight - st::simpleCloseIcon.height()) / 2;
@ -2501,8 +2500,8 @@ void DialogsWidget::paintEvent(QPaintEvent *e) {
int retina = cIntRetinaFactor();
if (a_coordOver.current() > 0) {
p.drawPixmap(QRect(0, 0, a_coordOver.current(), _cacheUnder.height() / retina), _cacheUnder, QRect(-a_coordUnder.current() * retina, 0, a_coordOver.current() * retina, _cacheUnder.height()));
p.setOpacity(a_progress.current() * st::slideFadeOut);
p.fillRect(0, 0, a_coordOver.current(), _cacheUnder.height() / retina, st::black);
p.setOpacity(a_progress.current());
p.fillRect(0, 0, a_coordOver.current(), _cacheUnder.height() / retina, st::slideFadeOutBg);
p.setOpacity(1);
}
p.drawPixmap(QRect(a_coordOver.current(), 0, _cacheOver.width() / retina, _cacheOver.height() / retina), _cacheOver, QRect(0, 0, _cacheOver.width(), _cacheOver.height()));
@ -2512,11 +2511,11 @@ void DialogsWidget::paintEvent(QPaintEvent *e) {
}
QRect above(0, 0, width(), _scroll.y());
if (above.intersects(r)) {
p.fillRect(above.intersected(r), st::white->b);
p.fillRect(above.intersected(r), st::dialogsBg);
}
QRect below(0, _scroll.y() + qMin(_scroll.height(), _inner.height()), width(), height());
if (below.intersects(r)) {
p.fillRect(below.intersected(r), st::white->b);
p.fillRect(below.intersected(r), st::dialogsBg);
}
}

View file

@ -65,7 +65,7 @@ void FieldAutocomplete::paintEvent(QPaintEvent *e) {
return;
}
p.fillRect(rect(), st::white);
p.fillRect(rect(), st::mentionBg);
}
void FieldAutocomplete::showFiltered(PeerData *peer, QString query, bool addInlineBots) {
@ -549,7 +549,7 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
int32 atwidth = st::mentionFont->width('@'), hashwidth = st::mentionFont->width('#');
int32 mentionleft = 2 * st::mentionPadding.left() + st::mentionPhotoSize;
int32 mentionwidth = width() - mentionleft - 2 * st::mentionPadding.right();
int32 htagleft = st::historyAttachPhoto.width + st::taMsgField.textMrg.left() - st::lineWidth, htagwidth = width() - st::mentionPadding.right() - htagleft - st::mentionScroll.width;
int32 htagleft = st::historyAttachPhoto.width + st::historyComposeField.textMrg.left() - st::lineWidth, htagwidth = width() - st::mentionPadding.right() - htagleft - st::mentionScroll.width;
if (!_srows->isEmpty()) {
int32 rows = rowscount(_srows->size(), _stickersPerRow);
@ -604,13 +604,12 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
bool selected = (i == _sel);
if (selected) {
p.fillRect(0, i * st::mentionHeight, width(), st::mentionHeight, st::mentionBgOver->b);
p.fillRect(0, i * st::mentionHeight, width(), st::mentionHeight, st::mentionBgOver);
int skip = (st::mentionHeight - st::simpleCloseIcon.height()) / 2;
if (!_hrows->isEmpty() || (!_mrows->isEmpty() && i < _recentInlineBotsInRows)) {
st::simpleCloseIcon.paint(p, QPoint(width() - st::simpleCloseIcon.width() - skip, i * st::mentionHeight + skip), width());
}
}
p.setPen(st::black->p);
if (!_mrows->isEmpty()) {
UserData *user = _mrows->at(i);
QString first = (!filterIsEmpty && user->username.startsWith(filter, Qt::CaseInsensitive)) ? ('@' + user->username.mid(0, filterSize)) : QString();
@ -632,9 +631,11 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
}
user->loadUserpic();
user->paintUserpicLeft(p, st::mentionPhotoSize, st::mentionPadding.left(), i * st::mentionHeight + st::mentionPadding.top(), width());
p.setPen(st::mentionNameFg);
user->nameText.drawElided(p, 2 * st::mentionPadding.left() + st::mentionPhotoSize, i * st::mentionHeight + st::mentionTop, namewidth);
p.setFont(st::mentionFont->f);
p.setFont(st::mentionFont);
p.setPen((selected ? st::mentionFgOverActive : st::mentionFgActive)->p);
p.drawText(mentionleft + namewidth + st::mentionPadding.right(), i * st::mentionHeight + st::mentionTop + st::mentionFont->ascent, first);
if (!second.isEmpty()) {
@ -678,7 +679,7 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
auto commandText = '/' + toHighlight;
p.setPen(st::windowTextFg);
p.setPen(st::mentionNameFg);
p.setFont(st::semiboldFont);
p.drawText(2 * st::mentionPadding.left() + st::mentionPhotoSize, i * st::mentionHeight + st::mentionTop + st::semiboldFont->ascent, commandText);

View file

@ -140,6 +140,27 @@ historyPeer8UserpicBg: #f7b37c;
historyPeer8UserpicFg: #de8d62;
historyPeer8UserpicPerson: icon {{ size(120px, 120px), historyPeer8UserpicBg }, { "userpic_person", historyPeer8UserpicFg }};
historyComposeField: flatTextarea {
textColor: #000000;
bgColor: historyComposeAreaBg;
align: align(left);
textMrg: margins(5px, 5px, 5px, 5px);
font: msgFont;
cursor: cursor(text);
phColor: #999999;
phFocusColor: #aaaaaa;
phAlign: align(topleft);
phPos: point(2px, 0px);
phShift: 50px;
phDuration: 100;
phLeftFunc: transition(linear);
phAlphaFunc: transition(linear);
phColorFunc: transition(linear);
}
historyComposeFieldMaxHeight: 224px;
// historyMinHeight: 56px;
historyMediaTypeFile: icon {{ "media_type_file", #b3b3b3, point(2px, 2px) }};
historyMediaTypePhoto: icon {{ "media_type_photo", #bebebe, point(2px, 2px) }};
historyMediaTypeVideo: icon {{ "media_type_video", #bebebe, point(2px, 2px) }};
@ -192,13 +213,14 @@ historyRecordSignalMax: 12px;
historyRecordCancel: #aaaaaa;
historyRecordCancelActive: #ec6466;
historyRecordFont: font(13px);
historyRecordDurationFg: #000000;
historyRecordTextTop: 14px;
historyAttachDropdownMenu: DropdownMenu(defaultDropdownMenu) {
menu: Menu(defaultMenu) {
skip: 5px;
itemBgOver: btnWhiteHover;
itemBgOver: historySendBgOver;
itemIconPosition: point(12px, 6px);
itemIconOpacity: 0.78;
itemIconOverOpacity: 1.;
@ -220,18 +242,18 @@ historyReplyIconPosition: point(13px, 13px);
historyReplyIcon: icon {{ "history_action_reply", #6fa1d2 }};
historyForwardIcon: icon {{ "history_action_forward", #6fa1d2 }};
historyEditIcon: icon {{ "history_action_edit", #6fa1d2 }};
historyReplyCancel: IconButton(defaultIconButton) {
historyReplyCancel: MaskButton(defaultMaskButton) {
width: 49px;
height: 49px;
bg: historyReplyBg;
icon: historyReplyCancelIcon;
iconPosition: point(17px, 17px);
downIconPosition: point(17px, 18px);
iconBg: historyReplyCancelIconFg;
iconBgOver: historyReplyCancelIconFgOver;
}
historyInlineBotCancel: IconButton(historyReplyCancel) {
historyInlineBotCancel: MaskButton(historyReplyCancel) {
height: 46px;
iconPosition: point(-1px, 16px); // < 0 means draw in the center of the button
downIconPosition: point(-1px, 17px);
}
topBarSearch: IconButton(defaultIconButton) {

View file

@ -88,14 +88,14 @@ void DragArea::paintEvent(QPaintEvent *e) {
// draw shadow
_shadow.paint(p, r, st::boxShadowShift);
p.fillRect(r, st::white->b);
p.fillRect(r, st::dragBg);
p.setPen(a_color.current());
p.setFont(st::dragFont->f);
p.setFont(st::dragFont);
p.drawText(QRect(0, (height() - st::dragHeight) / 2, width(), st::dragFont->height), _text, QTextOption(style::al_top));
p.setFont(st::dragSubfont->f);
p.setFont(st::dragSubfont);
p.drawText(QRect(0, (height() + st::dragHeight) / 2 - st::dragSubfont->height, width(), st::dragSubfont->height * 2), _subtext, QTextOption(style::al_top));
}

View file

@ -81,7 +81,7 @@ void LocationManager::init() {
delete notLoadedPlaceholder;
}
auto data = QImage(cIntRetinaFactor(), cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
data.fill(st::white->c);
data.fill(st::imageBgTransparent->c);
data.setDevicePixelRatio(cRetinaFactor());
notLoadedPlaceholder = new ImagePtr(App::pixmapFromImageInPlace(std_::move(data)), "GIF");
}

View file

@ -416,11 +416,10 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, uin
if (selected) {
p.setBrush(st::msgDateImgBgSelected);
} else if (isThumbAnimation(ms)) {
float64 over = _animation->a_thumbOver.current();
p.setOpacity((st::msgDateImgBg->c.alphaF() * (1 - over)) + (st::msgDateImgBgOver->c.alphaF() * over));
p.setBrush(st::black);
auto over = _animation->a_thumbOver.current();
p.setBrush(style::interpolate(st::msgDateImgBg, st::msgDateImgBgOver, over));
} else {
bool over = ClickHandler::showAsActive(_data->loading() ? _cancell : _savel);
auto over = ClickHandler::showAsActive(_data->loading() ? _cancell : _savel);
p.setBrush(over ? st::msgDateImgBgOver : st::msgDateImgBg);
}
@ -460,7 +459,7 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, uin
_parent->drawInfo(p, fullRight, fullBottom, 2 * skipx + width, selected, InfoDisplayOverImage);
}
} else {
p.setPen(st::black);
p.setPen(outbg ? st::historyCaptionOutFg : st::historyCaptionInFg);
_caption.draw(p, st::msgPadding.left(), skipy + height + st::mediaPadding.bottom() + st::mediaCaptionSkip, captionw, style::al_left, 0, -1, selection);
}
}
@ -755,9 +754,8 @@ void HistoryVideo::draw(Painter &p, const QRect &r, TextSelection selection, uin
if (selected) {
p.setBrush(st::msgDateImgBgSelected);
} else if (isThumbAnimation(ms)) {
float64 over = _animation->a_thumbOver.current();
p.setOpacity((st::msgDateImgBg->c.alphaF() * (1 - over)) + (st::msgDateImgBgOver->c.alphaF() * over));
p.setBrush(st::black);
auto over = _animation->a_thumbOver.current();
p.setBrush(style::interpolate(st::msgDateImgBg, st::msgDateImgBgOver, over));
} else {
bool over = ClickHandler::showAsActive(_data->loading() ? _cancell : _savel);
p.setBrush(over ? st::msgDateImgBgOver : st::msgDateImgBg);
@ -790,7 +788,7 @@ void HistoryVideo::draw(Painter &p, const QRect &r, TextSelection selection, uin
int32 statusH = st::normalFont->height + 2 * st::msgDateImgPadding.y();
App::roundRect(p, rtlrect(statusX - st::msgDateImgPadding.x(), statusY - st::msgDateImgPadding.y(), statusW, statusH, _width), selected ? st::msgDateImgBgSelected : st::msgDateImgBg, selected ? DateSelectedCorners : DateCorners);
p.setFont(st::normalFont);
p.setPen(st::white);
p.setPen(st::msgDateImgColor);
p.drawTextLeft(statusX, statusY, _width, _statusText, statusW - 2 * st::msgDateImgPadding.x());
// date
@ -800,7 +798,7 @@ void HistoryVideo::draw(Painter &p, const QRect &r, TextSelection selection, uin
_parent->drawInfo(p, fullRight, fullBottom, 2 * skipx + width, selected, InfoDisplayOverImage);
}
} else {
p.setPen(st::black);
p.setPen(outbg ? st::historyCaptionOutFg : st::historyCaptionInFg);
_caption.draw(p, st::msgPadding.left(), skipy + height + st::mediaPadding.bottom() + st::mediaCaptionSkip, captionw, style::al_left, 0, -1, selection);
}
}
@ -1110,11 +1108,10 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
if (selected) {
p.setBrush(st::msgDateImgBgSelected);
} else if (isThumbAnimation(ms)) {
float64 over = _animation->a_thumbOver.current();
p.setOpacity((st::msgDateImgBg->c.alphaF() * (1 - over)) + (st::msgDateImgBgOver->c.alphaF() * over));
p.setBrush(st::black);
auto over = _animation->a_thumbOver.current();
p.setBrush(style::interpolate(st::msgDateImgBg, st::msgDateImgBgOver, over));
} else {
bool over = ClickHandler::showAsActive(_data->loading() ? _cancell : _savel);
auto over = ClickHandler::showAsActive(_data->loading() ? _cancell : _savel);
p.setBrush(over ? st::msgDateImgBgOver : st::msgDateImgBg);
}
p.setOpacity(radialOpacity * p.opacity());
@ -1159,10 +1156,10 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
if (selected) {
p.setBrush(outbg ? st::msgFileOutBgSelected : st::msgFileInBgSelected);
} else if (isThumbAnimation(ms)) {
float64 over = _animation->a_thumbOver.current();
auto over = _animation->a_thumbOver.current();
p.setBrush(style::interpolate(outbg ? st::msgFileOutBg : st::msgFileInBg, outbg ? st::msgFileOutBgOver : st::msgFileInBgOver, over));
} else {
bool over = ClickHandler::showAsActive(_data->loading() ? _cancell : _savel);
auto over = ClickHandler::showAsActive(_data->loading() ? _cancell : _savel);
p.setBrush(outbg ? (over ? st::msgFileOutBgOver : st::msgFileOutBg) : (over ? st::msgFileInBgOver : st::msgFileInBg));
}
@ -1256,7 +1253,7 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
}
} else if (auto named = Get<HistoryDocumentNamed>()) {
p.setFont(st::semiboldFont);
p.setPen(st::black);
p.setPen(outbg ? st::historyFileNameOutFg : st::historyFileNameInFg);
if (namewidth < named->_namew) {
p.drawTextLeft(nameleft, nametop, _width, st::semiboldFont->elided(named->_name, namewidth));
} else {
@ -1282,7 +1279,7 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
}
if (auto captioned = Get<HistoryDocumentCaptioned>()) {
p.setPen(st::black);
p.setPen(outbg ? st::historyCaptionOutFg : st::historyCaptionInFg);
captioned->_caption.draw(p, st::msgPadding.left(), bottom, captionw, style::al_left, 0, -1, selection);
}
}
@ -1733,11 +1730,10 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, uint6
if (selected) {
p.setBrush(st::msgDateImgBgSelected);
} else if (isThumbAnimation(ms)) {
float64 over = _animation->a_thumbOver.current();
p.setOpacity((st::msgDateImgBg->c.alphaF() * (1 - over)) + (st::msgDateImgBgOver->c.alphaF() * over));
p.setBrush(st::black);
auto over = _animation->a_thumbOver.current();
p.setBrush(style::interpolate(st::msgDateImgBg, st::msgDateImgBgOver, over));
} else {
bool over = ClickHandler::showAsActive(_data->loading() ? _cancell : _savel);
auto over = ClickHandler::showAsActive(_data->loading() ? _cancell : _savel);
p.setBrush(over ? st::msgDateImgBgOver : st::msgDateImgBg);
}
p.setOpacity(radialOpacity * p.opacity());
@ -1773,13 +1769,13 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, uint6
int32 statusH = st::normalFont->height + 2 * st::msgDateImgPadding.y();
App::roundRect(p, rtlrect(statusX - st::msgDateImgPadding.x(), statusY - st::msgDateImgPadding.y(), statusW, statusH, _width), selected ? st::msgDateImgBgSelected : st::msgDateImgBg, selected ? DateSelectedCorners : DateCorners);
p.setFont(st::normalFont);
p.setPen(st::white);
p.setPen(st::msgDateImgColor);
p.drawTextLeft(statusX, statusY, _width, _statusText, statusW - 2 * st::msgDateImgPadding.x());
}
}
if (!_caption.isEmpty()) {
p.setPen(st::black);
p.setPen(outbg ? st::historyCaptionOutFg : st::historyCaptionInFg);
_caption.draw(p, st::msgPadding.left(), skipy + height + st::mediaPadding.bottom() + st::mediaCaptionSkip, captionw, style::al_left, 0, -1, selection);
} else if (_parent->getMedia() == this && (_data->uploading() || App::hoveredItem() == _parent)) {
int32 fullRight = skipx + width, fullBottom = skipy + height;
@ -2318,7 +2314,7 @@ void HistoryContact::draw(Painter &p, const QRect &r, TextSelection selection, u
int32 namewidth = width - nameleft - nameright;
p.setFont(st::semiboldFont);
p.setPen(st::black);
p.setPen(outbg ? st::historyFileNameOutFg : st::historyFileNameInFg);
_name.drawLeftElided(p, nameleft, nametop, namewidth, width);
style::color status(outbg ? (selected ? st::mediaOutFgSelected : st::mediaOutFg) : (selected ? st::mediaInFgSelected : st::mediaInFg));
@ -2699,7 +2695,7 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, u
tshift += _lineHeight;
}
if (_titleLines) {
p.setPen(st::black);
p.setPen(outbg ? st::webPageTitleOutFg : st::webPageTitleInFg);
int32 endskip = 0;
if (_title.hasSkipBlock()) {
endskip = _parent->skipBlockWidth();
@ -2708,7 +2704,7 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, u
tshift += _titleLines * _lineHeight;
}
if (_descriptionLines) {
p.setPen(st::black);
p.setPen(outbg ? st::webPageDescriptionOutFg : st::webPageDescriptionInFg);
int32 endskip = 0;
if (_description.hasSkipBlock()) {
endskip = _parent->skipBlockWidth();
@ -3078,7 +3074,7 @@ void HistoryGame::draw(Painter &p, const QRect &r, TextSelection selection, uint
tshift += _titleLines * _lineHeight;
}
if (_descriptionLines) {
p.setPen(st::black);
p.setPen(outbg ? st::webPageDescriptionOutFg : st::webPageDescriptionInFg);
int32 endskip = 0;
if (_description.hasSkipBlock()) {
endskip = _parent->skipBlockWidth();
@ -3390,12 +3386,13 @@ void HistoryLocation::draw(Painter &p, const QRect &r, TextSelection selection,
width -= st::mediaPadding.left() + st::mediaPadding.right();
int32 textw = _width - st::msgPadding.left() - st::msgPadding.right();
p.setPen(st::black);
if (!_title.isEmpty()) {
p.setPen(outbg ? st::webPageTitleOutFg : st::webPageTitleInFg);
_title.drawLeftElided(p, skipx + st::msgPadding.left(), skipy, textw, _width, 2, style::al_left, 0, -1, 0, false, selection);
skipy += qMin(_title.countHeight(textw), 2 * st::webPageTitleFont->height);
}
if (!_description.isEmpty()) {
p.setPen(outbg ? st::webPageDescriptionOutFg : st::webPageDescriptionInFg);
_description.drawLeftElided(p, skipx + st::msgPadding.left(), skipy, textw, _width, 3, style::al_left, 0, -1, 0, false, toDescriptionSelection(selection));
skipy += qMin(_description.countHeight(textw), 3 * st::webPageDescriptionFont->height);
}
@ -3423,7 +3420,7 @@ void HistoryLocation::draw(Painter &p, const QRect &r, TextSelection selection,
}
p.drawPixmap(QPoint(skipx, skipy), pix);
} else {
App::roundRect(p, skipx, skipy, width, height, st::white, MessageInCorners);
App::roundRect(p, skipx, skipy, width, height, st::msgInBg, MessageInCorners);
}
if (selected) {
App::roundRect(p, skipx, skipy, width, height, textstyleCurrent()->selectOverlay, SelectedOverlayLargeCorners);

View file

@ -247,7 +247,7 @@ void HistoryMessageReply::paint(Painter &p, const HistoryItem *holder, int x, in
if (flags & PaintInBubble) {
bar = ((flags & PaintSelected) ? (outbg ? st::historyOutSelectedFg : st::msgInReplyBarSelColor) : (outbg ? st::historyOutFg : st::msgInReplyBarColor));
} else {
bar = st::white;
bar = st::msgImgReplyBarColor;
}
QRect rbar(rtlrect(x + st::msgReplyBarPos.x(), y + st::msgReplyPadding.top() + st::msgReplyBarPos.y(), st::msgReplyBarSize.width(), st::msgReplyBarSize.height(), w + 2 * x));
p.fillRect(rbar, bar);
@ -271,7 +271,7 @@ void HistoryMessageReply::paint(Painter &p, const HistoryItem *holder, int x, in
if (flags & PaintInBubble) {
p.setPen(selected ? (outbg ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) : (outbg ? st::msgOutServiceFg : st::msgInServiceFg));
} else {
p.setPen(st::white);
p.setPen(st::msgImgReplyBarColor);
}
replyToName.drawLeftElided(p, x + st::msgReplyBarSkip + previewSkip, y + st::msgReplyPadding.top(), w - st::msgReplyBarSkip - previewSkip, w + 2 * x);
if (_replyToVia && w > st::msgReplyBarSkip + previewSkip + replyToName.maxWidth() + st::msgServiceFont->spacew) {
@ -292,7 +292,7 @@ void HistoryMessageReply::paint(Painter &p, const HistoryItem *holder, int x, in
} else {
p.setFont(st::msgDateFont);
style::color date(outbg ? (selected ? st::msgOutDateFgSelected : st::msgOutDateFg) : (selected ? st::msgInDateFgSelected : st::msgInDateFg));
p.setPen((flags & PaintInBubble) ? date : st::white);
p.setPen((flags & PaintInBubble) ? date : st::msgDateImgColor);
p.drawTextLeft(x + st::msgReplyBarSkip, y + st::msgReplyPadding.top() + (st::msgReplyBarSize.height() - st::msgDateFont->height) / 2, w + 2 * x, st::msgDateFont->elided(lang(replyToMsgId ? lng_profile_loading : lng_deleted_message), w - st::msgReplyBarSkip));
}
}
@ -316,9 +316,9 @@ void HistoryMessage::KeyboardStyle::paintButtonBg(Painter &p, const QRect &rect,
howMuchOver = 1.;
}
if (howMuchOver > 0) {
float64 o = p.opacity();
p.setOpacity(o * (howMuchOver * st::msgBotKbOverOpacity));
App::roundRect(p, rect, st::white, WhiteCorners);
auto o = p.opacity();
p.setOpacity(o * howMuchOver);
App::roundRect(p, rect, st::msgBotKbOverBg, BotKbOverCorners);
p.setOpacity(o);
}
}
@ -1412,7 +1412,8 @@ void HistoryMessage::paintViaBotIdInfo(Painter &p, QRect &trect, bool selected)
}
void HistoryMessage::paintText(Painter &p, QRect &trect, TextSelection selection) const {
p.setPen(st::msgColor);
bool outbg = out() && !isPost();
p.setPen(outbg ? st::historyTextOutFg : st::historyTextInFg);
p.setFont(st::msgFont);
_text.draw(p, trect.x(), trect.y(), trect.width(), style::al_left, 0, -1, selection);
}

View file

@ -371,9 +371,10 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
App::roundRect(p, _botAbout->rect, st::msgInBg, MessageInCorners, &st::msgInShadow);
p.setFont(st::msgNameFont);
p.setPen(st::black);
p.setPen(st::dialogsNameFg);
p.drawText(_botAbout->rect.left() + st::msgPadding.left(), _botAbout->rect.top() + st::msgPadding.top() + st::msgNameFont->ascent, lang(lng_bot_description));
p.setPen(st::historyTextInFg);
_botAbout->info->text.draw(p, _botAbout->rect.left() + st::msgPadding.left(), _botAbout->rect.top() + st::msgPadding.top() + st::msgNameFont->height + st::botDescSkip, _botAbout->width);
textstyleRestore();
@ -2303,7 +2304,7 @@ void HistoryInner::onParentGeometryChanged() {
MessageField::MessageField(HistoryWidget *history, const style::flatTextarea &st, const QString &ph, const QString &val) : FlatTextarea(history, st, ph, val), history(history) {
setMinHeight(st::btnSend.height - 2 * st::sendPadding);
setMaxHeight(st::maxFieldHeight);
setMaxHeight(st::historyComposeFieldMaxHeight);
}
bool MessageField::hasSendText() const {
@ -2397,11 +2398,11 @@ void ReportSpamPanel::resizeEvent(QResizeEvent *e) {
void ReportSpamPanel::paintEvent(QPaintEvent *e) {
Painter p(this);
p.fillRect(QRect(0, 0, width(), height() - st::lineWidth), st::reportSpamBg->b);
p.fillRect(QRect(0, 0, width(), height() - st::lineWidth), st::reportSpamBg);
p.fillRect(Adaptive::OneColumn() ? 0 : st::lineWidth, height() - st::lineWidth, width() - (Adaptive::OneColumn() ? 0 : st::lineWidth), st::lineWidth, st::shadowColor->b);
if (!_clear.isHidden()) {
p.setPen(st::black->p);
p.setFont(st::msgFont->f);
p.setPen(st::reportSpamFg);
p.setFont(st::msgFont);
p.drawText(QRect(_report.x(), (_clear.y() - st::msgFont->height) / 2, _report.width(), st::msgFont->height), lang(lng_report_spam_thanks), style::al_top);
}
}
@ -2427,8 +2428,8 @@ BotKeyboard::BotKeyboard() {
void BotKeyboard::paintEvent(QPaintEvent *e) {
Painter p(this);
QRect clip(e->rect());
p.fillRect(clip, st::white);
auto clip = e->rect();
p.fillRect(clip, st::historyComposeAreaBg);
if (_impl) {
int x = rtl() ? st::botKbScroll.width : _st->margin;
@ -2729,10 +2730,9 @@ bool HistoryHider::withConfirm() const {
void HistoryHider::paintEvent(QPaintEvent *e) {
Painter p(this);
p.setOpacity(a_opacity.current());
if (!_hiding || !_cacheForAnim.isNull() || !_offered) {
p.setOpacity(a_opacity.current() * st::layerAlpha);
p.fillRect(rect(), st::layerBg->b);
p.setOpacity(a_opacity.current());
p.fillRect(rect(), st::layerBg);
}
if (_cacheForAnim.isNull() || !_offered) {
p.setFont(st::forwardFont);
@ -2742,13 +2742,13 @@ void HistoryHider::paintEvent(QPaintEvent *e) {
// fill bg
p.fillRect(_box, st::boxBg);
p.setPen(st::black);
p.setPen(st::boxTextFg);
_toText.drawElided(p, _box.left() + st::boxPadding.left(), _box.top() + st::boxPadding.top(), _toTextWidth + 2);
} else {
int32 w = st::forwardMargins.left() + _chooseWidth + st::forwardMargins.right(), h = st::forwardMargins.top() + st::forwardFont->height + st::forwardMargins.bottom();
App::roundRect(p, (width() - w) / 2, (height() - st::titleHeight - h) / 2, w, h, st::forwardBg, ForwardCorners);
p.setPen(st::white);
p.setPen(st::forwardFg);
p.drawText(_box, lang(_botAndQuery.isEmpty() ? lng_forward_choose : lng_inline_switch_choose), QTextOption(style::al_center));
}
} else {
@ -3009,7 +3009,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
, _botKeyboardHide(this, st::historyBotKeyboardHide)
, _botCommandStart(this, st::historyBotCommandStart)
, _silent(this)
, _field(this, st::taMsgField, lang(lng_message_ph))
, _field(this, st::historyComposeField, lang(lng_message_ph))
, _a_record(animation(this, &HistoryWidget::step_record))
, _a_recording(animation(this, &HistoryWidget::step_recording))
, a_recordCancel(st::historyRecordCancel->c, st::historyRecordCancel->c)
@ -6154,7 +6154,7 @@ void HistoryWidget::onKbToggle(bool manual) {
_kbScroll.hide();
_kbShown = false;
_field.setMaxHeight(st::maxFieldHeight);
_field.setMaxHeight(st::historyComposeFieldMaxHeight);
_kbReplyTo = 0;
if (!readyToForward() && (!_previewData || _previewData->pendingTill < 0) && !_editMsgId && !_replyToId) {
@ -6177,7 +6177,7 @@ void HistoryWidget::onKbToggle(bool manual) {
_kbScroll.hide();
_kbShown = false;
_field.setMaxHeight(st::maxFieldHeight);
_field.setMaxHeight(st::historyComposeFieldMaxHeight);
_kbReplyTo = (_peer->isChat() || _peer->isChannel() || _keyboard.forceReply()) ? App::histItemById(_keyboard.forMsgId()) : 0;
if (_kbReplyTo && !_editMsgId && !_replyToId && fieldEnabled) {
@ -6195,8 +6195,8 @@ void HistoryWidget::onKbToggle(bool manual) {
_kbScroll.show();
_kbShown = true;
int32 maxh = qMin(_keyboard.height(), int(st::maxFieldHeight) - (int(st::maxFieldHeight) / 2));
_field.setMaxHeight(st::maxFieldHeight - maxh);
int32 maxh = qMin(_keyboard.height(), st::historyComposeFieldMaxHeight - (st::historyComposeFieldMaxHeight / 2));
_field.setMaxHeight(st::historyComposeFieldMaxHeight - maxh);
_kbReplyTo = (_peer->isChat() || _peer->isChannel() || _keyboard.forceReply()) ? App::histItemById(_keyboard.forMsgId()) : 0;
if (_kbReplyTo && !_editMsgId && !_replyToId) {
@ -6262,8 +6262,8 @@ void HistoryWidget::paintTopBar(Painter &p, float64 over, int32 decreaseWidth) {
int retina = cIntRetinaFactor();
if (a_coordOver.current() > 0) {
p.drawPixmap(QRect(0, 0, a_coordOver.current(), st::topBarHeight), _cacheUnder, QRect(-a_coordUnder.current() * retina, 0, a_coordOver.current() * retina, st::topBarHeight * retina));
p.setOpacity(a_progress.current() * st::slideFadeOut);
p.fillRect(0, 0, a_coordOver.current(), st::topBarHeight, st::black);
p.setOpacity(a_progress.current());
p.fillRect(0, 0, a_coordOver.current(), st::topBarHeight, st::slideFadeOutBg);
p.setOpacity(1);
}
p.drawPixmap(QRect(a_coordOver.current(), 0, _cacheOver.width() / retina, st::topBarHeight), _cacheOver, QRect(0, 0, _cacheOver.width(), st::topBarHeight * retina));
@ -6439,7 +6439,7 @@ void HistoryWidget::updateOnlineDisplayTimer() {
void HistoryWidget::moveFieldControls() {
int w = width(), h = height(), right = w, bottom = h, keyboardHeight = 0;
int maxKeyboardHeight = int(st::maxFieldHeight) - _field.height();
int maxKeyboardHeight = st::historyComposeFieldMaxHeight - _field.height();
_keyboard.resizeToWidth(width(), maxKeyboardHeight);
if (_kbShown) {
keyboardHeight = qMin(_keyboard.height(), maxKeyboardHeight);
@ -6505,7 +6505,7 @@ void HistoryWidget::clearInlineBot() {
void HistoryWidget::inlineBotChanged() {
bool isInlineBot = _inlineBot && (_inlineBot != LookingUpInlineBot);
if (isInlineBot && !_inlineBotCancel) {
_inlineBotCancel = std_::make_unique<Ui::IconButton>(this, st::historyInlineBotCancel);
_inlineBotCancel = std_::make_unique<Ui::MaskButton>(this, st::historyInlineBotCancel);
connect(_inlineBotCancel.get(), SIGNAL(clicked()), this, SLOT(onInlineBotCancel()));
_inlineBotCancel->setGeometry(_send.geometry());
_attachEmoji->raise();
@ -7340,8 +7340,8 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
_botKeyboardShow->hide();
_botCommandStart->hide();
}
int32 maxh = hasMarkup ? qMin(_keyboard.height(), int(st::maxFieldHeight) - (int(st::maxFieldHeight) / 2)) : 0;
_field.setMaxHeight(st::maxFieldHeight - maxh);
int32 maxh = hasMarkup ? qMin(_keyboard.height(), st::historyComposeFieldMaxHeight - (st::historyComposeFieldMaxHeight / 2)) : 0;
_field.setMaxHeight(st::historyComposeFieldMaxHeight - maxh);
_kbShown = hasMarkup;
_kbReplyTo = (_peer->isChat() || _peer->isChannel() || _keyboard.forceReply()) ? App::histItemById(_keyboard.forMsgId()) : 0;
if (_kbReplyTo && !_replyToId) {
@ -7358,7 +7358,7 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
_botKeyboardShow->show();
_botCommandStart->hide();
}
_field.setMaxHeight(st::maxFieldHeight);
_field.setMaxHeight(st::historyComposeFieldMaxHeight);
_kbShown = false;
_kbReplyTo = 0;
if (!readyToForward() && (!_previewData || _previewData->pendingTill < 0) && !_replyToId) {
@ -7374,7 +7374,7 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
_botKeyboardShow->hide();
_botCommandStart->show();
}
_field.setMaxHeight(st::maxFieldHeight);
_field.setMaxHeight(st::historyComposeFieldMaxHeight);
_kbShown = false;
_kbReplyTo = 0;
if (!readyToForward() && (!_previewData || _previewData->pendingTill < 0) && !_replyToId && !_editMsgId) {
@ -8524,7 +8524,7 @@ void HistoryWidget::drawField(Painter &p, const QRect &rect) {
backh += st::historyReplyHeight;
}
bool drawPreview = (_previewData && _previewData->pendingTill >= 0) && !_replyForwardPressed;
p.fillRect(0, backy, width(), backh, st::taMsgField.bgColor);
p.fillRect(0, backy, width(), backh, st::historyReplyBg);
if (_editMsgId || _replyToId || (!hasForward && _kbReplyTo)) {
int32 replyLeft = st::historyReplySkip;
(_editMsgId ? st::historyEditIcon : st::historyReplyIcon).paint(p, st::historyReplyIconPosition + QPoint(0, backy), width());
@ -8668,7 +8668,7 @@ void HistoryWidget::drawRecording(Painter &p) {
QString duration = formatDurationText(_recordingSamples / AudioVoiceMsgFrequency);
p.setFont(st::historyRecordFont);
p.setPen(st::black);
p.setPen(st::historyRecordDurationFg);
p.drawText(_attachPhoto->x() + _attachEmoji->width(), _attachPhoto->y() + st::historyRecordTextTop + st::historyRecordFont->ascent, duration);
int32 left = _attachPhoto->x() + _attachEmoji->width() + st::historyRecordFont->width(duration) + ((_send.width() - st::historyRecordVoice.width()) / 2);
@ -8684,7 +8684,7 @@ void HistoryWidget::drawPinnedBar(Painter &p) {
Text *from = 0, *text = 0;
bool serviceColor = false, hasForward = readyToForward();
ImagePtr preview;
p.fillRect(0, 0, width(), st::historyReplyHeight, st::taMsgField.bgColor);
p.fillRect(0, 0, width(), st::historyReplyHeight, st::historyPinnedBg);
QRect rbar(rtlrect(st::msgReplyBarSkip + st::msgReplyBarPos.x(), st::msgReplyPadding.top() + st::msgReplyBarPos.y(), st::msgReplyBarSize.width(), st::msgReplyBarSize.height(), width()));
p.fillRect(rbar, st::msgInReplyBarColor);
@ -8732,8 +8732,8 @@ void HistoryWidget::paintEvent(QPaintEvent *e) {
int inCacheTop = hasTopBar ? st::topBarHeight : 0;
if (a_coordOver.current() > 0) {
p.drawPixmap(QRect(0, 0, a_coordOver.current(), height()), _cacheUnder, QRect(-a_coordUnder.current() * retina, inCacheTop * retina, a_coordOver.current() * retina, height() * retina));
p.setOpacity(a_progress.current() * st::slideFadeOut);
p.fillRect(0, 0, a_coordOver.current(), height(), st::black);
p.setOpacity(a_progress.current());
p.fillRect(0, 0, a_coordOver.current(), height(), st::slideFadeOutBg);
p.setOpacity(1);
}
p.drawPixmap(QRect(a_coordOver.current(), 0, _cacheOver.width() / retina, height()), _cacheOver, QRect(0, inCacheTop * retina, _cacheOver.width(), height() * retina));

View file

@ -42,6 +42,7 @@ class DropdownMenu;
class PlainShadow;
class PopupMenu;
class IconButton;
class MaskButton;
class HistoryDownButton;
class EmojiButton;
} // namespace Ui
@ -895,7 +896,7 @@ private:
Text _replyEditMsgText;
mutable SingleTimer _updateEditTimeLeftDisplay;
ChildWidget<Ui::IconButton> _fieldBarCancel;
ChildWidget<Ui::MaskButton> _fieldBarCancel;
void updateReplyEditTexts(bool force = false);
struct PinnedBar {
@ -905,7 +906,7 @@ private:
MsgId msgId = 0;
HistoryItem *msg = nullptr;
Text text;
ChildWidget<Ui::IconButton> cancel;
ChildWidget<Ui::MaskButton> cancel;
ChildWidget<Ui::PlainShadow> shadow;
};
std_::unique_ptr<PinnedBar> _pinnedBar;
@ -1085,7 +1086,7 @@ private:
UserData *_inlineBot = nullptr;
QString _inlineBotUsername;
mtpRequestId _inlineBotResolveRequestId = 0;
std_::unique_ptr<Ui::IconButton> _inlineBotCancel;
std_::unique_ptr<Ui::MaskButton> _inlineBotCancel;
void inlineBotResolveDone(const MTPcontacts_ResolvedPeer &result);
bool inlineBotResolveFail(QString name, const RPCError &error);

View file

@ -172,10 +172,10 @@ void Gif::paint(Painter &p, const QRect &clip, const PaintContext *context) cons
auto radialOpacity = (radial && loaded) ? _animation->radial.opacity() : 1.;
if (_animation && _animation->_a_over.animating(context->ms)) {
auto over = _animation->_a_over.current();
p.setOpacity((st::msgDateImgBg->c.alphaF() * (1 - over)) + (st::msgDateImgBgOver->c.alphaF() * over));
p.fillRect(r, st::black);
p.fillRect(r, style::interpolate(st::msgDateImgBg, st::msgDateImgBgOver, over));
} else {
p.fillRect(r, (_state & StateFlag::Over) ? st::msgDateImgBgOver : st::msgDateImgBg);
auto over = (_state & StateFlag::Over);
p.fillRect(r, over ? st::msgDateImgBgOver : st::msgDateImgBg);
}
p.setOpacity(radialOpacity * p.opacity());
@ -600,7 +600,7 @@ void Video::paint(Painter &p, const QRect &clip, const PaintContext *context) co
p.drawPixmapLeft(0, st::inlineRowMargin, _width, _thumb);
}
} else {
p.fillRect(rtlrect(0, st::inlineRowMargin, st::inlineThumbSize, st::inlineThumbSize, _width), st::black);
p.fillRect(rtlrect(0, st::inlineRowMargin, st::inlineThumbSize, st::inlineThumbSize, _width), st::overviewVideoBg);
}
if (!_duration.isEmpty()) {
@ -608,12 +608,12 @@ void Video::paint(Painter &p, const QRect &clip, const PaintContext *context) co
int durationW = _durationWidth + 2 * st::msgDateImgPadding.x(), durationH = st::normalFont->height + 2 * st::msgDateImgPadding.y();
int durationX = (st::inlineThumbSize - durationW) / 2, durationY = st::inlineRowMargin + st::inlineThumbSize - durationH;
App::roundRect(p, durationX, durationY - st::msgDateImgPadding.y(), durationW, durationH, st::msgDateImgBg, DateCorners);
p.setPen(st::white);
p.setPen(st::msgDateImgColor);
p.setFont(st::normalFont);
p.drawText(durationX + st::msgDateImgPadding.x(), durationTop + st::normalFont->ascent, _duration);
}
p.setPen(st::black);
p.setPen(st::inlineTitleFg);
_title.drawLeftElided(p, left, st::inlineRowMargin, _width - left, _width, 2);
int32 titleHeight = qMin(_title.countHeight(_width - left), st::semiboldFont->height * 2);
@ -744,7 +744,7 @@ void File::paint(Painter &p, const QRect &clip, const PaintContext *context) con
int titleTop = st::inlineRowMargin + st::inlineRowFileNameTop;
int descriptionTop = st::inlineRowMargin + st::inlineRowFileDescriptionTop;
p.setPen(st::black);
p.setPen(st::inlineTitleFg);
_title.drawLeftElided(p, left, titleTop, _width - left, _width);
p.setPen(st::inlineDescriptionFg);
@ -939,7 +939,7 @@ void Contact::paint(Painter &p, const QRect &clip, const PaintContext *context)
int titleTop = st::inlineRowMargin + st::inlineRowFileNameTop;
int descriptionTop = st::inlineRowMargin + st::inlineRowFileDescriptionTop;
p.setPen(st::black);
p.setPen(st::inlineTitleFg);
_title.drawLeftElided(p, left, titleTop, _width - left, _width);
p.setPen(st::inlineDescriptionFg);
@ -1052,7 +1052,7 @@ void Article::paint(Painter &p, const QRect &clip, const PaintContext *context)
p.fillRect(rthumb, colors[index]);
if (!_thumbLetter.isEmpty()) {
p.setFont(st::linksLetterFont);
p.setPen(st::white);
p.setPen(st::linksLetterFg);
p.drawText(rthumb, _thumbLetter, style::al_center);
}
} else {
@ -1063,7 +1063,7 @@ void Article::paint(Painter &p, const QRect &clip, const PaintContext *context)
}
}
p.setPen(st::black);
p.setPen(st::inlineTitleFg);
_title.drawLeftElided(p, left, st::inlineRowMargin, _width - left, _width, 2);
int32 titleHeight = qMin(_title.countHeight(_width - left), st::semiboldFont->height * 2);
@ -1252,7 +1252,7 @@ void Game::paint(Painter &p, const QRect &clip, const PaintContext *context) con
}
}
p.setPen(st::black);
p.setPen(st::inlineTitleFg);
_title.drawLeftElided(p, left, st::inlineRowMargin, _width - left, _width, 2);
int32 titleHeight = qMin(_title.countHeight(_width - left), st::semiboldFont->height * 2);

View file

@ -43,8 +43,106 @@ introCountry: countryInput {
align: align(left);
}
introErrLabel: flatLabel(labelDefFlat) {
font: introErrFont;
introBtnTop: 288px;
introSkip: 45px;
introFinishSkip: 15px;
introPhotoSize: 98px;
introHeaderFont: font(24px);
introHeaderSkip: 14px;
introIconSkip: 54px;
introFont: font(16px);
introLink: linkButton(btnDefLink) {
font: introFont;
overFont: font(16px underline);
}
introLabel: flatLabel(labelDefFlat) {
font: introFont;
align: align(center);
}
introStepSize: size(400px, 200px);
introSize: size(400px, 400px);
introSlideShift: 500px; // intro hiding animation
introSlideDuration: 200;
introSlideDelta: 0; // between hide start and show start
introHideFunc: transition(easeInCirc);
introShowFunc: transition(easeOutCirc);
introAlphaHideFunc: transition(easeOutCirc);
introAlphaShowFunc: transition(easeInCirc);
introTextTop: 22px;
introTextSize: size(400px, 93px);
introCallSkip: 15px;
introPwdTextSize: size(400px, 73px);
introNextButton: flatButton {
duration: 200;
cursor: cursor(pointer);
color: #ffffff;
overColor: #ffffff;
downColor: #ffffff;
bgColor: #2fa9e2;
overBgColor: #279ad0;
downBgColor: #279ad0;
textTop: 16px;
overTextTop: 16px;
downTextTop: 17px;
font: font(17px);
overFont: font(17px);
width: 300px;
height: 56px;
radius: buttonRadius;
}
introPhoneTop: 8px;
inpIntroCountryCode: flatInput(inpDefGray) {
width: 70px;
height: 41px;
align: align(center);
}
inpIntroPhone: flatInput(inpDefGray) {
textMrg: margins(12px, 5px, 12px, 6px);
width: 225px;
height: 41px;
}
inpIntroCode: flatInput(inpDefGray) {
textMrg: margins(12px, 5px, 12px, 6px);
width: 106px;
height: 41px;
align: align(center);
phPos: point(0px, 0px);
phAlign: align(center);
phShift: 0px;
}
inpIntroName: flatInput(inpIntroPhone) {
width: 192px;
}
inpIntroPassword: flatInput(inpIntroPhone) {
width: 300px;
}
introSelectDelta: 30px;
introErrorWidth: 450px;
introErrorDuration: 200;
introErrorTop: 15px;
introErrorHeight: 40px;
introErrorFont: font(16px);
introLabelTextStyle: textStyle(defaultTextStyle) {
lineHeight: 30px;
}
introErrorLabelTextStyle: textStyle(defaultTextStyle) {
lineHeight: 27px;
}
introErrorLabel: flatLabel(labelDefFlat) {
font: introErrorFont;
align: align(center);
}
introBackButton: IconButton(defaultIconButton) {

View file

@ -75,7 +75,7 @@ void CodeInput::correctValue(const QString &was, QString &now) {
IntroCode::IntroCode(IntroWidget *parent) : IntroStep(parent)
, a_errorAlpha(0)
, _a_error(animation(this, &IntroCode::step_error))
, next(this, lang(lng_intro_next), st::btnIntroNext)
, next(this, lang(lng_intro_next), st::introNextButton)
, _desc(st::introTextSize.width())
, _noTelegramCode(this, lang(lng_code_no_telegram), st::introLink)
, _noTelegramCodeRequestId(0)
@ -149,14 +149,14 @@ void IntroCode::paintEvent(QPaintEvent *e) {
} break;
}
if (!callText.isEmpty()) {
p.drawText(QRect(textRect.left(), code.y() + code.height() + st::introCallSkip, st::introTextSize.width(), st::introErrHeight), callText, style::al_center);
p.drawText(QRect(textRect.left(), code.y() + code.height() + st::introCallSkip, st::introTextSize.width(), st::introErrorHeight), callText, style::al_center);
}
}
if (_a_error.animating() || error.length()) {
p.setOpacity(a_errorAlpha.current());
p.setFont(st::introErrFont->f);
p.setPen(st::introErrColor->p);
p.drawText(QRect(textRect.left(), next.y() + next.height() + st::introErrTop, st::introTextSize.width(), st::introErrHeight), error, style::al_center);
p.setFont(st::introErrorFont);
p.setPen(st::introErrorFg);
p.drawText(QRect(textRect.left(), next.y() + next.height() + st::introErrorTop, st::introTextSize.width(), st::introErrorHeight), error, style::al_center);
}
}
@ -166,7 +166,7 @@ void IntroCode::resizeEvent(QResizeEvent *e) {
code.move((width() - code.width()) / 2, st::introTextTop + st::introTextSize.height() + st::introCountry.top);
}
textRect = QRect((width() - st::introTextSize.width()) / 2, st::introTextTop, st::introTextSize.width(), st::introTextSize.height());
_noTelegramCode.move(textRect.left() + (st::introTextSize.width() - _noTelegramCode.width()) / 2, code.y() + code.height() + st::introCallSkip + (st::introErrHeight - _noTelegramCode.height()) / 2);
_noTelegramCode.move(textRect.left() + (st::introTextSize.width() - _noTelegramCode.width()) / 2, code.y() + code.height() + st::introCallSkip + (st::introErrorHeight - _noTelegramCode.height()) / 2);
}
void IntroCode::showError(const QString &err) {
@ -183,7 +183,7 @@ void IntroCode::showError(const QString &err) {
}
void IntroCode::step_error(float64 ms, bool timer) {
float64 dt = ms / st::introErrDuration;
float64 dt = ms / st::introErrorDuration;
if (dt >= 1) {
_a_error.stop();
@ -192,7 +192,7 @@ void IntroCode::step_error(float64 ms, bool timer) {
error.clear();
}
} else {
a_errorAlpha.update(dt, st::introErrFunc);
a_errorAlpha.update(dt, anim::linear);
}
if (timer) update();
}

View file

@ -47,11 +47,11 @@ IntroPhone::IntroPhone(IntroWidget *parent) : IntroStep(parent)
, a_errorAlpha(0)
, _a_error(animation(this, &IntroPhone::step_error))
, changed(false)
, next(this, lang(lng_intro_next), st::btnIntroNext)
, next(this, lang(lng_intro_next), st::introNextButton)
, country(this, st::introCountry)
, phone(this, st::inpIntroPhone)
, code(this, st::inpIntroCountryCode)
, _signup(this, lng_phone_notreg(lt_signup_start, textcmdStartLink(1), lt_signup_end, textcmdStopLink()), FlatLabel::InitType::Rich, st::introErrLabel, st::introErrLabelTextStyle)
, _signup(this, lng_phone_notreg(lt_signup_start, textcmdStartLink(1), lt_signup_end, textcmdStopLink()), FlatLabel::InitType::Rich, st::introErrorLabel, st::introErrorLabelTextStyle)
, _showSignup(false)
, sentRequest(0) {
setVisible(false);
@ -94,11 +94,11 @@ void IntroPhone::paintEvent(QPaintEvent *e) {
p.drawText(textRect, lang(lng_phone_desc), style::al_bottom);
}
if (_a_error.animating() || error.length()) {
int32 errorY = _showSignup ? ((phone.y() + phone.height() + next.y() - st::introErrFont->height) / 2) : (next.y() + next.height() + st::introErrTop);
int32 errorY = _showSignup ? ((phone.y() + phone.height() + next.y() - st::introErrorFont->height) / 2) : (next.y() + next.height() + st::introErrorTop);
p.setOpacity(a_errorAlpha.current());
p.setFont(st::introErrFont->f);
p.setPen(st::introErrColor->p);
p.drawText(QRect(textRect.x(), errorY, textRect.width(), st::introErrFont->height), error, style::al_top);
p.setFont(st::introErrorFont);
p.setPen(st::introErrorFg);
p.drawText(QRect(textRect.x(), errorY, textRect.width(), st::introErrorFont->height), error, style::al_top);
if (_signup.isHidden() && _showSignup) {
p.drawPixmap(_signup.x(), _signup.y(), _signupCache);
@ -114,7 +114,7 @@ void IntroPhone::resizeEvent(QResizeEvent *e) {
phone.move((width() - country.width()) / 2 + country.width() - st::inpIntroPhone.width, phoneTop);
code.move((width() - country.width()) / 2, phoneTop);
}
_signup.move((width() - _signup.width()) / 2, next.y() + next.height() + st::introErrTop - ((st::introErrLabelTextStyle.lineHeight - st::introErrFont->height) / 2));
_signup.move((width() - _signup.width()) / 2, next.y() + next.height() + st::introErrorTop - ((st::introErrorLabelTextStyle.lineHeight - st::introErrorFont->height) / 2));
textRect = QRect((width() - st::introTextSize.width()) / 2, st::introTextTop, st::introTextSize.width(), st::introTextSize.height());
}
@ -137,7 +137,7 @@ void IntroPhone::showError(const QString &err, bool signUp) {
}
void IntroPhone::step_error(float64 ms, bool timer) {
float64 dt = ms / st::introErrDuration;
float64 dt = ms / st::introErrorDuration;
if (dt >= 1) {
_a_error.stop();
@ -149,7 +149,7 @@ void IntroPhone::step_error(float64 ms, bool timer) {
_signup.show();
}
} else {
a_errorAlpha.update(dt, st::introErrFunc);
a_errorAlpha.update(dt, anim::linear);
}
if (timer) update();
}

View file

@ -31,7 +31,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
IntroPwdCheck::IntroPwdCheck(IntroWidget *parent) : IntroStep(parent)
, a_errorAlpha(0)
, _a_error(animation(this, &IntroPwdCheck::step_error))
, _next(this, lang(lng_intro_submit), st::btnIntroNext)
, _next(this, lang(lng_intro_submit), st::introNextButton)
, _salt(parent->getPwdSalt())
, _hasRecovery(parent->getHasRecovery())
, _hint(parent->getPwdHint())
@ -88,9 +88,9 @@ void IntroPwdCheck::paintEvent(QPaintEvent *e) {
if (_a_error.animating() || error.length()) {
p.setOpacity(a_errorAlpha.current());
QRect errRect((width() - st::introErrWidth) / 2, (_pwdField.y() + _pwdField.height() + st::introFinishSkip + st::introFont->height + _next.y() - st::introErrHeight) / 2, st::introErrWidth, st::introErrHeight);
p.setFont(st::introErrFont->f);
p.setPen(st::introErrColor->p);
QRect errRect((width() - st::introErrorWidth) / 2, (_pwdField.y() + _pwdField.height() + st::introFinishSkip + st::introFont->height + _next.y() - st::introErrorHeight) / 2, st::introErrorWidth, st::introErrorHeight);
p.setFont(st::introErrorFont);
p.setPen(st::introErrorFg);
p.drawText(errRect, error, QTextOption(style::al_center));
p.setOpacity(1);
@ -122,7 +122,7 @@ void IntroPwdCheck::showError(const QString &err) {
}
void IntroPwdCheck::step_error(float64 ms, bool timer) {
float64 dt = ms / st::introErrDuration;
float64 dt = ms / st::introErrorDuration;
if (dt >= 1) {
_a_error.stop();
@ -131,7 +131,7 @@ void IntroPwdCheck::step_error(float64 ms, bool timer) {
error.clear();
}
} else {
a_errorAlpha.update(dt, st::introErrFunc);
a_errorAlpha.update(dt, anim::linear);
}
if (timer) update();
}

View file

@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "intro/introsignup.h"
#include "styles/style_intro.h"
#include "styles/style_boxes.h"
#include "ui/filedialog.h"
#include "boxes/photocropbox.h"
#include "lang.h"
@ -32,7 +33,7 @@ IntroSignup::IntroSignup(IntroWidget *parent) : IntroStep(parent)
, a_photoOver(0)
, _a_error(animation(this, &IntroSignup::step_error))
, _a_photo(animation(this, &IntroSignup::step_photo))
, next(this, lang(lng_intro_finish), st::btnIntroNext)
, next(this, lang(lng_intro_finish), st::introNextButton)
, first(this, st::inpIntroName, lang(lng_signup_firstname))
, last(this, st::inpIntroName, lang(lng_signup_lastname))
, sentRequest(0)
@ -112,12 +113,12 @@ void IntroSignup::paintEvent(QPaintEvent *e) {
QRect errRect;
if (_invertOrder) {
errRect = QRect((width() - st::introErrWidth) / 2, (first.y() + first.height() + next.y() - st::introErrHeight) / 2, st::introErrWidth, st::introErrHeight);
errRect = QRect((width() - st::introErrorWidth) / 2, (first.y() + first.height() + next.y() - st::introErrorHeight) / 2, st::introErrorWidth, st::introErrorHeight);
} else {
errRect = QRect((width() - st::introErrWidth) / 2, (last.y() + last.height() + next.y() - st::introErrHeight) / 2, st::introErrWidth, st::introErrHeight);
errRect = QRect((width() - st::introErrorWidth) / 2, (last.y() + last.height() + next.y() - st::introErrorHeight) / 2, st::introErrorWidth, st::introErrorHeight);
}
p.setFont(st::introErrFont->f);
p.setPen(st::introErrColor->p);
p.setFont(st::introErrorFont);
p.setPen(st::introErrorFg);
p.drawText(errRect, error, QTextOption(style::al_center));
p.setOpacity(1);
@ -174,7 +175,7 @@ void IntroSignup::showError(const QString &err) {
}
void IntroSignup::step_error(float64 ms, bool timer) {
float64 dt = ms / st::introErrDuration;
float64 dt = ms / st::introErrorDuration;
if (dt >= 1) {
_a_error.stop();
@ -183,13 +184,13 @@ void IntroSignup::step_error(float64 ms, bool timer) {
error.clear();
}
} else {
a_errorAlpha.update(dt, st::introErrFunc);
a_errorAlpha.update(dt, anim::linear);
}
if (timer) update();
}
void IntroSignup::step_photo(float64 ms, bool timer) {
float64 dt = ms / st::introErrDuration;
float64 dt = ms / st::introErrorDuration;
if (dt >= 1) {
_a_photo.stop();

View file

@ -29,7 +29,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
IntroStart::IntroStart(IntroWidget *parent) : IntroStep(parent)
, _intro(this, lang(lng_intro), FlatLabel::InitType::Rich, st::introLabel, st::introLabelTextStyle)
, _changeLang(this, QString())
, _next(this, lang(lng_start_msgs), st::btnIntroNext) {
, _next(this, lang(lng_start_msgs), st::introNextButton) {
_changeLang.hide();
if (cLang() == languageDefault) {
int32 l = Sandbox::LangSystem();
@ -68,8 +68,8 @@ void IntroStart::paintEvent(QPaintEvent *e) {
}
int32 hy = _intro.y() - st::introHeaderFont->height - st::introHeaderSkip + st::introHeaderFont->ascent;
p.setFont(st::introHeaderFont->f);
p.setPen(st::introColor->p);
p.setFont(st::introHeaderFont);
p.setPen(st::introHeaderFg);
p.drawText((width() - _headerWidth) / 2, hy, qsl("Telegram Desktop"));
st::aboutIcon.paint(p, QPoint((width() - st::aboutIcon.width()) / 2, hy - st::introIconSkip - st::aboutIcon.height()), width());

View file

@ -248,12 +248,12 @@ void IntroWidget::paintEvent(QPaintEvent *e) {
if (!trivial) {
p.setClipRect(e->rect());
}
p.fillRect(e->rect(), st::white->b);
p.fillRect(e->rect(), st::windowBg);
if (_a_show.animating()) {
if (a_coordOver.current() > 0) {
p.drawPixmap(QRect(0, 0, a_coordOver.current(), height()), _cacheUnder, QRect(-a_coordUnder.current() * cRetinaFactor(), 0, a_coordOver.current() * cRetinaFactor(), height() * cRetinaFactor()));
p.setOpacity(a_shadow.current() * st::slideFadeOut);
p.fillRect(0, 0, a_coordOver.current(), height(), st::black->b);
p.setOpacity(a_shadow.current());
p.fillRect(0, 0, a_coordOver.current(), height(), st::slideFadeOutBg);
p.setOpacity(1);
}
p.drawPixmap(a_coordOver.current(), 0, _cacheOver);

View file

@ -61,7 +61,7 @@ protected:
void paintEvent(QPaintEvent *e) override {
Painter p(this);
p.setOpacity(st::layerAlpha * _opacity);
p.setOpacity(_opacity);
if (_box.isNull()) {
p.fillRect(rect(), st::layerBg);
} else {
@ -70,7 +70,6 @@ protected:
p.fillRect(r, st::layerBg);
}
p.setClipRegion(clip);
p.setOpacity(_opacity);
_shadow.paint(p, _box, st::boxShadowShift);
if (!_hiddenSpecialBox.isNull()) {
p.setClipRegion(QRegion(rect()) - _hiddenSpecialBox);

View file

@ -36,7 +36,7 @@ enum RoundCorners {
SmallMaskCorners = 0x00, // for images
LargeMaskCorners,
WhiteCorners,
BotKbOverCorners,
StickerCorners,
StickerSelectedCorners,
SelectedOverlaySmallCorners,

View file

@ -266,7 +266,7 @@ void FileLoadTask::process() {
if (fullimage.hasAlphaChannel()) {
QImage solid(fullimage.width(), fullimage.height(), QImage::Format_ARGB32_Premultiplied);
solid.fill(st::white->c);
solid.fill(st::imageBgTransparent->c);
{
QPainter(&solid).drawImage(0, 0, fullimage);
}

View file

@ -2697,8 +2697,8 @@ void MainWidget::paintEvent(QPaintEvent *e) {
if (_a_show.animating()) {
if (a_coordOver.current() > 0) {
p.drawPixmap(QRect(0, 0, a_coordOver.current(), height()), _cacheUnder, QRect(-a_coordUnder.current() * cRetinaFactor(), 0, a_coordOver.current() * cRetinaFactor(), height() * cRetinaFactor()));
p.setOpacity(a_shadow.current() * st::slideFadeOut);
p.fillRect(0, 0, a_coordOver.current(), height(), st::black->b);
p.setOpacity(a_shadow.current());
p.fillRect(0, 0, a_coordOver.current(), height(), st::slideFadeOutBg);
p.setOpacity(1);
}
p.drawPixmap(a_coordOver.current(), 0, _cacheOver);

View file

@ -1434,7 +1434,7 @@ void MainWindow::placeSmallCounter(QImage &img, int size, int count, const style
}
QImage MainWindow::iconWithCounter(int size, int count, const style::color &bg, bool smallIcon) {
QImage MainWindow::iconWithCounter(int size, int count, const style::color &bg, const style::color &fg, bool smallIcon) {
bool layer = false;
if (size < 0) {
size = -size;
@ -1446,7 +1446,7 @@ QImage MainWindow::iconWithCounter(int size, int count, const style::color &bg,
QString cnt = (count < 1000) ? QString("%1").arg(count) : QString("..%1").arg(count % 100, 2, 10, QChar('0'));
QImage result(size, size, QImage::Format_ARGB32);
int32 cntSize = cnt.size();
result.fill(st::transparent->c);
result.fill(Qt::transparent);
{
QPainter p(&result);
p.setBrush(bg);
@ -1480,7 +1480,7 @@ QImage MainWindow::iconWithCounter(int size, int count, const style::color &bg,
p.drawRoundedRect(QRect(size - w - d * 2, size - f->height, w + d * 2, f->height), r, r);
p.setFont(f);
p.setPen(st::counterFg);
p.setPen(fg);
p.drawText(size - w - d, size - f->height + f->ascent, cnt);
}
@ -1493,10 +1493,10 @@ QImage MainWindow::iconWithCounter(int size, int count, const style::color &bg,
if (!count) return img;
if (smallIcon) {
placeSmallCounter(img, size, count, bg, QPoint(), st::counterFg);
placeSmallCounter(img, size, count, bg, QPoint(), fg);
} else {
QPainter p(&img);
p.drawPixmap(size / 2, size / 2, App::pixmapFromImageInPlace(iconWithCounter(-size / 2, count, bg, false)));
p.drawPixmap(size / 2, size / 2, App::pixmapFromImageInPlace(iconWithCounter(-size / 2, count, bg, fg, false)));
}
return img;
}

View file

@ -158,7 +158,7 @@ public:
void updateUnreadCounter();
QImage iconWithCounter(int size, int count, const style::color &bg, bool smallIcon);
QImage iconWithCounter(int size, int count, const style::color &bg, const style::color &fg, bool smallIcon);
bool contentOverlapped(const QRect &globalRect);
bool contentOverlapped(QWidget *w, QPaintEvent *e) {

View file

@ -54,16 +54,16 @@ QPixmap _prepareFrame(const FrameRequest &request, const QImage &original, bool
Painter p(&cache);
if (newcache) {
if (request.framew < request.outerw) {
p.fillRect(0, 0, (request.outerw - request.framew) / (2 * factor), cache.height() / factor, st::black);
p.fillRect((request.outerw - request.framew) / (2 * factor) + (request.framew / factor), 0, (cache.width() / factor) - ((request.outerw - request.framew) / (2 * factor) + (request.framew / factor)), cache.height() / factor, st::black);
p.fillRect(0, 0, (request.outerw - request.framew) / (2 * factor), cache.height() / factor, st::imageBg);
p.fillRect((request.outerw - request.framew) / (2 * factor) + (request.framew / factor), 0, (cache.width() / factor) - ((request.outerw - request.framew) / (2 * factor) + (request.framew / factor)), cache.height() / factor, st::imageBg);
}
if (request.frameh < request.outerh) {
p.fillRect(qMax(0, (request.outerw - request.framew) / (2 * factor)), 0, qMin(cache.width(), request.framew) / factor, (request.outerh - request.frameh) / (2 * factor), st::black);
p.fillRect(qMax(0, (request.outerw - request.framew) / (2 * factor)), (request.outerh - request.frameh) / (2 * factor) + (request.frameh / factor), qMin(cache.width(), request.framew) / factor, (cache.height() / factor) - ((request.outerh - request.frameh) / (2 * factor) + (request.frameh / factor)), st::black);
p.fillRect(qMax(0, (request.outerw - request.framew) / (2 * factor)), 0, qMin(cache.width(), request.framew) / factor, (request.outerh - request.frameh) / (2 * factor), st::imageBg);
p.fillRect(qMax(0, (request.outerw - request.framew) / (2 * factor)), (request.outerh - request.frameh) / (2 * factor) + (request.frameh / factor), qMin(cache.width(), request.framew) / factor, (cache.height() / factor) - ((request.outerh - request.frameh) / (2 * factor) + (request.frameh / factor)), st::imageBg);
}
}
if (hasAlpha) {
p.fillRect(qMax(0, (request.outerw - request.framew) / (2 * factor)), qMax(0, (request.outerh - request.frameh) / (2 * factor)), qMin(cache.width(), request.framew) / factor, qMin(cache.height(), request.frameh) / factor, st::white);
p.fillRect(qMax(0, (request.outerw - request.framew) / (2 * factor)), qMax(0, (request.outerh - request.frameh) / (2 * factor)), qMin(cache.width(), request.framew) / factor, qMin(cache.height(), request.frameh) / factor, st::imageBgTransparent);
}
QPoint position((request.outerw - request.framew) / (2 * factor), (request.outerh - request.frameh) / (2 * factor));
if (badSize) {

View file

@ -85,43 +85,55 @@ mediaviewClose: icon {{ "mediaview_close", #ffffff }};
mediaviewSave: icon {{ "mediaview_download", #ffffff }};
mediaviewMore: icon {{ "mediaview_more", #ffffff }};
mediaviewFileRedCornerFg: #d55959;
mediaviewFileYellowCornerFg: #e8a659;
mediaviewFileGreenCornerFg: #49a957;
mediaviewFileBlueCornerFg: #599dcf;
mediaviewFileRed: icon {
{ size(25px, 25px), #ffffff },
{ size(25px, 25px), mediaviewFileBg },
{ "mediaview_file_corner", mediaviewFileRedCornerFg },
};
mediaviewFileYellow: icon {
{ size(25px, 25px), #ffffff },
{ size(25px, 25px), mediaviewFileBg },
{ "mediaview_file_corner", mediaviewFileYellowCornerFg },
};
mediaviewFileGreen: icon {
{ size(25px, 25px), #ffffff },
{ size(25px, 25px), mediaviewFileBg },
{ "mediaview_file_corner", mediaviewFileGreenCornerFg },
};
mediaviewFileBlue: icon {
{ size(25px, 25px), #ffffff },
{ size(25px, 25px), mediaviewFileBg },
{ "mediaview_file_corner", mediaviewFileBlueCornerFg },
};
mediaviewFilePadding: 18px;
mediaviewFileSize: size(340px, 116px);
mediaviewFileNameTop: 4px;
mediaviewFileNameFont: font(semibold 14px);
mediaviewFileSizeTop: 29px;
mediaviewFileExtTop: 35px;
mediaviewFileExtFont: font(semibold 18px);
mediaviewFileExtPadding: 10px;
mediaviewFileLinksTop: 57px;
mediaviewFileIconSize: 80px;
mediaviewFileLink: linkButton(btnDefLink) {
color: #4595d3;
overColor: #4595d3;
downColor: #4595d3;
}
mediaviewTransparentBg: #ffffff;
mediaviewTransparentFg: #cccccc;
mediaviewTransparentSize: 4px;
mediaviewMenu: Menu(defaultMenu) {
itemBg: #383838;
itemBgOver: #505050;
itemFg: white;
itemFgOver: white;
itemFgDisabled: #999999;
itemFgShortcut: #eeeeee;
itemFgShortcutOver: #ffffff;
itemFgShortcutDisabled: #999999;
itemBg: mediaviewMenuBg;
itemBgOver: mediaviewMenuBgOver;
itemFg: mediaviewMenuFg;
itemFgOver: mediaviewMenuFg;
itemFgDisabled: mediaviewMenuFg;
itemFgShortcut: mediaviewMenuFg;
itemFgShortcutOver: mediaviewMenuFg;
itemFgShortcutDisabled: mediaviewMenuFg;
separatorFg: #484848;
separatorFg: mediaviewMenuFg;
}
mediaviewPopupMenu: PopupMenu(defaultPopupMenu) {
shadow: icon {};
@ -130,30 +142,3 @@ mediaviewPopupMenu: PopupMenu(defaultPopupMenu) {
mediaviewDropdownMenu: DropdownMenu(defaultDropdownMenu) {
menu: mediaviewMenu;
}
/*
mvDropdown: dropdown(dropdownDef) {
shadow: icon {};
padding: margins(11px, 12px, 11px, 12px);
border: 0px;
width: 182px;
}
mvButton: iconedButton(btnDefIconed) {
bgColor: #383838;
overBgColor: #505050;
font: font(fsize);
opacity: 1.;
overOpacity: 1.;
width: -32px;
height: 36px;
color: white;
textPos: point(16px, 9px);
downTextPos: point(16px, 10px);
duration: 0;
}
*/

View file

@ -83,9 +83,9 @@ bool typeHasMediaOverview(MediaOverviewType type) {
MediaView::MediaView() : TWidget(App::wnd())
, _animStarted(getms())
, _docDownload(this, lang(lng_media_download), st::mvDocLink)
, _docSaveAs(this, lang(lng_mediaview_save_as), st::mvDocLink)
, _docCancel(this, lang(lng_cancel), st::mvDocLink)
, _docDownload(this, lang(lng_media_download), st::mediaviewFileLink)
, _docSaveAs(this, lang(lng_mediaview_save_as), st::mediaviewFileLink)
, _docCancel(this, lang(lng_cancel), st::mediaviewFileLink)
, _radial(animation(this, &MediaView::step_radial))
, _lastAction(-st::mvDeltaFromLastAction, -st::mvDeltaFromLastAction)
, _a_state(animation(this, &MediaView::step_state))
@ -279,7 +279,7 @@ void MediaView::updateDocSize() {
_docSize = formatSizeText(_doc->size);
}
_docSizeWidth = st::mvFont->width(_docSize);
int32 maxw = st::mvDocSize.width() - st::mvDocIconSize - st::mvDocPadding * 3;
int32 maxw = st::mediaviewFileSize.width() - st::mediaviewFileIconSize - st::mediaviewFilePadding * 3;
if (_docSizeWidth > maxw) {
_docSize = st::mvFont->elided(_docSize, maxw);
_docSizeWidth = st::mvFont->width(_docSize);
@ -291,18 +291,18 @@ void MediaView::updateControls() {
if (_doc->loading()) {
_docDownload.hide();
_docSaveAs.hide();
_docCancel.moveToLeft(_docRect.x() + 2 * st::mvDocPadding + st::mvDocIconSize, _docRect.y() + st::mvDocPadding + st::mvDocLinksTop);
_docCancel.moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
_docCancel.show();
} else {
if (_doc->loaded(DocumentData::FilePathResolveChecked)) {
_docDownload.hide();
_docSaveAs.moveToLeft(_docRect.x() + 2 * st::mvDocPadding + st::mvDocIconSize, _docRect.y() + st::mvDocPadding + st::mvDocLinksTop);
_docSaveAs.moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
_docSaveAs.show();
_docCancel.hide();
} else {
_docDownload.moveToLeft(_docRect.x() + 2 * st::mvDocPadding + st::mvDocIconSize, _docRect.y() + st::mvDocPadding + st::mvDocLinksTop);
_docDownload.moveToLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
_docDownload.show();
_docSaveAs.moveToLeft(_docRect.x() + 2.5 * st::mvDocPadding + st::mvDocIconSize + _docDownload.width(), _docRect.y() + st::mvDocPadding + st::mvDocLinksTop);
_docSaveAs.moveToLeft(_docRect.x() + 2.5 * st::mediaviewFilePadding + st::mediaviewFileIconSize + _docDownload.width(), _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileLinksTop);
_docSaveAs.show();
_docCancel.hide();
}
@ -1224,7 +1224,7 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) { // empty
}
}
_docIconRect = QRect((width() - st::mvDocIconSize) / 2, (height() - st::mvDocIconSize) / 2, st::mvDocIconSize, st::mvDocIconSize);
_docIconRect = QRect((width() - st::mediaviewFileIconSize) / 2, (height() - st::mediaviewFileIconSize) / 2, st::mediaviewFileIconSize, st::mediaviewFileIconSize);
if (!fileShown()) {
if (!_doc || _doc->thumb->isNull()) {
int32 colorIndex = documentColorIndex(_doc, _docExt);
@ -1232,11 +1232,11 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) { // empty
const style::icon *(thumbs[]) = { &st::mediaviewFileBlue, &st::mediaviewFileGreen, &st::mediaviewFileRed, &st::mediaviewFileYellow };
_docIcon = thumbs[colorIndex];
int32 extmaxw = (st::mvDocIconSize - st::mvDocExtPadding * 2);
_docExtWidth = st::mvDocExtFont->width(_docExt);
int32 extmaxw = (st::mediaviewFileIconSize - st::mediaviewFileExtPadding * 2);
_docExtWidth = st::mediaviewFileExtFont->width(_docExt);
if (_docExtWidth > extmaxw) {
_docExt = st::mvDocNameFont->elided(_docExt, extmaxw, Qt::ElideMiddle);
_docExtWidth = st::mvDocNameFont->width(_docExt);
_docExt = st::mediaviewFileNameFont->elided(_docExt, extmaxw, Qt::ElideMiddle);
_docExtWidth = st::mediaviewFileNameFont->width(_docExt);
}
} else {
_doc->thumb->load();
@ -1244,33 +1244,33 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) { // empty
if (!tw || !th) {
_docThumbx = _docThumby = _docThumbw = 0;
} else if (tw > th) {
_docThumbw = (tw * st::mvDocIconSize) / th;
_docThumbx = (_docThumbw - st::mvDocIconSize) / 2;
_docThumbw = (tw * st::mediaviewFileIconSize) / th;
_docThumbx = (_docThumbw - st::mediaviewFileIconSize) / 2;
_docThumby = 0;
} else {
_docThumbw = st::mvDocIconSize;
_docThumbw = st::mediaviewFileIconSize;
_docThumbx = 0;
_docThumby = ((th * _docThumbw) / tw - st::mvDocIconSize) / 2;
_docThumby = ((th * _docThumbw) / tw - st::mediaviewFileIconSize) / 2;
}
}
int32 maxw = st::mvDocSize.width() - st::mvDocIconSize - st::mvDocPadding * 3;
int32 maxw = st::mediaviewFileSize.width() - st::mediaviewFileIconSize - st::mediaviewFilePadding * 3;
if (_doc) {
_docName = (_doc->type == StickerDocument) ? lang(lng_in_dlg_sticker) : (_doc->type == AnimatedDocument ? qsl("GIF") : (_doc->name.isEmpty() ? lang(lng_mediaview_doc_image) : _doc->name));
} else {
_docName = lang(lng_message_empty);
}
_docNameWidth = st::mvDocNameFont->width(_docName);
_docNameWidth = st::mediaviewFileNameFont->width(_docName);
if (_docNameWidth > maxw) {
_docName = st::mvDocNameFont->elided(_docName, maxw, Qt::ElideMiddle);
_docNameWidth = st::mvDocNameFont->width(_docName);
_docName = st::mediaviewFileNameFont->elided(_docName, maxw, Qt::ElideMiddle);
_docNameWidth = st::mediaviewFileNameFont->width(_docName);
}
// _docSize is updated in updateControls()
_docRect = QRect((width() - st::mvDocSize.width()) / 2, (height() - st::mvDocSize.height()) / 2, st::mvDocSize.width(), st::mvDocSize.height());
_docIconRect = myrtlrect(_docRect.x() + st::mvDocPadding, _docRect.y() + st::mvDocPadding, st::mvDocIconSize, st::mvDocIconSize);
_docRect = QRect((width() - st::mediaviewFileSize.width()) / 2, (height() - st::mediaviewFileSize.height()) / 2, st::mediaviewFileSize.width(), st::mediaviewFileSize.height());
_docIconRect = myrtlrect(_docRect.x() + st::mediaviewFilePadding, _docRect.y() + st::mediaviewFilePadding, st::mediaviewFileIconSize, st::mediaviewFileIconSize);
} else if (!_current.isNull()) {
_current.setDevicePixelRatio(cRetinaFactor());
_w = convertScale(_current.width());
@ -1348,7 +1348,7 @@ void MediaView::initAnimation() {
_current = _doc->thumb->pixNoCache(w, h, ImagePixSmooth | ImagePixBlurred, w / cIntRetinaFactor(), h / cIntRetinaFactor());
if (cRetina()) _current.setDevicePixelRatio(cRetinaFactor());
} else {
_current = _doc->thumb->pixNoCache(_doc->thumb->width(), _doc->thumb->height(), ImagePixSmooth | ImagePixBlurred, st::mvDocIconSize, st::mvDocIconSize);
_current = _doc->thumb->pixNoCache(_doc->thumb->width(), _doc->thumb->height(), ImagePixSmooth | ImagePixBlurred, st::mediaviewFileIconSize, st::mediaviewFileIconSize);
}
}
@ -1364,7 +1364,7 @@ void MediaView::createClipReader() {
_current = _doc->thumb->pixNoCache(w, h, ImagePixSmooth | ImagePixBlurred, w / cIntRetinaFactor(), h / cIntRetinaFactor());
if (cRetina()) _current.setDevicePixelRatio(cRetinaFactor());
} else {
_current = _doc->thumb->pixNoCache(_doc->thumb->width(), _doc->thumb->height(), ImagePixSmooth | ImagePixBlurred, st::mvDocIconSize, st::mvDocIconSize);
_current = _doc->thumb->pixNoCache(_doc->thumb->width(), _doc->thumb->height(), ImagePixSmooth | ImagePixBlurred, st::mediaviewFileIconSize, st::mediaviewFileIconSize);
}
auto mode = _doc->isVideo() ? Media::Clip::Reader::Mode::Video : Media::Clip::Reader::Mode::Gif;
_gif = std_::make_unique<Media::Clip::Reader>(_doc->location(), _doc->data(), [this](Media::Clip::Notification notification) {
@ -1545,12 +1545,11 @@ void MediaView::paintEvent(QPaintEvent *e) {
p.setCompositionMode(QPainter::CompositionMode_Source);
if (_fullScreenVideo) {
for (int i = 0, l = region.rectCount(); i < l; ++i) {
p.fillRect(rs.at(i), st::black);
p.fillRect(rs.at(i), st::mediaviewVideoBg);
}
} else {
p.setOpacity(st::mvBgOpacity);
for (int i = 0, l = region.rectCount(); i < l; ++i) {
p.fillRect(rs.at(i), st::mvBgColor);
p.fillRect(rs.at(i), st::mediaviewBg);
}
p.setCompositionMode(m);
}
@ -1605,8 +1604,8 @@ void MediaView::paintEvent(QPaintEvent *e) {
auto inner = radialRect();
p.setPen(Qt::NoPen);
p.setBrush(st::black);
p.setOpacity(radialOpacity * st::radialBgOpacity);
p.setOpacity(radialOpacity);
p.setBrush(st::radialBg);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
@ -1614,7 +1613,7 @@ void MediaView::paintEvent(QPaintEvent *e) {
p.setOpacity(1);
QRect arc(inner.marginsRemoved(QMargins(st::radialLine, st::radialLine, st::radialLine, st::radialLine)));
_radial.draw(p, arc, st::radialLine, st::white);
_radial.draw(p, arc, st::radialLine, st::radialFg);
}
} else if (_doc) {
paintDocRadialLoading(p, radial, radialOpacity);
@ -1634,7 +1633,7 @@ void MediaView::paintEvent(QPaintEvent *e) {
App::roundRect(p, _saveMsg, st::medviewSaveMsg, MediaviewSaveCorners);
st::medviewSaveMsgCheck.paint(p, _saveMsg.topLeft() + st::medviewSaveMsgCheckPos, width());
p.setPen(st::white->p);
p.setPen(st::medviewSaveMsgFg);
textstyleSet(&st::medviewSaveAsTextStyle);
_saveMsgText.draw(p, _saveMsg.x() + st::medviewSaveMsgPadding.left(), _saveMsg.y() + st::medviewSaveMsgPadding.top(), _saveMsg.width() - st::medviewSaveMsgPadding.left() - st::medviewSaveMsgPadding.right());
textstyleRestore();
@ -1651,7 +1650,7 @@ void MediaView::paintEvent(QPaintEvent *e) {
}
} else {
if (_docRect.intersects(r)) {
p.fillRect(_docRect, st::mvDocBg);
p.fillRect(_docRect, st::mediaviewFileBg);
if (_docIconRect.intersects(r)) {
bool radial = false;
float64 radialOpacity = 0;
@ -1664,15 +1663,15 @@ void MediaView::paintEvent(QPaintEvent *e) {
p.fillRect(_docIconRect, _docIconColor->b);
if ((!_doc || _doc->loaded()) && (!radial || radialOpacity < 1) && _docIcon) {
_docIcon->paint(p, _docIconRect.x() + (_docIconRect.width() - _docIcon->width()), _docIconRect.y(), width());
p.setPen(st::mvDocExtColor->p);
p.setFont(st::mvDocExtFont->f);
p.setPen(st::mediaviewFileExtFg);
p.setFont(st::mediaviewFileExtFont);
if (!_docExt.isEmpty()) {
p.drawText(_docIconRect.x() + (_docIconRect.width() - _docExtWidth) / 2, _docIconRect.y() + st::mvDocExtTop + st::mvDocExtFont->ascent, _docExt);
p.drawText(_docIconRect.x() + (_docIconRect.width() - _docExtWidth) / 2, _docIconRect.y() + st::mediaviewFileExtTop + st::mediaviewFileExtFont->ascent, _docExt);
}
}
} else {
int32 rf(cIntRetinaFactor());
p.drawPixmap(_docIconRect.topLeft(), _doc->thumb->pix(_docThumbw), QRect(_docThumbx * rf, _docThumby * rf, st::mvDocIconSize * rf, st::mvDocIconSize * rf));
p.drawPixmap(_docIconRect.topLeft(), _doc->thumb->pix(_docThumbw), QRect(_docThumbx * rf, _docThumby * rf, st::mediaviewFileIconSize * rf, st::mediaviewFileIconSize * rf));
}
paintDocRadialLoading(p, radial, radialOpacity);
@ -1680,13 +1679,13 @@ void MediaView::paintEvent(QPaintEvent *e) {
if (!_docIconRect.contains(r)) {
name = true;
p.setPen(st::mvDocNameColor);
p.setFont(st::mvDocNameFont);
p.drawTextLeft(_docRect.x() + 2 * st::mvDocPadding + st::mvDocIconSize, _docRect.y() + st::mvDocPadding + st::mvDocNameTop, width(), _docName, _docNameWidth);
p.setPen(st::mediaviewFileNameFg);
p.setFont(st::mediaviewFileNameFont);
p.drawTextLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileNameTop, width(), _docName, _docNameWidth);
p.setPen(st::mvDocSizeColor);
p.setPen(st::mediaviewFileSizeFg);
p.setFont(st::mvFont);
p.drawTextLeft(_docRect.x() + 2 * st::mvDocPadding + st::mvDocIconSize, _docRect.y() + st::mvDocPadding + st::mvDocSizeTop, width(), _docSize, _docSizeWidth);
p.drawTextLeft(_docRect.x() + 2 * st::mediaviewFilePadding + st::mediaviewFileIconSize, _docRect.y() + st::mediaviewFilePadding + st::mediaviewFileSizeTop, width(), _docSize, _docSizeWidth);
}
}
}
@ -1697,10 +1696,10 @@ void MediaView::paintEvent(QPaintEvent *e) {
if (_leftNav.intersects(r) && _leftNavVisible) {
auto o = overLevel(OverLeftNav);
if (o > 0) {
p.setOpacity(o * st::mvControlBgOpacity * co);
p.setOpacity(o * co);
for (int i = 0, l = region.rectCount(); i < l; ++i) {
auto fill = _leftNav.intersected(rs.at(i));
if (!fill.isEmpty()) p.fillRect(fill, st::black->b);
if (!fill.isEmpty()) p.fillRect(fill, st::mediaviewControlBg);
}
}
if (_leftNavIcon.intersects(r)) {
@ -1713,10 +1712,10 @@ void MediaView::paintEvent(QPaintEvent *e) {
if (_rightNav.intersects(r) && _rightNavVisible) {
auto o = overLevel(OverRightNav);
if (o > 0) {
p.setOpacity(o * st::mvControlBgOpacity * co);
p.setOpacity(o * co);
for (int i = 0, l = region.rectCount(); i < l; ++i) {
auto fill = _rightNav.intersected(rs.at(i));
if (!fill.isEmpty()) p.fillRect(fill, st::black);
if (!fill.isEmpty()) p.fillRect(fill, st::mediaviewControlBg);
}
}
if (_rightNavIcon.intersects(r)) {
@ -1729,10 +1728,10 @@ void MediaView::paintEvent(QPaintEvent *e) {
if (_closeNav.intersects(r)) {
auto o = overLevel(OverClose);
if (o > 0) {
p.setOpacity(o * st::mvControlBgOpacity * co);
p.setOpacity(o * co);
for (int i = 0, l = region.rectCount(); i < l; ++i) {
auto fill = _closeNav.intersected(rs.at(i));
if (!fill.isEmpty()) p.fillRect(fill, st::black);
if (!fill.isEmpty()) p.fillRect(fill, st::mediaviewControlBg);
}
}
if (_closeNavIcon.intersects(r)) {
@ -1755,12 +1754,12 @@ void MediaView::paintEvent(QPaintEvent *e) {
st::mediaviewMore.paintInCenter(p, _moreNavIcon);
}
p.setPen(st::white);
p.setPen(st::mvControlFg);
p.setFont(st::mvThickFont);
// header
if (_headerNav.intersects(r)) {
float64 o = _headerHasLink ? overLevel(OverHeader) : 0;
auto o = _headerHasLink ? overLevel(OverHeader) : 0;
p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co);
p.drawText(_headerNav.left(), _headerNav.top() + st::mvThickFont->ascent, _headerText);
@ -1770,7 +1769,7 @@ void MediaView::paintEvent(QPaintEvent *e) {
}
}
p.setFont(st::mvFont->f);
p.setFont(st::mvFont);
// name
if (_from && _nameNav.intersects(r)) {
@ -1801,12 +1800,12 @@ void MediaView::paintEvent(QPaintEvent *e) {
QRect outer(_captionRect.marginsAdded(st::mvCaptionPadding));
if (outer.intersects(r)) {
p.setOpacity(co);
p.setBrush(st::mvCaptionBg->b);
p.setBrush(st::mvCaptionBg);
p.setPen(Qt::NoPen);
p.drawRoundedRect(outer, st::mvCaptionRadius, st::mvCaptionRadius);
if (_captionRect.intersects(r)) {
textstyleSet(&st::medviewSaveAsTextStyle);
p.setPen(st::white->p);
p.setPen(st::mvCaptionFg);
_caption.drawElided(p, _captionRect.x(), _captionRect.y(), _captionRect.width(), _captionRect.height() / st::mvCaptionFont->height);
textstyleRestore();
}
@ -1829,7 +1828,7 @@ void MediaView::paintDocRadialLoading(Painter &p, bool radial, float64 radialOpa
p.setBrush(st::msgDateImgBgOver);
} else {
p.setOpacity((st::msgDateImgBg->c.alphaF() * (1 - o)) + (st::msgDateImgBgOver->c.alphaF() * o));
p.setBrush(st::black);
p.setBrush(style::interpolate(st::msgDateImgBg, st::msgDateImgBgOver, o));
}
p.setRenderHint(QPainter::HighQualityAntialiasing);
@ -1849,7 +1848,7 @@ void MediaView::paintDocRadialLoading(Painter &p, bool radial, float64 radialOpa
if (radial) {
p.setOpacity(1);
QRect arc(inner.marginsRemoved(QMargins(st::radialLine, st::radialLine, st::radialLine, st::radialLine)));
_radial.draw(p, arc, st::radialLine, st::white);
_radial.draw(p, arc, st::radialLine, st::radialFg);
}
}
}

View file

@ -58,10 +58,14 @@ overviewPhotoChecked: icon {
};
overviewPhotoSelectOverlay: #0a7bb03f;
overviewVideoBg: #000000;
overviewFileThumbBg: #000000;
overviewFileChecked: #2fa9e2;
overviewFileCheck: #00000066;
overviewFileExtPadding: 5px;
overviewFileExtTop: 24px;
overviewFileExtFg: #ffffff;
overviewFileExtFont: font(18px semibold);
overviewFileLayout: OverviewFileLayout {
@ -93,8 +97,10 @@ playlistPadding: 10px;
linksSearchMargin: margins(20px, 20px, 20px, 0px);
linksMaxWidth: 520px;
linksLetterFg: #ffffff;
linksLetterFont: font(24px);
linksMargin: margins(0px, 7px, 0px, 5px);
linksTextFg: #000000;
linksTextTop: 6px;
linksBorder: 1px;
linksBorderFg: #eaeaea;

View file

@ -310,7 +310,7 @@ void Video::paint(Painter &p, const QRect &clip, TextSelection selection, const
statusX = _width - statusW + statusX;
p.fillRect(rtlrect(statusX - st::msgDateImgPadding.x(), statusY - st::msgDateImgPadding.y(), statusW, statusH, _width), selected ? st::msgDateImgBgSelected : st::msgDateImgBg);
p.setFont(st::normalFont);
p.setPen(st::white);
p.setPen(st::msgDateImgColor);
p.drawTextLeft(statusX, statusY, _width, _statusText, statusW - 2 * st::msgDateImgPadding.x());
}
}
@ -320,7 +320,7 @@ void Video::paint(Painter &p, const QRect &clip, TextSelection selection, const
int32 statusH = st::normalFont->height + 2 * st::msgDateImgPadding.y();
p.fillRect(rtlrect(statusX - st::msgDateImgPadding.x(), statusY - st::msgDateImgPadding.y(), statusW, statusH, _width), selected ? st::msgDateImgBgSelected : st::msgDateImgBg);
p.setFont(st::normalFont);
p.setPen(st::white);
p.setPen(st::msgDateImgColor);
p.drawTextLeft(statusX, statusY, _width, _duration, statusW - 2 * st::msgDateImgPadding.x());
}
@ -331,11 +331,10 @@ void Video::paint(Painter &p, const QRect &clip, TextSelection selection, const
p.setBrush(st::msgDateImgBgSelected);
} else if (_a_iconOver.animating()) {
_a_iconOver.step(context->ms);
float64 over = a_iconOver.current();
p.setOpacity((st::msgDateImgBg->c.alphaF() * (1 - over)) + (st::msgDateImgBgOver->c.alphaF() * over));
p.setBrush(st::black);
auto over = a_iconOver.current();
p.setBrush(style::interpolate(st::msgDateImgBg, st::msgDateImgBgOver, over));
} else {
bool over = ClickHandler::showAsActive(loaded ? _openl : (_data->loading() ? _cancell : _savel));
auto over = ClickHandler::showAsActive(loaded ? _openl : (_data->loading() ? _cancell : _savel));
p.setBrush(over ? st::msgDateImgBgOver : st::msgDateImgBg);
}
@ -488,7 +487,7 @@ void Voice::paint(Painter &p, const QRect &clip, TextSelection selection, const
int32 namewidth = _width - nameleft - nameright;
if (clip.intersects(rtlrect(nameleft, nametop, namewidth, st::semiboldFont->height, _width))) {
p.setPen(st::black);
p.setPen(st::historyFileNameInFg);
_name.drawLeftElided(p, nameleft, nametop, namewidth, _width);
}
@ -718,13 +717,13 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con
}
p.drawPixmap(rthumb.topLeft(), _thumb);
} else {
p.fillRect(rthumb, st::black);
p.fillRect(rthumb, st::overviewFileThumbBg);
}
} else {
p.fillRect(rthumb, documentColor(_colorIndex));
if (!radial && loaded && !_ext.isEmpty()) {
p.setFont(st::overviewFileExtFont);
p.setPen(st::white);
p.setPen(st::overviewFileExtFg);
p.drawText(rthumb.left() + (rthumb.width() - _extw) / 2, rthumb.top() + st::overviewFileExtTop + st::overviewFileExtFont->ascent, _ext);
}
}
@ -735,21 +734,16 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con
if (radial || (!loaded && !_data->loading())) {
QRect inner(rthumb.x() + (rthumb.width() - _st.songThumbSize) / 2, rthumb.y() + (rthumb.height() - _st.songThumbSize) / 2, _st.songThumbSize, _st.songThumbSize);
if (clip.intersects(inner)) {
float64 radialOpacity = (radial && loaded && !_data->uploading()) ? _radial->opacity() : 1;
auto radialOpacity = (radial && loaded && !_data->uploading()) ? _radial->opacity() : 1;
p.setPen(Qt::NoPen);
if (selected) {
p.setBrush(wthumb ? st::msgDateImgBgSelected : documentSelectedColor(_colorIndex));
} else if (_a_iconOver.animating()) {
_a_iconOver.step(context->ms);
float64 over = a_iconOver.current();
if (wthumb) {
p.setOpacity((st::msgDateImgBg->c.alphaF() * (1 - over)) + (st::msgDateImgBgOver->c.alphaF() * over));
p.setBrush(st::black);
} else {
p.setBrush(style::interpolate(documentDarkColor(_colorIndex), documentOverColor(_colorIndex), over));
}
auto over = a_iconOver.current();
p.setBrush(style::interpolate(wthumb ? st::msgDateImgBg : documentDarkColor(_colorIndex), wthumb ? st::msgDateImgBgOver : documentOverColor(_colorIndex), over));
} else {
bool over = ClickHandler::showAsActive(_data->loading() ? _cancell : _savel);
auto over = ClickHandler::showAsActive(_data->loading() ? _cancell : _savel);
p.setBrush(over ? (wthumb ? st::msgDateImgBgOver : documentOverColor(_colorIndex)) : (wthumb ? st::msgDateImgBg : documentDarkColor(_colorIndex)));
}
p.setOpacity(radialOpacity * p.opacity());
@ -785,7 +779,7 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con
int availwidth = _width - nameleft - nameright;
int namewidth = qMin(availwidth, _name.maxWidth());
if (clip.intersects(rtlrect(nameleft, nametop, namewidth, st::semiboldFont->height, _width))) {
p.setPen(st::black);
p.setPen(st::historyFileNameInFg);
_name.drawLeftElided(p, nameleft, nametop, namewidth, _width);
}
@ -1072,8 +1066,8 @@ void Link::paint(Painter &p, const QRect &clip, TextSelection selection, const P
}
if (!_letter.isEmpty()) {
p.setFont(st::linksLetterFont->f);
p.setPen(st::white->p);
p.setFont(st::linksLetterFont);
p.setPen(st::linksLetterFg);
p.drawText(rtlrect(0, top, st::linksPhotoSize, st::linksPhotoSize, _width), _letter, style::al_center);
}
}
@ -1092,7 +1086,7 @@ void Link::paint(Painter &p, const QRect &clip, TextSelection selection, const P
top = st::linksTextTop;
}
p.setPen(st::black);
p.setPen(st::linksTextFg);
p.setFont(st::semiboldFont);
if (!_title.isEmpty()) {
if (clip.intersects(rtlrect(left, top, qMin(w, _titlew), st::semiboldFont->height, _width))) {
@ -1100,7 +1094,7 @@ void Link::paint(Painter &p, const QRect &clip, TextSelection selection, const P
}
top += st::semiboldFont->height;
}
p.setFont(st::msgFont->f);
p.setFont(st::msgFont);
if (!_text.isEmpty()) {
int32 h = qMin(st::normalFont->height * 3, _text.countHeight(w));
if (clip.intersects(rtlrect(left, top, w, h, _width))) {

View file

@ -1942,8 +1942,8 @@ void OverviewWidget::paintEvent(QPaintEvent *e) {
int inCacheTop = st::topBarHeight;
if (a_coordOver.current() > 0) {
p.drawPixmap(QRect(0, 0, a_coordOver.current(), height()), _cacheUnder, QRect(-a_coordUnder.current() * retina, inCacheTop * retina, a_coordOver.current() * retina, height() * retina));
p.setOpacity(a_progress.current() * st::slideFadeOut);
p.fillRect(0, 0, a_coordOver.current(), height(), st::black);
p.setOpacity(a_progress.current());
p.fillRect(0, 0, a_coordOver.current(), height(), st::slideFadeOutBg);
p.setOpacity(1);
}
p.drawPixmap(QRect(a_coordOver.current(), 0, _cacheOver.width() / retina, height()), _cacheOver, QRect(0, inCacheTop * retina, _cacheOver.width(), height() * retina));
@ -1952,7 +1952,7 @@ void OverviewWidget::paintEvent(QPaintEvent *e) {
return;
}
p.fillRect(e->rect(), st::white);
p.fillRect(e->rect(), st::windowBg);
}
void OverviewWidget::contextMenuEvent(QContextMenuEvent *e) {
@ -1976,8 +1976,8 @@ void OverviewWidget::paintTopBar(Painter &p, float64 over, int32 decreaseWidth)
int retina = cIntRetinaFactor();
if (a_coordOver.current() > 0) {
p.drawPixmap(QRect(0, 0, a_coordOver.current(), st::topBarHeight), _cacheUnder, QRect(-a_coordUnder.current() * retina, 0, a_coordOver.current() * retina, st::topBarHeight * retina));
p.setOpacity(a_progress.current() * st::slideFadeOut);
p.fillRect(0, 0, a_coordOver.current(), st::topBarHeight, st::black);
p.setOpacity(a_progress.current());
p.fillRect(0, 0, a_coordOver.current(), st::topBarHeight, st::slideFadeOutBg);
p.setOpacity(1);
}
p.drawPixmap(QRect(a_coordOver.current(), 0, _cacheOver.width() / retina, st::topBarHeight), _cacheOver, QRect(0, 0, _cacheOver.width(), st::topBarHeight * retina));

View file

@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwindow.h"
#include "application.h"
#include "ui/text/text.h"
#include "styles/style_boxes.h"
PasscodeWidget::PasscodeWidget(QWidget *parent) : TWidget(parent)
, _a_show(animation(this, &PasscodeWidget::step_show))
@ -180,8 +181,8 @@ void PasscodeWidget::paintEvent(QPaintEvent *e) {
if (_a_show.animating()) {
if (a_coordOver.current() > 0) {
p.drawPixmap(QRect(0, 0, a_coordOver.current(), height()), _cacheUnder, QRect(-a_coordUnder.current() * cRetinaFactor(), 0, a_coordOver.current() * cRetinaFactor(), height() * cRetinaFactor()));
p.setOpacity(a_shadow.current() * st::slideFadeOut);
p.fillRect(0, 0, a_coordOver.current(), height(), st::black->b);
p.setOpacity(a_shadow.current());
p.fillRect(0, 0, a_coordOver.current(), height(), st::slideFadeOutBg);
p.setOpacity(1);
}
p.drawPixmap(a_coordOver.current(), 0, _cacheOver);
@ -190,12 +191,13 @@ void PasscodeWidget::paintEvent(QPaintEvent *e) {
} else {
p.fillRect(rect(), st::windowBg);
p.setFont(st::passcodeHeaderFont->f);
p.setFont(st::passcodeHeaderFont);
p.setPen(st::windowTextFg);
p.drawText(QRect(0, _passcode.y() - st::passcodeHeaderHeight, width(), st::passcodeHeaderHeight), lang(lng_passcode_enter), style::al_center);
if (!_error.isEmpty()) {
p.setFont(st::boxTextFont->f);
p.setPen(st::setErrColor->p);
p.setFont(st::boxTextFont);
p.setPen(st::boxTextFgError);
p.drawText(QRect(0, _passcode.y() + _passcode.height(), width(), st::passcodeSubmitSkip), _error, style::al_center);
}
}

View file

@ -103,7 +103,9 @@ QImage _trayIconImageGen() {
} else if (_trayIconSize >= 32) {
layerSize = -20;
}
QImage layer = App::wnd()->iconWithCounter(layerSize, counter, (muted ? st::counterMuteBg : st::counterBg), false);
auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg);
auto &fg = st::trayCounterFg;
auto layer = App::wnd()->iconWithCounter(layerSize, counter, bg, fg, false);
p.drawImage(_trayIconImage.width() - layer.width() - 1, _trayIconImage.height() - layer.height() - 1, layer);
}
}
@ -355,9 +357,10 @@ void MainWindow::psUpdateCounter() {
int32 counter = App::histories().unreadBadge();
bool muted = App::histories().unreadOnlyMuted();
auto &bg = (muted ? st::counterMuteBg : st::counterBg);
icon.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(16, counter, bg, true)));
icon.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(32, counter, bg, true)));
auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg);
auto &fg = st::trayCounterFg;
icon.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(16, counter, bg, fg, true)));
icon.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(32, counter, bg, fg, true)));
}
trayIcon->setIcon(icon);
}

View file

@ -60,7 +60,7 @@ public:
bool psHasNativeNotifications();
virtual QImage iconWithCounter(int size, int count, const style::color &bg, bool smallIcon) = 0;
virtual QImage iconWithCounter(int size, int count, const style::color &bg, const style::color &fg, bool smallIcon) = 0;
static void LibsLoaded();

View file

@ -73,7 +73,7 @@ public:
return !(QSysInfo::macVersion() < QSysInfo::MV_10_8);
}
virtual QImage iconWithCounter(int size, int count, const style::color &bg, bool smallIcon) = 0;
virtual QImage iconWithCounter(int size, int count, const style::color &bg, const style::color &fg, bool smallIcon) = 0;
void closeWithoutDestroy() override;

View file

@ -176,14 +176,14 @@ void MainWindow::psUpdateCounter() {
bool muted = App::histories().unreadOnlyMuted();
bool dm = objc_darkMode();
auto &bg = (muted ? st::counterMuteBg : st::counterBg);
auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg);
QIcon icon;
QImage img(psTrayIcon(dm)), imgsel(psTrayIcon(true));
img.detach();
imgsel.detach();
int32 size = cRetina() ? 44 : 22;
_placeCounter(img, size, counter, bg, (dm && muted) ? st::counterMacInvFg : st::counterFg);
_placeCounter(imgsel, size, counter, st::white, st::counterMacInvColor);
_placeCounter(img, size, counter, bg, (dm && muted) ? st::trayCounterFgMacInvert : st::trayCounterFg);
_placeCounter(imgsel, size, counter, st::trayCounterBgMacInvert, st::trayCounterFgMacInvert);
icon.addPixmap(App::pixmapFromImageInPlace(std_::move(img)));
icon.addPixmap(App::pixmapFromImageInPlace(std_::move(imgsel)), QIcon::Selected);
trayIcon->setIcon(icon);

View file

@ -718,14 +718,15 @@ void MainWindow::psUpdateCounter() {
auto iconSizeSmall = QSize(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON));
auto iconSizeBig = QSize(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON));
auto bg = (muted ? st::counterMuteBg : st::counterBg);
auto iconSmallPixmap16 = App::pixmapFromImageInPlace(iconWithCounter(16, counter, bg, true));
auto iconSmallPixmap32 = App::pixmapFromImageInPlace(iconWithCounter(32, counter, bg, true));
auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg);
auto &fg = st::trayCounterFg;
auto iconSmallPixmap16 = App::pixmapFromImageInPlace(iconWithCounter(16, counter, bg, fg, true));
auto iconSmallPixmap32 = App::pixmapFromImageInPlace(iconWithCounter(32, counter, bg, fg, true));
QIcon iconSmall, iconBig;
iconSmall.addPixmap(iconSmallPixmap16);
iconSmall.addPixmap(iconSmallPixmap32);
iconBig.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(32, taskbarList.Get() ? 0 : counter, bg, false)));
iconBig.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(64, taskbarList.Get() ? 0 : counter, bg, false)));
iconBig.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(32, taskbarList.Get() ? 0 : counter, bg, fg, false)));
iconBig.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(64, taskbarList.Get() ? 0 : counter, bg, fg, false)));
if (trayIcon) {
// Force Qt to use right icon size, not the larger one.
QIcon forTrayIcon;
@ -742,8 +743,8 @@ void MainWindow::psUpdateCounter() {
if (taskbarList.Get()) {
if (counter > 0) {
QIcon iconOverlay;
iconOverlay.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(-16, counter, bg, false)));
iconOverlay.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(-32, counter, bg, false)));
iconOverlay.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(-16, counter, bg, fg, false)));
iconOverlay.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(-32, counter, bg, fg, false)));
ps_iconOverlay = createHIconFromQIcon(iconOverlay, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON));
}
auto description = (counter > 0) ? lng_unread_bar(lt_count, counter) : LangString();

View file

@ -67,7 +67,7 @@ public:
bool psHasNativeNotifications();
virtual QImage iconWithCounter(int size, int count, const style::color &bg, bool smallIcon) = 0;
virtual QImage iconWithCounter(int size, int count, const style::color &bg, const style::color &fg, bool smallIcon) = 0;
static UINT TaskbarCreatedMsgId() {
return _taskbarCreatedMsgId;

View file

@ -28,8 +28,7 @@ profileTopBarBackIconPosition: point(12px, 20px);
profileTopBarBackFont: font(14px);
profileTopBarBackFg: #1485c2;
profileTopBarBackPosition: point(32px, 17px);
profileFixedBarButton: RoundButton(topBarButton) {
}
profileFixedBarButton: topBarButton;
profileMarginTop: 13px;
profilePhotoSize: 112px;
@ -57,18 +56,11 @@ profileMarginBottom: 30px;
profileButtonLeft: 27px;
profileButtonTop: 88px;
profileButtonSkip: 10px;
profilePrimaryButton: RoundButton(defaultActiveButton) {
}
profileSecondaryButton: RoundButton(profilePrimaryButton) {
textFg: semiboldButtonBlueText;
textFgOver: semiboldButtonBlueText;
textBg: #ffffff;
textBgOver: #f2f7fa;
}
profileAddMemberIcon: icon {{ "profile_add_member", windowActiveFill, point(20px, 10px) }};
profilePrimaryButton: defaultActiveButton;
profileSecondaryButton: defaultLightButton;
profileAddMemberButton: RoundButton(profileSecondaryButton) {
width: 62px;
icon: profileAddMemberIcon;
icon: icon {{ "profile_add_member", windowActiveFill, point(20px, 10px) }};
}
profileDropAreaBg: profileBg;

View file

@ -22,6 +22,7 @@ using "basic.style";
using "basic_types.style";
using "dialogs/dialogs.style";
using "ui/widgets/widgets.style";
using "boxes/boxes.style";
settingsMaxWidth: 520px;
settingsMaxPadding: 48px;
@ -33,16 +34,15 @@ settingsFixedBarFont: font(14px semibold);
settingsFixedBarFg: windowTextFg;
settingsFixedBarTextLeft: 20px;
settingsFixedBarTextTop: 16px;
settingsFixedBarClose: IconButton(defaultIconButton) {
settingsFixedBarClose: MaskButton(defaultMaskButton) {
width: settingsFixedBarHeight;
height: settingsFixedBarHeight;
opacity: 0.31;
overOpacity: 0.5;
bg: settingsFixedBarBg;
icon: settingsFixedBarCloseIcon;
icon: boxCancelIcon;
iconPosition: point(20px, 20px);
downIconPosition: point(20px, 20px);
iconBg: settingsCloseFg;
iconBgOver: settingsCloseFgOver;
}
settingsFixedBarShadowBg1: #00000021;
settingsFixedBarShadowBg2: #0000000b;
@ -72,31 +72,16 @@ settingsMarginBottom: 35px;
settingsButtonLeft: 27px;
settingsButtonTop: 75px;
settingsButtonSkip: 10px;
settingsPrimaryButton: RoundButton(defaultActiveButton) {
}
settingsSecondaryButton: RoundButton(settingsPrimaryButton) {
textFg: semiboldButtonBlueText;
textFgOver: semiboldButtonBlueText;
textBg: #ffffff;
textBgOver: #f2f7fa;
}
settingsEditButton: RoundButton {
settingsPrimaryButton: defaultActiveButton;
settingsSecondaryButton: defaultLightButton;
settingsEditButton: IconButton(dialogsNewChatButton) {
width: 24px;
height: 34px;
icon: settingsEditIcon;
textTop: 0px;
downTextTop: 1px;
textFg: transparent;
textFgOver: transparent;
secondaryTextFg: transparent;
secondaryTextFgOver: transparent;
textBg: transparent;
textBgOver: transparent;
iconPosition: point(3px, 9px);
downIconPosition: point(3px, 10px);
}
settingsBlocksTop: 7px;
settingsBlocksBottom: 20px;
settingsBlockMarginTop: 14px;

View file

@ -65,8 +65,8 @@ void BackgroundRow::paintEvent(QPaintEvent *e) {
auto outer = radialRect();
QRect inner(QPoint(outer.x() + (outer.width() - st::radialSize.width()) / 2, outer.y() + (outer.height() - st::radialSize.height()) / 2), st::radialSize);
p.setPen(Qt::NoPen);
p.setBrush(st::black);
p.setOpacity(radialOpacity * st::radialBgOpacity);
p.setOpacity(radialOpacity);
p.setBrush(st::radialBg);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
@ -74,7 +74,7 @@ void BackgroundRow::paintEvent(QPaintEvent *e) {
p.setOpacity(1);
QRect arc(inner.marginsRemoved(QMargins(st::radialLine, st::radialLine, st::radialLine, st::radialLine)));
_radial.draw(p, arc, st::radialLine, st::white);
_radial.draw(p, arc, st::radialLine, st::radialFg);
} else {
p.drawPixmap(0, 0, _background);
}

View file

@ -23,6 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/flatlabel.h"
#include "ui/buttons/round_button.h"
#include "ui/buttons/icon_button.h"
#include "observer_peer.h"
#include "lang.h"
#include "application.h"
@ -32,7 +33,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/confirmbox.h"
#include "boxes/photocropbox.h"
#include "boxes/addcontactbox.h"
#include "styles/style_settings.h"
#include "styles/style_profile.h" // for divider
@ -42,7 +42,7 @@ CoverWidget::CoverWidget(QWidget *parent, UserData *self) : BlockWidget(parent,
, _self(App::self())
, _userpicButton(this, _self)
, _name(this, st::settingsNameLabel)
, _editNameInline(this, QString(), st::settingsEditButton)
, _editNameInline(this, st::settingsEditButton)
, _setPhoto(this, lang(lng_settings_upload), st::settingsPrimaryButton)
, _editName(this, lang(lng_settings_edit), st::settingsSecondaryButton) {
setAcceptDrops(true);

View file

@ -30,6 +30,7 @@ class LinkButton;
namespace Ui {
class RoundButton;
class IconButton;
} // namespace Ui
namespace Notify {
@ -93,7 +94,7 @@ private:
ChildWidget<Profile::CoverDropArea> _dropArea = { nullptr };
ChildWidget<FlatLabel> _name;
ChildWidget<Ui::RoundButton> _editNameInline;
ChildWidget<Ui::IconButton> _editNameInline;
ChildWidget<LinkButton> _cancelPhotoUpload = { nullptr };
QPoint _statusPosition;

View file

@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "settings/settings_fixed_bar.h"
#include "styles/style_settings.h"
#include "styles/style_boxes.h"
#include "ui/buttons/icon_button.h"
#include "mainwindow.h"
#include "lang.h"
@ -30,6 +31,7 @@ namespace Settings {
FixedBar::FixedBar(QWidget *parent) : TWidget(parent)
, _close(this, st::settingsFixedBarClose) {
setAttribute(Qt::WA_OpaquePaintEvent);
_close->setClickedCallback([]() {
Ui::hideSettingsAndLayer();
});
@ -46,6 +48,8 @@ void FixedBar::resizeEvent(QResizeEvent *e) {
void FixedBar::paintEvent(QPaintEvent *e) {
Painter p(this);
p.fillRect(e->rect(), st::settingsFixedBarBg);
p.setFont(st::settingsFixedBarFont);
p.setPen(st::windowTextFg);
p.drawTextLeft(st::settingsFixedBarTextLeft, st::settingsFixedBarTextTop, width(), lang(lng_menu_settings));

View file

@ -21,7 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#pragma once
namespace Ui {
class IconButton;
class MaskButton;
} // namespace Ui
namespace Settings {
@ -37,7 +37,7 @@ protected:
int resizeGetHeight(int newWidth) override;
private:
ChildWidget<Ui::IconButton> _close;
ChildWidget<Ui::MaskButton> _close;
};

View file

@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "settings/settings_inner_widget.h"
#include "settings/settings_fixed_bar.h"
#include "styles/style_settings.h"
#include "styles/style_boxes.h"
#include "ui/widgets/shadow.h"
#include "ui/scrollarea.h"
#include "mainwindow.h"
@ -197,7 +198,7 @@ void Widget::showDone() {
void Widget::paintEvent(QPaintEvent *e) {
Painter p(this);
p.fillRect(rect(), st::windowBg);
p.fillRect(e->rect(), st::settingsBg);
}
void Widget::resizeEvent(QResizeEvent *e) {

View file

@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "stickers/emoji_pan.h"
#include "styles/style_stickers.h"
#include "styles/style_intro.h"
#include "ui/buttons/icon_button.h"
#include "boxes/confirmbox.h"
#include "boxes/stickersetbox.h"
@ -91,7 +92,7 @@ void EmojiColorPicker::paintEvent(QPaintEvent *e) {
_shadow.paint(p, r, st::defaultDropdownShadowShift);
if (_cache.isNull()) {
p.fillRect(e->rect().intersected(r), st::white);
p.fillRect(e->rect().intersected(r), st::emojiPanBg);
int32 x = w + 2 * st::emojiColorsPadding + st::emojiPanSize.width();
if (rtl()) x = width() - x - st::emojiColorsSep;
@ -342,7 +343,7 @@ void EmojiPanInner::paintEvent(QPaintEvent *e) {
if (r != rect()) {
p.setClipRect(r);
}
p.fillRect(r, st::white->b);
p.fillRect(r, st::emojiPanBg);
int32 fromcol = floorclamp(r.x() - st::emojiPanPadding, st::emojiPanSize.width(), 0, EmojiPanPerRow);
int32 tocol = ceilclamp(r.x() + r.width() - st::emojiPanPadding, st::emojiPanSize.width(), 0, EmojiPanPerRow);
@ -942,7 +943,7 @@ void StickerPanInner::paintEvent(QPaintEvent *e) {
if (r != rect()) {
p.setClipRect(r);
}
p.fillRect(r, st::white);
p.fillRect(r, st::emojiPanBg);
if (showingInlineItems()) {
paintInlineItems(p, r);
@ -2750,7 +2751,7 @@ void EmojiPan::paintEvent(QPaintEvent *e) {
if (_toCache.isNull()) {
if (_cache.isNull()) {
p.fillRect(myrtlrect(r.x() + r.width() - st::emojiScroll.width, r.y(), st::emojiScroll.width, e_scroll.height()), st::white->b);
p.fillRect(myrtlrect(r.x() + r.width() - st::emojiScroll.width, r.y(), st::emojiScroll.width, e_scroll.height()), st::emojiPanBg);
if (_stickersShown && s_inner.showSectionIcons()) {
p.fillRect(r.left(), _iconsTop, r.width(), st::emojiCategory.height, st::emojiPanCategories);
paintStickerSettingsIcon(p);
@ -2804,22 +2805,22 @@ void EmojiPan::paintEvent(QPaintEvent *e) {
float64 o_right = snap(float64(_iconsMax - _iconsX.current()) / st::stickerIconRight.width(), 0., 1.);
if (o_right > 0) {
p.setOpacity(o_right);
st::stickerIconRight.fill(p, rtlrect(width() - _iconsLeft - 7 * st::emojiCategory.width, _iconsTop, st::stickerIconRight.width(), st::emojiCategory.height, width()));
st::stickerIconRight.fill(p, rtlrect(_iconsLeft + 7 * st::emojiCategory.width - st::stickerIconRight.width(), _iconsTop, st::stickerIconRight.width(), st::emojiCategory.height, width()));
}
}
} else if (_stickersShown) {
int32 x = rtl() ? (_recent->x() + _recent->width()) : (_objects->x() + _objects->width());
p.fillRect(x, _recent->y(), r.left() + r.width() - x, st::emojiCategory.height, st::white);
p.fillRect(x, _recent->y(), r.left() + r.width() - x, st::emojiCategory.height, st::emojiPanBg);
} else {
p.fillRect(r.left(), _iconsTop, r.width(), st::emojiCategory.height, st::emojiPanCategories);
}
} else {
p.fillRect(r, st::white);
p.fillRect(r, st::emojiPanBg);
p.drawPixmap(r.left(), r.top(), _cache);
}
} else {
p.fillRect(QRect(r.left(), r.top(), r.width(), r.height() - st::emojiCategory.height), st::white->b);
p.fillRect(QRect(r.left(), _iconsTop, r.width(), st::emojiCategory.height), st::emojiPanCategories->b);
p.fillRect(QRect(r.left(), r.top(), r.width(), r.height() - st::emojiCategory.height), st::emojiPanBg);
p.fillRect(QRect(r.left(), _iconsTop, r.width(), st::emojiCategory.height), st::emojiPanCategories);
p.setOpacity(o * a_fromAlpha.current());
QRect fromDst = QRect(r.left() + a_fromCoord.current(), r.top(), _fromCache.width() / cIntRetinaFactor(), _fromCache.height() / cIntRetinaFactor());
QRect fromSrc = QRect(0, 0, _fromCache.width(), _fromCache.height());

View file

@ -56,7 +56,7 @@ stickersFeaturedUnreadBg: msgFileInBg;
stickersFeaturedUnreadSize: 5px;
stickersFeaturedUnreadSkip: 5px;
stickersFeaturedUnreadTop: 7px;
stickersFeaturedInstalled: icon {{ "mediaview_save_check", #40ace3 }};
stickersFeaturedInstalled: icon {{ "mediaview_save_check", windowActiveFill }};
stickersMaxHeight: 440px;
stickersPadding: margins(19px, 17px, 19px, 17px);

View file

@ -58,8 +58,8 @@ TitleWidget::Hider::Hider(QWidget *parent) : TWidget(parent) {
void TitleWidget::Hider::paintEvent(QPaintEvent *e) {
QPainter p(this);
p.setOpacity(_level * st::layerAlpha);
p.fillRect(App::main()->dlgsWidth(), 0, width() - App::main()->dlgsWidth(), height(), st::layerBg->b);
p.setOpacity(_level);
p.fillRect(App::main()->dlgsWidth(), 0, width() - App::main()->dlgsWidth(), height(), st::layerBg);
}
void TitleWidget::Hider::mousePressEvent(QMouseEvent *e) {
@ -325,8 +325,6 @@ void TitleWidget::updateCounter() {
int32 counter = App::histories().unreadBadge();
bool muted = App::histories().unreadOnlyMuted();
auto &bg = (muted ? st::counterMuteBg : st::counterBg);
if (counter > 0) {
int32 size = cRetina() ? -32 : -16;
switch (cScale()) {
@ -334,7 +332,9 @@ void TitleWidget::updateCounter() {
case dbisOneAndHalf: size = -24; break;
case dbisTwo: size = -32; break;
}
_counter = App::pixmapFromImageInPlace(App::wnd()->iconWithCounter(size, counter, bg, false));
auto &bg = (muted ? st::titleCounterBgMute : st::titleCounterBg);
auto &fg = st::titleCounterFg;
_counter = App::pixmapFromImageInPlace(App::wnd()->iconWithCounter(size, counter, bg, fg, false));
_counter.setDevicePixelRatio(cRetinaFactor());
update(QRect(st::titleCounterPosition, _counter.size() / cIntRetinaFactor()));
} else {

View file

@ -182,7 +182,7 @@ void Checkbox::paintEvent(QPaintEvent *e) {
QRect r(e->rect());
p.setClipRect(r);
p.fillRect(r, _st.textBg->b);
p.fillRect(r, _st.textBg);
if (_checkRect.intersects(r)) {
p.setRenderHint(QPainter::HighQualityAntialiasing);
@ -196,12 +196,12 @@ void Checkbox::paintEvent(QPaintEvent *e) {
pen.setWidth(_st.thickness);
p.setPen(pen);
if (checked > 0) {
color.setRedF(color.redF() * checked + st::white->c.redF() * (1. - checked));
color.setGreenF(color.greenF() * checked + st::white->c.greenF() * (1. - checked));
color.setBlueF(color.blueF() * checked + st::white->c.blueF() * (1. - checked));
color.setRedF(color.redF() * checked + _st.checkBg->c.redF() * (1. - checked));
color.setGreenF(color.greenF() * checked + _st.checkBg->c.greenF() * (1. - checked));
color.setBlueF(color.blueF() * checked + _st.checkBg->c.blueF() * (1. - checked));
p.setBrush(color);
} else {
p.setBrush(st::white);
p.setBrush(_st.checkBg);
}
p.drawRoundedRect(QRectF(_checkRect).marginsRemoved(QMarginsF(_st.thickness / 2., _st.thickness / 2., _st.thickness / 2., _st.thickness / 2.)), st::buttonRadius - (_st.thickness / 2.), st::buttonRadius - (_st.thickness / 2.));
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
@ -340,7 +340,7 @@ void Radiobutton::paintEvent(QPaintEvent *e) {
}
pen.setWidth(_st.thickness);
p.setPen(pen);
p.setBrush(Qt::NoBrush);
p.setBrush(_st.checkBg);
//int32 skip = qCeil(_st.thickness / 2.);
//p.drawEllipse(_checkRect.marginsRemoved(QMargins(skip, skip, skip, skip)));
p.drawEllipse(QRectF(_checkRect).marginsRemoved(QMarginsF(_st.thickness / 2., _st.thickness / 2., _st.thickness / 2., _st.thickness / 2.)));

View file

@ -41,7 +41,7 @@ HistoryDownButton::HistoryDownButton(QWidget *parent) : Button(parent)
{
Painter p(&cache);
p.setCompositionMode(QPainter::CompositionMode_Source);
p.fillRect(0, 0, iconWidth, iconHeight, st::transparent);
p.fillRect(0, 0, iconWidth, iconHeight, Qt::transparent);
st::historyToDown.paint(p, QPoint(0, 0), st::historyToDown.width());
}
_cache = App::pixmapFromImageInPlace(std_::move(cache));
@ -149,7 +149,7 @@ void EmojiButton::paintEvent(QPaintEvent *e) {
uint64 ms = getms();
p.fillRect(e->rect(), st::white);
p.fillRect(e->rect(), st::historyComposeAreaBg);
auto over = _a_over.current(getms(), (_state & StateOver) ? 1. : 0.);
auto opacity = over * _st.overOpacity + (1. - over) * _st.opacity;

View file

@ -57,4 +57,45 @@ void IconButton::onStateChanged(int oldState, ButtonStateChangeSource source) {
}
}
MaskButton::MaskButton(QWidget *parent, const style::MaskButton &st) : Button(parent)
, _st(st) {
resize(_st.width, _st.height);
setCursor(style::cur_pointer);
setAttribute(Qt::WA_OpaquePaintEvent);
}
void MaskButton::onStateChanged(int oldState, ButtonStateChangeSource source) {
auto over = (_state & StateOver);
if (over != (oldState & StateOver)) {
auto from = over ? _st.iconBg->c : _st.iconBgOver->c;
auto to = over ? _st.iconBgOver->c : _st.iconBg->c;
_a_iconBg.start([this] { update(); }, from, to, _st.duration);
}
}
void MaskButton::paintEvent(QPaintEvent *e) {
Painter p(this);
auto clip = e->rect();
auto position = (_state & StateDown) ? _st.downIconPosition : _st.iconPosition;
if (position.x() < 0) {
position.setX((width() - _st.icon.width()) / 2);
}
if (position.y() < 0) {
position.setY((height() - _st.icon.height()) / 2);
}
auto icon = myrtlrect(position.x(), position.y(), _st.icon.width(), _st.icon.height());
if (!icon.contains(clip)) {
p.fillRect(clip, _st.bg);
}
if (icon.intersects(clip)) {
if (_a_iconBg.animating(getms())) {
p.fillRect(icon.intersected(clip), _a_iconBg.current());
} else {
p.fillRect(icon.intersected(clip), (_state & StateOver) ? _st.iconBgOver : _st.iconBg);
}
_st.icon.paint(p, position, width());
}
}
} // namespace Ui

View file

@ -45,4 +45,20 @@ private:
};
class MaskButton : public Button {
public:
MaskButton(QWidget *parent, const style::MaskButton &st);
protected:
void paintEvent(QPaintEvent *e) override;
void onStateChanged(int oldState, ButtonStateChangeSource source) override;
private:
const style::MaskButton &_st;
ColorAnimation _a_iconBg;
};
} // namespace Ui

View file

@ -27,11 +27,7 @@ RoundButton::RoundButton(QWidget *parent, const QString &text, const style::Roun
, _text(text)
, _fullText(text)
, _textWidth(st.font->width(_text))
, _st(st)
, a_textBgOverOpacity(0)
, a_textFg(st.textFg->c)
, a_secondaryTextFg(st.secondaryTextFg->c)
, _a_over(animation(this, &RoundButton::step_over)) {
, _st(st) {
resizeToText();
setCursor(style::cur_pointer);
@ -104,11 +100,9 @@ void RoundButton::paintEvent(QPaintEvent *e) {
}
App::roundRect(p, rounded, _st.textBg, ImageRoundRadius::Small);
auto o = a_textBgOverOpacity.current();
if (o > 0) {
p.setOpacity(o);
auto over = (_state & StateOver);
if (over) {
App::roundRect(p, rounded, _st.textBgOver, ImageRoundRadius::Small);
p.setOpacity(1);
}
p.setFont(_st.font);
@ -119,57 +113,19 @@ void RoundButton::paintEvent(QPaintEvent *e) {
int textTopDelta = (_state & StateDown) ? (_st.downTextTop - _st.textTop) : 0;
int textTop = _st.padding.top() + _st.textTop + textTopDelta;
if (!_text.isEmpty()) {
if (o > 0) {
p.setPen(a_textFg.current());
} else {
p.setPen(_st.textFg);
}
p.setPen(over ? _st.textFgOver : _st.textFg);
p.drawTextLeft(textLeft, textTop, width(), _text);
}
if (!_secondaryText.isEmpty()) {
textLeft += _textWidth + (_textWidth ? _st.secondarySkip : 0);
if (o > 0) {
p.setPen(a_secondaryTextFg.current());
} else {
p.setPen(_st.secondaryTextFg);
}
p.setPen(over ? _st.secondaryTextFgOver : _st.secondaryTextFg);
p.drawTextLeft(textLeft, textTop, width(), _secondaryText);
}
_st.icon.paint(p, QPoint(_st.padding.left(), _st.padding.right() + textTopDelta), width());
}
void RoundButton::step_over(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
if (dt >= 1) {
_a_over.stop();
a_textFg.finish();
a_secondaryTextFg.finish();
a_textBgOverOpacity.finish();
} else {
a_textFg.update(dt, anim::linear);
a_secondaryTextFg.update(dt, anim::linear);
a_textBgOverOpacity.update(dt, anim::linear);
}
if (timer) update();
}
void RoundButton::onStateChanged(int oldState, ButtonStateChangeSource source) {
auto textBgOverOpacity = (_state & StateOver) ? 1. : 0.;
auto textFg = (_state & StateOver) ? (_st.textFgOver) : _st.textFg;
auto secondaryTextFg = (_state & StateOver) ? (_st.secondaryTextFgOver) : _st.secondaryTextFg;
a_textBgOverOpacity.start(textBgOverOpacity);
a_textFg.start(textFg->c);
a_secondaryTextFg.start(secondaryTextFg->c);
if (source == ButtonByUser || source == ButtonByPress || true) {
_a_over.stop();
a_textFg.finish();
a_secondaryTextFg.finish();
a_textBgOverOpacity.finish();
update();
} else {
_a_over.start();
}
update();
}
} // namespace Ui

View file

@ -47,8 +47,6 @@ protected:
void onStateChanged(int oldState, ButtonStateChangeSource source) override;
private:
void step_over(float64 ms, bool timer);
void updateText();
void resizeToText();
@ -62,10 +60,6 @@ private:
const style::RoundButton &_st;
anim::fvalue a_textBgOverOpacity;
anim::cvalue a_textFg, a_secondaryTextFg;
Animation _a_over;
TextTransform _transform = TextTransform::NoTransform;
};

View file

@ -103,10 +103,10 @@ CountryInput::CountryInput(QWidget *parent, const style::countryInput &st) : QWi
QPainter p(&trImage);
p.setRenderHint(QPainter::Antialiasing);
p.setCompositionMode(QPainter::CompositionMode_Source);
p.fillRect(0, 0, trImage.width(), trImage.height(), st::transparent->b);
p.fillRect(0, 0, trImage.width(), trImage.height(), Qt::transparent);
p.setPen(Qt::NoPen);
p.setBrush(_st.bgColor->b);
p.setBrush(_st.bgColor);
p.drawPolygon(trPoints, 3);
}
_arrow = App::pixmapFromImageInPlace(std_::move(trImage));
@ -314,7 +314,7 @@ void CountrySelectBox::Inner::paintEvent(QPaintEvent *e) {
int l = countriesNow->size();
if (l) {
if (r.intersects(QRect(0, 0, width(), st::countriesSkip))) {
p.fillRect(r.intersected(QRect(0, 0, width(), st::countriesSkip)), st::white->b);
p.fillRect(r.intersected(QRect(0, 0, width(), st::countriesSkip)), st::countryRowBg);
}
int32 from = floorclamp(r.y() - st::countriesSkip, _rowHeight, 0, l);
int32 to = ceilclamp(r.y() + r.height() - st::countriesSkip, _rowHeight, 0, l);
@ -322,7 +322,7 @@ void CountrySelectBox::Inner::paintEvent(QPaintEvent *e) {
bool sel = (i == _sel);
int32 y = st::countriesSkip + i * _rowHeight;
p.fillRect(0, y, width(), _rowHeight, (sel ? st::countryRowBgOver : st::white)->b);
p.fillRect(0, y, width(), _rowHeight, sel ? st::countryRowBgOver : st::countryRowBg);
QString code = QString("+") + (*countriesNow)[i]->code;
int32 codeWidth = st::countryRowCodeFont->width(code);
@ -336,16 +336,17 @@ void CountrySelectBox::Inner::paintEvent(QPaintEvent *e) {
}
p.setFont(st::countryRowNameFont);
p.setPen(st::black);
p.setPen(st::countryRowNameFg);
p.drawTextLeft(st::countryRowPadding.left(), y + st::countryRowPadding.top(), width(), name);
p.setFont(st::countryRowCodeFont);
p.setPen(sel ? st::countryRowCodeFgOver : st::countryRowCodeFg);
p.drawTextLeft(st::countryRowPadding.left() + nameWidth + st::countryRowPadding.right(), y + st::countryRowPadding.top(), width(), code);
}
} else {
p.fillRect(r, st::white->b);
p.setFont(st::noContactsFont->f);
p.setPen(st::noContactsColor->p);
p.fillRect(r, st::boxBg);
p.setFont(st::noContactsFont);
p.setPen(st::noContactsColor);
p.drawText(QRect(0, 0, width(), st::noContactsHeight), lang(lng_country_none), style::al_center);
}
}

View file

@ -167,10 +167,7 @@ BoxButton::BoxButton(QWidget *parent, const QString &text, const style::RoundBut
, _text(text.toUpper())
, _fullText(text.toUpper())
, _textWidth(st.font->width(_text))
, _st(st)
, a_textBgOverOpacity(0)
, a_textFg(st.textFg->c)
, _a_over(animation(this, &BoxButton::step_over)) {
, _st(st) {
resizeToText();
connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));
@ -203,48 +200,19 @@ void BoxButton::resizeToText() {
void BoxButton::paintEvent(QPaintEvent *e) {
Painter p(this);
p.fillRect(rect(), _st.textBg->b);
auto over = (_state & StateOver);
p.fillRect(rect(), _st.textBg);
float64 o = a_textBgOverOpacity.current();
if (o > 0) {
p.setOpacity(o);
if (over) {
App::roundRect(p, rect(), _st.textBgOver, ImageRoundRadius::Small);
p.setOpacity(1);
p.setPen(a_textFg.current());
} else {
p.setPen(_st.textFg);
}
p.setPen(over ? _st.textFgOver : _st.textFg);
p.setFont(_st.font);
auto textTop = (_state & StateDown) ? _st.downTextTop : _st.textTop;
p.drawText((width() - _textWidth) / 2, textTop + _st.font->ascent, _text);
}
void BoxButton::step_over(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
if (dt >= 1) {
_a_over.stop();
a_textFg.finish();
a_textBgOverOpacity.finish();
} else {
a_textFg.update(dt, anim::linear);
a_textBgOverOpacity.update(dt, anim::linear);
}
if (timer) update();
}
void BoxButton::onStateChange(int oldState, ButtonStateChangeSource source) {
float64 textBgOverOpacity = (_state & StateOver) ? 1 : 0;
style::color textFg = (_state & StateOver) ? (_st.textFgOver) : _st.textFg;
a_textBgOverOpacity.start(textBgOverOpacity);
a_textFg.start(textFg->c);
if (source == ButtonByUser || source == ButtonByPress || true) {
_a_over.stop();
a_textBgOverOpacity.finish();
a_textFg.finish();
update();
} else {
_a_over.start();
}
update();
}

View file

@ -105,8 +105,4 @@ private:
const style::RoundButton &_st;
anim::fvalue a_textBgOverOpacity;
anim::cvalue a_textFg;
Animation _a_over;
};

View file

@ -745,9 +745,9 @@ void InputArea::paintEvent(QPaintEvent *e) {
Painter p(this);
QRect r(rect().intersected(e->rect()));
p.fillRect(r, st::white);
p.fillRect(r, _st.textBg);
if (_st.border) {
p.fillRect(0, height() - _st.border, width(), _st.border, _st.borderFg->b);
p.fillRect(0, height() - _st.border, width(), _st.border, _st.borderFg);
}
if (_st.borderActive && a_borderOpacityActive.current() > 0) {
p.setOpacity(a_borderOpacityActive.current());
@ -2182,7 +2182,7 @@ void MaskedInputField::paintEvent(QPaintEvent *e) {
Painter p(this);
QRect r(rect().intersected(e->rect()));
p.fillRect(r, st::white->b);
p.fillRect(r, _st.textBg);
if (_st.border) {
p.fillRect(0, height() - _st.border, width(), _st.border, _st.borderFg->b);
}

View file

@ -927,7 +927,7 @@ void prepareFormattingOptimization(QTextDocument *document) {
}
}
void removeTags(QTextDocument *document, int from, int end) {
void removeTags(const style::color &textFg, QTextDocument *document, int from, int end) {
QTextCursor c(document->docHandle(), 0);
c.setPosition(from);
c.setPosition(end, QTextCursor::KeepAnchor);
@ -935,12 +935,12 @@ void removeTags(QTextDocument *document, int from, int end) {
QTextCharFormat format;
format.setAnchor(false);
format.setAnchorName(QString());
format.setForeground(st::black);
format.setForeground(textFg);
c.mergeCharFormat(format);
}
// Returns the position of the first inserted tag or "changedEnd" value if none found.
int processInsertedTags(QTextDocument *document, int changedPosition, int changedEnd, const FlatTextarea::TagList &tags, FlatTextarea::TagMimeProcessor *processor) {
int processInsertedTags(const style::color &textFg, QTextDocument *document, int changedPosition, int changedEnd, const FlatTextarea::TagList &tags, FlatTextarea::TagMimeProcessor *processor) {
int firstTagStart = changedEnd;
int applyNoTagFrom = changedEnd;
for_const (auto &tag, tags) {
@ -955,7 +955,7 @@ int processInsertedTags(QTextDocument *document, int changedPosition, int change
prepareFormattingOptimization(document);
if (applyNoTagFrom < tagFrom) {
removeTags(document, applyNoTagFrom, tagFrom);
removeTags(textFg, document, applyNoTagFrom, tagFrom);
}
QTextCursor c(document->docHandle(), 0);
c.setPosition(tagFrom);
@ -971,7 +971,7 @@ int processInsertedTags(QTextDocument *document, int changedPosition, int change
}
}
if (applyNoTagFrom < changedEnd) {
removeTags(document, applyNoTagFrom, changedEnd);
removeTags(textFg, document, applyNoTagFrom, changedEnd);
}
return firstTagStart;
@ -1036,7 +1036,7 @@ void FlatTextarea::processFormatting(int insertPosition, int insertEnd) {
// Apply inserted tags.
auto insertedTagsProcessor = _insertedTagsAreFromMime ? _tagMimeProcessor.get() : nullptr;
int breakTagOnNotLetterTill = processInsertedTags(doc, insertPosition, insertEnd,
int breakTagOnNotLetterTill = processInsertedTags(_st.textColor, doc, insertPosition, insertEnd,
_insertedTags, insertedTagsProcessor);
using ActionType = FormattingAction::Type;
while (true) {
@ -1143,7 +1143,7 @@ void FlatTextarea::processFormatting(int insertPosition, int insertEnd) {
QTextCharFormat format;
format.setAnchor(false);
format.setAnchorName(QString());
format.setForeground(st::black);
format.setForeground(_st.textColor);
c.mergeCharFormat(format);
} else if (action.type == ActionType::TildeFont) {
QTextCharFormat format;

View file

@ -36,7 +36,7 @@ WebImages webImages;
Image *generateBlankImage() {
auto data = QImage(cIntRetinaFactor(), cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
data.fill(QColor(255, 255, 255, 0));
data.fill(Qt::transparent);
data.setDevicePixelRatio(cRetinaFactor());
return internal::getImage(App::pixmapFromImageInPlace(std_::move(data)), "GIF");
}
@ -317,7 +317,7 @@ QImage imageBlur(QImage img) {
QPainter p(&imgsmall);
p.setCompositionMode(QPainter::CompositionMode_Source);
p.setRenderHint(QPainter::SmoothPixmapTransform);
p.fillRect(0, 0, w, h, st::transparent->b);
p.fillRect(0, 0, w, h, Qt::transparent);
p.drawImage(QRect(radius, radius, w - 2 * radius, h - 2 * radius), img, QRect(0, 0, w, h));
}
QImage was = img;
@ -423,8 +423,8 @@ const QPixmap &circleMask(int width, int height) {
Painter p(&mask);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.setCompositionMode(QPainter::CompositionMode_Source);
p.fillRect(0, 0, width, height, st::transparent);
p.setBrush(st::white);
p.fillRect(0, 0, width, height, Qt::transparent);
p.setBrush(Qt::white);
p.setPen(Qt::NoPen);
p.drawEllipse(0, 0, width, height);
}
@ -534,7 +534,7 @@ QPixmap imagePix(QImage img, int32 w, int32 h, ImagePixOptions options, int32 ou
{
QPainter p(&result);
if (w < outerw || h < outerh) {
p.fillRect(0, 0, result.width(), result.height(), st::black);
p.fillRect(0, 0, result.width(), result.height(), st::imageBg);
}
p.drawImage((result.width() - img.width()) / (2 * cIntRetinaFactor()), (result.height() - img.height()) / (2 * cIntRetinaFactor()), img);
}
@ -576,14 +576,14 @@ QPixmap Image::pixNoCache(int w, int h, ImagePixOptions options, int outerw, int
{
QPainter p(&result);
if (w < outerw) {
p.fillRect(0, 0, (outerw - w) / 2, result.height(), st::black);
p.fillRect(((outerw - w) / 2) + w, 0, result.width() - (((outerw - w) / 2) + w), result.height(), st::black);
p.fillRect(0, 0, (outerw - w) / 2, result.height(), st::imageBg);
p.fillRect(((outerw - w) / 2) + w, 0, result.width() - (((outerw - w) / 2) + w), result.height(), st::imageBg);
}
if (h < outerh) {
p.fillRect(qMax(0, (outerw - w) / 2), 0, qMin(result.width(), w), (outerh - h) / 2, st::black);
p.fillRect(qMax(0, (outerw - w) / 2), ((outerh - h) / 2) + h, qMin(result.width(), w), result.height() - (((outerh - h) / 2) + h), st::black);
p.fillRect(qMax(0, (outerw - w) / 2), 0, qMin(result.width(), w), (outerh - h) / 2, st::imageBg);
p.fillRect(qMax(0, (outerw - w) / 2), ((outerh - h) / 2) + h, qMin(result.width(), w), result.height() - (((outerh - h) / 2) + h), st::imageBg);
}
p.fillRect(qMax(0, (outerw - w) / 2), qMax(0, (outerh - h) / 2), qMin(result.width(), w), qMin(result.height(), h), st::white);
p.fillRect(qMax(0, (outerw - w) / 2), qMax(0, (outerh - h) / 2), qMin(result.width(), w), qMin(result.height(), h), st::imageBgTransparent);
}
if (options.testFlag(ImagePixCircled)) {

View file

@ -47,8 +47,8 @@ ScrollBar::ScrollBar(ScrollArea *parent, bool vert, const style::flatScroll *st)
, _connected(vert ? parent->verticalScrollBar() : parent->horizontalScrollBar())
, _scrollMax(_connected->maximum())
, _hideIn(-1)
, a_bg((_st->hiding ? st::transparent : _st->bgColor)->c)
, a_bar((_st->hiding ? st::transparent : _st->barColor)->c)
, a_bg(_st->hiding ? _st->bgColor->transparent() : _st->bgColor->c)
, a_bar(_st->hiding ? _st->barColor->transparent() : _st->barColor->c)
, _a_appearance(animation(this, &ScrollBar::step_appearance)) {
recountSize();

View file

@ -69,13 +69,15 @@ private:
class ColorData {
public:
QColor c;
QPen p;
QBrush b;
private:
QColor transparent() const {
return QColor(c.red(), c.green(), c.blue(), 0);
}
private:
ColorData(uchar r, uchar g, uchar b, uchar a);
void set(const QColor &c);

View file

@ -112,7 +112,6 @@ protected:
class NewlineBlock : public ITextBlock {
public:
Qt::LayoutDirection nextDirection() const {
return _nextDir;
}
@ -122,8 +121,7 @@ public:
}
private:
NewlineBlock(const style::font &font, const QString &str, uint16 from, uint16 length) : ITextBlock(font, str, from, length, 0, st::transparent, 0), _nextDir(Qt::LayoutDirectionAuto) {
NewlineBlock(const style::font &font, const QString &str, uint16 from, uint16 length) : ITextBlock(font, str, from, length, 0, st::windowTextFg, 0), _nextDir(Qt::LayoutDirectionAuto) {
_flags |= ((TextBlockTNewline & 0x0F) << 8);
}
@ -133,6 +131,7 @@ private:
friend class TextParser;
friend class TextPainter;
};
class TextWord {

View file

@ -584,7 +584,7 @@ void MultiSelect::Inner::paintEvent(QPaintEvent *e) {
_iconOpacity.step(ms);
auto paintRect = e->rect();
p.fillRect(paintRect, st::windowBg);
p.fillRect(paintRect, _st.bg);
auto offset = QPoint(rtl() ? _st.padding.right() : _st.padding.left(), _st.padding.top());
p.translate(offset);

View file

@ -26,7 +26,7 @@ class InputField;
namespace Ui {
class IconButton;
class MaskButton;
class MultiSelect : public TWidget {
public:
@ -154,7 +154,7 @@ private:
int _fieldTop = 0;
int _fieldWidth = 0;
ChildWidget<InputField> _field;
ChildWidget<Ui::IconButton> _cancel;
ChildWidget<Ui::MaskButton> _cancel;
int _newHeight = 0;
IntAnimation _height;

View file

@ -112,7 +112,8 @@ void PopupMenu::paintEvent(QPaintEvent *e) {
return;
}
p.fillRect(clip, st::almostTransparent);
// This is the minimal alpha value that allowed mouse tracking in OS X.
p.fillRect(clip, QColor(255, 255, 255, 13));
p.setCompositionMode(compositionMode);
_shadow.paint(p, _inner, _st.shadowShift);

View file

@ -41,6 +41,22 @@ IconButton {
duration: int;
}
MaskButton {
width: pixels;
height: pixels;
bg: color;
icon: icon;
iconBg: color;
iconBgOver: color;
iconPosition: point;
downIconPosition: point;
duration: int;
}
MediaSlider {
width: pixels;
activeFg: color;
@ -92,6 +108,7 @@ MultiSelectItem {
}
MultiSelect {
bg: color;
padding: margins;
maxHeight: pixels;
scroll: flatScroll;
@ -103,7 +120,7 @@ MultiSelect {
fieldMinWidth: pixels;
fieldIcon: icon;
fieldIconSkip: pixels;
fieldCancel: IconButton;
fieldCancel: MaskButton;
fieldCancelSkip: pixels;
}
@ -173,6 +190,12 @@ defaultIconButton: IconButton {
duration: 150;
}
defaultMaskButton: MaskButton {
iconPosition: point(-1px, -1px);
downIconPosition: point(-1px, -1px);
duration: 150;
}
widgetSlideDuration: 200;
widgetFadeDuration: 200;
@ -191,10 +214,10 @@ defaultMenuArrow: icon {{ "dropdown_submenu_arrow", #373737 }};
defaultMenu: Menu {
skip: 5px;
itemBg: white;
itemBg: windowBg;
itemBgOver: windowOverBg;
itemFg: black;
itemFgOver: black;
itemFg: windowTextFg;
itemFgOver: windowTextFg;
itemFgDisabled: #cccccc;
itemFgShortcut: #999999;
itemFgShortcutOver: #7c99b2;

View file

@ -477,7 +477,7 @@ Background::Background(QWidget *parent) : TWidget(parent) {
void Background::paintEvent(QPaintEvent *e) {
Painter p(this);
p.fillRect(rect(), st::notifyBg);
p.fillRect(rect(), st::notificationBg);
p.fillRect(0, 0, st::notifyBorderWidth, height(), st::notifyBorder);
p.fillRect(width() - st::notifyBorderWidth, 0, st::notifyBorderWidth, height(), st::notifyBorder);
p.fillRect(st::notifyBorderWidth, height() - st::notifyBorderWidth, width() - 2 * st::notifyBorderWidth, st::notifyBorderWidth, st::notifyBorder);
@ -530,11 +530,11 @@ void Notification::prepareActionsCache() {
auto actionsCacheHeight = height() - actionsTop;
auto actionsCacheImg = QImage(actionsCacheWidth * cIntRetinaFactor(), actionsCacheHeight * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
actionsCacheImg.setDevicePixelRatio(cRetinaFactor());
actionsCacheImg.fill(st::transparent->c);
actionsCacheImg.fill(Qt::transparent);
{
Painter p(&actionsCacheImg);
st::notifyFadeRight.fill(p, rtlrect(0, 0, fadeWidth, actionsCacheHeight, actionsCacheWidth));
p.fillRect(rtlrect(fadeWidth, 0, actionsCacheWidth - fadeWidth, actionsCacheHeight, actionsCacheWidth), st::notifyBg);
p.fillRect(rtlrect(fadeWidth, 0, actionsCacheWidth - fadeWidth, actionsCacheHeight, actionsCacheWidth), st::notificationBg);
p.drawPixmapRight(_replyPadding, _reply->y() - actionsTop, actionsCacheWidth, replyCache);
}
_buttonsCache = App::pixmapFromImageInPlace(std_::move(actionsCacheImg));
@ -615,7 +615,7 @@ void Notification::updateNotifyDisplay() {
int32 w = width(), h = height();
QImage img(w * cIntRetinaFactor(), h * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
if (cRetina()) img.setDevicePixelRatio(cRetinaFactor());
img.fill(st::notifyBg->c);
img.fill(st::notificationBg->c);
{
Painter p(&img);

View file

@ -33,8 +33,8 @@ void SlideAnimation::paintContents(Painter &p, const QRect &update) const {
_animation.step(getms());
if (a_coordOver.current() > 0) {
p.drawPixmap(QRect(0, 0, a_coordOver.current(), _cacheUnder.height() / retina), _cacheUnder, QRect(-a_coordUnder.current() * retina, 0, a_coordOver.current() * retina, _cacheUnder.height()));
p.setOpacity(a_progress.current() * st::slideFadeOut);
p.fillRect(0, 0, a_coordOver.current(), _cacheUnder.height() / retina, st::black);
p.setOpacity(a_progress.current());
p.fillRect(0, 0, a_coordOver.current(), _cacheUnder.height() / retina, st::slideFadeOutBg);
p.setOpacity(1);
}
p.drawPixmap(QRect(a_coordOver.current(), 0, _cacheOver.width() / retina, _cacheOver.height() / retina), _cacheOver, QRect(0, 0, _cacheOver.width(), _cacheOver.height()));

View file

@ -140,7 +140,7 @@ bool TopBarWidget::eventFilter(QObject *obj, QEvent *e) {
void TopBarWidget::paintEvent(QPaintEvent *e) {
Painter p(this);
p.fillRect(QRect(0, 0, width(), st::topBarHeight), st::topBarBG->b);
p.fillRect(QRect(0, 0, width(), st::topBarHeight), st::topBarBg);
if (_clearSelection->isHidden()) {
p.save();
int decreaseWidth = 0;

Some files were not shown because too many files have changed in this diff Show more