DisplayPreferences.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #pragma warning disable CA2227
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel.DataAnnotations;
  5. using System.ComponentModel.DataAnnotations.Schema;
  6. using Jellyfin.Data.Enums;
  7. namespace Jellyfin.Data.Entities
  8. {
  9. /// <summary>
  10. /// An entity representing a user's display preferences.
  11. /// </summary>
  12. public class DisplayPreferences
  13. {
  14. /// <summary>
  15. /// Initializes a new instance of the <see cref="DisplayPreferences"/> class.
  16. /// </summary>
  17. /// <param name="userId">The user's id.</param>
  18. /// <param name="client">The client string.</param>
  19. public DisplayPreferences(Guid userId, string client)
  20. {
  21. UserId = userId;
  22. Client = client;
  23. ShowSidebar = false;
  24. ShowBackdrop = true;
  25. SkipForwardLength = 30000;
  26. SkipBackwardLength = 10000;
  27. ScrollDirection = ScrollDirection.Horizontal;
  28. ChromecastVersion = ChromecastVersion.Stable;
  29. DashboardTheme = string.Empty;
  30. TvHome = string.Empty;
  31. HomeSections = new HashSet<HomeSection>();
  32. }
  33. /// <summary>
  34. /// Initializes a new instance of the <see cref="DisplayPreferences"/> class.
  35. /// </summary>
  36. protected DisplayPreferences()
  37. {
  38. }
  39. /// <summary>
  40. /// Gets or sets the Id.
  41. /// </summary>
  42. /// <remarks>
  43. /// Required.
  44. /// </remarks>
  45. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  46. public int Id { get; protected set; }
  47. /// <summary>
  48. /// Gets or sets the user Id.
  49. /// </summary>
  50. /// <remarks>
  51. /// Required.
  52. /// </remarks>
  53. public Guid UserId { get; set; }
  54. /// <summary>
  55. /// Gets or sets the client string.
  56. /// </summary>
  57. /// <remarks>
  58. /// Required. Max Length = 32.
  59. /// </remarks>
  60. [Required]
  61. [MaxLength(32)]
  62. [StringLength(32)]
  63. public string Client { get; set; }
  64. /// <summary>
  65. /// Gets or sets a value indicating whether to show the sidebar.
  66. /// </summary>
  67. /// <remarks>
  68. /// Required.
  69. /// </remarks>
  70. public bool ShowSidebar { get; set; }
  71. /// <summary>
  72. /// Gets or sets a value indicating whether to show the backdrop.
  73. /// </summary>
  74. /// <remarks>
  75. /// Required.
  76. /// </remarks>
  77. public bool ShowBackdrop { get; set; }
  78. /// <summary>
  79. /// Gets or sets the scroll direction.
  80. /// </summary>
  81. /// <remarks>
  82. /// Required.
  83. /// </remarks>
  84. public ScrollDirection ScrollDirection { get; set; }
  85. /// <summary>
  86. /// Gets or sets what the view should be indexed by.
  87. /// </summary>
  88. public IndexingKind? IndexBy { get; set; }
  89. /// <summary>
  90. /// Gets or sets the length of time to skip forwards, in milliseconds.
  91. /// </summary>
  92. /// <remarks>
  93. /// Required.
  94. /// </remarks>
  95. public int SkipForwardLength { get; set; }
  96. /// <summary>
  97. /// Gets or sets the length of time to skip backwards, in milliseconds.
  98. /// </summary>
  99. /// <remarks>
  100. /// Required.
  101. /// </remarks>
  102. public int SkipBackwardLength { get; set; }
  103. /// <summary>
  104. /// Gets or sets the Chromecast Version.
  105. /// </summary>
  106. /// <remarks>
  107. /// Required.
  108. /// </remarks>
  109. public ChromecastVersion ChromecastVersion { get; set; }
  110. /// <summary>
  111. /// Gets or sets a value indicating whether the next video info overlay should be shown.
  112. /// </summary>
  113. /// <remarks>
  114. /// Required.
  115. /// </remarks>
  116. public bool EnableNextVideoInfoOverlay { get; set; }
  117. /// <summary>
  118. /// Gets or sets the dashboard theme.
  119. /// </summary>
  120. [MaxLength(32)]
  121. [StringLength(32)]
  122. public string DashboardTheme { get; set; }
  123. /// <summary>
  124. /// Gets or sets the tv home screen.
  125. /// </summary>
  126. [MaxLength(32)]
  127. [StringLength(32)]
  128. public string TvHome { get; set; }
  129. /// <summary>
  130. /// Gets or sets the home sections.
  131. /// </summary>
  132. public virtual ICollection<HomeSection> HomeSections { get; protected set; }
  133. }
  134. }