From 20e7d9e0361a51923c992c75cf6fdc98c77a0776 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 21 Jul 2015 17:35:08 +0200 Subject: [PATCH] fixed some issues with forwarding, Great Minds sticker pack info, windows start --- Telegram/SourceFiles/boxes/stickersetbox.cpp | 20 ++++++++++-- Telegram/SourceFiles/boxes/stickersetbox.h | 3 +- Telegram/SourceFiles/gui/phoneinput.cpp | 2 +- Telegram/SourceFiles/historywidget.cpp | 4 +++ Telegram/SourceFiles/window.cpp | 32 ++++++++++---------- 5 files changed, 40 insertions(+), 21 deletions(-) diff --git a/Telegram/SourceFiles/boxes/stickersetbox.cpp b/Telegram/SourceFiles/boxes/stickersetbox.cpp index 12dfd5a02a..5a8af1db08 100644 --- a/Telegram/SourceFiles/boxes/stickersetbox.cpp +++ b/Telegram/SourceFiles/boxes/stickersetbox.cpp @@ -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); } else { 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; } +bool StickerSetInner::official() const { + return _loaded && _setShortName.isEmpty(); +} + QString StickerSetInner::title() const { 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), _close(this, st::btnStickersClose), _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()); setMaxHeight(st::stickersMaxHeight); 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(&_addStickers, SIGNAL(clicked()), this, SLOT(onAddStickers())); connect(&_shareStickers, SIGNAL(clicked()), this, SLOT(onShareStickers())); + connect(&_closeStickers, SIGNAL(clicked()), this, SLOT(onClose())); connect(&_inner, SIGNAL(updateButtons()), this, SLOT(onUpdateButtons())); connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll())); @@ -274,19 +280,26 @@ void StickerSetBox::showAll() { _close.show(); int32 cnt = _inner.notInstalled(); 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.show(); _addStickers.raise(); _shareStickers.hide(); + _closeStickers.hide(); } else { _shareStickers.show(); _shareStickers.raise(); _addStickers.hide(); + _closeStickers.hide(); } } else { _addStickers.hide(); _shareStickers.hide(); + _closeStickers.hide(); } update(); } @@ -304,4 +317,5 @@ void StickerSetBox::resizeEvent(QResizeEvent *e) { _close.moveToRight(0, 0, width()); _addStickers.move((width() - _addStickers.width()) / 2, height() - (st::stickersAddOrShare + _addStickers.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); } diff --git a/Telegram/SourceFiles/boxes/stickersetbox.h b/Telegram/SourceFiles/boxes/stickersetbox.h index 136be0e481..8ac876990b 100644 --- a/Telegram/SourceFiles/boxes/stickersetbox.h +++ b/Telegram/SourceFiles/boxes/stickersetbox.h @@ -32,6 +32,7 @@ public: bool loaded() const; int32 notInstalled() const; + bool official() const; QString title() const; QString shortName() const; @@ -97,5 +98,5 @@ private: StickerSetInner _inner; IconedButton _close; - FlatButton _addStickers, _shareStickers; + FlatButton _addStickers, _shareStickers, _closeStickers; }; diff --git a/Telegram/SourceFiles/gui/phoneinput.cpp b/Telegram/SourceFiles/gui/phoneinput.cpp index a28ce32512..f49a5d26eb 100644 --- a/Telegram/SourceFiles/gui/phoneinput.cpp +++ b/Telegram/SourceFiles/gui/phoneinput.cpp @@ -136,7 +136,7 @@ void PhoneInput::onChooseCode(const QString &code) { ph.reserve(20); for (int i = 0, l = pattern.size(); i < l; ++i) { ph.append(' '); - ph.append(qsl("X").repeated(pattern.at(i))); + ph.append(QString(QChar(0x2212)).repeated(pattern.at(i))); } setPlaceholder(ph); } diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 1e1cb2c714..eab7ea03fe 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -2678,6 +2678,10 @@ void HistoryWidget::showPeerHistory(const PeerId &peerId, MsgId showAtMsgId) { _histInited = false; historyLoaded(); + + emit peerShown(_peer); + App::main()->topBar()->update(); + update(); return; } updateTyping(false); diff --git a/Telegram/SourceFiles/window.cpp b/Telegram/SourceFiles/window.cpp index c83df1509c..8d438d159f 100644 --- a/Telegram/SourceFiles/window.cpp +++ b/Telegram/SourceFiles/window.cpp @@ -429,26 +429,26 @@ void Window::init() { 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(); - psUpdateWorkmode(); } 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(); updateTrayMenu(); }