summaryrefslogtreecommitdiff
path: root/src/frontend/bookshelfmanager/btinstallmgr.h
blob: 7d39440240f64a85fd6fc1fadb9285e62b4efd6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2011 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/

#ifndef NEWBTINSTALLMGR_H
#define NEWBTINSTALLMGR_H

#include <QObject>

#include <QList>
#include <QString>
#include <QStringList>

// Sword includes:
#include <installmgr.h>
#include <ftptrans.h>


/**
* Our own reimplementation to provide installation and status bar updates.
*/
class BtInstallMgr : public QObject, public sword::InstallMgr, public sword::StatusReporter {
        Q_OBJECT
    public:
        BtInstallMgr();
        ~BtInstallMgr();

        /** Re-implemented from sword::InstallMgr. */
        bool isUserDisclaimerConfirmed() const;

    signals:
        /** Download status. Percent of total and file.*/
        void percentCompleted(const int total, const int file);
        void downloadStarted();

    protected:
        /**
          Reimplementation of sword::StatusReporter::statusUpdate().
        */
        void statusUpdate(double dltotal, double dlnow);

        /**
        * Reimplementation of sword::StatusReporter::preStatus().
        * \warning This method is not always called before statusUpdate().
        * Called before starting to download each file of the module package.
        * The sword message is not i18n'ed, it's in the form "Downloading (1 of 6): nt.bzs".
        * This function is not utilized in the UI ATM.
        */
        void preStatus(long totalBytes, long completedBytes, const char *message);

    private:
        long m_totalBytes;
        long m_completedBytes;
        bool m_firstCallOfPreStatus;
};

#endif