~ubuntu-branches/ubuntu/trusty/bibletime/trusty

« back to all changes in this revision

Viewing changes to src/frontend/cexportmanager.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Marsden
  • Date: 2009-11-18 17:30:00 UTC
  • mfrom: (1.3.4 upstream) (5.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20091118173000-endkhjz5qai88tvr
Tags: 2.4-1
* New upstream version 2.4
* debian/control: 
  - Replace incorrect bibletime-data Depends on lib4qt-gui
    with bibletime Depends on libqtgui4 (>= 4.4.0). (Closes: #556209).
  - Add Build-depends: on zlib1g-dev and libcurl4-gnutls-dev 
    (Closes: #556805).

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
#ifndef CEXPORTMANAGER_H
11
11
#define CEXPORTMANAGER_H
12
12
 
 
13
#include "util/cpointers.h"
 
14
 
 
15
#include <QList>
 
16
#include <QString>
13
17
#include "backend/config/cbtconfig.h"
14
18
#include "backend/managers/cswordbackend.h"
15
 
#include "util/cpointers.h"
16
 
 
17
 
#include <QString>
18
 
#include <QList>
19
 
 
20
 
class ListKey;
 
19
 
 
20
 
21
21
class CSwordKey;
22
22
class CSwordModuleInfo;
 
23
class ListKey;
23
24
class QProgressDialog;
24
25
 
25
26
/** Contains the functions to export text to disk, clipboard or printer.
26
27
  * @author The BibleTime team
27
28
  */
28
29
class CExportManager : CPointers {
29
 
public:
30
 
        /** The format the export actions should have
31
 
        */
32
 
        enum Format {
33
 
                HTML,
34
 
                Text
35
 
        };
36
 
 
37
 
        CExportManager(const QString& caption, const bool showProgress = true, const QString& progressLabel = QString::null, const CSwordBackend::FilterOptions filterOptions = CBTConfig::getFilterOptionDefaults(), const CSwordBackend::DisplayOptions displayOptions = CBTConfig::getDisplayOptionDefaults());
38
 
 
39
 
        bool saveKey(CSwordKey* key, const Format format, const bool addText);
40
 
        bool saveKeyList(sword::ListKey* list, CSwordModuleInfo* module, const Format format, const bool addText);
41
 
        bool saveKeyList(QList<CSwordKey*>& list, const Format format, const bool addText );
42
 
 
43
 
        bool copyKey(CSwordKey* key, const Format format, const bool addText);
44
 
        bool copyKeyList(sword::ListKey* list, CSwordModuleInfo* module, const Format format, const bool addText);
45
 
        bool copyKeyList(QList<CSwordKey*>& list, const Format format, const bool addText );
46
 
 
47
 
        bool printKey(CSwordKey* key, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
48
 
        bool printKey( CSwordModuleInfo* module, const QString& startKey, const QString& stopKey, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions );
49
 
        bool printByHyperlink(const QString& hyperlink, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
50
 
        bool printKeyList(sword::ListKey* list, CSwordModuleInfo* module, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
51
 
        bool printKeyList(const QStringList& list,CSwordModuleInfo* module, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
52
 
 
53
 
protected: // Protected methods
54
 
        /**
55
 
        * Returns the string for the filedialogs to show the correct files.
56
 
        */
57
 
        const QString filterString( const Format format );
58
 
        /**
59
 
        * Returns a filename to save a file.
60
 
        */
61
 
        const QString getSaveFileName(const Format format);
62
 
        /**
63
 
        * Returns a string containing the linebreak for the current format.
64
 
        */
65
 
        const QString lineBreak( const Format format );
66
 
 
67
 
private:
68
 
        QString m_caption;
69
 
        QString m_progressLabel;
70
 
        bool m_showProgress;
71
 
        CSwordBackend::FilterOptions m_filterOptions;
72
 
        CSwordBackend::DisplayOptions m_displayOptions;
73
 
 
74
 
        QProgressDialog* m_progressDialog;
75
 
 
76
 
        /**
77
 
        * Creates the progress dialog with the correct settings.
78
 
        */
79
 
        QProgressDialog* progressDialog();
80
 
        /**
81
 
        * Returns the CSS string used in HTML pages.
82
 
        */
83
 
        void setProgressRange( const int item );
84
 
        /**
85
 
        * Increments the progress by one item.
86
 
        */
87
 
        inline void incProgress();
88
 
        bool progressWasCancelled();
89
 
        /**
90
 
        * Closes the progress dialog immediately.
91
 
        */
92
 
        void closeProgressDialog();
 
30
    public:
 
31
        /** The format the export actions should have
 
32
        */
 
33
        enum Format {
 
34
            HTML,
 
35
            Text
 
36
        };
 
37
 
 
38
        CExportManager(const QString& caption, const bool showProgress = true, const QString& progressLabel = QString::null, const CSwordBackend::FilterOptions filterOptions = CBTConfig::getFilterOptionDefaults(), const CSwordBackend::DisplayOptions displayOptions = CBTConfig::getDisplayOptionDefaults());
 
39
 
 
40
        bool saveKey(CSwordKey* key, const Format format, const bool addText);
 
41
        bool saveKeyList(sword::ListKey* list, CSwordModuleInfo* module, const Format format, const bool addText);
 
42
        bool saveKeyList(QList<CSwordKey*>& list, const Format format, const bool addText );
 
43
 
 
44
        bool copyKey(CSwordKey* key, const Format format, const bool addText);
 
45
        bool copyKeyList(sword::ListKey* list, CSwordModuleInfo* module, const Format format, const bool addText);
 
46
        bool copyKeyList(QList<CSwordKey*>& list, const Format format, const bool addText );
 
47
 
 
48
        bool printKey(CSwordKey* key, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
 
49
        bool printKey( CSwordModuleInfo* module, const QString& startKey, const QString& stopKey, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions );
 
50
        bool printByHyperlink(const QString& hyperlink, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
 
51
        bool printKeyList(sword::ListKey* list, CSwordModuleInfo* module, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
 
52
        bool printKeyList(const QStringList& list, CSwordModuleInfo* module, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
 
53
 
 
54
    protected: // Protected methods
 
55
        /**
 
56
        * Returns the string for the filedialogs to show the correct files.
 
57
        */
 
58
        const QString filterString( const Format format );
 
59
        /**
 
60
        * Returns a filename to save a file.
 
61
        */
 
62
        const QString getSaveFileName(const Format format);
 
63
        /**
 
64
        * Returns a string containing the linebreak for the current format.
 
65
        */
 
66
        const QString lineBreak( const Format format );
 
67
 
 
68
    private:
 
69
        QString m_caption; ///< \todo Useless field
 
70
        QString m_progressLabel;
 
71
        bool m_showProgress;
 
72
        CSwordBackend::FilterOptions m_filterOptions;
 
73
        CSwordBackend::DisplayOptions m_displayOptions;
 
74
 
 
75
        QProgressDialog* m_progressDialog;
 
76
 
 
77
        /**
 
78
        * Creates the progress dialog with the correct settings.
 
79
        */
 
80
        QProgressDialog* progressDialog();
 
81
        /**
 
82
        * Returns the CSS string used in HTML pages.
 
83
        */
 
84
        void setProgressRange( const int item );
 
85
        /**
 
86
        * Increments the progress by one item.
 
87
        */
 
88
        inline void incProgress();
 
89
        bool progressWasCancelled();
 
90
        /**
 
91
        * Closes the progress dialog immediately.
 
92
        */
 
93
        void closeProgressDialog();
93
94
};
94
95
 
95
96
#endif