~vcs-imports/bibletime/trunk

« back to all changes in this revision

Viewing changes to bibletime/frontend/btinstallmgr.h

  • Committer: mgruner
  • Date: 2007-05-08 15:51:07 UTC
  • Revision ID: vcs-imports@canonical.com-20070508155107-0rj7jdmm5ivf8685
-imported source and data files to new svn module
-this is where KDE4-based development will take place

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*********
 
2
*
 
3
* This file is part of BibleTime's source code, http://www.bibletime.info/.
 
4
*
 
5
* Copyright 1999-2006 by the BibleTime developers.
 
6
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
 
7
*
 
8
**********/
 
9
 
 
10
 
 
11
 
 
12
#ifndef BTINSTALLMGR_H
 
13
#define BTINSTALLMGR_H
 
14
 
 
15
 
 
16
//BibleTIme includes
 
17
#include "backend/cswordbackend.h"
 
18
 
 
19
 
 
20
//sword includes
 
21
#include <installmgr.h>
 
22
#include <ftptrans.h>
 
23
 
 
24
//Qt includes
 
25
#include <qobject.h>
 
26
#include <qptrlist.h>
 
27
#include <qstring.h>
 
28
#include <qstringlist.h>
 
29
 
 
30
namespace BookshelfManager {
 
31
 
 
32
        typedef QPtrList<sword::InstallSource> InstallSourceList;
 
33
 
 
34
        /**Our own reimplementation to provide status bar updates.
 
35
          *@author The BibleTime team
 
36
          */
 
37
class BTInstallMgr : public QObject, public sword::InstallMgr, public sword::StatusReporter {
 
38
                Q_OBJECT
 
39
public:
 
40
                class Tool {
 
41
public:
 
42
                        class LocalConfig {
 
43
public:
 
44
                                static const QString swordConfigFilename();
 
45
                                static QStringList targetList();
 
46
                                static void setTargetList( const QStringList& );
 
47
private:
 
48
                                LocalConfig() {}
 
49
                                ;
 
50
                        };
 
51
 
 
52
                        class RemoteConfig {
 
53
public:
 
54
                                static void initConfig();
 
55
                                static const QString configPath();
 
56
                                static const QString configFilename();
 
57
 
 
58
                                static void resetRemoteSources();
 
59
                                static void resetLocalSources();
 
60
 
 
61
                                static QStringList sourceList( sword::InstallMgr* );
 
62
                                static sword::InstallSource source( sword::InstallMgr*, const QString& name );
 
63
                                static const bool isRemoteSource( sword::InstallSource* is );
 
64
                                static void addSource( sword::InstallSource* );
 
65
                                static void removeSource( sword::InstallMgr*, sword::InstallSource* );
 
66
 
 
67
 
 
68
private:
 
69
                                RemoteConfig() {}
 
70
                                ;
 
71
                        };
 
72
 
 
73
                        static CSwordBackend* backend( sword::InstallSource* const );
 
74
 
 
75
private:
 
76
                        Tool() {}
 
77
                        ;
 
78
                };
 
79
 
 
80
                BTInstallMgr();
 
81
                virtual ~BTInstallMgr();
 
82
 
 
83
protected:
 
84
                /* Reimplementations of method in StatusReporter */
 
85
                virtual void statusUpdate(double dltotal, double dlnow);
 
86
                virtual void preStatus(long totalBytes, long completedBytes, const char *message);
 
87
 
 
88
                virtual FTPTransport *createFTPTransport(const char *host, StatusReporter *statusReporter);
 
89
 
 
90
                long m_totalBytes;
 
91
                long m_completedBytes;
 
92
 
 
93
signals: // Signals
 
94
                void completed( const int, const int );
 
95
                /**
 
96
                * Emitted when a new file gets downloaded.
 
97
                */
 
98
                void downloadStarted( const QString& );
 
99
        };
 
100
 
 
101
}
 
102
 
 
103
#endif