API Documentation
Loading...
Searching...
No Matches
UpdateChecker.h
Go to the documentation of this file.
1/**--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Widgets
28File: UpdateChecker
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/ItemDownloader.h>
34#include <NDEVR/File.h>
35#include <NDEVR/String.h>
36#include <NDEVR/Time.h>
37#include <NDEVR/TimeSpan.h>
38#include <NDEVR/INIFactory.h>
39#include <QObject>
40namespace NDEVR
41{
42 class NDEVR_WIDGETS_API UpdateChecker : public QObject
43 {
44 Q_OBJECT
45 public:
47 {
48 e_need_to_check
49 , e_no_new_updates
50 , e_update_available_to_download
51 , e_update_available_to_install
52 , e_could_not_connect
53 };
55 UpdateChecker(String update_version);
56 virtual void requestCheckForUpdate(const String& current_version = "") = 0;
57 virtual bool requstDownloadUpdate();
58 virtual bool requestInstallUpdate(bool wait_for_completion = false);
59 virtual bool updateSupported() const;
60 virtual String updateName() const { return m_update_file_name; };
61 virtual String updateVersion() const { return m_update_version; };
62 virtual String updateURLPage() const = 0;
63 virtual String updateURLDownload() const { return m_update_url; };
64 virtual bool updateRequiresApplicationClose() const;
65 UpdateStatus updateStatus() const;
66 void setUpdateStatus(UpdateStatus status);
67 virtual INIFactory getINI();
68 virtual void createUpdateFile(const String& installer_url, File output_location);
69 virtual void processUpdateString(const String& s);
70 Time lastUpdateCheckTime() const;
71 uint08 currentDownloadSize() const;
72 uint08 totalDownloadSize() const;
73 fltp08 downloadPercent() const;
74 File updateFile() const;
75 void showUpdateDialogIfNeeded();
76 void appStartupCheck();
77 void setMaxNoUpdateTime(const TimeSpan& max_no_update_check_time);
78 virtual String defaultURLPathName() const;
79 public:
80 static void setApplicationUpdateChecker(UpdateChecker* checker);
81 static UpdateChecker* ApplicationUpdateChecker();
82 static Time CompileTime();
83 signals:
85 void updateDownloadCompletedSignal(const File& location);
88 protected slots:
89 void onUpdateDownloadCompleteSlot();
90 void checkForUpdateCompleteSlot();
91 protected:
92 virtual void _onCheckForUpdateComplete(){};
93 protected:
102 private:
103 void init();
104 UpdateStatus m_status = UpdateStatus::e_need_to_check;
105 protected:
107 };
108}
109
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:81
Definition File.h:47
Definition INIReader.h:57
Definition ItemDownloader.h:104
Definition String.h:40
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Definition TimeSpan.h:40
Definition UpdateChecker.h:43
virtual String updateVersion() const
Definition UpdateChecker.h:61
UpdateStatus
Definition UpdateChecker.h:47
String m_update_file_name
Definition UpdateChecker.h:99
ItemDownloader * m_downloader
Definition UpdateChecker.h:95
Time m_last_application_update_check
Definition UpdateChecker.h:100
virtual String updateURLDownload() const
Definition UpdateChecker.h:63
virtual void requestCheckForUpdate(const String &current_version="")=0
File m_download_location
Definition UpdateChecker.h:94
void updateDownloadCompletedSignal(const File &location)
void checkForUpdateCompletedSignal(UpdateStatus update)
static UpdateChecker * s_app_update_checker
Definition UpdateChecker.h:106
String m_update_version
Definition UpdateChecker.h:96
virtual String updateName() const
Definition UpdateChecker.h:60
String m_current_version
Definition UpdateChecker.h:98
TimeSpan m_max_no_update_time
Definition UpdateChecker.h:101
String m_update_url
Definition UpdateChecker.h:97
virtual String updateURLPage() const =0
virtual void _onCheckForUpdateComplete()
Definition UpdateChecker.h:92
Definition ACIColor.h:37
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer -Can represent exact integer values 0 thro...
Definition BaseValues.hpp:132
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181