chat_style_radius.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #include "ui/chat/chat_style_radius.h"
  8. #include "ui/chat/chat_style.h"
  9. #include "base/options.h"
  10. #include "ui/chat/chat_theme.h"
  11. #include "ui/painter.h"
  12. #include "ui/ui_utility.h"
  13. #include "styles/style_chat.h"
  14. namespace Ui {
  15. namespace {
  16. base::options::toggle UseSmallMsgBubbleRadius({
  17. .id = kOptionUseSmallMsgBubbleRadius,
  18. .name = "Use small message bubble radius",
  19. .description = "Makes most message bubbles square-ish.",
  20. .restartRequired = true,
  21. });
  22. } // namespace
  23. const char kOptionUseSmallMsgBubbleRadius[] = "use-small-msg-bubble-radius";
  24. int BubbleRadiusSmall() {
  25. return st::bubbleRadiusSmall;
  26. }
  27. int BubbleRadiusLarge() {
  28. static const auto result = [] {
  29. if (UseSmallMsgBubbleRadius.value()) {
  30. return st::bubbleRadiusSmall;
  31. } else {
  32. return st::bubbleRadiusLarge;
  33. }
  34. }();
  35. return result;
  36. }
  37. int MsgFileThumbRadiusSmall() {
  38. return st::msgFileThumbRadiusSmall;
  39. }
  40. int MsgFileThumbRadiusLarge() {
  41. static const auto result = [] {
  42. if (UseSmallMsgBubbleRadius.value()) {
  43. return st::msgFileThumbRadiusSmall;
  44. } else {
  45. return st::msgFileThumbRadiusLarge;
  46. }
  47. }();
  48. return result;
  49. }
  50. }