Alpha 1.0.1: resize chats list with mouse press-and-drag.

Also fixed drag-n-drop images from Firefox in Windows.
Also some additional colors added to themes palette:
HistoryToDown button now has separate colors.
Windows title bar and buttons have separate active/inactive colors.
This commit is contained in:
John Preston 2017-01-16 16:27:11 +03:00
parent 47aa03ce37
commit 041e366df7
23 changed files with 185 additions and 80 deletions

View File

@ -104,15 +104,27 @@ tooltipFg: #5d6c80;
tooltipBorderFg: #c9d1db; tooltipBorderFg: #c9d1db;
// custom title bar for Windows and macOS // custom title bar for Windows and macOS
titleBg: windowBgOver;
titleShadow: #00000003; titleShadow: #00000003;
titleBg: windowBgOver;
titleBgActive: titleBg;
titleButtonBg: titleBg;
titleButtonFg: #ababab; titleButtonFg: #ababab;
titleButtonBgOver: #e5e5e5; titleButtonBgOver: #e5e5e5;
titleButtonFgOver: #9a9a9a; titleButtonFgOver: #9a9a9a;
titleButtonBgActive: titleButtonBg;
titleButtonFgActive: titleButtonFg;
titleButtonBgActiveOver: titleButtonBgOver;
titleButtonFgActiveOver: titleButtonFgOver;
titleButtonCloseBg: titleButtonBg;
titleButtonCloseFg: titleButtonFg;
titleButtonCloseBgOver: #e81123; titleButtonCloseBgOver: #e81123;
titleButtonCloseFgOver: windowFgActive; titleButtonCloseFgOver: windowFgActive;
titleFgActive: #3e3c3e; titleButtonCloseBgActive: titleButtonCloseBg;
titleButtonCloseFgActive: titleButtonCloseFg;
titleButtonCloseBgActiveOver: titleButtonCloseBgOver;
titleButtonCloseFgActiveOver: titleButtonCloseFgOver;
titleFg: #acacac; titleFg: #acacac;
titleFgActive: #3e3c3e;
// tray icon // tray icon
trayCounterBg: #f23c34; trayCounterBg: #f23c34;
@ -383,7 +395,13 @@ toastFg: windowFgActive;
reportSpamBg: emojiPanHeaderBg; reportSpamBg: emojiPanHeaderBg;
reportSpamFg: windowFg; reportSpamFg: windowFg;
historyToDownBg: windowBg;
historyToDownBgOver: windowBgOver;
historyToDownBgRipple: windowBgRipple;
historyToDownFg: menuIconFg;
historyToDownFgOver: menuIconFgOver;
historyToDownShadow: #00000040; historyToDownShadow: #00000040;
historyComposeAreaBg: msgInBg; historyComposeAreaBg: msgInBg;
historyComposeAreaFg: historyTextInFg; historyComposeAreaFg: historyTextInFg;
historyComposeAreaFgService: msgInDateFg; historyComposeAreaFgService: msgInDateFg;

View File

@ -89,15 +89,27 @@ sliderBgActive: windowBgActive;
tooltipBg: #eef2f5; tooltipBg: #eef2f5;
tooltipFg: #5d6c80; tooltipFg: #5d6c80;
tooltipBorderFg: #c9d1db; tooltipBorderFg: #c9d1db;
titleBg: windowBgOver;
titleShadow: #00000003; titleShadow: #00000003;
titleBg: windowBgOver;
titleBgActive: titleBg;
titleButtonBg: titleBg;
titleButtonFg: #ababab; titleButtonFg: #ababab;
titleButtonBgOver: #e5e5e5; titleButtonBgOver: #e5e5e5;
titleButtonFgOver: #9a9a9a; titleButtonFgOver: #9a9a9a;
titleButtonBgActive: titleButtonBg;
titleButtonFgActive: titleButtonFg;
titleButtonBgActiveOver: titleButtonBgOver;
titleButtonFgActiveOver: titleButtonFgOver;
titleButtonCloseBg: titleButtonBg;
titleButtonCloseFg: titleButtonFg;
titleButtonCloseBgOver: #e81123; titleButtonCloseBgOver: #e81123;
titleButtonCloseFgOver: windowFgActive; titleButtonCloseFgOver: windowFgActive;
titleFgActive: #3e3c3e; titleButtonCloseBgActive: titleButtonCloseBg;
titleButtonCloseFgActive: titleButtonCloseFg;
titleButtonCloseBgActiveOver: titleButtonCloseBgOver;
titleButtonCloseFgActiveOver: titleButtonCloseFgOver;
titleFg: #acacac; titleFg: #acacac;
titleFgActive: #3e3c3e;
trayCounterBg: #f23c34; trayCounterBg: #f23c34;
trayCounterBgMute: #888888; trayCounterBgMute: #888888;
trayCounterFg: #ffffff; trayCounterFg: #ffffff;
@ -328,6 +340,11 @@ toastBg: #000000b2;
toastFg: windowFgActive; toastFg: windowFgActive;
reportSpamBg: emojiPanHeaderBg; reportSpamBg: emojiPanHeaderBg;
reportSpamFg: windowFg; reportSpamFg: windowFg;
historyToDownBg: windowBg;
historyToDownBgOver: windowBgOver;
historyToDownBgRipple: windowBgRipple;
historyToDownFg: menuIconFg;
historyToDownFgOver: menuIconFgOver;
historyToDownShadow: #00000040; historyToDownShadow: #00000040;
historyComposeAreaBg: msgInBg; historyComposeAreaBg: msgInBg;
historyComposeAreaFg: historyTextInFg; historyComposeAreaFg: historyTextInFg;

View File

