The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. #pragma once
  14. //==============================================================================
  15. struct LicenseState
  16. {
  17. enum class Type
  18. {
  19. none,
  20. gpl,
  21. personal,
  22. educational,
  23. indie,
  24. pro
  25. };
  26. LicenseState() = default;
  27. LicenseState (Type t, String token, String user, Image avatarImage)
  28. : type (t), authToken (token), username (user), avatar (avatarImage)
  29. {
  30. }
  31. bool isValid() const noexcept { return isGPL() || (type != Type::none && authToken.isNotEmpty() && username.isNotEmpty()); }
  32. bool isPaid() const noexcept { return type == Type::indie || type == Type::pro; }
  33. bool isGPL() const noexcept { return type == Type::gpl; }
  34. bool isPaidOrGPL() const noexcept { return isPaid() || isGPL(); }
  35. String getLicenseTypeString() const
  36. {
  37. switch (type)
  38. {
  39. case Type::none: return "No license";
  40. case Type::gpl: return "GPL";
  41. case Type::personal: return "Personal";
  42. case Type::educational: return "Educational";
  43. case Type::indie: return "Indie";
  44. case Type::pro: return "Pro";
  45. default: break;
  46. };
  47. jassertfalse;
  48. return {};
  49. }
  50. Type type = Type::none;
  51. String authToken, username;
  52. Image avatar;
  53. };