summaryrefslogtreecommitdiff
path: root/src/frontend/bookshelfmanager/btinstallmgr.h
blob: 56079811620594adc38e029137d212b02e35fcff (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
63
64
65
66
67
68
69
70
71
72
73
74
75
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2008 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

//sword includes
#include <installmgr.h>
#include <ftptrans.h>

//Qt includes
#include <QObject>
#include <QList>
#include <QString>
#include <QStringList>

class CSwordBackend;


typedef QList<sword::InstallSource*> InstallSourceList;

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

	BtInstallMgr();
	virtual ~BtInstallMgr();

	/**
	* Refreshing the source should be cancellable (othewise it might freeze the app if there is
	* for example something wrong with the network).
	*/
	void slotRefreshCanceled();

#ifdef SWORD_INTERNET_WARNING
	/** Re-implemented from sword::InstallMgr. */
	virtual bool isUserDisclaimerConfirmed() const;
#endif

protected:
	/* Reimplementations of methods in StatusReporter */
	/**
	* Gets the total and current file status, emits the signal with those values as percents.
	*/
	virtual void statusUpdate(double dltotal, double dlnow);
	/**
	* 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.
	*/
	virtual void preStatus(long totalBytes, long completedBytes, const char *message);

	long m_totalBytes;
	long m_completedBytes;

private:
	bool m_firstCallOfPreStatus;

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


#endif