fixed some issues with forwarding, Great Minds sticker pack info, windows start

This commit is contained in:
John Preston 2015-07-21 17:35:08 +02:00
parent f1de06424e
commit 20e7d9e036
5 changed files with 40 additions and 21 deletions

View file

@ -63,7 +63,7 @@ void StickerSetInner::gotSet(const MTPmessages_StickerSet &set) {
} }
} }
if (_pack.isEmpty() || _setShortName.isEmpty()) { if (_pack.isEmpty()) {
App::wnd()->showLayer(new ConfirmBox(lang(lng_stickers_not_found), true), true); App::wnd()->showLayer(new ConfirmBox(lang(lng_stickers_not_found), true), true);
} else { } else {
int32 rows = _pack.size() / StickerPanPerRow + ((_pack.size() % StickerPanPerRow) ? 1 : 0); int32 rows = _pack.size() / StickerPanPerRow + ((_pack.size() % StickerPanPerRow) ? 1 : 0);
@ -198,6 +198,10 @@ int32 StickerSetInner::notInstalled() const {
return (_loaded && (cStickerSets().constFind(_setId) == cStickerSets().cend())) ? _pack.size() : 0; return (_loaded && (cStickerSets().constFind(_setId) == cStickerSets().cend())) ? _pack.size() : 0;
} }
bool StickerSetInner::official() const {
return _loaded && _setShortName.isEmpty();
}
QString StickerSetInner::title() const { QString StickerSetInner::title() const {
return _loaded ? (_pack.isEmpty() ? lang(lng_attach_failed) : _title) : lang(lng_contacts_loading); return _loaded ? (_pack.isEmpty() ? lang(lng_attach_failed) : _title) : lang(lng_contacts_loading);
} }
@ -217,7 +221,8 @@ StickerSetInner::~StickerSetInner() {
StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::stickersScroll), _inner(set), StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::stickersScroll), _inner(set),
_close(this, st::btnStickersClose), _close(this, st::btnStickersClose),
_addStickers(this, lng_stickers_add_pack(lt_count, 0), st::btnStickersAdd), _addStickers(this, lng_stickers_add_pack(lt_count, 0), st::btnStickersAdd),
_shareStickers(this, lang(lng_stickers_share_pack), st::btnStickersAdd) { _shareStickers(this, lang(lng_stickers_share_pack), st::btnStickersAdd),
_closeStickers(this, lang(lng_close), st::btnStickersAdd) {
resize(st::stickersWidth, height()); resize(st::stickersWidth, height());
setMaxHeight(st::stickersMaxHeight); setMaxHeight(st::stickersMaxHeight);
connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated())); connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated()));
@ -227,6 +232,7 @@ _shareStickers(this, lang(lng_stickers_share_pack), st::btnStickersAdd) {
connect(&_close, SIGNAL(clicked()), this, SLOT(onClose())); connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));
connect(&_addStickers, SIGNAL(clicked()), this, SLOT(onAddStickers())); connect(&_addStickers, SIGNAL(clicked()), this, SLOT(onAddStickers()));
connect(&_shareStickers, SIGNAL(clicked()), this, SLOT(onShareStickers())); connect(&_shareStickers, SIGNAL(clicked()), this, SLOT(onShareStickers()));
connect(&_closeStickers, SIGNAL(clicked()), this, SLOT(onClose()));
connect(&_inner, SIGNAL(updateButtons()), this, SLOT(onUpdateButtons())); connect(&_inner, SIGNAL(updateButtons()), this, SLOT(onUpdateButtons()));
connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll())); connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
@ -274,19 +280,26 @@ void StickerSetBox::showAll() {
_close.show(); _close.show();
int32 cnt = _inner.notInstalled(); int32 cnt = _inner.notInstalled();
if (_inner.loaded()) { if (_inner.loaded()) {
if (_inner.notInstalled()) { if (_inner.official()) {
_addStickers.hide();
_shareStickers.hide();
_closeStickers.show();
} else if (_inner.notInstalled()) {
_addStickers.setText(lng_stickers_add_pack(lt_count, cnt)); _addStickers.setText(lng_stickers_add_pack(lt_count, cnt));
_addStickers.show(); _addStickers.show();
_addStickers.raise(); _addStickers.raise();
_shareStickers.hide(); _shareStickers.hide();
_closeStickers.hide();
} else { } else {
_shareStickers.show(); _shareStickers.show();
_shareStickers.raise(); _shareStickers.raise();
_addStickers.hide(); _addStickers.hide();
_closeStickers.hide();
} }
} else { } else {
_addStickers.hide(); _addStickers.hide();
_shareStickers.hide(); _shareStickers.hide();
_closeStickers.hide();
} }
update(); update();
} }
@ -304,4 +317,5 @@ void StickerSetBox::resizeEvent(QResizeEvent *e) {
_close.moveToRight(0, 0, width()); _close.moveToRight(0, 0, width());
_addStickers.move((width() - _addStickers.width()) / 2, height() - (st::stickersAddOrShare + _addStickers.height()) / 2); _addStickers.move((width() - _addStickers.width()) / 2, height() - (st::stickersAddOrShare + _addStickers.height()) / 2);
_shareStickers.move((width() - _shareStickers.width()) / 2, height() - (st::stickersAddOrShare + _shareStickers.height()) / 2); _shareStickers.move((width() - _shareStickers.width()) / 2, height() - (st::stickersAddOrShare + _shareStickers.height()) / 2);
_closeStickers.move((width() - _closeStickers.width()) / 2, height() - (st::stickersAddOrShare + _closeStickers.height()) / 2);
} }