@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0 FILEVERSION 1,0,1,0
PRODUCTVERSION 1,0,0,0 PRODUCTVERSION 1,0,1,0
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", "1.0.0.0" VALUE "FileVersion", "1.0.1.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "LegalCopyright", "Copyright (C) 2014-2017"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "1.0.0.0" VALUE "ProductVersion", "1.0.1.0"
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 1,0,0,0 FILEVERSION 1,0,1,0
PRODUCTVERSION 1,0,0,0 PRODUCTVERSION 1,0,1,0
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", "1.0.0.0" VALUE "FileVersion", "1.0.1.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "LegalCopyright", "Copyright (C) 2014-2017"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "1.0.0.0" VALUE "ProductVersion", "1.0.1.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -407,7 +407,7 @@ namespace {
data->inputUser = MTP_inputUser(d.vid, MTP_long(0)); data->inputUser = MTP_inputUser(d.vid, MTP_long(0));
data->setName(lang(lng_deleted), QString(), QString(), QString()); data->setName(lang(lng_deleted), QString(), QString(), QString());
data->setPhoto(MTP_userProfilePhotoEmpty()); data->setPhoto(MTP_userProfilePhotoEmpty());
data->access = UserNoAccess; data->setIsInaccessible();
data->flags = 0; data->flags = 0;
data->setBotInfoVersion(-1); data->setBotInfoVersion(-1);
status = &emptyStatus; status = &emptyStatus;
@ -430,8 +430,8 @@ namespace {
data->input = MTP_inputPeerSelf(); data->input = MTP_inputPeerSelf();
data->inputUser = MTP_inputUserSelf(); data->inputUser = MTP_inputUserSelf();
} else if (!d.has_access_hash()) { } else if (!d.has_access_hash()) {
data->input = MTP_inputPeerUser(d.vid, MTP_long((data->access == UserNoAccess) ? 0 : data->access)); data->input = MTP_inputPeerUser(d.vid, MTP_long(data->isInaccessible() ? 0 : data->access));
data->inputUser = MTP_inputUser(d.vid, MTP_long((data->access == UserNoAccess) ? 0 : data->access)); data->inputUser = MTP_inputUser(d.vid, MTP_long(data->isInaccessible() ? 0 : data->access));
} else { } else {
data->input = MTP_inputPeerUser(d.vid, d.vaccess_hash); data->input = MTP_inputPeerUser(d.vid, d.vaccess_hash);
data->inputUser = MTP_inputUser(d.vid, d.vaccess_hash); data->inputUser = MTP_inputUser(d.vid, d.vaccess_hash);
@ -449,7 +449,7 @@ namespace {
} }
data->setName(lang(lng_deleted), QString(), QString(), QString()); data->setName(lang(lng_deleted), QString(), QString(), QString());
data->setPhoto(MTP_userProfilePhotoEmpty()); data->setPhoto(MTP_userProfilePhotoEmpty());
data->access = UserNoAccess; data->setIsInaccessible();
status = &emptyStatus; status = &emptyStatus;
} else { } else {
// apply first_name and last_name from minimal user only if we don't have // apply first_name and last_name from minimal user only if we don't have

View File

@ -1069,8 +1069,8 @@ void AppClass::checkMapVersion() {
if (Local::oldMapVersion() < AppVersion) { if (Local::oldMapVersion() < AppVersion) {
if (Local::oldMapVersion()) { if (Local::oldMapVersion()) {
QString versionFeatures; QString versionFeatures;
if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000000) { if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000001) {
versionFeatures = langNewVersionText();//QString::fromUtf8("\xe2\x80\x94 Appoint admins in your supergroups from members list context menu\n\xe2\x80\x94 Bug fixes and other minor improvements"); versionFeatures = QString::fromUtf8("\xe2\x80\x94 Resize chats list with mouse press-and-drag\n\xe2\x80\x94 Drag-n-drop images from Firefox fixed in Windows\n\xe2\x80\x94 Bug fixes and other minor improvements");
} else if (!(cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000000) { } else if (!(cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000000) {
versionFeatures = langNewVersionText(); versionFeatures = langNewVersionText();
} else { } else {

View File

@ -426,7 +426,7 @@ SetupChannelBox::SetupChannelBox(QWidget*, ChannelData *channel, bool existing)
, _existing(existing) , _existing(existing)
, _public(this, qsl("channel_privacy"), 0, lang(channel->isMegagroup() ? lng_create_public_group_title : lng_create_public_channel_title), true, st::defaultBoxCheckbox) , _public(this, qsl("channel_privacy"), 0, lang(channel->isMegagroup() ? lng_create_public_group_title : lng_create_public_channel_title), true, st::defaultBoxCheckbox)
, _private(this, qsl("channel_privacy"), 1, lang(channel->isMegagroup() ? lng_create_private_group_title : lng_create_private_channel_title), false, st::defaultBoxCheckbox) , _private(this, qsl("channel_privacy"), 1, lang(channel->isMegagroup() ? lng_create_private_group_title : lng_create_private_channel_title), false, st::defaultBoxCheckbox)
, _aboutPublicWidth(width() - st::boxPadding.left() - st::boxButtonPadding.right() - st::newGroupPadding.left() - st::defaultBoxCheckbox.textPosition.x()) , _aboutPublicWidth(st::boxWideWidth - st::boxPadding.left() - st::boxButtonPadding.right() - st::newGroupPadding.left() - st::defaultBoxCheckbox.textPosition.x())
, _aboutPublic(st::defaultTextStyle, lang(channel->isMegagroup() ? lng_create_public_group_about : lng_create_public_channel_about), _defaultOptions, _aboutPublicWidth) , _aboutPublic(st::defaultTextStyle, lang(channel->isMegagroup() ? lng_create_public_group_about : lng_create_public_channel_about), _defaultOptions, _aboutPublicWidth)
, _aboutPrivate(st::defaultTextStyle, lang(channel->isMegagroup() ? lng_create_private_group_about : lng_create_private_channel_about), _defaultOptions, _aboutPublicWidth) , _aboutPrivate(st::defaultTextStyle, lang(channel->isMegagroup() ? lng_create_private_group_about : lng_create_private_channel_about), _defaultOptions, _aboutPublicWidth)
, _link(this, st::setupChannelLink, QString(), channel->username, true) { , _link(this, st::setupChannelLink, QString(), channel->username, true) {
@ -923,7 +923,7 @@ void EditNameTitleBox::onSaveChatDone(const MTPUpdates &updates) {
EditChannelBox::EditChannelBox(QWidget*, ChannelData *channel) EditChannelBox::EditChannelBox(QWidget*, ChannelData *channel)
: _channel(channel) : _channel(channel)
, _title(this, st::defaultInputField, lang(lng_dlg_new_channel_name), _channel->name) , _title(this, st::defaultInputField, lang(channel->isMegagroup() ? lng_dlg_new_group_name : lng_dlg_new_channel_name), _channel->name)
, _description(this, st::newGroupDescription, lang(lng_create_group_description), _channel->about()) , _description(this, st::newGroupDescription, lang(lng_create_group_description), _channel->about())
, _sign(this, lang(lng_edit_sign_messages), channel->addsSignature(), st::defaultBoxCheckbox) , _sign(this, lang(lng_edit_sign_messages), channel->addsSignature(), st::defaultBoxCheckbox)
, _publicLink(this, lang(channel->isPublic() ? lng_profile_edit_public_link : lng_profile_create_public_link), st::boxLinkButton) { , _publicLink(this, lang(channel->isPublic() ? lng_profile_edit_public_link : lng_profile_create_public_link), st::boxLinkButton) {

View File

@ -24,7 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#define BETA_VERSION_MACRO (0ULL) #define BETA_VERSION_MACRO (0ULL)
constexpr int AppVersion = 1000000; constexpr int AppVersion = 1000001;
constexpr str_const AppVersionStr = "1.0"; constexpr str_const AppVersionStr = "1.0.1";
constexpr bool AppAlphaVersion = false; constexpr bool AppAlphaVersion = true;
constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;

View File

@ -204,6 +204,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
bool listAllSuggestions = _filter.isEmpty(); bool listAllSuggestions = _filter.isEmpty();
if (_addInlineBots) { if (_addInlineBots) {
for_const (auto user, cRecentInlineBots()) { for_const (auto user, cRecentInlineBots()) {
if (user->isInaccessible()) continue;
if (!listAllSuggestions && filterNotPassedByUsername(user)) continue; if (!listAllSuggestions && filterNotPassedByUsername(user)) continue;
mrows.push_back(user); mrows.push_back(user);
++recentInlineBots; ++recentInlineBots;
@ -216,13 +217,15 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
if (App::api()) App::api()->requestFullPeer(_chat); if (App::api()) App::api()->requestFullPeer(_chat);
} else if (!_chat->participants.isEmpty()) { } else if (!_chat->participants.isEmpty()) {
for (auto i = _chat->participants.cbegin(), e = _chat->participants.cend(); i != e; ++i) { for (auto i = _chat->participants.cbegin(), e = _chat->participants.cend(); i != e; ++i) {
UserData *user = i.key(); auto user = i.key();
if (user->isInaccessible()) continue;
if (!listAllSuggestions && filterNotPassedByName(user)) continue; if (!listAllSuggestions && filterNotPassedByName(user)) continue;
if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue; if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue;
ordered.insertMulti(App::onlineForSort(user, now), user); ordered.insertMulti(App::onlineForSort(user, now), user);
} }
} }
for_const (auto user, _chat->lastAuthors) { for_const (auto user, _chat->lastAuthors) {
if (user->isInaccessible()) continue;
if (!listAllSuggestions && filterNotPassedByName(user)) continue; if (!listAllSuggestions && filterNotPassedByName(user)) continue;
if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue; if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue;
mrows.push_back(user); mrows.push_back(user);
@ -231,7 +234,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
} }
} }
if (!ordered.isEmpty()) { if (!ordered.isEmpty()) {
for (QMultiMap<int32, UserData*>::const_iterator i = ordered.cend(), b = ordered.cbegin(); i != b;) { for (auto i = ordered.cend(), b = ordered.cbegin(); i != b;) {
--i; --i;
mrows.push_back(i.value()); mrows.push_back(i.value());
} }
@ -243,6 +246,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
} else { } else {
mrows.reserve(mrows.size() + _channel->mgInfo->lastParticipants.size()); mrows.reserve(mrows.size() + _channel->mgInfo->lastParticipants.size());
for_const (auto user, _channel->mgInfo->lastParticipants) { for_const (auto user, _channel->mgInfo->lastParticipants) {
if (user->isInaccessible()) continue;
if (!listAllSuggestions && filterNotPassedByName(user)) continue; if (!listAllSuggestions && filterNotPassedByName(user)) continue;
if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue; if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue;
mrows.push_back(user); mrows.push_back(user);
@ -627,7 +631,7 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
p.setPen(selected ? st::mentionFgOverActive : st::mentionFgActive); p.setPen(selected ? st::mentionFgOverActive : st::mentionFgActive);
p.drawText(mentionleft + namewidth + st::mentionPadding.right(), i * st::mentionHeight + st::mentionTop + st::mentionFont->ascent, first); p.drawText(mentionleft + namewidth + st::mentionPadding.right(), i * st::mentionHeight + st::mentionTop + st::mentionFont->ascent, first);
if (!second.isEmpty()) { if (!second.isEmpty()) {
p.setPen((selected ? st::mentionFgOver : st::mentionFg)->p); p.setPen(selected ? st::mentionFgOver : st::mentionFg);
p.drawText(mentionleft + namewidth + st::mentionPadding.right() + firstwidth, i * st::mentionHeight + st::mentionTop + st::mentionFont->ascent, second); p.drawText(mentionleft + namewidth + st::mentionPadding.right() + firstwidth, i * st::mentionHeight + st::mentionTop + st::mentionFont->ascent, second);
} }
} else if (!_hrows->isEmpty()) { } else if (!_hrows->isEmpty()) {

View File

@ -44,8 +44,8 @@ historyResizeWidth: 6px;
historyPaddingBottom: 8px; historyPaddingBottom: 8px;
historyToDownPosition: point(12px, 10px); historyToDownPosition: point(12px, 10px);
historyToDownAbove: icon {{ "history_down_arrow", menuIconFg, point(17px, 23px) }}; historyToDownAbove: icon {{ "history_down_arrow", historyToDownFg, point(17px, 23px) }};
historyToDownAboveOver: icon {{ "history_down_arrow", menuIconFgOver, point(17px, 23px) }}; historyToDownAboveOver: icon {{ "history_down_arrow", historyToDownFgOver, point(17px, 23px) }};
historyToDownPaddingTop: 10px; historyToDownPaddingTop: 10px;
historyToDown: TwoIconButton { historyToDown: TwoIconButton {
width: 52px; width: 52px;
@ -60,7 +60,7 @@ historyToDown: TwoIconButton {
rippleAreaPosition: point(5px, 15px); rippleAreaPosition: point(5px, 15px);
rippleAreaSize: 42px; rippleAreaSize: 42px;
ripple: RippleAnimation(defaultRippleAnimation) { ripple: RippleAnimation(defaultRippleAnimation) {
color: windowBgRipple; color: historyToDownBgRipple;
} }
} }
historyToDownBadgeFont: semiboldFont; historyToDownBadgeFont: semiboldFont;

View File

@ -1272,7 +1272,8 @@ void HistoryMessage::draw(Painter &p, const QRect &r, TextSelection selection, T
p.setTextPalette(outbg ? st::outTextPalette : st::inTextPalette); p.setTextPalette(outbg ? st::outTextPalette : st::inTextPalette);
if (auto keyboard = inlineReplyKeyboard()) { auto keyboard = inlineReplyKeyboard();
if (keyboard) {
int h = st::msgBotKbButton.margin + keyboard->naturalHeight(); int h = st::msgBotKbButton.margin + keyboard->naturalHeight();
height -= h; height -= h;
int top = height + st::msgBotKbButton.margin - marginBottom(); int top = height + st::msgBotKbButton.margin - marginBottom();
@ -1290,7 +1291,7 @@ void HistoryMessage::draw(Painter &p, const QRect &r, TextSelection selection, T
auto top = marginTop(); auto top = marginTop();
auto r = QRect(left, top, width, height - top - marginBottom()); auto r = QRect(left, top, width, height - top - marginBottom());
auto skipTail = isAttachedToNext() || (_media && _media->skipBubbleTail()); auto skipTail = isAttachedToNext() || (_media && _media->skipBubbleTail()) || (keyboard != nullptr);
auto displayTail = skipTail ? HistoryLayout::BubbleTail::None : (outbg && !Adaptive::ChatWide()) ? HistoryLayout::BubbleTail::Right : HistoryLayout::BubbleTail::Left; auto displayTail = skipTail ? HistoryLayout::BubbleTail::None : (outbg && !Adaptive::ChatWide()) ? HistoryLayout::BubbleTail::Right : HistoryLayout::BubbleTail::Left;
HistoryLayout::paintBubble(p, r, _history->width, selected, outbg, displayTail); HistoryLayout::paintBubble(p, r, _history->width, selected, outbg, displayTail);

View File

@ -425,6 +425,7 @@ void LayerStackWidget::onLayerClosed(LayerWidget *layer) {
if (_layers.size() == 1) { if (_layers.size() == 1) {
hideCurrent(); hideCurrent();
} else { } else {
if (layer->inFocusChain()) setFocus();
layer->hide(); layer->hide();
_layers.pop_back(); _layers.pop_back();
layer = currentLayer(); layer = currentLayer();
@ -527,6 +528,7 @@ void LayerStackWidget::showBox(object_ptr<BoxContent> box) {
_layers.pop_front(); _layers.pop_front();
removingLayer->setClosing(); removingLayer->setClosing();
if (removingLayer->inFocusChain()) setFocus();
removingLayer->hide(); removingLayer->hide();
removingLayer->deleteLater(); removingLayer->deleteLater();
} }
@ -616,6 +618,7 @@ void LayerStackWidget::appendBox(object_ptr<BoxContent> box) {
LayerWidget *LayerStackWidget::pushBox(object_ptr<BoxContent> box) { LayerWidget *LayerStackWidget::pushBox(object_ptr<BoxContent> box) {
auto oldLayer = currentLayer(); auto oldLayer = currentLayer();
if (oldLayer) { if (oldLayer) {
if (oldLayer->inFocusChain()) setFocus();
oldLayer->hide(); oldLayer->hide();
} }
auto layer = object_ptr<AbstractBox>(this, std_::move(box)); auto layer = object_ptr<AbstractBox>(this, std_::move(box));
@ -649,6 +652,7 @@ void LayerStackWidget::prependBox(object_ptr<BoxContent> box) {
void LayerStackWidget::clearLayers() { void LayerStackWidget::clearLayers() {
for (auto layer : base::take(_layers)) { for (auto layer : base::take(_layers)) {
layer->setClosing(); layer->setClosing();
if (layer->inFocusChain()) setFocus();
layer->hide(); layer->hide();
layer->deleteLater(); layer->deleteLater();
} }

View File

@ -3885,8 +3885,8 @@ PeerData *_readPeer(FileReadDescriptor &from, int32 fileVersion = 0) {
user->input = MTP_inputPeerSelf(); user->input = MTP_inputPeerSelf();
user->inputUser = MTP_inputUserSelf(); user->inputUser = MTP_inputUserSelf();
} else { } else {
user->input = MTP_inputPeerUser(MTP_int(peerToUser(user->id)), MTP_long((user->access == UserNoAccess) ? 0 : user->access)); user->input = MTP_inputPeerUser(MTP_int(peerToUser(user->id)), MTP_long(user->isInaccessible() ? 0 : user->access));
user->inputUser = MTP_inputUser(MTP_int(peerToUser(user->id)), MTP_long((user->access == UserNoAccess) ? 0 : user->access)); user->inputUser = MTP_inputUser(MTP_int(peerToUser(user->id)), MTP_long(user->isInaccessible() ? 0 : user->access));
} }
user->setUserpic(photoLoc.isNull() ? ImagePtr() : ImagePtr(photoLoc)); user->setUserpic(photoLoc.isNull() ? ImagePtr() : ImagePtr(photoLoc));

View File

@ -191,7 +191,7 @@ MainWidget::MainWidget(QWidget *parent) : TWidget(parent)
bool MainWidget::onForward(const PeerId &peer, ForwardWhatMessages what) { bool MainWidget::onForward(const PeerId &peer, ForwardWhatMessages what) {
PeerData *p = App::peer(peer); PeerData *p = App::peer(peer);
if (!peer || (p->isChannel() && !p->asChannel()->canPublish() && p->asChannel()->isBroadcast()) || (p->isChat() && !p->asChat()->canWrite()) || (p->isUser() && p->asUser()->access == UserNoAccess)) { if (!peer || (p->isChannel() && !p->asChannel()->canPublish() && p->asChannel()->isBroadcast()) || (p->isChat() && !p->asChat()->canWrite()) || (p->isUser() && p->asUser()->isInaccessible())) {
Ui::show(Box<InformBox>(lang(lng_forward_cant))); Ui::show(Box<InformBox>(lang(lng_forward_cant)));
return false; return false;
} }
@ -226,7 +226,7 @@ bool MainWidget::onForward(const PeerId &peer, ForwardWhatMessages what) {
bool MainWidget::onShareUrl(const PeerId &peer, const QString &url, const QString &text) { bool MainWidget::onShareUrl(const PeerId &peer, const QString &url, const QString &text) {
PeerData *p = App::peer(peer); PeerData *p = App::peer(peer);
if (!peer || (p->isChannel() && !p->asChannel()->canPublish() && p->asChannel()->isBroadcast()) || (p->isChat() && !p->asChat()->canWrite()) || (p->isUser() && p->asUser()->access == UserNoAccess)) { if (!peer || (p->isChannel() && !p->asChannel()->canPublish() && p->asChannel()->isBroadcast()) || (p->isChat() && !p->asChat()->canWrite()) || (p->isUser() && p->asUser()->isInaccessible())) {
Ui::show(Box<InformBox>(lang(lng_share_cant))); Ui::show(Box<InformBox>(lang(lng_share_cant)));
return false; return false;
} }
@ -246,7 +246,7 @@ bool MainWidget::onShareUrl(const PeerId &peer, const QString &url, const QStrin
bool MainWidget::onInlineSwitchChosen(const PeerId &peer, const QString &botAndQuery) { bool MainWidget::onInlineSwitchChosen(const PeerId &peer, const QString &botAndQuery) {
PeerData *p = App::peer(peer); PeerData *p = App::peer(peer);
if (!peer || (p->isChannel() && !p->asChannel()->canPublish() && p->asChannel()->isBroadcast()) || (p->isChat() && !p->asChat()->canWrite()) || (p->isUser() && p->asUser()->access == UserNoAccess)) { if (!peer || (p->isChannel() && !p->asChannel()->canPublish() && p->asChannel()->isBroadcast()) || (p->isChat() && !p->asChat()->canWrite()) || (p->isUser() && p->asUser()->isInaccessible())) {
Ui::show(Box<InformBox>(lang(lng_inline_switch_cant))); Ui::show(Box<InformBox>(lang(lng_inline_switch_cant)));
return false; return false;
} }
@ -2062,7 +2062,7 @@ void MainWidget::fillPeerMenu(PeerData *peer, base::lambda<QAction*(const QStrin
if (auto user = peer->asUser()) { if (auto user = peer->asUser()) {
callback(lang(lng_profile_delete_conversation), std_::move(deleteAndLeaveHandler)); callback(lang(lng_profile_delete_conversation), std_::move(deleteAndLeaveHandler));
callback(lang(lng_profile_clear_history), std_::move(clearHistoryHandler)); callback(lang(lng_profile_clear_history), std_::move(clearHistoryHandler));
if (user->access != UserNoAccess && user != App::self()) { if (!user->isInaccessible() && user != App::self()) {
auto blockSubscription = MakeShared<base::Subscription>(); auto blockSubscription = MakeShared<base::Subscription>();
auto blockAction = callback(lang(user->isBlocked() ? (user->botInfo ? lng_profile_unblock_bot : lng_profile_unblock_user) : (user->botInfo ? lng_profile_block_bot : lng_profile_block_user)), [user, blockSubscription] { auto blockAction = callback(lang(user->isBlocked() ? (user->botInfo ? lng_profile_unblock_bot : lng_profile_unblock_user) : (user->botInfo ? lng_profile_block_bot : lng_profile_block_user)), [user, blockSubscription] {
auto willBeBlocked = !user->isBlocked(); auto willBeBlocked = !user->isBlocked();

View File

@ -59,11 +59,11 @@ TitleWidget::TitleWidget(MainWindow *parent, int height) : Window::TitleWidget(p
void TitleWidget::paintEvent(QPaintEvent *e) { void TitleWidget::paintEvent(QPaintEvent *e) {
Painter p(this); Painter p(this);
p.fillRect(rect(), st::titleBg); auto active = isActiveWindow();
p.fillRect(rect(), active ? st::titleBgActive : st::titleBg);
p.setPen(isActiveWindow() ? st::titleFgActive : st::titleFg);
p.setFont(_font); p.setFont(_font);
p.setPen(active ? st::titleFgActive : st::titleFg);
p.drawText(rect(), static_cast<MainWindow*>(parentWidget())->titleText(), style::al_center); p.drawText(rect(), static_cast<MainWindow*>(parentWidget())->titleText(), style::al_center);
} }
@ -121,7 +121,7 @@ QImage PreviewWindowSystemButton(QColor inner, QColor border) {
void PreviewWindowTitle(Painter &p, const style::palette &palette, QRect body, int titleHeight, int outerWidth) { void PreviewWindowTitle(Painter &p, const style::palette &palette, QRect body, int titleHeight, int outerWidth) {
auto titleRect = QRect(body.x(), body.y() - titleHeight, body.width(), titleHeight); auto titleRect = QRect(body.x(), body.y() - titleHeight, body.width(), titleHeight);
p.fillRect(titleRect, QColor(0, 0, 0)); p.fillRect(titleRect, QColor(0, 0, 0));
p.fillRect(titleRect, st::titleBg[palette]); p.fillRect(titleRect, st::titleBgActive[palette]);
p.fillRect(titleRect.x(), titleRect.y() + titleRect.height() - st::lineWidth, titleRect.width(), st::lineWidth, st::titleShadow[palette]); p.fillRect(titleRect.x(), titleRect.y() + titleRect.height() - st::lineWidth, titleRect.width(), st::lineWidth, st::titleShadow[palette]);
auto useSystemFont = false; auto useSystemFont = false;

View File

@ -661,16 +661,19 @@ int32 MainWindow::screenNameChecksum(const QString &name) const {
} }
void MainWindow::psRefreshTaskbarIcon() { void MainWindow::psRefreshTaskbarIcon() {
QWidget *w = new QWidget(this); auto refresher = object_ptr<QWidget>(this);
w->setWindowFlags(static_cast<Qt::WindowFlags>(Qt::Tool) | Qt::FramelessWindowHint); auto guard = base::scope_guard([&refresher] {
w->setGeometry(x() + 1, y() + 1, 1, 1); refresher.destroy();
QPalette p(w->palette()); });
p.setColor(QPalette::Background, st::titleBg->c); refresher->setWindowFlags(static_cast<Qt::WindowFlags>(Qt::Tool) | Qt::FramelessWindowHint);
QWindow *wnd = w->windowHandle(); refresher->setGeometry(x() + 1, y() + 1, 1, 1);
w->setPalette(p); auto palette = refresher->palette();
w->show(); palette.setColor(QPalette::Background, (isActiveWindow() ? st::titleBgActive : st::titleBg)->c);
w->activateWindow(); refresher->setPalette(palette);
delete w; refresher->show();
refresher->activateWindow();
updateIconCounters();
} }
void MainWindow::psTrayMenuUpdated() { void MainWindow::psTrayMenuUpdated() {

View File

@ -32,14 +32,14 @@ TitleWidget::TitleWidget(QWidget *parent) : Window::TitleWidget(parent)
, _maximizeRestore(this, st::titleButtonMaximize) , _maximizeRestore(this, st::titleButtonMaximize)
, _close(this, st::titleButtonClose) , _close(this, st::titleButtonClose)
, _shadow(this, st::titleShadow) , _shadow(this, st::titleShadow)
, _maximized(parent->window()->windowState() & Qt::WindowMaximized) { , _maximizedState(parent->window()->windowState() & Qt::WindowMaximized) {
_minimize->setClickedCallback([this]() { _minimize->setClickedCallback([this]() {
window()->setWindowState(Qt::WindowMinimized); window()->setWindowState(Qt::WindowMinimized);
_minimize->clearState(); _minimize->clearState();
}); });
_minimize->setPointerCursor(false); _minimize->setPointerCursor(false);
_maximizeRestore->setClickedCallback([this]() { _maximizeRestore->setClickedCallback([this]() {
window()->setWindowState(_maximized ? Qt::WindowNoState : Qt::WindowMaximized); window()->setWindowState(_maximizedState ? Qt::WindowNoState : Qt::WindowMaximized);
_maximizeRestore->clearState(); _maximizeRestore->clearState();
}); });
_maximizeRestore->setPointerCursor(false); _maximizeRestore->setPointerCursor(false);
@ -55,12 +55,18 @@ TitleWidget::TitleWidget(QWidget *parent) : Window::TitleWidget(parent)
void TitleWidget::init() { void TitleWidget::init() {
connect(window()->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(onWindowStateChanged(Qt::WindowState))); connect(window()->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(onWindowStateChanged(Qt::WindowState)));
_maximized = (window()->windowState() & Qt::WindowMaximized); _maximizedState = (window()->windowState() & Qt::WindowMaximized);
updateMaximizeRestoreButton(); _activeState = isActiveWindow();
updateButtonsState();
} }
void TitleWidget::paintEvent(QPaintEvent *e) { void TitleWidget::paintEvent(QPaintEvent *e) {
Painter(this).fillRect(rect(), st::titleBg); auto active = isActiveWindow();
if (_activeState != active) {
_activeState = active;
updateButtonsState();
}
Painter(this).fillRect(rect(), active ? st::titleBgActive : st::titleBg);
} }
void TitleWidget::updateControlsPosition() { void TitleWidget::updateControlsPosition() {
@ -84,18 +90,20 @@ void TitleWidget::onWindowStateChanged(Qt::WindowState state) {
if (state == Qt::WindowMinimized) return; if (state == Qt::WindowMinimized) return;
auto maximized = (state == Qt::WindowMaximized); auto maximized = (state == Qt::WindowMaximized);
if (_maximized != maximized) { if (_maximizedState != maximized) {
_maximized = maximized; _maximizedState = maximized;
updateMaximizeRestoreButton(); updateButtonsState();
} }
} }
void TitleWidget::updateMaximizeRestoreButton() { void TitleWidget::updateButtonsState() {
if (_maximized) { _minimize->setIconOverride(_activeState ? &st::titleButtonMinimizeIconActive : nullptr, _activeState ? &st::titleButtonMinimizeIconActiveOver : nullptr);
_maximizeRestore->setIconOverride(&st::titleButtonRestoreIcon, &st::titleButtonRestoreIconOver); if (_maximizedState) {
_maximizeRestore->setIconOverride(_activeState ? &st::titleButtonRestoreIconActive : &st::titleButtonRestoreIcon, _activeState ? &st::titleButtonRestoreIconActiveOver : &st::titleButtonRestoreIconOver);
} else { } else {
_maximizeRestore->setIconOverride(nullptr, nullptr); _maximizeRestore->setIconOverride(_activeState ? &st::titleButtonMaximizeIconActive : nullptr, _activeState ? &st::titleButtonMaximizeIconActiveOver : nullptr);
} }
_close->setIconOverride(_activeState ? &st::titleButtonCloseIconActive : nullptr, _activeState ? &st::titleButtonCloseIconActiveOver : nullptr);
} }
Window::HitTestResult TitleWidget::hitTest(const QPoint &p) const { Window::HitTestResult TitleWidget::hitTest(const QPoint &p) const {

View File

@ -57,7 +57,7 @@ protected:
void resizeEvent(QResizeEvent *e) override; void resizeEvent(QResizeEvent *e) override;
private: private:
void updateMaximizeRestoreButton(); void updateButtonsState();
void updateControlsPosition(); void updateControlsPosition();
object_ptr<Ui::IconButton> _minimize; object_ptr<Ui::IconButton> _minimize;
@ -65,7 +65,8 @@ private:
object_ptr<Ui::IconButton> _close; object_ptr<Ui::IconButton> _close;
object_ptr<Ui::PlainShadow> _shadow; object_ptr<Ui::PlainShadow> _shadow;
bool _maximized = false; bool _maximizedState = false;
bool _activeState = false;
}; };

View File

@ -366,8 +366,6 @@ private:
}; };
static const uint64 UserNoAccess = 0xFFFFFFFFFFFFFFFFULL;
class BotCommand { class BotCommand {
public: public:
BotCommand(const QString &command, const QString &description) : command(command), _description(description) { BotCommand(const QString &command, const QString &description) : command(command), _description(description) {
@ -407,7 +405,6 @@ struct BotInfo {
class PhotoData; class PhotoData;
class UserData : public PeerData { class UserData : public PeerData {
public: public:
UserData(const PeerId &id) : PeerData(id) { UserData(const PeerId &id) : PeerData(id) {
} }
void setPhoto(const MTPUserProfilePhoto &photo); void setPhoto(const MTPUserProfilePhoto &photo);
@ -432,8 +429,14 @@ public:
bool isBotInlineGeo() const { bool isBotInlineGeo() const {
return flags & MTPDuser::Flag::f_bot_inline_geo; return flags & MTPDuser::Flag::f_bot_inline_geo;
} }
bool isInaccessible() const {
return (access == NoAccess);
}
void setIsInaccessible() {
access = NoAccess;
}
bool canWrite() const { bool canWrite() const {
return access != UserNoAccess; return !isInaccessible();
} }
bool isContact() const { bool isContact() const {
return (contact > 0); return (contact > 0);
@ -507,6 +510,8 @@ private:
BlockStatus _blockStatus = BlockStatus::Unknown; BlockStatus _blockStatus = BlockStatus::Unknown;
int _commonChatsCount = 0; int _commonChatsCount = 0;
static constexpr const uint64 NoAccess = 0xFFFFFFFFFFFFFFFFULL;
}; };
class ChatData : public PeerData { class ChatData : public PeerData {

View File

@ -818,11 +818,11 @@ defaultTooltip: Tooltip {
historyToDownBelow: icon { historyToDownBelow: icon {
{ "history_down_shadow", historyToDownShadow }, { "history_down_shadow", historyToDownShadow },
{ "history_down_circle", windowBg, point(4px, 4px) }, { "history_down_circle", historyToDownBg, point(4px, 4px) },
}; };
historyToDownBelowOver: icon { historyToDownBelowOver: icon {
{ "history_down_shadow", historyToDownShadow }, { "history_down_shadow", historyToDownShadow },
{ "history_down_circle", windowBgOver, point(4px, 4px) }, { "history_down_circle", historyToDownBgOver, point(4px, 4px) },
}; };
contactsAddIconBelow: icon { contactsAddIconBelow: icon {
{ "history_down_shadow", historyToDownShadow }, { "history_down_shadow", historyToDownShadow },

View File

@ -145,34 +145,78 @@ titleButtonMinimize: IconButton {
width: 24px; width: 24px;
height: 21px; height: 21px;
icon: icon {{ "title_button_minimize", titleButtonFg, point(4px, 4px) }}; icon: icon {
{ size(24px, 21px), titleButtonBg },
{ "title_button_minimize", titleButtonFg, point(4px, 4px) },
};
iconOver: icon { iconOver: icon {
{ size(24px, 21px), titleButtonBgOver }, { size(24px, 21px), titleButtonBgOver },
{ "title_button_minimize", titleButtonFgOver, point(4px, 4px) }, { "title_button_minimize", titleButtonFgOver, point(4px, 4px) },
}; };
iconPosition: point(0px, 0px); iconPosition: point(0px, 0px);
} }
titleButtonMinimizeIconActive: icon {
{ size(24px, 21px), titleButtonBgActive },
{ "title_button_minimize", titleButtonFgActive, point(4px, 4px) },
};
titleButtonMinimizeIconActiveOver: icon {
{ size(24px, 21px), titleButtonBgActiveOver },
{ "title_button_minimize", titleButtonFgActiveOver, point(4px, 4px) },
};
titleButtonMaximize: IconButton(titleButtonMinimize) { titleButtonMaximize: IconButton(titleButtonMinimize) {
icon: icon {{ "title_button_maximize", titleButtonFg, point(4px, 4px) }}; icon: icon {
{ size(24px, 21px), titleButtonBg },
{ "title_button_maximize", titleButtonFg, point(4px, 4px) },
};
iconOver: icon { iconOver: icon {
{ size(24px, 21px), titleButtonBgOver }, { size(24px, 21px), titleButtonBgOver },
{ "title_button_maximize", titleButtonFgOver, point(4px, 4px) }, { "title_button_maximize", titleButtonFgOver, point(4px, 4px) },
}; };
} }
titleButtonRestoreIcon: icon {{ "title_button_restore", titleButtonFg, point(4px, 4px) }}; titleButtonMaximizeIconActive: icon {
{ size(24px, 21px), titleButtonBgActive },
{ "title_button_maximize", titleButtonFgActive, point(4px, 4px) },
};
titleButtonMaximizeIconActiveOver: icon {
{ size(24px, 21px), titleButtonBgActiveOver },
{ "title_button_maximize", titleButtonFgActiveOver, point(4px, 4px) },
};
titleButtonRestoreIcon: icon {
{ size(24px, 21px), titleButtonBg },
{ "title_button_restore", titleButtonFg, point(4px, 4px) },
};
titleButtonRestoreIconOver: icon { titleButtonRestoreIconOver: icon {
{ size(24px, 21px), titleButtonBgOver }, { size(24px, 21px), titleButtonBgOver },
{ "title_button_restore", titleButtonFgOver, point(4px, 4px) }, { "title_button_restore", titleButtonFgOver, point(4px, 4px) },
}; };
titleButtonRestoreIconActive: icon {
{ size(24px, 21px), titleButtonBgActive },
{ "title_button_restore", titleButtonFgActive, point(4px, 4px) },
};
titleButtonRestoreIconActiveOver: icon {
{ size(24px, 21px), titleButtonBgActiveOver },
{ "title_button_restore", titleButtonFgActiveOver, point(4px, 4px) },
};
titleButtonClose: IconButton(titleButtonMinimize) { titleButtonClose: IconButton(titleButtonMinimize) {
width: 25px; width: 25px;
icon: icon {{ "title_button_close", titleButtonFg, point(5px, 4px) }}; icon: icon {
{ size(25px, 21px), titleButtonCloseBg },
{ "title_button_close", titleButtonCloseFg, point(5px, 4px) },
};
iconOver: icon { iconOver: icon {
{ size(25px, 21px), titleButtonCloseBgOver }, { size(25px, 21px), titleButtonCloseBgOver },
{ "title_button_close", titleButtonCloseFgOver, point(5px, 4px) }, { "title_button_close", titleButtonCloseFgOver, point(5px, 4px) },
}; };
} }
titleButtonCloseIconActive: icon {
{ size(25px, 21px), titleButtonCloseBgActive },
{ "title_button_close", titleButtonCloseFgActive, point(5px, 4px) },
};
titleButtonCloseIconActiveOver: icon {
{ size(25px, 21px), titleButtonCloseBgActiveOver },
{ "title_button_close", titleButtonCloseFgActiveOver, point(5px, 4px) },
};
// Legacy top bar. // Legacy top bar.
topBarHeight: 54px; topBarHeight: 54px;

View File

@ -902,7 +902,7 @@ int DefaultPreviewTitleHeight() {
void DefaultPreviewWindowTitle(Painter &p, const style::palette &palette, QRect body, int outerWidth) { void DefaultPreviewWindowTitle(Painter &p, const style::palette &palette, QRect body, int outerWidth) {
auto titleRect = QRect(body.x(), body.y() - st::titleHeight, body.width(), st::titleHeight); auto titleRect = QRect(body.x(), body.y() - st::titleHeight, body.width(), st::titleHeight);
p.fillRect(titleRect, QColor(0, 0, 0)); p.fillRect(titleRect, QColor(0, 0, 0));
p.fillRect(titleRect, st::titleBg[palette]); p.fillRect(titleRect, st::titleBgActive[palette]);
auto right = st::titleButtonClose.width; auto right = st::titleButtonClose.width;
st::titleButtonClose.icon[palette].paint(p, titleRect.x() + titleRect.width() - right + st::titleButtonClose.iconPosition.x(), titleRect.y() + st::titleButtonClose.iconPosition.y(), outerWidth); st::titleButtonClose.icon[palette].paint(p, titleRect.x() + titleRect.width() - right + st::titleButtonClose.iconPosition.x(), titleRect.y() + st::titleButtonClose.iconPosition.y(), outerWidth);
right += st::titleButtonMaximize.width; right += st::titleButtonMaximize.width;

View File

@ -1,6 +1,6 @@
AppVersion 1000000 AppVersion 1000001
AppVersionStrMajor 1.0 AppVersionStrMajor 1.0
AppVersionStrSmall 1.0 AppVersionStrSmall 1.0.1
AppVersionStr 1.0.0 AppVersionStr 1.0.1
AlphaChannel 0 AlphaChannel 1
BetaVersion 0 BetaVersion 0