mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Renamed swipe dialog action to quick dialog action.
This commit is contained in:
parent
b079c79390
commit
25ed8fe044
14 changed files with 161 additions and 158 deletions
|
@ -682,14 +682,14 @@ PRIVATE
|
||||||
dialogs/dialogs_main_list.h
|
dialogs/dialogs_main_list.h
|
||||||
dialogs/dialogs_pinned_list.cpp
|
dialogs/dialogs_pinned_list.cpp
|
||||||
dialogs/dialogs_pinned_list.h
|
dialogs/dialogs_pinned_list.h
|
||||||
|
dialogs/dialogs_quick_action.cpp
|
||||||
|
dialogs/dialogs_quick_action.h
|
||||||
dialogs/dialogs_row.cpp
|
dialogs/dialogs_row.cpp
|
||||||
dialogs/dialogs_row.h
|
dialogs/dialogs_row.h
|
||||||
dialogs/dialogs_search_from_controllers.cpp
|
dialogs/dialogs_search_from_controllers.cpp
|
||||||
dialogs/dialogs_search_from_controllers.h
|
dialogs/dialogs_search_from_controllers.h
|
||||||
dialogs/dialogs_search_tags.cpp
|
dialogs/dialogs_search_tags.cpp
|
||||||
dialogs/dialogs_search_tags.h
|
dialogs/dialogs_search_tags.h
|
||||||
dialogs/dialogs_swipe_action.cpp
|
|
||||||
dialogs/dialogs_swipe_action.h
|
|
||||||
dialogs/dialogs_widget.cpp
|
dialogs/dialogs_widget.cpp
|
||||||
dialogs/dialogs_widget.h
|
dialogs/dialogs_widget.h
|
||||||
editor/color_picker.cpp
|
editor/color_picker.cpp
|
||||||
|
|
|
@ -402,7 +402,7 @@ QByteArray Settings::serialize() const {
|
||||||
<< SerializeVideoQuality(_videoQuality)
|
<< SerializeVideoQuality(_videoQuality)
|
||||||
<< qint32(_ivZoom.current())
|
<< qint32(_ivZoom.current())
|
||||||
<< qint32(_systemDarkModeEnabled.current() ? 1 : 0)
|
<< qint32(_systemDarkModeEnabled.current() ? 1 : 0)
|
||||||
<< qint32(_swipeDialogAction);
|
<< qint32(_quickDialogAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ensures(result.size() == size);
|
Ensures(result.size() == size);
|
||||||
|
@ -531,7 +531,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
qint32 recordVideoMessages = _recordVideoMessages ? 1 : 0;
|
qint32 recordVideoMessages = _recordVideoMessages ? 1 : 0;
|
||||||
quint32 videoQuality = SerializeVideoQuality(_videoQuality);
|
quint32 videoQuality = SerializeVideoQuality(_videoQuality);
|
||||||
quint32 chatFiltersHorizontal = _chatFiltersHorizontal.current() ? 1 : 0;
|
quint32 chatFiltersHorizontal = _chatFiltersHorizontal.current() ? 1 : 0;
|
||||||
quint32 swipeDialogAction = quint32(_swipeDialogAction);
|
quint32 quickDialogAction = quint32(_quickDialogAction);
|
||||||
|
|
||||||
stream >> themesAccentColors;
|
stream >> themesAccentColors;
|
||||||
if (!stream.atEnd()) {
|
if (!stream.atEnd()) {
|
||||||
|
@ -861,7 +861,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
stream >> systemDarkModeEnabled;
|
stream >> systemDarkModeEnabled;
|
||||||
}
|
}
|
||||||
if (!stream.atEnd()) {
|
if (!stream.atEnd()) {
|
||||||
stream >> swipeDialogAction;
|
stream >> quickDialogAction;
|
||||||
}
|
}
|
||||||
if (stream.status() != QDataStream::Ok) {
|
if (stream.status() != QDataStream::Ok) {
|
||||||
LOG(("App Error: "
|
LOG(("App Error: "
|
||||||
|
@ -1084,7 +1084,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
_recordVideoMessages = (recordVideoMessages == 1);
|
_recordVideoMessages = (recordVideoMessages == 1);
|
||||||
_videoQuality = DeserializeVideoQuality(videoQuality);
|
_videoQuality = DeserializeVideoQuality(videoQuality);
|
||||||
_chatFiltersHorizontal = (chatFiltersHorizontal == 1);
|
_chatFiltersHorizontal = (chatFiltersHorizontal == 1);
|
||||||
_swipeDialogAction = Dialogs::Ui::SwipeDialogAction(swipeDialogAction);
|
_quickDialogAction = Dialogs::Ui::QuickDialogAction(quickDialogAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Settings::getSoundPath(const QString &key) const {
|
QString Settings::getSoundPath(const QString &key) const {
|
||||||
|
@ -1476,7 +1476,7 @@ void Settings::resetOnLastLogout() {
|
||||||
_recordVideoMessages = false;
|
_recordVideoMessages = false;
|
||||||
_videoQuality = {};
|
_videoQuality = {};
|
||||||
_chatFiltersHorizontal = false;
|
_chatFiltersHorizontal = false;
|
||||||
_swipeDialogAction = Dialogs::Ui::SwipeDialogAction::Disabled;
|
_quickDialogAction = Dialogs::Ui::QuickDialogAction::Disabled;
|
||||||
|
|
||||||
_recentEmojiPreload.clear();
|
_recentEmojiPreload.clear();
|
||||||
_recentEmoji.clear();
|
_recentEmoji.clear();
|
||||||
|
@ -1664,12 +1664,12 @@ void Settings::setChatFiltersHorizontal(bool value) {
|
||||||
_chatFiltersHorizontal = value;
|
_chatFiltersHorizontal = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialogs::Ui::SwipeDialogAction Settings::swipeDialogAction() const {
|
Dialogs::Ui::QuickDialogAction Settings::quickDialogAction() const {
|
||||||
return _swipeDialogAction;
|
return _quickDialogAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::setSwipeDialogAction(Dialogs::Ui::SwipeDialogAction action) {
|
void Settings::setQuickDialogAction(Dialogs::Ui::QuickDialogAction action) {
|
||||||
_swipeDialogAction = action;
|
_quickDialogAction = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
|
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "core/core_settings_proxy.h"
|
#include "core/core_settings_proxy.h"
|
||||||
#include "media/media_common.h"
|
#include "media/media_common.h"
|
||||||
#include "dialogs/ui/dialogs_swipe_context.h"
|
#include "dialogs/ui/dialogs_quick_action_context.h"
|
||||||
#include "window/themes/window_themes_embedded.h"
|
#include "window/themes/window_themes_embedded.h"
|
||||||
#include "ui/chat/attach/attach_send_files_way.h"
|
#include "ui/chat/attach/attach_send_files_way.h"
|
||||||
#include "base/flags.h"
|
#include "base/flags.h"
|
||||||
|
@ -947,8 +947,8 @@ public:
|
||||||
[[nodiscard]] static PlaybackSpeed DeserializePlaybackSpeed(
|
[[nodiscard]] static PlaybackSpeed DeserializePlaybackSpeed(
|
||||||
qint32 speed);
|
qint32 speed);
|
||||||
|
|
||||||
[[nodiscard]] Dialogs::Ui::SwipeDialogAction swipeDialogAction() const;
|
[[nodiscard]] Dialogs::Ui::QuickDialogAction quickDialogAction() const;
|
||||||
void setSwipeDialogAction(Dialogs::Ui::SwipeDialogAction);
|
void setQuickDialogAction(Dialogs::Ui::QuickDialogAction);
|
||||||
|
|
||||||
void resetOnLastLogout();
|
void resetOnLastLogout();
|
||||||
|
|
||||||
|
@ -1090,8 +1090,8 @@ private:
|
||||||
|
|
||||||
bool _recordVideoMessages = false;
|
bool _recordVideoMessages = false;
|
||||||
|
|
||||||
Dialogs::Ui::SwipeDialogAction _swipeDialogAction
|
Dialogs::Ui::QuickDialogAction _quickDialogAction
|
||||||
= Dialogs::Ui::SwipeDialogAction::Disabled;
|
= Dialogs::Ui::QuickDialogAction::Disabled;
|
||||||
|
|
||||||
QByteArray _photoEditorBrush;
|
QByteArray _photoEditorBrush;
|
||||||
|
|
||||||
|
|
|
@ -790,4 +790,4 @@ dialogsPopularAppsAbout: FlatLabel(boxDividerLabel) {
|
||||||
minWidth: 128px;
|
minWidth: 128px;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogsSwipeActionSize: 20px;
|
dialogsQuickActionSize: 20px;
|
||||||
|
|
|
@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "dialogs/dialogs_widget.h"
|
#include "dialogs/dialogs_widget.h"
|
||||||
#include "dialogs/dialogs_search_from_controllers.h"
|
#include "dialogs/dialogs_search_from_controllers.h"
|
||||||
#include "dialogs/dialogs_search_tags.h"
|
#include "dialogs/dialogs_search_tags.h"
|
||||||
#include "dialogs/dialogs_swipe_action.h"
|
#include "dialogs/dialogs_quick_action.h"
|
||||||
#include "history/view/history_view_context_menu.h"
|
#include "history/view/history_view_context_menu.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
|
@ -810,7 +810,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
|
||||||
const auto ms = crl::now();
|
const auto ms = crl::now();
|
||||||
const auto childListShown = _childListShown.current();
|
const auto childListShown = _childListShown.current();
|
||||||
auto context = Ui::PaintContext{
|
auto context = Ui::PaintContext{
|
||||||
.swipeContext = _swipeContext,
|
.quickActionContext = _quickActionContext,
|
||||||
.st = _st,
|
.st = _st,
|
||||||
.topicJumpCache = _topicJumpCache.get(),
|
.topicJumpCache = _topicJumpCache.get(),
|
||||||
.folder = _openedFolder,
|
.folder = _openedFolder,
|
||||||
|
@ -4996,22 +4996,23 @@ rpl::producer<UserId> InnerWidget::openBotMainAppRequests() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InnerWidget::setSwipeContextData(Ui::Controls::SwipeContextData data) {
|
void InnerWidget::setSwipeContextData(Ui::Controls::SwipeContextData data) {
|
||||||
_swipeContext.data = std::move(data);
|
_quickActionContext.data = std::move(data);
|
||||||
if (_swipeContext.data.msgBareId) {
|
if (_quickActionContext.data.msgBareId) {
|
||||||
constexpr auto kStartAnimateThreshold = 0.32;
|
constexpr auto kStartAnimateThreshold = 0.32;
|
||||||
constexpr auto kResetAnimateThreshold = 0.24;
|
constexpr auto kResetAnimateThreshold = 0.24;
|
||||||
if (_swipeContext.data.ratio > kStartAnimateThreshold) {
|
if (_quickActionContext.data.ratio > kStartAnimateThreshold) {
|
||||||
if (_swipeContext.icon
|
if (_quickActionContext.icon
|
||||||
&& !_swipeContext.icon->frameIndex()
|
&& !_quickActionContext.icon->frameIndex()
|
||||||
&& !_swipeContext.icon->animating()) {
|
&& !_quickActionContext.icon->animating()) {
|
||||||
_swipeContext.icon->animate(
|
_quickActionContext.icon->animate(
|
||||||
[=] { update(); },
|
[=] { update(); },
|
||||||
0,
|
0,
|
||||||
_swipeContext.icon->framesCount());
|
_quickActionContext.icon->framesCount());
|
||||||
}
|
}
|
||||||
} else if (_swipeContext.data.ratio < kResetAnimateThreshold) {
|
} else if (_quickActionContext.data.ratio < kResetAnimateThreshold) {
|
||||||
if (_swipeContext.icon && _swipeContext.icon->frameIndex()) {
|
if (_quickActionContext.icon
|
||||||
_swipeContext.icon->jumpTo(0, [=] { update(); });
|
&& _quickActionContext.icon->frameIndex()) {
|
||||||
|
_quickActionContext.icon->jumpTo(0, [=] { update(); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
|
@ -5034,24 +5035,24 @@ int64 InnerWidget::calcSwipeKey(int top) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InnerWidget::prepareSwipeAction(
|
void InnerWidget::prepareQuickAction(
|
||||||
int64 key,
|
int64 key,
|
||||||
Dialogs::Ui::SwipeDialogAction action) {
|
Dialogs::Ui::QuickDialogAction action) {
|
||||||
if (key) {
|
if (key) {
|
||||||
const auto peer = session().data().peer(PeerId(key));
|
const auto peer = session().data().peer(PeerId(key));
|
||||||
auto name = ResolveSwipeDialogLottieIconName(peer, action, _filterId);
|
auto name = ResolveQuickDialogLottieIconName(peer, action, _filterId);
|
||||||
_swipeLottieIcon = Lottie::MakeIcon({
|
_quickActionLottieIcon = Lottie::MakeIcon({
|
||||||
.name = std::move(name),
|
.name = std::move(name),
|
||||||
.sizeOverride = Size(st::dialogsSwipeActionSize),
|
.sizeOverride = Size(st::dialogsQuickActionSize),
|
||||||
});
|
});
|
||||||
_swipeContext.icon = _swipeLottieIcon.get();
|
_quickActionContext.icon = _quickActionLottieIcon.get();
|
||||||
_swipeContext.action = action;
|
_quickActionContext.action = action;
|
||||||
} else {
|
} else {
|
||||||
if (_swipeContext.icon) {
|
if (_quickActionContext.icon) {
|
||||||
_swipeContext = {};
|
_quickActionContext = {};
|
||||||
}
|
}
|
||||||
if (_swipeLottieIcon) {
|
if (_quickActionLottieIcon) {
|
||||||
_swipeLottieIcon.reset();
|
_quickActionLottieIcon.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/object_ptr.h"
|
#include "base/object_ptr.h"
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
#include "dialogs/dialogs_key.h"
|
#include "dialogs/dialogs_key.h"
|
||||||
#include "dialogs/ui/dialogs_swipe_context.h"
|
#include "dialogs/ui/dialogs_quick_action_context.h"
|
||||||
#include "data/data_messages.h"
|
#include "data/data_messages.h"
|
||||||
#include "ui/dragging_scroll_manager.h"
|
#include "ui/dragging_scroll_manager.h"
|
||||||
#include "ui/effects/animations.h"
|
#include "ui/effects/animations.h"
|
||||||
|
@ -40,7 +40,7 @@ class PopupMenu;
|
||||||
class FlatLabel;
|
class FlatLabel;
|
||||||
struct ScrollToRequest;
|
struct ScrollToRequest;
|
||||||
namespace Controls {
|
namespace Controls {
|
||||||
enum class SwipeDialogAction;
|
enum class QuickDialogAction;
|
||||||
} // namespace Controls
|
} // namespace Controls
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ public:
|
||||||
|
|
||||||
void setSwipeContextData(Ui::Controls::SwipeContextData data);
|
void setSwipeContextData(Ui::Controls::SwipeContextData data);
|
||||||
[[nodiscard]] int64 calcSwipeKey(int top);
|
[[nodiscard]] int64 calcSwipeKey(int top);
|
||||||
void prepareSwipeAction(int64 key, Dialogs::Ui::SwipeDialogAction);
|
void prepareQuickAction(int64 key, Dialogs::Ui::QuickDialogAction);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void visibleTopBottomUpdated(
|
void visibleTopBottomUpdated(
|
||||||
|
@ -623,8 +623,8 @@ private:
|
||||||
rpl::event_stream<> _refreshHashtagsRequests;
|
rpl::event_stream<> _refreshHashtagsRequests;
|
||||||
rpl::event_stream<UserId> _openBotMainAppRequests;
|
rpl::event_stream<UserId> _openBotMainAppRequests;
|
||||||
|
|
||||||
Dialogs::Ui::SwipeContext _swipeContext;
|
Dialogs::Ui::QuickActionContext _quickActionContext;
|
||||||
std::unique_ptr<Lottie::Icon> _swipeLottieIcon = nullptr;
|
std::unique_ptr<Lottie::Icon> _quickActionLottieIcon = nullptr;
|
||||||
|
|
||||||
RowDescriptor _chatPreviewRow;
|
RowDescriptor _chatPreviewRow;
|
||||||
bool _chatPreviewScheduled = false;
|
bool _chatPreviewScheduled = false;
|
||||||
|
|
|
@ -5,9 +5,9 @@ the official desktop application for the Telegram messaging service.
|
||||||
For license and copyright information please follow this link:
|
For license and copyright information please follow this link:
|
||||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "dialogs/dialogs_swipe_action.h"
|
#include "dialogs/dialogs_quick_action.h"
|
||||||
|
|
||||||
#include "dialogs/ui/dialogs_swipe_context.h"
|
#include "dialogs/ui/dialogs_quick_action_context.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "data/data_histories.h"
|
#include "data/data_histories.h"
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
|
@ -22,144 +22,144 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
namespace Dialogs {
|
namespace Dialogs {
|
||||||
|
|
||||||
void PerformSwipeDialogAction(
|
void PerformQuickDialogAction(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Ui::SwipeDialogAction action,
|
Ui::QuickDialogAction action,
|
||||||
FilterId filterId) {
|
FilterId filterId) {
|
||||||
const auto history = peer->owner().history(peer);
|
const auto history = peer->owner().history(peer);
|
||||||
if (action == Dialogs::Ui::SwipeDialogAction::Mute) {
|
if (action == Dialogs::Ui::QuickDialogAction::Mute) {
|
||||||
const auto isMuted = rpl::variable<bool>(
|
const auto isMuted = rpl::variable<bool>(
|
||||||
MuteMenu::ThreadDescriptor(history).isMutedValue()).current();
|
MuteMenu::ThreadDescriptor(history).isMutedValue()).current();
|
||||||
MuteMenu::ThreadDescriptor(history).updateMutePeriod(isMuted
|
MuteMenu::ThreadDescriptor(history).updateMutePeriod(isMuted
|
||||||
? 0
|
? 0
|
||||||
: std::numeric_limits<TimeId>::max());
|
: std::numeric_limits<TimeId>::max());
|
||||||
} else if (action == Dialogs::Ui::SwipeDialogAction::Pin) {
|
} else if (action == Dialogs::Ui::QuickDialogAction::Pin) {
|
||||||
const auto entry = (Dialogs::Entry*)(history);
|
const auto entry = (Dialogs::Entry*)(history);
|
||||||
Window::TogglePinnedThread(controller, entry, filterId);
|
Window::TogglePinnedThread(controller, entry, filterId);
|
||||||
} else if (action == Dialogs::Ui::SwipeDialogAction::Read) {
|
} else if (action == Dialogs::Ui::QuickDialogAction::Read) {
|
||||||
if (Window::IsUnreadThread(history)) {
|
if (Window::IsUnreadThread(history)) {
|
||||||
Window::MarkAsReadThread(history);
|
Window::MarkAsReadThread(history);
|
||||||
} else if (history) {
|
} else if (history) {
|
||||||
peer->owner().histories().changeDialogUnreadMark(history, true);
|
peer->owner().histories().changeDialogUnreadMark(history, true);
|
||||||
}
|
}
|
||||||
} else if (action == Dialogs::Ui::SwipeDialogAction::Archive) {
|
} else if (action == Dialogs::Ui::QuickDialogAction::Archive) {
|
||||||
history->session().api().toggleHistoryArchived(
|
history->session().api().toggleHistoryArchived(
|
||||||
history,
|
history,
|
||||||
!Window::IsArchived(history),
|
!Window::IsArchived(history),
|
||||||
[] {});
|
[] {});
|
||||||
} else if (action == Dialogs::Ui::SwipeDialogAction::Delete) {
|
} else if (action == Dialogs::Ui::QuickDialogAction::Delete) {
|
||||||
Window::DeleteAndLeaveHandler(controller, peer)();
|
Window::DeleteAndLeaveHandler(controller, peer)();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ResolveSwipeDialogLottieIconName(
|
QString ResolveQuickDialogLottieIconName(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Ui::SwipeDialogAction action,
|
Ui::QuickDialogAction action,
|
||||||
FilterId filterId) {
|
FilterId filterId) {
|
||||||
if (action == Dialogs::Ui::SwipeDialogAction::Mute) {
|
if (action == Dialogs::Ui::QuickDialogAction::Mute) {
|
||||||
const auto history = peer->owner().history(peer);
|
const auto history = peer->owner().history(peer);
|
||||||
const auto isMuted = rpl::variable<bool>(
|
const auto isMuted = rpl::variable<bool>(
|
||||||
MuteMenu::ThreadDescriptor(history).isMutedValue()).current();
|
MuteMenu::ThreadDescriptor(history).isMutedValue()).current();
|
||||||
return isMuted ? u"swipe_unmute"_q : u"swipe_mute"_q;
|
return isMuted ? u"swipe_unmute"_q : u"swipe_mute"_q;
|
||||||
} else if (action == Dialogs::Ui::SwipeDialogAction::Pin) {
|
} else if (action == Dialogs::Ui::QuickDialogAction::Pin) {
|
||||||
const auto history = peer->owner().history(peer);
|
const auto history = peer->owner().history(peer);
|
||||||
const auto entry = (Dialogs::Entry*)(history);
|
const auto entry = (Dialogs::Entry*)(history);
|
||||||
return entry->isPinnedDialog(filterId)
|
return entry->isPinnedDialog(filterId)
|
||||||
? u"swipe_unpin"_q
|
? u"swipe_unpin"_q
|
||||||
: u"swipe_pin"_q;
|
: u"swipe_pin"_q;
|
||||||
} else if (action == Dialogs::Ui::SwipeDialogAction::Read) {
|
} else if (action == Dialogs::Ui::QuickDialogAction::Read) {
|
||||||
const auto history = peer->owner().history(peer);
|
const auto history = peer->owner().history(peer);
|
||||||
return Window::IsUnreadThread(history)
|
return Window::IsUnreadThread(history)
|
||||||
? u"swipe_read"_q
|
? u"swipe_read"_q
|
||||||
: u"swipe_unread"_q;
|
: u"swipe_unread"_q;
|
||||||
} else if (action == Dialogs::Ui::SwipeDialogAction::Archive) {
|
} else if (action == Dialogs::Ui::QuickDialogAction::Archive) {
|
||||||
const auto history = peer->owner().history(peer);
|
const auto history = peer->owner().history(peer);
|
||||||
return Window::IsArchived(history)
|
return Window::IsArchived(history)
|
||||||
? u"swipe_unarchive"_q
|
? u"swipe_unarchive"_q
|
||||||
: u"swipe_archive"_q;
|
: u"swipe_archive"_q;
|
||||||
} else if (action == Dialogs::Ui::SwipeDialogAction::Delete) {
|
} else if (action == Dialogs::Ui::QuickDialogAction::Delete) {
|
||||||
return u"swipe_delete"_q;
|
return u"swipe_delete"_q;
|
||||||
}
|
}
|
||||||
return u"swipe_disabled"_q;
|
return u"swipe_disabled"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ui::SwipeDialogActionLabel ResolveSwipeDialogLabel(
|
Ui::QuickDialogActionLabel ResolveQuickDialogLabel(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
Ui::SwipeDialogAction action,
|
Ui::QuickDialogAction action,
|
||||||
FilterId filterId) {
|
FilterId filterId) {
|
||||||
if (action == Dialogs::Ui::SwipeDialogAction::Mute) {
|
if (action == Dialogs::Ui::QuickDialogAction::Mute) {
|
||||||
const auto isMuted = rpl::variable<bool>(
|
const auto isMuted = rpl::variable<bool>(
|
||||||
MuteMenu::ThreadDescriptor(history).isMutedValue()).current();
|
MuteMenu::ThreadDescriptor(history).isMutedValue()).current();
|
||||||
return isMuted
|
return isMuted
|
||||||
? Ui::SwipeDialogActionLabel::Unmute
|
? Ui::QuickDialogActionLabel::Unmute
|
||||||
: Ui::SwipeDialogActionLabel::Mute;
|
: Ui::QuickDialogActionLabel::Mute;
|
||||||
} else if (action == Dialogs::Ui::SwipeDialogAction::Pin) {
|
} else if (action == Dialogs::Ui::QuickDialogAction::Pin) {
|
||||||
const auto entry = (Dialogs::Entry*)(history);
|
const auto entry = (Dialogs::Entry*)(history);
|
||||||
return entry->isPinnedDialog(filterId)
|
return entry->isPinnedDialog(filterId)
|
||||||
? Ui::SwipeDialogActionLabel::Unpin
|
? Ui::QuickDialogActionLabel::Unpin
|
||||||
: Ui::SwipeDialogActionLabel::Pin;
|
: Ui::QuickDialogActionLabel::Pin;
|
||||||
} else if (action == Dialogs::Ui::SwipeDialogAction::Read) {
|
} else if (action == Dialogs::Ui::QuickDialogAction::Read) {
|
||||||
return Window::IsUnreadThread(history)
|
return Window::IsUnreadThread(history)
|
||||||
? Ui::SwipeDialogActionLabel::Read
|
? Ui::QuickDialogActionLabel::Read
|
||||||
: Ui::SwipeDialogActionLabel::Unread;
|
: Ui::QuickDialogActionLabel::Unread;
|
||||||
} else if (action == Dialogs::Ui::SwipeDialogAction::Archive) {
|
} else if (action == Dialogs::Ui::QuickDialogAction::Archive) {
|
||||||
return Window::IsArchived(history)
|
return Window::IsArchived(history)
|
||||||
? Ui::SwipeDialogActionLabel::Unarchive
|
? Ui::QuickDialogActionLabel::Unarchive
|
||||||
: Ui::SwipeDialogActionLabel::Archive;
|
: Ui::QuickDialogActionLabel::Archive;
|
||||||
} else if (action == Dialogs::Ui::SwipeDialogAction::Delete) {
|
} else if (action == Dialogs::Ui::QuickDialogAction::Delete) {
|
||||||
return Ui::SwipeDialogActionLabel::Delete;
|
return Ui::QuickDialogActionLabel::Delete;
|
||||||
}
|
}
|
||||||
return Ui::SwipeDialogActionLabel::Disabled;
|
return Ui::QuickDialogActionLabel::Disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ResolveSwipeDialogLabel(Ui::SwipeDialogActionLabel action) {
|
QString ResolveQuickDialogLabel(Ui::QuickDialogActionLabel action) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case Ui::SwipeDialogActionLabel::Mute:
|
case Ui::QuickDialogActionLabel::Mute:
|
||||||
return tr::lng_settings_swipe_mute(tr::now);
|
return tr::lng_settings_swipe_mute(tr::now);
|
||||||
case Ui::SwipeDialogActionLabel::Unmute:
|
case Ui::QuickDialogActionLabel::Unmute:
|
||||||
return tr::lng_settings_swipe_unmute(tr::now);
|
return tr::lng_settings_swipe_unmute(tr::now);
|
||||||
case Ui::SwipeDialogActionLabel::Pin:
|
case Ui::QuickDialogActionLabel::Pin:
|
||||||
return tr::lng_settings_swipe_pin(tr::now);
|
return tr::lng_settings_swipe_pin(tr::now);
|
||||||
case Ui::SwipeDialogActionLabel::Unpin:
|
case Ui::QuickDialogActionLabel::Unpin:
|
||||||
return tr::lng_settings_swipe_unpin(tr::now);
|
return tr::lng_settings_swipe_unpin(tr::now);
|
||||||
case Ui::SwipeDialogActionLabel::Read:
|
case Ui::QuickDialogActionLabel::Read:
|
||||||
return tr::lng_settings_swipe_read(tr::now);
|
return tr::lng_settings_swipe_read(tr::now);
|
||||||
case Ui::SwipeDialogActionLabel::Unread:
|
case Ui::QuickDialogActionLabel::Unread:
|
||||||
return tr::lng_settings_swipe_unread(tr::now);
|
return tr::lng_settings_swipe_unread(tr::now);
|
||||||
case Ui::SwipeDialogActionLabel::Archive:
|
case Ui::QuickDialogActionLabel::Archive:
|
||||||
return tr::lng_settings_swipe_archive(tr::now);
|
return tr::lng_settings_swipe_archive(tr::now);
|
||||||
case Ui::SwipeDialogActionLabel::Unarchive:
|
case Ui::QuickDialogActionLabel::Unarchive:
|
||||||
return tr::lng_settings_swipe_unarchive(tr::now);
|
return tr::lng_settings_swipe_unarchive(tr::now);
|
||||||
case Ui::SwipeDialogActionLabel::Delete:
|
case Ui::QuickDialogActionLabel::Delete:
|
||||||
return tr::lng_settings_swipe_delete(tr::now);
|
return tr::lng_settings_swipe_delete(tr::now);
|
||||||
default:
|
default:
|
||||||
return tr::lng_settings_swipe_disabled(tr::now);
|
return tr::lng_settings_swipe_disabled(tr::now);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const style::color &ResolveSwipeActionBg(
|
const style::color &ResolveQuickActionBg(
|
||||||
Ui::SwipeDialogActionLabel action) {
|
Ui::QuickDialogActionLabel action) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case Ui::SwipeDialogActionLabel::Delete:
|
case Ui::QuickDialogActionLabel::Delete:
|
||||||
return st::attentionButtonFg;
|
return st::attentionButtonFg;
|
||||||
case Ui::SwipeDialogActionLabel::Disabled:
|
case Ui::QuickDialogActionLabel::Disabled:
|
||||||
return st::windowSubTextFgOver;
|
return st::windowSubTextFgOver;
|
||||||
case Ui::SwipeDialogActionLabel::Mute:
|
case Ui::QuickDialogActionLabel::Mute:
|
||||||
case Ui::SwipeDialogActionLabel::Unmute:
|
case Ui::QuickDialogActionLabel::Unmute:
|
||||||
case Ui::SwipeDialogActionLabel::Pin:
|
case Ui::QuickDialogActionLabel::Pin:
|
||||||
case Ui::SwipeDialogActionLabel::Unpin:
|
case Ui::QuickDialogActionLabel::Unpin:
|
||||||
case Ui::SwipeDialogActionLabel::Read:
|
case Ui::QuickDialogActionLabel::Read:
|
||||||
case Ui::SwipeDialogActionLabel::Unread:
|
case Ui::QuickDialogActionLabel::Unread:
|
||||||
case Ui::SwipeDialogActionLabel::Archive:
|
case Ui::QuickDialogActionLabel::Archive:
|
||||||
case Ui::SwipeDialogActionLabel::Unarchive:
|
case Ui::QuickDialogActionLabel::Unarchive:
|
||||||
default:
|
default:
|
||||||
return st::windowBgActive;
|
return st::windowBgActive;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const style::color &ResolveSwipeActionBgActive(
|
const style::color &ResolveQuickActionBgActive(
|
||||||
Ui::SwipeDialogActionLabel action) {
|
Ui::QuickDialogActionLabel action) {
|
||||||
return st::windowSubTextFgOver;
|
return st::windowSubTextFgOver;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ class History;
|
||||||
class PeerData;
|
class PeerData;
|
||||||
|
|
||||||
namespace Dialogs::Ui {
|
namespace Dialogs::Ui {
|
||||||
enum class SwipeDialogAction;
|
enum class QuickDialogAction;
|
||||||
enum class SwipeDialogActionLabel;
|
enum class QuickDialogActionLabel;
|
||||||
} // namespace Dialogs::Ui
|
} // namespace Dialogs::Ui
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
|
@ -21,27 +21,27 @@ class SessionController;
|
||||||
|
|
||||||
namespace Dialogs {
|
namespace Dialogs {
|
||||||
|
|
||||||
void PerformSwipeDialogAction(
|
void PerformQuickDialogAction(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Ui::SwipeDialogAction action,
|
Ui::QuickDialogAction action,
|
||||||
FilterId filterId);
|
FilterId filterId);
|
||||||
|
|
||||||
[[nodiscard]] QString ResolveSwipeDialogLottieIconName(
|
[[nodiscard]] QString ResolveQuickDialogLottieIconName(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Ui::SwipeDialogAction action,
|
Ui::QuickDialogAction action,
|
||||||
FilterId filterId);
|
FilterId filterId);
|
||||||
|
|
||||||
[[nodiscard]] Ui::SwipeDialogActionLabel ResolveSwipeDialogLabel(
|
[[nodiscard]] Ui::QuickDialogActionLabel ResolveQuickDialogLabel(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
Ui::SwipeDialogAction action,
|
Ui::QuickDialogAction action,
|
||||||
FilterId filterId);
|
FilterId filterId);
|
||||||
|
|
||||||
[[nodiscard]] QString ResolveSwipeDialogLabel(Ui::SwipeDialogActionLabel);
|
[[nodiscard]] QString ResolveQuickDialogLabel(Ui::QuickDialogActionLabel);
|
||||||
|
|
||||||
[[nodiscard]] const style::color &ResolveSwipeActionBg(
|
[[nodiscard]] const style::color &ResolveQuickActionBg(
|
||||||
Ui::SwipeDialogActionLabel);
|
Ui::QuickDialogActionLabel);
|
||||||
[[nodiscard]] const style::color &ResolveSwipeActionBgActive(
|
[[nodiscard]] const style::color &ResolveQuickActionBgActive(
|
||||||
Ui::SwipeDialogActionLabel);
|
Ui::QuickDialogActionLabel);
|
||||||
|
|
||||||
} // namespace Dialogs
|
} // namespace Dialogs
|
|
@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "dialogs/ui/dialogs_suggestions.h"
|
#include "dialogs/ui/dialogs_suggestions.h"
|
||||||
#include "dialogs/dialogs_inner_widget.h"
|
#include "dialogs/dialogs_inner_widget.h"
|
||||||
#include "dialogs/dialogs_search_from_controllers.h"
|
#include "dialogs/dialogs_search_from_controllers.h"
|
||||||
#include "dialogs/dialogs_swipe_action.h"
|
#include "dialogs/dialogs_quick_action.h"
|
||||||
#include "dialogs/dialogs_key.h"
|
#include "dialogs/dialogs_key.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
|
@ -692,8 +692,8 @@ void Widget::setupSwipeBack() {
|
||||||
if (data.translation != 0) {
|
if (data.translation != 0) {
|
||||||
if (data.translation < 0
|
if (data.translation < 0
|
||||||
&& _inner
|
&& _inner
|
||||||
&& (Core::App().settings().swipeDialogAction()
|
&& (Core::App().settings().quickDialogAction()
|
||||||
!= Ui::SwipeDialogAction::Disabled)) {
|
!= Ui::QuickDialogAction::Disabled)) {
|
||||||
_inner->setSwipeContextData(std::move(data));
|
_inner->setSwipeContextData(std::move(data));
|
||||||
} else {
|
} else {
|
||||||
if (!_swipeBackData.callback) {
|
if (!_swipeBackData.callback) {
|
||||||
|
@ -727,17 +727,17 @@ void Widget::setupSwipeBack() {
|
||||||
return Ui::Controls::SwipeHandlerFinishData();
|
return Ui::Controls::SwipeHandlerFinishData();
|
||||||
}
|
}
|
||||||
const auto isRightToLeft = direction == Qt::RightToLeft;
|
const auto isRightToLeft = direction == Qt::RightToLeft;
|
||||||
const auto action = Core::App().settings().swipeDialogAction();
|
const auto action = Core::App().settings().quickDialogAction();
|
||||||
const auto isDisabled = action == Ui::SwipeDialogAction::Disabled;
|
const auto isDisabled = action == Ui::QuickDialogAction::Disabled;
|
||||||
if (!isRightToLeft && _inner) {
|
if (!isRightToLeft && _inner) {
|
||||||
if (const auto key = _inner->calcSwipeKey(top);
|
if (const auto key = _inner->calcSwipeKey(top);
|
||||||
key && !isDisabled) {
|
key && !isDisabled) {
|
||||||
_inner->prepareSwipeAction(key, action);
|
_inner->prepareQuickAction(key, action);
|
||||||
return Ui::Controls::SwipeHandlerFinishData{
|
return Ui::Controls::SwipeHandlerFinishData{
|
||||||
.callback = [=, session = &session()] {
|
.callback = [=, session = &session()] {
|
||||||
auto callback = [=, peerId = PeerId(key)] {
|
auto callback = [=, peerId = PeerId(key)] {
|
||||||
const auto peer = session->data().peer(peerId);
|
const auto peer = session->data().peer(peerId);
|
||||||
PerformSwipeDialogAction(
|
PerformQuickDialogAction(
|
||||||
controller(),
|
controller(),
|
||||||
peer,
|
peer,
|
||||||
action,
|
action,
|
||||||
|
|
|
@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/stickers/data_custom_emoji.h"
|
#include "data/stickers/data_custom_emoji.h"
|
||||||
#include "dialogs/dialogs_list.h"
|
#include "dialogs/dialogs_list.h"
|
||||||
#include "dialogs/dialogs_three_state_icon.h"
|
#include "dialogs/dialogs_three_state_icon.h"
|
||||||
#include "dialogs/dialogs_swipe_action.h"
|
#include "dialogs/dialogs_quick_action.h"
|
||||||
#include "dialogs/ui/dialogs_video_userpic.h"
|
#include "dialogs/ui/dialogs_video_userpic.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
|
@ -71,10 +71,10 @@ const auto kPsaBadgePrefix = "cloud_lng_badge_psa_";
|
||||||
}
|
}
|
||||||
|
|
||||||
const style::font &SwipeActionFont(
|
const style::font &SwipeActionFont(
|
||||||
Dialogs::Ui::SwipeDialogActionLabel action,
|
Dialogs::Ui::QuickDialogActionLabel action,
|
||||||
int availableWidth) {
|
int availableWidth) {
|
||||||
struct Entry final {
|
struct Entry final {
|
||||||
Dialogs::Ui::SwipeDialogActionLabel action;
|
Dialogs::Ui::QuickDialogActionLabel action;
|
||||||
QString langId;
|
QString langId;
|
||||||
style::font font;
|
style::font font;
|
||||||
};
|
};
|
||||||
|
@ -93,7 +93,7 @@ const style::font &SwipeActionFont(
|
||||||
style::ConvertScale(i, style::Scale()),
|
style::ConvertScale(i, style::Scale()),
|
||||||
st::semiboldFont->flags(),
|
st::semiboldFont->flags(),
|
||||||
st::semiboldFont->family());
|
st::semiboldFont->family());
|
||||||
if (font->width(ResolveSwipeDialogLabel(action)) <= availableWidth
|
if (font->width(ResolveQuickDialogLabel(action)) <= availableWidth
|
||||||
|| i == kMinFontSize) {
|
|| i == kMinFontSize) {
|
||||||
Fonts.emplace_back(Entry{
|
Fonts.emplace_back(Entry{
|
||||||
.action = action,
|
.action = action,
|
||||||
|
@ -395,9 +395,11 @@ void PaintRow(
|
||||||
: context.currentBg;
|
: context.currentBg;
|
||||||
auto swipeTranslation = 0;
|
auto swipeTranslation = 0;
|
||||||
if (history
|
if (history
|
||||||
&& history->peer->id.value == context.swipeContext.data.msgBareId) {
|
&& (history->peer->id.value
|
||||||
if (context.swipeContext.data.translation != 0) {
|
== context.quickActionContext.data.msgBareId)) {
|
||||||
swipeTranslation = context.swipeContext.data.translation * -2;
|
if (context.quickActionContext.data.translation != 0) {
|
||||||
|
swipeTranslation = context.quickActionContext.data.translation
|
||||||
|
* -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (swipeTranslation) {
|
if (swipeTranslation) {
|
||||||
|
@ -879,30 +881,30 @@ void PaintRow(
|
||||||
swipeTranslation,
|
swipeTranslation,
|
||||||
geometry.height());
|
geometry.height());
|
||||||
p.setClipRegion(swipeActionRect);
|
p.setClipRegion(swipeActionRect);
|
||||||
const auto labelType = ResolveSwipeDialogLabel(
|
const auto labelType = ResolveQuickDialogLabel(
|
||||||
history,
|
history,
|
||||||
context.swipeContext.action,
|
context.quickActionContext.action,
|
||||||
context.filter);
|
context.filter);
|
||||||
p.fillRect(swipeActionRect, ResolveSwipeActionBg(labelType));
|
p.fillRect(swipeActionRect, ResolveQuickActionBg(labelType));
|
||||||
if (context.swipeContext.data.reachRatio) {
|
if (context.quickActionContext.data.reachRatio) {
|
||||||
p.setPen(Qt::NoPen);
|
p.setPen(Qt::NoPen);
|
||||||
p.setBrush(ResolveSwipeActionBgActive(labelType));
|
p.setBrush(ResolveQuickActionBgActive(labelType));
|
||||||
const auto r = swipeTranslation
|
const auto r = swipeTranslation
|
||||||
* context.swipeContext.data.reachRatio;
|
* context.quickActionContext.data.reachRatio;
|
||||||
const auto offset = st::dialogsSwipeActionSize
|
const auto offset = st::dialogsQuickActionSize
|
||||||
+ st::dialogsSwipeActionSize / 2.;
|
+ st::dialogsQuickActionSize / 2.;
|
||||||
p.drawEllipse(QPointF(geometry.width() - offset, offset), r, r);
|
p.drawEllipse(QPointF(geometry.width() - offset, offset), r, r);
|
||||||
}
|
}
|
||||||
const auto iconOffset = (geometry.height()
|
const auto iconOffset = (geometry.height()
|
||||||
- st::dialogsSwipeActionSize) / 2;
|
- st::dialogsQuickActionSize) / 2;
|
||||||
const auto topTranslation = iconOffset / 2.;
|
const auto topTranslation = iconOffset / 2.;
|
||||||
p.translate(0, -topTranslation);
|
p.translate(0, -topTranslation);
|
||||||
if (context.swipeContext.icon) {
|
if (context.quickActionContext.icon) {
|
||||||
context.swipeContext.icon->paint(
|
context.quickActionContext.icon->paint(
|
||||||
p,
|
p,
|
||||||
rect::right(geometry)
|
rect::right(geometry)
|
||||||
- iconOffset
|
- iconOffset
|
||||||
- st::dialogsSwipeActionSize,
|
- st::dialogsQuickActionSize,
|
||||||
iconOffset,
|
iconOffset,
|
||||||
st::premiumButtonFg->c);
|
st::premiumButtonFg->c);
|
||||||
}
|
}
|
||||||
|
@ -911,12 +913,12 @@ void PaintRow(
|
||||||
p.setBrush(Qt::NoBrush);
|
p.setBrush(Qt::NoBrush);
|
||||||
const auto left = rect::right(geometry)
|
const auto left = rect::right(geometry)
|
||||||
- iconOffset * 2
|
- iconOffset * 2
|
||||||
- st::dialogsSwipeActionSize;
|
- st::dialogsQuickActionSize;
|
||||||
const auto availableWidth = geometry.width() - left;
|
const auto availableWidth = geometry.width() - left;
|
||||||
p.setFont(SwipeActionFont(labelType, availableWidth));
|
p.setFont(SwipeActionFont(labelType, availableWidth));
|
||||||
p.drawText(
|
p.drawText(
|
||||||
QRect(left, 0, availableWidth, geometry.height()),
|
QRect(left, 0, availableWidth, geometry.height()),
|
||||||
ResolveSwipeDialogLabel(labelType),
|
ResolveQuickDialogLabel(labelType),
|
||||||
style::al_bottom);
|
style::al_bottom);
|
||||||
}
|
}
|
||||||
p.translate(0, topTranslation);
|
p.translate(0, topTranslation);
|
||||||
|
|
|
@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "dialogs/ui/dialogs_swipe_context.h"
|
#include "dialogs/ui/dialogs_quick_action_context.h"
|
||||||
#include "ui/cached_round_corners.h"
|
#include "ui/cached_round_corners.h"
|
||||||
|
|
||||||
namespace style {
|
namespace style {
|
||||||
|
@ -55,7 +55,7 @@ struct TopicJumpCache {
|
||||||
struct PaintContext {
|
struct PaintContext {
|
||||||
RightButton *rightButton = nullptr;
|
RightButton *rightButton = nullptr;
|
||||||
std::vector<QImage*> *chatsFilterTags = nullptr;
|
std::vector<QImage*> *chatsFilterTags = nullptr;
|
||||||
SwipeContext swipeContext;
|
QuickActionContext quickActionContext;
|
||||||
not_null<const style::DialogRow*> st;
|
not_null<const style::DialogRow*> st;
|
||||||
TopicJumpCache *topicJumpCache = nullptr;
|
TopicJumpCache *topicJumpCache = nullptr;
|
||||||
Data::Folder *folder = nullptr;
|
Data::Folder *folder = nullptr;
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace Dialogs::Ui {
|
||||||
|
|
||||||
using namespace ::Ui;
|
using namespace ::Ui;
|
||||||
|
|
||||||
enum class SwipeDialogAction {
|
enum class QuickDialogAction {
|
||||||
Mute,
|
Mute,
|
||||||
Pin,
|
Pin,
|
||||||
Read,
|
Read,
|
||||||
|
@ -26,7 +26,7 @@ enum class SwipeDialogAction {
|
||||||
Disabled,
|
Disabled,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class SwipeDialogActionLabel {
|
enum class QuickDialogActionLabel {
|
||||||
Mute,
|
Mute,
|
||||||
Unmute,
|
Unmute,
|
||||||
Pin,
|
Pin,
|
||||||
|
@ -39,10 +39,10 @@ enum class SwipeDialogActionLabel {
|
||||||
Disabled,
|
Disabled,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SwipeContext {
|
struct QuickActionContext {
|
||||||
::Ui::Controls::SwipeContextData data;
|
::Ui::Controls::SwipeContextData data;
|
||||||
Lottie::Icon *icon = nullptr;
|
Lottie::Icon *icon = nullptr;
|
||||||
SwipeDialogAction action;
|
QuickDialogAction action;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Dialogs::Ui
|
} // namespace Dialogs::Ui
|
|
@ -1280,20 +1280,20 @@ void SetupChatListSwipe(
|
||||||
Ui::AddSkip(container);
|
Ui::AddSkip(container);
|
||||||
Ui::AddSubsectionTitle(container, tr::lng_settings_swipe_subsection());
|
Ui::AddSubsectionTitle(container, tr::lng_settings_swipe_subsection());
|
||||||
|
|
||||||
using Type = Dialogs::Ui::SwipeDialogAction;
|
using Type = Dialogs::Ui::QuickDialogAction;
|
||||||
const auto group = std::make_shared<Ui::RadioenumGroup<Type>>(
|
const auto group = std::make_shared<Ui::RadioenumGroup<Type>>(
|
||||||
Core::App().settings().swipeDialogAction());
|
Core::App().settings().quickDialogAction());
|
||||||
container->add(
|
container->add(
|
||||||
object_ptr<Ui::SettingsButton>(
|
object_ptr<Ui::SettingsButton>(
|
||||||
container,
|
container,
|
||||||
group->value() | rpl::map([](Type value) {
|
group->value() | rpl::map([](Type value) {
|
||||||
return ((value == Dialogs::Ui::SwipeDialogAction::Mute)
|
return ((value == Dialogs::Ui::QuickDialogAction::Mute)
|
||||||
? tr::lng_settings_swipe_mute
|
? tr::lng_settings_swipe_mute
|
||||||
: (value == Dialogs::Ui::SwipeDialogAction::Pin)
|
: (value == Dialogs::Ui::QuickDialogAction::Pin)
|
||||||
? tr::lng_settings_swipe_pin
|
? tr::lng_settings_swipe_pin
|
||||||
: (value == Dialogs::Ui::SwipeDialogAction::Read)
|
: (value == Dialogs::Ui::QuickDialogAction::Read)
|
||||||
? tr::lng_settings_swipe_read
|
? tr::lng_settings_swipe_read
|
||||||
: (value == Dialogs::Ui::SwipeDialogAction::Archive)
|
: (value == Dialogs::Ui::QuickDialogAction::Archive)
|
||||||
? tr::lng_settings_swipe_archive
|
? tr::lng_settings_swipe_archive
|
||||||
: tr::lng_settings_swipe_disabled)();
|
: tr::lng_settings_swipe_disabled)();
|
||||||
}) | rpl::flatten_latest(),
|
}) | rpl::flatten_latest(),
|
||||||
|
@ -1318,7 +1318,7 @@ void SetupChatListSwipe(
|
||||||
addRadio(Type::Delete, tr::lng_settings_swipe_delete);
|
addRadio(Type::Delete, tr::lng_settings_swipe_delete);
|
||||||
addRadio(Type::Disabled, tr::lng_settings_swipe_disabled);
|
addRadio(Type::Disabled, tr::lng_settings_swipe_disabled);
|
||||||
box->addButton(tr::lng_settings_save(), [=] {
|
box->addButton(tr::lng_settings_save(), [=] {
|
||||||
Core::App().settings().setSwipeDialogAction(
|
Core::App().settings().setQuickDialogAction(
|
||||||
group->current());
|
group->current());
|
||||||
Core::App().saveSettingsDelayed();
|
Core::App().saveSettingsDelayed();
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
|
|
|
@ -101,9 +101,9 @@ PRIVATE
|
||||||
dialogs/ui/chat_search_empty.h
|
dialogs/ui/chat_search_empty.h
|
||||||
dialogs/ui/chat_search_in.cpp
|
dialogs/ui/chat_search_in.cpp
|
||||||
dialogs/ui/chat_search_in.h
|
dialogs/ui/chat_search_in.h
|
||||||
|
dialogs/ui/dialogs_quick_action_context.h
|
||||||
dialogs/ui/dialogs_stories_list.cpp
|
dialogs/ui/dialogs_stories_list.cpp
|
||||||
dialogs/ui/dialogs_stories_list.h
|
dialogs/ui/dialogs_stories_list.h
|
||||||
dialogs/ui/dialogs_swipe_context.h
|
|
||||||
dialogs/ui/top_peers_strip.cpp
|
dialogs/ui/top_peers_strip.cpp
|
||||||
dialogs/ui/top_peers_strip.h
|
dialogs/ui/top_peers_strip.h
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue