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

« back to all changes in this revision

Viewing changes to src/frontend/searchdialog/cmoduleresultview.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:
7
7
*
8
8
**********/
9
9
 
10
 
 
11
 
 
12
10
#ifndef CMODULERESULTSVIEW_H
13
11
#define CMODULERESULTSVIEW_H
14
12
 
15
 
//BibleTime includes
16
 
#include "btsearchresultarea.h"
 
13
#include <QTreeWidget>
17
14
 
18
 
//Qt includes
19
15
#include <QLabel>
20
 
#include <QTreeWidget>
21
 
 
22
 
 
23
 
//forward declarations
 
16
#include "frontend/searchdialog/btsearchresultarea.h"
 
17
 
 
18
 
24
19
class CSwordModuleInfo;
25
 
 
 
20
class QAction;
 
21
class QContextMenuEvent;
 
22
class QMenu;
26
23
class QPoint;
27
 
class QMenu;
28
 
class QAction;
29
24
class QStringList;
30
 
class QContextMenuEvent;
31
 
 
32
25
class StrongsResultClass;
33
26
 
34
 
 
35
27
namespace Search {
36
28
 
37
 
 
38
29
class CModuleResultView : public QTreeWidget {
39
 
        Q_OBJECT
40
 
public:
41
 
        CModuleResultView(QWidget* parent);
42
 
        ~CModuleResultView();
43
 
        
44
 
        /**
45
 
        * Setups the tree using the given list of modules.
46
 
        */
47
 
        void setupTree( QList<CSwordModuleInfo*> modules, const QString& searchedText );
48
 
        /**
49
 
        * Returns the currently active module.
50
 
        */
51
 
        CSwordModuleInfo* activeModule();
52
 
 
53
 
        virtual QSize sizeHint() {return m_size;}
54
 
 
55
 
protected:
56
 
        /**
57
 
        * Initializes this widget.
58
 
        */
59
 
        void initView();
60
 
        /**
61
 
        * Initializes the connections of this widget
62
 
        */
63
 
        void initConnections();
64
 
 
65
 
 
66
 
   void setupStrongsResults(CSwordModuleInfo* module, QTreeWidgetItem* parent, const QString& searchedText);
67
 
 
68
 
protected slots:
69
 
        /**
70
 
        * Is executed when an item was selected in the list.
71
 
        */
72
 
        void executed(QTreeWidgetItem*, QTreeWidgetItem*);
73
 
        /**
74
 
        * Copies the whole search result with the text into the clipboard.
75
 
        */
76
 
        void copyResultWithText();
77
 
        /**
78
 
        * Copies the whole search result into the clipboard.
79
 
        */
80
 
        void copyResult();
81
 
        /**
82
 
        * This event handler (reimplemented from QWidget) opens the popup menu at the given position.
83
 
        */
84
 
        void contextMenuEvent( QContextMenuEvent * event );
85
 
        /**
86
 
        * Appends the whole search result to the printer queue.
87
 
        */
88
 
        void printResult();
89
 
        /**
90
 
        * Saves the search result with it's text.
91
 
        */
92
 
        void saveResultWithText();
93
 
        /**
94
 
        * Saves the search result keys.
95
 
        */
96
 
        void saveResult();
97
 
 
98
 
signals:
99
 
        void moduleSelected(CSwordModuleInfo*);
100
 
        void moduleChanged();
101
 
        void strongsSelected(CSwordModuleInfo*, QStringList*);
102
 
 
103
 
private:
104
 
        struct {
105
 
                QMenu* saveMenu;
106
 
                struct {
107
 
                        QAction* result;
108
 
                        QAction* resultWithText;
109
 
                }
110
 
                save;
111
 
 
112
 
                QMenu* printMenu;
113
 
                struct {
114
 
                        QAction* result;
115
 
                }
116
 
                print;
117
 
 
118
 
                QMenu* copyMenu;
119
 
                struct {
120
 
                        QAction* result;
121
 
                        QAction* resultWithText;
122
 
                }
123
 
                copy;
124
 
 
125
 
        } m_actions;
126
 
        
127
 
        QMenu* m_popup;
128
 
        
129
 
        StrongsResultClass* strongsResults;
130
 
        QSize m_size;
 
30
        Q_OBJECT
 
31
    public:
 
32
        CModuleResultView(QWidget* parent);
 
33
        ~CModuleResultView();
 
34
 
 
35
        /**
 
36
        * Setups the tree using the given list of modules.
 
37
        */
 
38
        void setupTree( QList<CSwordModuleInfo*> modules, const QString& searchedText );
 
39
        /**
 
40
        * Returns the currently active module.
 
41
        */
 
42
        CSwordModuleInfo* activeModule();
 
43
 
 
44
        virtual QSize sizeHint() {
 
45
            return m_size;
 
46
        }
 
47
 
 
48
    protected:
 
49
        /**
 
50
        * Initializes this widget.
 
51
        */
 
52
        void initView();
 
53
        /**
 
54
        * Initializes the connections of this widget
 
55
        */
 
56
        void initConnections();
 
57
 
 
58
 
 
59
        void setupStrongsResults(CSwordModuleInfo* module, QTreeWidgetItem* parent, const QString& searchedText);
 
60
 
 
61
    protected slots:
 
62
        /**
 
63
        * Is executed when an item was selected in the list.
 
64
        */
 
65
        void executed(QTreeWidgetItem*, QTreeWidgetItem*);
 
66
        /**
 
67
        * Copies the whole search result with the text into the clipboard.
 
68
        */
 
69
        void copyResultWithText();
 
70
        /**
 
71
        * Copies the whole search result into the clipboard.
 
72
        */
 
73
        void copyResult();
 
74
        /**
 
75
        * This event handler (reimplemented from QWidget) opens the popup menu at the given position.
 
76
        */
 
77
        void contextMenuEvent( QContextMenuEvent * event );
 
78
        /**
 
79
        * Appends the whole search result to the printer queue.
 
80
        */
 
81
        void printResult();
 
82
        /**
 
83
        * Saves the search result with it's text.
 
84
        */
 
85
        void saveResultWithText();
 
86
        /**
 
87
        * Saves the search result keys.
 
88
        */
 
89
        void saveResult();
 
90
 
 
91
    signals:
 
92
        void moduleSelected(CSwordModuleInfo*);
 
93
        void moduleChanged();
 
94
        void strongsSelected(CSwordModuleInfo*, QStringList*);
 
95
 
 
96
    private:
 
97
        struct {
 
98
            QMenu* saveMenu;
 
99
            struct {
 
100
                QAction* result;
 
101
                QAction* resultWithText;
 
102
            }
 
103
            save;
 
104
 
 
105
            QMenu* printMenu;
 
106
            struct {
 
107
                QAction* result;
 
108
            }
 
109
            print;
 
110
 
 
111
            QMenu* copyMenu;
 
112
            struct {
 
113
                QAction* result;
 
114
                QAction* resultWithText;
 
115
            }
 
116
            copy;
 
117
 
 
118
        } m_actions;
 
119
 
 
120
        QMenu* m_popup;
 
121
 
 
122
        QHash<CSwordModuleInfo*, StrongsResultClass*> strongsResults;
 
123
        QSize m_size;
131
124
};
132
125
 
133
126