forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_update.h
69 lines (51 loc) · 1.39 KB
/
check_update.h
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifndef APP_CHECK_UPDATE_H_INCLUDED
#define APP_CHECK_UPDATE_H_INCLUDED
#pragma once
#ifdef ENABLE_UPDATER
#include "base/thread.h"
#include "ui/timer.h"
#include "updater/check_update.h"
#include <atomic>
#include <memory>
namespace app {
class CheckUpdateDelegate;
class CheckUpdateBackgroundJob;
class Preferences;
class CheckUpdateThreadLauncher {
public:
CheckUpdateThreadLauncher(CheckUpdateDelegate* delegate);
~CheckUpdateThreadLauncher();
void launch();
bool isReceived() const;
const updater::CheckUpdateResponse& getResponse() const
{
return m_response;
}
private:
void onMonitoringTick();
void checkForUpdates();
void showUI();
CheckUpdateDelegate* m_delegate;
Preferences& m_preferences;
updater::Uuid m_uuid;
std::unique_ptr<base::thread> m_thread;
std::unique_ptr<CheckUpdateBackgroundJob> m_bgJob;
bool m_doCheck;
std::atomic<bool> m_received;
// Mini-stats
int m_inits;
int m_exits;
// True if this is a developer
bool m_isDeveloper;
updater::CheckUpdateResponse m_response;
ui::Timer m_timer;
};
} // namespace app
#endif // ENABLE_UPDATER
#endif // APP_CHECK_UPDATE_H_INCLUDED