mirror of https://github.com/procxx/kepka.git
Calendar button added to DialogsWidget.
When you search in a specific chat there is a calendar button now.
This commit is contained in:
parent
b80dd99172
commit
6d80471fc9
Binary file not shown.
After Width: | Height: | Size: 209 B |
Binary file not shown.
After Width: | Height: | Size: 275 B |
|
@ -99,6 +99,14 @@ dialogsLock: IconButton(dialogsMenuToggle) {
|
||||||
}
|
}
|
||||||
dialogsUnlockIcon: icon {{ "dialogs_unlock", dialogsMenuIconFg }};
|
dialogsUnlockIcon: icon {{ "dialogs_unlock", dialogsMenuIconFg }};
|
||||||
dialogsUnlockIconOver: icon {{ "dialogs_unlock", dialogsMenuIconFgOver }};
|
dialogsUnlockIconOver: icon {{ "dialogs_unlock", dialogsMenuIconFgOver }};
|
||||||
|
dialogsCalendar: IconButton {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
|
||||||
|
icon: icon {{ "dialogs_calendar", dialogsMenuIconFg }};
|
||||||
|
iconOver: icon {{ "dialogs_calendar", dialogsMenuIconFgOver }};
|
||||||
|
iconPosition: point(3px, 3px);
|
||||||
|
}
|
||||||
|
|
||||||
dialogsFilter: FlatInput(defaultFlatInput) {
|
dialogsFilter: FlatInput(defaultFlatInput) {
|
||||||
font: font(fsize);
|
font: font(fsize);
|
||||||
|
|
|
@ -46,6 +46,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "observer_peer.h"
|
#include "observer_peer.h"
|
||||||
#include "auth_session.h"
|
#include "auth_session.h"
|
||||||
#include "window/notifications_manager.h"
|
#include "window/notifications_manager.h"
|
||||||
|
#include "ui/effects/widget_fade_wrap.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -2263,6 +2264,7 @@ void DialogsWidget::UpdateButton::paintEvent(QPaintEvent *e) {
|
||||||
DialogsWidget::DialogsWidget(QWidget *parent) : TWidget(parent)
|
DialogsWidget::DialogsWidget(QWidget *parent) : TWidget(parent)
|
||||||
, _mainMenuToggle(this, st::dialogsMenuToggle)
|
, _mainMenuToggle(this, st::dialogsMenuToggle)
|
||||||
, _filter(this, st::dialogsFilter, lang(lng_dlg_filter))
|
, _filter(this, st::dialogsFilter, lang(lng_dlg_filter))
|
||||||
|
, _jumpToDate(this, object_ptr<Ui::IconButton>(this, st::dialogsCalendar))
|
||||||
, _cancelSearch(this, st::dialogsCancelSearch)
|
, _cancelSearch(this, st::dialogsCancelSearch)
|
||||||
, _lockUnlock(this, st::dialogsLock)
|
, _lockUnlock(this, st::dialogsLock)
|
||||||
, _scroll(this, st::dialogsScroll) {
|
, _scroll(this, st::dialogsScroll) {
|
||||||
|
@ -2291,6 +2293,7 @@ DialogsWidget::DialogsWidget(QWidget *parent) : TWidget(parent)
|
||||||
subscribe(Adaptive::Changed(), [this] { updateForwardBar(); });
|
subscribe(Adaptive::Changed(), [this] { updateForwardBar(); });
|
||||||
|
|
||||||
_cancelSearch->setClickedCallback([this] { onCancelSearch(); });
|
_cancelSearch->setClickedCallback([this] { onCancelSearch(); });
|
||||||
|
_jumpToDate->entity()->setClickedCallback([this] { jumpToDate(); });
|
||||||
_lockUnlock->setVisible(Global::LocalPasscode());
|
_lockUnlock->setVisible(Global::LocalPasscode());
|
||||||
subscribe(Global::RefLocalPasscodeChanged(), [this] { updateLockUnlockVisibility(); });
|
subscribe(Global::RefLocalPasscodeChanged(), [this] { updateLockUnlockVisibility(); });
|
||||||
_lockUnlock->setClickedCallback([this] {
|
_lockUnlock->setClickedCallback([this] {
|
||||||
|
@ -2318,6 +2321,8 @@ DialogsWidget::DialogsWidget(QWidget *parent) : TWidget(parent)
|
||||||
|
|
||||||
_filter->setFocusPolicy(Qt::StrongFocus);
|
_filter->setFocusPolicy(Qt::StrongFocus);
|
||||||
_filter->customUpDown(true);
|
_filter->customUpDown(true);
|
||||||
|
|
||||||
|
updateJumpToDateVisibility(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
@ -2343,6 +2348,10 @@ void DialogsWidget::activate() {
|
||||||
_inner->activate();
|
_inner->activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogsWidget::jumpToDate() {
|
||||||
|
Ui::show(Box<InformBox>("not implemented"));
|
||||||
|
}
|
||||||
|
|
||||||
void DialogsWidget::createDialog(History *history) {
|
void DialogsWidget::createDialog(History *history) {
|
||||||
auto creating = !history->inChatList(Dialogs::Mode::All);
|
auto creating = !history->inChatList(Dialogs::Mode::All);
|
||||||
_inner->createDialog(history);
|
_inner->createDialog(history);
|
||||||
|
@ -2413,6 +2422,7 @@ void DialogsWidget::showAnimated(Window::SlideDirection direction, const Window:
|
||||||
if (_forwardCancel) _forwardCancel->hide();
|
if (_forwardCancel) _forwardCancel->hide();
|
||||||
_filter->hide();
|
_filter->hide();
|
||||||
_cancelSearch->hideFast();
|
_cancelSearch->hideFast();
|
||||||
|
_jumpToDate->hideFast();
|
||||||
_lockUnlock->hide();
|
_lockUnlock->hide();
|
||||||
|
|
||||||
int delta = st::slideShift;
|
int delta = st::slideShift;
|
||||||
|
@ -2432,6 +2442,7 @@ void DialogsWidget::animationCallback() {
|
||||||
if (_forwardCancel) _forwardCancel->show();
|
if (_forwardCancel) _forwardCancel->show();
|
||||||
_filter->show();
|
_filter->show();
|
||||||
updateLockUnlockVisibility();
|
updateLockUnlockVisibility();
|
||||||
|
updateJumpToDateVisibility(true);
|
||||||
|
|
||||||
onFilterUpdate();
|
onFilterUpdate();
|
||||||
if (App::wnd()) App::wnd()->setInnerFocus();
|
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||||
|
@ -2941,7 +2952,7 @@ void DialogsWidget::onListScroll() {
|
||||||
void DialogsWidget::onFilterUpdate(bool force) {
|
void DialogsWidget::onFilterUpdate(bool force) {
|
||||||
if (_a_show.animating() && !force) return;
|
if (_a_show.animating() && !force) return;
|
||||||
|
|
||||||
QString filterText = _filter->getLastText();
|
auto filterText = _filter->getLastText();
|
||||||
_inner->onFilterUpdate(filterText, force);
|
_inner->onFilterUpdate(filterText, force);
|
||||||
if (filterText.isEmpty()) {
|
if (filterText.isEmpty()) {
|
||||||
_searchCache.clear();
|
_searchCache.clear();
|
||||||
|
@ -2951,6 +2962,8 @@ void DialogsWidget::onFilterUpdate(bool force) {
|
||||||
} else {
|
} else {
|
||||||
_cancelSearch->showAnimated();
|
_cancelSearch->showAnimated();
|
||||||
}
|
}
|
||||||
|
updateJumpToDateVisibility();
|
||||||
|
|
||||||
if (filterText.size() < MinUsernameLength) {
|
if (filterText.size() < MinUsernameLength) {
|
||||||
_peerSearchCache.clear();
|
_peerSearchCache.clear();
|
||||||
_peerSearchQueries.clear();
|
_peerSearchQueries.clear();
|
||||||
|
@ -2970,6 +2983,7 @@ void DialogsWidget::setSearchInPeer(PeerData *peer) {
|
||||||
if (newSearchInPeer != _searchInPeer) {
|
if (newSearchInPeer != _searchInPeer) {
|
||||||
_searchInPeer = newSearchInPeer;
|
_searchInPeer = newSearchInPeer;
|
||||||
App::main()->searchInPeerChanged().notify(_searchInPeer, true);
|
App::main()->searchInPeerChanged().notify(_searchInPeer, true);
|
||||||
|
updateJumpToDateVisibility();
|
||||||
}
|
}
|
||||||
_inner->searchInPeer(_searchInPeer);
|
_inner->searchInPeer(_searchInPeer);
|
||||||
}
|
}
|
||||||
|
@ -3028,6 +3042,22 @@ void DialogsWidget::updateLockUnlockVisibility() {
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogsWidget::updateJumpToDateVisibility(bool fast) {
|
||||||
|
if (_a_show.animating()) return;
|
||||||
|
|
||||||
|
if (_searchInPeer && _filter->getLastText().isEmpty()) {
|
||||||
|
if (fast) {
|
||||||
|
_jumpToDate->showFast();
|
||||||
|
} else {
|
||||||
|
_jumpToDate->showAnimated();
|
||||||
|
}
|
||||||
|
} else if (fast) {
|
||||||
|
_jumpToDate->hideFast();
|
||||||
|
} else {
|
||||||
|
_jumpToDate->hideAnimated();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DialogsWidget::updateControlsGeometry() {
|
void DialogsWidget::updateControlsGeometry() {
|
||||||
auto filterAreaTop = 0;
|
auto filterAreaTop = 0;
|
||||||
if (_forwardCancel) {
|
if (_forwardCancel) {
|
||||||
|
@ -3047,6 +3077,7 @@ void DialogsWidget::updateControlsGeometry() {
|
||||||
_mainMenuToggle->moveToLeft(mainMenuLeft, filterAreaTop + st::dialogsFilterPadding.y());
|
_mainMenuToggle->moveToLeft(mainMenuLeft, filterAreaTop + st::dialogsFilterPadding.y());
|
||||||
_lockUnlock->moveToLeft(filterLeft + filterWidth + st::dialogsFilterPadding.x(), filterAreaTop + st::dialogsFilterPadding.y());
|
_lockUnlock->moveToLeft(filterLeft + filterWidth + st::dialogsFilterPadding.x(), filterAreaTop + st::dialogsFilterPadding.y());
|
||||||
_cancelSearch->moveToLeft(filterLeft + filterWidth - _cancelSearch->width(), _filter->y());
|
_cancelSearch->moveToLeft(filterLeft + filterWidth - _cancelSearch->width(), _filter->y());
|
||||||
|
_jumpToDate->moveToLeft(filterLeft + filterWidth - _jumpToDate->width(), _filter->y());
|
||||||
|
|
||||||
auto scrollTop = filterAreaTop + filterAreaHeight;
|
auto scrollTop = filterAreaTop + filterAreaHeight;
|
||||||
auto addToScroll = App::main() ? App::main()->contentScrollAddToY() : 0;
|
auto addToScroll = App::main() ? App::main()->contentScrollAddToY() : 0;
|
||||||
|
|
|
@ -37,6 +37,8 @@ class FlatButton;
|
||||||
class LinkButton;
|
class LinkButton;
|
||||||
class FlatInput;
|
class FlatInput;
|
||||||
class CrossButton;
|
class CrossButton;
|
||||||
|
template <typename Widget>
|
||||||
|
class WidgetScaledFadeWrap;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
enum DialogsSearchRequestType {
|
enum DialogsSearchRequestType {
|
||||||
|
@ -391,9 +393,12 @@ private:
|
||||||
void searchReceived(DialogsSearchRequestType type, const MTPmessages_Messages &result, mtpRequestId requestId);
|
void searchReceived(DialogsSearchRequestType type, const MTPmessages_Messages &result, mtpRequestId requestId);
|
||||||
void peerSearchReceived(const MTPcontacts_Found &result, mtpRequestId requestId);
|
void peerSearchReceived(const MTPcontacts_Found &result, mtpRequestId requestId);
|
||||||
|
|
||||||
|
void jumpToDate();
|
||||||
|
|
||||||
void setSearchInPeer(PeerData *peer);
|
void setSearchInPeer(PeerData *peer);
|
||||||
void showMainMenu();
|
void showMainMenu();
|
||||||
void updateLockUnlockVisibility();
|
void updateLockUnlockVisibility();
|
||||||
|
void updateJumpToDateVisibility(bool fast = false);
|
||||||
void updateControlsGeometry();
|
void updateControlsGeometry();
|
||||||
void updateForwardBar();
|
void updateForwardBar();
|
||||||
|
|
||||||
|
@ -419,6 +424,7 @@ private:
|
||||||
object_ptr<Ui::IconButton> _forwardCancel = { nullptr };
|
object_ptr<Ui::IconButton> _forwardCancel = { nullptr };
|
||||||
object_ptr<Ui::IconButton> _mainMenuToggle;
|
object_ptr<Ui::IconButton> _mainMenuToggle;
|
||||||
object_ptr<Ui::FlatInput> _filter;
|
object_ptr<Ui::FlatInput> _filter;
|
||||||
|
object_ptr<Ui::WidgetScaledFadeWrap<Ui::IconButton>> _jumpToDate;
|
||||||
object_ptr<Ui::CrossButton> _cancelSearch;
|
object_ptr<Ui::CrossButton> _cancelSearch;
|
||||||
object_ptr<Ui::IconButton> _lockUnlock;
|
object_ptr<Ui::IconButton> _lockUnlock;
|
||||||
object_ptr<Ui::ScrollArea> _scroll;
|
object_ptr<Ui::ScrollArea> _scroll;
|
||||||
|
|
Loading…
Reference in New Issue