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.

91 lines
3.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #ifndef JUCER_AUTOUPDATER_H_INCLUDED
  18. #define JUCER_AUTOUPDATER_H_INCLUDED
  19. class UpdaterDialogModalCallback;
  20. //==============================================================================
  21. class LatestVersionChecker : private Thread,
  22. private Timer
  23. {
  24. public:
  25. struct JuceVersionTriple
  26. {
  27. JuceVersionTriple();
  28. JuceVersionTriple (int majorInt, int minorInt, int buildNumber);
  29. static bool fromString (const String& versionString, JuceVersionTriple& result);
  30. String toString() const;
  31. bool operator> (const JuceVersionTriple& b) const noexcept;
  32. int major, minor, build;
  33. };
  34. //==============================================================================
  35. LatestVersionChecker();
  36. ~LatestVersionChecker();
  37. static String getOSString();
  38. static URL getLatestVersionURL (String& headers, const String& path);
  39. static URL getLatestVersionURL (String& headers);
  40. void checkForNewVersion();
  41. void processResult (var reply, const String& downloadPath);
  42. void askUserAboutNewVersion (const JuceVersionTriple& version,
  43. const String& releaseNotes,
  44. URL& newVersionToDownload,
  45. const String& extraHeaders);
  46. void askUserForLocationToDownload (URL& newVersionToDownload, const String& extraHeaders);
  47. static bool isZipFolder (const File&);
  48. private:
  49. //==============================================================================
  50. friend class UpdaterDialogModalCallback;
  51. // callbacks
  52. void timerCallback() override;
  53. void run() override;
  54. void modalStateFinished (int result,
  55. URL& newVersionToDownload,
  56. const String& extraHeaders,
  57. File appParentFolder);
  58. int statusCode;
  59. var jsonReply;
  60. bool hasAttemptedToReadWebsite;
  61. String newRelativeDownloadPath;
  62. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LatestVersionChecker)
  63. };
  64. #endif // JUCER_AUTOUPDATER_H_INCLUDED