View file

@ -32,6 +32,7 @@ public:
bool loaded() const; bool loaded() const;
int32 notInstalled() const; int32 notInstalled() const;
bool official() const;
QString title() const; QString title() const;
QString shortName() const; QString shortName() const;
@ -97,5 +98,5 @@ private:
StickerSetInner _inner; StickerSetInner _inner;
IconedButton _close; IconedButton _close;
FlatButton _addStickers, _shareStickers; FlatButton _addStickers, _shareStickers, _closeStickers;
}; };

View file

@ -136,7 +136,7 @@ void PhoneInput::onChooseCode(const QString &code) {
ph.reserve(20); ph.reserve(20);
for (int i = 0, l = pattern.size(); i < l; ++i) { for (int i = 0, l = pattern.size(); i < l; ++i) {
ph.append(' '); ph.append(' ');
ph.append(qsl("X").repeated(pattern.at(i))); ph.append(QString(QChar(0x2212)).repeated(pattern.at(i)));
} }
setPlaceholder(ph); setPlaceholder(ph);
} }

View file

@ -2678,6 +2678,10 @@ void HistoryWidget::showPeerHistory(const PeerId &peerId, MsgId showAtMsgId) {
_histInited = false; _histInited = false;
historyLoaded(); historyLoaded();
emit peerShown(_peer);
App::main()->topBar()->update();
update();
return; return;
} }
updateTyping(false); updateTyping(false);

View file

@ -429,26 +429,26 @@ void Window::init() {
title = new TitleWidget(this); title = new TitleWidget(this);
#ifdef Q_OS_WIN
trayIconMenu = new ContextMenu(this);
#else
trayIconMenu = new QMenu(this);
trayIconMenu->setFont(QFont("Tahoma"));
#endif
if (cPlatform() == dbipWindows || cPlatform() == dbipMac) {
trayIconMenu->addAction(lang(lng_minimize_to_tray), this, SLOT(minimizeToTray()))->setEnabled(true);
trayIconMenu->addAction(lang(lng_quit_from_tray), this, SLOT(quitFromTray()))->setEnabled(true);
} else {
trayIconMenu->addAction(lang(lng_open_from_tray), this, SLOT(showFromTray()))->setEnabled(true);
trayIconMenu->addAction(lang(lng_minimize_to_tray), this, SLOT(minimizeToTray()))->setEnabled(true);
trayIconMenu->addAction(lang(lng_quit_from_tray), this, SLOT(quitFromTray()))->setEnabled(true);
}
psInitSize(); psInitSize();
psUpdateWorkmode();
} }
void Window::firstShow() { void Window::firstShow() {
#ifdef Q_OS_WIN
trayIconMenu = new ContextMenu(this);
#else
trayIconMenu = new QMenu(this);
trayIconMenu->setFont(QFont("Tahoma"));
#endif
if (cPlatform() == dbipWindows || cPlatform() == dbipMac) {
trayIconMenu->addAction(lang(lng_minimize_to_tray), this, SLOT(minimizeToTray()))->setEnabled(true);
trayIconMenu->addAction(lang(lng_quit_from_tray), this, SLOT(quitFromTray()))->setEnabled(true);
} else {
trayIconMenu->addAction(lang(lng_open_from_tray), this, SLOT(showFromTray()))->setEnabled(true);
trayIconMenu->addAction(lang(lng_minimize_to_tray), this, SLOT(minimizeToTray()))->setEnabled(true);
trayIconMenu->addAction(lang(lng_quit_from_tray), this, SLOT(quitFromTray()))->setEnabled(true);
}
psUpdateWorkmode();
psFirstShow(); psFirstShow();
updateTrayMenu(); updateTrayMenu();
} }