2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 09:05:14 +00:00
Files
kotatogram-desktop/Telegram/SourceFiles/kotato/settings.cpp

270 lines
6.7 KiB
C++
Raw Normal View History

2020-04-21 06:49:33 +03:00
/*
This file is part of Kotatogram Desktop,
the unofficial app based on Telegram Desktop.
For license and copyright information please follow this link:
https://github.com/kotatogram/kotatogram-desktop/blob/dev/LEGAL
*/
#include "kotato/settings.h"
#include "base/platform/base_platform_info.h"
2021-05-30 01:25:29 +00:00
#include "platform/platform_file_utilities.h"
2020-04-21 06:49:33 +03:00
bool gKotatoFirstRun = true;
QString gMainFont, gSemiboldFont, gMonospaceFont;
2021-05-30 01:24:56 +00:00
int gFontSize = 0;
2020-04-21 06:49:33 +03:00
bool gSemiboldFontIsBold = false;
#ifdef DESKTOP_APP_USE_PACKAGED_FONTS
bool gUseSystemFont = true;
#else
2020-12-26 00:30:29 +04:00
bool gUseSystemFont = Platform::IsLinux();
2020-04-21 06:49:33 +03:00
#endif
bool gUseOriginalMetrics = false;
rpl::variable<int> gStickerHeight = 170;
void SetStickerHeight(int height) {
gStickerHeight = height;
}
int StickerHeight() {
return gStickerHeight.current();
}
rpl::producer<int> StickerHeightChanges() {
return gStickerHeight.changes();
}
2020-05-06 02:27:04 +03:00
rpl::variable<bool> gStickerScaleBoth = true;
void SetStickerScaleBoth(bool scale) {
gStickerScaleBoth = scale;
}
bool StickerScaleBoth() {
return gStickerScaleBoth.current();
}
rpl::producer<bool> StickerScaleBothChanges() {
return gStickerScaleBoth.changes();
}
2020-04-21 06:49:33 +03:00
rpl::variable<bool> gBigEmojiOutline = true;
void SetBigEmojiOutline(bool enabled) {
gBigEmojiOutline = enabled;
}
bool BigEmojiOutline() {
return gBigEmojiOutline.current();
}
rpl::producer<bool> BigEmojiOutlineChanges() {
return gBigEmojiOutline.changes();
}
rpl::variable<bool> gAdaptiveBubbles = false;
void SetAdaptiveBubbles(bool enabled) {
gAdaptiveBubbles = enabled;
}
bool AdaptiveBubbles() {
return gAdaptiveBubbles.current();
}
rpl::producer<bool> AdaptiveBubblesChanges() {
return gAdaptiveBubbles.changes();
}
rpl::variable<bool> gMonospaceLargeBubbles = false;
void SetMonospaceLargeBubbles(bool enabled) {
gMonospaceLargeBubbles = enabled;
}
bool MonospaceLargeBubbles() {
return gMonospaceLargeBubbles.current();
}
rpl::producer<bool> MonospaceLargeBubblesChanges() {
return gMonospaceLargeBubbles.changes();
}
2020-04-21 06:49:33 +03:00
bool gAlwaysShowScheduled = false;
rpl::variable<int> gShowChatId = 2;
void SetShowChatId(int chatIdType) {
if (chatIdType >= 0 && chatIdType <= 2) {
gShowChatId = chatIdType;
}
}
int ShowChatId() {
return gShowChatId.current();
}
rpl::producer<int> ShowChatIdChanges() {
return gShowChatId.changes();
}
2020-04-21 06:49:33 +03:00
int gNetSpeedBoost = 0;
int gNetRequestsCount = 2;
int gNetUploadSessionsCount = 2;
int gNetUploadRequestInterval = 500;
bool gShowPhoneInDrawer = true;
ScaleVector gInterfaceScales;
bool HasCustomScales() {
return (!gInterfaceScales.empty());
}
bool AddCustomScale(int scale) {
if (gInterfaceScales.size() >= 6) {
return false;
}
gInterfaceScales.push_back(style::CheckScale(scale));
return true;
}
void ClearCustomScales() {
gInterfaceScales.clear();
}
rpl::variable<int> gDialogListLines = 2;
void SetDialogListLines(int lines) {
gDialogListLines = lines;
}
int DialogListLines() {
return gDialogListLines.current();
}
rpl::producer<int> DialogListLinesChanges() {
return gDialogListLines.changes();
}
bool gDisableUpEdit = false;
CustomReplacementsMap gCustomReplaces;
bool AddCustomReplace(QString from, QString to) {
gCustomReplaces.insert(from, to);
return true;
}
2021-03-30 19:22:28 +03:00
bool gConfirmBeforeCall = true;
2020-04-21 06:49:33 +03:00
2021-05-30 01:25:29 +00:00
bool gFFmpegMultithread = true;
uint gFFmpegThreadCount = 0;
bool gUseNativeDecorations = false;
bool UseNativeDecorations() {
static const auto NativeDecorations = cUseNativeDecorations();
return NativeDecorations;
}
2020-04-21 06:49:33 +03:00
rpl::variable<int> gRecentStickersLimit = 20;
void SetRecentStickersLimit(int limit) {
2020-12-25 02:12:58 +03:00
if (limit >= 0 && limit <= 200) {
2020-04-21 06:49:33 +03:00
gRecentStickersLimit = limit;
}
}
int RecentStickersLimit() {
return gRecentStickersLimit.current();
}
rpl::producer<int> RecentStickersLimitChanges() {
return gRecentStickersLimit.changes();
}
int gUserpicCornersType = 3;
bool gShowTopBarUserpic = false;
bool gQtScale = false;
bool gGtkIntegration = false;
rpl::variable<Platform::FileDialog::ImplementationType> gFileDialogType = Platform::FileDialog::ImplementationType::Default;
void SetFileDialogType(Platform::FileDialog::ImplementationType t) {
if (t == Platform::FileDialog::ImplementationType::Count) {
t = Platform::FileDialog::ImplementationType::Default;
}
gFileDialogType = t;
}
Platform::FileDialog::ImplementationType FileDialogType() {
return gFileDialogType.current();
}
rpl::producer<Platform::FileDialog::ImplementationType> FileDialogTypeChanges() {
return gFileDialogType.changes();
}
bool gDisableTrayCounter = Platform::IsLinux();
bool gUseTelegramPanelIcon = false;
2020-04-21 06:49:33 +03:00
int gCustomAppIcon = 0;
2020-07-02 03:34:22 +03:00
DefaultFilterMap gDefaultFilterId;
2021-04-26 23:45:08 +03:00
void SetDefaultFilterId(QString account, int filter) {
2020-07-02 03:34:22 +03:00
if (gDefaultFilterId.contains(account)) {
gDefaultFilterId[account] = filter;
} else {
gDefaultFilterId.insert(account, filter);
}
}
2021-04-26 23:45:08 +03:00
int DefaultFilterId(QString account) {
2020-07-02 03:34:22 +03:00
if (gDefaultFilterId.contains(account)) {
return gDefaultFilterId[account];
}
return 0;
}
2021-04-26 23:45:08 +03:00
bool HasDefaultFilterId(QString account) {
2020-07-02 03:34:22 +03:00
return gDefaultFilterId.contains(account);
}
2021-04-26 23:45:08 +03:00
bool ClearDefaultFilterId(QString account) {
2020-07-02 03:34:22 +03:00
return gDefaultFilterId.remove(account);
}
2020-04-21 06:49:33 +03:00
bool gUnmutedFilterCounterOnly = false;
bool gHideFilterEditButton = false;
bool gHideFilterNames = false;
bool gHideFilterAllChats = false;
bool gProfileTopBarNotifications = false;
2020-05-15 20:20:12 +03:00
rpl::variable<bool> gHoverEmojiPanel = true;
void SetHoverEmojiPanel(bool enabled) {
gHoverEmojiPanel = enabled;
}
bool HoverEmojiPanel() {
return gHoverEmojiPanel.current();
}
rpl::producer<bool> HoverEmojiPanelChanges() {
return gHoverEmojiPanel.changes();
}
bool gForwardRetainSelection = false;
2020-07-09 11:42:10 +03:00
bool gForwardChatOnClick = false;
#if defined TDESKTOP_API_ID && defined TDESKTOP_API_HASH
int gApiId = TDESKTOP_API_ID;
QString gApiHash = QT_STRINGIFY(TDESKTOP_API_HASH);
#else // TDESKTOP_API_ID && TDESKTOP_API_HASH
// To build your version of Telegram Desktop you're required to provide
// your own 'api_id' and 'api_hash' for the Telegram API access.
//
// How to obtain your 'api_id' and 'api_hash' is described here:
// https://core.telegram.org/api/obtaining_api_id
//
// If you're building the application not for deployment,
// but only for test purposes you can comment out the error below.
//
// This will allow you to use TEST ONLY 'api_id' and 'api_hash' which are
// very limited by the Telegram API server.
//
// Your users will start getting internal server errors on login
// if you deploy an app using those 'api_id' and 'api_hash'.
int gApiId = 0;
QString gApiHash;
#endif // TDESKTOP_API_ID && TDESKTOP_API_HASH
bool gUseEnvApi = true;
bool gApiFromStartParams = false;
2020-07-15 16:47:26 +03:00
bool gForwardQuoted = true;
bool gForwardCaptioned = true;
bool gForwardAlbumsAsIs = true;
bool gForwardGrouped = false;
2020-08-16 03:48:17 +03:00
bool gAutoScrollUnfocused = false;
2020-08-16 03:48:17 +03:00
LocalFolderVector gLocalFolders;
bool gTelegramSitesAutologin = true;