AnalogTapeModel

Physical modelling signal processing for analog tape recording
Log | Files | Refs | Submodules | README | LICENSE

AutoUpdating.h (1547B)


      1 #ifndef AUTOUPDATING_H_INCLUDED
      2 #define AUTOUPDATING_H_INCLUDED
      3 
      4 #include "MyLNF.h"
      5 #include <JuceHeader.h>
      6 #include <future>
      7 
      8 #if CHOWDSP_AUTO_UPDATE
      9 
     10 struct UpdateButtonLNF : public MyLNF
     11 {
     12     UpdateButtonLNF() {}
     13 
     14     Font getTextButtonFont (TextButton&, int /*buttonHeight*/) override
     15     {
     16         return Font (30.0f).boldened();
     17     }
     18 
     19     void drawButtonBackground (Graphics& g, Button& button, const Colour& backgroundColour, bool, bool) override
     20     {
     21         LookAndFeel_V4::drawButtonBackground (g, button, backgroundColour, false, false);
     22     }
     23 
     24 private:
     25     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UpdateButtonLNF)
     26 };
     27 
     28 class AutoUpdater : public Component
     29 {
     30 public:
     31     AutoUpdater();
     32     ~AutoUpdater();
     33 
     34     void paint (Graphics& g) override;
     35     void resized() override;
     36     void parentSizeChanged() override;
     37 
     38     void showUpdaterScreen (Component* parent);
     39 
     40     bool runAutoUpdateCheck();
     41     void noButtonPressed();
     42     void yesButtonPressed();
     43 
     44 private:
     45     File getUpdateCheckFile();
     46     String getLatestVersion();
     47     String getUpdateFileVersion (const File& updateFile);
     48     bool getUpdateFileYesNo (const File& updateFile);
     49     void editUpdateCheckFile (String version, bool wantsUpdate);
     50 
     51     String newVersion = String (JucePlugin_VersionString);
     52 
     53     TextButton yesButton { "Yes" };
     54     TextButton noButton { "No" };
     55     UpdateButtonLNF ubLNF;
     56 
     57     std::future<bool> needsUpdate;
     58 
     59     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AutoUpdater)
     60 };
     61 
     62 #endif // CHOWDSP_AUTO_UPDATE
     63 
     64 #endif // AUTOUPDATING_H_INCLUDED