summaryrefslogtreecommitdiff
path: root/src/frontend/searchdialog/crangechooserdialog.h
blob: 8711eab3239f14aa40cdd22cd61afd6ce0319cbd (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
76
77
78
79
80
81
82
83
84
85
86
87
88
/*********
*
* 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 CRANGECHOOSERDIALOG_H
#define CRANGECHOOSERDIALOG_H

#include <QDialog>
#include <QListWidgetItem>

class QListWidget;
class QLineEdit;
class QTextEdit;
class QPushButton;
class QDialogButtonBox;


namespace Search {

class CRangeChooserDialog : public QDialog {
        Q_OBJECT
    public:
        CRangeChooserDialog(QWidget* parentDialog);
        ~CRangeChooserDialog() {};

    protected: // Protected methods
        class RangeItem : public QListWidgetItem {
            public:
                RangeItem(QListWidget*, QListWidgetItem* afterThis = 0, const QString caption = QString::null, const QString range = QString::null);
                ~RangeItem();
                const QString& range() const;
                QString caption() const;
                void setRange(QString range);
                void setCaption(const QString);
            private:
                QString m_range;
        };

        /**
        * Initializes the connections of this widget.
        */
        void initConnections();
        /**
        * Initializes the view of this object.
        */
        void initView();

    protected slots: // Protected slots
        /**
        * Adds a new range to the list.
        */
        void addNewRange();
        void editRange(QListWidgetItem*);
        /**
        * Parses the entered text and prints out the result in the list box below the edit area.
        */
        void parseRange();
        void nameChanged(const QString&);
        void rangeChanged();
        /**
        * Deletes the selected range.
        */
        void deleteCurrentRange();
        virtual void slotDefault();
        virtual void slotOk();

    private:
        QListWidget* m_rangeList;
        QListWidget* m_resultList;
        QLineEdit* m_nameEdit;
        QTextEdit* m_rangeEdit;
        QPushButton* m_newRangeButton;
        QPushButton* m_deleteRangeButton;
        QDialogButtonBox* m_buttonBox;
};


} //end of namespace Search


#endif