window_theme_preview.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #pragma once
  8. #include "window/themes/window_theme.h"
  9. namespace Data {
  10. struct CloudTheme;
  11. } // namespace Data
  12. namespace Window {
  13. namespace Theme {
  14. struct CurrentData {
  15. WallPaperId backgroundId = 0;
  16. QImage backgroundImage;
  17. bool backgroundTiled = false;
  18. };
  19. enum class PreviewType {
  20. Normal,
  21. Extended,
  22. };
  23. [[nodiscard]] QString CachedThemePath(uint64 documentId);
  24. std::unique_ptr<Preview> PreviewFromFile(
  25. const QByteArray &bytes,
  26. const QString &filepath,
  27. const Data::CloudTheme &cloud);
  28. std::unique_ptr<Preview> GeneratePreview(
  29. const QByteArray &bytes,
  30. const QString &filepath,
  31. const Data::CloudTheme &cloud,
  32. CurrentData &&data,
  33. PreviewType type);
  34. QImage GeneratePreview(
  35. const QByteArray &bytes,
  36. const QString &filepath);
  37. int DefaultPreviewTitleHeight();
  38. void DefaultPreviewWindowFramePaint(
  39. QImage &preview,
  40. const style::palette &palette,
  41. QRect body,
  42. int outerWidth);
  43. } // namespace Theme
  44. } // namespace Window