LibreOffice Module onlineupdate (master) 1
progressui_gonk.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: sw=2 ts=8 et :
3 */
4/* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
6 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7
8#include <assert.h>
9#include <stdio.h>
10
11#include <string>
12
13#include "android/log.h"
14
15#include "progressui.h"
16
17#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoUpdater" , ## args)
18
19int InitProgressUI(int *argc, char ***argv)
20{
21 return 0;
22}
23
25{
26 LOG("Starting to apply update ...\n");
27 return 0;
28}
29
31{
32 LOG("Finished applying update\n");
33}
34
35void UpdateProgressUI(float progress)
36{
37 assert(0.0f <= progress && progress <= 100.0f);
38
39 static const size_t kProgressBarLength = 50;
40 static size_t sLastNumBars;
41 size_t numBars = size_t(float(kProgressBarLength) * progress / 100.0f);
42 if (numBars == sLastNumBars)
43 {
44 return;
45 }
46 sLastNumBars = numBars;
47
48 size_t numSpaces = kProgressBarLength - numBars;
49 std::string bars(numBars, '=');
50 std::string spaces(numSpaces, ' ');
51 LOG("Progress [ %s%s ]\n", bars.c_str(), spaces.c_str());
52}
int InitProgressUI(int *argc, char ***argv)
int ShowProgressUI()
void QuitProgressUI()
#define LOG(args...)
void UpdateProgressUI(float progress)