~ubuntu-branches/ubuntu/precise/kbibtex/precise

« back to all changes in this revision

Viewing changes to src/idsuggestionswidget.h

  • Committer: Package Import Robot
  • Author(s): Michael Hanke
  • Date: 2011-07-18 09:29:48 UTC
  • mfrom: (1.1.6) (2.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20110718092948-ksxjmg7kdfamolmg
Tags: 0.3-1
* First upstream release for KDE4 (Closes: #634255). A number of search
  engines are still missing, in comparison to the 0.2 series.
* Bumped Standards-Version to 3.9.2, no changes necessary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright (C) 2004-2009 by Thomas Fischer                             *
3
 
 *   fischer@unix-ag.uni-kl.de                                             *
4
 
 *                                                                         *
5
 
 *   This program is free software; you can redistribute it and/or modify  *
6
 
 *   it under the terms of the GNU General Public License as published by  *
7
 
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 
 *   (at your option) any later version.                                   *
9
 
 *                                                                         *
10
 
 *   This program is distributed in the hope that it will be useful,       *
11
 
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13
 
 *   GNU General Public License for more details.                          *
14
 
 *                                                                         *
15
 
 *   You should have received a copy of the GNU General Public License     *
16
 
 *   along with this program; if not, write to the                         *
17
 
 *   Free Software Foundation, Inc.,                                       *
18
 
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 
 ***************************************************************************/
20
 
#ifndef KBIBTEXIDSUGGESTIONSWIDGET_H
21
 
#define KBIBTEXIDSUGGESTIONSWIDGET_H
22
 
 
23
 
#include <qwidget.h>
24
 
#include <qdialog.h>
25
 
 
26
 
class QCheckBox;
27
 
class QScrollView;
28
 
class QSpinBox;
29
 
class KComboBox;
30
 
class KLineEdit;
31
 
class KPushButton;
32
 
 
33
 
namespace KBibTeX
34
 
{
35
 
    class IdSuggestionComponent: public QFrame
36
 
    {
37
 
        Q_OBJECT
38
 
    public:
39
 
        IdSuggestionComponent( const QString& title, QWidget *parent );
40
 
        virtual QString text() const = 0;
41
 
        void setEnableUpDown( bool enableUp, bool enableDown );
42
 
 
43
 
    signals:
44
 
        void modified();
45
 
        void moved();
46
 
        void deleted();
47
 
 
48
 
    protected:
49
 
        QWidget *moveWidgets( QWidget *parent );
50
 
 
51
 
        bool m_toBeDeleted;
52
 
        QString m_title;
53
 
        QWidget *m_parent;
54
 
        KPushButton *m_pushButtonDel;
55
 
        KPushButton *m_pushButtonUp;
56
 
        KPushButton *m_pushButtonDown;
57
 
 
58
 
    protected slots:
59
 
        void slotUp();
60
 
        void slotDown();
61
 
        void slotDelete();
62
 
    };
63
 
 
64
 
    class IdSuggestionComponentAuthor: public IdSuggestionComponent
65
 
    {
66
 
    public:
67
 
        IdSuggestionComponentAuthor( const QString &text, QWidget *parent );
68
 
        QString text() const;
69
 
    protected:
70
 
        KComboBox *m_comboBoxWhichAuthors;
71
 
        KComboBox *m_comboBoxCasing;
72
 
        KLineEdit *m_lineEditInBetween;
73
 
        QSpinBox *m_spinBoxLen;
74
 
    };
75
 
 
76
 
    class IdSuggestionComponentTitle: public IdSuggestionComponent
77
 
    {
78
 
    public:
79
 
        IdSuggestionComponentTitle( const QString &text, QWidget *parent );
80
 
        QString text() const;
81
 
    protected:
82
 
        QCheckBox *m_checkBoxRemoveSmallWords;
83
 
        KComboBox *m_comboBoxCasing;
84
 
        KLineEdit *m_lineEditInBetween;
85
 
        QSpinBox *m_spinBoxLen;
86
 
    };
87
 
 
88
 
    class IdSuggestionComponentYear: public IdSuggestionComponent
89
 
    {
90
 
    public:
91
 
        IdSuggestionComponentYear( const QString &text, QWidget *parent );
92
 
        QString text() const;
93
 
    protected:
94
 
        KComboBox *m_comboBoxDigits;
95
 
    };
96
 
 
97
 
    class IdSuggestionComponentText: public IdSuggestionComponent
98
 
    {
99
 
    public:
100
 
        IdSuggestionComponentText( const QString &text, QWidget *parent );
101
 
        QString text() const;
102
 
    protected:
103
 
        KLineEdit *m_lineEditInBetween;
104
 
    };
105
 
 
106
 
    class IdSuggestionsScrollView : public QScrollView
107
 
    {
108
 
        Q_OBJECT
109
 
    public:
110
 
        IdSuggestionsScrollView( QWidget *parent, const char*name = NULL );
111
 
        ~IdSuggestionsScrollView();
112
 
 
113
 
        void setMainWidget( QWidget *widget ) {m_widget = widget;}
114
 
 
115
 
    protected:
116
 
        void viewportResizeEvent( QResizeEvent * );
117
 
 
118
 
    private:
119
 
        QWidget *m_widget;
120
 
    };
121
 
 
122
 
    /**
123
 
     @author Thomas Fischer <fischer@unix-ag.uni-kl.de>
124
 
    */
125
 
    class IdSuggestionsWidget : public QWidget
126
 
    {
127
 
        Q_OBJECT
128
 
    public:
129
 
        ~IdSuggestionsWidget();
130
 
        int numComponents();
131
 
 
132
 
        static QDialog::DialogCode execute( QString &formatStr, QWidget *parent = 0, const char *name = 0 );
133
 
 
134
 
    protected:
135
 
        IdSuggestionsWidget( const QString &formatStr, KDialogBase *parent, const char *name = 0 );
136
 
 
137
 
        QString m_originalFormatStr;
138
 
        int m_componentCount;
139
 
 
140
 
        void reset( const QString& formatStr );
141
 
        void apply( QString& formatStr );
142
 
 
143
 
    private:
144
 
        static QString exampleBibTeXEntry;
145
 
        BibTeX::Entry *m_example;
146
 
        IdSuggestionsScrollView *m_scrollViewComponents;
147
 
        QLabel *m_labelExample;
148
 
        QWidget *m_listOfComponents;
149
 
        KPushButton *m_pushButtonAdd;
150
 
        KDialogBase *m_parent;
151
 
 
152
 
        void setupGUI();
153
 
 
154
 
    private slots:
155
 
        void addMenuActivated( int id );
156
 
        void updateGUI();
157
 
        void componentDeleted();
158
 
        void updateExample();
159
 
    };
160
 
 
161
 
}
162
 
 
163
 
#endif