diff --git a/Telegram/Resources/art/sprite.png b/Telegram/Resources/art/sprite.png index 9c656af6b..809d0201a 100644 Binary files a/Telegram/Resources/art/sprite.png and b/Telegram/Resources/art/sprite.png differ diff --git a/Telegram/Resources/art/sprite_200x.png b/Telegram/Resources/art/sprite_200x.png index da7b930da..2c1270a99 100644 Binary files a/Telegram/Resources/art/sprite_200x.png and b/Telegram/Resources/art/sprite_200x.png differ diff --git a/Telegram/Resources/basic.style b/Telegram/Resources/basic.style index 77912a38d..7c3fdeef3 100644 --- a/Telegram/Resources/basic.style +++ b/Telegram/Resources/basic.style @@ -1578,10 +1578,10 @@ contactsScroll: flatScroll(boxScroll) { deltab: 0px; } -btnNewGroup: iconedButton(btnDefIconed) { - icon: sprite(189px, 118px, 18px, 17px); +btnAddContact: iconedButton(btnDefIconed) { + icon: sprite(188px, 93px, 18px, 18px); iconPos: point(8px, 8px); - downIcon: sprite(189px, 118px, 18px, 17px); + downIcon: sprite(188px, 93px, 18px, 18px); downIconPos: point(8px, 9px); bgColor: transparent; @@ -1589,11 +1589,7 @@ btnNewGroup: iconedButton(btnDefIconed) { width: 36px; height: 36px; } -btnAddContact: iconedButton(btnNewGroup) { - icon: sprite(188px, 93px, 18px, 18px); - downIcon: sprite(188px, 93px, 18px, 18px); -} -btnCancelSearch: iconedButton(btnNewGroup) { +btnCancelSearch: iconedButton(btnAddContact) { icon: sprite(188px, 43px, 18px, 18px); downIcon: sprite(188px, 43px, 18px, 18px); } diff --git a/Telegram/Resources/icons/dialogs_new_chat.png b/Telegram/Resources/icons/dialogs_new_chat.png new file mode 100644 index 000000000..aa11bd633 Binary files /dev/null and b/Telegram/Resources/icons/dialogs_new_chat.png differ diff --git a/Telegram/Resources/icons/dialogs_new_chat@2x.png b/Telegram/Resources/icons/dialogs_new_chat@2x.png new file mode 100644 index 000000000..34a88445c Binary files /dev/null and b/Telegram/Resources/icons/dialogs_new_chat@2x.png differ diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 3d4e59e66..f6394b547 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,9,52,0 - PRODUCTVERSION 0,9,52,0 + FILEVERSION 0,9,53,0 + PRODUCTVERSION 0,9,53,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "0.9.52.0" + VALUE "FileVersion", "0.9.53.0" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.9.52.0" + VALUE "ProductVersion", "0.9.53.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 243033855..92da90e08 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,9,52,0 - PRODUCTVERSION 0,9,52,0 + FILEVERSION 0,9,53,0 + PRODUCTVERSION 0,9,53,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -43,10 +43,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Updater" - VALUE "FileVersion", "0.9.52.0" + VALUE "FileVersion", "0.9.53.0" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.9.52.0" + VALUE "ProductVersion", "0.9.53.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index c9155965c..b689de579 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -493,7 +493,10 @@ namespace { if (d.has_bot_info_version()) { data->setBotInfoVersion(d.vbot_info_version.v); data->botInfo->readsAllHistory = d.is_bot_chat_history(); - data->botInfo->cantJoinGroups = d.is_bot_nochats(); + if (data->botInfo->cantJoinGroups != d.is_bot_nochats()) { + data->botInfo->cantJoinGroups = d.is_bot_nochats(); + update.flags |= UpdateFlag::BotCanAddToGroups; + } data->botInfo->inlinePlaceholder = d.has_bot_inline_placeholder() ? '_' + qs(d.vbot_inline_placeholder) : QString(); } else { data->setBotInfoVersion(-1); diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index 366af9d94..e6b5a5a0e 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -1049,9 +1049,9 @@ void AppClass::checkMapVersion() { if (Local::oldMapVersion() < AppVersion) { if (Local::oldMapVersion()) { QString versionFeatures; - if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 9050) { -// versionFeatures = QString::fromUtf8("\xe2\x80\x94 Select and copy text in photo / video captions and web page previews\n\xe2\x80\x94 Media player shortcuts are enabled only when player is opened"); - versionFeatures = langNewVersionText(); + if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 9053) { + versionFeatures = QString::fromUtf8("\xe2\x80\x94 Put your cursor over the members count in a group chat to see the members list\n\xe2\x80\x94 Bug fixes and other minor improvements"); +// versionFeatures = langNewVersionText(); } else if (Local::oldMapVersion() < 9050) { versionFeatures = langNewVersionText(); } else { diff --git a/Telegram/SourceFiles/boxes/confirmbox.cpp b/Telegram/SourceFiles/boxes/confirmbox.cpp index 2d5937a0f..db82cbced 100644 --- a/Telegram/SourceFiles/boxes/confirmbox.cpp +++ b/Telegram/SourceFiles/boxes/confirmbox.cpp @@ -504,3 +504,19 @@ void RichDeleteMessageBox::hideAll() { _delete.hide(); _cancel.hide(); } + +KickMemberBox::KickMemberBox(PeerData *chat, UserData *member) +: ConfirmBox(lng_profile_sure_kick(lt_user, member->firstName), lang(lng_box_remove)) +, _chat(chat) +, _member(member) { + connect(this, SIGNAL(confirmed()), this, SLOT(onConfirm())); +} + +void KickMemberBox::onConfirm() { + Ui::hideLayer(); + if (auto chat = _chat->asChat()) { + App::main()->kickParticipant(chat, _member); + } else if (auto channel = _chat->asChannel()) { + App::api()->kickParticipant(channel, _member); + } +} diff --git a/Telegram/SourceFiles/boxes/confirmbox.h b/Telegram/SourceFiles/boxes/confirmbox.h index e7af61470..f162debdd 100644 --- a/Telegram/SourceFiles/boxes/confirmbox.h +++ b/Telegram/SourceFiles/boxes/confirmbox.h @@ -251,3 +251,18 @@ private: BoxButton _delete, _cancel; }; + +class KickMemberBox : public ConfirmBox { + Q_OBJECT + +public: + KickMemberBox(PeerData *chat, UserData *member); + +private slots: + void onConfirm(); + +private: + PeerData *_chat; + UserData *_member; + +}; diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 79b5b85bf..c0eee7a0f 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #define BETA_VERSION_MACRO (0ULL) -constexpr int AppVersion = 9052; -constexpr str_const AppVersionStr = "0.9.52"; +constexpr int AppVersion = 9053; +constexpr str_const AppVersionStr = "0.9.53"; constexpr bool AppAlphaVersion = true; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; diff --git a/Telegram/SourceFiles/dialogs/dialogs.style b/Telegram/SourceFiles/dialogs/dialogs.style index c65fa301c..5b4964ef1 100644 --- a/Telegram/SourceFiles/dialogs/dialogs.style +++ b/Telegram/SourceFiles/dialogs/dialogs.style @@ -85,3 +85,17 @@ dialogsTextStyleActive: textStyle(dialogsTextStyle) { linkFg: dialogsTextFgActive; linkFgDown: dialogsTextFgActive; } + +dialogsNewChatIcon: icon { + { "dialogs_new_chat", #b7b7b7, point(9px, 10px) } +}; +dialogsNewChatButton: BoxButton { + width: 36px; + height: 36px; + icon: dialogsNewChatIcon; + + textFg: transparent; + textFgOver: transparent; + textBg: transparent; + textBgOver: transparent; +} diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index 231e02818..66196dff7 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -24,6 +24,7 @@ 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 "data/data_drafts.h" #include "lang.h" #include "application.h" @@ -1759,7 +1760,7 @@ DialogsWidget::DialogsWidget(MainWidget *parent) : TWidget(parent) , _dialogsRequest(0) , _contactsRequest(0) , _filter(this, st::dlgFilter, lang(lng_dlg_filter)) -, _newGroup(this, st::btnNewGroup) +, _newGroup(this, QString(), st::dialogsNewChatButton) , _addContact(this, st::btnAddContact) , _cancelSearch(this, st::btnCancelSearch) , _scroll(this, st::dialogsScroll) @@ -1787,7 +1788,7 @@ DialogsWidget::DialogsWidget(MainWidget *parent) : TWidget(parent) 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(&_newGroup, SIGNAL(clicked()), this, SLOT(onNewGroup())); + connect(_newGroup, SIGNAL(clicked()), this, SLOT(onNewGroup())); connect(&_cancelSearch, SIGNAL(clicked()), this, SLOT(onCancelSearch())); _chooseByDragTimer.setSingleShot(true); @@ -1804,9 +1805,9 @@ DialogsWidget::DialogsWidget(MainWidget *parent) : TWidget(parent) _filter.setFocusPolicy(Qt::StrongFocus); _filter.customUpDown(true); _addContact.hide(); - _newGroup.show(); + _newGroup->show(); _cancelSearch.hide(); - _newGroup.move(width() - _newGroup.width() - st::dialogsPadding.x(), 0); + _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); } @@ -1854,7 +1855,7 @@ void DialogsWidget::showAnimated(Window::SlideDirection direction, const Window: _scroll.hide(); _filter.hide(); _cancelSearch.hide(); - _newGroup.hide(); + _newGroup->hide(); int delta = st::slideShift; if (direction == Window::SlideDirection::FromLeft) { @@ -2360,10 +2361,10 @@ void DialogsWidget::onFilterUpdate(bool force) { _searchQueries.clear(); _searchQuery = QString(); _cancelSearch.hide(); - _newGroup.show(); + _newGroup->show(); } else if (_cancelSearch.isHidden()) { _cancelSearch.show(); - _newGroup.hide(); + _newGroup->hide(); } if (filterText.size() < MinUsernameLength) { _peopleCache.clear(); @@ -2426,7 +2427,7 @@ void DialogsWidget::onCompleteHashtag(QString tag) { 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()); + _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()); _scroll.move(0, _filter.height() + 2 * st::dialogsFilterPadding); diff --git a/Telegram/SourceFiles/dialogswidget.h b/Telegram/SourceFiles/dialogswidget.h index b12e613c0..8891478f6 100644 --- a/Telegram/SourceFiles/dialogswidget.h +++ b/Telegram/SourceFiles/dialogswidget.h @@ -29,6 +29,10 @@ class FakeRow; class IndexedList; } // namespace Dialogs +namespace Ui { +class RoundButton; +} // namespace Ui + enum DialogsSearchRequestType { DialogsSearchFromStart, DialogsSearchFromOffset, @@ -336,7 +340,8 @@ private: mtpRequestId _dialogsRequest, _contactsRequest; FlatInput _filter; - IconedButton _newGroup, _addContact, _cancelSearch; + ChildWidget _newGroup; + IconedButton _addContact, _cancelSearch; ScrollArea _scroll; DialogsInner _inner; diff --git a/Telegram/SourceFiles/observer_peer.h b/Telegram/SourceFiles/observer_peer.h index 638938e64..fe0e26cbc 100644 --- a/Telegram/SourceFiles/observer_peer.h +++ b/Telegram/SourceFiles/observer_peer.h @@ -34,6 +34,7 @@ struct PeerUpdate { PeerData *peer; enum class Flag { + // Common flags NameChanged = 0x00000001U, UsernameChanged = 0x00000002U, PhotoChanged = 0x00000004U, @@ -47,15 +48,19 @@ struct PeerUpdate { MembersChanged = 0x00000040U, AdminsChanged = 0x00000080U, + // For users UserCanShareContact = 0x00010000U, UserIsContact = 0x00020000U, UserPhoneChanged = 0x00040000U, UserIsBlocked = 0x00080000U, BotCommandsChanged = 0x00100000U, UserOnlineChanged = 0x00200000U, + BotCanAddToGroups = 0x00400000U, + // For chats ChatCanEdit = 0x00010000U, + // For channels ChannelAmIn = 0x00010000U, ChannelAmEditor = 0x00020000U, ChannelCanEditPhoto = 0x00040000U, diff --git a/Telegram/SourceFiles/profile/profile_block_widget.h b/Telegram/SourceFiles/profile/profile_block_widget.h index 8f57e04e7..7b77d2770 100644 --- a/Telegram/SourceFiles/profile/profile_block_widget.h +++ b/Telegram/SourceFiles/profile/profile_block_widget.h @@ -30,9 +30,6 @@ class BlockWidget : public ScrolledWidget, public Notify::Observer { public: BlockWidget(QWidget *parent, PeerData *peer, const QString &title); -signals: - void heightUpdated(); - protected: void paintEvent(QPaintEvent *e) override; virtual void paintContents(Painter &p) { diff --git a/Telegram/SourceFiles/profile/profile_cover.cpp b/Telegram/SourceFiles/profile/profile_cover.cpp index a3928162a..b90c5fb06 100644 --- a/Telegram/SourceFiles/profile/profile_cover.cpp +++ b/Telegram/SourceFiles/profile/profile_cover.cpp @@ -40,6 +40,7 @@ namespace { using UpdateFlag = Notify::PeerUpdate::Flag; const auto ButtonsUpdateFlags = UpdateFlag::UserCanShareContact + | UpdateFlag::BotCanAddToGroups | UpdateFlag::ChatCanEdit | UpdateFlag::ChannelCanEditPhoto | UpdateFlag::ChannelCanAddMembers @@ -368,7 +369,9 @@ void CoverWidget::refreshButtons() { void CoverWidget::setUserButtons() { addButton(lang(lng_profile_send_message), SLOT(onSendMessage())); - if (_peerUser->canShareThisContact()) { + if (_peerUser->botInfo && !_peerUser->botInfo->cantJoinGroups) { + addButton(lang(lng_profile_invite_to_group), SLOT(onAddBotToGroup()), &st::profileAddMemberButton); + } else if (_peerUser->canShareThisContact()) { addButton(lang(lng_profile_share_contact), SLOT(onShareContact())); } } @@ -494,6 +497,12 @@ void CoverWidget::onAddMember() { } } +void CoverWidget::onAddBotToGroup() { + if (_peerUser && _peerUser->botInfo) { + Ui::showLayer(new ContactsBox(_peerUser)); + } +} + void CoverWidget::onJoin() { if (!_peerChannel) return; diff --git a/Telegram/SourceFiles/profile/profile_cover.h b/Telegram/SourceFiles/profile/profile_cover.h index 9aa67f166..f66f67b5d 100644 --- a/Telegram/SourceFiles/profile/profile_cover.h +++ b/Telegram/SourceFiles/profile/profile_cover.h @@ -64,6 +64,7 @@ private slots: void onShareContact(); void onSetPhoto(); void onAddMember(); + void onAddBotToGroup(); void onJoin(); void onViewChannel(); diff --git a/Telegram/SourceFiles/profile/profile_members_widget.cpp b/Telegram/SourceFiles/profile/profile_members_widget.cpp index d9b59f13f..34563e822 100644 --- a/Telegram/SourceFiles/profile/profile_members_widget.cpp +++ b/Telegram/SourceFiles/profile/profile_members_widget.cpp @@ -194,10 +194,7 @@ void MembersWidget::mouseReleaseEvent(QMouseEvent *e) { if (pressed >= 0 && pressed < _list.size() && pressed == _selected && pressedKick == _selectedKick) { auto member = _list.at(pressed); if (pressedKick) { - _kicking = member->user; - ConfirmBox *box = new ConfirmBox(lng_profile_sure_kick(lt_user, _kicking->firstName), lang(lng_box_remove)); - connect(box, SIGNAL(confirmed()), this, SLOT(onKickConfirm())); - Ui::showLayer(box); + Ui::showLayer(new KickMemberBox(peer(), member->user)); } else { Ui::showPeerProfile(member->user); } @@ -572,15 +569,6 @@ void MembersWidget::paintMember(Painter &p, int x, int y, Member *member, bool s p.drawTextLeft(x + st::profileMemberStatusPosition.x(), y + st::profileMemberStatusPosition.y(), width(), member->onlineText); } -void MembersWidget::onKickConfirm() { - Ui::hideLayer(); - if (auto chat = peer()->asChat()) { - App::main()->kickParticipant(chat, _kicking); - } else if (auto channel = peer()->asChannel()) { - App::api()->kickParticipant(channel, _kicking); - } -} - void MembersWidget::onUpdateOnlineDisplay() { if (_sortByOnline) { _now = unixtime(); diff --git a/Telegram/SourceFiles/profile/profile_members_widget.h b/Telegram/SourceFiles/profile/profile_members_widget.h index f71e7f21d..83ed921af 100644 --- a/Telegram/SourceFiles/profile/profile_members_widget.h +++ b/Telegram/SourceFiles/profile/profile_members_widget.h @@ -73,7 +73,6 @@ signals: void onlineCountUpdated(int onlineCount); private slots: - void onKickConfirm(); void onUpdateOnlineDisplay(); private: @@ -139,7 +138,6 @@ private: int _pressed = -1; bool _selectedKick = false; bool _pressedKick = false; - UserData *_kicking = nullptr; QPoint _mousePosition; int _onlineCount = 0; diff --git a/Telegram/Telegram.xcodeproj/project.pbxproj b/Telegram/Telegram.xcodeproj/project.pbxproj index 8be46c766..b1929ddaf 100644 --- a/Telegram/Telegram.xcodeproj/project.pbxproj +++ b/Telegram/Telegram.xcodeproj/project.pbxproj @@ -2365,7 +2365,7 @@ SDKROOT = macosx; SYMROOT = ./../Mac; TDESKTOP_MAJOR_VERSION = 0.9; - TDESKTOP_VERSION = 0.9.52; + TDESKTOP_VERSION = 0.9.53; }; name = Release; }; @@ -2506,7 +2506,7 @@ SDKROOT = macosx; SYMROOT = ./../Mac; TDESKTOP_MAJOR_VERSION = 0.9; - TDESKTOP_VERSION = 0.9.52; + TDESKTOP_VERSION = 0.9.53; }; name = Debug; }; diff --git a/Telegram/build/version b/Telegram/build/version index 004c586ad..14713536e 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,6 +1,6 @@ -AppVersion 9052 +AppVersion 9053 AppVersionStrMajor 0.9 -AppVersionStrSmall 0.9.52 -AppVersionStr 0.9.52 +AppVersionStrSmall 0.9.53 +AppVersionStr 0.9.53 AlphaChannel 1 BetaVersion 0