Improved ripple animation colors and styles for different buttons.

Also moved FlatLabel and LabelSimple to ui/widgets/labels module.
Also moved ScrollArea to ui/widgets/scroll_area module.
This commit is contained in:
John Preston 2016-11-16 13:44:06 +03:00
parent 3186e1e495
commit 7fa274a68e
115 changed files with 1435 additions and 1478 deletions

View File

@ -27,6 +27,8 @@ semibold: "Open Sans Semibold";
fsize: 13px;
normalFont: font(fsize);
semiboldFont: font(fsize semibold);
boxFontSize: 14px;
boxTextFont: font(boxFontSize);
emojiImgSize: 18px; // exceptional value for retina
emojiSize: 18px;
@ -34,56 +36,6 @@ emojiPadding: 1px;
lineWidth: 1px;
labelDefFlat: flatLabel {
font: font(fsize);
width: 0px;
maxHeight: 0px;
align: align(left);
textFg: windowTextFg;
}
boxVerticalMargin: 10px;
boxWidth: 320px;
boxWideWidth: 364px;
boxPadding: margins(26px, 30px, 34px, 8px);
boxMaxListHeight: 600px;
boxFontSize: 14px;
boxTextFont: font(boxFontSize);
boxLittleSkip: 10px;
boxMediumSkip: 20px;
boxTitleFont: font(boxFontSize bold);
boxTitlePosition: point(26px, 28px);
boxTitleHeight: 54px;
boxButtonFont: font(boxFontSize semibold);
boxButtonPadding: margins(12px, 16px, 22px, 16px);
boxLabel: flatLabel(labelDefFlat) {
font: font(boxFontSize);
align: align(topleft);
}
solidScroll: flatScroll {
barColor: #3f729734;
bgColor: #214f751a;
barOverColor: #3f729734;
bgOverColor: #214f751a;
minHeight: 20px;
round: 2px;
deltax: 5px;
width: 14px;
deltat: 6px;
deltab: 6px;
topsh: 0px;
bottomsh: 0px;
shColor: #00000012;
duration: 150;
hiding: 0;
}
defaultDropdownDuration: 150;
defaultDropdownPadding: margins(10px, 10px, 10px, 10px);
defaultDropdownShadow: icon {{ "dropdown_shadow", windowShadowFg }};
@ -103,14 +55,6 @@ defaultTooltip: Tooltip {
linesMax: 12;
}
boxScroll: flatScroll(solidScroll) {
round: 3px;
width: 18px;
deltax: 6px;
}
boxScrollSkip: 6px;
boxScrollShadowBg: #00000012;
statusFont: font(fsize);
statusFg: #999999;
statusFgActive: #0080c0;
@ -135,63 +79,12 @@ linkCropLimit: 360px;
linkFont: normalFont;
linkOverFont: font(fsize underline);
scrollDef: flatScroll {
barColor: #00000053;
bgColor: #0000001a;
barOverColor: #0000007a;
bgOverColor: #0000002c;
round: 2px;
width: 10px;
minHeight: 20px;
deltax: 3px;
deltat: 3px;
deltab: 3px;
topsh: 2px;
bottomsh: 2px;
shColor: #00000012;
duration: 150;
hiding: 1000;
}
dateRadius: 10px;
buttonRadius: 3px;
scrollCountries: flatScroll(scrollDef) {
topsh: 0px;
bottomsh: -2px;
}
lnkText: #0f7dc7;
boxShadow: icon {{ "box_shadow", windowShadowFg }};
boxShadowShift: 2px;
btnSelectSep: #e0e0e0;
countryRowHeight: 36px;
countryRowNameFont: semiboldFont;
countryRowNameFg: boxTextFg;
countryRowPadding: margins(22px, 9px, 8px, 0px);
countryRowCodeFont: font(fsize);
countryRowBg: windowBg;
countryRowBgOver: windowOverBg;
countryRowCodeFg: windowSubTextFg;
countryRowCodeFgOver: windowSubTextFgOver;
countriesSkip: 12px;
countriesScroll: flatScroll(boxScroll) {
deltat: 9px;
deltab: 3px;
}
setLittleSkip: 9px;
setScroll: flatScroll(scrollDef) {
bottomsh: 0px;
topsh: 0px;
}
noContactsHeight: 100px;
noContactsFont: font(fsize);
@ -245,20 +138,6 @@ msgOutReplyBarColor: historyOutIconFg;
msgOutReplyBarSelColor: historyOutIconFgSelected;
msgImgReplyBarColor: #ffffff;
msgBotKbDuration: 200;
msgBotKbFont: semiboldFont;
msgBotKbOverBg: #ffffff1a;
msgBotKbIconPadding: 2px;
msgBotKbUrlIcon: icon {{ "inline_button_url", #ffffff }};
msgBotKbSwitchPmIcon: icon {{ "inline_button_switch", #ffffff }};
msgBotKbButton: botKeyboardButton {
margin: 5px;
padding: 10px;
height: 36px;
textTop: 8px;
downTextTop: 9px;
}
msgServiceBg: #89a0b47f;
msgServiceSelectBg: #bbc8d4a2;
msgServiceColor: #ffffff;
@ -283,7 +162,7 @@ msgDateImgBgSelected: #1c4a7187;
msgDateImgPadding: point(8px, 2px);
msgDateImgCheckSpace: 4px;
defaultTextStyle: textStyle {
defaultTextStyle: TextStyle {
linkFlags: font(fsize);
linkFlagsOver: font(fsize underline);
linkFg: btnYesColor;
@ -293,10 +172,7 @@ defaultTextStyle: textStyle {
selectOverlay: msgSelectOverlay;
lineHeight: 0px;
}
boxTextStyle: textStyle(defaultTextStyle) {
lineHeight: 22px;
}
serviceTextStyle: textStyle(defaultTextStyle) {
serviceTextStyle: TextStyle(defaultTextStyle) {
linkFlags: msgServiceFont;
linkFlagsOver: font(fsize semibold underline);
linkFg: msgServiceColor;
@ -305,35 +181,35 @@ serviceTextStyle: textStyle(defaultTextStyle) {
selectBg: msgServiceSelectBg;
selectOverlay: msgServiceSelectBg;
}
inTextStyle: textStyle(defaultTextStyle) {
inTextStyle: TextStyle(defaultTextStyle) {
monoFg: #4e7391;
selectBg: msgInBgSelected;
selectOverlay: msgSelectOverlay;
}
outTextStyle: textStyle(defaultTextStyle) {
outTextStyle: TextStyle(defaultTextStyle) {
monoFg: #469165;
selectBg: msgOutBgSelected;
selectOverlay: msgSelectOverlay;
}
inFwdTextStyle: textStyle(defaultTextStyle) {
inFwdTextStyle: TextStyle(defaultTextStyle) {
linkFlags: semiboldFont;
linkFlagsOver: semiboldFont;
linkFg: msgInServiceFg;
linkFgDown: msgInServiceFg;
}
outFwdTextStyle: textStyle(inFwdTextStyle) {
outFwdTextStyle: TextStyle(inFwdTextStyle) {
linkFg: msgOutServiceFg;
linkFgDown: msgOutServiceFg;
}
inFwdTextStyleSelected: textStyle(inFwdTextStyle) {
inFwdTextStyleSelected: TextStyle(inFwdTextStyle) {
linkFg: msgInServiceFgSelected;
linkFgDown: msgInServiceFgSelected;
}
outFwdTextStyleSelected: textStyle(inFwdTextStyle) {
outFwdTextStyleSelected: TextStyle(inFwdTextStyle) {
linkFg: msgOutServiceFgSelected;
linkFgDown: msgOutServiceFgSelected;
}
medviewSaveAsTextStyle: textStyle(defaultTextStyle) {
medviewSaveAsTextStyle: TextStyle(defaultTextStyle) {
linkFg: #91d9ff;
linkFgDown: #91d9ff;
}
@ -356,11 +232,11 @@ mediaUnreadSize: 7px;
mediaUnreadSkip: 5px;
mediaUnreadTop: 6px;
mediaInStyle: textStyle(defaultTextStyle) {
mediaInStyle: TextStyle(defaultTextStyle) {
linkFg: mediaInFg;
linkFgDown: mediaInFg;
}
mediaInStyleSelected: textStyle(defaultTextStyle) {
mediaInStyleSelected: TextStyle(defaultTextStyle) {
linkFg: mediaInFgSelected;
linkFgDown: mediaInFgSelected;
}
@ -397,7 +273,7 @@ msgFileThumbLinkOutFgSelected: #31a298;
msgFileNameTop: 16px;
msgFileStatusTop: 37px;
msgFileMinWidth: 294px;
msgFileInBg: windowActiveBg;
msgFileInBg: windowBgActive;
msgFileInBgOver: #4eade3;
msgFileInBgSelected: #51a3d3;
msgFileOutBg: #78c67f;
@ -413,7 +289,7 @@ msgWaveformBar: 2px;
msgWaveformSkip: 1px;
msgWaveformMin: 2px;
msgWaveformMax: 20px;
msgWaveformInActive: windowActiveBg;
msgWaveformInActive: windowBgActive;
msgWaveformInActiveSelected: #51a3d3;
msgWaveformInInactive: #d4dee6;
msgWaveformInInactiveSelected: #9cc1e1;
@ -422,22 +298,6 @@ msgWaveformOutActiveSelected: #6badad;
msgWaveformOutInactive: #b3e2b4;
msgWaveformOutInactiveSelected: #91c3c3;
historyScroll: flatScroll(scrollDef) {
barColor: #89a0b47a;
bgColor: #89a0b44c;
barOverColor: #89a0b4bc;
bgOverColor: #89a0b46b;
round: 3px;
width: 12px;
deltax: 3px;
deltat: 3px;
deltab: 3px;
topsh: 0px;
bottomsh: -1px;
}
textRectMargins: margins(-2px, -1px, -2px, -1px);
newMsgSound: ":/gui/art/newmsg.wav";
@ -463,13 +323,6 @@ simpleCloseIcon: icon {{ "simple_close", #c7c7c7 }};
simpleCloseIconOver: icon {{ "simple_close", #a3a3a3 }};
dialogsForwardCancelIcon: icon {{ "simple_close", dialogsForwardFg }};
boxPhotoPadding: margins(28px, 28px, 28px, 18px);
boxPhotoCompressedPadding: margins(0px, 2px, 0px, 22px);
boxPhotoTextFg: #808080;
cropPointSize: 10px;
cropSkip: 13px;
cropMinSize: 20px;
profileMaxWidth: 410px;
profilePadding: margins(28px, 30px, 28px, 0px);
@ -504,31 +357,6 @@ dragPadding: margins(20px, 10px, 20px, 10px);
dragHeight: 72px;
botKbDuration: 200;
botKbBg: #edf1f5;
botKbOverBg: #d8e2ec;
botKbDownBg: #d8e2ec;
botKbColor: #4b565f;
botKbFont: font(15px semibold);
botKbButton: botKeyboardButton {
margin: 10px;
padding: 10px;
height: 38px;
textTop: 9px;
downTextTop: 9px;
}
botKbTinyButton: botKeyboardButton {
margin: 4px;
padding: 3px;
height: 25px;
textTop: 2px;
downTextTop: 2px;
}
botKbScroll: flatScroll(solidScroll) {
deltax: 3px;
width: 10px;
}
minPhotoSize: 100px;
maxMediaSize: 420px;
maxStickerSize: 256px;
@ -590,7 +418,7 @@ downloadPathSkip: 10px;
usernamePadding: margins(23px, 22px, 21px, 12px);
usernameSkip: 49px;
usernameTextStyle: textStyle(defaultTextStyle) {
usernameTextStyle: TextStyle(defaultTextStyle) {
lineHeight: 20px;
}
usernameDefaultFg: #777777;
@ -605,23 +433,6 @@ videoIcon: icon {
};
locationSize: size(320px, 240px);
mentionHeight: 40px;
mentionScroll: flatScroll(scrollDef) {
topsh: 0px;
bottomsh: 0px;
}
mentionPadding: margins(8px, 5px, 8px, 5px);
mentionTop: 11px;
mentionFont: linkFont;
mentionNameFg: windowTextFg;
mentionPhotoSize: msgPhotoSize;
mentionBg: #ffffff;
mentionBgOver: #f5f5f5;
mentionFg: #777777;
mentionFgOver: #707070;
mentionFgActive: #0080c0;
mentionFgOverActive: #0077b3;
webPageLeft: 10px;
webPageBar: 2px;
webPageTitleFont: semiboldFont;
@ -645,7 +456,7 @@ inlineResultsSkip: 3px;
inlineMediaHeight: 96px;
inlineThumbSize: 64px;
inlineThumbSkip: 10px;
inlineTitleFg: windowTextFg;
inlineTitleFg: windowFg;
inlineDescriptionFg: windowSubTextFg;
inlineRowMargin: 6px;
inlineRowBorder: 1px;

View File

@ -19,7 +19,7 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
textStyle {
TextStyle {
linkFlags: font;
linkFlagsOver: font;
linkFg: color;
@ -30,37 +30,6 @@ textStyle {
lineHeight: pixels;
}
flatScroll {
barColor: color;
bgColor: color;
barOverColor: color;
bgOverColor: color;
round: pixels;
width: pixels;
minHeight: pixels;
deltax: pixels;
deltat: pixels;
deltab: pixels;
topsh: pixels;
bottomsh: pixels;
shColor: color;
duration: int;
hiding: int;
}
flatLabel {
font: font;
margin: margins;
width: pixels;
align: align;
textFg: color;
maxHeight: pixels;
}
Tooltip {
textBg: color;
textFg: color;
@ -74,11 +43,3 @@ Tooltip {
widthMax: pixels;
linesMax: int;
}
botKeyboardButton {
margin: pixels;
padding: pixels;
height: pixels;
textTop: pixels;
downTextTop: pixels;
}

View File

@ -21,12 +21,16 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
// basic
windowBg: #ffffff; // white: fallback for background
windowTextFg: #000000; // black: fallback for text color
windowFg: #000000; // black: fallback for text color
windowBgOver: #f1f1f1; // light gray: fallback for over background
windowBgRipple: #e5e5e5; // darker gray: fallback for ripple effect
windowFgOver: windowFg; // black: fallback for over text color
windowSubTextFg: #999999; // gray: fallback for subtext color
windowActiveBg: #40ace3; // bright blue: fallback for blue filled active areas
windowActiveFg: #ffffff; // text on bright blue: fallback for text on active areas
windowOverBg: #f0f0f0; // light gray: fallback for over background
windowSubTextFgOver: #7c99b2; // gray over light blue: fallback for subtext over color
windowSubTextFgOver: #919191; // gray over light blue: fallback for subtext over color
windowBoldFg: #222222; // dark gray: fallback for bold text color
windowBoldFgOver: #222222; // dark gray: fallback for over bold text color
windowBgActive: #40ace3; // bright blue: fallback for blue filled active areas
windowFgActive: #ffffff; // text on bright blue: fallback for text on active areas
windowActiveTextFg: #2687bf; // online blue: fallback for active color
windowShadowFg: #000000; // black: fallback for shadow color
windowShadowFgFallback: #cdcdcd; // gray: fallback for shadow without
@ -35,27 +39,28 @@ imageBg: #000000;
imageBgTransparent: #ffffff;
// widgets
activeButtonBg: windowActiveBg;
activeButtonBgOver: #46b4eb;
activeButtonBgRipple: #177eb2;
activeButtonFg: windowActiveFg;
activeButtonBg: windowBgActive;
activeButtonBgOver: #39a5db;
activeButtonBgRipple: #2095d0;
activeButtonFg: windowFgActive;
activeButtonFgOver: activeButtonFg;
activeButtonSecondaryFg: #cceeff;
activeButtonSecondaryFgOver: activeButtonSecondaryFg;
lightButtonBg: windowBg;
lightButtonBgOver: #edf7ff;
lightButtonBgRipple: #c7e1f6;
lightButtonBgOver: #e3f1fa;
lightButtonBgRipple: #c9e4f6;
lightButtonFg: #2b99d5;
lightButtonFgOver: lightButtonFg;
menuBg: windowBg;
menuBgOver: windowOverBg;
menuBgOver: windowBgOver;
menuBgRipple: windowBgRipple;
menuIconFg: #a8a8a8;
menuIconFgOver: #999999;
// custom title bar for Windows and macOS
titleBg: windowOverBg;
titleBg: windowBgOver;
titleShadow: #00000003;
titleButtonFg: #ababab;
titleButtonBgOver: #e5e5e5;
@ -80,7 +85,7 @@ cancelIconFgOver: #808080;
// boxes
boxBg: windowBg;
boxTextFg: windowTextFg;
boxTextFg: windowFg;
boxTextFgGood: #4ab44a;
boxTextFgError: #d84d4d;
boxTitleFg: #404040;
@ -94,41 +99,41 @@ boxBlockTitleAdditionalFg: #808080;
boxBlockTitleCloseFg: cancelIconFg;
boxBlockTitleCloseFgOver: cancelIconFgOver;
attentionBoxButtonFg: #ea4b2f;
attentionBoxButtonFgOver: #ea4b2f;
attentionBoxButtonBgOver: #fff0ed;
attentionBoxButtonBgRipple: #efbcb2;
attentionBoxButtonFg: #d14e4e;
attentionBoxButtonFgOver: #d14e4e;
attentionBoxButtonBgOver: #fcdfde;
attentionBoxButtonBgRipple: #f4c3c2;
membersAboutLimitFg: windowSubTextFg;
membersAboutLimitFg: windowSubTextFgOver;
contactsBg: windowBg;
contactsBgOver: windowOverBg;
contactsBgOver: windowBgOver;
contactsNameFg: boxTextFg;
contactsStatusFg: windowSubTextFg;
contactsStatusFgOver: contactsStatusFg;
contactsStatusFgOnline: #3b8dcc;
contactsStatusFgOver: windowSubTextFgOver;
contactsStatusFgOnline: windowActiveTextFg;
photoCropFadeBg: #0000007f;
photoCropPointFg: #ffffff7f;
// settings
notificationsBoxMonitorFg: windowTextFg;
notificationsBoxMonitorFg: windowFg;
notificationSampleUserpicFg: windowActiveBg;
notificationSampleUserpicFg: windowBgActive;
notificationSampleCloseFg: #d7d7d7 | windowSubTextFg;
notificationSampleTextFg: #d7d7d7 | windowSubTextFg;
notificationSampleNameFg: #939393 | windowSubTextFg;
// intro
introHeaderFg: windowTextFg;
introErrorFg: windowTextFg;
introHeaderFg: windowFg;
introErrorFg: windowFg;
// dialogs
dialogsMenuIconFg: menuIconFg;
dialogsMenuIconFgOver: menuIconFgOver;
dialogsBg: windowBg;
dialogsNameFg: #373737;
dialogsNameFg: windowBoldFg;
dialogsChatIconFg: dialogsNameFg;
dialogsDateFg: windowSubTextFg;
dialogsTextFg: windowSubTextFg;
@ -138,15 +143,15 @@ dialogsVerifiedIconBg: #4abcf1;
dialogsVerifiedIconFg: #ffffff;
dialogsSendingIconFg: #c1c1c1;
dialogsSentIconFg: #5dc452;
dialogsUnreadBg: windowActiveBg;
dialogsUnreadBg: windowBgActive;
dialogsUnreadBgMuted: #bbbbbb;
dialogsUnreadFg: #ffffff;
dialogsBgOver: windowOverBg;
dialogsNameFgOver: windowTextFg;
dialogsBgOver: windowBgOver;
dialogsNameFgOver: windowBoldFgOver;
dialogsChatIconFgOver: dialogsNameFgOver;
dialogsDateFgOver: #8a8a8a | dialogsDateFg;
dialogsTextFgOver: dialogsTextFg;
dialogsDateFgOver: windowSubTextFgOver;
dialogsTextFgOver: windowSubTextFgOver;
dialogsTextFgServiceOver: dialogsTextFgService;
dialogsDraftFgOver: dialogsDraftFg;
dialogsVerifiedIconBgOver: dialogsVerifiedIconBg;
@ -158,10 +163,10 @@ dialogsUnreadBgMutedOver: dialogsUnreadBgMuted;
dialogsUnreadFgOver: dialogsUnreadFg;
dialogsBgActive: #419fd9;
dialogsNameFgActive: windowActiveFg;
dialogsNameFgActive: windowFgActive;
dialogsChatIconFgActive: dialogsNameFgActive;
dialogsDateFgActive: windowActiveFg;
dialogsTextFgActive: windowActiveFg;
dialogsDateFgActive: windowFgActive;
dialogsTextFgActive: windowFgActive;
dialogsTextFgServiceActive: dialogsTextFgActive;
dialogsDraftFgActive: #c6e1f7;
dialogsVerifiedIconBgActive: dialogsTextFgActive;
@ -186,19 +191,19 @@ emojiPanHeaderBg: #fffffff2 | emojiPanBg;
historyComposeAreaBg: windowBg;
historyComposeIconFg: menuIconFg;
historyComposeIconFgOver: menuIconFgOver;
historySendIconFg: windowActiveBg;
historySendIconFgOver: windowActiveBg;
historySendIconFg: windowBgActive;
historySendIconFgOver: windowBgActive;
historyPinnedBg: historyComposeAreaBg;
historyReplyBg: historyComposeAreaBg;
historyReplyCancelFg: cancelIconFg;
historyReplyCancelFgOver: cancelIconFgOver;
historyComposeButtonBg: historyComposeAreaBg;
historyComposeButtonBgOver: #f5f5f5;
historyComposeButtonBgRipple: #e7e7e7;
historyComposeButtonBgOver: windowBgOver;
historyComposeButtonBgRipple: windowBgRipple;
historyTextInFg: windowTextFg;
historyTextOutFg: windowTextFg;
historyTextInFg: windowFg;
historyTextOutFg: windowFg;
historyCaptionInFg: historyTextInFg;
historyCaptionOutFg: historyTextOutFg;
historyFileNameInFg: historyTextInFg;
@ -213,7 +218,7 @@ historySystemFg: #ffffff;
// mediaview
mediaviewFileBg: windowBg;
mediaviewFileNameFg: windowTextFg;
mediaviewFileNameFg: windowFg;
mediaviewFileSizeFg: windowSubTextFg;
mediaviewFileRedCornerFg: #d55959;
mediaviewFileYellowCornerFg: #e8a659;

View File

@ -22,34 +22,39 @@
//
windowBg: #ffffff;
windowTextFg: #000000;
windowFg: #000000;
windowBgOver: #f1f1f1;
windowBgRipple: #e5e5e5;
windowFgOver: windowFg;
windowSubTextFg: #999999;
windowActiveBg: #40ace3;
windowActiveFg: #ffffff;
windowOverBg: #f0f0f0;
windowSubTextFgOver: #7c99b2;
windowSubTextFgOver: #919191;
windowBoldFg: #222222;
windowBoldFgOver: #222222;
windowBgActive: #40ace3;
windowFgActive: #ffffff;
windowActiveTextFg: #2687bf;
windowShadowFg: #000000;
windowShadowFgFallback: #cdcdcd;
imageBg: #000000;
imageBgTransparent: #ffffff;
activeButtonBg: windowActiveBg;
activeButtonBgOver: #46b4eb;
activeButtonBgRipple: #177eb2;
activeButtonFg: windowActiveFg;
activeButtonBg: windowBgActive;
activeButtonBgOver: #39a5db;
activeButtonBgRipple: #2095d0;
activeButtonFg: windowFgActive;
activeButtonFgOver: activeButtonFg;
activeButtonSecondaryFg: #cceeff;
activeButtonSecondaryFgOver: activeButtonSecondaryFg;
lightButtonBg: windowBg;
lightButtonBgOver: #edf7ff;
lightButtonBgRipple: #c7e1f6;
lightButtonBgOver: #e3f1fa;
lightButtonBgRipple: #c9e4f6;
lightButtonFg: #2b99d5;
lightButtonFgOver: lightButtonFg;
menuBg: windowBg;
menuBgOver: windowOverBg;
menuBgOver: windowBgOver;
menuBgRipple: windowBgRipple;
menuIconFg: #a8a8a8;
menuIconFgOver: #999999;
titleBg: windowOverBg;
titleBg: windowBgOver;
titleShadow: #00000003;
titleButtonFg: #ababab;
titleButtonBgOver: #e5e5e5;
@ -67,7 +72,7 @@ layerBg: #0000007f;
cancelIconFg: #a2a2a2;
cancelIconFgOver: #808080;
boxBg: windowBg;
boxTextFg: windowTextFg;
boxTextFg: windowFg;
boxTextFgGood: #4ab44a;
boxTextFgError: #d84d4d;
boxTitleFg: #404040;
@ -79,30 +84,30 @@ boxBlockTitleFg: boxTitleFg;
boxBlockTitleAdditionalFg: #808080;
boxBlockTitleCloseFg: cancelIconFg;
boxBlockTitleCloseFgOver: cancelIconFgOver;
attentionBoxButtonFg: #ea4b2f;
attentionBoxButtonFgOver: #ea4b2f;
attentionBoxButtonBgOver: #fff0ed;
attentionBoxButtonBgRipple: #efbcb2;
membersAboutLimitFg: windowSubTextFg;
attentionBoxButtonFg: #d14e4e;
attentionBoxButtonFgOver: #d14e4e;
attentionBoxButtonBgOver: #fcdfde;
attentionBoxButtonBgRipple: #f4c3c2;
membersAboutLimitFg: windowSubTextFgOver;
contactsBg: windowBg;
contactsBgOver: windowOverBg;
contactsBgOver: windowBgOver;
contactsNameFg: boxTextFg;
contactsStatusFg: windowSubTextFg;
contactsStatusFgOver: contactsStatusFg;
contactsStatusFgOnline: #3b8dcc;
contactsStatusFgOver: windowSubTextFgOver;
contactsStatusFgOnline: windowActiveTextFg;
photoCropFadeBg: #0000007f;
photoCropPointFg: #ffffff7f;
notificationsBoxMonitorFg: windowTextFg;
notificationSampleUserpicFg: windowActiveBg;
notificationsBoxMonitorFg: windowFg;
notificationSampleUserpicFg: windowBgActive;
notificationSampleCloseFg: #d7d7d7; // windowSubTextFg;
notificationSampleTextFg: #d7d7d7; // windowSubTextFg;
notificationSampleNameFg: #939393; // windowSubTextFg;
introHeaderFg: windowTextFg;
introErrorFg: windowTextFg;
introHeaderFg: windowFg;
introErrorFg: windowFg;
dialogsMenuIconFg: menuIconFg;
dialogsMenuIconFgOver: menuIconFgOver;
dialogsBg: windowBg;
dialogsNameFg: #373737;
dialogsNameFg: windowBoldFg;
dialogsChatIconFg: dialogsNameFg;
dialogsDateFg: windowSubTextFg;
dialogsTextFg: windowSubTextFg;
@ -112,14 +117,14 @@ dialogsVerifiedIconBg: #4abcf1;
dialogsVerifiedIconFg: #ffffff;
dialogsSendingIconFg: #c1c1c1;
dialogsSentIconFg: #5dc452;
dialogsUnreadBg: windowActiveBg;
dialogsUnreadBg: windowBgActive;
dialogsUnreadBgMuted: #bbbbbb;
dialogsUnreadFg: #ffffff;
dialogsBgOver: windowOverBg;
dialogsNameFgOver: windowTextFg;
dialogsBgOver: windowBgOver;
dialogsNameFgOver: windowBoldFgOver;
dialogsChatIconFgOver: dialogsNameFgOver;
dialogsDateFgOver: #8a8a8a; // dialogsDateFg;
dialogsTextFgOver: dialogsTextFg;
dialogsDateFgOver: windowSubTextFgOver;
dialogsTextFgOver: windowSubTextFgOver;
dialogsTextFgServiceOver: dialogsTextFgService;
dialogsDraftFgOver: dialogsDraftFg;
dialogsVerifiedIconBgOver: dialogsVerifiedIconBg;
@ -130,10 +135,10 @@ dialogsUnreadBgOver: dialogsUnreadBg;
dialogsUnreadBgMutedOver: dialogsUnreadBgMuted;
dialogsUnreadFgOver: dialogsUnreadFg;
dialogsBgActive: #419fd9;
dialogsNameFgActive: windowActiveFg;
dialogsNameFgActive: windowFgActive;
dialogsChatIconFgActive: dialogsNameFgActive;
dialogsDateFgActive: windowActiveFg;
dialogsTextFgActive: windowActiveFg;
dialogsDateFgActive: windowFgActive;
dialogsTextFgActive: windowFgActive;
dialogsTextFgServiceActive: dialogsTextFgActive;
dialogsDraftFgActive: #c6e1f7;
dialogsVerifiedIconBgActive: dialogsTextFgActive;
@ -153,17 +158,17 @@ emojiPanHeaderBg: #fffffff2; // emojiPanBg;
historyComposeAreaBg: windowBg;
historyComposeIconFg: menuIconFg;
historyComposeIconFgOver: menuIconFgOver;
historySendIconFg: windowActiveBg;
historySendIconFgOver: windowActiveBg;
historySendIconFg: windowBgActive;
historySendIconFgOver: windowBgActive;
historyPinnedBg: historyComposeAreaBg;
historyReplyBg: historyComposeAreaBg;
historyReplyCancelFg: cancelIconFg;
historyReplyCancelFgOver: cancelIconFgOver;
historyComposeButtonBg: historyComposeAreaBg;
historyComposeButtonBgOver: #f5f5f5;
historyComposeButtonBgRipple: #e7e7e7;
historyTextInFg: windowTextFg;
historyTextOutFg: windowTextFg;
historyComposeButtonBgOver: windowBgOver;
historyComposeButtonBgRipple: windowBgRipple;
historyTextInFg: windowFg;
historyTextOutFg: windowFg;
historyCaptionInFg: historyTextInFg;
historyCaptionOutFg: historyTextOutFg;
historyFileNameInFg: historyTextInFg;
@ -175,7 +180,7 @@ historySystemBg: #89a0b47f;
historySystemBgSelected: #bbc8d4a2;
historySystemFg: #ffffff;
mediaviewFileBg: windowBg;
mediaviewFileNameFg: windowTextFg;
mediaviewFileNameFg: windowFg;
mediaviewFileSizeFg: windowSubTextFg;
mediaviewFileRedCornerFg: #d55959;
mediaviewFileYellowCornerFg: #e8a659;

View File

@ -28,6 +28,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_overview.h"
#include "styles/style_mediaview.h"
#include "styles/style_stickers.h"
#include "styles/style_history.h"
#include "lang.h"
#include "data/data_abstract_structure.h"
#include "history/history_service_layout.h"

View File

@ -28,12 +28,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/confirmbox.h"
#include "application.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/labels.h"
#include "styles/style_boxes.h"
AboutBox::AboutBox() : AbstractBox(st::aboutWidth)
, _version(this, lng_about_version(lt_version, QString::fromLatin1(AppVersionStr.c_str()) + (cAlphaVersion() ? " alpha" : "") + (cBetaVersion() ? qsl(" beta %1").arg(cBetaVersion()) : QString())), st::aboutVersionLink)
, _text1(this, lang(lng_about_text_1), FlatLabel::InitType::Rich, st::aboutLabel, st::aboutTextStyle)
, _text2(this, lang(lng_about_text_2), FlatLabel::InitType::Rich, st::aboutLabel, st::aboutTextStyle)
, _text1(this, lang(lng_about_text_1), Ui::FlatLabel::InitType::Rich, st::aboutLabel, st::aboutTextStyle)
, _text2(this, lang(lng_about_text_2), Ui::FlatLabel::InitType::Rich, st::aboutLabel, st::aboutTextStyle)
, _text3(this,st::aboutLabel, st::aboutTextStyle)
, _done(this, lang(lng_close), st::defaultBoxButton) {
_text3->setRichText(lng_about_text_3(lt_faq_open, qsl("[a href=\"%1\"]").arg(telegramFaqLink()), lt_faq_close, qsl("[/a]")));
@ -140,3 +141,14 @@ QString telegramFaqLink() {
}
return result;
}
QString currentVersionText() {
auto result = QString::fromLatin1(AppVersionStr.c_str());
if (cAlphaVersion()) {
result += " alpha";
}
if (cBetaVersion()) {
result += qsl(" beta %1").arg(cBetaVersion() % 1000);
}
return result;
}

View File

@ -20,12 +20,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include "abstractbox.h"
#include "ui/flatlabel.h"
#include "boxes/abstractbox.h"
namespace Ui {
class RoundButton;
class LinkButton;
class FlatLabel;
} // namespace Ui
class AboutBox : public AbstractBox {
@ -48,11 +48,12 @@ protected:
private:
ChildWidget<Ui::LinkButton> _version;
ChildWidget<FlatLabel> _text1;
ChildWidget<FlatLabel> _text2;
ChildWidget<FlatLabel> _text3;
ChildWidget<Ui::FlatLabel> _text1;
ChildWidget<Ui::FlatLabel> _text2;
ChildWidget<Ui::FlatLabel> _text3;
ChildWidget<Ui::RoundButton> _done;
};
QString telegramFaqLink();
QString currentVersionText();

View File

@ -25,6 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "localstorage.h"
#include "lang.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/scroll_area.h"
#include "mainwidget.h"
#include "mainwindow.h"
@ -150,7 +151,7 @@ void AbstractBox::raiseShadow() {
ScrollableBoxShadow::ScrollableBoxShadow(QWidget *parent) : Ui::PlainShadow(parent, st::boxScrollShadowBg) {
}
ScrollableBox::ScrollableBox(const style::flatScroll &scroll, int32 w) : AbstractBox(w)
ScrollableBox::ScrollableBox(const style::FlatScroll &scroll, int32 w) : AbstractBox(w)
, _scroll(this, scroll)
, _topSkip(st::boxBlockTitleHeight)
, _bottomSkip(st::boxScrollSkip) {
@ -185,6 +186,6 @@ void ScrollableBox::updateScrollGeometry() {
_scroll->setGeometry(0, _topSkip, width(), height() - _topSkip - _bottomSkip);
}
ItemListBox::ItemListBox(const style::flatScroll &scroll, int32 w) : ScrollableBox(scroll, w) {
ItemListBox::ItemListBox(const style::FlatScroll &scroll, int32 w) : ScrollableBox(scroll, w) {
setMaxHeight(st::boxMaxListHeight);
}

View File

@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Ui {
class IconButton;
class GradientShadow;
class ScrollArea;
} // namespace Ui
class AbstractBox : public LayerWidget, protected base::Subscriber {
@ -81,7 +82,7 @@ public:
class ScrollableBox : public AbstractBox {
public:
ScrollableBox(const style::flatScroll &scroll, int w = 0);
ScrollableBox(const style::FlatScroll &scroll, int w = 0);
protected:
void init(TWidget *inner, int bottomSkip = -1, int topSkip = -1);
@ -89,21 +90,21 @@ protected:
void resizeEvent(QResizeEvent *e) override;
ScrollArea *scrollArea() {
Ui::ScrollArea *scrollArea() {
return _scroll;
}
private:
void updateScrollGeometry();
ChildWidget<ScrollArea> _scroll;
ChildWidget<Ui::ScrollArea> _scroll;
int _topSkip, _bottomSkip;
};
class ItemListBox : public ScrollableBox {
public:
ItemListBox(const style::flatScroll &scroll, int32 w = 0);
ItemListBox(const style::FlatScroll &scroll, int32 w = 0);
};

View File

@ -32,6 +32,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/input_fields.h"
#include "ui/widgets/labels.h"
#include "mainwidget.h"
#include "mainwindow.h"
#include "apiwrap.h"
@ -1301,7 +1302,7 @@ void EditChannelBox::onSaveSignDone(const MTPUpdates &updates) {
RevokePublicLinkBox::RevokePublicLinkBox(base::lambda_unique<void()> &&revokeCallback) : AbstractBox()
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
, _revokeWidth(st::normalFont->width(lang(lng_channels_too_much_public_revoke)))
, _aboutRevoke(this, lang(lng_channels_too_much_public_about), FlatLabel::InitType::Simple, st::aboutRevokePublicLabel)
, _aboutRevoke(this, lang(lng_channels_too_much_public_about), Ui::FlatLabel::InitType::Simple, st::aboutRevokePublicLabel)
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
, _revokeCallback(std_::move(revokeCallback)) {
setMouseTracking(true);

View File

@ -20,14 +20,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include "abstractbox.h"
#include "core/lambda_wrap.h"
#include "boxes/abstractbox.h"
#include "ui/filedialog.h"
class FlatLabel;
class ConfirmBox;
namespace Ui {
class FlatLabel;
class InputField;
class PhoneInput;
class InputArea;
@ -342,7 +341,7 @@ private:
int _rowHeight = 0;
int _revokeWidth = 0;
ChildWidget<FlatLabel> _aboutRevoke;
ChildWidget<Ui::FlatLabel> _aboutRevoke;
ChildWidget<Ui::RoundButton> _cancel;
base::lambda_unique<void()> _revokeCallback;

View File

@ -23,6 +23,7 @@ using "basic.style";
using "ui/widgets/widgets.style";
using "intro/intro.style";
boxButtonFont: font(boxFontSize semibold);
defaultBoxButton: RoundButton {
textFg: #2f9fea;
textFgOver: #2f9fea;
@ -90,14 +91,70 @@ boxLinkButton: LinkButton {
boxOptionListPadding: margins(2px, 20px, 2px, 2px);
confirmInviteTitle: flatLabel(labelDefFlat) {
boxVerticalMargin: 10px;
boxWidth: 320px;
boxWideWidth: 364px;
boxPadding: margins(26px, 30px, 34px, 8px);
boxMaxListHeight: 600px;
boxLittleSkip: 10px;
boxMediumSkip: 20px;
boxTitleFont: font(boxFontSize bold);
boxTitlePosition: point(26px, 28px);
boxTitleHeight: 54px;
boxButtonPadding: margins(12px, 16px, 22px, 16px);
boxLabel: FlatLabel(defaultFlatLabel) {
font: font(boxFontSize);
align: align(topleft);
}
boxScroll: FlatScroll(defaultSolidScroll) {
round: 3px;
width: 18px;
deltax: 6px;
}
boxScrollSkip: 6px;
boxScrollShadowBg: #00000012;
boxShadow: icon {{ "box_shadow", windowShadowFg }};
boxShadowShift: 2px;
countryRowHeight: 36px;
countryRowNameFont: semiboldFont;
countryRowNameFg: boxTextFg;
countryRowPadding: margins(22px, 9px, 8px, 0px);
countryRowCodeFont: font(fsize);
countryRowBg: windowBg;
countryRowBgOver: windowBgOver;
countryRowCodeFg: windowSubTextFg;
countryRowCodeFgOver: windowSubTextFgOver;
countriesSkip: 12px;
countriesScroll: FlatScroll(boxScroll) {
deltat: 9px;
deltab: 3px;
}
boxTextStyle: TextStyle(defaultTextStyle) {
lineHeight: 22px;
}
boxPhotoPadding: margins(28px, 28px, 28px, 18px);
boxPhotoCompressedPadding: margins(0px, 2px, 0px, 22px);
boxPhotoTextFg: #808080;
cropPointSize: 10px;
cropSkip: 13px;
cropMinSize: 20px;
confirmInviteTitle: FlatLabel(defaultFlatLabel) {
font: font(16px semibold);
align: align(center);
width: 320px;
maxHeight: 24px;
textFg: #333333;
}
confirmInviteStatus: flatLabel(labelDefFlat) {
confirmInviteStatus: FlatLabel(defaultFlatLabel) {
font: font(boxFontSize);
align: align(center);
width: 320px;
@ -111,7 +168,7 @@ confirmInviteStatusTop: 136px;
confirmInviteUserHeight: 80px;
confirmInviteUserPhotoSize: 56px;
confirmInviteUserPhotoTop: 166px;
confirmInviteUserName: flatLabel(labelDefFlat) {
confirmInviteUserName: FlatLabel(defaultFlatLabel) {
font: normalFont;
align: align(center);
width: 66px;
@ -119,22 +176,22 @@ confirmInviteUserName: flatLabel(labelDefFlat) {
}
confirmInviteUserNameTop: 227px;
confirmPhoneAboutLabel: flatLabel(labelDefFlat) {
confirmPhoneAboutLabel: FlatLabel(defaultFlatLabel) {
width: 282px;
}
confirmPhoneCodeField: InputField(defaultInputField) {
}
revokePublicLinkStatusStyle: textStyle(defaultTextStyle) {
revokePublicLinkStatusStyle: TextStyle(defaultTextStyle) {
linkFg: contactsStatusFgOnline;
linkFgDown: contactsStatusFgOnline;
linkFlagsOver: font(fsize);
}
aboutRevokePublicLabel: flatLabel(labelDefFlat) {
aboutRevokePublicLabel: FlatLabel(defaultFlatLabel) {
font: normalFont;
align: align(topleft);
width: 320px;
textFg: windowTextFg;
textFg: windowFg;
}
contactUserIcon: icon {{ "add_contact_user", #999999 }};
@ -172,7 +229,7 @@ contactsAdminCheckbox: Checkbox(defaultBoxCheckbox) {
contactsAboutSkip: 53px;
contactsAboutHeight: 42px;
contactsAboutTop: 9px;
contactsScroll: flatScroll(boxScroll) {
contactsScroll: FlatScroll(boxScroll) {
deltab: 0px;
}
@ -180,7 +237,7 @@ contactsMultiSelect: MultiSelect {
bg: boxSearchBg;
padding: margins(8px, 8px, 8px, 8px);
maxHeight: 104px;
scroll: flatScroll(solidScroll) {
scroll: FlatScroll(defaultSolidScroll) {
deltat: 3px;
deltab: 3px;
round: 1px;
@ -195,7 +252,7 @@ contactsMultiSelect: MultiSelect {
height: 32px;
font: normalFont;
textBg: contactsBgOver;
textFg: windowTextFg;
textFg: windowFg;
textActiveBg: activeButtonBg;
textActiveFg: activeButtonFg;
deleteFg: activeButtonFg;
@ -242,13 +299,13 @@ contactsPhotoCheckbox: RoundImageCheckbox {
imageRadius: 21px;
imageSmallRadius: 18px;
selectWidth: 2px;
selectFg: windowActiveBg;
selectFg: windowBgActive;
selectDuration: 150;
checkBorder: windowBg;
checkBg: windowActiveBg;
checkBg: windowBgActive;
checkRadius: 10px;
checkSmallRadius: 3px;
checkIcon: icon {{ "default_checkbox_check", windowActiveFg, point(3px, 6px) }};
checkIcon: icon {{ "default_checkbox_check", windowFgActive, point(3px, 6px) }};
}
contactsPhotoDisabledCheckFg: #bbbbbb;
contactsNameCheckedFg: #2b88b8;
@ -263,7 +320,7 @@ sharePhotoCheckbox: RoundImageCheckbox(contactsPhotoCheckbox) {
imageSmallRadius: 24px;
}
shareNameFont: font(11px);
shareNameFg: windowTextFg;
shareNameFg: windowFg;
shareNameActiveFg: btnYesColor;
shareNameTop: 6px;
shareColumnSkip: 6px;
@ -289,7 +346,7 @@ notificationSampleSize: size(64px, 16px);
membersAboutLimitPadding: margins(0px, 12px, 0px, 12px);
sessionsScroll: flatScroll(boxScroll) {
sessionsScroll: FlatScroll(boxScroll) {
round: 2px;
deltax: 5px;
width: 14px;
@ -376,12 +433,12 @@ aboutVersionLink: LinkButton(defaultLinkButton) {
}
aboutTextTop: 34px;
aboutSkip: 14px;
aboutLabel: flatLabel(labelDefFlat) {
aboutLabel: FlatLabel(defaultFlatLabel) {
font: normalFont;
width: 330px;
align: align(topleft);
}
aboutTextStyle: textStyle(defaultTextStyle) {
aboutTextStyle: TextStyle(defaultTextStyle) {
lineHeight: 22px;
}
@ -419,7 +476,7 @@ langsButton: Radiobutton(defaultRadiobutton) {
backgroundPadding: 10px;
backgroundSize: size(108px, 193px);
backgroundScroll: flatScroll(boxScroll) {
backgroundScroll: FlatScroll(boxScroll) {
round: 2px;
width: 10px;
deltax: 3px;

View File

@ -29,6 +29,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "application.h"
#include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/labels.h"
#include "core/click_handler_types.h"
#include "localstorage.h"
@ -397,7 +398,7 @@ void ConvertToSupergroupBox::resizeEvent(QResizeEvent *e) {
PinMessageBox::PinMessageBox(ChannelData *channel, MsgId msgId) : AbstractBox(st::boxWidth)
, _channel(channel)
, _msgId(msgId)
, _text(this, lang(lng_pinned_pin_sure), FlatLabel::InitType::Simple, st::boxLabel)
, _text(this, lang(lng_pinned_pin_sure), Ui::FlatLabel::InitType::Simple, st::boxLabel)
, _notify(this, lang(lng_pinned_notify), true, st::defaultBoxCheckbox)
, _pin(this, lang(lng_pinned_pin), st::defaultBoxButton)
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) {
@ -450,7 +451,7 @@ RichDeleteMessageBox::RichDeleteMessageBox(ChannelData *channel, UserData *from,
, _channel(channel)
, _from(from)
, _msgId(msgId)
, _text(this, lang(lng_selected_delete_sure_this), FlatLabel::InitType::Simple, st::boxLabel)
, _text(this, lang(lng_selected_delete_sure_this), Ui::FlatLabel::InitType::Simple, st::boxLabel)
, _banUser(this, lang(lng_ban_user), false, st::defaultBoxCheckbox)
, _reportSpam(this, lang(lng_report_spam), false, st::defaultBoxCheckbox)
, _deleteAll(this, lang(lng_delete_all_from), false, st::defaultBoxCheckbox)
@ -562,7 +563,7 @@ ConfirmInviteBox::ConfirmInviteBox(const QString &title, const MTPChatPhoto &pho
int sumWidth = _participants.size() * _userWidth;
int left = (width() - sumWidth) / 2;
for_const (auto user, _participants) {
auto name = new FlatLabel(this, st::confirmInviteUserName);
auto name = new Ui::FlatLabel(this, st::confirmInviteUserName);
name->resizeToWidth(st::confirmInviteUserPhotoSize + padding);
name->setText(user->firstName.isEmpty() ? App::peerName(user) : user->firstName);
name->moveToLeft(left + (padding / 2), st::confirmInviteUserNameTop);

View File

@ -20,13 +20,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include "abstractbox.h"
#include "ui/flatlabel.h"
#include "core/lambda_wrap.h"
#include "boxes/abstractbox.h"
namespace Ui {
class Checkbox;
class RoundButton;
class FlatLabel;
} // namespace Ui
namespace st {
@ -237,7 +236,7 @@ private:
ChannelData *_channel;
MsgId _msgId;
ChildWidget<FlatLabel> _text;
ChildWidget<Ui::FlatLabel> _text;
ChildWidget<Ui::Checkbox> _notify;
ChildWidget<Ui::RoundButton> _pin;
@ -266,7 +265,7 @@ private:
UserData *_from;
MsgId _msgId;
ChildWidget<FlatLabel> _text;
ChildWidget<Ui::FlatLabel> _text;
ChildWidget<Ui::Checkbox> _banUser;
ChildWidget<Ui::Checkbox> _reportSpam;
ChildWidget<Ui::Checkbox> _deleteAll;
@ -304,8 +303,8 @@ protected:
void showAll() override;
private:
ChildWidget<FlatLabel> _title;
ChildWidget<FlatLabel> _status;
ChildWidget<Ui::FlatLabel> _title;
ChildWidget<Ui::FlatLabel> _status;
ImagePtr _photo;
QVector<UserData*> _participants;

View File

@ -25,6 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/confirmbox.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/input_fields.h"
#include "ui/widgets/labels.h"
#include "mainwidget.h"
#include "lang.h"
@ -97,7 +98,7 @@ void ConfirmPhoneBox::setCallStatus(const CallStatus &status) {
void ConfirmPhoneBox::launch() {
setBlockTitle(true);
_about = new FlatLabel(this, st::confirmPhoneAboutLabel);
_about.create(this, st::confirmPhoneAboutLabel);
TextWithEntities aboutText;
auto formattedPhone = App::formatPhone(_phone);
aboutText.text = lng_confirm_phone_about(lt_phone, formattedPhone);

View File

@ -22,11 +22,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/abstractbox.h"
class FlatLabel;
namespace Ui {
class InputField;
class RoundButton;
class FlatLabel;
} // namespace Ui
class ConfirmPhoneBox : public AbstractBox, public RPCSender {
@ -92,7 +91,7 @@ private:
mtpRequestId _checkCodeRequestId = 0;
ChildWidget<FlatLabel> _about = { nullptr };
ChildWidget<Ui::FlatLabel> _about = { nullptr };
ChildWidget<Ui::RoundButton> _send = { nullptr };
ChildWidget<Ui::RoundButton> _cancel = { nullptr };
ChildWidget<Ui::InputField> _code = { nullptr };

View File

@ -34,6 +34,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/widgets/buttons.h"
#include "ui/filedialog.h"
#include "ui/widgets/multi_select.h"
#include "ui/widgets/scroll_area.h"
#include "ui/effects/widget_slide_wrap.h"
#include "boxes/photocropbox.h"
#include "boxes/confirmbox.h"

View File

@ -81,7 +81,7 @@ void LocalStorageBox::paintEvent(QPaintEvent *e) {
paintTitle(p, lang(lng_local_storage_title));
p.setFont(st::boxTextFont);
p.setPen(st::windowTextFg);
p.setPen(st::windowFg);
checkLocalStoredCounts();
int top = titleHeight() + st::localStorageBoxSkip;
if (_imagesCount > 0) {

View File

@ -29,6 +29,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/contactsbox.h"
#include "boxes/confirmbox.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/scroll_area.h"
#include "observer_peer.h"
MembersBox::MembersBox(ChannelData *channel, MembersFilter filter) : ItemListBox(st::boxScroll)

View File

@ -28,6 +28,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "countries.h"
#include "boxes/confirmbox.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/scroll_area.h"
#include "styles/style_boxes.h"
SessionsBox::SessionsBox() : ScrollableBox(st::sessionsScroll)

View File

@ -36,6 +36,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/widgets/multi_select.h"
#include "history/history_media_types.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/scroll_area.h"
#include "boxes/contactsbox.h"
ShareBox::ShareBox(CopyCallback &&copyCallback, SubmitCallback &&submitCallback, FilterCallback &&filterCallback) : ItemListBox(st::boxScroll)

View File

@ -32,6 +32,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_boxes.h"
#include "styles/style_stickers.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/scroll_area.h"
namespace {

View File

@ -32,6 +32,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_boxes.h"
#include "styles/style_stickers.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/scroll_area.h"
StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::stickersScroll)
, _inner(this, set)

View File

@ -178,3 +178,18 @@ protected:
virtual void onClickImpl() const = 0;
};
class LambdaClickHandler : public ClickHandler {
public:
LambdaClickHandler(base::lambda_unique<void()> handler) : _handler(std_::move(handler)) {
}
void onClick(Qt::MouseButton button) const override final {
if (button == Qt::LeftButton && _handler) {
_handler();
}
}
private:
base::lambda_unique<void()> _handler;
};

View File

@ -33,7 +33,8 @@ dialogsDateSkip: 5px;
dialogsNameTop: 2px;
dialogsRowHeight: 62px;
dialogsFilterPadding: point(11px, 11px);
dialogsFilterPadding: point(7px, 7px);
dialogsFilterSkip: 4px;
dialogsPhotoSize: 46px;
dialogsPhotoPadding: 12px;
dialogsPadding: point(10px, 8px);
@ -45,49 +46,51 @@ dialogsSkip: 8px;
dialogsWidthMin: 260px;
dialogsWidthMax: 540px;
dialogsTextWidthMin: 150px;
dialogsScroll: flatScroll(scrollDef) {
dialogsScroll: FlatScroll(defaultFlatScroll) {
topsh: 0px;
bottomsh: 0px;
}
dialogsTextStyle: textStyle(defaultTextStyle) {
dialogsTextStyle: TextStyle(defaultTextStyle) {
linkFg: dialogsTextFgService;
linkFgDown: dialogsTextFgService;
linkFlagsOver: font(fsize);
}
dialogsTextStyleOver: textStyle(dialogsTextStyle) {
dialogsTextStyleOver: TextStyle(dialogsTextStyle) {
linkFg: dialogsTextFgServiceOver;
linkFgDown: dialogsTextFgServiceOver;
}
dialogsTextStyleActive: textStyle(dialogsTextStyle) {
dialogsTextStyleActive: TextStyle(dialogsTextStyle) {
linkFg: dialogsTextFgServiceActive;
linkFgDown: dialogsTextFgServiceActive;
}
dialogsTextStyleDraft: textStyle(dialogsTextStyle) {
dialogsTextStyleDraft: TextStyle(dialogsTextStyle) {
linkFg: dialogsDraftFg;
linkFgDown: dialogsDraftFg;
}
dialogsTextStyleDraftOver: textStyle(dialogsTextStyle) {
dialogsTextStyleDraftOver: TextStyle(dialogsTextStyle) {
linkFg: dialogsDraftFgOver;
linkFgDown: dialogsDraftFgOver;
}
dialogsTextStyleDraftActive: textStyle(dialogsTextStyle) {
dialogsTextStyleDraftActive: TextStyle(dialogsTextStyle) {
linkFg: dialogsDraftFgActive;
linkFgDown: dialogsDraftFgActive;
}
dialogsMenuToggle: IconButton {
width: 32px;
height: 32px;
width: 40px;
height: 40px;
icon: icon {{ "dialogs_menu", dialogsMenuIconFg }};
iconOver: icon {{ "dialogs_menu", dialogsMenuIconFgOver }};
iconPosition: point(6px, 6px);
iconPositionDown: point(6px, 6px);
iconPosition: point(10px, 10px);
iconPositionDown: point(10px, 10px);
rippleAreaPosition: point(0px, 0px);
rippleAreaSize: 32px;
ripple: defaultRippleAnimation;
rippleAreaSize: 40px;
ripple: RippleAnimation(defaultRippleAnimation) {
color: windowBgOver;
}
}
dialogsLock: IconButton(dialogsMenuToggle) {
icon: icon {{ "dialogs_lock", dialogsMenuIconFg }};
@ -110,33 +113,19 @@ dialogsCancelSearchInPeer: IconButton(dialogsMenuToggle) {
icon: icon {{ "dialogs_cancel_search", dialogsMenuIconFg }};
iconOver: icon {{ "dialogs_cancel_search", dialogsMenuIconFgOver }};
iconPosition: point(7px, 7px);
iconPositionDown: point(7px, 7px);
iconPosition: point(11px, 11px);
iconPositionDown: point(11px, 11px);
}
dialogsCancelSearch: IconButton(dialogsCancelSearchInPeer) {
width: 32px;
height: 32px;
iconPosition: point(7px, 7px);
iconPositionDown: point(7px, 7px);
rippleAreaSize: 0px;
}
dialogsMenu: Menu(defaultMenu) {
itemFont: semiboldFont;
itemIconPosition: point(28px, 11px);
itemPadding: margins(76px, 14px, 28px, 14px);
}
dialogsMenuWrap: DropdownMenu(defaultDropdownMenu) {
menu: dialogsMenu;
}
dialogsMenuPosition: point(-3px, -2px);
dialogsMenuNewGroup: icon {{ "menu_new_group", menuIconFg }};
dialogsMenuNewGroupOver: icon {{ "menu_new_group", menuIconFgOver }};
dialogsMenuNewChannel: icon {{ "menu_new_channel", menuIconFg }};
dialogsMenuNewChannelOver: icon {{ "menu_new_channel", menuIconFgOver }};
dialogsMenuContacts: icon {{ "menu_contacts", menuIconFg }};
dialogsMenuContactsOver: icon {{ "menu_contacts", menuIconFgOver }};
dialogsMenuSettings: icon {{ "menu_settings", menuIconFg }};
dialogsMenuSettingsOver: icon {{ "menu_settings", menuIconFgOver }};
dialogsMenuHelp: icon {{ "menu_help", menuIconFg }};
dialogsMenuHelpOver: icon {{ "menu_help", menuIconFgOver }};
dialogsChatTypeSkip: 22px;
dialogsChatIcon: icon {{ "dialogs_chat", dialogsChatIconFg, point(1px, 4px) }};
dialogsChatIconOver: icon {{ "dialogs_chat", dialogsChatIconFgOver, point(1px, 4px) }};

View File

@ -25,6 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "dialogs/dialogs_layout.h"
#include "styles/style_dialogs.h"
#include "styles/style_stickers.h"
#include "styles/style_history.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/popup_menu.h"
#include "data/data_drafts.h"
@ -412,7 +413,7 @@ void DialogsInner::mousePressEvent(QMouseEvent *e) {
void DialogsInner::resizeEvent(QResizeEvent *e) {
_addContactLnk->move((width() - _addContactLnk->width()) / 2, (st::noContactsHeight + st::noContactsFont->height) / 2);
_cancelSearchInPeer->move(width() - st::dialogsPadding.x() - st::dialogsCancelSearch.width, (st::dialogsRowHeight - st::dialogsCancelSearch.height) / 2);
_cancelSearchInPeer->moveToRight(st::dialogsFilterSkip + st::dialogsFilterPadding.x() - otherWidth(), (st::dialogsRowHeight - st::dialogsCancelSearchInPeer.height) / 2);
}
void DialogsInner::onDialogRowReplaced(Dialogs::Row *oldRow, Dialogs::Row *newRow) {
@ -2014,28 +2015,6 @@ void DialogsWidget::onChooseByDrag() {
void DialogsWidget::showMainMenu() {
App::wnd()->showMainMenu();
return;
if (!_mainMenu) {
_mainMenu.create(this, st::dialogsMenuWrap);
_mainMenu->addAction(lang(lng_create_group_title), [] {
App::wnd()->onShowNewGroup();
}, &st::dialogsMenuNewGroup, &st::dialogsMenuNewGroupOver);
_mainMenu->addAction(lang(lng_create_channel_title), [] {
App::wnd()->onShowNewChannel();
}, &st::dialogsMenuNewChannel, &st::dialogsMenuNewChannelOver);
_mainMenu->addAction(lang(lng_menu_contacts), [] {
Ui::showLayer(new ContactsBox());
}, &st::dialogsMenuContacts, &st::dialogsMenuContactsOver);
_mainMenu->addAction(lang(lng_menu_settings), [] {
App::wnd()->showSettings();
}, &st::dialogsMenuSettings, &st::dialogsMenuSettingsOver);
_mainMenu->addAction(lang(lng_settings_faq), [] {
QDesktopServices::openUrl(telegramFaqLink());
}, &st::dialogsMenuHelp, &st::dialogsMenuHelpOver);
}
updateMainMenuGeometry();
_mainMenu->showAnimated(Ui::PanelAnimation::Origin::TopLeft);
}
void DialogsWidget::searchMessages(const QString &query, PeerData *inPeer) {
@ -2381,7 +2360,6 @@ void DialogsWidget::onCompleteHashtag(QString tag) {
void DialogsWidget::resizeEvent(QResizeEvent *e) {
updateControlsGeometry();
updateMainMenuGeometry();
}
void DialogsWidget::updateLockUnlockVisibility() {
@ -2397,21 +2375,18 @@ void DialogsWidget::updateControlsGeometry() {
_forwardCancel->moveToLeft(0, filterTop);
filterTop += st::dialogsForwardHeight;
}
auto filterLeft = st::dialogsFilterPadding.x() * 2 + _mainMenuToggle->width();
auto filterWidth = width() - 2 * st::dialogsFilterPadding.x();
filterWidth -= st::dialogsFilterPadding.x() + _mainMenuToggle->width();
if (Global::LocalPasscode()) {
filterWidth -= st::dialogsFilterPadding.x() + _lockUnlock->width();
}
filterTop += st::dialogsFilterPadding.y();
auto filterLeft = st::dialogsFilterPadding.x() + _mainMenuToggle->width() + st::dialogsFilterPadding.x();
auto filterRight = (Global::LocalPasscode() ? (st::dialogsFilterPadding.x() + _lockUnlock->width()) : st::dialogsFilterSkip) + st::dialogsFilterPadding.x();
auto filterWidth = width() - filterLeft - filterRight;
auto scrollTop = st::dialogsFilterPadding.y() + _mainMenuToggle->height() + st::dialogsFilterPadding.y();
filterTop += (scrollTop - _filter->height()) / 2;
_filter->setGeometryToLeft(filterLeft, filterTop, filterWidth, _filter->height());
_mainMenuToggle->moveToLeft(st::dialogsFilterPadding.x(), _filter->y());
_lockUnlock->moveToRight(st::dialogsFilterPadding.x(), _filter->y());
_mainMenuToggle->moveToLeft(st::dialogsFilterPadding.x(), st::dialogsFilterPadding.y());
_lockUnlock->moveToRight(st::dialogsFilterPadding.x(), st::dialogsFilterPadding.y());
_cancelSearch->moveToLeft(filterLeft + filterWidth - _cancelSearch->width(), _filter->y());
auto addToScroll = App::main() ? App::main()->contentScrollAddToY() : 0;
auto newScrollTop = _scroll->scrollTop() + addToScroll;
auto scrollTop = filterTop + _filter->height() + st::dialogsFilterPadding.y();
auto scrollHeight = height() - scrollTop;
if (_updateTelegram) {
auto updateHeight = _updateTelegram->height();
@ -2428,12 +2403,6 @@ void DialogsWidget::updateControlsGeometry() {
}
}
void DialogsWidget::updateMainMenuGeometry() {
if (!_mainMenu) return;
_mainMenu->moveToLeft(st::dialogsMenuPosition.x(), st::dialogsMenuPosition.y());
}
void DialogsWidget::updateForwardBar() {
auto selecting = App::main()->selectingPeer();
auto oneColumnSelecting = (Adaptive::OneColumn() && selecting);

View File

@ -21,6 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#pragma once
#include "window/section_widget.h"
#include "ui/widgets/scroll_area.h"
namespace Dialogs {
class Row;
@ -46,7 +47,7 @@ enum DialogsSearchRequestType {
DialogsSearchMigratedFromOffset,
};
class DialogsInner : public SplittedWidget, public RPCSender, private base::Subscriber {
class DialogsInner : public Ui::SplittedWidget, public RPCSender, private base::Subscriber {
Q_OBJECT
public:
@ -310,7 +311,6 @@ private:
void showMainMenu();
void updateLockUnlockVisibility();
void updateControlsGeometry();
void updateMainMenuGeometry();
void updateForwardBar();
bool _dragInScroll = false;
@ -332,11 +332,10 @@ private:
ChildWidget<Ui::IconButton> _forwardCancel = { nullptr };
ChildWidget<Ui::IconButton> _mainMenuToggle;
ChildWidget<Ui::DropdownMenu> _mainMenu = { nullptr };
ChildWidget<Ui::FlatInput> _filter;
ChildWidget<Ui::IconButton> _cancelSearch;
ChildWidget<Ui::IconButton> _lockUnlock;
ChildWidget<ScrollArea> _scroll;
ChildWidget<Ui::ScrollArea> _scroll;
ChildWidget<DialogsInner> _inner;
ChildWidget<Ui::FlatButton> _updateTelegram = { nullptr };

View File

@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwindow.h"
#include "apiwrap.h"
#include "localstorage.h"
#include "ui/widgets/scroll_area.h"
#include "styles/style_history.h"
#include "styles/style_widgets.h"
#include "styles/style_stickers.h"
@ -624,11 +625,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);
p.setPen(selected ? st::mentionNameFgOver : st::mentionNameFg);
user->nameText.drawElided(p, 2 * st::mentionPadding.left() + st::mentionPhotoSize, i * st::mentionHeight + st::mentionTop, namewidth);
p.setFont(st::mentionFont);
p.setPen((selected ? st::mentionFgOverActive : st::mentionFgActive)->p);
p.setPen(selected ? st::mentionFgOverActive : st::mentionFgActive);
p.drawText(mentionleft + namewidth + st::mentionPadding.right(), i * st::mentionHeight + st::mentionTop + st::mentionFont->ascent, first);
if (!second.isEmpty()) {
p.setPen((selected ? st::mentionFgOver : st::mentionFg)->p);
@ -671,7 +672,7 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
auto commandText = '/' + toHighlight;
p.setPen(st::mentionNameFg);
p.setPen(selected ? st::mentionNameFgOver : 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

@ -23,6 +23,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/twidget.h"
#include "ui/effects/rect_shadow.h"
namespace Ui {
class ScrollArea;
} // namespace Ui
namespace internal {
using MentionRows = QList<UserData*>;
@ -106,7 +110,7 @@ private:
void rowsUpdated(const internal::MentionRows &mrows, const internal::HashtagRows &hrows, const internal::BotCommandRows &brows, const StickerPack &srows, bool resetScroll);
ChildWidget<ScrollArea> _scroll;
ChildWidget<Ui::ScrollArea> _scroll;
ChildWidget<internal::FieldAutocompleteInner> _inner;
ChatData *_chat = nullptr;

View File

@ -22,6 +22,31 @@ using "basic.style";
using "dialogs/dialogs.style";
using "ui/widgets/widgets.style";
BotKeyboardButton {
margin: pixels;
padding: pixels;
height: pixels;
textTop: pixels;
downTextTop: pixels;
}
historyScroll: FlatScroll(defaultFlatScroll) {
barColor: #89a0b47a;
bgColor: #89a0b44c;
barOverColor: #89a0b4bc;
bgOverColor: #89a0b46b;
round: 3px;
width: 12px;
deltax: 3px;
deltat: 3px;
deltab: 3px;
topsh: 0px;
bottomsh: -1px;
}
historyPaddingBottom: 10px;
historyToDownPosition: point(12px, 10px);
@ -41,7 +66,7 @@ historyEmptySize: 128px;
membersInnerWidth: 310px;
membersInnerHeightMax: 360px;
membersInnerDropdown: InnerDropdown(defaultInnerDropdown) {
scroll: flatScroll(solidScroll) {
scroll: FlatScroll(defaultSolidScroll) {
deltat: 3px;
deltab: 3px;
round: 1px;
@ -202,6 +227,12 @@ historyEditSaveIconOver: icon {{ "send_control_save", historySendIconFgOver, poi
historyAttach: IconButton(historySend) {
icon: icon {{ "send_control_attach", historyComposeIconFg }};
iconOver: icon {{ "send_control_attach", historyComposeIconFgOver }};
rippleAreaPosition: point(3px, 3px);
rippleAreaSize: 40px;
ripple: RippleAnimation(defaultRippleAnimation) {
color: windowBgOver;
}
}
historyAttachFileIcon: icon {{ "media_type_file", historyComposeIconFg }};
historyAttachFileIconOver: icon {{ "media_type_file", historyComposeIconFgOver }};
@ -214,6 +245,8 @@ historyAttachEmoji: IconButton(historyAttach) {
iconPosition: point(15px, 15px);
iconPositionDown: point(15px, 15px);
rippleAreaSize: 0px;
}
historyEmojiCircle: size(20px, 20px);
historyEmojiCirclePeriod: 1500;
@ -289,9 +322,17 @@ historyReplyCancel: IconButton {
iconPosition: point(-1px, -1px);
iconPositionDown: point(-1px, -1px);
rippleAreaPosition: point(4px, 4px);
rippleAreaSize: 40px;
ripple: RippleAnimation(defaultRippleAnimation) {
color: windowBgOver;
}
}
historyInlineBotCancel: IconButton(historyReplyCancel) {
height: 46px;
rippleAreaPosition: point(4px, 3px);
}
reportSpamHide: FlatButton {
@ -318,3 +359,59 @@ reportSpamSeparator: 30px;
reportSpamBg: #fffffff0;
reportSpamFg: #000000;
msgBotKbDuration: 200;
msgBotKbFont: semiboldFont;
msgBotKbOverBg: #ffffff1a;
msgBotKbIconPadding: 2px;
msgBotKbUrlIcon: icon {{ "inline_button_url", #ffffff }};
msgBotKbSwitchPmIcon: icon {{ "inline_button_switch", #ffffff }};
msgBotKbButton: BotKeyboardButton {
margin: 5px;
padding: 10px;
height: 36px;
textTop: 8px;
downTextTop: 9px;
}
botKbDuration: 200;
botKbBg: #edf1f5;
botKbOverBg: #d8e2ec;
botKbDownBg: #d8e2ec;
botKbColor: #4b565f;
botKbFont: font(15px semibold);
botKbButton: BotKeyboardButton {
margin: 10px;
padding: 10px;
height: 38px;
textTop: 9px;
downTextTop: 9px;
}
botKbTinyButton: BotKeyboardButton {
margin: 4px;
padding: 3px;
height: 25px;
textTop: 2px;
downTextTop: 2px;
}
botKbScroll: FlatScroll(defaultSolidScroll) {
deltax: 3px;
width: 10px;
}
mentionHeight: 40px;
mentionScroll: FlatScroll(defaultFlatScroll) {
topsh: 0px;
bottomsh: 0px;
}
mentionPadding: margins(8px, 5px, 8px, 5px);
mentionTop: 11px;
mentionFont: linkFont;
mentionNameFg: windowFg;
mentionNameFgOver: windowFgOver;
mentionPhotoSize: msgPhotoSize;
mentionBg: #ffffff;
mentionBgOver: #f5f5f5;
mentionFg: #777777;
mentionFgOver: #707070;
mentionFgActive: #0080c0;
mentionFgOverActive: #0077b3;

View File

@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "history/history_drag_area.h"
#include "styles/style_stickers.h"
#include "styles/style_boxes.h"
#include "boxes/confirmbox.h"
#include "boxes/stickersetbox.h"
#include "inline_bots/inline_bot_result.h"

View File

@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "history/history_service_layout.h"
#include "media/media_clip_reader.h"
#include "styles/style_dialogs.h"
#include "styles/style_history.h"
#include "fileuploader.h"
namespace {
@ -176,7 +177,7 @@ void ReplyKeyboard::resize(int width, int height) {
}
}
bool ReplyKeyboard::isEnoughSpace(int width, const style::botKeyboardButton &st) const {
bool ReplyKeyboard::isEnoughSpace(int width, const style::BotKeyboardButton &st) const {
for_const (auto &row, _rows) {
int s = row.size();
int widthLeft = width - ((s - 1) * st.margin + s * 2 * st.padding);
@ -317,6 +318,18 @@ void ReplyKeyboard::clearSelection() {
_a_selected.stop();
}
int ReplyKeyboard::Style::buttonSkip() const {
return _st->margin;
}
int ReplyKeyboard::Style::buttonPadding() const {
return _st->padding;
}
int ReplyKeyboard::Style::buttonHeight() const {
return _st->height;
}
void ReplyKeyboard::Style::paintButton(Painter &p, int outerWidth, const ReplyKeyboard::Button &button) const {
const QRect &rect = button.rect;
bool pressed = ClickHandler::showAsPressed(button.link);
@ -880,12 +893,14 @@ HistoryItem::~HistoryItem() {
}
}
void GoToMessageClickHandler::onClickImpl() const {
if (App::main()) {
HistoryItem *current = App::mousedItem();
if (current && current->history()->peer->id == peer()) {
App::main()->pushReplyReturn(current);
ClickHandlerPtr goToMessageClickHandler(PeerData *peer, MsgId msgId) {
return MakeShared<LambdaClickHandler>([peer, msgId] {
if (App::main()) {
auto current = App::mousedItem();
if (current && current->history()->peer == peer) {
App::main()->pushReplyReturn(current);
}
Ui::showPeerHistory(peer, msgId, Ui::ShowWay::Forward);
}
Ui::showPeerHistory(peer(), msgid(), Ui::ShowWay::Forward);
}
});
}

View File

@ -22,6 +22,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "core/runtime_composer.h"
namespace style {
struct BotKeyboardButton;
} // namespace style
class HistoryElement {
public:
HistoryElement() = default;
@ -281,21 +285,15 @@ private:
public:
class Style {
public:
Style(const style::botKeyboardButton &st) : _st(&st) {
Style(const style::BotKeyboardButton &st) : _st(&st) {
}
virtual void startPaint(Painter &p) const = 0;
virtual style::font textFont() const = 0;
int buttonSkip() const {
return _st->margin;
}
int buttonPadding() const {
return _st->padding;
}
int buttonHeight() const {
return _st->height;
}
int buttonSkip() const;
int buttonPadding() const;
int buttonHeight() const;
virtual void repaint(const HistoryItem *item) const = 0;
virtual ~Style() {
@ -308,7 +306,7 @@ public:
virtual int minButtonWidth(HistoryMessageReplyMarkup::Button::Type type) const = 0;
private:
const style::botKeyboardButton *_st;
const style::BotKeyboardButton *_st;
void paintButton(Painter &p, int outerWidth, const ReplyKeyboard::Button &button) const;
friend class ReplyKeyboard;
@ -320,7 +318,7 @@ public:
ReplyKeyboard(const ReplyKeyboard &other) = delete;
ReplyKeyboard &operator=(const ReplyKeyboard &other) = delete;
bool isEnoughSpace(int width, const style::botKeyboardButton &st) const;
bool isEnoughSpace(int width, const style::BotKeyboardButton &st) const;
void setStyle(StylePtr &&s);
void resize(int width, int height);
@ -951,30 +949,8 @@ public:
}
};
class MessageClickHandler : public LeftButtonClickHandler {
public:
MessageClickHandler(PeerId peer, MsgId msgid) : _peer(peer), _msgid(msgid) {
}
MessageClickHandler(HistoryItem *item) : _peer(item->history()->peer->id), _msgid(item->id) {
}
PeerId peer() const {
return _peer;
}
MsgId msgid() const {
return _msgid;
}
ClickHandlerPtr goToMessageClickHandler(PeerData *peer, MsgId msgId);
private:
PeerId _peer;
MsgId _msgid;
};
class GoToMessageClickHandler : public MessageClickHandler {
public:
using MessageClickHandler::MessageClickHandler;
protected:
void onClickImpl() const override;
};
inline ClickHandlerPtr goToMessageClickHandler(HistoryItem *item) {
return goToMessageClickHandler(item->history()->peer, item->id);
}

View File

@ -1927,33 +1927,6 @@ bool HistoryGif::dataLoaded() const {
return (!_parent || _parent->id > 0) ? _data->loaded() : false;
}
namespace {
class StickerClickHandler : public LeftButtonClickHandler {
public:
StickerClickHandler(const HistoryItem *item) : _item(item) {
}
protected:
void onClickImpl() const override {
if (auto media = _item->getMedia()) {
if (auto document = media->getDocument()) {
if (auto sticker = document->sticker()) {
if (sticker->set.type() != mtpc_inputStickerSetEmpty && App::main()) {
App::main()->stickersBox(sticker->set);
}
}
}
}
}
private:
const HistoryItem *_item;
};
} // namespace
HistorySticker::HistorySticker(HistoryItem *parent, DocumentData *document) : HistoryMedia(parent)
, _data(document)
, _emoji(_data->sticker()->alt) {
@ -1963,11 +1936,21 @@ HistorySticker::HistorySticker(HistoryItem *parent, DocumentData *document) : Hi
}
}
class TestClickHandler : public ClickHandler {
};
void HistorySticker::initDimensions() {
auto sticker = _data->sticker();
if (!_packLink && sticker && sticker->set.type() != mtpc_inputStickerSetEmpty) {
_packLink = ClickHandlerPtr(new StickerClickHandler(_parent));
_packLink = MakeShared<LambdaClickHandler>([document = _data] {
if (auto sticker = document->sticker()) {
if (sticker->set.type() != mtpc_inputStickerSetEmpty && App::main()) {
App::main()->stickersBox(sticker->set);
}
}
});
}
_pixw = _data->dimensions.width();
_pixh = _data->dimensions.height();
@ -2198,23 +2181,32 @@ int HistorySticker::additionalWidth(const HistoryMessageVia *via, const HistoryM
return result;
}
void SendMessageClickHandler::onClickImpl() const {
Ui::showPeerHistory(peer()->id, ShowAtUnreadMsgId, Ui::ShowWay::Forward);
namespace {
ClickHandlerPtr sendMessageClickHandler(PeerData *peer) {
return MakeShared<LambdaClickHandler>([peer] {
Ui::showPeerHistory(peer->id, ShowAtUnreadMsgId, Ui::ShowWay::Forward);
});
}
void AddContactClickHandler::onClickImpl() const {
if (HistoryItem *item = App::histItemById(peerToChannel(peer()), msgid())) {
if (HistoryMedia *media = item->getMedia()) {
if (media->type() == MediaTypeContact) {
QString fname = static_cast<HistoryContact*>(media)->fname();
QString lname = static_cast<HistoryContact*>(media)->lname();
QString phone = static_cast<HistoryContact*>(media)->phone();
Ui::showLayer(new AddContactBox(fname, lname, phone));
ClickHandlerPtr addContactClickHandler(HistoryItem *item) {
return MakeShared<LambdaClickHandler>([fullId = item->fullId()] {
if (auto item = App::histItemById(fullId)) {
if (auto media = item->getMedia()) {
if (media->type() == MediaTypeContact) {
auto contact = static_cast<HistoryContact*>(media);
auto fname = contact->fname();
auto lname = contact->lname();
auto phone = contact->phone();
Ui::showLayer(new AddContactBox(fname, lname, phone));
}
}
}
}
});
}
} // namespace
HistoryContact::HistoryContact(HistoryItem *parent, int32 userId, const QString &first, const QString &last, const QString &phone) : HistoryMedia(parent)
, _userId(userId)
, _contact(0)
@ -2236,10 +2228,10 @@ void HistoryContact::initDimensions() {
_contact->loadUserpic();
}
if (_contact && _contact->contact > 0) {
_linkl.reset(new SendMessageClickHandler(_contact));
_linkl = sendMessageClickHandler(_contact);
_link = lang(lng_profile_send_message).toUpper();
} else if (_userId) {
_linkl.reset(new AddContactClickHandler(_parent->history()->peer->id, _parent->id));
_linkl = addContactClickHandler(_parent);
_link = lang(lng_profile_add_contact).toUpper();
}
_linkw = _link.isEmpty() ? 0 : st::semiboldFont->width(_link);

View File

@ -898,21 +898,3 @@ private:
int32 fullHeight() const;
};
class SendMessageClickHandler : public PeerClickHandler {
public:
using PeerClickHandler::PeerClickHandler;
protected:
void onClickImpl() const override;
};
class AddContactClickHandler : public MessageClickHandler {
public:
using MessageClickHandler::MessageClickHandler;
protected:
void onClickImpl() const override;
};

View File

@ -83,7 +83,9 @@ void historyInitMessages() {
void HistoryMessageVia::create(int32 userId) {
_bot = App::user(peerFromUser(userId));
_maxWidth = st::msgServiceNameFont->width(lng_inline_bot_via(lt_inline_bot, '@' + _bot->username));
_lnk.reset(new ViaInlineBotClickHandler(_bot));
_lnk = MakeShared<LambdaClickHandler>([bot = _bot] {
App::insertBotCommand('@' + bot->username);
});
}
void HistoryMessageVia::resize(int32 availw) const {
@ -149,7 +151,7 @@ void HistoryMessageForwarded::create(const HistoryMessageVia *via) const {
textstyleSet(&st::inFwdTextStyle);
_text.setText(st::msgServiceNameFont, text, opts);
textstyleRestore();
_text.setLink(1, (_originalId && _authorOriginal->isChannel()) ? ClickHandlerPtr(new GoToMessageClickHandler(_authorOriginal->id, _originalId)) : _authorOriginal->openLink());
_text.setLink(1, (_originalId && _authorOriginal->isChannel()) ? goToMessageClickHandler(_authorOriginal, _originalId) : _authorOriginal->openLink());
if (via) {
_text.setLink(2, via->_lnk);
}
@ -173,7 +175,7 @@ bool HistoryMessageReply::updateData(HistoryMessage *holder, bool force) {
updateName();
replyToLnk.reset(new GoToMessageClickHandler(replyToMsg->history()->peer->id, replyToMsg->id));
replyToLnk = goToMessageClickHandler(replyToMsg);
if (!replyToMsg->Has<HistoryMessageForwarded>()) {
if (auto bot = replyToMsg->viaBot()) {
_replyToVia.reset(new HistoryMessageVia());
@ -1760,7 +1762,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
auto from = textcmdLink(1, _from->name);
Links links;
links.push_back(MakeShared<PeerOpenClickHandler>(_from));
links.push_back(peerOpenClickHandler(_from));
switch (action.type()) {
case mtpc_messageActionChatAddUser: {
@ -1778,7 +1780,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
if (u == _from) {
text = lng_action_user_joined(lt_from, from);
} else {
links.push_back(MakeShared<PeerOpenClickHandler>(u));
links.push_back(peerOpenClickHandler(u));
text = lng_action_add_user(lt_from, from, lt_user, textcmdLink(2, u->name));
}
} else if (v.isEmpty()) {
@ -1794,7 +1796,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
} else {
text = lng_action_add_users_and_last(lt_accumulated, text, lt_user, linkText);
}
links.push_back(MakeShared<PeerOpenClickHandler>(u));
links.push_back(peerOpenClickHandler(u));
}
text = lng_action_add_users_many(lt_from, from, lt_users, text);
}
@ -1811,7 +1813,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
text = lng_action_user_joined_by_link(lt_from, from);
//} else {
// UserData *u = App::user(App::peerFromUser(d.vinviter_id));
// links.push_back(MakeShared<PeerOpenClickHandler>(u));
// links.push_back(peerOpenClickHandler(u));
// text = lng_action_user_joined_by_link_from(lt_from, from, lt_inviter, textcmdLink(2, u->name));
//}
if (_from->isSelf() && history()->peer->isMegagroup()) {
@ -1847,7 +1849,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
text = lng_action_user_left(lt_from, from);
} else {
auto u = App::user(peerFromUser(d.vuser_id));
links.push_back(MakeShared<PeerOpenClickHandler>(u));
links.push_back(peerOpenClickHandler(u));
text = lng_action_kick_user(lt_from, from, lt_user, textcmdLink(2, u->name));
}
} break;
@ -1913,7 +1915,7 @@ bool HistoryService::updateDependent(bool force) {
}
if (!dependent->lnk) {
dependent->lnk.reset(new GoToMessageClickHandler(history()->peer->id, dependent->msgId));
dependent->lnk = goToMessageClickHandler(history()->peer, dependent->msgId);
}
bool gotDependencyItem = false;
if (!dependent->msg) {
@ -2312,7 +2314,7 @@ bool HistoryService::updateDependentText() {
auto from = textcmdLink(1, _from->name);
QString text;
Links links;
links.push_back(MakeShared<PeerOpenClickHandler>(_from));
links.push_back(peerOpenClickHandler(_from));
if (Has<HistoryServicePinned>()) {
result = preparePinnedText(from, &text, &links);
} else if (Has<HistoryServiceGameScore>()) {
@ -2352,7 +2354,7 @@ HistoryJoined::HistoryJoined(History *history, const QDateTime &inviteDate, User
if (peerToUser(inviter->id) == MTP::authedId()) {
return lang(history->isMegagroup() ? lng_action_you_joined_group : lng_action_you_joined);
}
links.push_back(MakeShared<PeerOpenClickHandler>(inviter));
links.push_back(peerOpenClickHandler(inviter));
if (history->isMegagroup()) {
return lng_action_add_you_group(lt_from, textcmdLink(1, inviter->name));
}
@ -2360,7 +2362,3 @@ HistoryJoined::HistoryJoined(History *history, const QDateTime &inviteDate, User
})();
setServiceText(text, links);
}
void ViaInlineBotClickHandler::onClickImpl() const {
App::insertBotCommand('@' + _bot->username);
}

View File

@ -366,16 +366,3 @@ protected:
friend class HistoryItemInstantiated<HistoryJoined>;
};
class ViaInlineBotClickHandler : public LeftButtonClickHandler {
public:
ViaInlineBotClickHandler(UserData *bot) : _bot(bot) {
}
protected:
void onClickImpl() const override;
private:
UserData *_bot;
};

View File

@ -118,7 +118,7 @@ ApiWrap::RequestMessageDataCallback replyEditMessageDataCallback() {
// flick scroll taken from http://qt-project.org/doc/qt-4.8/demos-embedded-anomaly-src-flickcharm-cpp.html
HistoryInner::HistoryInner(HistoryWidget *historyWidget, ScrollArea *scroll, History *history) : TWidget(nullptr)
HistoryInner::HistoryInner(HistoryWidget *historyWidget, Ui::ScrollArea *scroll, History *history) : TWidget(nullptr)
, _peer(history->peer)
, _migrated(history->peer->migrateFrom() ? App::history(history->peer->migrateFrom()->id) : nullptr)
, _history(history)
@ -567,16 +567,16 @@ bool HistoryInner::event(QEvent *e) {
void HistoryInner::onTouchScrollTimer() {
uint64 nowTime = getms();
if (_touchScrollState == TouchScrollAcceleration && _touchWaitingAcceleration && (nowTime - _touchAccelerationTime) > 40) {
_touchScrollState = TouchScrollManual;
if (_touchScrollState == Ui::TouchScrollState::Acceleration && _touchWaitingAcceleration && (nowTime - _touchAccelerationTime) > 40) {
_touchScrollState = Ui::TouchScrollState::Manual;
touchResetSpeed();
} else if (_touchScrollState == TouchScrollAuto || _touchScrollState == TouchScrollAcceleration) {
} else if (_touchScrollState == Ui::TouchScrollState::Auto || _touchScrollState == Ui::TouchScrollState::Acceleration) {
int32 elapsed = int32(nowTime - _touchTime);
QPoint delta = _touchSpeed * elapsed / 1000;
bool hasScrolled = _widget->touchScroll(delta);
if (_touchSpeed.isNull() || !hasScrolled) {
_touchScrollState = TouchScrollManual;
_touchScrollState = Ui::TouchScrollState::Manual;
_touchScroll = false;
_touchScrollTimer.stop();
} else {
@ -598,7 +598,7 @@ void HistoryInner::touchUpdateSpeed() {
// of a small horizontal offset when scrolling vertically
const int newSpeedY = (qAbs(pixelsPerSecond.y()) > FingerAccuracyThreshold) ? pixelsPerSecond.y() : 0;
const int newSpeedX = (qAbs(pixelsPerSecond.x()) > FingerAccuracyThreshold) ? pixelsPerSecond.x() : 0;
if (_touchScrollState == TouchScrollAuto) {
if (_touchScrollState == Ui::TouchScrollState::Auto) {
const int oldSpeedY = _touchSpeed.y();
const int oldSpeedX = _touchSpeed.x();
if ((oldSpeedY <= 0 && newSpeedY <= 0) || ((oldSpeedY >= 0 && newSpeedY >= 0)
@ -644,7 +644,7 @@ void HistoryInner::touchEvent(QTouchEvent *e) {
_touchInProgress = false;
_touchSelectTimer.stop();
_touchScroll = _touchSelect = false;
_touchScrollState = TouchScrollManual;
_touchScrollState = Ui::TouchScrollState::Manual;
dragActionCancel();
return;
}
@ -664,8 +664,8 @@ void HistoryInner::touchEvent(QTouchEvent *e) {
if (e->touchPoints().isEmpty()) return;
_touchInProgress = true;
if (_touchScrollState == TouchScrollAuto) {
_touchScrollState = TouchScrollAcceleration;
if (_touchScrollState == Ui::TouchScrollState::Auto) {
_touchScrollState = Ui::TouchScrollState::Acceleration;
_touchWaitingAcceleration = true;
_touchAccelerationTime = getms();
touchUpdateSpeed();
@ -688,13 +688,13 @@ void HistoryInner::touchEvent(QTouchEvent *e) {
touchUpdateSpeed();
}
if (_touchScroll) {
if (_touchScrollState == TouchScrollManual) {
if (_touchScrollState == Ui::TouchScrollState::Manual) {
touchScrollUpdated(_touchPos);
} else if (_touchScrollState == TouchScrollAcceleration) {
} else if (_touchScrollState == Ui::TouchScrollState::Acceleration) {
touchUpdateSpeed();
_touchAccelerationTime = getms();
if (_touchSpeed.isNull()) {
_touchScrollState = TouchScrollManual;
_touchScrollState = Ui::TouchScrollState::Manual;
}
}
}
@ -709,17 +709,17 @@ void HistoryInner::touchEvent(QTouchEvent *e) {
showContextMenu(&contextMenu, true);
_touchScroll = false;
} else if (_touchScroll) {
if (_touchScrollState == TouchScrollManual) {
_touchScrollState = TouchScrollAuto;
if (_touchScrollState == Ui::TouchScrollState::Manual) {
_touchScrollState = Ui::TouchScrollState::Auto;
_touchPrevPosValid = false;
_touchScrollTimer.start(15);
_touchTime = getms();
} else if (_touchScrollState == TouchScrollAuto) {
_touchScrollState = TouchScrollManual;
} else if (_touchScrollState == Ui::TouchScrollState::Auto) {
_touchScrollState = Ui::TouchScrollState::Manual;
_touchScroll = false;
touchResetSpeed();
} else if (_touchScrollState == TouchScrollAcceleration) {
_touchScrollState = TouchScrollAuto;
} else if (_touchScrollState == Ui::TouchScrollState::Acceleration) {
_touchScrollState = Ui::TouchScrollState::Auto;
_touchWaitingAcceleration = false;
_touchPrevPosValid = false;
}
@ -2421,7 +2421,8 @@ void ReportSpamPanel::setReported(bool reported, PeerData *onPeer) {
update();
}
BotKeyboard::BotKeyboard() {
BotKeyboard::BotKeyboard(QWidget *parent) : TWidget(parent)
, _st(&st::botKbButton) {
setGeometry(0, 0, _st->margin, st::botKbScroll.deltat);
_height = st::botKbScroll.deltat;
setMouseTracking(true);
@ -3037,6 +3038,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
, a_recordCancelActive(0, 0)
, _recordCancelWidth(st::historyRecordFont->width(lang(lng_record_cancel)))
, _kbScroll(this, st::botKbScroll)
, _keyboard(this)
, _attachType(this, st::historyAttachDropdownMenu)
, _emojiPan(this)
, _attachDragDocument(this)
@ -3047,10 +3049,10 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
setAcceptDrops(true);
subscribe(FileDownload::ImageLoaded(), [this] { update(); });
connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
connect(&_reportSpamPanel, SIGNAL(reportClicked()), this, SLOT(onReportSpamClicked()));
connect(&_reportSpamPanel, SIGNAL(hideClicked()), this, SLOT(onReportSpamHide()));
connect(&_reportSpamPanel, SIGNAL(clearClicked()), this, SLOT(onReportSpamClear()));
connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
connect(_reportSpamPanel, SIGNAL(reportClicked()), this, SLOT(onReportSpamClicked()));
connect(_reportSpamPanel, SIGNAL(hideClicked()), this, SLOT(onReportSpamHide()));
connect(_reportSpamPanel, SIGNAL(clearClicked()), this, SLOT(onReportSpamClear()));
connect(_historyToEnd, SIGNAL(clicked()), this, SLOT(onHistoryToEnd()));
connect(_fieldBarCancel, SIGNAL(clicked()), this, SLOT(onFieldBarCancel()));
connect(_send, SIGNAL(clicked()), this, SLOT(onSend()));
@ -3117,10 +3119,10 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
_fieldBarCancel->hide();
_scroll.hide();
_scroll->hide();
_kbScroll.setWidget(&_keyboard);
_kbScroll.hide();
_kbScroll->setOwnedWidget(_keyboard);
_kbScroll->hide();
updateScrollColors();
@ -3143,8 +3145,8 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
_joinChannel->hide();
_muteUnmute->hide();
_reportSpamPanel.move(0, 0);
_reportSpamPanel.hide();
_reportSpamPanel->move(0, 0);
_reportSpamPanel->hide();
_attachToggle->hide();
_attachEmoji->hide();
@ -3509,7 +3511,7 @@ void HistoryWidget::activate() {
}
void HistoryWidget::setInnerFocus() {
if (_scroll.isHidden()) {
if (_scroll->isHidden()) {
setFocus();
} else if (_list) {
if (_selCount || (_list && _list->wasSelectedText()) || _recording || isBotStart() || isBlocked() || !_canSendMessages) {
@ -3588,7 +3590,7 @@ void HistoryWidget::notify_inlineBotRequesting(bool requesting) {
}
void HistoryWidget::notify_replyMarkupUpdated(const HistoryItem *item) {
if (_keyboard.forMsgId() == item->fullId()) {
if (_keyboard->forMsgId() == item->fullId()) {
updateBotKeyboard(item->history(), true);
}
}
@ -4248,7 +4250,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
_membersDropdownShowTimer.stop();
if (_list) _list->deleteLater();
_list = nullptr;
_scroll.takeWidget();
_scroll->takeWidget();
clearInlineBot();
@ -4312,10 +4314,10 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
}
}
_list = new HistoryInner(this, &_scroll, _history);
_list = new HistoryInner(this, _scroll, _history);
_list->hide();
_scroll.hide();
_scroll.setWidget(_list);
_scroll->hide();
_scroll->setWidget(_list);
_list->show();
_updateHistoryItems.stop();
@ -4343,7 +4345,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
onPreviewParse();
}
connect(&_scroll, SIGNAL(geometryChanged()), _list, SLOT(onParentGeometryChanged()));
connect(_scroll, SIGNAL(geometryChanged()), _list, SLOT(onParentGeometryChanged()));
if (startBot && _peer->isUser() && _peer->asUser()->botInfo) {
if (wasHistory) _peer->asUser()->botInfo->inlineReturnPeerId = wasHistory->peer->id;
@ -4446,7 +4448,7 @@ void HistoryWidget::updateReportSpamStatus() {
} else if (_reportSpamStatus == dbiprsShowButton) {
requestReportSpamSetting();
}
_reportSpamPanel.setReported(_reportSpamStatus == dbiprsReportSent, _peer);
_reportSpamPanel->setReported(_reportSpamStatus == dbiprsReportSent, _peer);
return;
} else if (_peer->migrateFrom()) { // migrate report status
i = cReportSpamStatuses().constFind(_peer->migrateFrom()->id);
@ -4463,7 +4465,7 @@ void HistoryWidget::updateReportSpamStatus() {
cRefReportSpamStatuses().insert(_peer->id, _reportSpamStatus);
Local::writeReportSpamStatuses();
_reportSpamPanel.setReported(_reportSpamStatus == dbiprsReportSent, _peer);
_reportSpamPanel->setReported(_reportSpamStatus == dbiprsReportSent, _peer);
return;
}
}
@ -4477,7 +4479,7 @@ void HistoryWidget::updateReportSpamStatus() {
requestReportSpamSetting();
}
if (_reportSpamStatus == dbiprsHidden) {
_reportSpamPanel.setReported(false, _peer);
_reportSpamPanel->setReported(false, _peer);
cRefReportSpamStatuses().insert(_peer->id, _reportSpamStatus);
Local::writeReportSpamStatuses();
}
@ -4498,7 +4500,7 @@ void HistoryWidget::reportSpamSettingDone(const MTPPeerSettings &result, mtpRequ
DBIPeerReportSpamStatus status = d.is_report_spam() ? dbiprsShowButton : dbiprsHidden;
if (status != _reportSpamStatus) {
_reportSpamStatus = status;
_reportSpamPanel.setReported(false, _peer);
_reportSpamPanel->setReported(false, _peer);
cRefReportSpamStatuses().insert(_peer->id, _reportSpamStatus);
Local::writeReportSpamStatuses();
@ -4530,9 +4532,9 @@ void HistoryWidget::updateControlsVisibility() {
}
updateToEndVisibility();
if (!_history || _a_show.animating()) {
_reportSpamPanel.hide();
_scroll.hide();
_kbScroll.hide();
_reportSpamPanel->hide();
_scroll->hide();
_kbScroll->hide();
_send->hide();
if (_inlineBotCancel) _inlineBotCancel->hide();
_unblock->hide();
@ -4562,15 +4564,15 @@ void HistoryWidget::updateControlsVisibility() {
_pinnedBar->cancel->show();
_pinnedBar->shadow->show();
}
if (_firstLoadRequest && !_scroll.isHidden()) {
_scroll.hide();
} else if (!_firstLoadRequest && _scroll.isHidden()) {
_scroll.show();
if (_firstLoadRequest && !_scroll->isHidden()) {
_scroll->hide();
} else if (!_firstLoadRequest && _scroll->isHidden()) {
_scroll->show();
}
if (_reportSpamStatus == dbiprsShowButton || _reportSpamStatus == dbiprsReportSent) {
_reportSpamPanel.show();
_reportSpamPanel->show();
} else {
_reportSpamPanel.hide();
_reportSpamPanel->hide();
}
if (isBlocked() || isJoinChannel() || isMuteUnmute()) {
if (isBlocked()) {
@ -4602,7 +4604,7 @@ void HistoryWidget::updateControlsVisibility() {
_botStart->hide();
_attachToggle->hide();
_silent->hide();
_kbScroll.hide();
_kbScroll->hide();
_fieldBarCancel->hide();
_attachToggle->hide();
_attachEmoji->hide();
@ -4636,7 +4638,7 @@ void HistoryWidget::updateControlsVisibility() {
_botCommandStart->hide();
_attachToggle->hide();
_silent->hide();
_kbScroll.hide();
_kbScroll->hide();
_fieldBarCancel->hide();
} else {
_unblock->hide();
@ -4665,29 +4667,29 @@ void HistoryWidget::updateControlsVisibility() {
_attachToggle->hide();
_silent->hide();
if (_kbShown) {
_kbScroll.show();
_kbScroll->show();
} else {
_kbScroll.hide();
_kbScroll->hide();
}
} else {
_field->show();
if (_kbShown) {
_kbScroll.show();
_kbScroll->show();
_attachEmoji->hide();
_botKeyboardHide->show();
_botKeyboardShow->hide();
_botCommandStart->hide();
} else if (_kbReplyTo) {
_kbScroll.hide();
_kbScroll->hide();
_attachEmoji->show();
_botKeyboardHide->hide();
_botKeyboardShow->hide();
_botCommandStart->hide();
} else {
_kbScroll.hide();
_kbScroll->hide();
_attachEmoji->show();
_botKeyboardHide->hide();
if (_keyboard.hasMarkup()) {
if (_keyboard->hasMarkup()) {
_botKeyboardShow->show();
_botCommandStart->hide();
} else {
@ -4727,7 +4729,7 @@ void HistoryWidget::updateControlsVisibility() {
_muteUnmute->hide();
_attachToggle->hide();
_silent->hide();
_kbScroll.hide();
_kbScroll->hide();
_fieldBarCancel->hide();
_attachToggle->hide();
_attachEmoji->hide();
@ -4736,7 +4738,7 @@ void HistoryWidget::updateControlsVisibility() {
_botCommandStart->hide();
_attachType->hide();
_emojiPan->hide();
_kbScroll.hide();
_kbScroll->hide();
if (!_field->isHidden()) {
_field->hide();
resizeEvent(0);
@ -4758,7 +4760,7 @@ void HistoryWidget::destroyUnreadBar() {
void HistoryWidget::newUnreadMsg(History *history, HistoryItem *item) {
if (_history == history) {
if (_scroll.scrollTop() + 1 > _scroll.scrollTopMax()) {
if (_scroll->scrollTop() + 1 > _scroll->scrollTopMax()) {
destroyUnreadBar();
}
if (App::wnd()->doWeReadServerHistory()) {
@ -4776,7 +4778,7 @@ void HistoryWidget::historyToDown(History *history) {
migrated->forgetScrollState();
}
if (history == _history) {
_scroll.scrollToY(_scroll.scrollTopMax());
_scroll->scrollToY(_scroll->scrollTopMax());
}
}
@ -4958,12 +4960,12 @@ bool HistoryWidget::doWeReadServerHistory() const {
if (!_history || !_list) return true;
if (_firstLoadRequest || _a_show.animating()) return false;
if (_history->loadedAtBottom()) {
int scrollTop = _scroll.scrollTop();
if (scrollTop + 1 > _scroll.scrollTopMax()) return true;
int scrollTop = _scroll->scrollTop();
if (scrollTop + 1 > _scroll->scrollTopMax()) return true;
auto showFrom = (_migrated && _migrated->showFrom) ? _migrated->showFrom : (_history ? _history->showFrom : nullptr);
if (showFrom && !showFrom->detached()) {
int scrollBottom = scrollTop + _scroll.height();
int scrollBottom = scrollTop + _scroll->height();
if (scrollBottom > _list->itemTop(showFrom)) return true;
}
}
@ -5110,9 +5112,9 @@ void HistoryWidget::onScroll() {
}
void HistoryWidget::visibleAreaUpdated() {
if (_list && !_scroll.isHidden()) {
int scrollTop = _scroll.scrollTop();
int scrollBottom = scrollTop + _scroll.height();
if (_list && !_scroll->isHidden()) {
int scrollTop = _scroll->scrollTop();
int scrollBottom = scrollTop + _scroll->height();
_list->visibleAreaUpdated(scrollTop, scrollBottom);
if (_history->loadedAtBottom() && (_history->unreadCount() > 0 || (_migrated && _migrated->unreadCount() > 0))) {
auto showFrom = (_migrated && _migrated->showFrom) ? _migrated->showFrom : (_history ? _history->showFrom : nullptr);
@ -5124,11 +5126,11 @@ void HistoryWidget::visibleAreaUpdated() {
}
void HistoryWidget::preloadHistoryIfNeeded() {
if (_firstLoadRequest || _scroll.isHidden() || !_peer) return;
if (_firstLoadRequest || _scroll->isHidden() || !_peer) return;
updateToEndVisibility();
int st = _scroll.scrollTop(), stm = _scroll.scrollTopMax(), sh = _scroll.height();
int st = _scroll->scrollTop(), stm = _scroll->scrollTopMax(), sh = _scroll->height();
if (st + PreloadHeightsCount * sh > stm) {
loadMessagesDown();
}
@ -5287,7 +5289,7 @@ void HistoryWidget::onSend(bool ctrlShiftEnter, MsgId replyTo) {
if (_previewData && _previewData->pendingTill) previewCancel();
_field->setFocus();
if (!_keyboard.hasMarkup() && _keyboard.forceReply() && !_kbReplyTo) onKbToggle();
if (!_keyboard->hasMarkup() && _keyboard->forceReply() && !_kbReplyTo) onKbToggle();
}
void HistoryWidget::onUnblock() {
@ -5335,11 +5337,11 @@ void HistoryWidget::onBotStart() {
MTP::send(MTPmessages_StartBot(_peer->asUser()->inputUser, MTP_inputPeerEmpty(), MTP_long(randomId), MTP_string(token)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::addParticipantFail, _peer->asUser()));
_peer->asUser()->botInfo->startToken = QString();
if (_keyboard.hasMarkup()) {
if (_keyboard.singleUse() && _keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId) && _history->lastKeyboardUsed) {
if (_keyboard->hasMarkup()) {
if (_keyboard->singleUse() && _keyboard->forMsgId() == FullMsgId(_channel, _history->lastKeyboardId) && _history->lastKeyboardUsed) {
_history->lastKeyboardHiddenId = _history->lastKeyboardId;
}
if (!kbWasHidden()) _kbShown = _keyboard.hasMarkup();
if (!kbWasHidden()) _kbShown = _keyboard->hasMarkup();
}
}
updateControlsVisibility();
@ -5479,9 +5481,9 @@ void HistoryWidget::showAnimated(Window::SlideDirection direction, const Window:
App::main()->topBar()->startAnim();
_topShadow->setVisible(params.withTopBarShadow ? true : false);
_scroll.hide();
_kbScroll.hide();
_reportSpamPanel.hide();
_scroll->hide();
_kbScroll->hide();
_reportSpamPanel->hide();
_historyToEnd->hide();
_attachToggle->hide();
_attachEmoji->hide();
@ -5684,7 +5686,7 @@ void HistoryWidget::leaveEvent(QEvent *e) {
void HistoryWidget::mouseMoveEvent(QMouseEvent *e) {
QPoint pos(e ? e->pos() : mapFromGlobal(QCursor::pos()));
bool inRecord = _send->geometry().contains(pos);
bool inField = pos.y() >= (_scroll.y() + _scroll.height()) && pos.y() < height() && pos.x() >= 0 && pos.x() < width();
bool inField = pos.y() >= (_scroll->y() + _scroll->height()) && pos.y() < height() && pos.x() >= 0 && pos.x() < width();
bool inReplyEdit = QRect(st::historyReplySkip, _field->y() - st::historySendPadding - st::historyReplyHeight, width() - st::historyReplySkip - _fieldBarCancel->width(), st::historyReplyHeight).contains(pos) && (_editMsgId || replyToId());
bool inPinnedMsg = QRect(0, 0, width(), st::historyReplyHeight).contains(pos) && _pinnedBar;
if (inRecord != _inRecord) {
@ -5750,7 +5752,7 @@ void HistoryWidget::stopRecording(bool send) {
void HistoryWidget::sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo) { // replyTo != 0 from ReplyKeyboardMarkup, == 0 from cmd links
if (!_peer || _peer != peer) return;
bool lastKeyboardUsed = (_keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId)) && (_keyboard.forMsgId() == FullMsgId(_channel, replyTo));
bool lastKeyboardUsed = (_keyboard->forMsgId() == FullMsgId(_channel, _history->lastKeyboardId)) && (_keyboard->forMsgId() == FullMsgId(_channel, replyTo));
QString toSend = cmd;
if (bot && (!bot->isUser() || !bot->asUser()->botInfo)) {
@ -5773,7 +5775,7 @@ void HistoryWidget::sendBotCommand(PeerData *peer, UserData *bot, const QString
cancelReply();
onCloudDraftSave();
}
if (_keyboard.singleUse() && _keyboard.hasMarkup() && lastKeyboardUsed) {
if (_keyboard->singleUse() && _keyboard->hasMarkup() && lastKeyboardUsed) {
if (_kbShown) onKbToggle(false);
_history->lastKeyboardUsed = true;
}
@ -5787,7 +5789,7 @@ void HistoryWidget::app_sendBotCallback(const HistoryMessageReplyMarkup::Button
return;
}
bool lastKeyboardUsed = (_keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId)) && (_keyboard.forMsgId() == FullMsgId(_channel, msg->id));
bool lastKeyboardUsed = (_keyboard->forMsgId() == FullMsgId(_channel, _history->lastKeyboardId)) && (_keyboard->forMsgId() == FullMsgId(_channel, msg->id));
auto bot = msg->getMessageBot();
@ -5807,7 +5809,7 @@ void HistoryWidget::app_sendBotCallback(const HistoryMessageReplyMarkup::Button
if (_replyToId == msg->id) {
cancelReply();
}
if (_keyboard.singleUse() && _keyboard.hasMarkup() && lastKeyboardUsed) {
if (_keyboard->singleUse() && _keyboard->hasMarkup() && lastKeyboardUsed) {
if (_kbShown) onKbToggle(false);
_history->lastKeyboardUsed = true;
}
@ -5917,7 +5919,7 @@ bool HistoryWidget::insertBotCommand(const QString &cmd, bool specialGif) {
bool HistoryWidget::eventFilter(QObject *obj, QEvent *e) {
if (obj == _historyToEnd && e->type() == QEvent::Wheel) {
return _scroll.viewportEvent(e);
return _scroll->viewportEvent(e);
}
return TWidget::eventFilter(obj, e);
}
@ -6073,7 +6075,7 @@ bool HistoryWidget::isMuteUnmute() const {
bool HistoryWidget::updateCmdStartShown() {
bool cmdStartShown = false;
if (_history && _peer && ((_peer->isChat() && _peer->asChat()->botStatus > 0) || (_peer->isMegagroup() && _peer->asChannel()->mgInfo->botStatus > 0) || (_peer->isUser() && _peer->asUser()->botInfo))) {
if (!isBotStart() && !isBlocked() && !_keyboard.hasMarkup() && !_keyboard.forceReply()) {
if (!isBotStart() && !isBlocked() && !_keyboard->hasMarkup() && !_keyboard->forceReply()) {
if (!_field->hasSendText()) {
cmdStartShown = true;
}
@ -6087,7 +6089,7 @@ bool HistoryWidget::updateCmdStartShown() {
}
bool HistoryWidget::kbWasHidden() const {
return _history && (_keyboard.forMsgId() == FullMsgId(_history->channelId(), _history->lastKeyboardHiddenId));
return _history && (_keyboard->forMsgId() == FullMsgId(_history->channelId(), _history->lastKeyboardHiddenId));
}
void HistoryWidget::dropEvent(QDropEvent *e) {
@ -6154,10 +6156,10 @@ void HistoryWidget::onKbToggle(bool manual) {
_botKeyboardShow->show();
}
if (manual && _history) {
_history->lastKeyboardHiddenId = _keyboard.forMsgId().msg;
_history->lastKeyboardHiddenId = _keyboard->forMsgId().msg;
}
_kbScroll.hide();
_kbScroll->hide();
_kbShown = false;
_field->setMaxHeight(st::historyComposeFieldMaxHeight);
@ -6174,18 +6176,18 @@ void HistoryWidget::onKbToggle(bool manual) {
updateBotKeyboard();
}
}
} else if (!_keyboard.hasMarkup() && _keyboard.forceReply()) {
} else if (!_keyboard->hasMarkup() && _keyboard->forceReply()) {
_botKeyboardHide->hide();
_botKeyboardShow->hide();
if (fieldEnabled) {
_botCommandStart->show();
}
_kbScroll.hide();
_kbScroll->hide();
_kbShown = false;
_field->setMaxHeight(st::historyComposeFieldMaxHeight);
_kbReplyTo = (_peer->isChat() || _peer->isChannel() || _keyboard.forceReply()) ? App::histItemById(_keyboard.forMsgId()) : 0;
_kbReplyTo = (_peer->isChat() || _peer->isChannel() || _keyboard->forceReply()) ? App::histItemById(_keyboard->forMsgId()) : 0;
if (_kbReplyTo && !_editMsgId && !_replyToId && fieldEnabled) {
updateReplyToName();
_replyEditMsgText.setText(st::msgFont, textClean(_kbReplyTo->inReplyText()), _textDlgOptions);
@ -6198,13 +6200,13 @@ void HistoryWidget::onKbToggle(bool manual) {
} else if (fieldEnabled) {
_botKeyboardHide->show();
_botKeyboardShow->hide();
_kbScroll.show();
_kbScroll->show();
_kbShown = true;
int32 maxh = qMin(_keyboard.height(), st::historyComposeFieldMaxHeight - (st::historyComposeFieldMaxHeight / 2));
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;
_kbReplyTo = (_peer->isChat() || _peer->isChannel() || _keyboard->forceReply()) ? App::histItemById(_keyboard->forMsgId()) : 0;
if (_kbReplyTo && !_editMsgId && !_replyToId) {
updateReplyToName();
_replyEditMsgText.setText(st::msgFont, textClean(_kbReplyTo->inReplyText()), _textDlgOptions);
@ -6342,7 +6344,7 @@ void HistoryWidget::onMembersDropdownShow() {
}
void HistoryWidget::onModerateKeyActivate(int index, bool *outHandled) {
*outHandled = _keyboard.isHidden() ? false : _keyboard.moderateKeyActivate(index);
*outHandled = _keyboard->isHidden() ? false : _keyboard->moderateKeyActivate(index);
}
void HistoryWidget::topBarClick() {
@ -6442,11 +6444,11 @@ void HistoryWidget::moveFieldControls() {
auto keyboardHeight = 0;
auto bottom = height();
auto maxKeyboardHeight = st::historyComposeFieldMaxHeight - _field->height();
_keyboard.resizeToWidth(width(), maxKeyboardHeight);
_keyboard->resizeToWidth(width(), maxKeyboardHeight);
if (_kbShown) {
keyboardHeight = qMin(_keyboard.height(), maxKeyboardHeight);
keyboardHeight = qMin(_keyboard->height(), maxKeyboardHeight);
bottom -= keyboardHeight;
_kbScroll.setGeometry(0, bottom, width(), keyboardHeight);
_kbScroll->setGeometry(0, bottom, width(), keyboardHeight);
}
// _attachToggle --------------------------------------------------------- _emojiPan --------- _fieldBarCancel
@ -6478,7 +6480,7 @@ void HistoryWidget::moveFieldControls() {
}
void HistoryWidget::updateFieldSize() {
bool kbShowShown = _history && !_kbShown && _keyboard.hasMarkup();
bool kbShowShown = _history && !_kbShown && _keyboard->hasMarkup();
int fieldWidth = width() - _attachToggle->width();
fieldWidth -= _send->width();
fieldWidth -= _attachEmoji->width();
@ -6878,7 +6880,7 @@ void HistoryWidget::reportSpamDone(PeerData *peer, const MTPBool &result, mtpReq
Local::writeReportSpamStatuses();
}
_reportSpamStatus = dbiprsReportSent;
_reportSpamPanel.setReported(_reportSpamStatus == dbiprsReportSent, peer);
_reportSpamPanel->setReported(_reportSpamStatus == dbiprsReportSent, peer);
}
bool HistoryWidget::reportSpamFail(const RPCError &error, mtpRequestId req) {
@ -6921,7 +6923,7 @@ void HistoryWidget::peerMessagesUpdated(PeerId peer) {
if (_peer && _list && peer == _peer->id) {
updateListSize();
updateBotKeyboard();
if (!_scroll.isHidden()) {
if (!_scroll->isHidden()) {
bool unblock = isBlocked(), botStart = isBotStart(), joinChannel = isJoinChannel(), muteUnmute = isMuteUnmute();
bool upd = (_unblock->isHidden() == unblock);
if (!upd && !unblock) upd = (_botStart->isHidden() == botStart);
@ -6954,8 +6956,8 @@ bool HistoryWidget::isItemVisible(HistoryItem *item) {
if (isHidden() || _a_show.animating() || !_list) {
return false;
}
int32 top = _list->itemTop(item), st = _scroll.scrollTop();
if (top < 0 || top + item->height() <= st || top >= st + _scroll.height()) {
int32 top = _list->itemTop(item), st = _scroll->scrollTop();
if (top < 0 || top + item->height() <= st || top >= st + _scroll->height()) {
return false;
}
return true;
@ -7021,29 +7023,29 @@ void HistoryWidget::resizeEvent(QResizeEvent *e) {
}
void HistoryWidget::updateControlsGeometry() {
_reportSpamPanel.resize(width(), _reportSpamPanel.height());
_reportSpamPanel->resize(width(), _reportSpamPanel->height());
moveFieldControls();
if (_pinnedBar) {
if (_scroll.y() != st::historyReplyHeight) {
_scroll.move(0, st::historyReplyHeight);
_reportSpamPanel.move(0, st::historyReplyHeight);
_fieldAutocomplete->setBoundings(_scroll.geometry());
if (_scroll->y() != st::historyReplyHeight) {
_scroll->move(0, st::historyReplyHeight);
_reportSpamPanel->move(0, st::historyReplyHeight);
_fieldAutocomplete->setBoundings(_scroll->geometry());
}
_pinnedBar->cancel->move(width() - _pinnedBar->cancel->width(), 0);
_pinnedBar->shadow->setGeometry(0, st::historyReplyHeight, width(), st::lineWidth);
} else if (_scroll.y() != 0) {
_scroll.move(0, 0);
_reportSpamPanel.move(0, 0);
_fieldAutocomplete->setBoundings(_scroll.geometry());
} else if (_scroll->y() != 0) {
_scroll->move(0, 0);
_reportSpamPanel->move(0, 0);
_fieldAutocomplete->setBoundings(_scroll->geometry());
}
updateListSize(false, false, { ScrollChangeAdd, App::main() ? App::main()->contentScrollAddToY() : 0 });
updateFieldSize();
_historyToEnd->moveToRight(st::historyToDownPosition.x(), _scroll.y() + _scroll.height() - _historyToEnd->height() - st::historyToDownPosition.y());
_historyToEnd->moveToRight(st::historyToDownPosition.x(), _scroll->y() + _scroll->height() - _historyToEnd->height() - st::historyToDownPosition.y());
_emojiPan->setMaxHeight(height() - st::defaultDropdownPadding.top() - st::defaultDropdownPadding.bottom() - _attachEmoji->height());
if (_membersDropdown) {
@ -7101,7 +7103,7 @@ void HistoryWidget::itemEdited(HistoryItem *item) {
}
void HistoryWidget::updateScrollColors() {
_scroll.updateBars();
_scroll->updateBars();
}
MsgId HistoryWidget::replyToId() const {
@ -7125,36 +7127,36 @@ void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollCh
newScrollHeight -= st::historyReplyHeight;
}
if (_kbShown) {
newScrollHeight -= _kbScroll.height();
newScrollHeight -= _kbScroll->height();
}
}
if (_pinnedBar) {
newScrollHeight -= st::historyReplyHeight;
}
int wasScrollTop = _scroll.scrollTop();
bool wasAtBottom = wasScrollTop + 1 > _scroll.scrollTopMax();
bool needResize = (_scroll.width() != width()) || (_scroll.height() != newScrollHeight);
int wasScrollTop = _scroll->scrollTop();
bool wasAtBottom = wasScrollTop + 1 > _scroll->scrollTopMax();
bool needResize = (_scroll->width() != width()) || (_scroll->height() != newScrollHeight);
if (needResize) {
_scroll.resize(width(), newScrollHeight);
// on initial updateListSize we didn't put the _scroll.scrollTop correctly yet
_scroll->resize(width(), newScrollHeight);
// on initial updateListSize we didn't put the _scroll->scrollTop correctly yet
// so visibleAreaUpdated() call will erase it with the new (undefined) value
if (!initial) {
visibleAreaUpdated();
}
_fieldAutocomplete->setBoundings(_scroll.geometry());
_historyToEnd->moveToRight(st::historyToDownPosition.x(), _scroll.y() + _scroll.height() - _historyToEnd->height() - st::historyToDownPosition.y());
_fieldAutocomplete->setBoundings(_scroll->geometry());
_historyToEnd->moveToRight(st::historyToDownPosition.x(), _scroll->y() + _scroll->height() - _historyToEnd->height() - st::historyToDownPosition.y());
}
_list->recountHeight();
bool washidden = _scroll.isHidden();
bool washidden = _scroll->isHidden();
if (washidden) {
_scroll.show();
_scroll->show();
}
_list->updateSize();
if (washidden) {
_scroll.hide();
_scroll->hide();
}
if ((!initial && !wasAtBottom) || (loadedDown && (!_history->showFrom || _history->unreadBar || _history->loadedAtBottom()) && (!_migrated || !_migrated->showFrom || _migrated->unreadBar || _history->loadedAtBottom()))) {
@ -7167,13 +7169,13 @@ void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollCh
toY += _addToScroll;
_addToScroll = 0;
}
if (toY > _scroll.scrollTopMax()) {
toY = _scroll.scrollTopMax();
if (toY > _scroll->scrollTopMax()) {
toY = _scroll->scrollTopMax();
}
if (_scroll.scrollTop() == toY) {
if (_scroll->scrollTop() == toY) {
visibleAreaUpdated();
} else {
_scroll.scrollToY(toY);
_scroll->scrollToY(toY);
}
return;
}
@ -7193,7 +7195,7 @@ void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollCh
_histInited = false;
return updateListSize(initial, false, change);
} else {
toY = (_scroll.height() > item->height()) ? qMax(iy - (_scroll.height() - item->height()) / 2, 0) : iy;
toY = (_scroll->height() > item->height()) ? qMax(iy - (_scroll->height() - item->height()) / 2, 0) : iy;
_animActiveStart = getms();
_animActiveTimer.start(AnimationTimerDelta);
_activeAnimMsgId = _showAtMsgId;
@ -7206,7 +7208,7 @@ void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollCh
_histInited = false;
return updateListSize(initial, false, change);
} else {
toY = (_scroll.height() > item->height()) ? qMax(iy - (_scroll.height() - item->height()) / 2, 0) : iy;
toY = (_scroll->height() > item->height()) ? qMax(iy - (_scroll->height() - item->height()) / 2, 0) : iy;
_animActiveStart = getms();
_animActiveTimer.start(AnimationTimerDelta);
_activeAnimMsgId = _showAtMsgId;
@ -7218,7 +7220,7 @@ void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollCh
toY = unreadBarTop();
} else if (_migrated && _migrated->showFrom) {
toY = _list->itemTop(_migrated->showFrom);
if (toY < _scroll.scrollTopMax() + HistoryMessageUnreadBar::height() - HistoryMessageUnreadBar::marginTop()) {
if (toY < _scroll->scrollTopMax() + HistoryMessageUnreadBar::height() - HistoryMessageUnreadBar::marginTop()) {
_migrated->addUnreadBar();
if (_migrated->unreadBar) {
setMsgId(ShowAtUnreadMsgId);
@ -7230,7 +7232,7 @@ void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollCh
}
} else if (_history->showFrom) {
toY = _list->itemTop(_history->showFrom);
if (toY < _scroll.scrollTopMax() + st::unreadBarHeight) {
if (toY < _scroll->scrollTopMax() + st::unreadBarHeight) {
_history->addUnreadBar();
if (_history->unreadBar) {
setMsgId(ShowAtUnreadMsgId);
@ -7242,12 +7244,12 @@ void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollCh
}
} else {
}
auto scrollMax = _scroll.scrollTopMax();
auto scrollMax = _scroll->scrollTopMax();
accumulate_min(toY, scrollMax);
if (_scroll.scrollTop() == toY) {
if (_scroll->scrollTop() == toY) {
visibleAreaUpdated();
} else {
_scroll.scrollToY(toY);
_scroll->scrollToY(toY);
}
}
@ -7311,39 +7313,39 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
bool changed = false;
bool wasVisible = _kbShown || _kbReplyTo;
if ((_replyToId && !_replyEditMsg) || _editMsgId || !_history) {
changed = _keyboard.updateMarkup(nullptr, force);
changed = _keyboard->updateMarkup(nullptr, force);
} else if (_replyToId && _replyEditMsg) {
changed = _keyboard.updateMarkup(_replyEditMsg, force);
changed = _keyboard->updateMarkup(_replyEditMsg, force);
} else {
HistoryItem *keyboardItem = _history->lastKeyboardId ? App::histItemById(_channel, _history->lastKeyboardId) : nullptr;
changed = _keyboard.updateMarkup(keyboardItem, force);
changed = _keyboard->updateMarkup(keyboardItem, force);
}
updateCmdStartShown();
if (!changed) return;
bool hasMarkup = _keyboard.hasMarkup(), forceReply = _keyboard.forceReply() && (!_replyToId || !_replyEditMsg);
bool hasMarkup = _keyboard->hasMarkup(), forceReply = _keyboard->forceReply() && (!_replyToId || !_replyEditMsg);
if (hasMarkup || forceReply) {
if (_keyboard.singleUse() && _keyboard.hasMarkup() && _keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId) && _history->lastKeyboardUsed) {
if (_keyboard->singleUse() && _keyboard->hasMarkup() && _keyboard->forMsgId() == FullMsgId(_channel, _history->lastKeyboardId) && _history->lastKeyboardUsed) {
_history->lastKeyboardHiddenId = _history->lastKeyboardId;
}
if (!isBotStart() && !isBlocked() && _canSendMessages && (wasVisible || (_replyToId && _replyEditMsg) || (!_field->hasSendText() && !kbWasHidden()))) {
if (!_a_show.animating()) {
if (hasMarkup) {
_kbScroll.show();
_kbScroll->show();
_attachEmoji->hide();
_botKeyboardHide->show();
} else {
_kbScroll.hide();
_kbScroll->hide();
_attachEmoji->show();
_botKeyboardHide->hide();
}
_botKeyboardShow->hide();
_botCommandStart->hide();
}
int32 maxh = hasMarkup ? qMin(_keyboard.height(), st::historyComposeFieldMaxHeight - (st::historyComposeFieldMaxHeight / 2)) : 0;
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;
_kbReplyTo = (_peer->isChat() || _peer->isChannel() || _keyboard->forceReply()) ? App::histItemById(_keyboard->forMsgId()) : 0;
if (_kbReplyTo && !_replyToId) {
updateReplyToName();
_replyEditMsgText.setText(st::msgFont, textClean(_kbReplyTo->inReplyText()), _textDlgOptions);
@ -7352,7 +7354,7 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
}
} else {
if (!_a_show.animating()) {
_kbScroll.hide();
_kbScroll->hide();
_attachEmoji->show();
_botKeyboardHide->hide();
_botKeyboardShow->show();
@ -7367,8 +7369,8 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
}
}
} else {
if (!_scroll.isHidden()) {
_kbScroll.hide();
if (!_scroll->isHidden()) {
_kbScroll->hide();
_attachEmoji->show();
_botKeyboardHide->hide();
_botKeyboardShow->hide();
@ -7396,7 +7398,7 @@ void HistoryWidget::updateToEndVisibility() {
if (!history->showFrom || history->showFrom->detached()) {
return false;
}
return (_list->itemTop(history->showFrom) >= _scroll.scrollTop() + _scroll.height());
return (_list->itemTop(history->showFrom) >= _scroll->scrollTop() + _scroll->height());
};
auto isToEndVisible = [this, &haveUnreadBelowBottom]() {
if (!_history || _firstLoadRequest) {
@ -7405,7 +7407,7 @@ void HistoryWidget::updateToEndVisibility() {
if (!_history->loadedAtBottom() || _replyReturn) {
return true;
}
if (_scroll.scrollTop() + st::historyToDownShownAfter < _scroll.scrollTopMax()) {
if (_scroll->scrollTop() + st::historyToDownShownAfter < _scroll->scrollTopMax()) {
return true;
}
if (haveUnreadBelowBottom(_history) || haveUnreadBelowBottom(_migrated)) {
@ -7453,12 +7455,12 @@ void HistoryWidget::keyPressEvent(QKeyEvent *e) {
App::main()->showBackFromStack();
emit cancelled();
} else if (e->key() == Qt::Key_PageDown) {
_scroll.keyPressEvent(e);
_scroll->keyPressEvent(e);
} else if (e->key() == Qt::Key_PageUp) {
_scroll.keyPressEvent(e);
_scroll->keyPressEvent(e);
} else if (e->key() == Qt::Key_Down) {
if (!(e->modifiers() & (Qt::ShiftModifier | Qt::MetaModifier | Qt::ControlModifier))) {
_scroll.keyPressEvent(e);
_scroll->keyPressEvent(e);
}
} else if (e->key() == Qt::Key_Up) {
if (!(e->modifiers() & (Qt::ShiftModifier | Qt::MetaModifier | Qt::ControlModifier))) {
@ -7469,7 +7471,7 @@ void HistoryWidget::keyPressEvent(QKeyEvent *e) {
return;
}
}
_scroll.keyPressEvent(e);
_scroll->keyPressEvent(e);
}
} else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
onListEnterPressed();
@ -7625,7 +7627,7 @@ bool HistoryWidget::pinnedMsgVisibilityUpdated() {
_pinnedBar->shadow->show();
}
connect(_pinnedBar->cancel, SIGNAL(clicked()), this, SLOT(onPinnedHide()));
_reportSpamPanel.raise();
_reportSpamPanel->raise();
_topShadow->raise();
if (_membersDropdown) {
_membersDropdown->raise();
@ -7638,8 +7640,8 @@ bool HistoryWidget::pinnedMsgVisibilityUpdated() {
updatePinnedBar();
result = true;
if (_scroll.scrollTop() != unreadBarTop()) {
_scroll.scrollToY(_scroll.scrollTop() + st::historyReplyHeight);
if (_scroll->scrollTop() != unreadBarTop()) {
_scroll->scrollToY(_scroll->scrollTop() + st::historyReplyHeight);
}
} else if (_pinnedBar->msgId != pinnedMsgId) {
_pinnedBar->msgId = pinnedMsgId;
@ -7653,8 +7655,8 @@ bool HistoryWidget::pinnedMsgVisibilityUpdated() {
} else if (_pinnedBar) {
destroyPinnedBar();
result = true;
if (_scroll.scrollTop() != unreadBarTop()) {
_scroll.scrollToY(_scroll.scrollTop() - st::historyReplyHeight);
if (_scroll->scrollTop() != unreadBarTop()) {
_scroll->scrollToY(_scroll->scrollTop() - st::historyReplyHeight);
}
resizeEvent(0);
}
@ -7958,7 +7960,7 @@ void HistoryWidget::onCopyPostLink() {
bool HistoryWidget::lastForceReplyReplied(const FullMsgId &replyTo) const {
if (replyTo.msg > 0 && replyTo.channel != _channel) return false;
return _keyboard.forceReply() && _keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId) && _keyboard.forMsgId().msg == (replyTo.msg < 0 ? replyToId() : replyTo.msg);
return _keyboard->forceReply() && _keyboard->forMsgId() == FullMsgId(_channel, _history->lastKeyboardId) && _keyboard->forMsgId().msg == (replyTo.msg < 0 ? replyToId() : replyTo.msg);
}
bool HistoryWidget::cancelReply(bool lastKeyboardUsed) {
@ -7992,7 +7994,7 @@ bool HistoryWidget::cancelReply(bool lastKeyboardUsed) {
_saveDraftStart = getms();
onDraftSave();
}
if (!_editMsgId && _keyboard.singleUse() && _keyboard.forceReply() && lastKeyboardUsed) {
if (!_editMsgId && _keyboard->singleUse() && _keyboard->forceReply() && lastKeyboardUsed) {
if (_kbReplyTo) {
onKbToggle(false);
}
@ -8252,7 +8254,7 @@ void HistoryWidget::onFullPeerUpdated(PeerData *data) {
if (updateCmdStartShown()) {
updateControlsVisibility();
updateControlsGeometry();
} else if (!_scroll.isHidden() && _unblock->isHidden() == isBlocked()) {
} else if (!_scroll->isHidden() && _unblock->isHidden() == isBlocked()) {
updateControlsVisibility();
updateControlsGeometry();
}
@ -8497,7 +8499,7 @@ void HistoryWidget::updateReplyToName() {
}
void HistoryWidget::updateField() {
int32 fy = _scroll.y() + _scroll.height();
int32 fy = _scroll->y() + _scroll->height();
update(0, fy, width(), height() - fy);
}
@ -8786,8 +8788,8 @@ void HistoryWidget::paintEvent(QPaintEvent *e) {
if (_pinnedBar && !_pinnedBar->cancel->isHidden()) {
drawPinnedBar(p);
}
if (_scroll.isHidden()) {
p.setClipRect(_scroll.geometry());
if (_scroll->isHidden()) {
p.setClipRect(_scroll->geometry());
HistoryLayout::paintEmpty(p, width(), height() - _field->height() - 2 * st::historySendPadding);
}
} else {
@ -8803,7 +8805,7 @@ void HistoryWidget::paintEvent(QPaintEvent *e) {
}
QRect HistoryWidget::historyRect() const {
return _scroll.geometry();
return _scroll->geometry();
}
void HistoryWidget::destroyData() {
@ -8849,27 +8851,27 @@ QStringList HistoryWidget::getMediasFromMime(const QMimeData *d) {
QPoint HistoryWidget::clampMousePosition(QPoint point) {
if (point.x() < 0) {
point.setX(0);
} else if (point.x() >= _scroll.width()) {
point.setX(_scroll.width() - 1);
} else if (point.x() >= _scroll->width()) {
point.setX(_scroll->width() - 1);
}
if (point.y() < _scroll.scrollTop()) {
point.setY(_scroll.scrollTop());
} else if (point.y() >= _scroll.scrollTop() + _scroll.height()) {
point.setY(_scroll.scrollTop() + _scroll.height() - 1);
if (point.y() < _scroll->scrollTop()) {
point.setY(_scroll->scrollTop());
} else if (point.y() >= _scroll->scrollTop() + _scroll->height()) {
point.setY(_scroll->scrollTop() + _scroll->height() - 1);
}
return point;
}
void HistoryWidget::onScrollTimer() {
int32 d = (_scrollDelta > 0) ? qMin(_scrollDelta * 3 / 20 + 1, int32(MaxScrollSpeed)) : qMax(_scrollDelta * 3 / 20 - 1, -int32(MaxScrollSpeed));
_scroll.scrollToY(_scroll.scrollTop() + d);
_scroll->scrollToY(_scroll->scrollTop() + d);
}
void HistoryWidget::checkSelectingScroll(QPoint point) {
if (point.y() < _scroll.scrollTop()) {
_scrollDelta = point.y() - _scroll.scrollTop();
} else if (point.y() >= _scroll.scrollTop() + _scroll.height()) {
_scrollDelta = point.y() - _scroll.scrollTop() - _scroll.height() + 1;
if (point.y() < _scroll->scrollTop()) {
_scrollDelta = point.y() - _scroll->scrollTop();
} else if (point.y() >= _scroll->scrollTop() + _scroll->height()) {
_scrollDelta = point.y() - _scroll->scrollTop() - _scroll->height() + 1;
} else {
_scrollDelta = 0;
}
@ -8885,10 +8887,10 @@ void HistoryWidget::noSelectingScroll() {
}
bool HistoryWidget::touchScroll(const QPoint &delta) {
int32 scTop = _scroll.scrollTop(), scMax = _scroll.scrollTopMax(), scNew = snap(scTop - delta.y(), 0, scMax);
int32 scTop = _scroll->scrollTop(), scMax = _scroll->scrollTopMax(), scNew = snap(scTop - delta.y(), 0, scMax);
if (scNew == scTop) return false;
_scroll.scrollToY(scNew);
_scroll->scrollToY(scNew);
return true;
}

View File

@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/effects/rect_shadow.h"
#include "ui/widgets/tooltip.h"
#include "ui/widgets/input_fields.h"
#include "ui/widgets/scroll_area.h"
#include "history/history_common.h"
#include "history/field_autocomplete.h"
#include "window/section_widget.h"
@ -58,7 +59,7 @@ class HistoryInner : public TWidget, public Ui::AbstractTooltipShower, private b
Q_OBJECT
public:
HistoryInner(HistoryWidget *historyWidget, ScrollArea *scroll, History *history);
HistoryInner(HistoryWidget *historyWidget, Ui::ScrollArea *scroll, History *history);
void messagesReceived(PeerData *peer, const QVector<MTPMessage> &messages);
void messagesReceivedDown(PeerData *peer, const QVector<MTPMessage> &messages);
@ -203,7 +204,7 @@ private:
std_::unique_ptr<BotAbout> _botAbout;
HistoryWidget *_widget = nullptr;
ScrollArea *_scroll = nullptr;
Ui::ScrollArea *_scroll = nullptr;
mutable History *_curHistory = nullptr;
mutable int _curBlock = 0;
mutable int _curItem = 0;
@ -254,7 +255,7 @@ private:
QPoint _touchStart, _touchPrevPos, _touchPos;
QTimer _touchSelectTimer;
TouchScrollState _touchScrollState = TouchScrollManual;
Ui::TouchScrollState _touchScrollState = Ui::TouchScrollState::Manual;
bool _touchPrevPosValid = false;
bool _touchWaitingAcceleration = false;
QPoint _touchSpeed;
@ -364,7 +365,7 @@ class BotKeyboard : public TWidget, public Ui::AbstractTooltipShower, public Cli
Q_OBJECT
public:
BotKeyboard();
BotKeyboard(QWidget *parent);
bool moderateKeyActivate(int index);
@ -423,7 +424,7 @@ private:
class Style : public ReplyKeyboard::Style {
public:
Style(BotKeyboard *parent, const style::botKeyboardButton &st) : ReplyKeyboard::Style(st), _parent(parent) {
Style(BotKeyboard *parent, const style::BotKeyboardButton &st) : ReplyKeyboard::Style(st), _parent(parent) {
}
void startPaint(Painter &p) const override;
@ -440,7 +441,7 @@ private:
BotKeyboard *_parent;
};
const style::botKeyboardButton *_st = &st::botKbButton;
const style::BotKeyboardButton *_st = nullptr;
};
@ -1049,7 +1050,7 @@ private:
MsgId _activeAnimMsgId = 0;
ScrollArea _scroll;
ChildWidget<Ui::ScrollArea> _scroll;
HistoryInner *_list = nullptr;
History *_migrated = nullptr;
History *_history = nullptr;
@ -1077,7 +1078,7 @@ private:
bool isMuteUnmute() const;
bool updateCmdStartShown();
ReportSpamPanel _reportSpamPanel;
ChildWidget<ReportSpamPanel> _reportSpamPanel;
ChildWidget<Ui::IconButton> _send;
ChildWidget<Ui::FlatButton> _unblock;
@ -1110,8 +1111,8 @@ private:
bool _kbShown = false;
HistoryItem *_kbReplyTo = nullptr;
ScrollArea _kbScroll;
BotKeyboard _keyboard;
ChildWidget<Ui::ScrollArea> _kbScroll;
ChildWidget<BotKeyboard> _keyboard;
ChildWidget<Ui::InnerDropdown> _membersDropdown = { nullptr };
QTimer _membersDropdownShowTimer;

View File

@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_overview.h"
#include "styles/style_history.h"
#include "styles/style_stickers.h"
#include "styles/style_widgets.h"
#include "inline_bots/inline_bot_result.h"
#include "media/media_audio.h"
#include "media/media_clip_reader.h"

View File

@ -63,7 +63,7 @@ introLink: LinkButton(defaultLinkButton) {
font: introFont;
overFont: font(16px underline);
}
introLabel: flatLabel(labelDefFlat) {
introLabel: FlatLabel(defaultFlatLabel) {
font: introFont;
align: align(center);
}
@ -124,14 +124,14 @@ introErrorTop: 15px;
introErrorHeight: 40px;
introErrorFont: font(16px);
introLabelTextStyle: textStyle(defaultTextStyle) {
introLabelTextStyle: TextStyle(defaultTextStyle) {
lineHeight: 30px;
}
introErrorLabelTextStyle: textStyle(defaultTextStyle) {
introErrorLabelTextStyle: TextStyle(defaultTextStyle) {
lineHeight: 27px;
}
introErrorLabel: flatLabel(labelDefFlat) {
introErrorLabel: FlatLabel(defaultFlatLabel) {
font: introErrorFont;
align: align(center);
}

View File

@ -26,23 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "intro/introcode.h"
#include "styles/style_intro.h"
#include "ui/widgets/buttons.h"
namespace {
class SignUpClickHandler : public LeftButtonClickHandler {
public:
SignUpClickHandler(IntroPhone *widget) : _widget(widget) {
}
protected:
void onClickImpl() const override {
_widget->toSignUp();
}
private:
IntroPhone *_widget;
};
}
#include "ui/widgets/labels.h"
IntroPhone::IntroPhone(IntroWidget *parent) : IntroStep(parent)
, a_errorAlpha(0)
@ -51,7 +35,7 @@ IntroPhone::IntroPhone(IntroWidget *parent) : IntroStep(parent)
, _country(this, st::introCountry)
, _phone(this, st::introPhone)
, _code(this, st::introCountryCode)
, _signup(this, lng_phone_notreg(lt_signup_start, textcmdStartLink(1), lt_signup_end, textcmdStopLink()), FlatLabel::InitType::Rich, st::introErrorLabel, st::introErrorLabelTextStyle)
, _signup(this, lng_phone_notreg(lt_signup_start, textcmdStartLink(1), lt_signup_end, textcmdStopLink()), Ui::FlatLabel::InitType::Rich, st::introErrorLabel, st::introErrorLabelTextStyle)
, _checkRequest(this) {
setVisible(false);
setGeometry(parent->innerRect());
@ -68,7 +52,9 @@ IntroPhone::IntroPhone(IntroWidget *parent) : IntroStep(parent)
connect(intro(), SIGNAL(countryChanged()), this, SLOT(countryChanged()));
connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));
_signup->setLink(1, MakeShared<SignUpClickHandler>(this));
_signup->setLink(1, MakeShared<LambdaClickHandler>([this] {
toSignUp();
}));
_signup->hide();
_signupCache = myGrab(_signup);

View File

@ -21,13 +21,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#pragma once
#include "ui/countryinput.h"
#include "ui/flatlabel.h"
#include "intro/introwidget.h"
namespace Ui {
class PhonePartInput;
class CountryCodeInput;
class RoundButton;
class FlatLabel;
} // namespace Ui
class IntroPhone final : public IntroStep {
@ -52,8 +52,6 @@ public:
void phoneSubmitDone(const MTPauth_SentCode &result);
bool phoneSubmitFail(const RPCError &error);
void toSignUp();
public slots:
void countryChanged();
void onInputChange();
@ -61,6 +59,8 @@ public slots:
void onCheckRequest();
private:
void toSignUp();
QString fullNumber() const;
void disableAll();
void enableAll(bool failed);
@ -81,7 +81,7 @@ private:
ChildWidget<Ui::PhonePartInput> _phone;
ChildWidget<Ui::CountryCodeInput> _code;
ChildWidget<FlatLabel> _signup;
ChildWidget<Ui::FlatLabel> _signup;
QPixmap _signupCache;
bool _showSignup = false;

View File

@ -26,9 +26,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "intro/introphone.h"
#include "langloaderplain.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/labels.h"
IntroStart::IntroStart(IntroWidget *parent) : IntroStep(parent)
, _intro(this, lang(lng_intro), FlatLabel::InitType::Rich, st::introLabel, st::introLabelTextStyle)
, _intro(this, lang(lng_intro), Ui::FlatLabel::InitType::Rich, st::introLabel, st::introLabelTextStyle)
, _changeLang(this, QString())
, _next(this, lang(lng_start_msgs), st::introNextButton) {
_changeLang->hide();

View File

@ -22,9 +22,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "intro/introwidget.h"
class FlatLabel;
namespace Ui {
class FlatLabel;
class LinkButton;
class RoundButton;
} // namespace Ui
@ -39,7 +38,7 @@ public:
void onSubmit() override;
private:
ChildWidget<FlatLabel> _intro;
ChildWidget<Ui::FlatLabel> _intro;
ChildWidget<Ui::LinkButton> _changeLang;

View File

@ -27,6 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwindow.h"
#include "mainwidget.h"
#include "ui/filedialog.h"
#include "styles/style_boxes.h"
#include "styles/style_stickers.h"
#include "window/window_main_menu.h"
@ -366,6 +367,7 @@ void LayerStackWidget::showMainMenu() {
startShow();
} else {
_mainMenu->show();
_mainMenu->showFinished();
if (App::wnd()) App::wnd()->setInnerFocus();
updateLayerBox();
}
@ -474,6 +476,7 @@ void LayerStackWidget::step_background(float64 ms, bool timer) {
_background->setMainMenuRight(_mainMenu->width());
_background->setMainMenuCache(QPixmap());
_mainMenu->show();
_mainMenu->showFinished();
}
if (App::wnd()) App::wnd()->setInnerFocus();
}

View File

@ -3541,7 +3541,9 @@ void MainWidget::start(const MTPUser &user) {
Local::readSavedPeers();
cSetOtherOnline(0);
App::feedUsers(MTP_vector<MTPUser>(1, user));
if (auto self = App::feedUsers(MTP_vector<MTPUser>(1, user))) {
self->loadUserpic();
}
MTP::send(MTPupdates_GetState(), rpcDone(&MainWidget::gotState));
update();

View File

@ -1503,7 +1503,7 @@ PreLaunchWindow::PreLaunchWindow(QString title) : TWidget(0) {
int paddingVertical = (_size / 2);
int paddingHorizontal = _size;
int borderRadius = (_size / 5);
setStyleSheet(qsl("QPushButton { padding: %1px %2px; background-color: #ffffff; border-radius: %3px; }\nQPushButton#confirm:hover, QPushButton#cancel:hover { background-color: #edf7ff; color: #2f9fea; }\nQPushButton#confirm { color: #2f9fea; }\nQPushButton#cancel { color: #aeaeae; }\nQLineEdit { border: 1px solid #e0e0e0; padding: 5px; }\nQLineEdit:focus { border: 2px solid #62c0f7; padding: 4px; }").arg(paddingVertical).arg(paddingHorizontal).arg(borderRadius));
setStyleSheet(qsl("QPushButton { padding: %1px %2px; background-color: #ffffff; border-radius: %3px; }\nQPushButton#confirm:hover, QPushButton#cancel:hover { background-color: #e3f1fa; color: #2f9fea; }\nQPushButton#confirm { color: #2f9fea; }\nQPushButton#cancel { color: #aeaeae; }\nQLineEdit { border: 1px solid #e0e0e0; padding: 5px; }\nQLineEdit:focus { border: 2px solid #62c0f7; padding: 4px; }").arg(paddingVertical).arg(paddingHorizontal).arg(borderRadius));
if (!PreLaunchWindowInstance) {
PreLaunchWindowInstance = this;
}

View File

@ -34,7 +34,7 @@ MediaPlayerButton {
cancelStroke: pixels;
}
mediaPlayerActiveFg: windowActiveBg;
mediaPlayerActiveFg: windowBgActive;
mediaPlayerInactiveFg: #dfebf2;
mediaPlayerButton: MediaPlayerButton {
@ -60,9 +60,9 @@ mediaPlayerPlaySkip: 1px;
mediaPlayerPlayTop: 0px;
mediaPlayerCloseRight: 0px;
mediaPlayerName: flatLabel(labelDefFlat) {
mediaPlayerName: FlatLabel(defaultFlatLabel) {
maxHeight: 20px;
textFg: windowTextFg;
textFg: windowFg;
}
mediaPlayerTime: LabelSimple(defaultLabelSimple) {
textFg: windowSubTextFg;
@ -209,7 +209,7 @@ mediaPlayerPanelVolumeWidth: 64px;
mediaPlayerPanelVolumeToggleSkip: 0px;
mediaPlayerPanelVolumeToggleTop: 57px;
mediaPlayerScroll: flatScroll(solidScroll) {
mediaPlayerScroll: FlatScroll(defaultSolidScroll) {
deltat: 10px;
deltab: 0px;
}

View File

@ -21,8 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "stdafx.h"
#include "media/player/media_player_cover.h"
#include "ui/flatlabel.h"
#include "ui/widgets/label_simple.h"
#include "ui/widgets/labels.h"
#include "ui/widgets/media_slider.h"
#include "ui/widgets/buttons.h"
#include "media/media_audio.h"

View File

@ -22,8 +22,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
class AudioMsgId;
struct AudioPlaybackState;
class FlatLabel;
namespace Ui {
class FlatLabel;
class LabelSimple;
class IconButton;
} // namespace Ui
@ -77,7 +78,7 @@ private:
QString _time;
class PlayButton;
ChildWidget<FlatLabel> _nameLabel;
ChildWidget<Ui::FlatLabel> _nameLabel;
ChildWidget<Ui::LabelSimple> _timeLabel;
ChildWidget<Ui::IconButton> _close;
ChildWidget<Clip::Playback> _playback;

View File

@ -28,6 +28,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_widgets.h"
#include "styles/style_media_player.h"
#include "ui/widgets/shadow.h"
#include "ui/widgets/scroll_area.h"
#include "mainwindow.h"
namespace Media {

View File

@ -22,9 +22,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/effects/rect_shadow.h"
class ScrollArea;
namespace Ui {
class ScrollArea;
class GradientShadow;
} // namespace Ui
@ -110,7 +109,7 @@ private:
Ui::RectShadow _shadow;
ButtonCallback _pinCallback, _closeCallback;
ChildWidget<CoverWidget> _cover = { nullptr };
ChildWidget<ScrollArea> _scroll;
ChildWidget<Ui::ScrollArea> _scroll;
ChildWidget<Ui::GradientShadow> _scrollShadow = { nullptr };
};

View File

@ -21,8 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "stdafx.h"
#include "media/player/media_player_widget.h"
#include "ui/flatlabel.h"
#include "ui/widgets/label_simple.h"
#include "ui/widgets/labels.h"
#include "ui/widgets/filled_slider.h"
#include "ui/widgets/shadow.h"
#include "ui/widgets/buttons.h"

View File

@ -22,9 +22,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
class AudioMsgId;
struct AudioPlaybackState;
class FlatLabel;
namespace Ui {
class FlatLabel;
class LabelSimple;
class IconButton;
class PlainShadow;
@ -91,7 +91,7 @@ private:
QString _time;
class PlayButton;
ChildWidget<FlatLabel> _nameLabel;
ChildWidget<Ui::FlatLabel> _nameLabel;
ChildWidget<Ui::LabelSimple> _timeLabel;
ChildWidget<Ui::IconButton> _previousTrack = { nullptr };
ChildWidget<PlayButton> _playPause;

View File

@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "media/view/media_clip_playback.h"
#include "media/view/media_clip_volume_controller.h"
#include "styles/style_mediaview.h"
#include "ui/widgets/label_simple.h"
#include "ui/widgets/labels.h"
#include "ui/widgets/media_slider.h"
#include "ui/effects/widget_fade_wrap.h"
#include "ui/widgets/buttons.h"

View File

@ -37,23 +37,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace {
class SaveMsgClickHandler : public ClickHandler {
public:
SaveMsgClickHandler(MediaView *view) : _view(view) {
}
void onClick(Qt::MouseButton button) const {
if (button == Qt::LeftButton) {
_view->showSaveMsgFile();
}
}
private:
MediaView *_view;
};
TextParseOptions _captionTextOptions = {
TextParseLinks | TextParseMentions | TextParseHashtags | TextParseMultiline | TextParseRichText, // flags
0, // maxw
@ -95,7 +78,7 @@ MediaView::MediaView() : TWidget(App::wnd())
custom.insert(QChar('c'), qMakePair(textcmdStartLink(1), textcmdStopLink()));
_saveMsgText.setRichText(st::medviewSaveMsgFont, lang(lng_mediaview_saved), _textDlgOptions, custom);
_saveMsg = QRect(0, 0, _saveMsgText.maxWidth() + st::medviewSaveMsgPadding.left() + st::medviewSaveMsgPadding.right(), st::medviewSaveMsgFont->height + st::medviewSaveMsgPadding.top() + st::medviewSaveMsgPadding.bottom());
_saveMsgText.setLink(1, MakeShared<SaveMsgClickHandler>(this));
_saveMsgText.setLink(1, MakeShared<LambdaClickHandler>([this] { showSaveMsgFile(); }));
connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(onScreenResized(int)));

View File

@ -64,7 +64,6 @@ public:
void documentUpdated(DocumentData *doc);
void changingMsgId(HistoryItem *row, MsgId newId);
void showSaveMsgFile();
void close();
void activateControls();
@ -128,6 +127,8 @@ private slots:
void onVideoPlayProgress(const AudioMsgId &audioId);
private:
void showSaveMsgFile();
void dropdownHidden();
void updateDocSize();
void updateControls();

View File

@ -409,7 +409,7 @@ Voice::Voice(DocumentData *voice, HistoryItem *parent) : FileBase(parent)
QString d = textcmdLink(1, textRichPrepare(langDateTime(date(_data->date))));
TextParseOptions opts = { TextParseRichText, 0, 0, Qt::LayoutDirectionAuto };
_details.setText(st::normalFont, lng_date_and_duration(lt_date, d, lt_duration, formatDurationText(_data->voice()->duration)), opts);
_details.setLink(1, MakeShared<GoToMessageClickHandler>(parent));
_details.setLink(1, goToMessageClickHandler(parent));
}
void Voice::initDimensions() {
@ -588,7 +588,7 @@ bool Voice::updateStatusText() const {
Document::Document(DocumentData *document, HistoryItem *parent, const style::OverviewFileLayout &st) : FileBase(parent)
, _data(document)
, _msgl(new GoToMessageClickHandler(parent))
, _msgl(goToMessageClickHandler(parent))
, _namel(new DocumentOpenClickHandler(_data))
, _st(st)
, _date(langDateTime(date(_data->date)))

View File

@ -23,6 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_overview.h"
#include "styles/style_dialogs.h"
#include "styles/style_window.h"
#include "styles/style_settings.h"
#include "boxes/addcontactbox.h"
#include "boxes/confirmbox.h"
#include "boxes/photocropbox.h"
@ -45,7 +46,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
// flick scroll taken from http://qt-project.org/doc/qt-4.8/demos-embedded-anomaly-src-flickcharm-cpp.html
OverviewInner::OverviewInner(OverviewWidget *overview, ScrollArea *scroll, PeerData *peer, MediaOverviewType type) : TWidget(nullptr)
OverviewInner::OverviewInner(OverviewWidget *overview, Ui::ScrollArea *scroll, PeerData *peer, MediaOverviewType type) : TWidget(nullptr)
, _overview(overview)
, _scroll(scroll)
, _peer(peer->migrateTo() ? peer->migrateTo() : peer)
@ -116,7 +117,7 @@ void OverviewInner::touchUpdateSpeed() {
// of a small horizontal offset when scrolling vertically
const int newSpeedY = (qAbs(pixelsPerSecond.y()) > FingerAccuracyThreshold) ? pixelsPerSecond.y() : 0;
const int newSpeedX = (qAbs(pixelsPerSecond.x()) > FingerAccuracyThreshold) ? pixelsPerSecond.x() : 0;
if (_touchScrollState == TouchScrollAuto) {
if (_touchScrollState == Ui::TouchScrollState::Auto) {
const int oldSpeedY = _touchSpeed.y();
const int oldSpeedX = _touchSpeed.x();
if ((oldSpeedY <= 0 && newSpeedY <= 0) || ((oldSpeedY >= 0 && newSpeedY >= 0)
@ -352,7 +353,7 @@ void OverviewInner::touchEvent(QTouchEvent *e) {
_touchInProgress = false;
_touchSelectTimer.stop();
_touchScroll = _touchSelect = false;
_touchScrollState = TouchScrollManual;
_touchScrollState = Ui::TouchScrollState::Manual;
dragActionCancel();
return;
}
@ -368,8 +369,8 @@ void OverviewInner::touchEvent(QTouchEvent *e) {
if (e->touchPoints().isEmpty()) return;
_touchInProgress = true;
if (_touchScrollState == TouchScrollAuto) {
_touchScrollState = TouchScrollAcceleration;
if (_touchScrollState == Ui::TouchScrollState::Auto) {
_touchScrollState = Ui::TouchScrollState::Acceleration;
_touchWaitingAcceleration = true;
_touchAccelerationTime = getms();
touchUpdateSpeed();
@ -392,13 +393,13 @@ void OverviewInner::touchEvent(QTouchEvent *e) {
touchUpdateSpeed();
}
if (_touchScroll) {
if (_touchScrollState == TouchScrollManual) {
if (_touchScrollState == Ui::TouchScrollState::Manual) {
touchScrollUpdated(_touchPos);
} else if (_touchScrollState == TouchScrollAcceleration) {
} else if (_touchScrollState == Ui::TouchScrollState::Acceleration) {
touchUpdateSpeed();
_touchAccelerationTime = getms();
if (_touchSpeed.isNull()) {
_touchScrollState = TouchScrollManual;
_touchScrollState = Ui::TouchScrollState::Manual;
}
}
}
@ -413,17 +414,17 @@ void OverviewInner::touchEvent(QTouchEvent *e) {
showContextMenu(&contextMenu, true);
_touchScroll = false;
} else if (_touchScroll) {
if (_touchScrollState == TouchScrollManual) {
_touchScrollState = TouchScrollAuto;
if (_touchScrollState == Ui::TouchScrollState::Manual) {
_touchScrollState = Ui::TouchScrollState::Auto;
_touchPrevPosValid = false;
_touchScrollTimer.start(15);
_touchTime = getms();
} else if (_touchScrollState == TouchScrollAuto) {
_touchScrollState = TouchScrollManual;
} else if (_touchScrollState == Ui::TouchScrollState::Auto) {
_touchScrollState = Ui::TouchScrollState::Manual;
_touchScroll = false;
touchResetSpeed();
} else if (_touchScrollState == TouchScrollAcceleration) {
_touchScrollState = TouchScrollAuto;
} else if (_touchScrollState == Ui::TouchScrollState::Acceleration) {
_touchScrollState = Ui::TouchScrollState::Auto;
_touchWaitingAcceleration = false;
_touchPrevPosValid = false;
}
@ -1561,16 +1562,16 @@ void OverviewInner::onTouchSelect() {
void OverviewInner::onTouchScrollTimer() {
uint64 nowTime = getms();
if (_touchScrollState == TouchScrollAcceleration && _touchWaitingAcceleration && (nowTime - _touchAccelerationTime) > 40) {
_touchScrollState = TouchScrollManual;
if (_touchScrollState == Ui::TouchScrollState::Acceleration && _touchWaitingAcceleration && (nowTime - _touchAccelerationTime) > 40) {
_touchScrollState = Ui::TouchScrollState::Manual;
touchResetSpeed();
} else if (_touchScrollState == TouchScrollAuto || _touchScrollState == TouchScrollAcceleration) {
} else if (_touchScrollState == Ui::TouchScrollState::Auto || _touchScrollState == Ui::TouchScrollState::Acceleration) {
int32 elapsed = int32(nowTime - _touchTime);
QPoint delta = _touchSpeed * elapsed / 1000;
bool hasScrolled = _overview->touchScroll(delta);
if (_touchSpeed.isNull() || !hasScrolled) {
_touchScrollState = TouchScrollManual;
_touchScrollState = Ui::TouchScrollState::Manual;
_touchScroll = false;
_touchScrollTimer.stop();
} else {
@ -1876,16 +1877,16 @@ OverviewInner::~OverviewInner() {
}
OverviewWidget::OverviewWidget(QWidget *parent, PeerData *peer, MediaOverviewType type) : TWidget(parent)
, _scroll(this, st::setScroll, false)
, _inner(this, &_scroll, peer, type)
, _scroll(this, st::settingsScroll, false)
, _inner(this, _scroll, peer, type)
, _a_show(animation(this, &OverviewWidget::step_show))
, _topShadow(this, st::shadowColor) {
_scroll.setWidget(&_inner);
_scroll.move(0, 0);
_inner.move(0, 0);
_scroll->setOwnedWidget(_inner);
_scroll->move(0, 0);
_inner->move(0, 0);
_scroll.show();
connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
_scroll->show();
connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
connect(&_scrollTimer, SIGNAL(timeout()), this, SLOT(onScrollTimer()));
_scrollTimer.setSingleShot(false);
@ -1894,37 +1895,37 @@ OverviewWidget::OverviewWidget(QWidget *parent, PeerData *peer, MediaOverviewTyp
}
void OverviewWidget::clear() {
_inner.clear();
_inner->clear();
}
void OverviewWidget::onScroll() {
MTP::clearLoaderPriorities();
int32 preloadThreshold = _scroll.height() * 5;
int32 preloadThreshold = _scroll->height() * 5;
bool needToPreload = false;
do {
needToPreload = (type() == OverviewMusicFiles || type() == OverviewVoiceFiles) ? (_scroll.scrollTop() < preloadThreshold) : (_scroll.scrollTop() + preloadThreshold > _scroll.scrollTopMax());
if (!needToPreload || !_inner.preloadLocal()) {
needToPreload = (type() == OverviewMusicFiles || type() == OverviewVoiceFiles) ? (_scroll->scrollTop() < preloadThreshold) : (_scroll->scrollTop() + preloadThreshold > _scroll->scrollTopMax());
if (!needToPreload || !_inner->preloadLocal()) {
break;
}
} while (true);
if (needToPreload) {
_inner.preloadMore();
_inner->preloadMore();
}
if (!_noDropResizeIndex) {
_inner.dropResizeIndex();
_inner->dropResizeIndex();
}
}
void OverviewWidget::resizeEvent(QResizeEvent *e) {
_noDropResizeIndex = true;
int32 st = _scroll.scrollTop();
_scroll.resize(size());
int32 newScrollTop = _inner.resizeToWidth(width(), st, height());
int32 st = _scroll->scrollTop();
_scroll->resize(size());
int32 newScrollTop = _inner->resizeToWidth(width(), st, height());
if (int32 addToY = App::main() ? App::main()->contentScrollAddToY() : 0) {
newScrollTop += addToY;
}
if (newScrollTop != _scroll.scrollTop()) {
_scroll.scrollToY(newScrollTop);
if (newScrollTop != _scroll->scrollTop()) {
_scroll->scrollToY(newScrollTop);
}
_noDropResizeIndex = false;
@ -1955,19 +1956,19 @@ void OverviewWidget::paintEvent(QPaintEvent *e) {
}
void OverviewWidget::contextMenuEvent(QContextMenuEvent *e) {
return _inner.showContextMenu(e);
return _inner->showContextMenu(e);
}
void OverviewWidget::scrollBy(int32 add) {
if (_scroll.isHidden()) {
if (_scroll->isHidden()) {
_scrollSetAfterShow += add;
} else {
_scroll.scrollToY(_scroll.scrollTop() + add);
_scroll->scrollToY(_scroll->scrollTop() + add);
}
}
void OverviewWidget::scrollReset() {
_scroll.scrollToY((type() == OverviewMusicFiles || type() == OverviewVoiceFiles) ? _scroll.scrollTopMax() : 0);
_scroll->scrollToY((type() == OverviewMusicFiles || type() == OverviewVoiceFiles) ? _scroll->scrollTopMax() : 0);
}
bool OverviewWidget::paintTopBar(Painter &p, float64 over, int32 decreaseWidth) {
@ -1998,24 +1999,24 @@ void OverviewWidget::topBarClick() {
}
PeerData *OverviewWidget::peer() const {
return _inner.peer();
return _inner->peer();
}
PeerData *OverviewWidget::migratePeer() const {
return _inner.migratePeer();
return _inner->migratePeer();
}
MediaOverviewType OverviewWidget::type() const {
return _inner.type();
return _inner->type();
}
void OverviewWidget::switchType(MediaOverviewType type) {
_selCount = 0;
disconnect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
disconnect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
_inner.setSelectMode(false);
_inner.switchType(type);
_inner->setSelectMode(false);
_inner->switchType(type);
switch (type) {
case OverviewPhotos: _header = lang(lng_profile_photos_header); break;
case OverviewVideos: _header = lang(lng_profile_videos_header); break;
@ -2029,7 +2030,7 @@ void OverviewWidget::switchType(MediaOverviewType type) {
updateTopBarSelection();
scrollReset();
connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
onScroll();
activate();
@ -2037,15 +2038,15 @@ void OverviewWidget::switchType(MediaOverviewType type) {
void OverviewWidget::updateTopBarSelection() {
int32 selectedForForward, selectedForDelete;
_inner.getSelectionState(selectedForForward, selectedForDelete);
_inner->getSelectionState(selectedForForward, selectedForDelete);
_selCount = selectedForForward ? selectedForForward : selectedForDelete;
_inner.setSelectMode(_selCount > 0);
_inner->setSelectMode(_selCount > 0);
if (App::main()) {
App::main()->topBar()->showSelected(_selCount > 0 ? _selCount : 0, (selectedForDelete == selectedForForward));
App::main()->topBar()->update();
}
if (App::wnd() && !Ui::isLayerShown()) {
_inner.activate();
_inner->activate();
}
update();
}
@ -2055,7 +2056,7 @@ int32 OverviewWidget::lastWidth() const {
}
int32 OverviewWidget::lastScrollTop() const {
return _scroll.scrollTop();
return _scroll->scrollTop();
}
int32 OverviewWidget::countBestScroll() const {
@ -2063,22 +2064,22 @@ int32 OverviewWidget::countBestScroll() const {
AudioMsgId playing;
audioPlayer()->currentState(&playing, AudioMsgId::Type::Song);
if (playing) {
int32 top = _inner.itemTop(playing.contextId());
int32 top = _inner->itemTop(playing.contextId());
if (top >= 0) {
return snap(top - int(_scroll.height() - (st::msgPadding.top() + st::mediaThumbSize + st::msgPadding.bottom())) / 2, 0, _scroll.scrollTopMax());
return snap(top - int(_scroll->height() - (st::msgPadding.top() + st::mediaThumbSize + st::msgPadding.bottom())) / 2, 0, _scroll->scrollTopMax());
}
}
} else if (type() == OverviewLinks || type() == OverviewFiles) {
return 0;
}
return _scroll.scrollTopMax();
return _scroll->scrollTopMax();
}
void OverviewWidget::fastShow(bool back, int32 lastScrollTop) {
resizeEvent(0);
_scrollSetAfterShow = (lastScrollTop < 0 ? countBestScroll() : lastScrollTop);
show();
_inner.activate();
_inner->activate();
doneShow();
if (App::app()) App::app()->mtpUnpause();
@ -2086,7 +2087,7 @@ void OverviewWidget::fastShow(bool back, int32 lastScrollTop) {
void OverviewWidget::setLastScrollTop(int lastScrollTop) {
resizeEvent(0);
_scroll.scrollToY(lastScrollTop < 0 ? countBestScroll() : lastScrollTop);
_scroll->scrollToY(lastScrollTop < 0 ? countBestScroll() : lastScrollTop);
}
void OverviewWidget::showAnimated(Window::SlideDirection direction, const Window::SectionSlideParams &params) {
@ -2101,8 +2102,8 @@ void OverviewWidget::showAnimated(Window::SlideDirection direction, const Window
_topShadow->setVisible(params.withTopBarShadow ? true : false);
App::main()->topBar()->startAnim();
_scrollSetAfterShow = _scroll.scrollTop();
_scroll.hide();
_scrollSetAfterShow = _scroll->scrollTop();
_scroll->hide();
int delta = st::slideShift;
if (direction == Window::SlideDirection::FromLeft) {
@ -2149,15 +2150,15 @@ void OverviewWidget::step_show(float64 ms, bool timer) {
}
void OverviewWidget::doneShow() {
_scroll.show();
_scroll.scrollToY(_scrollSetAfterShow);
_scroll->show();
_scroll->scrollToY(_scrollSetAfterShow);
activate();
onScroll();
}
void OverviewWidget::mediaOverviewUpdated(PeerData *p, MediaOverviewType t) {
if ((peer() == p || migratePeer() == p) && t == type()) {
_inner.mediaOverviewUpdated();
_inner->mediaOverviewUpdated();
onScroll();
updateTopBarSelection();
}
@ -2165,7 +2166,7 @@ void OverviewWidget::mediaOverviewUpdated(PeerData *p, MediaOverviewType t) {
void OverviewWidget::changingMsgId(HistoryItem *row, MsgId newId) {
if (peer() == row->history()->peer || migratePeer() == row->history()->peer) {
_inner.changingMsgId(row, newId);
_inner->changingMsgId(row, newId);
}
}
@ -2182,22 +2183,22 @@ void OverviewWidget::grabFinish() {
void OverviewWidget::ui_repaintHistoryItem(const HistoryItem *item) {
if (peer() == item->history()->peer || migratePeer() == item->history()->peer) {
_inner.repaintItem(item);
_inner->repaintItem(item);
}
}
void OverviewWidget::notify_historyItemLayoutChanged(const HistoryItem *item) {
if (peer() == item->history()->peer || migratePeer() == item->history()->peer) {
_inner.onUpdateSelected();
_inner->onUpdateSelected();
}
}
void OverviewWidget::fillSelectedItems(SelectedItemSet &sel, bool forDelete) {
_inner.fillSelectedItems(sel, forDelete);
_inner->fillSelectedItems(sel, forDelete);
}
void OverviewWidget::updateAfterDrag() {
_inner.dragActionUpdate(QCursor::pos());
_inner->dragActionUpdate(QCursor::pos());
}
OverviewWidget::~OverviewWidget() {
@ -2206,37 +2207,37 @@ OverviewWidget::~OverviewWidget() {
}
void OverviewWidget::activate() {
if (_scroll.isHidden()) {
if (_scroll->isHidden()) {
setFocus();
} else {
_inner.activate();
_inner->activate();
}
}
QPoint OverviewWidget::clampMousePosition(QPoint point) {
if (point.x() < 0) {
point.setX(0);
} else if (point.x() >= _scroll.width()) {
point.setX(_scroll.width() - 1);
} else if (point.x() >= _scroll->width()) {
point.setX(_scroll->width() - 1);
}
if (point.y() < _scroll.scrollTop()) {
point.setY(_scroll.scrollTop());
} else if (point.y() >= _scroll.scrollTop() + _scroll.height()) {
point.setY(_scroll.scrollTop() + _scroll.height() - 1);
if (point.y() < _scroll->scrollTop()) {
point.setY(_scroll->scrollTop());
} else if (point.y() >= _scroll->scrollTop() + _scroll->height()) {
point.setY(_scroll->scrollTop() + _scroll->height() - 1);
}
return point;
}
void OverviewWidget::onScrollTimer() {
int32 d = (_scrollDelta > 0) ? qMin(_scrollDelta * 3 / 20 + 1, int32(MaxScrollSpeed)) : qMax(_scrollDelta * 3 / 20 - 1, -int32(MaxScrollSpeed));
_scroll.scrollToY(_scroll.scrollTop() + d);
_scroll->scrollToY(_scroll->scrollTop() + d);
}
void OverviewWidget::checkSelectingScroll(QPoint point) {
if (point.y() < _scroll.scrollTop()) {
_scrollDelta = point.y() - _scroll.scrollTop();
} else if (point.y() >= _scroll.scrollTop() + _scroll.height()) {
_scrollDelta = point.y() - _scroll.scrollTop() - _scroll.height() + 1;
if (point.y() < _scroll->scrollTop()) {
_scrollDelta = point.y() - _scroll->scrollTop();
} else if (point.y() >= _scroll->scrollTop() + _scroll->height()) {
_scrollDelta = point.y() - _scroll->scrollTop() - _scroll->height() + 1;
} else {
_scrollDelta = 0;
}
@ -2252,10 +2253,10 @@ void OverviewWidget::noSelectingScroll() {
}
bool OverviewWidget::touchScroll(const QPoint &delta) {
int32 scTop = _scroll.scrollTop(), scMax = _scroll.scrollTopMax(), scNew = snap(scTop - delta.y(), 0, scMax);
int32 scTop = _scroll->scrollTop(), scMax = _scroll->scrollTopMax(), scNew = snap(scTop - delta.y(), 0, scMax);
if (scNew == scTop) return false;
_scroll.scrollToY(scNew);
_scroll->scrollToY(scNew);
return true;
}
@ -2265,7 +2266,7 @@ void OverviewWidget::onForwardSelected() {
void OverviewWidget::onDeleteSelected() {
SelectedItemSet sel;
_inner.fillSelectedItems(sel);
_inner->fillSelectedItems(sel);
if (sel.isEmpty()) return;
App::main()->deleteLayer(sel.size());
@ -2275,7 +2276,7 @@ void OverviewWidget::onDeleteSelectedSure() {
Ui::hideLayer();
SelectedItemSet sel;
_inner.fillSelectedItems(sel);
_inner->fillSelectedItems(sel);
if (sel.isEmpty()) return;
QMap<PeerData*, QVector<MTPint> > ids;
@ -2318,5 +2319,5 @@ void OverviewWidget::onDeleteContextSure() {
}
void OverviewWidget::onClearSelected() {
_inner.clearSelectedItems();
_inner->clearSelectedItems();
}

View File

@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "window/section_widget.h"
#include "ui/widgets/tooltip.h"
#include "ui/widgets/scroll_area.h"
namespace Overview {
namespace Layout {
@ -43,7 +44,7 @@ class OverviewInner : public TWidget, public Ui::AbstractTooltipShower, public R
Q_OBJECT
public:
OverviewInner(OverviewWidget *overview, ScrollArea *scroll, PeerData *peer, MediaOverviewType type);
OverviewInner(OverviewWidget *overview, Ui::ScrollArea *scroll, PeerData *peer, MediaOverviewType type);
void activate();
@ -154,7 +155,7 @@ private:
int32 countHeight();
OverviewWidget *_overview;
ScrollArea *_scroll;
Ui::ScrollArea *_scroll;
int _resizeIndex = -1;
int _resizeSkip = 0;
@ -257,7 +258,7 @@ private:
QPoint _touchStart, _touchPrevPos, _touchPos;
QTimer _touchSelectTimer;
TouchScrollState _touchScrollState = TouchScrollManual;
Ui::TouchScrollState _touchScrollState = Ui::TouchScrollState::Manual;
bool _touchPrevPosValid = false;
bool _touchWaitingAcceleration = false;
QPoint _touchSpeed;
@ -325,7 +326,7 @@ public:
void grapWithoutTopBarShadow();
void grabFinish() override;
void rpcClear() override {
_inner.rpcClear();
_inner->rpcClear();
RPCSender::rpcClear();
}
@ -353,8 +354,8 @@ public slots:
void onClearSelected();
private:
ScrollArea _scroll;
OverviewInner _inner;
ChildWidget<Ui::ScrollArea> _scroll;
ChildWidget<OverviewInner> _inner;
bool _noDropResizeIndex = false;
QString _header;

View File

@ -187,7 +187,7 @@ void PasscodeWidget::paintEvent(QPaintEvent *e) {
p.fillRect(rect(), st::windowBg);
p.setFont(st::passcodeHeaderFont);
p.setPen(st::windowTextFg);
p.setPen(st::windowFg);
p.drawText(QRect(0, _passcode->y() - st::passcodeHeaderHeight, width(), st::passcodeHeaderHeight), lang(lng_passcode_enter), style::al_center);
if (!_error.isEmpty()) {

View File

@ -39,14 +39,14 @@ profilePhotoLeftMax: 35px;
profilePhotoDuration: 500;
profileNameLeft: 26px;
profileNameTop: 9px;
profileNameLabel: flatLabel(labelDefFlat) {
profileNameLabel: FlatLabel(defaultFlatLabel) {
margin: margins(10px, 5px, 10px, 5px);
font: font(16px semibold);
width: 160px;
maxHeight: 24px;
textFg: #333333;
}
profileNameTextStyle: textStyle(defaultTextStyle) {
profileNameTextStyle: TextStyle(defaultTextStyle) {
}
profileStatusLeft: 27px;
profileStatusTop: 35px;
@ -94,14 +94,14 @@ profileBlockTitleHeight: 24px;
profileBlockTitleFont: font(14px semibold);
profileBlockTitleFg: #333333;
profileBlockTitlePosition: point(24px, 0px);
profileBlockLabel: flatLabel(labelDefFlat) {
profileBlockLabel: FlatLabel(defaultFlatLabel) {
textFg: windowSubTextFg;
}
profileBlockTextPart: flatLabel(labelDefFlat) {
profileBlockTextPart: FlatLabel(defaultFlatLabel) {
width: 180px;
margin: margins(5px, 5px, 5px, 5px);
}
profileBlockOneLineTextPart: flatLabel(profileBlockTextPart) {
profileBlockOneLineTextPart: FlatLabel(profileBlockTextPart) {
width: 0px; // No need to set minWidth in one-line text.
maxHeight: 20px;
}
@ -111,7 +111,7 @@ profileBlockOneLineWidthMax: 240px;
profileEnableNotificationsTop: 7px;
profileSettingsBlockSkip: 8px;
profileInviteLinkText: flatLabel(profileBlockTextPart) {
profileInviteLinkText: FlatLabel(profileBlockTextPart) {
width: 1px; // Required for BreakEverywhere
}
@ -122,17 +122,17 @@ profileMemberPaddingLeft: 16px;
profileMemberPhotoSize: 46px;
profileMemberPhotoPosition: point(12px, 6px);
profileMemberNamePosition: point(68px, 11px);
profileMemberNameFg: #222222;//windowTextFg;
profileMemberNameFg: #222222;
profileMemberStatusPosition: point(68px, 31px);
profileMemberStatusFg: windowSubTextFg;
profileMemberStatusFgOver: windowSubTextFgOver;
profileMemberStatusFgActive: windowActiveTextFg;
profileMemberAdminIcon: icon {{ "profile_admin_star", #3babe7, point(4px, 3px) }};
profileLimitReachedLabel: flatLabel(labelDefFlat) {
profileLimitReachedLabel: FlatLabel(defaultFlatLabel) {
width: 180px;
margin: margins(profileMemberPaddingLeft, 9px, profileMemberPaddingLeft, 6px);
}
profileLimitReachedStyle: textStyle(defaultTextStyle) {
profileLimitReachedStyle: TextStyle(defaultTextStyle) {
lineHeight: 19px;
}

View File

@ -27,7 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "profile/profile_userpic_button.h"
#include "ui/widgets/buttons.h"
#include "ui/filedialog.h"
#include "ui/flatlabel.h"
#include "ui/widgets/labels.h"
#include "observer_peer.h"
#include "boxes/confirmbox.h"
#include "boxes/contactsbox.h"

View File

@ -23,13 +23,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "core/observer.h"
#include "ui/filedialog.h"
class FlatLabel;
namespace style {
struct RoundButton;
} // namespace style
namespace Ui {
class FlatLabel;
class RoundButton;
class LinkButton;
} // namespace Ui
@ -121,7 +120,7 @@ private:
ChildWidget<UserpicButton> _userpicButton;
ChildWidget<CoverDropArea> _dropArea = { nullptr };
ChildWidget<FlatLabel> _name;
ChildWidget<Ui::FlatLabel> _name;
ChildWidget<Ui::LinkButton> _cancelPhotoUpload = { nullptr };
QPoint _statusPosition;

View File

@ -22,7 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "profile/profile_info_widget.h"
#include "styles/style_profile.h"
#include "ui/flatlabel.h"
#include "ui/widgets/labels.h"
#include "core/click_handler_types.h"
#include "observer_peer.h"
#include "lang.h"
@ -80,7 +80,7 @@ int InfoWidget::resizeGetHeight(int newWidth) {
newHeight += _about->height();
}
auto moveLabeledText = [&newHeight, left, newWidth, marginLeft, marginRight](FlatLabel *label, FlatLabel *text, FlatLabel *shortText) {
auto moveLabeledText = [&newHeight, left, newWidth, marginLeft, marginRight](Ui::FlatLabel *label, Ui::FlatLabel *text, Ui::FlatLabel *shortText) {
if (!label) return;
label->moveToLeft(left, newHeight);
@ -144,7 +144,7 @@ void InfoWidget::refreshAbout() {
_about.destroy();
auto aboutText = textClean(getAboutText());
if (!aboutText.isEmpty()) {
_about = new FlatLabel(this, st::profileBlockTextPart);
_about.create(this, st::profileBlockTextPart);
_about->show();
EntitiesInText aboutEntities;
@ -198,17 +198,17 @@ void InfoWidget::refreshChannelLink() {
}
}
void InfoWidget::setLabeledText(ChildWidget<FlatLabel> *labelWidget, const QString &label,
ChildWidget<FlatLabel> *textWidget, const TextWithEntities &textWithEntities, const QString &copyText) {
void InfoWidget::setLabeledText(ChildWidget<Ui::FlatLabel> *labelWidget, const QString &label,
ChildWidget<Ui::FlatLabel> *textWidget, const TextWithEntities &textWithEntities, const QString &copyText) {
if (labelWidget) labelWidget->destroy();
textWidget->destroy();
if (textWithEntities.text.isEmpty()) return;
if (labelWidget) {
*labelWidget = new FlatLabel(this, label, FlatLabel::InitType::Simple, st::profileBlockLabel);
labelWidget->create(this, label, Ui::FlatLabel::InitType::Simple, st::profileBlockLabel);
(*labelWidget)->show();
}
*textWidget = new FlatLabel(this, QString(), FlatLabel::InitType::Simple, st::profileBlockOneLineTextPart);
textWidget->create(this, QString(), Ui::FlatLabel::InitType::Simple, st::profileBlockOneLineTextPart);
(*textWidget)->show();
(*textWidget)->setMarkedText(textWithEntities);
(*textWidget)->setContextCopyText(copyText);

View File

@ -22,7 +22,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "profile/profile_block_widget.h"
namespace Ui {
class FlatLabel;
} // namespace Ui
namespace Notify {
struct PeerUpdate;
@ -52,17 +54,17 @@ private:
void refreshVisibility();
// labelWidget may be nullptr.
void setLabeledText(ChildWidget<FlatLabel> *labelWidget, const QString &label,
ChildWidget<FlatLabel> *textWidget, const TextWithEntities &textWithEntities, const QString &copyText);
void setLabeledText(ChildWidget<Ui::FlatLabel> *labelWidget, const QString &label,
ChildWidget<Ui::FlatLabel> *textWidget, const TextWithEntities &textWithEntities, const QString &copyText);
ChildWidget<FlatLabel> _about = { nullptr };
ChildWidget<FlatLabel> _channelLinkLabel = { nullptr };
ChildWidget<FlatLabel> _channelLink = { nullptr };
ChildWidget<FlatLabel> _channelLinkShort = { nullptr };
ChildWidget<FlatLabel> _mobileNumberLabel = { nullptr };
ChildWidget<FlatLabel> _mobileNumber = { nullptr };
ChildWidget<FlatLabel> _usernameLabel = { nullptr };
ChildWidget<FlatLabel> _username = { nullptr };
ChildWidget<Ui::FlatLabel> _about = { nullptr };
ChildWidget<Ui::FlatLabel> _channelLinkLabel = { nullptr };
ChildWidget<Ui::FlatLabel> _channelLink = { nullptr };
ChildWidget<Ui::FlatLabel> _channelLinkShort = { nullptr };
ChildWidget<Ui::FlatLabel> _mobileNumberLabel = { nullptr };
ChildWidget<Ui::FlatLabel> _mobileNumber = { nullptr };
ChildWidget<Ui::FlatLabel> _usernameLabel = { nullptr };
ChildWidget<Ui::FlatLabel> _username = { nullptr };
};

View File

@ -22,7 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "profile/profile_invite_link_widget.h"
#include "styles/style_profile.h"
#include "ui/flatlabel.h"
#include "ui/widgets/labels.h"
#include "boxes/confirmbox.h"
#include "observer_peer.h"
#include "lang.h"
@ -94,7 +94,7 @@ void InviteLinkWidget::refreshLink() {
if (linkData.text.isEmpty()) {
_link.destroy();
} else {
_link = new FlatLabel(this, QString(), FlatLabel::InitType::Simple, st::profileInviteLinkText);
_link.create(this, QString(), Ui::FlatLabel::InitType::Simple, st::profileInviteLinkText);
_link->show();
linkData.entities.push_back(EntityInText(EntityInTextUrl, 0, linkData.text.size()));

View File

@ -22,7 +22,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "profile/profile_block_widget.h"
namespace Ui {
class FlatLabel;
} // namespace Ui
namespace Notify {
struct PeerUpdate;
@ -46,7 +48,7 @@ private:
void refreshLink();
void refreshVisibility();
ChildWidget<FlatLabel> _link = { nullptr };
ChildWidget<Ui::FlatLabel> _link = { nullptr };
};

View File

@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_profile.h"
#include "mtproto/file_download.h"
#include "ui/buttons/left_outline_button.h"
#include "ui/flatlabel.h"
#include "ui/widgets/labels.h"
#include "boxes/contactsbox.h"
#include "boxes/confirmbox.h"
#include "core/click_handler_types.h"
@ -307,7 +307,7 @@ void MembersWidget::refreshLimitReached() {
bool limitReachedShown = (_list.size() >= Global::ChatSizeMax()) && chat->amCreator() && !emptyTitle();
if (limitReachedShown && !_limitReachedInfo) {
_limitReachedInfo = new FlatLabel(this, st::profileLimitReachedLabel, st::profileLimitReachedStyle);
_limitReachedInfo.create(this, st::profileLimitReachedLabel, st::profileLimitReachedStyle);
QString title = textRichPrepare(lng_profile_migrate_reached(lt_count, Global::ChatSizeMax()));
QString body = textRichPrepare(lang(lng_profile_migrate_body));
QString link = textRichPrepare(lang(lng_profile_migrate_learn_more));

View File

@ -22,9 +22,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "profile/profile_block_widget.h"
class FlatLabel;
namespace Ui {
class FlatLabel;
class LeftOutlineButton;
} // namespace Ui
@ -123,7 +122,7 @@ private:
Member *addUser(ChannelData *megagroup, UserData *user);
bool addUsersToEnd(ChannelData *megagroup);
ChildWidget<FlatLabel> _limitReachedInfo = { nullptr };
ChildWidget<Ui::FlatLabel> _limitReachedInfo = { nullptr };
QList<Member*> _list;
QMap<UserData*, Member*> _membersByUser;

View File

@ -27,8 +27,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Profile {
UserpicButton::UserpicButton(QWidget *parent, PeerData *peer) : AbstractButton(parent), _peer(peer) {
resize(st::profilePhotoSize, st::profilePhotoSize);
UserpicButton::UserpicButton(QWidget *parent, PeerData *peer, int size) : AbstractButton(parent)
, _size(size ? size : st::profilePhotoSize)
, _peer(peer) {
resize(_size, _size);
processPeerPhoto();
_notShownYet = _waiting;
@ -107,13 +109,13 @@ void UserpicButton::startNewPhotoShowing() {
QPixmap UserpicButton::prepareUserpicPixmap() const {
auto retina = cIntRetinaFactor();
auto size = st::profilePhotoSize * retina;
auto size = width() * retina;
QImage image(size, size, QImage::Format_ARGB32_Premultiplied);
image.setDevicePixelRatio(cRetinaFactor());
image.fill(Qt::transparent);
{
Painter p(&image);
p.fillRect(0, 0, st::profilePhotoSize, st::profilePhotoSize, st::profileBg);
_peer->paintUserpic(p, st::profilePhotoSize, 0, 0);
_peer->paintUserpic(p, width(), 0, 0);
}
return App::pixmapFromImageInPlace(std_::move(image));
}

View File

@ -31,7 +31,7 @@ namespace Profile {
class UserpicButton : public Ui::AbstractButton, private base::Subscriber {
public:
UserpicButton(QWidget *parent, PeerData *peer);
UserpicButton(QWidget *parent, PeerData *peer, int size = 0);
// If at the first moment the _userpic was not loaded,
// we need to show it animated after the profile is fully shown.
@ -50,6 +50,7 @@ private:
bool _notShownYet;
int _size = 0;
PeerData *_peer;
bool _waiting = false;
QPixmap _userpic, _oldUserpic;

View File

@ -21,16 +21,18 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "stdafx.h"
#include "profile/profile_widget.h"
#include "styles/style_settings.h"
#include "profile/profile_fixed_bar.h"
#include "profile/profile_inner_widget.h"
#include "profile/profile_section_memento.h"
#include "mainwindow.h"
#include "application.h"
#include "ui/widgets/scroll_area.h"
namespace Profile {
Widget::Widget(QWidget *parent, PeerData *peer) : Window::SectionWidget(parent)
, _scroll(this, st::setScroll)
, _scroll(this, st::settingsScroll)
, _inner(this, peer)
, _fixedBar(this, peer)
, _fixedBarShadow(this, st::shadowColor) {

View File

@ -23,7 +23,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "window/section_widget.h"
#include "ui/widgets/shadow.h"
namespace Ui {
class ScrollArea;
} // namespace Ui
namespace Profile {
@ -68,7 +70,7 @@ private:
friend class SectionMemento;
ChildWidget<ScrollArea> _scroll;
ChildWidget<Ui::ScrollArea> _scroll;
ChildWidget<InnerWidget> _inner;
ChildWidget<FixedBar> _fixedBar;
ChildWidget<Ui::ToggleableShadow> _fixedBarShadow;

View File

@ -24,6 +24,11 @@ using "dialogs/dialogs.style";
using "ui/widgets/widgets.style";
using "boxes/boxes.style";
settingsScroll: FlatScroll(defaultFlatScroll) {
bottomsh: 0px;
topsh: 0px;
}
settingsMaxWidth: 520px;
settingsMaxPadding: 48px;
settingsMinPadding: 32px;
@ -44,14 +49,14 @@ settingsPhotoLeft: -8px;
settingsPhotoDuration: 500;
settingsNameLeft: 26px;
settingsNameTop: 9px;
settingsNameLabel: flatLabel(labelDefFlat) {
settingsNameLabel: FlatLabel(defaultFlatLabel) {
margin: margins(10px, 5px, 10px, 5px);
font: font(16px semibold);
width: 160px;
maxHeight: 24px;
textFg: #333333;
}
settingsNameTextStyle: textStyle(defaultTextStyle) {
settingsNameTextStyle: TextStyle(defaultTextStyle) {
}
settingsStatusLeft: 27px;
settingsStatusTop: 35px;
@ -83,13 +88,13 @@ settingsBlockTitleHeight: 31px;
settingsBlockTitleFont: font(15px semibold);
settingsBlockTitleFg: #333333;
settingsBlockTitleTop: 0px;
settingsPrimaryLabel: flatLabel(labelDefFlat) {
settingsPrimaryLabel: FlatLabel(defaultFlatLabel) {
font: boxTextFont;
}
settingsBlockLabel: flatLabel(settingsPrimaryLabel) {
settingsBlockLabel: FlatLabel(settingsPrimaryLabel) {
textFg: windowSubTextFg;
}
settingsBlockOneLineTextPart: flatLabel(settingsPrimaryLabel) {
settingsBlockOneLineTextPart: FlatLabel(settingsPrimaryLabel) {
width: 0px; // No need to set minWidth in one-line text.
margin: margins(5px, 5px, 5px, 5px);
maxHeight: 20px;

View File

@ -26,7 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/effects/widget_slide_wrap.h"
#include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
#include "ui/flatlabel.h"
#include "ui/widgets/labels.h"
#include "localstorage.h"
#include "mainwidget.h"
#include "mainwindow.h"
@ -39,7 +39,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Settings {
LabeledLink::LabeledLink(QWidget *parent, const QString &label, const QString &text, Type type, const char *slot) : TWidget(parent)
, _label(this, label, FlatLabel::InitType::Simple, (type == Type::Primary) ? st::settingsPrimaryLabel : st::labelDefFlat)
, _label(this, label, Ui::FlatLabel::InitType::Simple, (type == Type::Primary) ? st::settingsPrimaryLabel : st::defaultFlatLabel)
, _link(this, text, (type == Type::Primary) ? st::boxLinkButton : st::defaultLinkButton) {
connect(_link, SIGNAL(clicked()), parent, slot);
}
@ -97,7 +97,7 @@ void DownloadPathState::paintEvent(QPaintEvent *e) {
})();
if (!text.isEmpty()) {
p.setFont(st::linkFont);
p.setPen(st::windowTextFg);
p.setPen(st::windowFg);
p.drawTextRight(0, 0, width(), text);
}
}

View File

@ -22,7 +22,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "settings/settings_block_widget.h"
namespace Ui {
class FlatLabel;
} // namespace Ui
namespace Settings {
@ -46,7 +48,7 @@ protected:
int resizeGetHeight(int newWidth) override;
private:
ChildWidget<FlatLabel> _label;
ChildWidget<Ui::FlatLabel> _label;
ChildWidget<Ui::LinkButton> _link;
};

View File

@ -21,7 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "stdafx.h"
#include "settings/settings_cover.h"
#include "ui/flatlabel.h"
#include "ui/widgets/labels.h"
#include "ui/widgets/buttons.h"
#include "observer_peer.h"
#include "lang.h"

View File

@ -25,8 +25,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "settings/settings_block_widget.h"
class FlatLabel;
namespace Ui {
class FlatLabel;
class RoundButton;
class IconButton;
} // namespace Ui
@ -91,7 +91,7 @@ private:
ChildWidget<Profile::UserpicButton> _userpicButton;
ChildWidget<Profile::CoverDropArea> _dropArea = { nullptr };
ChildWidget<FlatLabel> _name;
ChildWidget<Ui::FlatLabel> _name;
ChildWidget<Ui::IconButton> _editNameInline;
ChildWidget<Ui::LinkButton> _cancelPhotoUpload = { nullptr };

View File

@ -51,7 +51,7 @@ void FixedBar::paintEvent(QPaintEvent *e) {
p.fillRect(e->rect(), st::boxBlockTitleBg);
p.setFont(st::settingsFixedBarFont);
p.setPen(st::windowTextFg);
p.setPen(st::windowFg);
p.drawTextLeft(st::settingsFixedBarTextLeft, st::settingsFixedBarTextTop, width(), lang(lng_menu_settings));
}

View File

@ -32,25 +32,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "application.h"
#include "boxes/languagebox.h"
#include "boxes/confirmbox.h"
#include "boxes/aboutbox.h"
#include "ui/filedialog.h"
#include "langloaderplain.h"
#include "autoupdater.h"
namespace Settings {
namespace {
QString currentVersion() {
auto result = QString::fromLatin1(AppVersionStr.c_str());
if (cAlphaVersion()) {
result += " alpha";
}
if (cBetaVersion()) {
result += qsl(" beta %1").arg(cBetaVersion() % 1000);
}
return result;
}
} // namespace
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
UpdateStateRow::UpdateStateRow(QWidget *parent) : TWidget(parent)
@ -189,7 +176,7 @@ void GeneralWidget::refreshControls() {
style::margins slidedPadding(0, marginSmall.bottom() / 2, 0, marginSmall.bottom() - (marginSmall.bottom() / 2));
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
addChildRow(_updateAutomatically, marginSub, lng_settings_update_automatically(lt_version, currentVersion()), SLOT(onUpdateAutomatically()), cAutoUpdate());
addChildRow(_updateAutomatically, marginSub, lng_settings_update_automatically(lt_version, currentVersionText()), SLOT(onUpdateAutomatically()), cAutoUpdate());
style::margins marginLink(st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
addChildRow(_updateRow, marginLink, slidedPadding);
connect(_updateRow->entity(), SIGNAL(restart()), this, SLOT(onRestart()));

View File

@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_settings.h"
#include "lang.h"
#include "ui/flatlabel.h"
#include "ui/widgets/labels.h"
#include "ui/effects/widget_slide_wrap.h"
#include "boxes/usernamebox.h"
#include "observer_peer.h"
@ -133,18 +133,18 @@ void InfoWidget::LabeledWidget::setLabeledText(const QString &label, const TextW
_shortText.destroy();
if (textWithEntities.text.isEmpty()) return;
_label = new FlatLabel(this, label, FlatLabel::InitType::Simple, st::settingsBlockLabel);
_label.create(this, label, Ui::FlatLabel::InitType::Simple, st::settingsBlockLabel);
_label->show();
setLabelText(_text, textWithEntities, copyText);
setLabelText(_shortText, shortTextWithEntities, copyText);
resizeToWidth(width());
}
void InfoWidget::LabeledWidget::setLabelText(ChildWidget<FlatLabel> &text, const TextWithEntities &textWithEntities, const QString &copyText) {
void InfoWidget::LabeledWidget::setLabelText(ChildWidget<Ui::FlatLabel> &text, const TextWithEntities &textWithEntities, const QString &copyText) {
text.destroy();
if (textWithEntities.text.isEmpty()) return;
text = new FlatLabel(this, QString(), FlatLabel::InitType::Simple, st::settingsBlockOneLineTextPart);
text.create(this, QString(), Ui::FlatLabel::InitType::Simple, st::settingsBlockOneLineTextPart);
text->show();
text->setMarkedText(textWithEntities);
text->setContextCopyText(copyText);

View File

@ -22,7 +22,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "settings/settings_block_widget.h"
namespace Ui {
class FlatLabel;
} // namespace Ui
namespace Notify {
struct PeerUpdate;
@ -50,10 +52,10 @@ private:
void setLabeledText(const QString &label, const TextWithEntities &textWithEntities, const TextWithEntities &shortTextWithEntities, const QString &copyText);
FlatLabel *textLabel() {
Ui::FlatLabel *textLabel() {
return _text;
}
FlatLabel *shortTextLabel() {
Ui::FlatLabel *shortTextLabel() {
return _shortText;
}
@ -63,11 +65,11 @@ private:
int resizeGetHeight(int newWidth) override;
private:
void setLabelText(ChildWidget<FlatLabel> &text, const TextWithEntities &textWithEntities, const QString &copyText);
void setLabelText(ChildWidget<Ui::FlatLabel> &text, const TextWithEntities &textWithEntities, const QString &copyText);
ChildWidget<FlatLabel> _label = { nullptr };
ChildWidget<FlatLabel> _text = { nullptr };
ChildWidget<FlatLabel> _shortText = { nullptr };
ChildWidget<Ui::FlatLabel> _label = { nullptr };
ChildWidget<Ui::FlatLabel> _text = { nullptr };
ChildWidget<Ui::FlatLabel> _shortText = { nullptr };
};

View File

@ -146,7 +146,7 @@ void CloudPasswordState::paintEvent(QPaintEvent *e) {
auto text = st::linkFont->elided(_waitingConfirm, width() - _turnOff->width());
if (!text.isEmpty()) {
p.setPen(st::windowTextFg);
p.setPen(st::windowFg);
p.setFont(st::boxTextFont);
p.drawTextLeft(0, 0, width(), text);
}

View File

@ -27,7 +27,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_window.h"
#include "styles/style_boxes.h"
#include "ui/widgets/shadow.h"
#include "ui/scrollarea.h"
#include "ui/widgets/scroll_area.h"
#include "mainwindow.h"
#include "mainwidget.h"
#include "localstorage.h"
@ -125,7 +125,7 @@ void codesFeedString(const QString &text) {
} // namespace
Widget::Widget(QWidget *parent) : LayerWidget(parent)
, _scroll(this, st::setScroll)
, _scroll(this, st::settingsScroll)
, _inner(this)
, _fixedBar(this)
, _fixedBarShadow(this, st::boxBlockTitleShadow) {

View File

@ -23,6 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "layerwidget.h"
namespace Ui {
class ScrollArea;
class GradientShadow;
} // namespace Ui
@ -51,7 +52,7 @@ private slots:
private:
void resizeUsingInnerHeight(int newWidth, int newContentLeft);
ChildWidget<ScrollArea> _scroll;
ChildWidget<Ui::ScrollArea> _scroll;
ChildWidget<InnerWidget> _inner;
ChildWidget<FixedBar> _fixedBar;
ChildWidget<Ui::GradientShadow> _fixedBarShadow;

View File

@ -70,7 +70,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/animation.h"
#include "ui/twidget.h"
#include "ui/scrollarea.h"
#include "ui/images.h"
#include "ui/text/text.h"

View File

@ -292,7 +292,7 @@ void EmojiColorPicker::drawVariant(Painter &p, int variant) {
p.drawPixmapLeft(w.x() + (st::emojiPanSize.width() - (esize / cIntRetinaFactor())) / 2, w.y() + (st::emojiPanSize.height() - (esize / cIntRetinaFactor())) / 2, width(), App::emojiLarge(), QRect(_variants[variant]->x * esize, _variants[variant]->y * esize, esize, esize));
}
EmojiPanInner::EmojiPanInner() : TWidget()
EmojiPanInner::EmojiPanInner(QWidget *parent) : TWidget(parent)
, _maxHeight(int(st::emojiPanMaxHeight) - st::emojiCategory.height)
, _a_selected(animation(this, &EmojiPanInner::step_selected)) {
resize(st::emojiPanWidth - st::emojiScroll.width - st::buttonRadius, countHeight());
@ -793,7 +793,7 @@ void EmojiPanInner::showEmojiPack(DBIEmojiTab packIndex) {
update();
}
StickerPanInner::StickerPanInner() : TWidget()
StickerPanInner::StickerPanInner(QWidget *parent) : TWidget(parent)
, _a_selected(animation(this, &StickerPanInner::step_selected))
, _section(cShowingSavedGifs() ? Section::Gifs : Section::Stickers)
, _addText(lang(lng_stickers_featured_add).toUpper())
@ -2813,26 +2813,26 @@ EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent)
, _symbols(this, st::emojiCategorySymbols)
, _a_icons(animation(this, &EmojiPan::step_icons))
, e_scroll(this, st::emojiScroll)
, e_inner()
, e_switch(&e_scroll, true)
, e_inner(this)
, e_switch(e_scroll, true)
, s_scroll(this, st::emojiScroll)
, s_inner()
, s_switch(&s_scroll, false) {
, s_inner(this)
, s_switch(s_scroll, false) {
resize(QRect(0, 0, st::emojiPanWidth, _contentHeight).marginsAdded(innerPadding()).size());
_width = width();
_height = height();
_bottom = 0;
e_scroll.resize(st::emojiPanWidth - st::buttonRadius, _contentHeightEmoji);
s_scroll.resize(st::emojiPanWidth - st::buttonRadius, _contentHeightStickers);
e_scroll->resize(st::emojiPanWidth - st::buttonRadius, _contentHeightEmoji);
s_scroll->resize(st::emojiPanWidth - st::buttonRadius, _contentHeightStickers);
e_scroll.move(verticalRect().topLeft());
e_scroll.setWidget(&e_inner);
s_scroll.move(verticalRect().topLeft());
s_scroll.setWidget(&s_inner);
e_scroll->move(verticalRect().topLeft());
e_scroll->setOwnedWidget(e_inner);
s_scroll->move(verticalRect().topLeft());
s_scroll->setOwnedWidget(s_inner);
e_inner.moveToLeft(0, 0, e_scroll.width());
s_inner.moveToLeft(0, 0, s_scroll.width());
e_inner->moveToLeft(0, 0, e_scroll->width());
s_inner->moveToLeft(0, 0, s_scroll->width());
int32 left = _iconsLeft = innerRect().x() + (st::emojiPanWidth - 8 * st::emojiCategory.width) / 2;
int32 top = _iconsTop = innerRect().y() + innerRect().height() - st::emojiCategory.height;
@ -2844,7 +2844,7 @@ EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent)
prepareTab(left, top, _width, _travel, dbietTravel);
prepareTab(left, top, _width, _objects, dbietObjects);
prepareTab(left, top, _width, _symbols, dbietSymbols);
e_inner.fillPanels(e_panels);
e_inner->fillPanels(e_panels);
updatePanelsPositions(e_panels, 0);
setCurrentTabIcon(dbietRecent);
@ -2852,38 +2852,38 @@ EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent)
_hideTimer.setSingleShot(true);
connect(&_hideTimer, SIGNAL(timeout()), this, SLOT(hideByTimerOrLeave()));
connect(&e_inner, SIGNAL(scrollToY(int)), &e_scroll, SLOT(scrollToY(int)));
connect(&e_inner, SIGNAL(disableScroll(bool)), &e_scroll, SLOT(disableScroll(bool)));
connect(e_inner, SIGNAL(scrollToY(int)), e_scroll, SLOT(scrollToY(int)));
connect(e_inner, SIGNAL(disableScroll(bool)), e_scroll, SLOT(disableScroll(bool)));
connect(&s_inner, SIGNAL(scrollToY(int)), &s_scroll, SLOT(scrollToY(int)));
connect(&s_inner, SIGNAL(scrollUpdated()), this, SLOT(onScrollStickers()));
connect(s_inner, SIGNAL(scrollToY(int)), s_scroll, SLOT(scrollToY(int)));
connect(s_inner, SIGNAL(scrollUpdated()), this, SLOT(onScrollStickers()));
connect(&e_scroll, SIGNAL(scrolled()), this, SLOT(onScrollEmoji()));
connect(&s_scroll, SIGNAL(scrolled()), this, SLOT(onScrollStickers()));
connect(e_scroll, SIGNAL(scrolled()), this, SLOT(onScrollEmoji()));
connect(s_scroll, SIGNAL(scrolled()), this, SLOT(onScrollStickers()));
connect(&e_inner, SIGNAL(selected(EmojiPtr)), this, SIGNAL(emojiSelected(EmojiPtr)));
connect(&s_inner, SIGNAL(selected(DocumentData*)), this, SIGNAL(stickerSelected(DocumentData*)));
connect(&s_inner, SIGNAL(selected(PhotoData*)), this, SIGNAL(photoSelected(PhotoData*)));
connect(&s_inner, SIGNAL(selected(InlineBots::Result*,UserData*)), this, SIGNAL(inlineResultSelected(InlineBots::Result*,UserData*)));
connect(e_inner, SIGNAL(selected(EmojiPtr)), this, SIGNAL(emojiSelected(EmojiPtr)));
connect(s_inner, SIGNAL(selected(DocumentData*)), this, SIGNAL(stickerSelected(DocumentData*)));
connect(s_inner, SIGNAL(selected(PhotoData*)), this, SIGNAL(photoSelected(PhotoData*)));
connect(s_inner, SIGNAL(selected(InlineBots::Result*,UserData*)), this, SIGNAL(inlineResultSelected(InlineBots::Result*,UserData*)));
connect(&s_inner, SIGNAL(emptyInlineRows()), this, SLOT(onEmptyInlineRows()));
connect(s_inner, SIGNAL(emptyInlineRows()), this, SLOT(onEmptyInlineRows()));
connect(&s_switch, SIGNAL(clicked()), this, SLOT(onSwitch()));
connect(&e_switch, SIGNAL(clicked()), this, SLOT(onSwitch()));
s_switch.moveToRight(st::buttonRadius, 0, st::emojiPanWidth);
e_switch.moveToRight(st::buttonRadius, 0, st::emojiPanWidth);
connect(s_switch, SIGNAL(clicked()), this, SLOT(onSwitch()));
connect(e_switch, SIGNAL(clicked()), this, SLOT(onSwitch()));
s_switch->moveToRight(st::buttonRadius, 0, st::emojiPanWidth);
e_switch->moveToRight(st::buttonRadius, 0, st::emojiPanWidth);
connect(&s_inner, SIGNAL(displaySet(quint64)), this, SLOT(onDisplaySet(quint64)));
connect(&s_inner, SIGNAL(installSet(quint64)), this, SLOT(onInstallSet(quint64)));
connect(&s_inner, SIGNAL(removeSet(quint64)), this, SLOT(onRemoveSet(quint64)));
connect(&s_inner, SIGNAL(refreshIcons(bool)), this, SLOT(onRefreshIcons(bool)));
connect(&e_inner, SIGNAL(needRefreshPanels()), this, SLOT(onRefreshPanels()));
connect(&s_inner, SIGNAL(needRefreshPanels()), this, SLOT(onRefreshPanels()));
connect(s_inner, SIGNAL(displaySet(quint64)), this, SLOT(onDisplaySet(quint64)));
connect(s_inner, SIGNAL(installSet(quint64)), this, SLOT(onInstallSet(quint64)));
connect(s_inner, SIGNAL(removeSet(quint64)), this, SLOT(onRemoveSet(quint64)));
connect(s_inner, SIGNAL(refreshIcons(bool)), this, SLOT(onRefreshIcons(bool)));
connect(e_inner, SIGNAL(needRefreshPanels()), this, SLOT(onRefreshPanels()));
connect(s_inner, SIGNAL(needRefreshPanels()), this, SLOT(onRefreshPanels()));
_saveConfigTimer.setSingleShot(true);
connect(&_saveConfigTimer, SIGNAL(timeout()), this, SLOT(onSaveConfig()));
connect(&e_inner, SIGNAL(saveConfigDelayed(int32)), this, SLOT(onSaveConfigDelayed(int32)));
connect(&s_inner, SIGNAL(saveConfigDelayed(int32)), this, SLOT(onSaveConfigDelayed(int32)));
connect(e_inner, SIGNAL(saveConfigDelayed(int32)), this, SLOT(onSaveConfigDelayed(int32)));
connect(s_inner, SIGNAL(saveConfigDelayed(int32)), this, SLOT(onSaveConfigDelayed(int32)));
// inline bots
_inlineRequestTimer.setSingleShot(true);
@ -2905,7 +2905,7 @@ void EmojiPan::setMaxHeight(int32 h) {
void EmojiPan::updateContentHeight() {
int32 h = qMin(_contentMaxHeight, _maxHeight);
int32 he = h - st::emojiCategory.height;
int32 hs = h - (s_inner.showSectionIcons() ? st::emojiCategory.height : 0);
int32 hs = h - (s_inner->showSectionIcons() ? st::emojiCategory.height : 0);
if (h == _contentHeight && he == _contentHeightEmoji && hs == _contentHeightStickers) return;
int32 was = _contentHeight, wase = _contentHeightEmoji, wass = _contentHeightStickers;
@ -2918,15 +2918,15 @@ void EmojiPan::updateContentHeight() {
move(x(), _bottom - _height);
if (was > _contentHeight || (was == _contentHeight && wass > _contentHeightStickers)) {
e_scroll.resize(e_scroll.width(), _contentHeightEmoji);
s_scroll.resize(s_scroll.width(), _contentHeightStickers);
s_inner.setMaxHeight(_contentHeightStickers);
e_inner.setMaxHeight(_contentHeightEmoji);
e_scroll->resize(e_scroll->width(), _contentHeightEmoji);
s_scroll->resize(s_scroll->width(), _contentHeightStickers);
s_inner->setMaxHeight(_contentHeightStickers);
e_inner->setMaxHeight(_contentHeightEmoji);
} else {
s_inner.setMaxHeight(_contentHeightStickers);
e_inner.setMaxHeight(_contentHeightEmoji);
e_scroll.resize(e_scroll.width(), _contentHeightEmoji);
s_scroll.resize(s_scroll.width(), _contentHeightStickers);
s_inner->setMaxHeight(_contentHeightStickers);
e_inner->setMaxHeight(_contentHeightEmoji);
e_scroll->resize(e_scroll->width(), _contentHeightEmoji);
s_scroll->resize(s_scroll->width(), _contentHeightStickers);
}
_iconsTop = innerRect().y() + innerRect().height() - st::emojiCategory.height;
@ -3016,14 +3016,14 @@ void EmojiPan::paintContent(Painter &p) {
auto inner = innerRect();
App::roundRect(p, inner, st::emojiPanBg, ImageRoundRadius::Small, App::RectPart::TopFull);
auto showSectionIcons = _emojiShown || s_inner.showSectionIcons();
auto showSectionIcons = _emojiShown || s_inner->showSectionIcons();
auto &bottomBg = showSectionIcons ? st::emojiPanCategories : st::emojiPanBg;
auto bottomParts = showSectionIcons ? (App::RectPart::NoTopBottom | App::RectPart::BottomFull) : App::RectPart::BottomFull;
App::roundRect(p, inner.x(), _iconsTop - st::buttonRadius, inner.width(), st::emojiCategory.height + st::buttonRadius, bottomBg, ImageRoundRadius::Small, bottomParts);
auto horizontal = horizontalRect();
auto sidesTop = horizontal.y();
auto sidesHeight = e_scroll.y() + e_scroll.height() - sidesTop;
auto sidesHeight = e_scroll->y() + e_scroll->height() - sidesTop;
p.fillRect(myrtlrect(inner.x() + inner.width() - st::emojiScroll.width, sidesTop, st::emojiScroll.width, sidesHeight), st::emojiPanBg);
p.fillRect(myrtlrect(inner.x(), sidesTop, st::buttonRadius, sidesHeight), st::emojiPanBg);
if (_emojiShown) {
@ -3099,7 +3099,7 @@ void EmojiPan::moveBottom(int32 bottom, bool force) {
move(x(), _bottom - height());
return;
}
if (!_emojiShown && s_inner.inlineResultsShown()) {
if (!_emojiShown && s_inner->inlineResultsShown()) {
setOrigin(Ui::PanelAnimation::Origin::BottomLeft);
moveToLeft(0, _bottom - height());
} else {
@ -3118,7 +3118,7 @@ bool EmojiPan::preventAutoHide() const {
}
void EmojiPan::leaveEvent(QEvent *e) {
if (preventAutoHide() || s_inner.inlineResultsShown()) return;
if (preventAutoHide() || s_inner->inlineResultsShown()) return;
auto ms = getms();
if (_a_show.animating(ms) || _a_opacity.animating(ms)) {
hideAnimated();
@ -3134,7 +3134,7 @@ void EmojiPan::otherEnter() {
}
void EmojiPan::otherLeave() {
if (preventAutoHide() || s_inner.inlineResultsShown()) return;
if (preventAutoHide() || s_inner->inlineResultsShown()) return;
auto ms = getms();
if (_a_opacity.animating(ms)) {
hideByTimerOrLeave();
@ -3200,7 +3200,7 @@ void EmojiPan::mouseReleaseEvent(QMouseEvent *e) {
if (wasDown == _iconOver && _iconOver >= 0 && _iconOver < _icons.size()) {
_iconSelX = anim::ivalue(_iconOver * st::emojiCategory.width, _iconOver * st::emojiCategory.width);
s_inner.showStickerSet(_icons.at(_iconOver).setId);
s_inner->showStickerSet(_icons.at(_iconOver).setId);
}
}
}
@ -3242,19 +3242,19 @@ void EmojiPan::hideFast() {
}
void EmojiPan::refreshStickers() {
s_inner.refreshStickers();
s_inner->refreshStickers();
if (_emojiShown) {
s_inner.preloadImages();
s_inner->preloadImages();
}
update();
}
void EmojiPan::refreshSavedGifs() {
e_switch.updateText();
e_switch.moveToRight(st::buttonRadius, 0, st::emojiPanWidth);
s_inner.refreshSavedGifs();
e_switch->updateText();
e_switch->moveToRight(st::buttonRadius, 0, st::emojiPanWidth);
s_inner->refreshSavedGifs();
if (_emojiShown) {
s_inner.preloadImages();
s_inner->preloadImages();
}
}
@ -3262,8 +3262,8 @@ void EmojiPan::onRefreshIcons(bool scrollAnimation) {
_iconOver = -1;
_iconHovers.clear();
_iconAnimations.clear();
s_inner.fillIcons(_icons);
s_inner.fillPanels(s_panels);
s_inner->fillIcons(_icons);
s_inner->fillPanels(s_panels);
_iconsX.finish();
_iconSelX.finish();
_iconsStartAnim = 0;
@ -3277,7 +3277,7 @@ void EmojiPan::onRefreshIcons(bool scrollAnimation) {
if (_iconsX.current() > _iconsMax) {
_iconsX = anim::ivalue(_iconsMax, _iconsMax);
}
updatePanelsPositions(s_panels, s_scroll.scrollTop());
updatePanelsPositions(s_panels, s_scroll->scrollTop());
updateSelected();
if (!_emojiShown) {
validateSelectedIcon(scrollAnimation ? ValidateIconAnimations::Scroll : ValidateIconAnimations::None);
@ -3287,12 +3287,12 @@ void EmojiPan::onRefreshIcons(bool scrollAnimation) {
}
void EmojiPan::onRefreshPanels() {
e_inner.refreshPanels(e_panels);
s_inner.refreshPanels(s_panels);
e_inner->refreshPanels(e_panels);
s_inner->refreshPanels(s_panels);
if (_emojiShown) {
updatePanelsPositions(e_panels, e_scroll.scrollTop());
updatePanelsPositions(e_panels, e_scroll->scrollTop());
} else {
updatePanelsPositions(s_panels, s_scroll.scrollTop());
updatePanelsPositions(s_panels, s_scroll->scrollTop());
}
}
@ -3346,7 +3346,7 @@ void EmojiPan::updateSelected() {
}
void EmojiPan::updateIcons() {
if (_emojiShown || !s_inner.showSectionIcons()) return;
if (_emojiShown || !s_inner->showSectionIcons()) return;
QRect r(st::defaultDropdownPadding.left(), st::defaultDropdownPadding.top(), _width - st::defaultDropdownPadding.left() - st::defaultDropdownPadding.right(), _height - st::defaultDropdownPadding.top() - st::defaultDropdownPadding.bottom());
update(r.left(), _iconsTop, r.width(), st::emojiCategory.height);
@ -3405,7 +3405,7 @@ void EmojiPan::opacityAnimationCallback() {
}
void EmojiPan::hideByTimerOrLeave() {
if (isHidden() || preventAutoHide() || s_inner.inlineResultsShown()) return;
if (isHidden() || preventAutoHide() || s_inner->inlineResultsShown()) return;
hideAnimated();
}
@ -3481,8 +3481,8 @@ EmojiPan::~EmojiPan() = default;
void EmojiPan::hideFinished() {
hide();
e_inner.hideFinish();
s_inner.hideFinish(true);
e_inner->hideFinish();
s_inner->hideFinish(true);
_a_show.finish();
_showAnimation.reset();
_a_slide.finish();
@ -3491,9 +3491,9 @@ void EmojiPan::hideFinished() {
_horizontal = false;
_hiding = false;
e_scroll.scrollToY(0);
e_scroll->scrollToY(0);
setCurrentTabIcon(dbietRecent);
s_scroll.scrollToY(0);
s_scroll->scrollToY(0);
_iconOver = _iconDown = -1;
_iconSel = 0;
_iconsX = anim::ivalue(0, 0);
@ -3518,32 +3518,30 @@ void EmojiPan::showAnimated(Ui::PanelAnimation::Origin origin) {
void EmojiPan::showStarted() {
if (isHidden()) {
e_inner.refreshRecent();
if (s_inner.inlineResultsShown() && refreshInlineRows()) {
emit updateStickers();
e_inner->refreshRecent();
if (s_inner->inlineResultsShown() && refreshInlineRows()) {
_emojiShown = false;
_shownFromInlineQuery = true;
} else {
s_inner.refreshRecent();
s_inner->refreshRecent();
_emojiShown = true;
_shownFromInlineQuery = false;
_cache = QPixmap(); // clear after refreshInlineRows()
}
recountContentMaxHeight();
s_inner.preloadImages();
s_inner->preloadImages();
_a_slide.finish();
_slideAnimation.reset();
moveBottom(y() + height(), true);
show();
startShowAnimation();
return;
} else if (!_hiding) {
return;
} else if (_hiding) {
if (s_inner->inlineResultsShown() && refreshInlineRows()) {
onSwitch();
}
startOpacityAnimation(false);
}
if (s_inner.inlineResultsShown() && refreshInlineRows()) {
onSwitch();
}
startOpacityAnimation(false);
emit updateStickers();
}
bool EmojiPan::eventFilter(QObject *obj, QEvent *e) {
@ -3578,40 +3576,40 @@ void EmojiPan::stickersInstalled(uint64 setId) {
show();
}
showAll();
s_inner.showStickerSet(setId);
s_inner->showStickerSet(setId);
updateContentHeight();
showAnimated(Ui::PanelAnimation::Origin::BottomRight);
}
void EmojiPan::notify_inlineItemLayoutChanged(const InlineBots::Layout::ItemBase *layout) {
if (!_emojiShown && !isHidden()) {
s_inner.notify_inlineItemLayoutChanged(layout);
s_inner->notify_inlineItemLayoutChanged(layout);
}
}
void EmojiPan::ui_repaintInlineItem(const InlineBots::Layout::ItemBase *layout) {
if (!_emojiShown && !isHidden()) {
s_inner.ui_repaintInlineItem(layout);
s_inner->ui_repaintInlineItem(layout);
}
}
bool EmojiPan::ui_isInlineItemVisible(const InlineBots::Layout::ItemBase *layout) {
if (!_emojiShown && !isHidden()) {
return s_inner.ui_isInlineItemVisible(layout);
return s_inner->ui_isInlineItemVisible(layout);
}
return false;
}
bool EmojiPan::ui_isInlineItemBeingChosen() {
if (!_emojiShown && !isHidden()) {
return s_inner.ui_isInlineItemBeingChosen();
return s_inner->ui_isInlineItemBeingChosen();
}
return false;
}
void EmojiPan::showAll() {
if (_emojiShown) {
s_scroll.hide();
s_scroll->hide();
_recent->show();
_people->show();
_nature->show();
@ -3620,9 +3618,9 @@ void EmojiPan::showAll() {
_travel->show();
_objects->show();
_symbols->show();
e_scroll.show();
e_scroll->show();
} else {
s_scroll.show();
s_scroll->show();
_recent->hide();
_people->hide();
_nature->hide();
@ -3631,7 +3629,7 @@ void EmojiPan::showAll() {
_travel->hide();
_objects->hide();
_symbols->hide();
e_scroll.hide();
e_scroll->hide();
}
}
@ -3644,14 +3642,14 @@ void EmojiPan::hideAll() {
_travel->hide();
_objects->hide();
_symbols->hide();
e_scroll.hide();
s_scroll.hide();
e_inner.clearSelection(true);
s_inner.clearSelection(true);
e_scroll->hide();
s_scroll->hide();
e_inner->clearSelection(true);
s_inner->clearSelection(true);
}
void EmojiPan::setActiveTab(DBIEmojiTab tab) {
e_inner.showEmojiPack(tab);
e_inner->showEmojiPack(tab);
}
void EmojiPan::updatePanelsPositions(const QVector<internal::EmojiPanel*> &panels, int32 st) {
@ -3666,20 +3664,20 @@ void EmojiPan::updatePanelsPositions(const QVector<internal::EmojiPanel*> &panel
// Somehow the panels gets hidden (not displayed) when scrolling
// by clicking on the scroll bar to the middle of the panel.
// This bug occurs only in the Section::Featured stickers.
if (s_inner.currentSet(0) == Stickers::FeaturedSetId) {
if (s_inner->currentSet(0) == Stickers::FeaturedSetId) {
panels.at(i)->repaint();
}
}
}
void EmojiPan::onScrollEmoji() {
auto st = e_scroll.scrollTop();
auto st = e_scroll->scrollTop();
updatePanelsPositions(e_panels, st);
setCurrentTabIcon(e_inner.currentTab(st));
setCurrentTabIcon(e_inner->currentTab(st));
e_inner.setVisibleTopBottom(st, st + e_scroll.height());
e_inner->setVisibleTopBottom(st, st + e_scroll->height());
}
void EmojiPan::setCurrentTabIcon(DBIEmojiTab tab) {
@ -3694,20 +3692,20 @@ void EmojiPan::setCurrentTabIcon(DBIEmojiTab tab) {
}
void EmojiPan::onScrollStickers() {
auto st = s_scroll.scrollTop();
auto st = s_scroll->scrollTop();
updatePanelsPositions(s_panels, st);
validateSelectedIcon(ValidateIconAnimations::Full);
if (st + s_scroll.height() > s_scroll.scrollTopMax()) {
if (st + s_scroll->height() > s_scroll->scrollTopMax()) {
onInlineRequest();
}
s_inner.setVisibleTopBottom(st, st + s_scroll.height());
s_inner->setVisibleTopBottom(st, st + s_scroll->height());
}
void EmojiPan::validateSelectedIcon(ValidateIconAnimations animations) {
uint64 setId = s_inner.currentSet(s_scroll.scrollTop());
uint64 setId = s_inner->currentSet(s_scroll->scrollTop());
int32 newSel = 0;
for (int i = 0, l = _icons.size(); i < l; ++i) {
if (_icons.at(i).setId == setId) {
@ -3784,9 +3782,9 @@ void EmojiPan::onSwitch() {
hideAll();
if (_emojiShown) {
s_inner.hideFinish(false);
s_inner->hideFinish(false);
} else {
e_inner.hideFinish();
e_inner->hideFinish();
}
_a_slide.start([this] { update(); }, 0., 1., st::emojiPanSlideDuration, anim::linear);
@ -3799,14 +3797,14 @@ void EmojiPan::performSwitch() {
Notify::clipStopperHidden(ClipStopperSavedGifsPanel);
} else {
if (cShowingSavedGifs() && cSavedGifs().isEmpty()) {
s_inner.showStickerSet(Stickers::DefaultSetId);
s_inner->showStickerSet(Stickers::DefaultSetId);
} else if (!cShowingSavedGifs() && !cSavedGifs().isEmpty() && Global::StickerSetsOrder().isEmpty()) {
s_inner.showStickerSet(Stickers::NoneSetId);
s_inner->showStickerSet(Stickers::NoneSetId);
} else {
s_inner.updateShowingSavedGifs();
s_inner->updateShowingSavedGifs();
}
if (cShowingSavedGifs()) {
s_inner.showFinish();
s_inner->showFinish();
}
validateSelectedIcon(ValidateIconAnimations::None);
updateContentHeight();
@ -3833,7 +3831,7 @@ void EmojiPan::onInstallSet(quint64 setId) {
auto it = sets.constFind(setId);
if (it != sets.cend()) {
MTP::send(MTPmessages_InstallStickerSet(Stickers::inputSetId(*it), MTP_bool(false)), rpcDone(&EmojiPan::installSetDone), rpcFail(&EmojiPan::installSetFail, setId));
s_inner.installedLocally(setId);
s_inner->installedLocally(setId);
Stickers::installLocally(setId);
}
}
@ -3848,7 +3846,7 @@ bool EmojiPan::installSetFail(uint64 setId, const RPCError &error) {
if (MTP::isDefaultHandledError(error)) {
return false;
}
s_inner.notInstalledLocally(setId);
s_inner->notInstalledLocally(setId);
Stickers::undoInstallLocally(setId);
return true;
}
@ -3908,12 +3906,12 @@ void EmojiPan::onDelayedHide() {
void EmojiPan::clearInlineBot() {
inlineBotChanged();
e_switch.updateText();
e_switch.moveToRight(st::buttonRadius, 0, st::emojiPanWidth);
e_switch->updateText();
e_switch->moveToRight(st::buttonRadius, 0, st::emojiPanWidth);
}
bool EmojiPan::hideOnNoInlineResults() {
return _inlineBot && !_emojiShown && s_inner.inlineResultsShown() && (_shownFromInlineQuery || _inlineBot->username != cInlineGifBotUsername());
return _inlineBot && !_emojiShown && s_inner->inlineResultsShown() && (_shownFromInlineQuery || _inlineBot->username != cInlineGifBotUsername());
}
void EmojiPan::inlineBotChanged() {
@ -3933,8 +3931,8 @@ void EmojiPan::inlineBotChanged() {
delete i.value();
}
_inlineCache.clear();
s_inner.inlineBotChanged();
s_inner.hideInlineRowsPanel();
s_inner->inlineBotChanged();
s_inner->hideInlineRowsPanel();
Notify::inlineBotRequesting(false);
}
@ -4042,11 +4040,11 @@ void EmojiPan::onInlineRequest() {
void EmojiPan::onEmptyInlineRows() {
if (_shownFromInlineQuery || hideOnNoInlineResults()) {
hideAnimated();
s_inner.clearInlineRowsPanel();
s_inner->clearInlineRowsPanel();
} else if (!_inlineBot) {
s_inner.hideInlineRowsPanel();
s_inner->hideInlineRowsPanel();
} else {
s_inner.clearInlineRowsPanel();
s_inner->clearInlineRowsPanel();
}
}
@ -4060,7 +4058,7 @@ bool EmojiPan::refreshInlineRows(int32 *added) {
_inlineNextOffset = i.value()->nextOffset;
}
if (!entry) prepareCache();
int32 result = s_inner.refreshInlineRows(_inlineBot, entry, false);
int32 result = s_inner->refreshInlineRows(_inlineBot, entry, false);
if (added) *added = result;
return (entry != nullptr);
}
@ -4068,10 +4066,10 @@ bool EmojiPan::refreshInlineRows(int32 *added) {
int32 EmojiPan::showInlineRows(bool newResults) {
int32 added = 0;
bool clear = !refreshInlineRows(&added);
if (newResults) s_scroll.scrollToY(0);
if (newResults) s_scroll->scrollToY(0);
e_switch.updateText(s_inner.inlineResultsShown() ? _inlineBot->username : QString());
e_switch.moveToRight(0, 0, st::emojiPanWidth);
e_switch->updateText(s_inner->inlineResultsShown() ? _inlineBot->username : QString());
e_switch->moveToRight(0, 0, st::emojiPanWidth);
bool hidden = isHidden();
if (!hidden && !clear) {
@ -4097,7 +4095,7 @@ int32 EmojiPan::showInlineRows(bool newResults) {
void EmojiPan::recountContentMaxHeight() {
if (_shownFromInlineQuery) {
_contentMaxHeight = qMin(s_inner.countHeight(true), int(st::emojiPanMaxHeight));
_contentMaxHeight = qMin(s_inner->countHeight(true), int(st::emojiPanMaxHeight));
} else {
_contentMaxHeight = st::emojiPanMaxHeight;
}

View File

@ -33,6 +33,7 @@ class Result;
} // namespace InlineBots
namespace Ui {
class ScrollArea;
class IconButton;
class LinkButton;
class RoundButton;
@ -123,7 +124,7 @@ class EmojiPanInner : public TWidget {
Q_OBJECT
public:
EmojiPanInner();
EmojiPanInner(QWidget *parent);
void setMaxHeight(int32 h);
void paintEvent(QPaintEvent *e) override;
@ -217,7 +218,7 @@ class StickerPanInner : public TWidget, private base::Subscriber {
Q_OBJECT
public:
StickerPanInner();
StickerPanInner(QWidget *parent);
void setMaxHeight(int32 h);
void paintEvent(QPaintEvent *e) override;
@ -681,14 +682,14 @@ private:
bool _emojiShown = true;
bool _shownFromInlineQuery = false;
ScrollArea e_scroll;
internal::EmojiPanInner e_inner;
ChildWidget<Ui::ScrollArea> e_scroll;
ChildWidget<internal::EmojiPanInner> e_inner;
QVector<internal::EmojiPanel*> e_panels;
internal::EmojiSwitchButton e_switch;
ScrollArea s_scroll;
internal::StickerPanInner s_inner;
ChildWidget<internal::EmojiSwitchButton> e_switch;
ChildWidget<Ui::ScrollArea> s_scroll;
ChildWidget<internal::StickerPanInner> s_inner;
QVector<internal::EmojiPanel*> s_panels;
internal::EmojiSwitchButton s_switch;
ChildWidget<internal::EmojiSwitchButton> s_switch;
uint64 _displayingSetId = 0;
uint64 _removingSetId = 0;

View File

@ -34,7 +34,7 @@ stickersTrendingHeader: 45px;
stickersTrendingSkip: 15px;
stickersTrendingHeaderFont: semiboldFont;
stickersTrendingHeaderFg: windowTextFg;
stickersTrendingHeaderFg: windowFg;
stickersTrendingHeaderTop: 0px;
stickersTrendingSubheaderFont: normalFont;
stickersTrendingSubheaderFg: #777777;
@ -68,7 +68,7 @@ stickersFeaturedInstalled: icon {{ "mediaview_save_check", lightButtonFg }};
stickersMaxHeight: 440px;
stickersPadding: margins(19px, 17px, 19px, 17px);
stickersSize: size(64px, 64px);
stickersScroll: flatScroll(boxScroll) {
stickersScroll: FlatScroll(boxScroll) {
round: 2px;
deltax: 7px;
deltat: 23px;
@ -86,7 +86,7 @@ stickersTrendingActive: icon {{ "emoji_trending", #58b2ed }};
stickersSettingsUnreadSize: 17px;
stickersSettingsUnreadPosition: point(4px, 5px);
emojiScroll: flatScroll(solidScroll) {
emojiScroll: FlatScroll(defaultSolidScroll) {
deltat: 48px;
}
emojiRecent: icon {{ "emoji_recent", #b3b3b3 }};

View File

@ -1678,18 +1678,20 @@ GameData::GameData(const GameId &id, const uint64 &accessHash, const QString &sh
, document(document) {
}
void PeerOpenClickHandler::onClickImpl() const {
if (App::main()) {
if (peer() && peer()->isChannel() && App::main()->historyPeer() != peer()) {
if (!peer()->asChannel()->isPublic() && !peer()->asChannel()->amIn()) {
Ui::showLayer(new InformBox(lang((peer()->isMegagroup()) ? lng_group_not_accessible : lng_channel_not_accessible)));
ClickHandlerPtr peerOpenClickHandler(PeerData *peer) {
return MakeShared<LambdaClickHandler>([peer] {
if (App::main()) {
if (peer && peer->isChannel() && App::main()->historyPeer() != peer) {
if (!peer->asChannel()->isPublic() && !peer->asChannel()->amIn()) {
Ui::showLayer(new InformBox(lang((peer->isMegagroup()) ? lng_group_not_accessible : lng_channel_not_accessible)));
} else {
Ui::showPeerHistory(peer, ShowAtUnreadMsgId, Ui::ShowWay::Forward);
}
} else {
Ui::showPeerHistory(peer(), ShowAtUnreadMsgId, Ui::ShowWay::Forward);
Ui::showPeerProfile(peer);
}
} else {
Ui::showPeerProfile(peer());
}
}
});
}
MsgId clientMsgId() {

View File

@ -215,25 +215,7 @@ inline const QString &emptyUsername() {
return empty;
}
class PeerClickHandler : public LeftButtonClickHandler {
public:
PeerClickHandler(PeerData *peer) : _peer(peer) {
}
PeerData *peer() const {
return _peer;
}
private:
PeerData *_peer;
};
class PeerOpenClickHandler : public PeerClickHandler {
public:
using PeerClickHandler::PeerClickHandler;
protected:
void onClickImpl() const override;
};
ClickHandlerPtr peerOpenClickHandler(PeerData *peer);
class UserData;
class ChatData;
@ -339,7 +321,7 @@ public:
const ClickHandlerPtr &openLink() {
if (!_openLink) {
_openLink.reset(new PeerOpenClickHandler(this));
_openLink = peerOpenClickHandler(this);
}
return _openLink;
}

View File

@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "lang.h"
#include "application.h"
#include "ui/scrollarea.h"
#include "ui/widgets/scroll_area.h"
#include "ui/widgets/multi_select.h"
#include "boxes/contactsbox.h"
#include "countries.h"
@ -126,7 +126,7 @@ void CountryInput::paintEvent(QPaintEvent *e) {
p.drawPixmap(_arrowRect.x(), _arrowRect.top(), _arrow);
p.setFont(_st.font);
p.setPen(st::windowTextFg);
p.setPen(st::windowFg);
p.drawText(rect().marginsRemoved(_st.textMrg), _text, QTextOption(_st.align));
}

View File

@ -20,7 +20,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include "ui/scrollarea.h"
#include "ui/effects/rect_shadow.h"
#include "boxes/abstractbox.h"
#include "styles/style_intro.h"

View File

@ -32,7 +32,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace {
const style::textStyle *_textStyle = nullptr;
const style::TextStyle *_textStyle = nullptr;
void initDefault() {
_textStyle = &st::defaultTextStyle;
@ -44,11 +44,11 @@ inline int32 countBlockHeight(const ITextBlock *b, const style::font &font) {
} // namespace
const style::textStyle *textstyleCurrent() {
const style::TextStyle *textstyleCurrent() {
return _textStyle;
}
void textstyleSet(const style::textStyle *style) {
void textstyleSet(const style::TextStyle *style) {
_textStyle = style ? style : &st::defaultTextStyle;
}

View File

@ -264,8 +264,8 @@ const QRegularExpression &reHashtag();
const QRegularExpression &reBotCommand();
// text style
const style::textStyle *textstyleCurrent();
void textstyleSet(const style::textStyle *style);
const style::TextStyle *textstyleCurrent();
void textstyleSet(const style::TextStyle *style);
inline void textstyleRestore() {
textstyleSet(nullptr);
}

View File

@ -305,7 +305,7 @@ TextBlock::TextBlock(const style::font &font, const QString &str, QFixed minResi
if (length) {
style::font blockFont = font;
if (!flags && lnkIndex) {
// should use textStyle lnkFlags somehow... not supported
// should use TextStyle lnkFlags somehow... not supported
}
if ((flags & TextBlockFPre) || (flags & TextBlockFCode)) {

View File

@ -132,7 +132,7 @@ void FlatButton::paintEvent(QPaintEvent *e) {
p.setRenderHint(QPainter::TextAntialiasing);
p.setPen(anim::pen(_st.color, _st.overColor, a_over.current()));
int32 top = (_state & StateOver) ? ((_state & StateDown) ? _st.downTextTop : _st.overTextTop) : _st.textTop;
auto top = (_state & StateDown) ? _st.downTextTop : ((_state & StateOver) ? _st.overTextTop : _st.textTop);
r.setTop(top);
p.drawText(r, _text, style::al_top);
@ -259,7 +259,7 @@ void RoundButton::paintEvent(QPaintEvent *e) {
auto over = (_state & StateOver);
auto down = (_state & StateDown);
if (over) {
if (over || down) {
App::roundRect(p, myrtlrect(rounded), _st.textBgOver, ImageRoundRadius::Small);
}
@ -360,6 +360,7 @@ void IconButton::paintEvent(QPaintEvent *e) {
}
}
auto down = (_state & StateDown);
auto over = _a_over.current(getms(), (_state & StateOver) ? 1. : 0.);
auto overIcon = [this] {
if (_iconOverrideOver) {
@ -377,7 +378,7 @@ void IconButton::paintEvent(QPaintEvent *e) {
}
return &_st.icon;
};
auto icon = (over == 1.) ? overIcon() : justIcon();
auto icon = (over == 1. || down) ? overIcon() : justIcon();
auto position = (_state & StateDown) ? _st.iconPositionDown : _st.iconPosition;
if (position.x() < 0) {
position.setX((width() - icon->width()) / 2);

View File

@ -22,7 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/widgets/inner_dropdown.h"
#include "mainwindow.h"
#include "ui/scrollarea.h"
#include "ui/widgets/scroll_area.h"
#include "ui/widgets/shadow.h"
#include "profile/profile_members_widget.h"
#include "ui/effects/panel_animation.h"

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