mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-29 13:47:47 +00:00
Moved settings variables
This commit is contained in:
parent
32ffb58f7a
commit
2f7183e67c
@ -1021,6 +1021,8 @@ PRIVATE
|
||||
observer_peer.h
|
||||
settings.cpp
|
||||
settings.h
|
||||
kotato/settings.cpp
|
||||
kotato/settings.h
|
||||
)
|
||||
|
||||
if (DESKTOP_APP_USE_PACKAGED)
|
||||
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "core/version.h"
|
||||
#include "settings.h"
|
||||
#include "kotato/settings.h"
|
||||
|
||||
enum {
|
||||
MaxSelectedItems = 100,
|
||||
|
129
Telegram/SourceFiles/kotato/settings.cpp
Normal file
129
Telegram/SourceFiles/kotato/settings.cpp
Normal file
@ -0,0 +1,129 @@
|
||||
/*
|
||||
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"
|
||||
|
||||
bool gKotatoFirstRun = true;
|
||||
|
||||
QString gMainFont, gSemiboldFont, gMonospaceFont;
|
||||
bool gSemiboldFontIsBold = false;
|
||||
|
||||
#ifdef DESKTOP_APP_USE_PACKAGED_FONTS
|
||||
bool gUseSystemFont = true;
|
||||
#else
|
||||
bool gUseSystemFont = false;
|
||||
#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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
bool gAlwaysShowScheduled = false;
|
||||
bool gShowChatId = false;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
bool gConfirmBeforeCall = false;
|
||||
bool gNoTaskbarFlashing = false;
|
||||
|
||||
rpl::variable<int> gRecentStickersLimit = 20;
|
||||
void SetRecentStickersLimit(int limit) {
|
||||
if (limit >= 0 || limit <= 200) {
|
||||
gRecentStickersLimit = limit;
|
||||
}
|
||||
}
|
||||
int RecentStickersLimit() {
|
||||
return gRecentStickersLimit.current();
|
||||
}
|
||||
rpl::producer<int> RecentStickersLimitChanges() {
|
||||
return gRecentStickersLimit.changes();
|
||||
}
|
||||
|
||||
int gUserpicCornersType = 3;
|
||||
bool gShowTopBarUserpic = false;
|
||||
int gCustomAppIcon = 0;
|
||||
|
||||
int gDefaultFilterId = 0;
|
||||
bool gUnmutedFilterCounterOnly = false;
|
||||
bool gHideFilterEditButton = false;
|
||||
bool gHideFilterNames = false;
|
||||
bool gHideFilterAllChats = false;
|
||||
|
||||
bool gProfileTopBarNotifications = false;
|
102
Telegram/SourceFiles/kotato/settings.h
Normal file
102
Telegram/SourceFiles/kotato/settings.h
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#define DeclareReadSetting(Type, Name) extern Type g##Name; \
|
||||
inline const Type &c##Name() { \
|
||||
return g##Name; \
|
||||
}
|
||||
|
||||
#define DeclareSetting(Type, Name) DeclareReadSetting(Type, Name) \
|
||||
inline void cSet##Name(const Type &Name) { \
|
||||
g##Name = Name; \
|
||||
}
|
||||
|
||||
#define DeclareRefSetting(Type, Name) DeclareSetting(Type, Name) \
|
||||
inline Type &cRef##Name() { \
|
||||
return g##Name; \
|
||||
}
|
||||
|
||||
DeclareSetting(bool, KotatoFirstRun);
|
||||
|
||||
DeclareSetting(QString, MainFont);
|
||||
DeclareSetting(QString, SemiboldFont);
|
||||
DeclareSetting(bool, SemiboldFontIsBold);
|
||||
DeclareSetting(QString, MonospaceFont);
|
||||
DeclareSetting(bool, UseSystemFont);
|
||||
DeclareSetting(bool, UseOriginalMetrics);
|
||||
|
||||
void SetBigEmojiOutline(bool enabled);
|
||||
[[nodiscard]] bool BigEmojiOutline();
|
||||
[[nodiscard]] rpl::producer<bool> BigEmojiOutlineChanges();
|
||||
|
||||
void SetStickerHeight(int height);
|
||||
[[nodiscard]] int StickerHeight();
|
||||
[[nodiscard]] rpl::producer<int> StickerHeightChanges();
|
||||
|
||||
void SetAdaptiveBubbles(bool enabled);
|
||||
[[nodiscard]] bool AdaptiveBubbles();
|
||||
[[nodiscard]] rpl::producer<bool> AdaptiveBubblesChanges();
|
||||
|
||||
DeclareSetting(bool, AlwaysShowScheduled);
|
||||
DeclareSetting(bool, ShowChatId);
|
||||
|
||||
DeclareSetting(int, NetSpeedBoost);
|
||||
DeclareSetting(int, NetRequestsCount);
|
||||
DeclareSetting(int, NetUploadSessionsCount);
|
||||
DeclareSetting(int, NetUploadRequestInterval);
|
||||
|
||||
inline void SetNetworkBoost(int boost) {
|
||||
if (boost < 0) {
|
||||
cSetNetSpeedBoost(0);
|
||||
} else if (boost > 3) {
|
||||
cSetNetSpeedBoost(3);
|
||||
} else {
|
||||
cSetNetSpeedBoost(boost);
|
||||
}
|
||||
|
||||
cSetNetRequestsCount(2 + (2 * cNetSpeedBoost()));
|
||||
cSetNetUploadSessionsCount(2 + (2 * cNetSpeedBoost()));
|
||||
cSetNetUploadRequestInterval(500 - (100 * cNetSpeedBoost()));
|
||||
}
|
||||
|
||||
DeclareSetting(bool, ShowPhoneInDrawer);
|
||||
|
||||
using ScaleVector = std::vector<int>;
|
||||
DeclareRefSetting(ScaleVector, InterfaceScales);
|
||||
bool HasCustomScales();
|
||||
bool AddCustomScale(int scale);
|
||||
void ClearCustomScales();
|
||||
|
||||
void SetDialogListLines(int lines);
|
||||
[[nodiscard]] int DialogListLines();
|
||||
[[nodiscard]] rpl::producer<int> DialogListLinesChanges();
|
||||
|
||||
DeclareSetting(bool, DisableUpEdit);
|
||||
|
||||
using CustomReplacementsMap = QMap<QString, QString>;
|
||||
DeclareRefSetting(CustomReplacementsMap, CustomReplaces);
|
||||
bool AddCustomReplace(QString from, QString to);
|
||||
DeclareSetting(bool, ConfirmBeforeCall);
|
||||
DeclareSetting(bool, NoTaskbarFlashing);
|
||||
|
||||
void SetRecentStickersLimit(int limit);
|
||||
[[nodiscard]] int RecentStickersLimit();
|
||||
[[nodiscard]] rpl::producer<int> RecentStickersLimitChanges();
|
||||
|
||||
DeclareSetting(int, UserpicCornersType);
|
||||
DeclareSetting(bool, ShowTopBarUserpic);
|
||||
DeclareSetting(int, CustomAppIcon);
|
||||
|
||||
DeclareSetting(int, DefaultFilterId);
|
||||
DeclareSetting(bool, UnmutedFilterCounterOnly);
|
||||
DeclareSetting(bool, HideFilterEditButton);
|
||||
DeclareSetting(bool, HideFilterNames);
|
||||
DeclareSetting(bool, HideFilterAllChats);
|
||||
|
||||
DeclareSetting(bool, ProfileTopBarNotifications);
|
@ -206,124 +206,3 @@ void AddRecentEmoji(EmojiPtr emoji) {
|
||||
rpl::producer<> UpdatedRecentEmoji() {
|
||||
return UpdatesRecentEmoji.events();
|
||||
}
|
||||
|
||||
bool gKotatoFirstRun = true;
|
||||
|
||||
QString gMainFont, gSemiboldFont, gMonospaceFont;
|
||||
bool gSemiboldFontIsBold = false;
|
||||
|
||||
#ifdef DESKTOP_APP_USE_PACKAGED_FONTS
|
||||
bool gUseSystemFont = true;
|
||||
#else
|
||||
bool gUseSystemFont = false;
|
||||
#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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
bool gAlwaysShowScheduled = false;
|
||||
bool gShowChatId = false;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
bool gConfirmBeforeCall = false;
|
||||
bool gNoTaskbarFlashing = false;
|
||||
|
||||
rpl::variable<int> gRecentStickersLimit = 20;
|
||||
void SetRecentStickersLimit(int limit) {
|
||||
if (limit >= 0 || limit <= 200) {
|
||||
gRecentStickersLimit = limit;
|
||||
}
|
||||
}
|
||||
int RecentStickersLimit() {
|
||||
return gRecentStickersLimit.current();
|
||||
}
|
||||
rpl::producer<int> RecentStickersLimitChanges() {
|
||||
return gRecentStickersLimit.changes();
|
||||
}
|
||||
|
||||
int gUserpicCornersType = 3;
|
||||
bool gShowTopBarUserpic = false;
|
||||
int gCustomAppIcon = 0;
|
||||
|
||||
int gDefaultFilterId = 0;
|
||||
bool gUnmutedFilterCounterOnly = false;
|
||||
bool gHideFilterEditButton = false;
|
||||
bool gHideFilterNames = false;
|
||||
bool gHideFilterAllChats = false;
|
||||
|
||||
bool gProfileTopBarNotifications = false;
|
||||
|
@ -178,82 +178,3 @@ inline void ValidateScale() {
|
||||
SetScaleChecked(cConfigScale());
|
||||
style::SetScale(cEvalScale(cConfigScale()));
|
||||
}
|
||||
|
||||
DeclareSetting(bool, KotatoFirstRun);
|
||||
|
||||
DeclareSetting(QString, MainFont);
|
||||
DeclareSetting(QString, SemiboldFont);
|
||||
DeclareSetting(bool, SemiboldFontIsBold);
|
||||
DeclareSetting(QString, MonospaceFont);
|
||||
DeclareSetting(bool, UseSystemFont);
|
||||
DeclareSetting(bool, UseOriginalMetrics);
|
||||
|
||||
void SetBigEmojiOutline(bool enabled);
|
||||
[[nodiscard]] bool BigEmojiOutline();
|
||||
[[nodiscard]] rpl::producer<bool> BigEmojiOutlineChanges();
|
||||
|
||||
void SetStickerHeight(int height);
|
||||
[[nodiscard]] int StickerHeight();
|
||||
[[nodiscard]] rpl::producer<int> StickerHeightChanges();
|
||||
|
||||
void SetAdaptiveBubbles(bool enabled);
|
||||
[[nodiscard]] bool AdaptiveBubbles();
|
||||
[[nodiscard]] rpl::producer<bool> AdaptiveBubblesChanges();
|
||||
|
||||
DeclareSetting(bool, AlwaysShowScheduled);
|
||||
DeclareSetting(bool, ShowChatId);
|
||||
|
||||
DeclareSetting(int, NetSpeedBoost);
|
||||
DeclareSetting(int, NetRequestsCount);
|
||||
DeclareSetting(int, NetUploadSessionsCount);
|
||||
DeclareSetting(int, NetUploadRequestInterval);
|
||||
|
||||
inline void SetNetworkBoost(int boost) {
|
||||
if (boost < 0) {
|
||||
cSetNetSpeedBoost(0);
|
||||
} else if (boost > 3) {
|
||||
cSetNetSpeedBoost(3);
|
||||
} else {
|
||||
cSetNetSpeedBoost(boost);
|
||||
}
|
||||
|
||||
cSetNetRequestsCount(2 + (2 * cNetSpeedBoost()));
|
||||
cSetNetUploadSessionsCount(2 + (2 * cNetSpeedBoost()));
|
||||
cSetNetUploadRequestInterval(500 - (100 * cNetSpeedBoost()));
|
||||
}
|
||||
|
||||
DeclareSetting(bool, ShowPhoneInDrawer);
|
||||
|
||||
using ScaleVector = std::vector<int>;
|
||||
DeclareRefSetting(ScaleVector, InterfaceScales);
|
||||
bool HasCustomScales();
|
||||
bool AddCustomScale(int scale);
|
||||
void ClearCustomScales();
|
||||
|
||||
void SetDialogListLines(int lines);
|
||||
[[nodiscard]] int DialogListLines();
|
||||
[[nodiscard]] rpl::producer<int> DialogListLinesChanges();
|
||||
|
||||
DeclareSetting(bool, DisableUpEdit);
|
||||
|
||||
using CustomReplacementsMap = QMap<QString, QString>;
|
||||
DeclareRefSetting(CustomReplacementsMap, CustomReplaces);
|
||||
bool AddCustomReplace(QString from, QString to);
|
||||
DeclareSetting(bool, ConfirmBeforeCall);
|
||||
DeclareSetting(bool, NoTaskbarFlashing);
|
||||
|
||||
void SetRecentStickersLimit(int limit);
|
||||
[[nodiscard]] int RecentStickersLimit();
|
||||
[[nodiscard]] rpl::producer<int> RecentStickersLimitChanges();
|
||||
|
||||
DeclareSetting(int, UserpicCornersType);
|
||||
DeclareSetting(bool, ShowTopBarUserpic);
|
||||
DeclareSetting(int, CustomAppIcon);
|
||||
|
||||
DeclareSetting(int, DefaultFilterId);
|
||||
DeclareSetting(bool, UnmutedFilterCounterOnly);
|
||||
DeclareSetting(bool, HideFilterEditButton);
|
||||
DeclareSetting(bool, HideFilterNames);
|
||||
DeclareSetting(bool, HideFilterAllChats);
|
||||
|
||||
DeclareSetting(bool, ProfileTopBarNotifications);
|
||||
|
Loading…
x
Reference in New Issue
Block a user