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;
}
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);
}

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
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"

View file

@ -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"

View file

@ -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);

View file

@ -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 {

View file

@ -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);
}
}

View file

@ -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;
};

View file

@ -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;

View file

@ -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;
}

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_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);

View file

@ -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<Ui::RoundButton> _newGroup;
IconedButton _addContact, _cancelSearch;
ScrollArea _scroll;
DialogsInner _inner;

View file

@ -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,

View file

@ -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) {

View file

@ -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;

View file

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

View file

@ -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();

View file

@ -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;

View file

@ -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;
};

View file

@ -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