New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Updater UI #6546
Implement Updater UI #6546
Conversation
spycrab
commented
Mar 27, 2018
•
edited
edited
Screenshots please! |
Source/Core/Updater/UI.h
Outdated
|
||
namespace UI | ||
{ | ||
void Loop(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Updater/UI.h
Outdated
void SetProgress(int current, int total); | ||
void IncrementProgress(int amount); | ||
|
||
extern HWND label_handle; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Common/HttpRequest.h
Outdated
@@ -18,7 +18,8 @@ namespace Common | |||
class HttpRequest final | |||
{ | |||
public: | |||
explicit HttpRequest(std::chrono::milliseconds timeout_ms = std::chrono::milliseconds{3000}); | |||
explicit HttpRequest(std::chrono::milliseconds timeout_ms = std::chrono::milliseconds{3000}, | |||
void* callback = nullptr); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Common/HttpRequest.h
Outdated
@@ -18,7 +18,8 @@ namespace Common | |||
class HttpRequest final | |||
{ | |||
public: | |||
explicit HttpRequest(std::chrono::milliseconds timeout_ms = std::chrono::milliseconds{3000}); | |||
explicit HttpRequest(std::chrono::milliseconds timeout_ms = std::chrono::milliseconds{3000}, | |||
void* callback = nullptr); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Updater/UI.cpp
Outdated
#include "Updater/UI.h" | ||
|
||
// Enable visual styles | ||
#pragma comment(linker, "\"/manifestdependency:type='win32' \ |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Updater/UI.h
Outdated
void SetProgress(int current, int total); | ||
void IncrementProgress(int amount); | ||
|
||
extern HWND label_handle; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Updater/Main.cpp
Outdated
Common::HttpRequest req(std::chrono::seconds(30)); | ||
UI::SetMarquee(false); | ||
auto progress_callback = [](void*, double total, double now, double, double) -> int { | ||
UI::SetProgress(now, total); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
e2aeda9
to
98fe5a8
Compare
Source/Core/Updater/Main.cpp
Outdated
for (const auto& h : to_download) | ||
{ | ||
std::string hash_filename = HexEncode(h.data(), h.size()); | ||
UI::SetDescription("Downloading " + hash_filename + "..."); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This + the callback change and LGTM.
Source/Core/Updater/Main.cpp
Outdated
Manifest::Filename filename; | ||
Manifest::Hash hash; | ||
}; | ||
|
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Updater/Main.cpp
Outdated
download.filename = entry.first; | ||
download.hash = entry.second; | ||
|
||
todo.to_download.push_back(download); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Updater/Updater.vcxproj
Outdated
@@ -38,7 +38,8 @@ | |||
<PropertyGroup /> | |||
<ItemDefinitionGroup> | |||
<Link> | |||
<AdditionalDependencies>iphlpapi.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> | |||
<AdditionalDependencies>iphlpapi.lib;winmm.lib;ws2_32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies> | |||
<AdditionalManifestDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'";%(AdditionalManifestDependencies)</AdditionalManifestDependencies> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Updater/Main.cpp
Outdated
@@ -286,6 +289,7 @@ std::optional<Manifest> ParseManifest(const std::string& manifest) | |||
return parsed; | |||
} | |||
|
|||
// Not showing a progress bar here because this part is just to quick |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Common/HttpRequest.cpp
Outdated
double ulnow, double ultotal) | ||
{ | ||
// Abort if callback isn't true | ||
return impl->m_callback(dlnow, dltotal, ulnow, ultotal) == false; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Common/HttpRequest.cpp
Outdated
|
||
bool IsValid() const; | ||
Response Fetch(const std::string& url, Method method, const Headers& headers, const u8* payload, | ||
size_t size); | ||
|
||
static int CurlProgressCallback(Impl* impl, double down, double up, double, double); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Common/HttpRequest.cpp
Outdated
@@ -69,7 +73,16 @@ HttpRequest::Response HttpRequest::Post(const std::string& url, const std::strin | |||
reinterpret_cast<const u8*>(payload.data()), payload.size()); | |||
} | |||
|
|||
HttpRequest::Impl::Impl(std::chrono::milliseconds timeout_ms) | |||
int HttpRequest::Impl::CurlProgressCallback(HttpRequest::Impl* impl, double dlnow, double dltotal, |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/Common/HttpRequest.cpp
Outdated
} | ||
|
||
HttpRequest::Impl::Impl(std::chrono::milliseconds timeout_ms, | ||
HttpRequest::ProgressCallback callback) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last nit :)
Source/Core/Common/HttpRequest.h
Outdated
@@ -18,7 +18,9 @@ namespace Common | |||
class HttpRequest final | |||
{ | |||
public: | |||
explicit HttpRequest(std::chrono::milliseconds timeout_ms = std::chrono::milliseconds{3000}); | |||
using ProgressCallback = bool (*)(double dlnow, double dltotal, double ulnow, double ultotal); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
No Cancel button? :P Any thoughts on more detailed feedback, such as "File x of y" (or at least "x/y")? |
<assemblyIdentity | ||
version="1.0.0.0" | ||
processorArchitecture="amd64" | ||
name="CompanyName.ProductName.YourApplication" |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
df3516e
to
2b814b2
Compare
cool.. now its got a self-updater. that's convenient :) |
um....i know this is an old version now.. but ive tried launching the updater with several updates.. and it never opened... what am i doing wrong? |
How are you "launching the updater"? |