Style.qml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. pragma Singleton
  2. import QtQuick 2.15
  3. import com.nextcloud.desktopclient 1.0
  4. QtObject {
  5. readonly property int pixelSize: fontMetrics.font.pixelSize
  6. readonly property bool darkMode: Theme.darkMode
  7. // Colors
  8. readonly property color ncBlue: Theme.wizardHeaderBackgroundColor
  9. readonly property color ncTextColor: Theme.systemPalette.windowText
  10. readonly property color ncSecondaryTextColor: "#808080"
  11. readonly property color ncHeaderTextColor: "white"
  12. readonly property color lightHover: Theme.darkMode ? Qt.lighter(backgroundColor, 2) : Qt.darker(backgroundColor, 1.05)
  13. readonly property color darkerHover: Theme.darkMode ? Qt.lighter(backgroundColor, 2.35) : Qt.darker(backgroundColor, 1.25)
  14. readonly property color menuBorder: Theme.darkMode ? Qt.lighter(backgroundColor, 2.5) : Qt.darker(backgroundColor, 1.5)
  15. readonly property color backgroundColor: Theme.systemPalette.base
  16. readonly property color buttonBackgroundColor: Theme.systemPalette.button
  17. readonly property color positiveColor: Qt.rgba(0.38, 0.74, 0.38, 1)
  18. readonly property color currentUserHeaderColor: UserModel.currentUser ? UserModel.currentUser.headerColor : ncBlue
  19. readonly property color currentUserHeaderTextColor: UserModel.currentUser ? UserModel.currentUser.headerTextColor : ncHeaderTextColor
  20. readonly property color adjustedCurrentUserHeaderColor: Theme.darkMode ? Qt.lighter(currentUserHeaderColor, 2)
  21. : Qt.darker(currentUserHeaderColor, 1.5)
  22. // ErrorBox colors
  23. readonly property color errorBoxBackgroundColor: Qt.rgba(0.89, 0.18, 0.18, 1)
  24. readonly property int errorBoxStripeWidth: 4
  25. // Fonts
  26. // We are using pixel size because this is cross platform comparable, point size isn't
  27. readonly property int topLinePixelSize: pixelSize
  28. readonly property int subLinePixelSize: topLinePixelSize - 2
  29. // Dimensions and sizes
  30. property int trayWindowWidth: variableSize(400)
  31. property int trayWindowHeight: variableSize(510)
  32. property int trayWindowRadius: 10
  33. property int trayWindowBorderWidth: variableSize(1)
  34. property int trayWindowHeaderHeight: variableSize(60)
  35. property int trayHorizontalMargin: 10
  36. property int trayModalWidth: 380
  37. property int trayModalHeight: 490
  38. property int trayListItemIconSize: accountAvatarSize
  39. property int trayDrawerMargin: trayWindowHeaderHeight
  40. property real thumbnailImageSizeReduction: 0.2 // We reserve some space within the thumbnail "item", here about 20%.
  41. // This is because we need to also add the added/modified icon and we
  42. // want them to fit within the general icon size. We also need to know
  43. // this amount to properly center the sync status icon to the thumbnail
  44. // images, which will work so long as the thumbnails are left aligned
  45. property int standardSpacing: trayHorizontalMargin
  46. property int smallSpacing: 5
  47. property int extraSmallSpacing: 2
  48. property int iconButtonWidth: 36
  49. property int standardPrimaryButtonHeight: 40
  50. property int minActivityHeight: variableSize(32)
  51. property int currentAccountButtonWidth: 220
  52. property int currentAccountButtonRadius: 2
  53. property int currentAccountLabelWidth: 128
  54. property int normalBorderWidth: 1
  55. property int thickBorderWidth: 2
  56. property int veryRoundedButtonRadius: 100
  57. property int mediumRoundedButtonRadius: 8
  58. property int slightlyRoundedButtonRadius: 5
  59. property double hoverOpacity: 0.7
  60. property url stateOnlineImageSource: Theme.stateOnlineImageSource
  61. property url stateOfflineImageSource: Theme.stateOfflineImageSource
  62. property int accountAvatarSize: (trayWindowHeaderHeight - 16)
  63. property int accountAvatarStateIndicatorSize: 16
  64. property int folderStateIndicatorSize: 16
  65. property int accountLabelWidth: 128
  66. property int accountDropDownCaretSize: 20
  67. property int accountDropDownCaretMargin: 8
  68. property int addAccountButtonHeight: 50
  69. property int headerButtonIconSize: 32
  70. property int dismissButtonSize: 24
  71. property int minimumActivityItemHeight: 24
  72. property int activityLabelBaseWidth: 240
  73. property int talkReplyTextFieldPreferredHeight: 34
  74. property int talkReplyTextFieldPreferredWidth: 250
  75. property int activityItemActionPrimaryButtonMinWidth: 100
  76. property int activityItemActionSecondaryButtonMinWidth: 80
  77. property int callNotificationPrimaryButtonMinWidth: 100
  78. property int callNotificationPrimaryButtonMinHeight: 40
  79. property int roundButtonBackgroundVerticalMargins: 10
  80. property int roundedButtonBackgroundVerticalMargins: 5
  81. property int userStatusEmojiSize: 8
  82. property int userStatusSpacing: trayHorizontalMargin
  83. property int userStatusAnchorsMargin: 2
  84. property int accountServerAnchorsMargin: 10
  85. property int accountLabelsSpacing: 4
  86. property int accountLabelsAnchorsMargin: 7
  87. property int accountLabelsLayoutMargin: 12
  88. property int accountLabelsLayoutTopMargin: 10
  89. // Visual behaviour
  90. property bool hoverEffectsEnabled: true
  91. // unified search constants
  92. readonly property int unifiedSearchItemHeight: trayWindowHeaderHeight
  93. readonly property int unifiedSearchResultTextLeftMargin: 18
  94. readonly property int unifiedSearchResultTextRightMargin: 16
  95. readonly property int unifiedSearchResultIconWidth: trayListItemIconSize * (1 - thumbnailImageSizeReduction)
  96. readonly property int unifiedSearchResultSmallIconWidth: trayListItemIconSize * (1 - thumbnailImageSizeReduction * 2)
  97. readonly property int unifiedSearchResultIconLeftMargin: 12
  98. readonly property int unifiedSearchResultTitleFontSize: topLinePixelSize
  99. readonly property int unifiedSearchResultSublineFontSize: subLinePixelSize
  100. readonly property int unifiedSearchResultSectionItemLeftPadding: 16
  101. readonly property int unifiedSearchResultSectionItemVerticalPadding: 8
  102. readonly property int unifiedSearchResultNothingFoundHorizontalMargin: 10
  103. readonly property int radioButtonCustomMarginLeftInner: 4
  104. readonly property int radioButtonCustomMarginLeftOuter: 5
  105. readonly property int radioButtonCustomRadius: 9
  106. readonly property int radioButtonIndicatorSize: 16
  107. readonly property var fontMetrics: FontMetrics {}
  108. readonly property int bigFontPixelSizeResolveConflictsDialog: 20
  109. readonly property int fontPixelSizeResolveConflictsDialog: 15
  110. readonly property int minimumWidthResolveConflictsDialog: 600
  111. readonly property int minimumHeightResolveConflictsDialog: 800
  112. readonly property double smallIconScaleFactor: 0.6
  113. readonly property double trayFolderListButtonWidthScaleFactor: 1.75
  114. readonly property int trayFolderStatusIndicatorSizeOffset: 2
  115. readonly property double trayFolderStatusIndicatorRadiusFactor: 0.5
  116. readonly property double trayFolderStatusIndicatorMouseHoverOpacityFactor: 0.2
  117. readonly property double trayWindowMenuWidthFactor: 0.35
  118. readonly property int trayWindowMenuOffsetX: -2
  119. readonly property int trayWindowMenuOffsetY: 2
  120. readonly property int trayWindowMenuEntriesMargin: 6
  121. // animation durations
  122. readonly property int shortAnimationDuration: 200
  123. readonly property int veryLongAnimationDuration: 3000
  124. function variableSize(size) {
  125. return size * (1 + Math.min(pixelSize / 100, 1));
  126. }
  127. }