~vcs-imports/bibletime/trunk

« back to all changes in this revision

Viewing changes to bibletime/util/ctoolclass.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
//Qt includes
 
13
#include <qstring.h>
 
14
#include <qpixmap.h>
 
15
#include <qtextstream.h>
 
16
 
 
17
 
 
18
#ifndef CTOOLCLASS_H
 
19
#define CTOOLCLASS_H
 
20
 
 
21
 
 
22
class CSwordModuleInfo;
 
23
class QLabel;
 
24
 
 
25
/**
 
26
 * Provides some useful functions which would be normally global.
 
27
 *
 
28
 * Some methods,that would be normaly global, but I hate global functions :-)
 
29
 * (the function locateHTML is from Sandy Meier (KDevelop))
 
30
 *
 
31
 * @short A class which contains static members to do small things.
 
32
 * @author Joachim Ansorg <info@bibletime.info>
 
33
 */
 
34
class CToolClass {
 
35
public:
 
36
        /**
 
37
         * @return The path of the HTML file "filename". This function searches only in $KDEDIR.
 
38
         * @author Sandy Meier of the KDevelop team.
 
39
         */
 
40
        static QString locatehtml(const QString &filename);
 
41
        /**
 
42
         * Converts HTML text to plain text.
 
43
         * This function converts some HTML tags in text (e.g. <BR> to \n)
 
44
         * @return The text withput HTML tags and with converted <BR> to \n
 
45
         * @author Joachim Ansorg  
 
46
         */
 
47
        static QString htmlToText(const QString&);
 
48
        /**
 
49
        * Converts text to HTML converting some text commands into HTML tags (e.g. \n to <BR>)
 
50
        * @return The HTML formatted text we got after changing \n to <BR>
 
51
        * @author Joachim Ansorg
 
52
        */
 
53
        static QString textToHTML(const QString&);
 
54
        /**
 
55
        * Creates the file filename and put the text of parameter "text" into the file.
 
56
        * @return True if saving was sucessful, otherwise false
 
57
        * @author Joachim Ansorg
 
58
        */
 
59
        static bool savePlainFile( const QString& filename, const QString& text, const bool& forceOverwrite = false, const QTextStream::Encoding& fileEncoding = QTextStream::Locale);
 
60
        /**
 
61
        * Returns the icon used for the module given as aparameter.
 
62
        */
 
63
        static QPixmap getIconForModule( CSwordModuleInfo* );
 
64
        /** Returns a label to explain difficult things of dialogs.
 
65
        * This function returns a label with heading "heading" and explanation "text". This label should be used to
 
66
        * explain difficult things of the GUI, e.g. in the optionsdialog.
 
67
        */
 
68
        static QLabel* explanationLabel(QWidget* parent, const QString& heading, const QString& text );
 
69
        /**
 
70
        * Returns true if the character at position "pos" of text is inside an HTML tag. Returns false if it's not inside an HTML tag.
 
71
        */
 
72
        static bool inHTMLTag(int pos, QString & text);
 
73
        /** Return the module's tooltip text
 
74
        * @param module The module required for the toolip
 
75
        * @return The tooltip text for the passed module
 
76
        */
 
77
        static QString moduleToolTip(CSwordModuleInfo* module);
 
78
};
 
79
 
 
80
#endif