Skip to content
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

Merged
merged 2 commits into from Mar 28, 2018
Merged

Implement Updater UI #6546

merged 2 commits into from Mar 28, 2018

Conversation

spycrab
Copy link
Contributor

@spycrab spycrab commented Mar 27, 2018

Updater

@MayImilae
Copy link
Contributor

Screenshots please!


namespace UI
{
void Loop();

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

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.

@@ -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.

@@ -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.

#include "Updater/UI.h"

// Enable visual styles
#pragma comment(linker, "\"/manifestdependency:type='win32' \

This comment was marked as off-topic.

void SetProgress(int current, int total);
void IncrementProgress(int amount);

extern HWND label_handle;

This comment was marked as off-topic.

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.

@spycrab spycrab force-pushed the updater_ui branch 2 times, most recently from e2aeda9 to 98fe5a8 Compare March 27, 2018 23:38
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.

Copy link
Member

@delroth delroth left a 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.

Manifest::Filename filename;
Manifest::Hash hash;
};

This comment was marked as off-topic.

download.filename = entry.first;
download.hash = entry.second;

todo.to_download.push_back(download);

This comment was marked as off-topic.

@@ -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.

@@ -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.

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.


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.

@@ -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.

}

HttpRequest::Impl::Impl(std::chrono::milliseconds timeout_ms,
HttpRequest::ProgressCallback callback)

This comment was marked as off-topic.

Copy link
Member

@delroth delroth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last nit :)

@@ -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.

@BhaaLseN
Copy link
Member

BhaaLseN commented Mar 28, 2018

No Cancel button? :P
(You can obviously ignore that)

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.

@spycrab spycrab force-pushed the updater_ui branch 3 times, most recently from df3516e to 2b814b2 Compare March 28, 2018 15:54
@leoetlino leoetlino merged commit 03a6a9b into dolphin-emu:master Mar 28, 2018
@spycrab spycrab deleted the updater_ui branch March 28, 2018 18:07
@GlydetheSurfer
Copy link

cool.. now its got a self-updater. that's convenient :)

@GlydetheSurfer
Copy link

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?

@delroth
Copy link
Member

delroth commented Apr 9, 2018

How are you "launching the updater"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
8 participants