2019-08-23 13:52:59 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "window/themes/window_themes_embedded.h"
|
2020-10-15 14:27:16 +00:00
|
|
|
#include "ui/chat/attach/attach_send_files_way.h"
|
2021-01-24 23:16:32 +00:00
|
|
|
#include "platform/platform_notifications_manager.h"
|
2021-04-25 08:12:32 +00:00
|
|
|
#include "emoji.h"
|
2019-08-23 13:52:59 +00:00
|
|
|
|
2020-06-25 12:16:09 +00:00
|
|
|
enum class RectPart;
|
2020-06-18 18:04:16 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
enum class InputSubmitSettings;
|
|
|
|
} // namespace Ui
|
|
|
|
|
2020-06-25 12:16:09 +00:00
|
|
|
namespace Window {
|
|
|
|
enum class Column;
|
|
|
|
} // namespace Window
|
|
|
|
|
2021-01-07 15:27:11 +00:00
|
|
|
namespace Webrtc {
|
|
|
|
enum class Backend;
|
|
|
|
} // namespace Webrtc
|
|
|
|
|
2019-08-23 13:52:59 +00:00
|
|
|
namespace Core {
|
|
|
|
|
2021-02-17 15:20:05 +00:00
|
|
|
struct WindowPosition {
|
|
|
|
WindowPosition() = default;
|
|
|
|
|
|
|
|
int32 moncrc = 0;
|
|
|
|
int maximized = 0;
|
|
|
|
int scale = 0;
|
|
|
|
int x = 0;
|
|
|
|
int y = 0;
|
|
|
|
int w = 0;
|
|
|
|
int h = 0;
|
|
|
|
};
|
|
|
|
|
2019-08-23 13:52:59 +00:00
|
|
|
class Settings final {
|
|
|
|
public:
|
2020-06-18 18:04:16 +00:00
|
|
|
enum class ScreenCorner {
|
|
|
|
TopLeft = 0,
|
|
|
|
TopRight = 1,
|
|
|
|
BottomRight = 2,
|
|
|
|
BottomLeft = 3,
|
|
|
|
};
|
|
|
|
|
|
|
|
static constexpr auto kDefaultVolume = 0.9;
|
|
|
|
|
|
|
|
Settings();
|
|
|
|
|
2021-04-25 08:12:32 +00:00
|
|
|
[[nodiscard]] rpl::producer<> saveDelayedRequests() const {
|
|
|
|
return _saveDelayed.events();
|
|
|
|
}
|
|
|
|
|
2020-06-18 18:04:16 +00:00
|
|
|
[[nodiscard]] static bool IsLeftCorner(ScreenCorner corner) {
|
|
|
|
return (corner == ScreenCorner::TopLeft)
|
|
|
|
|| (corner == ScreenCorner::BottomLeft);
|
2019-08-23 13:52:59 +00:00
|
|
|
}
|
2020-06-18 18:04:16 +00:00
|
|
|
[[nodiscard]] static bool IsTopCorner(ScreenCorner corner) {
|
|
|
|
return (corner == ScreenCorner::TopLeft)
|
|
|
|
|| (corner == ScreenCorner::TopRight);
|
|
|
|
}
|
|
|
|
|
2019-08-23 13:52:59 +00:00
|
|
|
[[nodiscard]] QByteArray serialize() const;
|
2020-06-18 18:04:16 +00:00
|
|
|
void addFromSerialized(const QByteArray &serialized);
|
2019-08-23 13:52:59 +00:00
|
|
|
|
2020-06-18 18:04:16 +00:00
|
|
|
[[nodiscard]] bool chatWide() const;
|
|
|
|
[[nodiscard]] bool adaptiveForWide() const {
|
|
|
|
return _adaptiveForWide;
|
|
|
|
}
|
|
|
|
void setAdaptiveForWide(bool value) {
|
|
|
|
_adaptiveForWide = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool moderateModeEnabled() const {
|
|
|
|
return _moderateModeEnabled;
|
|
|
|
}
|
|
|
|
void setModerateModeEnabled(bool value) {
|
|
|
|
_moderateModeEnabled = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] float64 songVolume() const {
|
|
|
|
return _songVolume.current();
|
|
|
|
}
|
|
|
|
[[nodiscard]] rpl::producer<float64> songVolumeChanges() const {
|
|
|
|
return _songVolume.changes();
|
|
|
|
}
|
|
|
|
void setSongVolume(float64 value) {
|
|
|
|
_songVolume = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] float64 videoVolume() const {
|
|
|
|
return _videoVolume.current();
|
|
|
|
}
|
|
|
|
[[nodiscard]] rpl::producer<float64> videoVolumeChanges() const {
|
|
|
|
return _videoVolume.changes();
|
|
|
|
}
|
|
|
|
void setVideoVolume(float64 value) {
|
|
|
|
_videoVolume = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool askDownloadPath() const {
|
|
|
|
return _askDownloadPath;
|
|
|
|
}
|
|
|
|
void setAskDownloadPath(bool value) {
|
|
|
|
_askDownloadPath = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] QString downloadPath() const {
|
|
|
|
return _downloadPath.current();
|
|
|
|
}
|
|
|
|
[[nodiscard]] rpl::producer<QString> downloadPathValue() const {
|
|
|
|
return _downloadPath.value();
|
|
|
|
}
|
|
|
|
void setDownloadPath(const QString &value) {
|
|
|
|
_downloadPath = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] QByteArray downloadPathBookmark() const {
|
|
|
|
return _downloadPathBookmark;
|
|
|
|
}
|
|
|
|
void setDownloadPathBookmark(const QByteArray &value) {
|
|
|
|
_downloadPathBookmark = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool voiceMsgPlaybackDoubled() const {
|
|
|
|
return _voiceMsgPlaybackDoubled;
|
|
|
|
}
|
|
|
|
void setVoiceMsgPlaybackDoubled(bool value) {
|
|
|
|
_voiceMsgPlaybackDoubled = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool soundNotify() const {
|
|
|
|
return _soundNotify;
|
|
|
|
}
|
|
|
|
void setSoundNotify(bool value) {
|
|
|
|
_soundNotify = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool desktopNotify() const {
|
|
|
|
return _desktopNotify;
|
|
|
|
}
|
|
|
|
void setDesktopNotify(bool value) {
|
|
|
|
_desktopNotify = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool flashBounceNotify() const {
|
|
|
|
return _flashBounceNotify;
|
|
|
|
}
|
|
|
|
void setFlashBounceNotify(bool value) {
|
|
|
|
_flashBounceNotify = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] DBINotifyView notifyView() const {
|
|
|
|
return _notifyView;
|
|
|
|
}
|
|
|
|
void setNotifyView(DBINotifyView value) {
|
|
|
|
_notifyView = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool nativeNotifications() const {
|
2021-01-24 23:16:32 +00:00
|
|
|
return _nativeNotifications.value_or(Platform::Notifications::ByDefault());
|
2020-06-18 18:04:16 +00:00
|
|
|
}
|
|
|
|
void setNativeNotifications(bool value) {
|
2021-01-24 23:16:32 +00:00
|
|
|
_nativeNotifications = (value == Platform::Notifications::ByDefault())
|
|
|
|
? std::nullopt
|
|
|
|
: std::make_optional(value);
|
2020-06-18 18:04:16 +00:00
|
|
|
}
|
|
|
|
[[nodiscard]] int notificationsCount() const {
|
|
|
|
return _notificationsCount;
|
|
|
|
}
|
|
|
|
void setNotificationsCount(int value) {
|
|
|
|
_notificationsCount = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] ScreenCorner notificationsCorner() const {
|
|
|
|
return _notificationsCorner;
|
|
|
|
}
|
|
|
|
void setNotificationsCorner(ScreenCorner corner) {
|
|
|
|
_notificationsCorner = corner;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool includeMutedCounter() const {
|
|
|
|
return _includeMutedCounter;
|
|
|
|
}
|
|
|
|
void setIncludeMutedCounter(bool value) {
|
|
|
|
_includeMutedCounter = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool countUnreadMessages() const {
|
|
|
|
return _countUnreadMessages;
|
|
|
|
}
|
|
|
|
void setCountUnreadMessages(bool value) {
|
|
|
|
_countUnreadMessages = value;
|
|
|
|
}
|
|
|
|
void setNotifyAboutPinned(bool notify) {
|
|
|
|
_notifyAboutPinned = notify;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool notifyAboutPinned() const {
|
|
|
|
return _notifyAboutPinned.current();
|
|
|
|
}
|
|
|
|
[[nodiscard]] rpl::producer<bool> notifyAboutPinnedChanges() const {
|
|
|
|
return _notifyAboutPinned.changes();
|
|
|
|
}
|
|
|
|
[[nodiscard]] int autoLock() const {
|
|
|
|
return _autoLock;
|
|
|
|
}
|
|
|
|
void setAutoLock(int value) {
|
|
|
|
_autoLock = value;
|
|
|
|
}
|
2020-08-18 14:00:33 +00:00
|
|
|
[[nodiscard]] QString callOutputDeviceId() const {
|
|
|
|
return _callOutputDeviceId.isEmpty()
|
2020-08-18 07:23:45 +00:00
|
|
|
? u"default"_q
|
2020-08-18 14:00:33 +00:00
|
|
|
: _callOutputDeviceId;
|
2020-06-18 18:04:16 +00:00
|
|
|
}
|
2020-08-18 14:00:33 +00:00
|
|
|
void setCallOutputDeviceId(const QString &value) {
|
|
|
|
_callOutputDeviceId = value;
|
2020-06-18 18:04:16 +00:00
|
|
|
}
|
2020-08-18 14:00:33 +00:00
|
|
|
[[nodiscard]] QString callInputDeviceId() const {
|
|
|
|
return _callInputDeviceId.isEmpty()
|
2020-08-18 07:23:45 +00:00
|
|
|
? u"default"_q
|
2020-08-18 14:00:33 +00:00
|
|
|
: _callInputDeviceId;
|
2020-06-18 18:04:16 +00:00
|
|
|
}
|
2020-08-18 14:00:33 +00:00
|
|
|
void setCallInputDeviceId(const QString &value) {
|
|
|
|
_callInputDeviceId = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] QString callVideoInputDeviceId() const {
|
|
|
|
return _callVideoInputDeviceId.isEmpty()
|
|
|
|
? u"default"_q
|
|
|
|
: _callVideoInputDeviceId;
|
|
|
|
}
|
|
|
|
void setCallVideoInputDeviceId(const QString &value) {
|
|
|
|
_callVideoInputDeviceId = value;
|
2020-06-18 18:04:16 +00:00
|
|
|
}
|
|
|
|
[[nodiscard]] int callOutputVolume() const {
|
|
|
|
return _callOutputVolume;
|
|
|
|
}
|
|
|
|
void setCallOutputVolume(int value) {
|
|
|
|
_callOutputVolume = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] int callInputVolume() const {
|
|
|
|
return _callInputVolume;
|
|
|
|
}
|
|
|
|
void setCallInputVolume(int value) {
|
|
|
|
_callInputVolume = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool callAudioDuckingEnabled() const {
|
|
|
|
return _callAudioDuckingEnabled;
|
|
|
|
}
|
|
|
|
void setCallAudioDuckingEnabled(bool value) {
|
|
|
|
_callAudioDuckingEnabled = value;
|
2019-08-23 13:52:59 +00:00
|
|
|
}
|
2021-01-21 15:57:12 +00:00
|
|
|
[[nodiscard]] Webrtc::Backend callAudioBackend() const;
|
2021-01-26 11:58:30 +00:00
|
|
|
void setDisableCalls(bool value) {
|
|
|
|
_disableCalls = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool disableCalls() const {
|
|
|
|
return _disableCalls;
|
2021-01-07 15:27:11 +00:00
|
|
|
}
|
2020-12-03 18:17:15 +00:00
|
|
|
[[nodiscard]] bool groupCallPushToTalk() const {
|
|
|
|
return _groupCallPushToTalk;
|
|
|
|
}
|
|
|
|
void setGroupCallPushToTalk(bool value) {
|
|
|
|
_groupCallPushToTalk = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] QByteArray groupCallPushToTalkShortcut() const {
|
|
|
|
return _groupCallPushToTalkShortcut;
|
|
|
|
}
|
|
|
|
void setGroupCallPushToTalkShortcut(const QByteArray &serialized) {
|
|
|
|
_groupCallPushToTalkShortcut = serialized;
|
|
|
|
}
|
2020-12-06 12:44:20 +00:00
|
|
|
[[nodiscard]] crl::time groupCallPushToTalkDelay() const {
|
|
|
|
return _groupCallPushToTalkDelay;
|
|
|
|
}
|
|
|
|
void setGroupCallPushToTalkDelay(crl::time delay) {
|
|
|
|
_groupCallPushToTalkDelay = delay;
|
|
|
|
}
|
2019-08-23 13:52:59 +00:00
|
|
|
[[nodiscard]] Window::Theme::AccentColors &themesAccentColors() {
|
2020-06-18 18:04:16 +00:00
|
|
|
return _themesAccentColors;
|
|
|
|
}
|
|
|
|
void setThemesAccentColors(Window::Theme::AccentColors &&colors) {
|
|
|
|
_themesAccentColors = std::move(colors);
|
|
|
|
}
|
|
|
|
void setLastSeenWarningSeen(bool lastSeenWarningSeen) {
|
|
|
|
_lastSeenWarningSeen = lastSeenWarningSeen;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool lastSeenWarningSeen() const {
|
|
|
|
return _lastSeenWarningSeen;
|
|
|
|
}
|
2020-10-13 15:11:53 +00:00
|
|
|
void setSendFilesWay(Ui::SendFilesWay way) {
|
2020-06-18 18:04:16 +00:00
|
|
|
_sendFilesWay = way;
|
|
|
|
}
|
2020-10-13 15:11:53 +00:00
|
|
|
[[nodiscard]] Ui::SendFilesWay sendFilesWay() const {
|
2020-06-18 18:04:16 +00:00
|
|
|
return _sendFilesWay;
|
|
|
|
}
|
|
|
|
void setSendSubmitWay(Ui::InputSubmitSettings value) {
|
|
|
|
_sendSubmitWay = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] Ui::InputSubmitSettings sendSubmitWay() const {
|
|
|
|
return _sendSubmitWay;
|
|
|
|
}
|
|
|
|
void setSoundOverride(const QString &key, const QString &path) {
|
|
|
|
_soundOverrides.emplace(key, path);
|
|
|
|
}
|
|
|
|
void clearSoundOverrides() {
|
|
|
|
_soundOverrides.clear();
|
|
|
|
}
|
|
|
|
[[nodiscard]] QString getSoundPath(const QString &key) const;
|
|
|
|
|
|
|
|
[[nodiscard]] bool exeLaunchWarning() const {
|
|
|
|
return _exeLaunchWarning;
|
|
|
|
}
|
|
|
|
void setExeLaunchWarning(bool warning) {
|
|
|
|
_exeLaunchWarning = warning;
|
|
|
|
}
|
2020-10-23 10:10:30 +00:00
|
|
|
[[nodiscard]] bool ipRevealWarning() const {
|
|
|
|
return _ipRevealWarning;
|
|
|
|
}
|
|
|
|
void setIpRevealWarning(bool warning) {
|
|
|
|
_ipRevealWarning = warning;
|
|
|
|
}
|
2020-06-18 18:04:16 +00:00
|
|
|
[[nodiscard]] bool loopAnimatedStickers() const {
|
|
|
|
return _loopAnimatedStickers;
|
|
|
|
}
|
|
|
|
void setLoopAnimatedStickers(bool value) {
|
|
|
|
_loopAnimatedStickers = value;
|
|
|
|
}
|
|
|
|
void setLargeEmoji(bool value) {
|
|
|
|
_largeEmoji = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool largeEmoji() const {
|
|
|
|
return _largeEmoji.current();
|
|
|
|
}
|
|
|
|
[[nodiscard]] rpl::producer<bool> largeEmojiValue() const {
|
|
|
|
return _largeEmoji.value();
|
|
|
|
}
|
|
|
|
[[nodiscard]] rpl::producer<bool> largeEmojiChanges() const {
|
|
|
|
return _largeEmoji.changes();
|
|
|
|
}
|
|
|
|
void setReplaceEmoji(bool value) {
|
|
|
|
_replaceEmoji = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool replaceEmoji() const {
|
|
|
|
return _replaceEmoji.current();
|
|
|
|
}
|
|
|
|
[[nodiscard]] rpl::producer<bool> replaceEmojiValue() const {
|
|
|
|
return _replaceEmoji.value();
|
|
|
|
}
|
|
|
|
[[nodiscard]] rpl::producer<bool> replaceEmojiChanges() const {
|
|
|
|
return _replaceEmoji.changes();
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool suggestEmoji() const {
|
|
|
|
return _suggestEmoji;
|
|
|
|
}
|
|
|
|
void setSuggestEmoji(bool value) {
|
|
|
|
_suggestEmoji = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool suggestStickersByEmoji() const {
|
|
|
|
return _suggestStickersByEmoji;
|
|
|
|
}
|
|
|
|
void setSuggestStickersByEmoji(bool value) {
|
|
|
|
_suggestStickersByEmoji = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setSpellcheckerEnabled(bool value) {
|
|
|
|
_spellcheckerEnabled = value;
|
|
|
|
}
|
|
|
|
bool spellcheckerEnabled() const {
|
|
|
|
return _spellcheckerEnabled.current();
|
|
|
|
}
|
|
|
|
rpl::producer<bool> spellcheckerEnabledValue() const {
|
|
|
|
return _spellcheckerEnabled.value();
|
|
|
|
}
|
|
|
|
rpl::producer<bool> spellcheckerEnabledChanges() const {
|
|
|
|
return _spellcheckerEnabled.changes();
|
|
|
|
}
|
|
|
|
|
|
|
|
void setDictionariesEnabled(std::vector<int> dictionaries) {
|
|
|
|
_dictionariesEnabled = std::move(dictionaries);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<int> dictionariesEnabled() const {
|
|
|
|
return _dictionariesEnabled.current();
|
|
|
|
}
|
|
|
|
|
|
|
|
rpl::producer<std::vector<int>> dictionariesEnabledChanges() const {
|
|
|
|
return _dictionariesEnabled.changes();
|
|
|
|
}
|
|
|
|
|
|
|
|
void setAutoDownloadDictionaries(bool value) {
|
|
|
|
_autoDownloadDictionaries = value;
|
|
|
|
}
|
|
|
|
bool autoDownloadDictionaries() const {
|
|
|
|
return _autoDownloadDictionaries.current();
|
|
|
|
}
|
|
|
|
rpl::producer<bool> autoDownloadDictionariesValue() const {
|
|
|
|
return _autoDownloadDictionaries.value();
|
|
|
|
}
|
|
|
|
rpl::producer<bool> autoDownloadDictionariesChanges() const {
|
|
|
|
return _autoDownloadDictionaries.changes();
|
|
|
|
}
|
|
|
|
|
|
|
|
[[nodiscard]] float64 videoPlaybackSpeed() const {
|
|
|
|
return _videoPlaybackSpeed.current();
|
|
|
|
}
|
|
|
|
void setVideoPlaybackSpeed(float64 speed) {
|
|
|
|
_videoPlaybackSpeed = speed;
|
|
|
|
}
|
|
|
|
[[nodiscard]] QByteArray videoPipGeometry() const {
|
|
|
|
return _videoPipGeometry;
|
|
|
|
}
|
|
|
|
void setVideoPipGeometry(QByteArray geometry) {
|
|
|
|
_videoPipGeometry = geometry;
|
|
|
|
}
|
|
|
|
|
|
|
|
[[nodiscard]] float64 rememberedSongVolume() const {
|
|
|
|
return _rememberedSongVolume;
|
|
|
|
}
|
|
|
|
void setRememberedSongVolume(float64 value) {
|
|
|
|
_rememberedSongVolume = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool rememberedSoundNotifyFromTray() const {
|
|
|
|
return _rememberedSoundNotifyFromTray;
|
|
|
|
}
|
|
|
|
void setRememberedSoundNotifyFromTray(bool value) {
|
|
|
|
_rememberedSoundNotifyFromTray = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool rememberedFlashBounceNotifyFromTray() const {
|
|
|
|
return _rememberedFlashBounceNotifyFromTray;
|
|
|
|
}
|
|
|
|
void setRememberedFlashBounceNotifyFromTray(bool value) {
|
|
|
|
_rememberedFlashBounceNotifyFromTray = value;
|
|
|
|
}
|
2020-06-22 13:01:41 +00:00
|
|
|
[[nodiscard]] bool mainMenuAccountsShown() const {
|
|
|
|
return _mainMenuAccountsShown.current();
|
|
|
|
}
|
|
|
|
[[nodiscard]] rpl::producer<bool> mainMenuAccountsShownValue() const {
|
|
|
|
return _mainMenuAccountsShown.value();
|
|
|
|
}
|
|
|
|
void setMainMenuAccountsShown(bool value) {
|
|
|
|
_mainMenuAccountsShown = value;
|
|
|
|
}
|
2020-06-25 12:16:09 +00:00
|
|
|
[[nodiscard]] bool tabbedSelectorSectionEnabled() const {
|
|
|
|
return _tabbedSelectorSectionEnabled;
|
|
|
|
}
|
|
|
|
void setTabbedSelectorSectionEnabled(bool enabled);
|
|
|
|
[[nodiscard]] bool thirdSectionInfoEnabled() const {
|
|
|
|
return _thirdSectionInfoEnabled;
|
|
|
|
}
|
|
|
|
void setThirdSectionInfoEnabled(bool enabled);
|
|
|
|
[[nodiscard]] rpl::producer<bool> thirdSectionInfoEnabledValue() const;
|
|
|
|
[[nodiscard]] int thirdSectionExtendedBy() const {
|
|
|
|
return _thirdSectionExtendedBy;
|
|
|
|
}
|
|
|
|
void setThirdSectionExtendedBy(int savedValue) {
|
|
|
|
_thirdSectionExtendedBy = savedValue;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool tabbedReplacedWithInfo() const {
|
|
|
|
return _tabbedReplacedWithInfo;
|
|
|
|
}
|
|
|
|
void setTabbedReplacedWithInfo(bool enabled);
|
|
|
|
[[nodiscard]] rpl::producer<bool> tabbedReplacedWithInfoValue() const;
|
|
|
|
void setFloatPlayerColumn(Window::Column column) {
|
|
|
|
_floatPlayerColumn = column;
|
|
|
|
}
|
|
|
|
[[nodiscard]] Window::Column floatPlayerColumn() const {
|
|
|
|
return _floatPlayerColumn;
|
|
|
|
}
|
|
|
|
void setFloatPlayerCorner(RectPart corner) {
|
|
|
|
_floatPlayerCorner = corner;
|
|
|
|
}
|
|
|
|
[[nodiscard]] RectPart floatPlayerCorner() const {
|
|
|
|
return _floatPlayerCorner;
|
|
|
|
}
|
|
|
|
void setDialogsWidthRatio(float64 ratio);
|
|
|
|
[[nodiscard]] float64 dialogsWidthRatio() const;
|
|
|
|
[[nodiscard]] rpl::producer<float64> dialogsWidthRatioChanges() const;
|
|
|
|
void setThirdColumnWidth(int width);
|
|
|
|
[[nodiscard]] int thirdColumnWidth() const;
|
|
|
|
[[nodiscard]] rpl::producer<int> thirdColumnWidthChanges() const;
|
2020-06-30 18:11:48 +00:00
|
|
|
void setNotifyFromAll(bool value) {
|
|
|
|
_notifyFromAll = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool notifyFromAll() const {
|
|
|
|
return _notifyFromAll;
|
|
|
|
}
|
2020-07-07 13:54:39 +00:00
|
|
|
void setNativeWindowFrame(bool value) {
|
|
|
|
_nativeWindowFrame = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool nativeWindowFrame() const {
|
|
|
|
return _nativeWindowFrame.current();
|
|
|
|
}
|
|
|
|
[[nodiscard]] rpl::producer<bool> nativeWindowFrameChanges() const {
|
|
|
|
return _nativeWindowFrame.changes();
|
|
|
|
}
|
2020-07-14 16:36:55 +00:00
|
|
|
void setSystemDarkMode(std::optional<bool> value) {
|
|
|
|
_systemDarkMode = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] std::optional<bool> systemDarkMode() const {
|
|
|
|
return _systemDarkMode.current();
|
|
|
|
}
|
|
|
|
[[nodiscard]] rpl::producer<std::optional<bool>> systemDarkModeValue() const {
|
|
|
|
return _systemDarkMode.value();
|
|
|
|
}
|
|
|
|
[[nodiscard]] rpl::producer<std::optional<bool>> systemDarkModeChanges() const {
|
|
|
|
return _systemDarkMode.changes();
|
|
|
|
}
|
|
|
|
void setSystemDarkModeEnabled(bool value) {
|
|
|
|
_systemDarkModeEnabled = value;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool systemDarkModeEnabled() const {
|
|
|
|
return _systemDarkModeEnabled.current();
|
|
|
|
}
|
|
|
|
[[nodiscard]] rpl::producer<bool> systemDarkModeEnabledValue() const {
|
|
|
|
return _systemDarkModeEnabled.value();
|
|
|
|
}
|
|
|
|
[[nodiscard]] rpl::producer<bool> systemDarkModeEnabledChanges() const {
|
|
|
|
return _systemDarkModeEnabled.changes();
|
|
|
|
}
|
2021-02-17 15:20:05 +00:00
|
|
|
[[nodiscard]] const WindowPosition &windowPosition() const {
|
|
|
|
return _windowPosition;
|
|
|
|
}
|
|
|
|
void setWindowPosition(const WindowPosition &position) {
|
|
|
|
_windowPosition = position;
|
|
|
|
}
|
2020-06-18 18:04:16 +00:00
|
|
|
|
2021-04-25 08:12:32 +00:00
|
|
|
struct RecentEmoji {
|
|
|
|
EmojiPtr emoji = nullptr;
|
|
|
|
ushort rating = 0;
|
|
|
|
};
|
|
|
|
[[nodiscard]] const std::vector<RecentEmoji> &recentEmoji() const;
|
|
|
|
[[nodiscard]] EmojiPack recentEmojiSection() const;
|
|
|
|
void incrementRecentEmoji(EmojiPtr emoji);
|
|
|
|
void setLegacyRecentEmojiPreload(QVector<QPair<QString, ushort>> data);
|
|
|
|
[[nodiscard]] rpl::producer<> recentEmojiUpdated() const {
|
|
|
|
return _recentEmojiUpdated.events();
|
|
|
|
}
|
|
|
|
|
|
|
|
[[nodiscard]] const base::flat_map<QString, uint8> &emojiVariants() const {
|
|
|
|
return _emojiVariants;
|
|
|
|
}
|
|
|
|
void saveEmojiVariant(EmojiPtr emoji);
|
|
|
|
void setLegacyEmojiVariants(QMap<QString, int> data);
|
|
|
|
|
2021-05-20 12:07:53 +00:00
|
|
|
[[nodiscard]] bool disableOpenGL() const {
|
|
|
|
return _disableOpenGL;
|
|
|
|
}
|
|
|
|
void setDisableOpenGL(bool value) {
|
|
|
|
_disableOpenGL = value;
|
|
|
|
}
|
|
|
|
|
2020-06-25 12:16:09 +00:00
|
|
|
[[nodiscard]] static bool ThirdColumnByDefault();
|
2021-04-25 08:12:32 +00:00
|
|
|
[[nodiscard]] static float64 DefaultDialogsWidthRatio();
|
2020-06-18 18:04:16 +00:00
|
|
|
[[nodiscard]] static qint32 SerializePlaybackSpeed(float64 speed) {
|
2021-01-28 05:46:40 +00:00
|
|
|
return int(std::round(std::clamp(speed, 0.5, 2.0) * 100));
|
2020-06-18 18:04:16 +00:00
|
|
|
}
|
|
|
|
[[nodiscard]] static float64 DeserializePlaybackSpeed(qint32 speed) {
|
2021-01-28 05:46:40 +00:00
|
|
|
if (speed < 10) {
|
|
|
|
// The old values in settings.
|
|
|
|
return (std::clamp(speed, 0, 6) + 2) / 4.;
|
|
|
|
} else {
|
|
|
|
return std::clamp(speed, 50, 200) / 100.;
|
|
|
|
}
|
2019-08-23 13:52:59 +00:00
|
|
|
}
|
|
|
|
|
2020-06-19 15:51:51 +00:00
|
|
|
void resetOnLastLogout();
|
|
|
|
|
2019-08-23 13:52:59 +00:00
|
|
|
private:
|
2021-04-25 08:12:32 +00:00
|
|
|
void resolveRecentEmoji() const;
|
|
|
|
|
2020-06-25 12:16:09 +00:00
|
|
|
static constexpr auto kDefaultThirdColumnWidth = 0;
|
|
|
|
static constexpr auto kDefaultDialogsWidthRatio = 5. / 14;
|
|
|
|
static constexpr auto kDefaultBigDialogsWidthRatio = 0.275;
|
|
|
|
|
2021-04-25 08:12:32 +00:00
|
|
|
struct RecentEmojiId {
|
|
|
|
QString emoji;
|
|
|
|
ushort rating = 0;
|
|
|
|
};
|
|
|
|
|
2020-06-18 18:04:16 +00:00
|
|
|
bool _adaptiveForWide = true;
|
|
|
|
bool _moderateModeEnabled = false;
|
|
|
|
rpl::variable<float64> _songVolume = kDefaultVolume;
|
|
|
|
rpl::variable<float64> _videoVolume = kDefaultVolume;
|
|
|
|
bool _askDownloadPath = false;
|
|
|
|
rpl::variable<QString> _downloadPath;
|
|
|
|
QByteArray _downloadPathBookmark;
|
|
|
|
bool _voiceMsgPlaybackDoubled = false;
|
|
|
|
bool _soundNotify = true;
|
|
|
|
bool _desktopNotify = true;
|
|
|
|
bool _flashBounceNotify = true;
|
|
|
|
DBINotifyView _notifyView = dbinvShowPreview;
|
2021-01-24 23:16:32 +00:00
|
|
|
std::optional<bool> _nativeNotifications;
|
2020-06-18 18:04:16 +00:00
|
|
|
int _notificationsCount = 3;
|
|
|
|
ScreenCorner _notificationsCorner = ScreenCorner::BottomRight;
|
|
|
|
bool _includeMutedCounter = true;
|
|
|
|
bool _countUnreadMessages = true;
|
|
|
|
rpl::variable<bool> _notifyAboutPinned = true;
|
|
|
|
int _autoLock = 3600;
|
2020-08-18 14:00:33 +00:00
|
|
|
QString _callOutputDeviceId = u"default"_q;
|
|
|
|
QString _callInputDeviceId = u"default"_q;
|
|
|
|
QString _callVideoInputDeviceId = u"default"_q;
|
2020-06-18 18:04:16 +00:00
|
|
|
int _callOutputVolume = 100;
|
|
|
|
int _callInputVolume = 100;
|
|
|
|
bool _callAudioDuckingEnabled = true;
|
2021-01-26 11:58:30 +00:00
|
|
|
bool _disableCalls = false;
|
2020-12-03 18:17:15 +00:00
|
|
|
bool _groupCallPushToTalk = false;
|
|
|
|
QByteArray _groupCallPushToTalkShortcut;
|
2020-12-06 12:44:20 +00:00
|
|
|
crl::time _groupCallPushToTalkDelay = 20;
|
2020-06-18 18:04:16 +00:00
|
|
|
Window::Theme::AccentColors _themesAccentColors;
|
|
|
|
bool _lastSeenWarningSeen = false;
|
2021-01-07 15:27:11 +00:00
|
|
|
Ui::SendFilesWay _sendFilesWay = Ui::SendFilesWay();
|
|
|
|
Ui::InputSubmitSettings _sendSubmitWay = Ui::InputSubmitSettings();
|
2020-06-18 18:04:16 +00:00
|
|
|
base::flat_map<QString, QString> _soundOverrides;
|
|
|
|
bool _exeLaunchWarning = true;
|
2020-10-23 10:10:30 +00:00
|
|
|
bool _ipRevealWarning = true;
|
2020-06-18 18:04:16 +00:00
|
|
|
bool _loopAnimatedStickers = true;
|
|
|
|
rpl::variable<bool> _largeEmoji = true;
|
|
|
|
rpl::variable<bool> _replaceEmoji = true;
|
|
|
|
bool _suggestEmoji = true;
|
|
|
|
bool _suggestStickersByEmoji = true;
|
|
|
|
rpl::variable<bool> _spellcheckerEnabled = true;
|
|
|
|
rpl::variable<float64> _videoPlaybackSpeed = 1.;
|
|
|
|
QByteArray _videoPipGeometry;
|
|
|
|
rpl::variable<std::vector<int>> _dictionariesEnabled;
|
|
|
|
rpl::variable<bool> _autoDownloadDictionaries = true;
|
2020-07-02 18:11:45 +00:00
|
|
|
rpl::variable<bool> _mainMenuAccountsShown = true;
|
2021-04-25 08:12:32 +00:00
|
|
|
mutable std::vector<RecentEmojiId> _recentEmojiPreload;
|
|
|
|
mutable std::vector<RecentEmoji> _recentEmoji;
|
|
|
|
base::flat_map<QString, uint8> _emojiVariants;
|
|
|
|
rpl::event_stream<> _recentEmojiUpdated;
|
2020-06-25 12:16:09 +00:00
|
|
|
bool _tabbedSelectorSectionEnabled = false; // per-window
|
2021-01-07 15:27:11 +00:00
|
|
|
Window::Column _floatPlayerColumn = Window::Column(); // per-window
|
|
|
|
RectPart _floatPlayerCorner = RectPart(); // per-window
|
2020-06-25 12:16:09 +00:00
|
|
|
bool _thirdSectionInfoEnabled = true; // per-window
|
|
|
|
rpl::event_stream<bool> _thirdSectionInfoEnabledValue; // per-window
|
|
|
|
int _thirdSectionExtendedBy = -1; // per-window
|
|
|
|
rpl::variable<float64> _dialogsWidthRatio; // per-window
|
|
|
|
rpl::variable<int> _thirdColumnWidth = kDefaultThirdColumnWidth; // p-w
|
2020-06-30 18:11:48 +00:00
|
|
|
bool _notifyFromAll = true;
|
2020-07-07 13:54:39 +00:00
|
|
|
rpl::variable<bool> _nativeWindowFrame = false;
|
2020-07-14 16:36:55 +00:00
|
|
|
rpl::variable<std::optional<bool>> _systemDarkMode = std::nullopt;
|
|
|
|
rpl::variable<bool> _systemDarkModeEnabled = false;
|
2021-02-17 15:20:05 +00:00
|
|
|
WindowPosition _windowPosition; // per-window
|
2021-05-20 12:07:53 +00:00
|
|
|
bool _disableOpenGL = false;
|
2020-06-25 12:16:09 +00:00
|
|
|
|
|
|
|
bool _tabbedReplacedWithInfo = false; // per-window
|
|
|
|
rpl::event_stream<bool> _tabbedReplacedWithInfoValue; // per-window
|
2020-06-18 18:04:16 +00:00
|
|
|
|
2021-04-25 08:12:32 +00:00
|
|
|
rpl::event_stream<> _saveDelayed;
|
2020-06-18 18:04:16 +00:00
|
|
|
float64 _rememberedSongVolume = kDefaultVolume;
|
|
|
|
bool _rememberedSoundNotifyFromTray = false;
|
|
|
|
bool _rememberedFlashBounceNotifyFromTray = false;
|
2019-08-23 13:52:59 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Core
|
2020-06-18 18:04:16 +00:00
|
|
|
|