Closed beta 10019004: new add contact button, various improvements.

This commit is contained in:
John Preston 2016-11-10 21:10:31 +03:00
parent 3366e05b77
commit 1310b156dc
28 changed files with 187 additions and 201 deletions

View File

@ -173,6 +173,7 @@ defaultInputField: InputField {
height: 32px; height: 32px;
} }
defaultCheckboxIcon: icon {{ "default_checkbox_check", windowActiveFg, point(4px, 7px) }};
defaultCheckbox: Checkbox { defaultCheckbox: Checkbox {
textFg: windowTextFg; textFg: windowTextFg;
textBg: windowBg; textBg: windowBg;
@ -188,7 +189,7 @@ defaultCheckbox: Checkbox {
textPosition: point(32px, 2px); textPosition: point(32px, 2px);
diameter: 22px; diameter: 22px;
thickness: 2px; thickness: 2px;
checkIcon: icon {{ "default_checkbox_check", windowActiveFg, point(4px, 7px) }}; checkIcon: defaultCheckboxIcon;
font: normalFont; font: normalFont;
duration: 120; duration: 120;
@ -752,33 +753,6 @@ layerSlideDuration: 200;
layerHideDuration: 200; layerHideDuration: 200;
layerPadding: margins(10px, 10px, 10px, 10px); layerPadding: margins(10px, 10px, 10px, 10px);
contactPadding: margins(49px, 22px, 0px, 6px);
contactSkip: 13px;
contactPhoneSkip: 30px;
contactsPhotoSize: 42px;
contactsPadding: margins(16px, 7px, 16px, 7px);
contactsNameTop: 2px;
contactsNameFont: semiboldFont;
contactsStatusTop: 23px;
contactsStatusFont: font(fsize);
contactsStatusFg: #999999;
contactsStatusFgOver: #7c99b2;
contactsStatusFgOnline: #3b8dcc;
contactsCheckPosition: point(8px, 16px);
contactsAboutBg: #f7f7f7;
contactsAboutShadow: #0000001F;
contactsAdminCheckbox: Checkbox(defaultBoxCheckbox) {
font: semiboldFont;
textBg: #f7f7f7;
textPosition: point(34px, 1px);
}
contactsAboutHeight: 42px;
contactsAboutTop: 9px;
contactsScroll: flatScroll(boxScroll) {
deltab: 0px;
}
simpleCloseIcon: icon {{ "simple_close", #c7c7c7 }}; simpleCloseIcon: icon {{ "simple_close", #c7c7c7 }};
simpleCloseIconOver: icon {{ "simple_close", #a3a3a3 }}; simpleCloseIconOver: icon {{ "simple_close", #a3a3a3 }};
dialogsForwardCancelIcon: icon {{ "simple_close", dialogsForwardFg }}; dialogsForwardCancelIcon: icon {{ "simple_close", dialogsForwardFg }};

View File

@ -97,6 +97,9 @@ membersAboutLimitFg: windowSubTextFg;
contactsBg: windowBg; contactsBg: windowBg;
contactsBgOver: windowOverBg; contactsBgOver: windowOverBg;
contactsNameFg: boxTextFg; contactsNameFg: boxTextFg;
contactsStatusFg: windowSubTextFg;
contactsStatusFgOver: contactsStatusFg;
contactsStatusFgOnline: #3b8dcc;
photoCropFadeBg: #0000007f; photoCropFadeBg: #0000007f;
photoCropPointFg: #ffffff7f; photoCropPointFg: #ffffff7f;
@ -170,7 +173,7 @@ topBarBg: windowBg;
emojiPanBg: windowBg; emojiPanBg: windowBg;
emojiPanCategories: #f7f7f7 | windowBg; emojiPanCategories: #f7f7f7 | windowBg;
emojiPanHeaderFg: #999999 | windowSubTextFg; emojiPanHeaderFg: windowSubTextFg;
emojiPanHeaderBg: #fffffff2 | emojiPanBg; emojiPanHeaderBg: #fffffff2 | emojiPanBg;
historyComposeAreaBg: windowBg; historyComposeAreaBg: windowBg;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 590 B

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -81,6 +81,9 @@ membersAboutLimitFg: windowSubTextFg;
contactsBg: windowBg; contactsBg: windowBg;
contactsBgOver: windowOverBg; contactsBgOver: windowOverBg;
contactsNameFg: boxTextFg; contactsNameFg: boxTextFg;
contactsStatusFg: windowSubTextFg;
contactsStatusFgOver: contactsStatusFg;
contactsStatusFgOnline: #3b8dcc;
photoCropFadeBg: #0000007f; photoCropFadeBg: #0000007f;
photoCropPointFg: #ffffff7f; photoCropPointFg: #ffffff7f;
notificationsBoxMonitorFg: windowTextFg; notificationsBoxMonitorFg: windowTextFg;

View File

@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,10,19,3 FILEVERSION 0,10,19,4
PRODUCTVERSION 0,10,19,3 PRODUCTVERSION 0,10,19,4
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.10.19.3" VALUE "FileVersion", "0.10.19.4"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.19.3" VALUE "ProductVersion", "0.10.19.4"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,10,19,3 FILEVERSION 0,10,19,4
PRODUCTVERSION 0,10,19,3 PRODUCTVERSION 0,10,19,4
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -43,10 +43,10 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileDescription", "Telegram Updater" VALUE "FileDescription", "Telegram Updater"
VALUE "FileVersion", "0.10.19.3" VALUE "FileVersion", "0.10.19.4"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.19.3" VALUE "ProductVersion", "0.10.19.4"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -89,10 +89,40 @@ contactUserIcon: icon {{ "add_contact_user", #999999 }};
contactPhoneIcon: icon {{ "add_contact_phone", #999999 }}; contactPhoneIcon: icon {{ "add_contact_phone", #999999 }};
contactIconTop: 10px; contactIconTop: 10px;
contactsNewItemHeight: 53px; contactsAdd: IconButton {
contactsNewItemIcon: icon {{ "contacts_add", #749fc2, point(29px, 19px) }}; width: 52px;
contactsNewItemTop: 18px; height: 52px;
contactsNewItemFg: #4b82af;
icon: contactsAddIcon;
iconOver: contactsAddIconOver;
}
contactsAddPosition: point(14px, 8px);
contactPadding: margins(49px, 22px, 0px, 6px);
contactSkip: 13px;
contactPhoneSkip: 30px;
contactsPhotoSize: 42px;
contactsPadding: margins(16px, 7px, 16px, 7px);
contactsNameTop: 2px;
contactsNameFont: semiboldFont;
contactsStatusTop: 23px;
contactsStatusFont: font(fsize);
contactsCheckPosition: point(8px, 16px);
contactsAllAdminsTop: 18px;
contactsAboutBg: #f7f7f7;
contactsAboutShadow: #0000001F;
contactsAdminCheckbox: Checkbox(defaultBoxCheckbox) {
font: semiboldFont;
textBg: #f7f7f7;
textPosition: point(34px, 1px);
}
contactsAboutSkip: 53px;
contactsAboutHeight: 42px;
contactsAboutTop: 9px;
contactsScroll: flatScroll(boxScroll) {
deltab: 0px;
}
contactsMultiSelect: MultiSelect { contactsMultiSelect: MultiSelect {
bg: boxSearchBg; bg: boxSearchBg;

View File

@ -31,6 +31,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwindow.h" #include "mainwindow.h"
#include "application.h" #include "application.h"
#include "ui/buttons/checkbox.h" #include "ui/buttons/checkbox.h"
#include "ui/buttons/icon_button.h"
#include "ui/filedialog.h" #include "ui/filedialog.h"
#include "ui/widgets/multi_select.h" #include "ui/widgets/multi_select.h"
#include "ui/effects/widget_slide_wrap.h" #include "ui/effects/widget_slide_wrap.h"
@ -108,7 +109,13 @@ void ContactsBox::init() {
auto bottomSkip = inviting ? (st::boxButtonPadding.top() + _next->height() + st::boxButtonPadding.bottom()) : st::boxScrollSkip; auto bottomSkip = inviting ? (st::boxButtonPadding.top() + _next->height() + st::boxButtonPadding.bottom()) : st::boxScrollSkip;
ItemListBox::init(_inner, bottomSkip, topSkip); ItemListBox::init(_inner, bottomSkip, topSkip);
connect(_inner, SIGNAL(addRequested()), App::wnd(), SLOT(onShowAddContact())); if (_inner->creating() == CreatingGroupNone && !_inner->chat() && !_inner->channel() && !_inner->bot()) {
_add.create(this, st::contactsAdd);
_add->setClickedCallback([] {
App::wnd()->onShowAddContact();
});
}
_inner->setPeerSelectedChangedCallback([this](PeerData *peer, bool checked) { _inner->setPeerSelectedChangedCallback([this](PeerData *peer, bool checked) {
onPeerSelectedChanged(peer, checked); onPeerSelectedChanged(peer, checked);
}); });
@ -336,6 +343,10 @@ void ContactsBox::resizeEvent(QResizeEvent *e) {
updateScrollSkips(); updateScrollSkips();
if (_add) {
_add->moveToRight(st::contactsAddPosition.x(), height() - st::contactsAddPosition.y() - _add->height());
}
_inner->resize(width(), _inner->height()); _inner->resize(width(), _inner->height());
_next->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _next->height()); _next->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _next->height());
_cancel->moveToRight(st::boxButtonPadding.right() + _next->width() + st::boxButtonPadding.left(), _next->y()); _cancel->moveToRight(st::boxButtonPadding.right() + _next->width() + st::boxButtonPadding.left(), _next->y());
@ -558,7 +569,6 @@ ContactsBox::Inner::ContactData::ContactData(PeerData *peer, base::lambda_wrap<v
ContactsBox::Inner::Inner(QWidget *parent, CreatingGroupType creating) : TWidget(parent) ContactsBox::Inner::Inner(QWidget *parent, CreatingGroupType creating) : TWidget(parent)
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom()) , _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
, _newItemHeight(creating == CreatingGroupNone ? st::contactsNewItemHeight : 0)
, _creating(creating) , _creating(creating)
, _allAdmins(this, lang(lng_chat_all_members_admins), false, st::contactsAdminCheckbox) , _allAdmins(this, lang(lng_chat_all_members_admins), false, st::contactsAdminCheckbox)
, _contacts(App::main()->contactsList()) , _contacts(App::main()->contactsList())
@ -597,7 +607,7 @@ ContactsBox::Inner::Inner(QWidget *parent, ChatData *chat, MembersFilter members
, _addContactLnk(this, lang(lng_add_contact_button)) { , _addContactLnk(this, lang(lng_add_contact_button)) {
initList(); initList();
if (membersFilter == MembersFilter::Admins) { if (membersFilter == MembersFilter::Admins) {
_newItemHeight = st::contactsNewItemHeight + qMax(_aboutAllAdmins.countHeight(_aboutWidth), _aboutAdmins.countHeight(_aboutWidth)) + st::contactsAboutHeight; _aboutHeight = st::contactsAboutSkip + qMax(_aboutAllAdmins.countHeight(_aboutWidth), _aboutAdmins.countHeight(_aboutWidth)) + st::contactsAboutHeight;
if (_contacts->isEmpty()) { if (_contacts->isEmpty()) {
App::api()->requestFullPeer(_chat); App::api()->requestFullPeer(_chat);
} }
@ -836,7 +846,7 @@ void ContactsBox::Inner::peerUpdated(PeerData *peer) {
for_const (auto row, _contacts->all()) { for_const (auto row, _contacts->all()) {
if (row->attached == i.value()) { if (row->attached == i.value()) {
row->attached = nullptr; row->attached = nullptr;
update(0, _newItemHeight + _rowHeight * row->pos(), width(), _rowHeight); update(0, _aboutHeight + _rowHeight * row->pos(), width(), _rowHeight);
} }
} }
if (!_filter.isEmpty()) { if (!_filter.isEmpty()) {
@ -863,9 +873,9 @@ void ContactsBox::Inner::loadProfilePhotos(int32 yFrom) {
if (_filter.isEmpty()) { if (_filter.isEmpty()) {
if (!_contacts->isEmpty()) { if (!_contacts->isEmpty()) {
auto i = _contacts->cfind(yFrom - _newItemHeight, _rowHeight); auto i = _contacts->cfind(yFrom - _aboutHeight, _rowHeight);
for (auto end = _contacts->cend(); i != end; ++i) { for (auto end = _contacts->cend(); i != end; ++i) {
if ((_newItemHeight + (*i)->pos() * _rowHeight) >= yTo) { if ((_aboutHeight + (*i)->pos() * _rowHeight) >= yTo) {
break; break;
} }
(*i)->history()->peer->loadUserpic(); (*i)->history()->peer->loadUserpic();
@ -1046,24 +1056,17 @@ void ContactsBox::Inner::paintEvent(QPaintEvent *e) {
int32 yFrom = r.y(), yTo = r.y() + r.height(); int32 yFrom = r.y(), yTo = r.y() + r.height();
if (_filter.isEmpty()) { if (_filter.isEmpty()) {
if (!_contacts->isEmpty() || !_byUsername.isEmpty()) { if (!_contacts->isEmpty() || !_byUsername.isEmpty()) {
if (_newItemHeight) { if (_aboutHeight) {
if (_chat) { p.fillRect(0, 0, width(), _aboutHeight - st::contactsPadding.bottom() - st::lineWidth, st::contactsAboutBg);
p.fillRect(0, 0, width(), _newItemHeight - st::contactsPadding.bottom() - st::lineWidth, st::contactsAboutBg); p.fillRect(0, _aboutHeight - st::contactsPadding.bottom() - st::lineWidth, width(), st::lineWidth, st::shadowColor);
p.fillRect(0, _newItemHeight - st::contactsPadding.bottom() - st::lineWidth, width(), st::lineWidth, st::shadowColor); p.setPen(st::boxTextFg);
p.setPen(st::boxTextFg); p.drawTextLeft(st::contactsPadding.left(), st::contactsAllAdminsTop, width(), lang(lng_chat_all_members_admins));
p.drawTextLeft(st::contactsPadding.left(), st::contactsNewItemTop, width(), lang(lng_chat_all_members_admins)); int aboutw = width() - st::contactsPadding.left() - st::contactsPadding.right();
int aboutw = width() - st::contactsPadding.left() - st::contactsPadding.right(); (_allAdmins->checked() ? _aboutAllAdmins : _aboutAdmins).draw(p, st::contactsPadding.left(), st::contactsAboutSkip + st::contactsAboutTop, aboutw);
(_allAdmins->checked() ? _aboutAllAdmins : _aboutAdmins).draw(p, st::contactsPadding.left(), st::contactsNewItemHeight + st::contactsAboutTop, aboutw);
} else { yFrom -= _aboutHeight;
p.fillRect(0, 0, width(), st::contactsNewItemHeight, _newItemSel ? st::contactsBgOver : st::contactsBg); yTo -= _aboutHeight;
p.setFont(st::contactsNameFont); p.translate(0, _aboutHeight);
st::contactsNewItemIcon.paint(p, 0, 0, width());
p.setPen(st::contactsNewItemFg);
p.drawTextLeft(st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left(), st::contactsNewItemTop, width(), lang(lng_add_contact_button));
}
yFrom -= _newItemHeight;
yTo -= _newItemHeight;
p.translate(0, _newItemHeight);
} }
if (!_contacts->isEmpty()) { if (!_contacts->isEmpty()) {
auto i = _contacts->cfind(yFrom, _rowHeight); auto i = _contacts->cfind(yFrom, _rowHeight);
@ -1103,13 +1106,13 @@ void ContactsBox::Inner::paintEvent(QPaintEvent *e) {
text = lang((cDialogsReceived() && !_searching) ? (sharingBotGame() ? lng_bot_no_chats : lng_bot_no_groups) : lng_contacts_loading); text = lang((cDialogsReceived() && !_searching) ? (sharingBotGame() ? lng_bot_no_chats : lng_bot_no_groups) : lng_contacts_loading);
} else if (_chat && _membersFilter == MembersFilter::Admins) { } else if (_chat && _membersFilter == MembersFilter::Admins) {
text = lang(lng_contacts_loading); text = lang(lng_contacts_loading);
p.fillRect(0, 0, width(), _newItemHeight - st::contactsPadding.bottom() - st::lineWidth, st::contactsAboutBg); p.fillRect(0, 0, width(), _aboutHeight - st::contactsPadding.bottom() - st::lineWidth, st::contactsAboutBg);
p.fillRect(0, _newItemHeight - st::contactsPadding.bottom() - st::lineWidth, width(), st::lineWidth, st::shadowColor); p.fillRect(0, _aboutHeight - st::contactsPadding.bottom() - st::lineWidth, width(), st::lineWidth, st::shadowColor);
p.setPen(st::boxTextFg); p.setPen(st::boxTextFg);
p.drawTextLeft(st::contactsPadding.left(), st::contactsNewItemTop, width(), lang(lng_chat_all_members_admins)); p.drawTextLeft(st::contactsPadding.left(), st::contactsAllAdminsTop, width(), lang(lng_chat_all_members_admins));
int aboutw = width() - st::contactsPadding.left() - st::contactsPadding.right(); int aboutw = width() - st::contactsPadding.left() - st::contactsPadding.right();
(_allAdmins->checked() ? _aboutAllAdmins : _aboutAdmins).draw(p, st::contactsPadding.left(), st::contactsNewItemHeight + st::contactsAboutTop, aboutw); (_allAdmins->checked() ? _aboutAllAdmins : _aboutAdmins).draw(p, st::contactsPadding.left(), st::contactsAboutSkip + st::contactsAboutTop, aboutw);
p.translate(0, _newItemHeight); p.translate(0, _aboutHeight);
} else if (cContactsReceived() && !_searching) { } else if (cContactsReceived() && !_searching) {
text = lang(lng_no_contacts); text = lang(lng_no_contacts);
skip = st::noContactsFont->height; skip = st::noContactsFont->height;
@ -1171,9 +1174,9 @@ void ContactsBox::Inner::enterEvent(QEvent *e) {
int ContactsBox::Inner::getSelectedRowTop() const { int ContactsBox::Inner::getSelectedRowTop() const {
if (_filter.isEmpty()) { if (_filter.isEmpty()) {
if (_sel) { if (_sel) {
return _newItemHeight + (_sel->pos() * _rowHeight); return _aboutHeight + (_sel->pos() * _rowHeight);
} else if (_byUsernameSel >= 0) { } else if (_byUsernameSel >= 0) {
return _newItemHeight + (_contacts->size() * _rowHeight) + st::searchedBarHeight + (_byUsernameSel * _rowHeight); return _aboutHeight + (_contacts->size() * _rowHeight) + st::searchedBarHeight + (_byUsernameSel * _rowHeight);
} }
} else { } else {
if (_filteredSel >= 0) { if (_filteredSel >= 0) {
@ -1186,13 +1189,9 @@ int ContactsBox::Inner::getSelectedRowTop() const {
} }
void ContactsBox::Inner::updateSelectedRow() { void ContactsBox::Inner::updateSelectedRow() {
if (_filter.isEmpty() && _newItemSel) { auto rowTop = getSelectedRowTop();
update(0, 0, width(), st::contactsNewItemHeight); if (rowTop >= 0) {
} else { updateRowWithTop(rowTop);
auto rowTop = getSelectedRowTop();
if (rowTop >= 0) {
updateRowWithTop(rowTop);
}
} }
} }
@ -1204,12 +1203,12 @@ int ContactsBox::Inner::getRowTopWithPeer(PeerData *peer) const {
if (_filter.isEmpty()) { if (_filter.isEmpty()) {
for (auto i = _contacts->cbegin(), end = _contacts->cend(); i != end; ++i) { for (auto i = _contacts->cbegin(), end = _contacts->cend(); i != end; ++i) {
if ((*i)->history()->peer == peer) { if ((*i)->history()->peer == peer) {
return _newItemHeight + ((*i)->pos() * _rowHeight); return _aboutHeight + ((*i)->pos() * _rowHeight);
} }
} }
for (auto i = 0, count = _byUsername.size(); i != count; ++i) { for (auto i = 0, count = _byUsername.size(); i != count; ++i) {
if (_byUsername[i] == peer) { if (_byUsername[i] == peer) {
return _newItemHeight + (_contacts->size() * _rowHeight) + st::searchedBarHeight + (i * _rowHeight); return _aboutHeight + (_contacts->size() * _rowHeight) + st::searchedBarHeight + (i * _rowHeight);
} }
} }
} else { } else {
@ -1237,10 +1236,9 @@ void ContactsBox::Inner::updateRowWithPeer(PeerData *peer) {
void ContactsBox::Inner::leaveEvent(QEvent *e) { void ContactsBox::Inner::leaveEvent(QEvent *e) {
_mouseSel = false; _mouseSel = false;
setMouseTracking(false); setMouseTracking(false);
if (_newItemSel || _sel || _filteredSel >= 0 || _byUsernameSel >= 0) { if (_sel || _filteredSel >= 0 || _byUsernameSel >= 0) {
updateSelectedRow(); updateSelectedRow();
_sel = 0; _sel = 0;
_newItemSel = false;
_filteredSel = _byUsernameSel = -1; _filteredSel = _byUsernameSel = -1;
} }
} }
@ -1316,10 +1314,6 @@ void ContactsBox::Inner::chooseParticipant() {
} else { } else {
PeerData *peer = 0; PeerData *peer = 0;
if (_filter.isEmpty()) { if (_filter.isEmpty()) {
if (_newItemSel) {
emit addRequested();
return;
}
if (_byUsernameSel >= 0 && _byUsernameSel < _byUsername.size()) { if (_byUsernameSel >= 0 && _byUsernameSel < _byUsername.size()) {
peer = _byUsername[_byUsernameSel]; peer = _byUsername[_byUsernameSel];
} else if (_sel) { } else if (_sel) {
@ -1431,19 +1425,14 @@ void ContactsBox::Inner::updateSelection() {
QPoint p(mapFromGlobal(_lastMousePos)); QPoint p(mapFromGlobal(_lastMousePos));
bool in = parentWidget()->rect().contains(parentWidget()->mapFromGlobal(_lastMousePos)); bool in = parentWidget()->rect().contains(parentWidget()->mapFromGlobal(_lastMousePos));
if (_filter.isEmpty()) { if (_filter.isEmpty()) {
bool newItemSel = false; if (_aboutHeight) {
if (_newItemHeight) { p.setY(p.y() - _aboutHeight);
if (in && (p.y() >= 0) && (p.y() < _newItemHeight) && !(_chat && _membersFilter == MembersFilter::Admins)) {
newItemSel = true;
}
p.setY(p.y() - _newItemHeight);
} }
Dialogs::Row *newSel = (in && !newItemSel && (p.y() >= 0) && (p.y() < _contacts->size() * _rowHeight)) ? _contacts->rowAtY(p.y(), _rowHeight) : nullptr; Dialogs::Row *newSel = (in && (p.y() >= 0) && (p.y() < _contacts->size() * _rowHeight)) ? _contacts->rowAtY(p.y(), _rowHeight) : nullptr;
int32 byUsernameSel = (in && !newItemSel && p.y() >= _contacts->size() * _rowHeight + st::searchedBarHeight) ? ((p.y() - _contacts->size() * _rowHeight - st::searchedBarHeight) / _rowHeight) : -1; int32 byUsernameSel = (in && p.y() >= _contacts->size() * _rowHeight + st::searchedBarHeight) ? ((p.y() - _contacts->size() * _rowHeight - st::searchedBarHeight) / _rowHeight) : -1;
if (byUsernameSel >= _byUsername.size()) byUsernameSel = -1; if (byUsernameSel >= _byUsername.size()) byUsernameSel = -1;
if (newSel != _sel || byUsernameSel != _byUsernameSel || newItemSel != _newItemSel) { if (newSel != _sel || byUsernameSel != _byUsernameSel) {
updateSelectedRow(); updateSelectedRow();
_newItemSel = newItemSel;
_sel = newSel; _sel = newSel;
_byUsernameSel = byUsernameSel; _byUsernameSel = byUsernameSel;
updateSelectedRow(); updateSelectedRow();
@ -1678,10 +1667,10 @@ void ContactsBox::Inner::refresh() {
} }
if (!_contacts->isEmpty() || !_byUsername.isEmpty()) { if (!_contacts->isEmpty() || !_byUsername.isEmpty()) {
if (!_addContactLnk->isHidden()) _addContactLnk->hide(); if (!_addContactLnk->isHidden()) _addContactLnk->hide();
resize(width(), _newItemHeight + (_contacts->size() * _rowHeight) + (_byUsername.isEmpty() ? 0 : (st::searchedBarHeight + _byUsername.size() * _rowHeight))); resize(width(), _aboutHeight + (_contacts->size() * _rowHeight) + (_byUsername.isEmpty() ? 0 : (st::searchedBarHeight + _byUsername.size() * _rowHeight)));
} else if (_chat && _membersFilter == MembersFilter::Admins) { } else if (_chat && _membersFilter == MembersFilter::Admins) {
if (!_addContactLnk->isHidden()) _addContactLnk->hide(); if (!_addContactLnk->isHidden()) _addContactLnk->hide();
resize(width(), _newItemHeight + st::noContactsHeight); resize(width(), _aboutHeight + st::noContactsHeight);
} else { } else {
if (cContactsReceived() && !bot()) { if (cContactsReceived() && !bot()) {
if (_addContactLnk->isHidden()) _addContactLnk->show(); if (_addContactLnk->isHidden()) _addContactLnk->show();
@ -1740,7 +1729,7 @@ ContactsBox::Inner::~Inner() {
void ContactsBox::Inner::resizeEvent(QResizeEvent *e) { void ContactsBox::Inner::resizeEvent(QResizeEvent *e) {
_addContactLnk->move((width() - _addContactLnk->width()) / 2, (st::noContactsHeight + st::noContactsFont->height) / 2); _addContactLnk->move((width() - _addContactLnk->width()) / 2, (st::noContactsHeight + st::noContactsFont->height) / 2);
_allAdmins->moveToLeft(st::contactsPadding.left(), st::contactsNewItemTop); _allAdmins->moveToLeft(st::contactsPadding.left(), st::contactsAllAdminsTop);
} }
void ContactsBox::Inner::selectSkip(int32 dir) { void ContactsBox::Inner::selectSkip(int32 dir) {
@ -1752,20 +1741,16 @@ void ContactsBox::Inner::selectSkip(int32 dir) {
for (auto i = _contacts->cbegin(); *i != _sel; ++i) { for (auto i = _contacts->cbegin(); *i != _sel; ++i) {
++cur; ++cur;
} }
if (_newItemHeight) ++cur;
} else if (_byUsernameSel >= 0) { } else if (_byUsernameSel >= 0) {
cur = (_contacts->size() + _byUsernameSel); cur = (_contacts->size() + _byUsernameSel);
if (_newItemHeight) ++cur; } else {
} else if (!_newItemSel) {
cur = -1; cur = -1;
} }
cur += dir; cur += dir;
if (cur <= 0) { if (cur <= 0) {
_newItemSel = (_chat && _membersFilter == MembersFilter::Admins) ? false : (_newItemHeight ? true : false); _sel = (!_contacts->isEmpty()) ? *_contacts->cbegin() : nullptr;
_sel = (!_newItemHeight && !_contacts->isEmpty()) ? *_contacts->cbegin() : nullptr; _byUsernameSel = (_contacts->isEmpty() && !_byUsername.isEmpty()) ? 0 : -1;
_byUsernameSel = (!_newItemHeight && _contacts->isEmpty() && !_byUsername.isEmpty()) ? 0 : -1; } else if (cur >= _contacts->size()) {
} else if (cur >= _contacts->size() + (_newItemHeight ? 1 : 0)) {
_newItemSel = false;
if (_byUsername.isEmpty()) { if (_byUsername.isEmpty()) {
_sel = _contacts->isEmpty() ? nullptr : *(_contacts->cend() - 1); _sel = _contacts->isEmpty() ? nullptr : *(_contacts->cend() - 1);
_byUsernameSel = -1; _byUsernameSel = -1;
@ -1775,8 +1760,6 @@ void ContactsBox::Inner::selectSkip(int32 dir) {
if (_byUsernameSel >= _byUsername.size()) _byUsernameSel = _byUsername.size() - 1; if (_byUsernameSel >= _byUsername.size()) _byUsernameSel = _byUsername.size() - 1;
} }
} else { } else {
_newItemSel = false;
if (_newItemHeight) --cur;
for (auto i = _contacts->cbegin(); ; ++i) { for (auto i = _contacts->cbegin(); ; ++i) {
_sel = *i; _sel = *i;
if (!cur) { if (!cur) {
@ -1809,7 +1792,7 @@ void ContactsBox::Inner::selectSkip(int32 dir) {
} }
if (_byUsernameSel < 0) { if (_byUsernameSel < 0) {
if (!_contacts->isEmpty()) { if (!_contacts->isEmpty()) {
if (!_newItemSel && !_sel) _sel = *(_contacts->cend() - 1); if (!_sel) _sel = *(_contacts->cend() - 1);
if (_sel) { if (_sel) {
for (auto i = _contacts->cfind(_sel), b = _contacts->cbegin(); i != b && contactData(*i)->disabledChecked; --i) { for (auto i = _contacts->cfind(_sel), b = _contacts->cbegin(); i != b && contactData(*i)->disabledChecked; --i) {
_sel = *i; _sel = *i;
@ -1821,12 +1804,10 @@ void ContactsBox::Inner::selectSkip(int32 dir) {
} }
} }
} }
if (_newItemSel) { if (_sel) {
emit mustScrollTo(0, _newItemHeight); emit mustScrollTo(_aboutHeight + _sel->pos() * _rowHeight, _aboutHeight + (_sel->pos() + 1) * _rowHeight);
} else if (_sel) {
emit mustScrollTo(_newItemHeight + _sel->pos() * _rowHeight, _newItemHeight + (_sel->pos() + 1) * _rowHeight);
} else if (_byUsernameSel >= 0) { } else if (_byUsernameSel >= 0) {
emit mustScrollTo(_newItemHeight + (_contacts->size() + _byUsernameSel) * _rowHeight + st::searchedBarHeight, _newItemHeight + (_contacts->size() + _byUsernameSel + 1) * _rowHeight + st::searchedBarHeight); emit mustScrollTo(_aboutHeight + (_contacts->size() + _byUsernameSel) * _rowHeight + st::searchedBarHeight, _aboutHeight + (_contacts->size() + _byUsernameSel + 1) * _rowHeight + st::searchedBarHeight);
} }
} else { } else {
int cur = (_filteredSel >= 0) ? _filteredSel : ((_byUsernameSel >= 0) ? (_filtered.size() + _byUsernameSel) : -1); int cur = (_filteredSel >= 0) ? _filteredSel : ((_byUsernameSel >= 0) ? (_filtered.size() + _byUsernameSel) : -1);

View File

@ -91,6 +91,7 @@ private:
class Inner; class Inner;
ChildWidget<Inner> _inner; ChildWidget<Inner> _inner;
ChildWidget<Ui::WidgetSlideWrap<Ui::MultiSelect>> _select; ChildWidget<Ui::WidgetSlideWrap<Ui::MultiSelect>> _select;
ChildWidget<Ui::IconButton> _add = { nullptr };
ChildWidget<BoxButton> _next; ChildWidget<BoxButton> _next;
ChildWidget<BoxButton> _cancel; ChildWidget<BoxButton> _cancel;
@ -187,7 +188,6 @@ signals:
void mustScrollTo(int ymin, int ymax); void mustScrollTo(int ymin, int ymax);
void searchByUsername(); void searchByUsername();
void adminAdded(); void adminAdded();
void addRequested();
private slots: private slots:
void onDialogRowReplaced(Dialogs::Row *oldRow, Dialogs::Row *newRow); void onDialogRowReplaced(Dialogs::Row *oldRow, Dialogs::Row *newRow);
@ -252,9 +252,8 @@ private:
base::lambda_unique<void(PeerData *peer, bool selected)> _peerSelectedChangedCallback; base::lambda_unique<void(PeerData *peer, bool selected)> _peerSelectedChangedCallback;
int32 _rowHeight; int _rowHeight;
int _newItemHeight = 0; int _aboutHeight = 0;
bool _newItemSel = false;
ChatData *_chat = nullptr; ChatData *_chat = nullptr;
ChannelData *_channel = nullptr; ChannelData *_channel = nullptr;

View File

@ -28,13 +28,17 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwindow.h" #include "mainwindow.h"
#include "boxes/contactsbox.h" #include "boxes/contactsbox.h"
#include "boxes/confirmbox.h" #include "boxes/confirmbox.h"
#include "ui/buttons/icon_button.h"
#include "observer_peer.h" #include "observer_peer.h"
MembersBox::MembersBox(ChannelData *channel, MembersFilter filter) : ItemListBox(st::boxScroll) MembersBox::MembersBox(ChannelData *channel, MembersFilter filter) : ItemListBox(st::boxScroll)
, _inner(this, channel, filter) { , _inner(this, channel, filter) {
ItemListBox::init(_inner); ItemListBox::init(_inner);
connect(_inner, SIGNAL(addRequested()), this, SLOT(onAdd())); if (channel->amCreator() && (channel->membersCount() < (channel->isMegagroup() ? Global::MegagroupSizeMax() : Global::ChatSizeMax()) || (!channel->isMegagroup() && !channel->isPublic()) || filter == MembersFilter::Admins)) {
_add.create(this, st::contactsAdd);
_add->setClickedCallback([this] { onAdd(); });
}
connect(scrollArea(), SIGNAL(scrolled()), this, SLOT(onScroll())); connect(scrollArea(), SIGNAL(scrolled()), this, SLOT(onScroll()));
connect(_inner, SIGNAL(mustScrollTo(int, int)), scrollArea(), SLOT(scrollToY(int, int))); connect(_inner, SIGNAL(mustScrollTo(int, int)), scrollArea(), SLOT(scrollToY(int, int)));
@ -69,6 +73,10 @@ void MembersBox::paintEvent(QPaintEvent *e) {
void MembersBox::resizeEvent(QResizeEvent *e) { void MembersBox::resizeEvent(QResizeEvent *e) {
ItemListBox::resizeEvent(e); ItemListBox::resizeEvent(e);
_inner->resize(width(), _inner->height()); _inner->resize(width(), _inner->height());
if (_add) {
_add->moveToRight(st::contactsAddPosition.x(), height() - st::contactsAddPosition.y() - _add->height());
}
} }
void MembersBox::onScroll() { void MembersBox::onScroll() {
@ -99,8 +107,6 @@ void MembersBox::onAdminAdded() {
MembersBox::Inner::Inner(QWidget *parent, ChannelData *channel, MembersFilter filter) : TWidget(parent) MembersBox::Inner::Inner(QWidget *parent, ChannelData *channel, MembersFilter filter) : TWidget(parent)
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom()) , _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
, _newItemHeight((channel->amCreator() && (channel->membersCount() < (channel->isMegagroup() ? Global::MegagroupSizeMax() : Global::ChatSizeMax()) || (!channel->isMegagroup() && !channel->isPublic()) || filter == MembersFilter::Admins)) ? st::contactsNewItemHeight : 0)
, _newItemSel(false)
, _channel(channel) , _channel(channel)
, _filter(filter) , _filter(filter)
, _kickText(lang(lng_profile_kick)) , _kickText(lang(lng_profile_kick))
@ -148,17 +154,6 @@ void MembersBox::Inner::paintEvent(QPaintEvent *e) {
p.setPen(st::noContactsColor); p.setPen(st::noContactsColor);
p.drawText(QRect(0, 0, width(), st::noContactsHeight), lang(lng_contacts_loading), style::al_center); p.drawText(QRect(0, 0, width(), st::noContactsHeight), lang(lng_contacts_loading), style::al_center);
} else { } else {
if (_newItemHeight) {
p.fillRect(0, 0, width(), _newItemHeight, _newItemSel ? st::contactsBgOver : st::contactsBg);
st::contactsNewItemIcon.paint(p, 0, 0, width());
p.setFont(st::contactsNameFont);
p.setPen(st::contactsNewItemFg);
p.drawTextLeft(st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left(), st::contactsNewItemTop, width(), lang(_filter == MembersFilter::Admins ? lng_channel_add_admins : lng_channel_add_members));
yFrom -= _newItemHeight;
yTo -= _newItemHeight;
p.translate(0, _newItemHeight);
}
int32 from = floorclamp(yFrom, _rowHeight, 0, _rows.size()); int32 from = floorclamp(yFrom, _rowHeight, 0, _rows.size());
int32 to = ceilclamp(yTo, _rowHeight, 0, _rows.size()); int32 to = ceilclamp(yTo, _rowHeight, 0, _rows.size());
p.translate(0, from * _rowHeight); p.translate(0, from * _rowHeight);
@ -271,19 +266,16 @@ void MembersBox::Inner::selectSkip(int32 dir) {
_mouseSel = false; _mouseSel = false;
int cur = -1; int cur = -1;
if (_newItemHeight && _newItemSel) { if (_sel >= 0) {
cur = 0; cur = _sel;
} else if (_sel >= 0) {
cur = _sel + (_newItemHeight ? 1 : 0);
} }
cur += dir; cur += dir;
if (cur <= 0) { if (cur <= 0) {
_newItemSel = _newItemHeight ? true : false; _sel = _rows.isEmpty() ? -1 : 0;
_sel = (_newItemSel || _rows.isEmpty()) ? -1 : 0; } else if (cur >= _rows.size()) {
} else if (cur >= _rows.size() + (_newItemHeight ? 1 : 0)) {
_sel = -1; _sel = -1;
} else { } else {
_sel = cur - (_newItemHeight ? 1 : 0); _sel = cur;
} }
if (dir > 0) { if (dir > 0) {
if (_sel < 0 || _sel >= _rows.size()) { if (_sel < 0 || _sel >= _rows.size()) {
@ -291,13 +283,11 @@ void MembersBox::Inner::selectSkip(int32 dir) {
} }
} else { } else {
if (!_rows.isEmpty()) { if (!_rows.isEmpty()) {
if (_sel < 0 && !_newItemSel) _sel = _rows.size() - 1; if (_sel < 0) _sel = _rows.size() - 1;
} }
} }
if (_newItemSel) { if (_sel >= 0) {
emit mustScrollTo(0, _newItemHeight); emit mustScrollTo(_sel * _rowHeight, (_sel + 1) * _rowHeight);
} else if (_sel >= 0) {
emit mustScrollTo(_newItemHeight + _sel * _rowHeight, _newItemHeight + (_sel + 1) * _rowHeight);
} }
update(); update();
@ -318,10 +308,10 @@ void MembersBox::Inner::loadProfilePhotos(int32 yFrom) {
if (yFrom < 0) yFrom = 0; if (yFrom < 0) yFrom = 0;
if (!_rows.isEmpty()) { if (!_rows.isEmpty()) {
int32 from = (yFrom - _newItemHeight) / _rowHeight; int32 from = yFrom / _rowHeight;
if (from < 0) from = 0; if (from < 0) from = 0;
if (from < _rows.size()) { if (from < _rows.size()) {
int32 to = ((yTo - _newItemHeight) / _rowHeight) + 1; int32 to = (yTo / _rowHeight) + 1;
if (to > _rows.size()) to = _rows.size(); if (to > _rows.size()) to = _rows.size();
for (; from < to; ++from) { for (; from < to; ++from) {
@ -332,10 +322,6 @@ void MembersBox::Inner::loadProfilePhotos(int32 yFrom) {
} }
void MembersBox::Inner::chooseParticipant() { void MembersBox::Inner::chooseParticipant() {
if (_newItemSel) {
emit addRequested();
return;
}
if (_sel < 0 || _sel >= _rows.size()) return; if (_sel < 0 || _sel >= _rows.size()) return;
if (PeerData *peer = _rows[_sel]) { if (PeerData *peer = _rows[_sel]) {
Ui::hideLayer(); Ui::hideLayer();
@ -353,7 +339,7 @@ void MembersBox::Inner::refresh() {
if (_filter != MembersFilter::Recent || (_rows.size() >= _channel->membersCount() && _rows.size() < Global::ChatSizeMax())) { if (_filter != MembersFilter::Recent || (_rows.size() >= _channel->membersCount() && _rows.size() < Global::ChatSizeMax())) {
_aboutHeight = 0; _aboutHeight = 0;
} }
resize(width(), st::membersPadding.top() + _newItemHeight + _rows.size() * _rowHeight + st::membersPadding.bottom() + _aboutHeight); resize(width(), st::membersPadding.top() + _rows.size() * _rowHeight + st::membersPadding.bottom() + _aboutHeight);
} }
update(); update();
} }
@ -378,7 +364,6 @@ MembersAlreadyIn MembersBox::Inner::already() const {
void MembersBox::Inner::clearSel() { void MembersBox::Inner::clearSel() {
updateSelectedRow(); updateSelectedRow();
_newItemSel = false;
_sel = _kickSel = _kickDown = -1; _sel = _kickSel = _kickDown = -1;
_lastMousePos = QCursor::pos(); _lastMousePos = QCursor::pos();
updateSel(); updateSel();
@ -425,15 +410,13 @@ void MembersBox::Inner::updateSel() {
QPoint p(mapFromGlobal(_lastMousePos)); QPoint p(mapFromGlobal(_lastMousePos));
p.setY(p.y() - st::membersPadding.top()); p.setY(p.y() - st::membersPadding.top());
bool in = parentWidget()->rect().contains(parentWidget()->mapFromGlobal(_lastMousePos)); bool in = parentWidget()->rect().contains(parentWidget()->mapFromGlobal(_lastMousePos));
bool newItemSel = (in && p.y() >= 0 && p.y() < _newItemHeight); int32 newSel = (in && p.y() >= 0 && p.y() < _rows.size() * _rowHeight) ? (p.y() / _rowHeight) : -1;
int32 newSel = (in && !newItemSel && p.y() >= _newItemHeight && p.y() < _newItemHeight + _rows.size() * _rowHeight) ? ((p.y() - _newItemHeight) / _rowHeight) : -1;
int32 newKickSel = newSel; int32 newKickSel = newSel;
if (newSel >= 0 && (!data(newSel)->canKick || !QRect(width() - _kickWidth - st::contactsPadding.right() - st::contactsCheckPosition.x(), _newItemHeight + newSel * _rowHeight + st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, _kickWidth, st::normalFont->height).contains(p))) { if (newSel >= 0 && (!data(newSel)->canKick || !QRect(width() - _kickWidth - st::contactsPadding.right() - st::contactsCheckPosition.x(), newSel * _rowHeight + st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, _kickWidth, st::normalFont->height).contains(p))) {
newKickSel = -1; newKickSel = -1;
} }
if (newSel != _sel || newKickSel != _kickSel || newItemSel != _newItemSel) { if (newSel != _sel || newKickSel != _kickSel) {
updateSelectedRow(); updateSelectedRow();
_newItemSel = newItemSel;
_sel = newSel; _sel = newSel;
_kickSel = newKickSel; _kickSel = newKickSel;
updateSelectedRow(); updateSelectedRow();
@ -446,11 +429,8 @@ void MembersBox::Inner::peerUpdated(PeerData *peer) {
} }
void MembersBox::Inner::updateSelectedRow() { void MembersBox::Inner::updateSelectedRow() {
if (_newItemSel) {
update(0, st::membersPadding.top(), width(), _newItemHeight);
}
if (_sel >= 0) { if (_sel >= 0) {
update(0, st::membersPadding.top() + _newItemHeight + _sel * _rowHeight, width(), _rowHeight); update(0, st::membersPadding.top() + _sel * _rowHeight, width(), _rowHeight);
} }
} }

View File

@ -42,7 +42,6 @@ public:
public slots: public slots:
void onScroll(); void onScroll();
void onAdd();
void onAdminAdded(); void onAdminAdded();
protected: protected:
@ -51,8 +50,11 @@ protected:
void resizeEvent(QResizeEvent *e) override; void resizeEvent(QResizeEvent *e) override;
private: private:
void onAdd();
class Inner; class Inner;
ChildWidget<Inner> _inner; ChildWidget<Inner> _inner;
ChildWidget<Ui::IconButton> _add = { nullptr };
ContactsBox *_addBox = nullptr; ContactsBox *_addBox = nullptr;
@ -89,7 +91,6 @@ public:
signals: signals:
void mustScrollTo(int ymin, int ymax); void mustScrollTo(int ymin, int ymax);
void addRequested();
void loaded(); void loaded();
public slots: public slots:
@ -132,8 +133,7 @@ private:
void clear(); void clear();
int32 _rowHeight, _newItemHeight; int _rowHeight;
bool _newItemSel;
ChannelData *_channel; ChannelData *_channel;
MembersFilter _filter; MembersFilter _filter;

View File

@ -22,7 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "core/utils.h" #include "core/utils.h"
#define BETA_VERSION_MACRO (10019003ULL) #define BETA_VERSION_MACRO (10019004ULL)
constexpr int AppVersion = 10020; constexpr int AppVersion = 10020;
constexpr str_const AppVersionStr = "0.10.20"; constexpr str_const AppVersionStr = "0.10.20";

View File

@ -24,19 +24,16 @@ using "ui/widgets/widgets.style";
historyPaddingBottom: 10px; historyPaddingBottom: 10px;
historyToDown: icon {
{ "history_down_shadow", #00000040 },
{ "history_down_circle", #ffffff, point(2px, 1px) },
};
historyToDownPosition: point(12px, 10px); historyToDownPosition: point(12px, 10px);
historyToDownArrow: icon { historyToDownArrow: icon {
{ "history_down_arrow", #b9b9b9, point(14px, 19px) }, { "history_down_arrow", #b9b9b9, point(17px, 23px) },
}; };
historyToDownPaddingTop: 10px; historyToDownPaddingTop: 10px;
historyToDownBadgeFont: semiboldFont; historyToDownBadgeFont: semiboldFont;
historyToDownBadgeSize: 22px; historyToDownBadgeSize: 22px;
historyToDownShownAfter: 480px; historyToDownShownAfter: 480px;
historyToDownDuration: 150;
historyEmptyDog: icon {{ "history_empty_dog", #ffffff }}; historyEmptyDog: icon {{ "history_empty_dog", #ffffff }};
historyEmptySize: 128px; historyEmptySize: 128px;
@ -177,8 +174,8 @@ historyComposeButton: flatButton {
overTextTop: 12px; overTextTop: 12px;
downTextTop: 13px; downTextTop: 13px;
font: font(16px); font: semiboldFont;
overFont: font(16px); overFont: semiboldFont;
} }
historyUnblock: flatButton(historyComposeButton) { historyUnblock: flatButton(historyComposeButton) {
color: #d15948; color: #d15948;

View File

@ -4231,7 +4231,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
_canSendMessages = canSendMessages(_peer); _canSendMessages = canSendMessages(_peer);
if (_peer && _peer->isChannel()) { if (_peer && _peer->isChannel()) {
_peer->asChannel()->updateFull(); _peer->asChannel()->updateFull();
_joinChannel->setText(lang(_peer->isMegagroup() ? lng_group_invite_join : lng_channel_join)); _joinChannel->setText(lang(_peer->isMegagroup() ? lng_group_invite_join : lng_channel_join).toUpper());
} }
_unblockRequest = _reportSpamRequest = 0; _unblockRequest = _reportSpamRequest = 0;
@ -4371,7 +4371,7 @@ void HistoryWidget::updateFieldSubmitSettings() {
void HistoryWidget::updateNotifySettings() { void HistoryWidget::updateNotifySettings() {
if (!_peer || !_peer->isChannel()) return; if (!_peer || !_peer->isChannel()) return;
_muteUnmute->setText(lang(_history->mute() ? lng_channel_unmute : lng_channel_mute)); _muteUnmute->setText(lang(_history->mute() ? lng_channel_unmute : lng_channel_mute).toUpper());
if (_peer->notify != UnknownNotifySettings) { if (_peer->notify != UnknownNotifySettings) {
_silent->setChecked(_peer->notify != EmptyNotifySettings && (_peer->notify->flags & MTPDpeerNotifySettings::Flag::f_silent)); _silent->setChecked(_peer->notify != EmptyNotifySettings && (_peer->notify->flags & MTPDpeerNotifySettings::Flag::f_silent));
if (_silent->isHidden() && hasSilentToggle()) { if (_silent->isHidden() && hasSilentToggle()) {

View File

@ -86,14 +86,13 @@ void ScaleWidget::setScale(DBIScale newScale) {
} else if (newScale != dbisAuto && _auto->checked()) { } else if (newScale != dbisAuto && _auto->checked()) {
_auto->setChecked(false); _auto->setChecked(false);
} }
_newScale = newScale;
if (newScale == dbisAuto) newScale = cScreenScale(); if (newScale == dbisAuto) newScale = cScreenScale();
if (_scale->activeSection() != newScale - 1) { if (_scale->activeSection() != newScale - 1) {
_scale->setActiveSection(newScale - 1); _scale->setActiveSection(newScale - 1);
} }
if (cEvalScale(newScale) != cEvalScale(cRealScale())) { if (cEvalScale(newScale) != cEvalScale(cRealScale())) {
_newScale = newScale;
auto box = new ConfirmBox(lang(lng_settings_need_restart), lang(lng_settings_restart_now), st::defaultBoxButton, lang(lng_cancel)); auto box = new ConfirmBox(lang(lng_settings_need_restart), lang(lng_settings_restart_now), st::defaultBoxButton, lang(lng_cancel));
connect(box, SIGNAL(confirmed()), this, SLOT(onRestartNow())); connect(box, SIGNAL(confirmed()), this, SLOT(onRestartNow()));
connect(box, SIGNAL(cancelled()), this, SLOT(onCancel())); connect(box, SIGNAL(cancelled()), this, SLOT(onCancel()));

View File

@ -1191,14 +1191,14 @@ void StickerPanInner::mouseReleaseEvent(QMouseEvent *e) {
ClickHandlerPtr activated = ClickHandler::unpressed(); ClickHandlerPtr activated = ClickHandler::unpressed();
_lastMousePos = e->globalPos();
updateSelected();
if (_previewShown) { if (_previewShown) {
_previewShown = false; _previewShown = false;
return; return;
} }
_lastMousePos = e->globalPos();
updateSelected();
if (showingInlineItems()) { if (showingInlineItems()) {
if (_selected < 0 || _selected != pressed || !activated) { if (_selected < 0 || _selected != pressed || !activated) {
return; return;

View File

@ -51,7 +51,7 @@ stickersFeaturedFont: contactsNameFont;
stickersFeaturedPosition: point(16px, 6px); stickersFeaturedPosition: point(16px, 6px);
stickersFeaturedBadgeFont: semiboldFont; stickersFeaturedBadgeFont: semiboldFont;
stickersFeaturedBadgeSize: 21px; stickersFeaturedBadgeSize: 21px;
stickersFeaturedPen: contactsNewItemFg; stickersFeaturedPen: lightButtonFg;
stickersFeaturedUnreadBg: msgFileInBg; stickersFeaturedUnreadBg: msgFileInBg;
stickersFeaturedUnreadSize: 5px; stickersFeaturedUnreadSize: 5px;
stickersFeaturedUnreadSkip: 5px; stickersFeaturedUnreadSkip: 5px;

View File

@ -114,7 +114,7 @@ void HistoryDownButton::hideAnimated() {
void HistoryDownButton::toggleAnimated() { void HistoryDownButton::toggleAnimated() {
_shown = !_shown; _shown = !_shown;
float64 from = _shown ? 0. : 1., to = _shown ? 1. : 0.; float64 from = _shown ? 0. : 1., to = _shown ? 1. : 0.;
_a_show.start([this] { update(); }, from, to, st::historyAttachEmoji.duration); _a_show.start([this] { update(); }, from, to, st::historyToDownDuration);
} }
void HistoryDownButton::finishAnimation() { void HistoryDownButton::finishAnimation() {

View File

@ -112,24 +112,20 @@ void InnerDropdown::paintEvent(QPaintEvent *e) {
if (auto opacity = _a_opacity.current(ms, _hiding ? 0. : 1.)) { if (auto opacity = _a_opacity.current(ms, _hiding ? 0. : 1.)) {
p.drawImage(0, 0, _showAnimation->getFrame(_a_show.current(1.), opacity)); p.drawImage(0, 0, _showAnimation->getFrame(_a_show.current(1.), opacity));
} }
return;
} else if (_a_opacity.animating(ms)) { } else if (_a_opacity.animating(ms)) {
p.setOpacity(_a_opacity.current(0.)); p.setOpacity(_a_opacity.current(0.));
p.drawPixmap(0, 0, _cache); p.drawPixmap(0, 0, _cache);
return;
} else if (_hiding || isHidden()) { } else if (_hiding || isHidden()) {
hideFinished(); hideFinished();
return;
} else if (_showAnimation) { } else if (_showAnimation) {
p.drawImage(0, 0, _showAnimation->getFrame(1., 1.)); p.drawImage(0, 0, _showAnimation->getFrame(1., 1.));
_showAnimation.reset(); _showAnimation.reset();
showChildren(); showChildren();
return; } else {
auto inner = rect().marginsRemoved(_st.padding);
Shadow::paint(p, inner, width(), _st.shadow);
App::roundRect(p, inner, _st.bg, ImageRoundRadius::Small);
} }
auto inner = rect().marginsRemoved(_st.padding);
Shadow::paint(p, inner, width(), _st.shadow);
App::roundRect(p, inner, _st.bg, ImageRoundRadius::Small);
} }
void InnerDropdown::enterEvent(QEvent *e) { void InnerDropdown::enterEvent(QEvent *e) {
@ -269,9 +265,13 @@ QImage InnerDropdown::grabForPanelAnimation() {
void InnerDropdown::opacityAnimationCallback() { void InnerDropdown::opacityAnimationCallback() {
update(); update();
if (_hiding && !_a_opacity.animating()) { if (!_a_opacity.animating()) {
_hiding = false; if (_hiding) {
hideFinished(); _hiding = false;
hideFinished();
} else {
showChildren();
}
} }
} }

View File

@ -349,7 +349,7 @@ void MultiSelect::Inner::Item::setVisibleAnimated(bool visible) {
prepareCache(); prepareCache();
auto from = visible ? 0. : 1.; auto from = visible ? 0. : 1.;
auto to = visible ? 1. : 0.; auto to = visible ? 1. : 0.;
auto transition = visible ? anim::bumpy(1.125) : anim::linear; auto transition = visible ? anim::bumpy(1.0625) : anim::linear;
_visibility.start(_updateCallback, from, to, _st.duration, transition); _visibility.start(_updateCallback, from, to, _st.duration, transition);
} }

View File

@ -361,9 +361,13 @@ void PopupMenu::startShowAnimation() {
void PopupMenu::opacityAnimationCallback() { void PopupMenu::opacityAnimationCallback() {
update(); update();
if (_hiding && !_a_opacity.animating()) { if (!_a_opacity.animating()) {
_hiding = false; if (_hiding) {
hideFinished(); _hiding = false;
hideFinished();
} else {
showChildren();
}
} }
} }

View File

@ -323,3 +323,19 @@ defaultDropdownMenu: DropdownMenu {
} }
menu: defaultMenu; menu: defaultMenu;
} }
historyToDown: icon {
{ "history_down_shadow", #00000040 },
{ "history_down_circle", #ffffff, point(4px, 4px) },
};
contactsAddIcon: icon {
{ "history_down_shadow", #00000020 },
{ "history_down_circle", activeButtonBg, point(4px, 4px) },
{ "contacts_add", activeButtonFg, point(18px, 18px) },
};
contactsAddIconOver: icon {
{ "history_down_shadow", #00000020 },
{ "history_down_circle", activeButtonBgOver, point(4px, 4px) },
{ "contacts_add", activeButtonFg, point(18px, 18px) },
};

View File

@ -3,4 +3,4 @@ AppVersionStrMajor 0.10
AppVersionStrSmall 0.10.20 AppVersionStrSmall 0.10.20
AppVersionStr 0.10.20 AppVersionStr 0.10.20
AlphaChannel 0 AlphaChannel 0
BetaVersion 10019003 BetaVersion 10019004