BibleTime
btinstallmgr.h
Go to the documentation of this file.
1 /*********
2 *
3 * In the name of the Father, and of the Son, and of the Holy Spirit.
4 *
5 * This file is part of BibleTime's source code, https://bibletime.info/
6 *
7 * Copyright 1999-2021 by the BibleTime developers.
8 * The BibleTime source code is licensed under the GNU General Public License
9 * version 2.0.
10 *
11 **********/
12 
13 #pragma once
14 
15 #include <QObject>
16 
17 #include <QString>
18 
19 // Sword includes:
20 #pragma GCC diagnostic push
21 #pragma GCC diagnostic ignored "-Wextra-semi"
22 #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
23 #include <installmgr.h>
24 #include <remotetrans.h>
25 #pragma GCC diagnostic pop
26 
27 
28 /**
29 * Our own reimplementation to provide installation and status bar updates.
30 */
32  : public QObject
33  , public sword::InstallMgr
34  , private sword::StatusReporter
35 {
36 
37  Q_OBJECT
38 
39 public: // methods:
40 
41  BtInstallMgr(QObject * parent = nullptr);
42  ~BtInstallMgr() override;
43 
44  bool isUserDisclaimerConfirmed() const override;
45 
46 Q_SIGNALS:
47 
48  /**
49  Download status. Percent of total and file.
50  \warning Use these values for display only, since they might be incorrect.
51  */
52  void percentCompleted(const int total, const int file);
53 
55 
56 protected: // methods:
57 
58  /** \note Reimplementation of sword::StatusReporter::statusUpdate(). */
59  void statusUpdate(double dltotal, double dlnow) override;
60 
61  /**
62  * \note Reimplementation of sword::StatusReporter::preStatus().
63  * \warning This method is not always called before statusUpdate().
64  * Called before starting to download each file of the module package.
65  * The sword message is not i18n'ed, it's in the form "Downloading (1 of 6): nt.bzs".
66  * This function is not utilized in the UI ATM.
67  */
68  void preStatus(long totalBytes,
69  long completedBytes,
70  const char * message) override;
71 
72 private: // fields:
73 
77 
78 };
long m_totalBytes
Definition: btinstallmgr.h:74
void percentCompleted(const int total, const int file)
BtInstallMgr(QObject *parent=nullptr)
bool m_firstCallOfPreStatus
Definition: btinstallmgr.h:76
void statusUpdate(double dltotal, double dlnow) override
void downloadStarted()
bool isUserDisclaimerConfirmed() const override
~BtInstallMgr() override
long m_completedBytes
Definition: btinstallmgr.h:75
void preStatus(long totalBytes, long completedBytes, const char *message) override