summaryrefslogtreecommitdiff
path: root/Source/Core/UICommon/AutoUpdate.h
blob: 7c75100433f57d7bb9920043d3c13b85fd0121d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2018 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.

#pragma once

#include <string>

// This class defines all the logic for Dolphin auto-update checking. UI-specific elements have to
// be defined in a backend specific subclass.
class AutoUpdateChecker
{
public:
  // Initiates a check for updates in the background. Calls the OnUpdateAvailable callback if an
  // update is available, does "nothing" otherwise.
  void CheckForUpdate();

  static bool SystemSupportsAutoUpdates();

  struct NewVersionInformation
  {
    // Name (5.0-1234) and revision hash of the new version.
    std::string new_shortrev;
    std::string new_hash;

    // The full changelog in HTML format.
    std::string changelog_html;

    // Internals, to be passed to the updater binary.
    std::string this_manifest_url;
    std::string next_manifest_url;
    std::string content_store_url;
  };

  // Starts the updater process, which will wait in the background until the current process exits.
  enum class RestartMode
  {
    NO_RESTART_AFTER_UPDATE = 0,
    RESTART_AFTER_UPDATE,
  };
  void TriggerUpdate(const NewVersionInformation& info, RestartMode restart_mode);

protected:
  virtual void OnUpdateAvailable(const NewVersionInformation& info) = 0;
};