Added "Add to Group" button in bot profile.

Changed new chat icon to more simplified.
Fixed kick user from a new members dropdown in chat history view.
Version 0.9.53.alpha is ready.
This commit is contained in:
John Preston 2016-06-20 18:40:36 +03:00
parent caba965b80
commit e47d8c0e03
23 changed files with 103 additions and 55 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 KiB

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 KiB

After

Width:  |  Height:  |  Size: 239 KiB

View File

@ -1578,10 +1578,10 @@ contactsScroll: flatScroll(boxScroll) {
deltab: 0px; deltab: 0px;
} }
btnNewGroup: iconedButton(btnDefIconed) { btnAddContact: iconedButton(btnDefIconed) {
icon: sprite(189px, 118px, 18px, 17px); icon: sprite(188px, 93px, 18px, 18px);
iconPos: point(8px, 8px); iconPos: point(8px, 8px);
downIcon: sprite(189px, 118px, 18px, 17px); downIcon: sprite(188px, 93px, 18px, 18px);
downIconPos: point(8px, 9px); downIconPos: point(8px, 9px);
bgColor: transparent; bgColor: transparent;
@ -1589,11 +1589,7 @@ btnNewGroup: iconedButton(btnDefIconed) {
width: 36px; width: 36px;
height: 36px; height: 36px;
} }
btnAddContact: iconedButton(btnNewGroup) { btnCancelSearch: iconedButton(btnAddContact) {
icon: sprite(188px, 93px, 18px, 18px);
downIcon: sprite(188px, 93px, 18px, 18px);
}
btnCancelSearch: iconedButton(btnNewGroup) {
icon: sprite(188px, 43px, 18px, 18px); icon: sprite(188px, 43px, 18px, 18px);
downIcon: sprite(188px, 43px, 18px, 18px); downIcon: sprite(188px, 43px, 18px, 18px);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

View File

@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,9,52,0 FILEVERSION 0,9,53,0
PRODUCTVERSION 0,9,52,0 PRODUCTVERSION 0,9,53,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", "0.9.52.0" VALUE "FileVersion", "0.9.53.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.9.52.0" VALUE "ProductVersion", "0.9.53.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 0,9,52,0 FILEVERSION 0,9,53,0
PRODUCTVERSION 0,9,52,0 PRODUCTVERSION 0,9,53,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", "0.9.52.0" VALUE "FileVersion", "0.9.53.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.9.52.0" VALUE "ProductVersion", "0.9.53.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -493,7 +493,10 @@ namespace {
if (d.has_bot_info_version()) { if (d.has_bot_info_version()) {
data->setBotInfoVersion(d.vbot_info_version.v); data->setBotInfoVersion(d.vbot_info_version.v);
data->botInfo->readsAllHistory = d.is_bot_chat_history(); 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(); data->botInfo->inlinePlaceholder = d.has_bot_inline_placeholder() ? '_' + qs(d.vbot_inline_placeholder) : QString();
} else { } else {
data->setBotInfoVersion(-1); data->setBotInfoVersion(-1);

View File

@ -1049,9 +1049,9 @@ 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() < 9050) { if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 9053) {
// 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 = 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(); // versionFeatures = langNewVersionText();
} else if (Local::oldMapVersion() < 9050) { } else if (Local::oldMapVersion() < 9050) {
versionFeatures = langNewVersionText(); versionFeatures = langNewVersionText();
} else { } else {

View File

@ -504,3 +504,19 @@ void RichDeleteMessageBox::hideAll() {
_delete.hide(); _delete.hide();
_cancel.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);
}
}

View File

@ -251,3 +251,18 @@ private:
BoxButton _delete, _cancel; BoxButton _delete, _cancel;
}; };
class KickMemberBox : public ConfirmBox {
Q_OBJECT
public:
KickMemberBox(PeerData *chat, UserData *member);
private slots:
void onConfirm();
private:
PeerData *_chat;
UserData *_member;
};

View File

@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#define BETA_VERSION_MACRO (0ULL) #define BETA_VERSION_MACRO (0ULL)
constexpr int AppVersion = 9052; constexpr int AppVersion = 9053;
constexpr str_const AppVersionStr = "0.9.52"; constexpr str_const AppVersionStr = "0.9.53";
constexpr bool AppAlphaVersion = true; constexpr bool AppAlphaVersion = true;
constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;

View File

@ -85,3 +85,17 @@ dialogsTextStyleActive: textStyle(dialogsTextStyle) {
linkFg: dialogsTextFgActive; linkFg: dialogsTextFgActive;
linkFgDown: 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;
}

View File

@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "dialogs/dialogs_indexed_list.h" #include "dialogs/dialogs_indexed_list.h"
#include "dialogs/dialogs_layout.h" #include "dialogs/dialogs_layout.h"
#include "styles/style_dialogs.h" #include "styles/style_dialogs.h"
#include "ui/buttons/round_button.h"
#include "data/data_drafts.h" #include "data/data_drafts.h"
#include "lang.h" #include "lang.h"
#include "application.h" #include "application.h"
@ -1759,7 +1760,7 @@ DialogsWidget::DialogsWidget(MainWidget *parent) : TWidget(parent)
, _dialogsRequest(0) , _dialogsRequest(0)
, _contactsRequest(0) , _contactsRequest(0)
, _filter(this, st::dlgFilter, lang(lng_dlg_filter)) , _filter(this, st::dlgFilter, lang(lng_dlg_filter))
, _newGroup(this, st::btnNewGroup) , _newGroup(this, QString(), st::dialogsNewChatButton)
, _addContact(this, st::btnAddContact) , _addContact(this, st::btnAddContact)
, _cancelSearch(this, st::btnCancelSearch) , _cancelSearch(this, st::btnCancelSearch)
, _scroll(this, st::dialogsScroll) , _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(&_filter, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(onFilterCursorMoved(int,int)));
connect(parent, SIGNAL(dialogsUpdated()), this, SLOT(onListScroll())); connect(parent, SIGNAL(dialogsUpdated()), this, SLOT(onListScroll()));
connect(&_addContact, SIGNAL(clicked()), this, SLOT(onAddContact())); connect(&_addContact, SIGNAL(clicked()), this, SLOT(onAddContact()));
connect(&_newGroup, SIGNAL(clicked()), this, SLOT(onNewGroup())); connect(_newGroup, SIGNAL(clicked()), this, SLOT(onNewGroup()));
connect(&_cancelSearch, SIGNAL(clicked()), this, SLOT(onCancelSearch())); connect(&_cancelSearch, SIGNAL(clicked()), this, SLOT(onCancelSearch()));
_chooseByDragTimer.setSingleShot(true); _chooseByDragTimer.setSingleShot(true);
@ -1804,9 +1805,9 @@ DialogsWidget::DialogsWidget(MainWidget *parent) : TWidget(parent)
_filter.setFocusPolicy(Qt::StrongFocus); _filter.setFocusPolicy(Qt::StrongFocus);
_filter.customUpDown(true); _filter.customUpDown(true);
_addContact.hide(); _addContact.hide();
_newGroup.show(); _newGroup->show();
_cancelSearch.hide(); _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); _addContact.move(width() - _addContact.width() - st::dialogsPadding.x(), 0);
_cancelSearch.move(width() - _cancelSearch.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(); _scroll.hide();
_filter.hide(); _filter.hide();
_cancelSearch.hide(); _cancelSearch.hide();
_newGroup.hide(); _newGroup->hide();
int delta = st::slideShift; int delta = st::slideShift;
if (direction == Window::SlideDirection::FromLeft) { if (direction == Window::SlideDirection::FromLeft) {
@ -2360,10 +2361,10 @@ void DialogsWidget::onFilterUpdate(bool force) {
_searchQueries.clear(); _searchQueries.clear();
_searchQuery = QString(); _searchQuery = QString();
_cancelSearch.hide(); _cancelSearch.hide();
_newGroup.show(); _newGroup->show();
} else if (_cancelSearch.isHidden()) { } else if (_cancelSearch.isHidden()) {
_cancelSearch.show(); _cancelSearch.show();
_newGroup.hide(); _newGroup->hide();
} }
if (filterText.size() < MinUsernameLength) { if (filterText.size() < MinUsernameLength) {
_peopleCache.clear(); _peopleCache.clear();
@ -2426,7 +2427,7 @@ void DialogsWidget::onCompleteHashtag(QString tag) {
void DialogsWidget::resizeEvent(QResizeEvent *e) { void DialogsWidget::resizeEvent(QResizeEvent *e) {
int32 w = width(); int32 w = width();
_filter.setGeometry(st::dialogsPadding.x(), st::dialogsFilterPadding, w - 2 * st::dialogsPadding.x(), _filter.height()); _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()); _addContact.move(w - _addContact.width() - st::dialogsPadding.x(), _filter.y());
_cancelSearch.move(w - _cancelSearch.width() - st::dialogsPadding.x(), _filter.y()); _cancelSearch.move(w - _cancelSearch.width() - st::dialogsPadding.x(), _filter.y());
_scroll.move(0, _filter.height() + 2 * st::dialogsFilterPadding); _scroll.move(0, _filter.height() + 2 * st::dialogsFilterPadding);

View File

@ -29,6 +29,10 @@ class FakeRow;
class IndexedList; class IndexedList;
} // namespace Dialogs } // namespace Dialogs
namespace Ui {
class RoundButton;
} // namespace Ui
enum DialogsSearchRequestType { enum DialogsSearchRequestType {
DialogsSearchFromStart, DialogsSearchFromStart,
DialogsSearchFromOffset, DialogsSearchFromOffset,
@ -336,7 +340,8 @@ private:
mtpRequestId _dialogsRequest, _contactsRequest; mtpRequestId _dialogsRequest, _contactsRequest;
FlatInput _filter; FlatInput _filter;
IconedButton _newGroup, _addContact, _cancelSearch; ChildWidget<Ui::RoundButton> _newGroup;
IconedButton _addContact, _cancelSearch;
ScrollArea _scroll; ScrollArea _scroll;
DialogsInner _inner; DialogsInner _inner;

View File

@ -34,6 +34,7 @@ struct PeerUpdate {
PeerData *peer; PeerData *peer;
enum class Flag { enum class Flag {
// Common flags
NameChanged = 0x00000001U, NameChanged = 0x00000001U,
UsernameChanged = 0x00000002U, UsernameChanged = 0x00000002U,
PhotoChanged = 0x00000004U, PhotoChanged = 0x00000004U,
@ -47,15 +48,19 @@ struct PeerUpdate {
MembersChanged = 0x00000040U, MembersChanged = 0x00000040U,
AdminsChanged = 0x00000080U, AdminsChanged = 0x00000080U,
// For users
UserCanShareContact = 0x00010000U, UserCanShareContact = 0x00010000U,
UserIsContact = 0x00020000U, UserIsContact = 0x00020000U,
UserPhoneChanged = 0x00040000U, UserPhoneChanged = 0x00040000U,
UserIsBlocked = 0x00080000U, UserIsBlocked = 0x00080000U,
BotCommandsChanged = 0x00100000U, BotCommandsChanged = 0x00100000U,
UserOnlineChanged = 0x00200000U, UserOnlineChanged = 0x00200000U,
BotCanAddToGroups = 0x00400000U,
// For chats
ChatCanEdit = 0x00010000U, ChatCanEdit = 0x00010000U,
// For channels
ChannelAmIn = 0x00010000U, ChannelAmIn = 0x00010000U,
ChannelAmEditor = 0x00020000U, ChannelAmEditor = 0x00020000U,
ChannelCanEditPhoto = 0x00040000U, ChannelCanEditPhoto = 0x00040000U,

View File

@ -30,9 +30,6 @@ class BlockWidget : public ScrolledWidget, public Notify::Observer {
public: public:
BlockWidget(QWidget *parent, PeerData *peer, const QString &title); BlockWidget(QWidget *parent, PeerData *peer, const QString &title);
signals:
void heightUpdated();
protected: protected:
void paintEvent(QPaintEvent *e) override; void paintEvent(QPaintEvent *e) override;
virtual void paintContents(Painter &p) { virtual void paintContents(Painter &p) {

View File

@ -40,6 +40,7 @@ namespace {
using UpdateFlag = Notify::PeerUpdate::Flag; using UpdateFlag = Notify::PeerUpdate::Flag;
const auto ButtonsUpdateFlags = UpdateFlag::UserCanShareContact const auto ButtonsUpdateFlags = UpdateFlag::UserCanShareContact
| UpdateFlag::BotCanAddToGroups
| UpdateFlag::ChatCanEdit | UpdateFlag::ChatCanEdit
| UpdateFlag::ChannelCanEditPhoto | UpdateFlag::ChannelCanEditPhoto
| UpdateFlag::ChannelCanAddMembers | UpdateFlag::ChannelCanAddMembers
@ -368,7 +369,9 @@ void CoverWidget::refreshButtons() {
void CoverWidget::setUserButtons() { void CoverWidget::setUserButtons() {
addButton(lang(lng_profile_send_message), SLOT(onSendMessage())); 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())); 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() { void CoverWidget::onJoin() {
if (!_peerChannel) return; if (!_peerChannel) return;

View File

@ -64,6 +64,7 @@ private slots:
void onShareContact(); void onShareContact();
void onSetPhoto(); void onSetPhoto();
void onAddMember(); void onAddMember();
void onAddBotToGroup();
void onJoin(); void onJoin();
void onViewChannel(); void onViewChannel();

View File

@ -194,10 +194,7 @@ void MembersWidget::mouseReleaseEvent(QMouseEvent *e) {
if (pressed >= 0 && pressed < _list.size() && pressed == _selected && pressedKick == _selectedKick) { if (pressed >= 0 && pressed < _list.size() && pressed == _selected && pressedKick == _selectedKick) {
auto member = _list.at(pressed); auto member = _list.at(pressed);
if (pressedKick) { if (pressedKick) {
_kicking = member->user; Ui::showLayer(new KickMemberBox(peer(), 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);
} else { } else {
Ui::showPeerProfile(member->user); 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); 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() { void MembersWidget::onUpdateOnlineDisplay() {
if (_sortByOnline) { if (_sortByOnline) {
_now = unixtime(); _now = unixtime();

View File

@ -73,7 +73,6 @@ signals:
void onlineCountUpdated(int onlineCount); void onlineCountUpdated(int onlineCount);
private slots: private slots:
void onKickConfirm();
void onUpdateOnlineDisplay(); void onUpdateOnlineDisplay();
private: private:
@ -139,7 +138,6 @@ private:
int _pressed = -1; int _pressed = -1;
bool _selectedKick = false; bool _selectedKick = false;
bool _pressedKick = false; bool _pressedKick = false;
UserData *_kicking = nullptr;
QPoint _mousePosition; QPoint _mousePosition;
int _onlineCount = 0; int _onlineCount = 0;

View File

@ -2365,7 +2365,7 @@
SDKROOT = macosx; SDKROOT = macosx;
SYMROOT = ./../Mac; SYMROOT = ./../Mac;
TDESKTOP_MAJOR_VERSION = 0.9; TDESKTOP_MAJOR_VERSION = 0.9;
TDESKTOP_VERSION = 0.9.52; TDESKTOP_VERSION = 0.9.53;
}; };
name = Release; name = Release;
}; };
@ -2506,7 +2506,7 @@
SDKROOT = macosx; SDKROOT = macosx;
SYMROOT = ./../Mac; SYMROOT = ./../Mac;
TDESKTOP_MAJOR_VERSION = 0.9; TDESKTOP_MAJOR_VERSION = 0.9;
TDESKTOP_VERSION = 0.9.52; TDESKTOP_VERSION = 0.9.53;
}; };
name = Debug; name = Debug;
}; };

View File

@ -1,6 +1,6 @@
AppVersion 9052 AppVersion 9053
AppVersionStrMajor 0.9 AppVersionStrMajor 0.9
AppVersionStrSmall 0.9.52 AppVersionStrSmall 0.9.53
AppVersionStr 0.9.52 AppVersionStr 0.9.53
AlphaChannel 1 AlphaChannel 1
BetaVersion 0 BetaVersion 0