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.

87 lines
3.1KB

  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_JUCEUPDATER_JUCEHEADER__
  18. #define __JUCER_JUCEUPDATER_JUCEHEADER__
  19. #include "../Project/jucer_Module.h"
  20. //==============================================================================
  21. class JuceUpdater : public Component,
  22. private ButtonListener,
  23. private FilenameComponentListener,
  24. private ListBoxModel,
  25. private ValueTree::Listener
  26. {
  27. public:
  28. JuceUpdater (ModuleList& moduleList, const String& message);
  29. ~JuceUpdater();
  30. static void show (ModuleList& moduleList, Component* mainWindow, const String& message);
  31. //==============================================================================
  32. void resized();
  33. void paint (Graphics& g);
  34. void buttonClicked (Button*);
  35. void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged);
  36. int getNumRows();
  37. void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
  38. Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
  39. void backgroundUpdateComplete (const ModuleList& newList);
  40. private:
  41. ModuleList& moduleList;
  42. ModuleList latestList;
  43. Label messageLabel, label, currentVersionLabel;
  44. FilenameComponent filenameComp;
  45. TextButton checkNowButton;
  46. ListBox availableVersionsList;
  47. ValueTree versionsToDownload;
  48. TextButton installButton;
  49. ToggleButton selectAllButton;
  50. ScopedPointer<Thread> websiteContacterThread;
  51. void checkNow();
  52. void install();
  53. void updateInstallButtonStatus();
  54. void refresh();
  55. void selectAll();
  56. int getNumCheckedModules() const;
  57. bool isLatestVersion (const String& moduleID) const;
  58. void valueTreePropertyChanged (ValueTree&, const Identifier&) override;
  59. void valueTreeChildAdded (ValueTree&, ValueTree&) override;
  60. void valueTreeChildRemoved (ValueTree&, ValueTree&) override;
  61. void valueTreeChildOrderChanged (ValueTree&) override;
  62. void valueTreeParentChanged (ValueTree&) override;
  63. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceUpdater)
  64. };
  65. #endif // __JUCER_JUCEUPDATER_JUCEHEADER__