Almost all icons moved from sprite.

It is a broken build, some of sprite()s are in stickers.style file.
This commit is contained in:
John Preston 2016-10-28 00:19:38 +03:00
parent 29493a0693
commit f7374aa7b7
59 changed files with 316 additions and 314 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -1027,54 +1027,6 @@ btnUnblock: flatButton(btnSend) {
downColor: #db6352;
}
silentToggle: flatCheckbox {
textColor: black;
bgColor: white;
disColor: black;
width: 33px;
height: 46px;
duration: 200;
bgFunc: transition(easeOutCirc);
cursor: cursor(pointer);
font: normalFont;
imageRect: sprite(354px, 242px, 21px, 21px);
chkImageRect: sprite(354px, 221px, 21px, 21px);
overImageRect: sprite(375px, 242px, 21px, 21px);
chkOverImageRect: sprite(375px, 221px, 21px, 21px);
disImageRect: sprite(354px, 242px, 21px, 21px);
chkDisImageRect: sprite(354px, 221px, 21px, 21px);
imagePos: point(6px, 12px);
}
replySkip: 51px;
replyColor: #377aae;
replyHeight: 49px;
replyTop: 8px;
replyBottom: 6px;
replyIconPos: point(13px, 13px);
replyIcon: sprite(343px, 197px, 24px, 24px);
editIcon: sprite(371px, 286px, 24px, 24px);
replyCancel: iconedButton(btnDefIconed) {
icon: sprite(165px, 24px, 14px, 14px);
iconPos: point(17px, 17px);
downIcon: sprite(165px, 24px, 14px, 14px);
downIconPos: point(17px, 18px);
bgColor: white;
overBgColor: white;
width: 49px;
height: 49px;
}
inlineBotCancel: iconedButton(replyCancel) {
height: 46px;
iconPos: point(-1px, 16px); // < 0 means draw in the center of the button
downIconPos: point(-1px, 17px);
}
forwardIcon: sprite(368px, 197px, 24px, 24px);
historyScroll: flatScroll(scrollDef) {
barColor: #89a0b47a;
bgColor: #89a0b44c;
@ -1179,31 +1131,7 @@ contactsScroll: flatScroll(boxScroll) {
deltab: 0px;
}
btnAddContact: iconedButton(btnDefIconed) {
icon: sprite(188px, 93px, 18px, 18px);
iconPos: point(8px, 8px);
downIcon: sprite(188px, 93px, 18px, 18px);
downIconPos: point(8px, 9px);
bgColor: transparent;
overBgColor: transparent;
width: 36px;
height: 36px;
}
btnCancelSearch: iconedButton(btnAddContact) {
icon: sprite(188px, 43px, 18px, 18px);
downIcon: sprite(188px, 43px, 18px, 18px);
}
simpleClose: iconedButton(btnDefIconed) {
icon: sprite(167px, 130px, 10px, 10px);
iconPos: point(10px, 10px);
downIcon: sprite(167px, 130px, 10px, 10px);
downIconPos: point(10px, 11px);
width: 30px;
height: 30px;
}
simpleCloseIcon: icon {{ "simple_close", #000000 }};
boxPhotoPadding: margins(28px, 28px, 28px, 18px);
boxPhotoCompressedPadding: margins(0px, 2px, 0px, 22px);
@ -1243,7 +1171,7 @@ newGroupLinkFont: font(16px);
newGroupPhotoSize: 76px;
newGroupPhotoBg: #4eb5f0;
newGroupPhotoBgOver: #3fa9e7;
newGroupPhotoIcon: sprite(74px, 104px, 30px, 27px);
newGroupPhotoIcon: icon {{ "new_chat_photo", #ffffff }};
newGroupPhotoIconPosition: point(23px, 25px);
newGroupNamePosition: point(27px, 20px);
@ -1449,8 +1377,14 @@ usernameTextStyle: textStyle(defaultTextStyle) {
}
usernameDefaultFg: #777;
youtubeIcon: sprite(116px, 338px, 72px, 50px);
videoIcon: sprite(0px, 340px, 60px, 60px);
youtubeIcon: icon {
{ "media_youtube_play_bg", #e83131c8 },
{ "media_youtube_play", #ffffff, point(24px, 12px) },
};
videoIcon: icon {
{ "media_video_play_bg", #0000007f },
{ "media_video_play", #ffffff, point(12px, 12px) },
};
locationSize: size(320px, 240px);
boxOptionListPadding: margins(2px, 20px, 2px, 2px);
@ -1501,30 +1435,6 @@ mentionFgOver: #707070;
mentionFgActive: #0080c0;
mentionFgOverActive: #0077b3;
sessionsScroll: flatScroll(boxScroll) {
round: 2px;
deltax: 5px;
width: 14px;
}
sessionsHeight: 440px;
sessionHeight: 70px;
sessionCurrentPadding: margins(0px, 7px, 0px, 4px);
sessionCurrentHeight: 118px;
sessionPadding: margins(21px, 10px, 21px, 0px);
sessionNameFont: msgNameFont;
sessionActiveFont: msgDateFont;
sessionActiveColor: #aaa;
sessionInfoFont: msgFont;
sessionInfoColor: #888888;
sessionTerminateTop: 30px;
sessionTerminateSkip: 18px;
sessionTerminate: iconedButton(simpleClose) {
iconPos: point(3px, 3px);
downIconPos: point(3px, 4px);
width: 16px;
height: 16px;
}
webPageLeft: 10px;
webPageBar: 2px;
webPageTitleFont: semiboldFont;
@ -1575,3 +1485,6 @@ infoButton: PeerAvatarButton {
// forward declaration for single "title_previous" usage.
profileTopBarBackIconFg: #0290d7;
profileTopBarBackIcon: icon {{ "title_previous", profileTopBarBackIconFg }};
boxCancelIcon: icon {{ "box_cancel", #000000 }};
historyReplyCancelIcon: icon {{ "box_cancel", #adadad }};

View file

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 187 B

View file

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,011 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

View file

@ -388,7 +388,7 @@ void GroupInfoBox::paintEvent(QPaintEvent *e) {
} else {
p.fillRect(phRect, st::newGroupPhotoBg->b);
}
p.drawSprite(phRect.topLeft() + st::newGroupPhotoIconPosition, st::newGroupPhotoIcon);
st::newGroupPhotoIcon.paint(p, phRect.topLeft() + st::newGroupPhotoIconPosition, width());
} else {
p.drawPixmap(phRect.topLeft(), _photoSmall);
}

View file

@ -136,18 +136,16 @@ contactsMultiSelect: MultiSelect {
fieldIcon: fieldSearchIcon;
fieldIconSkip: 36px;
fieldCancel: IconButton {
fieldCancel: IconButton(defaultIconButton) {
width: 41px;
height: 48px;
opacity: 0.3;
overOpacity: 0.4;
icon: icon {{ "box_search_cancel", #000000 }};
icon: boxCancelIcon;
iconPosition: point(8px, 18px);
downIconPosition: point(8px, 19px);
duration: 150;
}
fieldCancelSkip: 34px;
}
@ -206,3 +204,29 @@ notificationSampleNameFg: #939393;
membersAboutPadding: margins(0px, 12px, 0px, 12px);
membersAboutFg: #777;
sessionsScroll: flatScroll(boxScroll) {
round: 2px;
deltax: 5px;
width: 14px;
}
sessionsHeight: 440px;
sessionHeight: 70px;
sessionCurrentPadding: margins(0px, 7px, 0px, 4px);
sessionCurrentHeight: 118px;
sessionPadding: margins(21px, 10px, 21px, 0px);
sessionNameFont: msgNameFont;
sessionActiveFont: msgDateFont;
sessionActiveColor: #aaa;
sessionInfoFont: msgFont;
sessionInfoColor: #888888;
sessionTerminateTop: 30px;
sessionTerminateSkip: 18px;
sessionTerminate: IconButton(defaultIconButton) {
width: 16px;
height: 16px;
icon: simpleCloseIcon;
iconPosition: point(3px, 3px);
downIconPosition: point(3px, 4px);
}

View file

@ -23,6 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "lang.h"
#include "ui/buttons/round_button.h"
#include "ui/buttons/icon_button.h"
#include "ui/widgets/discrete_slider.h"
#include "styles/style_boxes.h"
#include "styles/style_dialogs.h"
@ -289,7 +290,7 @@ void NotificationsBox::prepareNotificationSampleLarge() {
p.drawText(rectForName.left(), rectForName.top() + st::msgNameFont->ascent, notifyTitle);
p.setOpacity(st::notifyClose.opacity);
p.drawSpriteLeft(w - st::notifyClosePos.x() - st::notifyClose.width + st::notifyClose.iconPos.x(), st::notifyClosePos.y() + st::notifyClose.iconPos.y(), w, st::notifyClose.icon);
st::notifyClose.icon.paint(p, w - st::notifyClosePos.x() - st::notifyClose.width + st::notifyClose.iconPosition.x(), st::notifyClosePos.y() + st::notifyClose.iconPosition.y(), w);
}
_notificationSampleLarge = App::pixmapFromImageInPlace(std_::move(sampleImage));

View file

@ -19,16 +19,16 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
#include "boxes/sessionsbox.h"
#include "lang.h"
#include "localstorage.h"
#include "sessionsbox.h"
#include "mainwidget.h"
#include "mainwindow.h"
#include "countries.h"
#include "confirmbox.h"
#include "boxes/confirmbox.h"
#include "ui/buttons/icon_button.h"
#include "styles/style_boxes.h"
SessionsBox::SessionsBox() : ScrollableBox(st::sessionsScroll)
, _loading(true)
@ -90,7 +90,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
_shortPollRequest = 0;
int32 availCurrent = st::boxWideWidth - st::sessionPadding.left() - st::sessionTerminateSkip;
int32 availOther = availCurrent - st::sessionTerminate.iconPos.x();// -st::sessionTerminate.width - st::sessionTerminateSkip;
int32 availOther = availCurrent - st::sessionTerminate.iconPosition.x();// -st::sessionTerminate.width - st::sessionTerminateSkip;
_list.clear();
const auto &v(result.c_account_authorizations().vauthorizations.c_vector().v);
@ -258,7 +258,7 @@ void SessionsBox::Inner::paintEvent(QPaintEvent *e) {
Painter p(this);
p.fillRect(r, st::white->b);
int32 x = st::sessionPadding.left(), xact = st::sessionTerminateSkip + st::sessionTerminate.iconPos.x();// st::sessionTerminateSkip + st::sessionTerminate.width + st::sessionTerminateSkip;
int32 x = st::sessionPadding.left(), xact = st::sessionTerminateSkip + st::sessionTerminate.iconPosition.x();// st::sessionTerminateSkip + st::sessionTerminate.width + st::sessionTerminateSkip;
int32 w = width();
if (_current->active.isEmpty() && _list->isEmpty()) {
@ -414,7 +414,7 @@ void SessionsBox::Inner::listUpdated() {
for (int32 i = 0, l = _list->size(); i < l; ++i) {
TerminateButtons::iterator j = _terminateButtons.find(_list->at(i).hash);
if (j == _terminateButtons.cend()) {
j = _terminateButtons.insert(_list->at(i).hash, new IconedButton(this, st::sessionTerminate));
j = _terminateButtons.insert(_list->at(i).hash, new Ui::IconButton(this, st::sessionTerminate));
connect(j.value(), SIGNAL(clicked()), this, SLOT(onTerminate()));
}
j.value()->moveToRight(st::sessionTerminateSkip, st::sessionCurrentHeight + i * st::sessionHeight + st::sessionTerminateTop, width());

View file

@ -25,6 +25,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
class ConfirmBox;
namespace Ui {
class IconButton;
} // namespace Ui
class SessionsBox : public ScrollableBox, public RPCSender {
Q_OBJECT
@ -106,7 +110,7 @@ private:
SessionsBox::List *_list;
SessionsBox::Data *_current;
typedef QMap<uint64, IconedButton*> TerminateButtons;
typedef QMap<uint64, Ui::IconButton*> TerminateButtons;
TerminateButtons _terminateButtons;
uint64 _terminating;

View file

@ -29,6 +29,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "apiwrap.h"
#include "localstorage.h"
#include "dialogs/dialogs_layout.h"
#include "styles/style_boxes.h"
#include "styles/style_stickers.h"
namespace {

View file

@ -21,6 +21,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
using "basic.style";
using "basic_types.style";
using "ui/widgets/widgets.style";
dialogsUnreadFg: #ffffff;
dialogsUnreadFgActive: #5b94bf;
dialogsUnreadBg: windowActiveBg;
@ -81,21 +83,21 @@ dialogsTextStyleDraftActive: textStyle(dialogsTextStyle) {
linkFgDown: #c6e1f7;
}
dialogsNewChatIcon: icon {{ "dialogs_new_chat", #b7b7b7, point(9px, 10px) }};
dialogsNewChatButton: RoundButton {
dialogsNewChatButton: IconButton(defaultIconButton) {
width: 36px;
height: 36px;
icon: dialogsNewChatIcon;
textTop: 5px;
downTextTop: 6px;
textFg: transparent;
textFgOver: transparent;
secondaryTextFg: transparent;
secondaryTextFgOver: transparent;
textBg: transparent;
textBgOver: transparent;
icon: icon {{ "dialogs_new_chat", #b7b7b7 }};
iconPosition: point(9px, 10px);
downIconPosition: point(9px, 11px);
}
dialogsAddContact: IconButton(dialogsNewChatButton) {
icon: icon {{ "dialogs_add_contact", #a6a6a6 }};
iconPosition: point(8px, 8px);
downIconPosition: point(8px, 9px);
}
dialogsCancelSearch: IconButton(dialogsAddContact) {
icon: icon {{ "dialogs_cancel_search", #a6a6a6 }};
}
dialogsChatTypeSkip: 22px;

View file

@ -24,7 +24,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "dialogs/dialogs_indexed_list.h"
#include "dialogs/dialogs_layout.h"
#include "styles/style_dialogs.h"
#include "ui/buttons/round_button.h"
#include "styles/style_stickers.h"
#include "ui/buttons/icon_button.h"
#include "ui/widgets/popup_menu.h"
#include "data/data_drafts.h"
#include "lang.h"
@ -43,7 +44,7 @@ DialogsInner::DialogsInner(QWidget *parent, MainWidget *main) : SplittedWidget(p
, contactsNoDialogs(std_::make_unique<Dialogs::IndexedList>(Dialogs::SortMode::Name))
, contacts(std_::make_unique<Dialogs::IndexedList>(Dialogs::SortMode::Name))
, _addContactLnk(this, lang(lng_add_contact_button))
, _cancelSearchInPeer(this, st::btnCancelSearch) {
, _cancelSearchInPeer(this, st::dialogsCancelSearch) {
if (Global::DialogsModeEnabled()) {
importantDialogs = std_::make_unique<Dialogs::IndexedList>(Dialogs::SortMode::Date);
}
@ -51,8 +52,8 @@ DialogsInner::DialogsInner(QWidget *parent, MainWidget *main) : SplittedWidget(p
connect(main, SIGNAL(peerPhotoChanged(PeerData*)), this, SLOT(onPeerPhotoChanged(PeerData*)));
connect(main, SIGNAL(dialogRowReplaced(Dialogs::Row*,Dialogs::Row*)), this, SLOT(onDialogRowReplaced(Dialogs::Row*,Dialogs::Row*)));
connect(&_addContactLnk, SIGNAL(clicked()), App::wnd(), SLOT(onShowAddContact()));
connect(&_cancelSearchInPeer, SIGNAL(clicked()), this, SIGNAL(cancelSearchInPeer()));
_cancelSearchInPeer.hide();
connect(_cancelSearchInPeer, SIGNAL(clicked()), this, SIGNAL(cancelSearchInPeer()));
_cancelSearchInPeer->hide();
subscribe(FileDownload::ImageLoaded(), [this] { update(); });
subscribe(Global::RefItemRemoved(), [this](HistoryItem *item) {
@ -126,8 +127,8 @@ void DialogsInner::paintRegion(Painter &p, const QRegion &region, bool paintingO
p.fillRect(0, 0, w, st::mentionHeight, (selected ? st::mentionBgOver : st::white)->b);
if (!paintingOther) {
if (selected) {
int skip = (st::mentionHeight - st::simpleClose.icon.pxHeight()) / 2;
p.drawSprite(QPoint(w - st::simpleClose.icon.pxWidth() - skip, skip), st::simpleClose.icon);
int skip = (st::mentionHeight - st::simpleCloseIcon.height()) / 2;
st::simpleCloseIcon.paint(p, QPoint(w - st::simpleCloseIcon.width() - skip, skip), width());
}
QString first = (_hashtagFilter.size() < 2) ? QString() : ('#' + _hashtagResults.at(from).mid(0, _hashtagFilter.size() - 1)), second = (_hashtagFilter.size() < 2) ? ('#' + _hashtagResults.at(from)) : _hashtagResults.at(from).mid(_hashtagFilter.size() - 1);
int32 firstwidth = st::mentionFont->width(first), secondwidth = st::mentionFont->width(second);
@ -299,7 +300,7 @@ void DialogsInner::searchInPeerPaint(Painter &p, int32 w, bool onlyBackground) c
_searchInPeer->paintUserpicLeft(p, st::dialogsPhotoSize, st::dialogsPadding.x(), st::dialogsPadding.y(), fullWidth());
int32 nameleft = st::dialogsPadding.x() + st::dialogsPhotoSize + st::dialogsPhotoPadding;
int32 namewidth = w - nameleft - st::dialogsPadding.x() * 2 - st::btnCancelSearch.width;
int32 namewidth = w - nameleft - st::dialogsPadding.x() * 2 - st::dialogsCancelSearch.width;
QRect rectForName(nameleft, st::dialogsPadding.y() + st::dialogsNameTop, namewidth, st::msgNameFont->height);
if (auto chatTypeIcon = Dialogs::Layout::ChatTypeIcon(_searchInPeer, false)) {
@ -408,7 +409,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::btnCancelSearch.width, (st::dialogsRowHeight - st::btnCancelSearch.height) / 2);
_cancelSearchInPeer->move(width() - st::dialogsPadding.x() - st::dialogsCancelSearch.width, (st::dialogsRowHeight - st::dialogsCancelSearch.height) / 2);
}
void DialogsInner::onDialogRowReplaced(Dialogs::Row *oldRow, Dialogs::Row *newRow) {
@ -1260,9 +1261,9 @@ void DialogsInner::searchInPeer(PeerData *peer) {
_searchInMigrated = _searchInPeer ? _searchInPeer->migrateFrom() : 0;
if (_searchInPeer) {
onHashtagFilterUpdate(QStringRef());
_cancelSearchInPeer.show();
_cancelSearchInPeer->show();
} else {
_cancelSearchInPeer.hide();
_cancelSearchInPeer->hide();
}
}
@ -1780,9 +1781,9 @@ DialogsWidget::DialogsWidget(MainWidget *parent) : TWidget(parent)
, _dialogsRequest(0)
, _contactsRequest(0)
, _filter(this, st::dlgFilter, lang(lng_dlg_filter))
, _newGroup(this, QString(), st::dialogsNewChatButton)
, _addContact(this, st::btnAddContact)
, _cancelSearch(this, st::btnCancelSearch)
, _newGroup(this, st::dialogsNewChatButton)
, _addContact(this, st::dialogsAddContact)
, _cancelSearch(this, st::dialogsCancelSearch)
, _scroll(this, st::dialogsScroll)
, _inner(&_scroll, parent)
, _a_show(animation(this, &DialogsWidget::step_show))
@ -1807,9 +1808,9 @@ DialogsWidget::DialogsWidget(MainWidget *parent) : TWidget(parent)
connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
connect(&_filter, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(onFilterCursorMoved(int,int)));
connect(parent, SIGNAL(dialogsUpdated()), this, SLOT(onListScroll()));
connect(&_addContact, SIGNAL(clicked()), this, SLOT(onAddContact()));
connect(_addContact, SIGNAL(clicked()), this, SLOT(onAddContact()));
connect(_newGroup, SIGNAL(clicked()), this, SLOT(onNewGroup()));
connect(&_cancelSearch, SIGNAL(clicked()), this, SLOT(onCancelSearch()));
connect(_cancelSearch, SIGNAL(clicked()), this, SLOT(onCancelSearch()));
_chooseByDragTimer.setSingleShot(true);
connect(&_chooseByDragTimer, SIGNAL(timeout()), this, SLOT(onChooseByDrag()));
@ -1824,12 +1825,12 @@ DialogsWidget::DialogsWidget(MainWidget *parent) : TWidget(parent)
_filter.move(st::dialogsPadding.x(), st::dialogsFilterPadding);
_filter.setFocusPolicy(Qt::StrongFocus);
_filter.customUpDown(true);
_addContact.hide();
_addContact->hide();
_newGroup->show();
_cancelSearch.hide();
_cancelSearch->hide();
_newGroup->move(width() - _newGroup->width() - st::dialogsPadding.x(), 0);
_addContact.move(width() - _addContact.width() - st::dialogsPadding.x(), 0);
_cancelSearch.move(width() - _cancelSearch.width() - st::dialogsPadding.x(), 0);
_addContact->move(width() - _addContact->width() - st::dialogsPadding.x(), 0);
_cancelSearch->move(width() - _cancelSearch->width() - st::dialogsPadding.x(), 0);
}
void DialogsWidget::activate() {
@ -1874,7 +1875,7 @@ void DialogsWidget::showAnimated(Window::SlideDirection direction, const Window:
_scroll.hide();
_filter.hide();
_cancelSearch.hide();
_cancelSearch->hide();
_newGroup->hide();
int delta = st::slideShift;
@ -2377,10 +2378,10 @@ void DialogsWidget::onFilterUpdate(bool force) {
_searchCache.clear();
_searchQueries.clear();
_searchQuery = QString();
_cancelSearch.hide();
_cancelSearch->hide();
_newGroup->show();
} else if (_cancelSearch.isHidden()) {
_cancelSearch.show();
} else if (_cancelSearch->isHidden()) {
_cancelSearch->show();
_newGroup->hide();
}
if (filterText.size() < MinUsernameLength) {
@ -2445,8 +2446,8 @@ void DialogsWidget::resizeEvent(QResizeEvent *e) {
int32 w = width();
_filter.setGeometry(st::dialogsPadding.x(), st::dialogsFilterPadding, w - 2 * st::dialogsPadding.x(), _filter.height());
_newGroup->move(w - _newGroup->width() - st::dialogsPadding.x(), _filter.y());
_addContact.move(w - _addContact.width() - st::dialogsPadding.x(), _filter.y());
_cancelSearch.move(w - _cancelSearch.width() - st::dialogsPadding.x(), _filter.y());
_addContact->move(w - _addContact->width() - st::dialogsPadding.x(), _filter.y());
_cancelSearch->move(w - _cancelSearch->width() - st::dialogsPadding.x(), _filter.y());
_scroll.move(0, _filter.height() + 2 * st::dialogsFilterPadding);
int32 addToY = App::main() ? App::main()->contentScrollAddToY() : 0;

View file

@ -29,7 +29,7 @@ class IndexedList;
} // namespace Dialogs
namespace Ui {
class RoundButton;
class IconButton;
class PopupMenu;
} // namespace Ui
@ -221,7 +221,7 @@ private:
void paintDialog(QPainter &p, Dialogs::Row *dialog);
LinkButton _addContactLnk;
IconedButton _cancelSearchInPeer;
ChildWidget<Ui::IconButton> _cancelSearchInPeer;
bool _overDelete = false;
@ -336,8 +336,9 @@ private:
mtpRequestId _dialogsRequest, _contactsRequest;
FlatInput _filter;
ChildWidget<Ui::RoundButton> _newGroup;
IconedButton _addContact, _cancelSearch;
ChildWidget<Ui::IconButton> _newGroup;
ChildWidget<Ui::IconButton> _addContact;
ChildWidget<Ui::IconButton> _cancelSearch;
ScrollArea _scroll;
DialogsInner _inner;

View file

@ -605,9 +605,9 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
bool selected = (i == _sel);
if (selected) {
p.fillRect(0, i * st::mentionHeight, width(), st::mentionHeight, st::mentionBgOver->b);
int skip = (st::mentionHeight - st::simpleClose.icon.pxHeight()) / 2;
int skip = (st::mentionHeight - st::simpleCloseIcon.height()) / 2;
if (!_hrows->isEmpty() || (!_mrows->isEmpty() && i < _recentInlineBotsInRows)) {
p.drawSprite(QPoint(width() - st::simpleClose.icon.pxWidth() - skip, i * st::mentionHeight + skip), st::simpleClose.icon);
st::simpleCloseIcon.paint(p, QPoint(width() - st::simpleCloseIcon.width() - skip, i * st::mentionHeight + skip), width());
}
}
p.setPen(st::black->p);

View file

@ -147,18 +147,13 @@ historyMediaTypeSong: icon {{ "media_type_song", #bebebe, point(0px, 0px) }};
historyMediaTypeVoice: icon {{ "media_type_voice", #bebebe, point(2px, 2px) }};
historyMediaTypeLink: icon {{ "media_type_link", #bebebe, point(2px, 2px) }};
historyAttachDocument: IconButton {
historyAttachDocument: IconButton(defaultIconButton) {
width: 46px;
height: 46px;
opacity: 0.78;
overOpacity: 1.;
icon: historyMediaTypeFile;
iconPosition: point(9px, 9px);
downIconPosition: point(9px, 10px);
duration: 150;
}
historyAttachPhoto: IconButton(historyAttachDocument) {
icon: historyMediaTypePhoto;
@ -211,7 +206,35 @@ historyAttachDropdownMenu: DropdownMenu(defaultDropdownMenu) {
}
}
topBarSearch: IconButton {
historySilentToggle: IconButton(historyBotKeyboardShow) {
icon: icon {{ "send_control_silent_off", #b3b3b3 }};
}
historySilentToggleOn: icon {{ "send_control_silent_on", #b3b3b3 }};
historyReplySkip: 51px;
historyReplyColor: #377aae;
historyReplyHeight: 49px;
historyReplyTop: 8px;
historyReplyBottom: 6px;
historyReplyIconPosition: point(13px, 13px);
historyReplyIcon: icon {{ "history_action_reply", #6fa1d2 }};
historyForwardIcon: icon {{ "history_action_forward", #6fa1d2 }};
historyEditIcon: icon {{ "history_action_edit", #6fa1d2 }};
historyReplyCancel: IconButton(defaultIconButton) {
width: 49px;
height: 49px;
icon: historyReplyCancelIcon;
iconPosition: point(17px, 17px);
downIconPosition: point(17px, 18px);
}
historyInlineBotCancel: IconButton(historyReplyCancel) {
height: 46px;
iconPosition: point(-1px, 16px); // < 0 means draw in the center of the button
downIconPosition: point(-1px, 17px);
}
topBarSearch: IconButton(defaultIconButton) {
width: 44px;
height: topBarHeight;
@ -221,6 +244,4 @@ topBarSearch: IconButton {
opacity: 0.22;
overOpacity: 0.36;
duration: 150;
}

View file

@ -2733,9 +2733,9 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, u
if (_data->type == WebPageVideo && _attach->type() == MediaTypePhoto) {
if (_attach->isReadyForOpen()) {
if (_data->siteName == qstr("YouTube")) {
p.drawSprite(QPoint((pixwidth - st::youtubeIcon.pxWidth()) / 2, (pixheight - st::youtubeIcon.pxHeight()) / 2), st::youtubeIcon);
st::youtubeIcon.paint(p, (pixwidth - st::youtubeIcon.width()) / 2, (pixheight - st::youtubeIcon.height()) / 2, _width);
} else {
p.drawSprite(QPoint((pixwidth - st::videoIcon.pxWidth()) / 2, (pixheight - st::videoIcon.pxHeight()) / 2), st::videoIcon);
st::videoIcon.paint(p, (pixwidth - st::videoIcon.width()) / 2, (pixheight - st::videoIcon.height()) / 2, _width);
}
}
if (_durationWidth) {

View file

@ -2913,12 +2913,12 @@ HistoryHider::~HistoryHider() {
parent()->noHider(this);
}
SilentToggle::SilentToggle(QWidget *parent) : FlatCheckbox(parent, QString(), false, st::silentToggle) {
SilentToggle::SilentToggle(QWidget *parent) : IconButton(parent, st::historySilentToggle) {
setMouseTracking(true);
}
void SilentToggle::mouseMoveEvent(QMouseEvent *e) {
FlatCheckbox::mouseMoveEvent(e);
IconButton::mouseMoveEvent(e);
if (rect().contains(e->pos())) {
Ui::Tooltip::Show(1000, this);
} else {
@ -2926,21 +2926,29 @@ void SilentToggle::mouseMoveEvent(QMouseEvent *e) {
}
}
void SilentToggle::setChecked(bool checked) {
if (_checked != checked) {
_checked = checked;
setIcon(_checked ? &st::historySilentToggleOn : nullptr);
}
}
void SilentToggle::leaveEvent(QEvent *e) {
Ui::Tooltip::Hide();
}
void SilentToggle::mouseReleaseEvent(QMouseEvent *e) {
FlatCheckbox::mouseReleaseEvent(e);
setChecked(!_checked);
IconButton::mouseReleaseEvent(e);
Ui::Tooltip::Show(0, this);
PeerData *p = App::main() ? App::main()->peer() : nullptr;
auto p = App::main() ? App::main()->peer() : nullptr;
if (p && p->isChannel() && p->notify != UnknownNotifySettings) {
App::main()->updateNotifySetting(p, NotifySettingDontChange, checked() ? SilentNotifiesSetSilent : SilentNotifiesSetNotify);
App::main()->updateNotifySetting(p, NotifySettingDontChange, _checked ? SilentNotifiesSetSilent : SilentNotifiesSetNotify);
}
}
QString SilentToggle::tooltipText() const {
return lang(checked() ? lng_wont_be_notified : lng_will_be_notified);
return lang(_checked ? lng_wont_be_notified : lng_will_be_notified);
}
QPoint SilentToggle::tooltipPos() const {
@ -2984,7 +2992,7 @@ TextWithTags::Tags textTagsFromEntities(const EntitiesInText &entities) {
}
HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
, _fieldBarCancel(this, st::replyCancel)
, _fieldBarCancel(this, st::historyReplyCancel)
, _scroll(this, st::historyScroll, false)
, _historyToEnd(this)
, _fieldAutocomplete(this)
@ -3024,13 +3032,13 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
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(_fieldBarCancel, SIGNAL(clicked()), this, SLOT(onFieldBarCancel()));
connect(&_send, SIGNAL(clicked()), this, SLOT(onSend()));
connect(&_unblock, SIGNAL(clicked()), this, SLOT(onUnblock()));
connect(&_botStart, SIGNAL(clicked()), this, SLOT(onBotStart()));
connect(&_joinChannel, SIGNAL(clicked()), this, SLOT(onJoinChannel()));
connect(&_muteUnmute, SIGNAL(clicked()), this, SLOT(onMuteUnmute()));
connect(&_silent, SIGNAL(clicked()), this, SLOT(onBroadcastSilentChange()));
connect(_silent, SIGNAL(clicked()), this, SLOT(onBroadcastSilentChange()));
connect(_attachDocument, SIGNAL(clicked()), this, SLOT(onDocumentSelect()));
connect(_attachPhoto, SIGNAL(clicked()), this, SLOT(onPhotoSelect()));
connect(&_field, SIGNAL(submitted(bool)), this, SLOT(onSend(bool)));
@ -3077,7 +3085,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
connect(&_field, SIGNAL(cursorPositionChanged()), this, SLOT(onDraftSaveDelayed()));
connect(&_field, SIGNAL(cursorPositionChanged()), this, SLOT(onCheckFieldAutocomplete()), Qt::QueuedConnection);
_fieldBarCancel.hide();
_fieldBarCancel->hide();
_scroll.hide();
@ -3115,7 +3123,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
_attachEmoji->hide();
_botKeyboardShow->hide();
_botKeyboardHide->hide();
_silent.hide();
_silent->hide();
_botCommandStart->hide();
_attachDocument->installEventFilter(_attachType);
@ -3489,7 +3497,7 @@ void HistoryWidget::onRecordDone(QByteArray result, VoiceWaveform waveform, qint
App::wnd()->activateWindow();
int32 duration = samples / AudioVoiceMsgFrequency;
_fileLoader.addTask(new FileLoadTask(result, duration, waveform, FileLoadTo(_peer->id, _silent.checked(), replyToId())));
_fileLoader.addTask(new FileLoadTask(result, duration, waveform, FileLoadTo(_peer->id, _silent->checked(), replyToId())));
cancelReplyAfterMediaSend(lastForceReplyReplied());
}
@ -4203,7 +4211,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
_editMsgId = _replyToId = 0;
_previewData = 0;
_previewCache.clear();
_fieldBarCancel.hide();
_fieldBarCancel->hide();
_membersDropdownShowTimer.stop();
if (_list) _list->deleteLater();
@ -4363,8 +4371,8 @@ void HistoryWidget::updateNotifySettings() {
_muteUnmute.setText(lang(_history->mute() ? lng_channel_unmute : lng_channel_mute));
if (_peer->notify != UnknownNotifySettings) {
_silent.setChecked(_peer->notify != EmptyNotifySettings && (_peer->notify->flags & MTPDpeerNotifySettings::Flag::f_silent));
if (_silent.isHidden() && hasSilentToggle()) {
_silent->setChecked(_peer->notify != EmptyNotifySettings && (_peer->notify->flags & MTPDpeerNotifySettings::Flag::f_silent));
if (_silent->isHidden() && hasSilentToggle()) {
updateControlsVisibility();
}
}
@ -4499,11 +4507,11 @@ void HistoryWidget::updateControlsVisibility() {
_muteUnmute.hide();
_fieldAutocomplete->hide();
_field.hide();
_fieldBarCancel.hide();
_fieldBarCancel->hide();
_attachDocument->hide();
_attachPhoto->hide();
_attachEmoji->hide();
_silent.hide();
_silent->hide();
_historyToEnd->hide();
_botKeyboardShow->hide();
_botKeyboardHide->hide();
@ -4561,9 +4569,9 @@ void HistoryWidget::updateControlsVisibility() {
_botStart.hide();
_attachDocument->hide();
_attachPhoto->hide();
_silent.hide();
_silent->hide();
_kbScroll.hide();
_fieldBarCancel.hide();
_fieldBarCancel->hide();
_attachDocument->hide();
_attachPhoto->hide();
_attachEmoji->hide();
@ -4597,9 +4605,9 @@ void HistoryWidget::updateControlsVisibility() {
_botCommandStart->hide();
_attachDocument->hide();
_attachPhoto->hide();
_silent.hide();
_silent->hide();
_kbScroll.hide();
_fieldBarCancel.hide();
_fieldBarCancel->hide();
} else {
_unblock.hide();
_botStart.hide();
@ -4627,7 +4635,7 @@ void HistoryWidget::updateControlsVisibility() {
_botCommandStart->hide();
_attachDocument->hide();
_attachPhoto->hide();
_silent.hide();
_silent->hide();
if (_kbShown) {
_kbScroll.show();
} else {
@ -4671,20 +4679,20 @@ void HistoryWidget::updateControlsVisibility() {
_attachPhoto->hide();
}
if (hasSilentToggle()) {
_silent.show();
_silent->show();
} else {
_silent.hide();
_silent->hide();
}
updateFieldPlaceholder();
}
if (_editMsgId || _replyToId || readyToForward() || (_previewData && _previewData->pendingTill >= 0) || _kbReplyTo) {
if (_fieldBarCancel.isHidden()) {
_fieldBarCancel.show();
if (_fieldBarCancel->isHidden()) {
_fieldBarCancel->show();
resizeEvent(0);
update();
}
} else {
_fieldBarCancel.hide();
_fieldBarCancel->hide();
}
}
} else {
@ -4697,9 +4705,9 @@ void HistoryWidget::updateControlsVisibility() {
_muteUnmute.hide();
_attachDocument->hide();
_attachPhoto->hide();
_silent.hide();
_silent->hide();
_kbScroll.hide();
_fieldBarCancel.hide();
_fieldBarCancel->hide();
_attachDocument->hide();
_attachPhoto->hide();
_attachEmoji->hide();
@ -4719,7 +4727,7 @@ void HistoryWidget::updateControlsVisibility() {
}
void HistoryWidget::updateMouseTracking() {
bool trackMouse = !_fieldBarCancel.isHidden() || _pinnedBar || (cHasAudioCapture() && _send.isHidden() && !_field.isHidden());
bool trackMouse = !_fieldBarCancel->isHidden() || _pinnedBar || (cHasAudioCapture() && _send.isHidden() && !_field.isHidden());
setMouseTracking(trackMouse);
}
@ -5244,7 +5252,7 @@ void HistoryWidget::onSend(bool ctrlShiftEnter, MsgId replyTo) {
message.history = _history;
message.textWithTags = _field.getTextWithTags();
message.replyTo = replyTo;
message.silent = _silent.checked();
message.silent = _silent->checked();
message.webPageId = webPageId;
App::main()->sendMessage(message);
@ -5388,7 +5396,7 @@ void HistoryWidget::shareContact(const PeerId &peer, const QString &phone, const
bool channelPost = p->isChannel() && !p->isMegagroup();
bool showFromName = !channelPost || p->asChannel()->addsSignature();
bool silentPost = channelPost && _silent.checked();
bool silentPost = channelPost && _silent->checked();
if (channelPost) {
flags |= MTPDmessage::Flag::f_views;
flags |= MTPDmessage::Flag::f_post;
@ -5404,7 +5412,7 @@ void HistoryWidget::shareContact(const PeerId &peer, const QString &phone, const
App::historyRegRandom(randomId, newId);
App::main()->finishForwarding(history, _silent.checked());
App::main()->finishForwarding(history, _silent->checked());
cancelReplyAfterMediaSend(lastKeyboardUsed);
}
@ -5459,12 +5467,12 @@ void HistoryWidget::showAnimated(Window::SlideDirection direction, const Window:
_attachPhoto->hide();
_attachEmoji->hide();
_fieldAutocomplete->hide();
_silent.hide();
_silent->hide();
_botKeyboardShow->hide();
_botKeyboardHide->hide();
_botCommandStart->hide();
_field.hide();
_fieldBarCancel.hide();
_fieldBarCancel->hide();
_send.hide();
if (_inlineBotCancel) _inlineBotCancel->hide();
_unblock.hide();
@ -5664,8 +5672,8 @@ 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 inReplyEdit = QRect(st::replySkip, _field.y() - st::sendPadding - st::replyHeight, width() - st::replySkip - _fieldBarCancel.width(), st::replyHeight).contains(pos) && (_editMsgId || replyToId());
bool inPinnedMsg = QRect(0, 0, width(), st::replyHeight).contains(pos) && _pinnedBar;
bool inReplyEdit = QRect(st::historyReplySkip, _field.y() - st::sendPadding - st::historyReplyHeight, width() - st::historyReplySkip - _fieldBarCancel->width(), st::historyReplyHeight).contains(pos) && (_editMsgId || replyToId());
bool inPinnedMsg = QRect(0, 0, width(), st::historyReplyHeight).contains(pos) && _pinnedBar;
bool startAnim = false;
if (inRecord != _inRecord) {
_inRecord = inRecord;
@ -5699,7 +5707,7 @@ void HistoryWidget::leaveToChildEvent(QEvent *e, QWidget *child) { // e -- from
void HistoryWidget::mouseReleaseEvent(QMouseEvent *e) {
if (_replyForwardPressed) {
_replyForwardPressed = false;
update(0, _field.y() - st::sendPadding - st::replyHeight, width(), st::replyHeight);
update(0, _field.y() - st::sendPadding - st::historyReplyHeight, width(), st::historyReplyHeight);
}
if (_attachDrag != DragStateNone || !_attachDragPhoto->isHidden() || !_attachDragDocument->isHidden()) {
_attachDrag = DragStateNone;
@ -6150,7 +6158,7 @@ void HistoryWidget::onKbToggle(bool manual) {
_kbReplyTo = 0;
if (!readyToForward() && (!_previewData || _previewData->pendingTill < 0) && !_editMsgId && !_replyToId) {
_fieldBarCancel.hide();
_fieldBarCancel->hide();
updateMouseTracking();
}
} else {
@ -6175,7 +6183,7 @@ void HistoryWidget::onKbToggle(bool manual) {
if (_kbReplyTo && !_editMsgId && !_replyToId && fieldEnabled) {
updateReplyToName();
_replyEditMsgText.setText(st::msgFont, textClean(_kbReplyTo->inReplyText()), _textDlgOptions);
_fieldBarCancel.show();
_fieldBarCancel->show();
updateMouseTracking();
}
if (manual && _history) {
@ -6194,7 +6202,7 @@ void HistoryWidget::onKbToggle(bool manual) {
if (_kbReplyTo && !_editMsgId && !_replyToId) {
updateReplyToName();
_replyEditMsgText.setText(st::msgFont, textClean(_kbReplyTo->inReplyText()), _textDlgOptions);
_fieldBarCancel.show();
_fieldBarCancel->show();
updateMouseTracking();
}
if (manual && _history) {
@ -6455,10 +6463,10 @@ void HistoryWidget::moveFieldControls() {
right -= _attachEmoji->width();
_botKeyboardShow->move(right - _botKeyboardShow->width(), buttonsBottom);
_botCommandStart->move(right - _botCommandStart->width(), buttonsBottom);
_silent.move(right - _silent.width(), buttonsBottom);
_silent->move(right - _silent->width(), buttonsBottom);
right = w;
_fieldBarCancel.move(right - _fieldBarCancel.width(), _field.y() - st::sendPadding - _fieldBarCancel.height());
_fieldBarCancel->move(right - _fieldBarCancel->width(), _field.y() - st::sendPadding - _fieldBarCancel->height());
_attachType->move(0, _attachDocument->y() - _attachType->height());
_emojiPan->moveBottom(_attachEmoji->y());
@ -6475,7 +6483,7 @@ void HistoryWidget::updateFieldSize() {
fieldWidth -= _attachEmoji->width();
if (kbShowShown) fieldWidth -= _botKeyboardShow->width();
if (_cmdStartShown) fieldWidth -= _botCommandStart->width();
if (hasSilentToggle()) fieldWidth -= _silent.width();
if (hasSilentToggle()) fieldWidth -= _silent->width();
if (_field.width() != fieldWidth) {
_field.resize(fieldWidth, _field.height());
@ -6497,7 +6505,7 @@ void HistoryWidget::clearInlineBot() {
void HistoryWidget::inlineBotChanged() {
bool isInlineBot = _inlineBot && (_inlineBot != LookingUpInlineBot);
if (isInlineBot && !_inlineBotCancel) {
_inlineBotCancel = std_::make_unique<IconedButton>(this, st::inlineBotCancel);
_inlineBotCancel = std_::make_unique<Ui::IconButton>(this, st::historyInlineBotCancel);
connect(_inlineBotCancel.get(), SIGNAL(clicked()), this, SLOT(onInlineBotCancel()));
_inlineBotCancel->setGeometry(_send.geometry());
_attachEmoji->raise();
@ -6543,7 +6551,7 @@ void HistoryWidget::updateFieldPlaceholder() {
if (_inlineBot && _inlineBot != LookingUpInlineBot) {
_field.setPlaceholder(_inlineBot->botInfo->inlinePlaceholder.mid(1), _inlineBot->username.size() + 2);
} else {
_field.setPlaceholder(lang((_history && _history->isChannel() && !_history->isMegagroup()) ? (_silent.checked() ? lng_broadcast_silent_ph : lng_broadcast_ph) : lng_message_ph));
_field.setPlaceholder(lang((_history && _history->isChannel() && !_history->isMegagroup()) ? (_silent->checked() ? lng_broadcast_silent_ph : lng_broadcast_ph) : lng_message_ph));
}
_send.setText(lang(lng_send_button));
}
@ -6553,7 +6561,7 @@ void HistoryWidget::uploadImage(const QImage &img, PrepareMediaType type, FileLo
if (!_history) return;
App::wnd()->activateWindow();
auto task = new FileLoadTask(img, type, FileLoadTo(_peer->id, _silent.checked(), replyToId()), confirm, source);
auto task = new FileLoadTask(img, type, FileLoadTo(_peer->id, _silent->checked(), replyToId()), confirm, source);
if (withText) {
_confirmWithTextId = task->fileid();
}
@ -6564,7 +6572,7 @@ void HistoryWidget::uploadFile(const QString &file, PrepareMediaType type, FileL
if (!_history) return;
App::wnd()->activateWindow();
FileLoadTask *task = new FileLoadTask(file, type, FileLoadTo(_peer->id, _silent.checked(), replyToId()), confirm);
FileLoadTask *task = new FileLoadTask(file, type, FileLoadTo(_peer->id, _silent->checked(), replyToId()), confirm);
if (withText) {
_confirmWithTextId = task->fileid();
}
@ -6578,7 +6586,7 @@ void HistoryWidget::uploadFiles(const QStringList &files, PrepareMediaType type)
App::wnd()->activateWindow();
FileLoadTo to(_peer->id, _silent.checked(), replyToId());
FileLoadTo to(_peer->id, _silent->checked(), replyToId());
TasksList tasks;
tasks.reserve(files.size());
@ -6594,7 +6602,7 @@ void HistoryWidget::uploadFileContent(const QByteArray &fileContent, PrepareMedi
if (!_history) return;
App::wnd()->activateWindow();
_fileLoader.addTask(new FileLoadTask(fileContent, type, FileLoadTo(_peer->id, _silent.checked(), replyToId())));
_fileLoader.addTask(new FileLoadTask(fileContent, type, FileLoadTo(_peer->id, _silent->checked(), replyToId())));
cancelReplyAfterMediaSend(lastForceReplyReplied());
}
@ -7017,13 +7025,13 @@ void HistoryWidget::updateControlsGeometry() {
moveFieldControls();
if (_pinnedBar) {
if (_scroll.y() != st::replyHeight) {
_scroll.move(0, st::replyHeight);
_reportSpamPanel.move(0, st::replyHeight);
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::replyHeight, width(), st::lineWidth);
_pinnedBar->shadow->setGeometry(0, st::historyReplyHeight, width(), st::lineWidth);
} else if (_scroll.y() != 0) {
_scroll.move(0, 0);
_reportSpamPanel.move(0, 0);
@ -7114,14 +7122,14 @@ void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollCh
newScrollHeight -= (_field.height() + 2 * st::sendPadding);
}
if (_editMsgId || replyToId() || readyToForward() || (_previewData && _previewData->pendingTill >= 0)) {
newScrollHeight -= st::replyHeight;
newScrollHeight -= st::historyReplyHeight;
}
if (_kbShown) {
newScrollHeight -= _kbScroll.height();
}
}
if (_pinnedBar) {
newScrollHeight -= st::replyHeight;
newScrollHeight -= st::historyReplyHeight;
}
int wasScrollTop = _scroll.scrollTop();
bool wasAtBottom = wasScrollTop + 1 > _scroll.scrollTopMax();
@ -7339,7 +7347,7 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
if (_kbReplyTo && !_replyToId) {
updateReplyToName();
_replyEditMsgText.setText(st::msgFont, textClean(_kbReplyTo->inReplyText()), _textDlgOptions);
_fieldBarCancel.show();
_fieldBarCancel->show();
updateMouseTracking();
}
} else {
@ -7354,7 +7362,7 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
_kbShown = false;
_kbReplyTo = 0;
if (!readyToForward() && (!_previewData || _previewData->pendingTill < 0) && !_replyToId) {
_fieldBarCancel.hide();
_fieldBarCancel->hide();
updateMouseTracking();
}
}
@ -7370,7 +7378,7 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
_kbShown = false;
_kbReplyTo = 0;
if (!readyToForward() && (!_previewData || _previewData->pendingTill < 0) && !_replyToId && !_editMsgId) {
_fieldBarCancel.hide();
_fieldBarCancel->hide();
updateMouseTracking();
}
}
@ -7414,8 +7422,8 @@ void HistoryWidget::updateToEndVisibility() {
}
void HistoryWidget::mousePressEvent(QMouseEvent *e) {
_replyForwardPressed = QRect(0, _field.y() - st::sendPadding - st::replyHeight, st::replySkip, st::replyHeight).contains(e->pos());
if (_replyForwardPressed && !_fieldBarCancel.isHidden()) {
_replyForwardPressed = QRect(0, _field.y() - st::sendPadding - st::historyReplyHeight, st::historyReplySkip, st::historyReplyHeight).contains(e->pos());
if (_replyForwardPressed && !_fieldBarCancel->isHidden()) {
updateField();
} else if (_inRecord && cHasAudioCapture()) {
emit audioCapture()->start();
@ -7505,7 +7513,7 @@ void HistoryWidget::onInlineResultSend(InlineBots::Result *result, UserData *bot
}
bool channelPost = _peer->isChannel() && !_peer->isMegagroup();
bool showFromName = !channelPost || _peer->asChannel()->addsSignature();
bool silentPost = channelPost && _silent.checked();
bool silentPost = channelPost && _silent->checked();
if (channelPost) {
flags |= MTPDmessage::Flag::f_views;
flags |= MTPDmessage::Flag::f_post;
@ -7528,7 +7536,7 @@ void HistoryWidget::onInlineResultSend(InlineBots::Result *result, UserData *bot
result->addToHistory(_history, flags, messageId, messageFromId, messageDate, messageViaBotId, replyToId());
_history->sendRequestId = MTP::send(MTPmessages_SendInlineBotResult(MTP_flags(sendFlags), _peer->input, MTP_int(replyToId()), MTP_long(randomId), MTP_long(result->getQueryId()), MTP_string(result->getId())), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, _history->sendRequestId);
App::main()->finishForwarding(_history, _silent.checked());
App::main()->finishForwarding(_history, _silent->checked());
cancelReply(lastKeyboardUsed);
App::historyRegRandom(randomId, newId);
@ -7557,7 +7565,7 @@ void HistoryWidget::onInlineResultSend(InlineBots::Result *result, UserData *bot
HistoryWidget::PinnedBar::PinnedBar(MsgId msgId, HistoryWidget *parent)
: msgId(msgId)
, cancel(parent, st::replyCancel)
, cancel(parent, st::historyReplyCancel)
, shadow(parent, st::shadowColor) {
}
@ -7632,7 +7640,7 @@ bool HistoryWidget::pinnedMsgVisibilityUpdated() {
result = true;
if (_scroll.scrollTop() != unreadBarTop()) {
_scroll.scrollToY(_scroll.scrollTop() + st::replyHeight);
_scroll.scrollToY(_scroll.scrollTop() + st::historyReplyHeight);
}
} else if (_pinnedBar->msgId != pinnedMsgId) {
_pinnedBar->msgId = pinnedMsgId;
@ -7648,7 +7656,7 @@ bool HistoryWidget::pinnedMsgVisibilityUpdated() {
destroyPinnedBar();
result = true;
if (_scroll.scrollTop() != unreadBarTop()) {
_scroll.scrollToY(_scroll.scrollTop() - st::replyHeight);
_scroll.scrollToY(_scroll.scrollTop() - st::historyReplyHeight);
}
resizeEvent(0);
}
@ -7687,7 +7695,7 @@ bool HistoryWidget::sendExistingDocument(DocumentData *doc, const QString &capti
}
bool channelPost = _peer->isChannel() && !_peer->isMegagroup();
bool showFromName = !channelPost || _peer->asChannel()->addsSignature();
bool silentPost = channelPost && _silent.checked();
bool silentPost = channelPost && _silent->checked();
if (channelPost) {
flags |= MTPDmessage::Flag::f_views;
flags |= MTPDmessage::Flag::f_post;
@ -7701,7 +7709,7 @@ bool HistoryWidget::sendExistingDocument(DocumentData *doc, const QString &capti
_history->addNewDocument(newId.msg, flags, 0, replyToId(), date(MTP_int(unixtime())), showFromName ? MTP::authedId() : 0, doc, caption, MTPnullMarkup);
_history->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), _peer->input, MTP_int(replyToId()), MTP_inputMediaDocument(mtpInput, MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, _history->sendRequestId);
App::main()->finishForwarding(_history, _silent.checked());
App::main()->finishForwarding(_history, _silent->checked());
cancelReplyAfterMediaSend(lastKeyboardUsed);
if (doc->sticker()) App::main()->incrementSticker(doc);
@ -7742,7 +7750,7 @@ void HistoryWidget::sendExistingPhoto(PhotoData *photo, const QString &caption)
}
bool channelPost = _peer->isChannel() && !_peer->isMegagroup();
bool showFromName = !channelPost || _peer->asChannel()->addsSignature();
bool silentPost = channelPost && _silent.checked();
bool silentPost = channelPost && _silent->checked();
if (channelPost) {
flags |= MTPDmessage::Flag::f_views;
flags |= MTPDmessage::Flag::f_post;
@ -7756,7 +7764,7 @@ void HistoryWidget::sendExistingPhoto(PhotoData *photo, const QString &caption)
_history->addNewPhoto(newId.msg, flags, 0, replyToId(), date(MTP_int(unixtime())), showFromName ? MTP::authedId() : 0, photo, caption, MTPnullMarkup);
_history->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), _peer->input, MTP_int(replyToId()), MTP_inputMediaPhoto(MTP_inputPhoto(MTP_long(photo->id), MTP_long(photo->access)), MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, _history->sendRequestId);
App::main()->finishForwarding(_history, _silent.checked());
App::main()->finishForwarding(_history, _silent->checked());
cancelReplyAfterMediaSend(lastKeyboardUsed);
App::historyRegRandom(randomId, newId);
@ -7818,7 +7826,7 @@ void HistoryWidget::onReplyToMessage() {
updateBotKeyboard();
if (!_field.isHidden()) _fieldBarCancel.show();
if (!_field.isHidden()) _fieldBarCancel->show();
updateMouseTracking();
updateReplyToName();
resizeEvent(0);
@ -7871,7 +7879,7 @@ void HistoryWidget::onEditMessage() {
updateBotKeyboard();
if (!_field.isHidden()) _fieldBarCancel.show();
if (!_field.isHidden()) _fieldBarCancel->show();
updateFieldPlaceholder();
updateMouseTracking();
updateReplyToName();
@ -7964,7 +7972,7 @@ bool HistoryWidget::cancelReply(bool lastKeyboardUsed) {
_replyToId = 0;
mouseMoveEvent(0);
if (!readyToForward() && (!_previewData || _previewData->pendingTill < 0) && !_kbReplyTo) {
_fieldBarCancel.hide();
_fieldBarCancel->hide();
updateMouseTracking();
}
@ -8026,7 +8034,7 @@ void HistoryWidget::cancelEdit() {
mouseMoveEvent(nullptr);
if (!readyToForward() && (!_previewData || _previewData->pendingTill < 0) && !replyToId()) {
_fieldBarCancel.hide();
_fieldBarCancel->hide();
updateMouseTracking();
}
@ -8089,7 +8097,7 @@ void HistoryWidget::previewCancel() {
_previewLinks.clear();
updatePreview();
if (!_editMsgId && !_replyToId && !readyToForward() && !_kbReplyTo) {
_fieldBarCancel.hide();
_fieldBarCancel->hide();
updateMouseTracking();
}
}
@ -8155,7 +8163,7 @@ void HistoryWidget::gotPreview(QString links, const MTPMessageMedia &result, mtp
void HistoryWidget::updatePreview() {
_previewTimer.stop();
if (_previewData && _previewData->pendingTill >= 0) {
_fieldBarCancel.show();
_fieldBarCancel->show();
updateMouseTracking();
if (_previewData->pendingTill) {
_previewTitle.setText(st::msgServiceNameFont, lang(lng_preview_loading), _textNameOptions);
@ -8199,7 +8207,7 @@ void HistoryWidget::updatePreview() {
_previewDescription.setText(st::msgFont, textClean(desc), _textDlgOptions);
}
} else if (!readyToForward() && !replyToId() && !_editMsgId) {
_fieldBarCancel.hide();
_fieldBarCancel->hide();
updateMouseTracking();
}
resizeEvent(0);
@ -8461,7 +8469,7 @@ void HistoryWidget::updateReplyEditTexts(bool force) {
updateBotKeyboard();
if (!_field.isHidden() || _recording) {
_fieldBarCancel.show();
_fieldBarCancel->show();
updateMouseTracking();
}
updateReplyToName();
@ -8505,21 +8513,21 @@ void HistoryWidget::drawField(Painter &p, const QRect &rect) {
if (!_editMsgId && drawMsgText && drawMsgText->author()->nameVersion > _replyToNameVersion) {
updateReplyToName();
}
backy -= st::replyHeight;
backh += st::replyHeight;
backy -= st::historyReplyHeight;
backh += st::historyReplyHeight;
} else if (hasForward) {
App::main()->fillForwardingInfo(from, text, serviceColor, preview);
backy -= st::replyHeight;
backh += st::replyHeight;
backy -= st::historyReplyHeight;
backh += st::historyReplyHeight;
} else if (_previewData && _previewData->pendingTill >= 0) {
backy -= st::replyHeight;
backh += st::replyHeight;
backy -= st::historyReplyHeight;
backh += st::historyReplyHeight;
}
bool drawPreview = (_previewData && _previewData->pendingTill >= 0) && !_replyForwardPressed;
p.fillRect(0, backy, width(), backh, st::taMsgField.bgColor);
if (_editMsgId || _replyToId || (!hasForward && _kbReplyTo)) {
int32 replyLeft = st::replySkip;
p.drawSprite(QPoint(st::replyIconPos.x(), backy + st::replyIconPos.y()), _editMsgId ? st::editIcon : st::replyIcon);
int32 replyLeft = st::historyReplySkip;
(_editMsgId ? st::historyEditIcon : st::historyReplyIcon).paint(p, st::historyReplyIconPosition + QPoint(0, backy), width());
if (!drawPreview) {
if (drawMsgText) {
if (drawMsgText->getMedia() && drawMsgText->getMedia()->hasReplyPreview()) {
@ -8530,23 +8538,23 @@ void HistoryWidget::drawField(Painter &p, const QRect &rect) {
}
replyLeft += st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x();
}
p.setPen(st::replyColor);
p.setPen(st::historyReplyColor);
if (_editMsgId) {
paintEditHeader(p, rect, replyLeft, backy);
} else {
_replyToName.drawElided(p, replyLeft, backy + st::msgReplyPadding.top(), width() - replyLeft - _fieldBarCancel.width() - st::msgReplyPadding.right());
_replyToName.drawElided(p, replyLeft, backy + st::msgReplyPadding.top(), width() - replyLeft - _fieldBarCancel->width() - st::msgReplyPadding.right());
}
p.setPen((((drawMsgText->toHistoryMessage() && drawMsgText->toHistoryMessage()->emptyText()) || drawMsgText->serviceMsg()) ? st::msgInDateFg : st::msgColor)->p);
_replyEditMsgText.drawElided(p, replyLeft, backy + st::msgReplyPadding.top() + st::msgServiceNameFont->height, width() - replyLeft - _fieldBarCancel.width() - st::msgReplyPadding.right());
_replyEditMsgText.drawElided(p, replyLeft, backy + st::msgReplyPadding.top() + st::msgServiceNameFont->height, width() - replyLeft - _fieldBarCancel->width() - st::msgReplyPadding.right());
} else {
p.setFont(st::msgDateFont->f);
p.setPen(st::msgInDateFg->p);
p.drawText(replyLeft, backy + st::msgReplyPadding.top() + (st::msgReplyBarSize.height() - st::msgDateFont->height) / 2 + st::msgDateFont->ascent, st::msgDateFont->elided(lang(lng_profile_loading), width() - replyLeft - _fieldBarCancel.width() - st::msgReplyPadding.right()));
p.drawText(replyLeft, backy + st::msgReplyPadding.top() + (st::msgReplyBarSize.height() - st::msgDateFont->height) / 2 + st::msgDateFont->ascent, st::msgDateFont->elided(lang(lng_profile_loading), width() - replyLeft - _fieldBarCancel->width() - st::msgReplyPadding.right()));
}
}
} else if (from && text) {
int32 forwardLeft = st::replySkip;
p.drawSprite(QPoint(st::replyIconPos.x(), backy + st::replyIconPos.y()), st::forwardIcon);
int forwardLeft = st::historyReplySkip;
st::historyForwardIcon.paint(p, st::historyReplyIconPosition + QPoint(0, backy), width());
if (!drawPreview) {
if (!preview->isNull()) {
QRect to(forwardLeft, backy + st::msgReplyPadding.top(), st::msgReplyBarSize.height(), st::msgReplyBarSize.height());
@ -8558,15 +8566,15 @@ void HistoryWidget::drawField(Painter &p, const QRect &rect) {
}
forwardLeft += st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x();
}
p.setPen(st::replyColor->p);
from->drawElided(p, forwardLeft, backy + st::msgReplyPadding.top(), width() - forwardLeft - _fieldBarCancel.width() - st::msgReplyPadding.right());
p.setPen(st::historyReplyColor->p);
from->drawElided(p, forwardLeft, backy + st::msgReplyPadding.top(), width() - forwardLeft - _fieldBarCancel->width() - st::msgReplyPadding.right());
p.setPen((serviceColor ? st::msgInDateFg : st::msgColor)->p);
text->drawElided(p, forwardLeft, backy + st::msgReplyPadding.top() + st::msgServiceNameFont->height, width() - forwardLeft - _fieldBarCancel.width() - st::msgReplyPadding.right());
text->drawElided(p, forwardLeft, backy + st::msgReplyPadding.top() + st::msgServiceNameFont->height, width() - forwardLeft - _fieldBarCancel->width() - st::msgReplyPadding.right());
}
}
if (drawPreview) {
int32 previewLeft = st::replySkip + st::webPageLeft;
p.fillRect(st::replySkip, backy + st::msgReplyPadding.top(), st::webPageBar, st::msgReplyBarSize.height(), st::msgInReplyBarColor->b);
int32 previewLeft = st::historyReplySkip + st::webPageLeft;
p.fillRect(st::historyReplySkip, backy + st::msgReplyPadding.top(), st::webPageBar, st::msgReplyBarSize.height(), st::msgInReplyBarColor->b);
if ((_previewData->photo && !_previewData->photo->thumb->isNull()) || (_previewData->document && !_previewData->document->thumb->isNull())) {
ImagePtr replyPreview = _previewData->photo ? _previewData->photo->makeReplyPreview() : _previewData->document->makeReplyPreview();
if (!replyPreview->isNull()) {
@ -8580,10 +8588,10 @@ void HistoryWidget::drawField(Painter &p, const QRect &rect) {
}
previewLeft += st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x();
}
p.setPen(st::replyColor->p);
_previewTitle.drawElided(p, previewLeft, backy + st::msgReplyPadding.top(), width() - previewLeft - _fieldBarCancel.width() - st::msgReplyPadding.right());
p.setPen(st::historyReplyColor->p);
_previewTitle.drawElided(p, previewLeft, backy + st::msgReplyPadding.top(), width() - previewLeft - _fieldBarCancel->width() - st::msgReplyPadding.right());
p.setPen(st::msgColor->p);
_previewDescription.drawElided(p, previewLeft, backy + st::msgReplyPadding.top() + st::msgServiceNameFont->height, width() - previewLeft - _fieldBarCancel.width() - st::msgReplyPadding.right());
_previewDescription.drawElided(p, previewLeft, backy + st::msgReplyPadding.top() + st::msgServiceNameFont->height, width() - previewLeft - _fieldBarCancel->width() - st::msgReplyPadding.right());
}
}
@ -8676,7 +8684,7 @@ void HistoryWidget::drawPinnedBar(Painter &p) {
Text *from = 0, *text = 0;
bool serviceColor = false, hasForward = readyToForward();
ImagePtr preview;
p.fillRect(0, 0, width(), st::replyHeight, st::taMsgField.bgColor);
p.fillRect(0, 0, width(), st::historyReplyHeight, st::taMsgField.bgColor);
QRect rbar(rtlrect(st::msgReplyBarSkip + st::msgReplyBarPos.x(), st::msgReplyPadding.top() + st::msgReplyBarPos.y(), st::msgReplyBarSize.width(), st::msgReplyBarSize.height(), width()));
p.fillRect(rbar, st::msgInReplyBarColor);
@ -8691,7 +8699,7 @@ void HistoryWidget::drawPinnedBar(Painter &p) {
}
left += st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x();
}
p.setPen(st::replyColor);
p.setPen(st::historyReplyColor);
p.setFont(st::msgServiceNameFont);
p.drawText(left, st::msgReplyPadding.top() + st::msgServiceNameFont->ascent, lang(lng_pinned_message));

View file

@ -23,6 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "localimageloader.h"
#include "ui/effects/rect_shadow.h"
#include "ui/widgets/tooltip.h"
#include "ui/buttons/icon_button.h"
#include "history/history_common.h"
#include "history/field_autocomplete.h"
#include "window/section_widget.h"
@ -508,18 +509,27 @@ private:
};
class SilentToggle : public FlatCheckbox, public Ui::AbstractTooltipShower {
class SilentToggle : public Ui::IconButton, public Ui::AbstractTooltipShower {
public:
SilentToggle(QWidget *parent);
void mouseMoveEvent(QMouseEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void leaveEvent(QEvent *e) override;
void setChecked(bool checked);
bool checked() const {
return _checked;
}
// AbstractTooltipShower interface
QString tooltipText() const override;
QPoint tooltipPos() const override;
protected:
void mouseMoveEvent(QMouseEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void leaveEvent(QEvent *e) override;
private:
bool _checked = false;
};
EntitiesInText entitiesFromTextTags(const TextWithTags::Tags &tags);
@ -885,7 +895,7 @@ private:
Text _replyEditMsgText;
mutable SingleTimer _updateEditTimeLeftDisplay;
IconedButton _fieldBarCancel;
ChildWidget<Ui::IconButton> _fieldBarCancel;
void updateReplyEditTexts(bool force = false);
struct PinnedBar {
@ -895,7 +905,7 @@ private:
MsgId msgId = 0;
HistoryItem *msg = nullptr;
Text text;
ChildWidget<IconedButton> cancel;
ChildWidget<Ui::IconButton> cancel;
ChildWidget<Ui::PlainShadow> shadow;
};
std_::unique_ptr<PinnedBar> _pinnedBar;
@ -1075,7 +1085,7 @@ private:
UserData *_inlineBot = nullptr;
QString _inlineBotUsername;
mtpRequestId _inlineBotResolveRequestId = 0;
std_::unique_ptr<IconedButton> _inlineBotCancel;
std_::unique_ptr<Ui::IconButton> _inlineBotCancel;
void inlineBotResolveDone(const MTPcontacts_ResolvedPeer &result);
bool inlineBotResolveFail(QString name, const RPCError &error);
@ -1096,7 +1106,7 @@ private:
ChildWidget<Ui::IconButton> _botKeyboardShow;
ChildWidget<Ui::IconButton> _botKeyboardHide;
ChildWidget<Ui::IconButton> _botCommandStart;
SilentToggle _silent;
ChildWidget<SilentToggle> _silent;
bool _cmdStartShown = false;
MessageField _field;
Animation _a_record, _a_recording;

View file

@ -25,20 +25,15 @@ introErrLabel: flatLabel(labelDefFlat) {
font: introErrFont;
align: align(center);
}
introBackButton: IconButton {
introBackButton: IconButton(defaultIconButton) {
width: 40px;
height: 40px;
opacity: 0.71;
overOpacity: 1.;
icon: icon {
{ size(40px, 40px), #eeeeee },
{ "title_previous", #969696, point(12px, 12px) },
};
iconPosition: point(0px, 0px);
downIconPosition: point(0px, 0px);
duration: 150;
}
introBackPosition: point(32px, 32px);

View file

@ -138,7 +138,7 @@ void IntroSignup::paintEvent(QPaintEvent *e) {
} else {
p.fillRect(phRect, st::newGroupPhotoBg);
}
p.drawSpriteCenter(phRect, st::newGroupPhotoIcon);
st::newGroupPhotoIcon.paintInCenter(p, phRect);
} else {
p.drawPixmap(_phLeft, _phTop, _photoSmall);
}

View file

@ -21,12 +21,14 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "stdafx.h"
#include "styles/style_overview.h"
#include "styles/style_dialogs.h"
#include "boxes/addcontactbox.h"
#include "boxes/confirmbox.h"
#include "boxes/photocropbox.h"
#include "ui/filedialog.h"
#include "ui/widgets/popup_menu.h"
#include "ui/widgets/tooltip.h"
#include "ui/buttons/icon_button.h"
#include "window/top_bar_widget.h"
#include "window/chat_background.h"
#include "lang.h"
@ -52,7 +54,7 @@ OverviewInner::OverviewInner(OverviewWidget *overview, ScrollArea *scroll, PeerD
, _channel(peerToChannel(_peer->id))
, _rowWidth(st::msgMinWidth)
, _search(this, st::dlgFilter, lang(lng_dlg_filter))
, _cancelSearch(this, st::btnCancelSearch)
, _cancelSearch(this, st::dialogsCancelSearch)
, _itemsToBeLoaded(LinksOverviewPerPage * 2)
, _width(st::wndMinWidth) {
subscribe(FileDownload::ImageLoaded(), [this] { update(); });
@ -73,14 +75,14 @@ OverviewInner::OverviewInner(OverviewWidget *overview, ScrollArea *scroll, PeerD
mediaOverviewUpdated();
setMouseTracking(true);
connect(&_cancelSearch, SIGNAL(clicked()), this, SLOT(onCancelSearch()));
connect(_cancelSearch, SIGNAL(clicked()), this, SLOT(onCancelSearch()));
connect(&_search, SIGNAL(cancelled()), this, SLOT(onCancel()));
connect(&_search, SIGNAL(changed()), this, SLOT(onSearchUpdate()));
_searchTimer.setSingleShot(true);
connect(&_searchTimer, SIGNAL(timeout()), this, SLOT(onSearchMessages()));
_cancelSearch.hide();
_cancelSearch->hide();
if (_type == OverviewLinks || _type == OverviewFiles) {
_search.show();
} else {
@ -1280,7 +1282,7 @@ int32 OverviewInner::resizeToWidth(int32 nwidth, int32 scrollTop, int32 minHeigh
_rowsLeft = (_width - _rowWidth) / 2;
_search.setGeometry(_rowsLeft, st::linksSearchMargin.top(), _rowWidth, _search.height());
_cancelSearch.moveToLeft(_rowsLeft + _rowWidth - _cancelSearch.width(), _search.y());
_cancelSearch->moveToLeft(_rowsLeft + _rowWidth - _cancelSearch->width(), _search.y());
if (_type == OverviewPhotos || _type == OverviewVideos) {
for (int32 i = 0, l = _items.size(); i < l; ++i) {
@ -1341,7 +1343,7 @@ void OverviewInner::switchType(MediaOverviewType type) {
_search.updatePlaceholder();
onSearchUpdate();
}
_cancelSearch.hide();
_cancelSearch->hide();
resizeToWidth(_width, 0, _minHeight, true);
}
@ -1470,9 +1472,9 @@ void OverviewInner::onSearchUpdate() {
_searchQueries.clear();
_searchQuery = QString();
_searchResults.clear();
_cancelSearch.hide();
} else if (_cancelSearch.isHidden()) {
_cancelSearch.show();
_cancelSearch->hide();
} else if (_cancelSearch->isHidden()) {
_cancelSearch->show();
}
if (changed) {
@ -1494,7 +1496,7 @@ void OverviewInner::onCancel() {
bool OverviewInner::onCancelSearch() {
if (_search.isHidden()) return false;
bool clearing = !_search.text().isEmpty();
_cancelSearch.hide();
_cancelSearch->hide();
_search.clear();
_search.updatePlaceholder();
onSearchUpdate();

View file

@ -34,6 +34,7 @@ class Date;
namespace Ui {
class PlainShadow;
class PopupMenu;
class IconButton;
} // namespace Ui
class OverviewWidget;
@ -179,7 +180,7 @@ private:
int32 setLayoutItem(int32 index, Overview::Layout::AbstractItem *item, int32 top);
FlatInput _search;
IconedButton _cancelSearch;
ChildWidget<Ui::IconButton> _cancelSearch;
QVector<MsgId> _results;
int32 _itemsToBeLoaded;

View file

@ -33,18 +33,16 @@ settingsFixedBarFont: font(14px semibold);
settingsFixedBarFg: windowTextFg;
settingsFixedBarTextLeft: 20px;
settingsFixedBarTextTop: 16px;
settingsFixedBarClose: IconButton {
settingsFixedBarClose: IconButton(defaultIconButton) {
width: settingsFixedBarHeight;
height: settingsFixedBarHeight;
opacity: 0.31;
overOpacity: 0.5;
icon: icon {{ "settings_close", #000000, point(0px, 0px) }};
icon: boxCancelIcon;
iconPosition: point(20px, 20px);
downIconPosition: point(20px, 20px);
duration: 200;
}
settingsFixedBarShadowBg1: #00000021;
settingsFixedBarShadowBg2: #0000000b;

View file

@ -2427,14 +2427,14 @@ EmojiPanel::EmojiPanel(QWidget *parent, const QString &text, uint64 setId, bool
, _setId(setId)
, _special(special)
, _deleteVisible(false)
, _delete(special ? 0 : new IconedButton(this, st::simpleClose)) { // Stickers::NoneSetId if in emoji
, _delete(special ? 0 : new Ui::IconButton(this, st::hashtagClose)) { // Stickers::NoneSetId if in emoji
resize(st::emojiPanWidth, st::emojiPanHeader);
setMouseTracking(true);
setFocusPolicy(Qt::NoFocus);
setText(text);
if (_delete) {
_delete->hide();
_delete->moveToRight(st::emojiPanHeaderLeft - ((_delete->width() - st::simpleClose.icon.pxWidth()) / 2), (st::emojiPanHeader - _delete->height()) / 2, width());
_delete->moveToRight(st::emojiPanHeaderLeft - ((_delete->width() - st::hashtagClose.icon.width()) / 2), (st::emojiPanHeader - _delete->height()) / 2, width());
connect(_delete, SIGNAL(clicked()), this, SLOT(onDelete()));
}
}
@ -2452,7 +2452,7 @@ void EmojiPanel::updateText() {
int32 availw = st::emojiPanWidth - st::emojiPanHeaderLeft * 2;
if (_deleteVisible) {
if (!_special && _setId != Stickers::NoneSetId) {
availw -= st::simpleClose.icon.pxWidth() + st::emojiPanHeaderLeft;
availw -= st::hashtagClose.icon.width() + st::emojiPanHeaderLeft;
}
} else {
auto switchText = ([this]() {

View file

@ -459,7 +459,7 @@ private:
QString _text, _fullText;
uint64 _setId;
bool _special, _deleteVisible;
IconedButton *_delete;
Ui::IconButton *_delete;
};

View file

@ -162,3 +162,12 @@ stickerIconMove: 400;
stickerPreviewDuration: 150;
stickerPreviewBg: #FFFFFFB0;
stickerPreviewMin: 0.1;
hashtagClose: IconButton(defaultIconButton) {
width: 30px;
height: 30px;
icon: simpleCloseIcon;
iconPosition: point(10px, 10px);
downIconPosition: point(10px, 11px);
}

View file

@ -40,8 +40,12 @@ void IconButton::paintEvent(QPaintEvent *e) {
auto over = _a_over.current(getms(), (_state & StateOver) ? 1. : 0.);
p.setOpacity(over * _st.overOpacity + (1. - over) * _st.opacity);
auto icon = (_iconOverride ? _iconOverride : &_st.icon);
auto position = (_state & StateDown) ? _st.downIconPosition : _st.iconPosition;
(_iconOverride ? _iconOverride : &_st.icon)->paint(p, position, width());
if (position.x() < 0) {
position.setX((width() - icon->width()) / 2);
}
icon->paint(p, position, width());
}
void IconButton::onStateChanged(int oldState, ButtonStateChangeSource source) {

View file

@ -167,6 +167,12 @@ defaultLabelSimple: LabelSimple {
textFg: windowTextFg;
}
defaultIconButton: IconButton {
opacity: 0.78;
overOpacity: 1.;
duration: 150;
}
widgetSlideDuration: 200;
widgetFadeDuration: 200;

View file

@ -244,7 +244,7 @@ private:
PeerData *_author;
HistoryItem *_item;
int _forwardedCount;
ChildWidget<IconedButton> _close;
ChildWidget<Ui::IconButton> _close;
ChildWidget<BoxButton> _reply;
ChildWidget<Background> _background = { nullptr };
ChildWidget<InputArea> _replyArea = { nullptr };

View file

@ -37,7 +37,13 @@ notifyPhotoSize: 62px;
notifyMacPhotoSize: 64px;
notifyPhotoPos: point(9px, 9px);
notifyClosePos: point(1px, 2px);
notifyClose: iconedButton(simpleClose) {
notifyClose: IconButton(defaultIconButton) {
width: 30px;
height: 30px;
icon: simpleCloseIcon;
iconPosition: point(10px, 10px);
downIconPosition: point(10px, 11px);
}
notifyItemTop: 12px;
notifyTextLeft: 12px;
@ -64,16 +70,11 @@ notifyReplyArea: InputArea(defaultInputArea) {
borderActive: 0px;
borderError: 0px;
}
notifySendReply: IconButton {
notifySendReply: IconButton(defaultIconButton) {
width: 36px;
height: 36px;
opacity: 0.78;
overOpacity: 1.;
icon: icon {{ "notification_send", windowActiveBg, point(3px, 9px) }};
iconPosition: point(0px, 0px);
downIconPosition: point(0px, 1px);
duration: notifyFastAnim;
}