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

« back to all changes in this revision

Viewing changes to src/mergeelements.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 KBIBTEXMERGEELEMENTS_H
21
 
#define KBIBTEXMERGEELEMENTS_H
22
 
 
23
 
#include <kdialogbase.h>
24
 
 
25
 
#include <findduplicates.h>
26
 
#include <file.h>
27
 
#include <entry.h>
28
 
 
29
 
class KPushButton;
30
 
class KTextEdit;
31
 
class KListView;
32
 
class QProgressBar;
33
 
 
34
 
namespace KBibTeX
35
 
{
36
 
    class MergeElementsCliqueItem : public QObject, public QCheckListItem
37
 
    {
38
 
        Q_OBJECT
39
 
    public:
40
 
        MergeElementsCliqueItem( BibTeX::Entry* entry, BibTeX::Macro* macro, BibTeX::Preamble* preamble, QListView *parent );
41
 
        BibTeX::Entry* entry;
42
 
        BibTeX::Macro* macro;
43
 
        BibTeX::Preamble* preamble;
44
 
 
45
 
    protected:
46
 
        void stateChange( bool );
47
 
 
48
 
    signals:
49
 
        void stateChanged( MergeElementsCliqueItem* );
50
 
    };
51
 
 
52
 
    class MergeEntriesAlternativesController: public QCheckListItem
53
 
    {
54
 
    public:
55
 
        MergeEntriesAlternativesController( const QString &label, QListView *parent );
56
 
        MergeEntriesAlternativesController( BibTeX::EntryField::FieldType fieldType, QListView *parent );
57
 
        BibTeX::EntryField::FieldType fieldType;
58
 
        const QString fieldName;
59
 
    };
60
 
 
61
 
    class MergeMacrosAlternativesController: public QCheckListItem
62
 
    {
63
 
    public:
64
 
        MergeMacrosAlternativesController( bool isKey, QListView *parent );
65
 
    };
66
 
 
67
 
 
68
 
    class MergeEntriesAlternativesItem: public QCheckListItem
69
 
    {
70
 
    public:
71
 
        MergeEntriesAlternativesItem( BibTeX::EntryField *field, MergeEntriesAlternativesController *parent );
72
 
        BibTeX::EntryField *field;
73
 
    };
74
 
 
75
 
    class MergeMacrosAlternativesItem: public QCheckListItem
76
 
    {
77
 
    public:
78
 
        MergeMacrosAlternativesItem( BibTeX::Value *value, MergeMacrosAlternativesController *parent );
79
 
        BibTeX::Value *value;
80
 
    };
81
 
 
82
 
    class MergeElementsAlternativesId: public QCheckListItem
83
 
    {
84
 
    public:
85
 
        MergeElementsAlternativesId( const QString &id, MergeEntriesAlternativesController *parent );
86
 
        QString id;
87
 
    };
88
 
 
89
 
    class MergeMacroAlternativesKey: public QCheckListItem
90
 
    {
91
 
    public:
92
 
        MergeMacroAlternativesKey( const QString &key, MergeMacrosAlternativesController *parent );
93
 
        QString key;
94
 
    };
95
 
 
96
 
 
97
 
    class MergeEntriesAlternativesEntryType: public QCheckListItem
98
 
    {
99
 
    public:
100
 
        MergeEntriesAlternativesEntryType( const QString &typeString, MergeEntriesAlternativesController *parent );
101
 
        MergeEntriesAlternativesEntryType( BibTeX::Entry::EntryType type, MergeEntriesAlternativesController *parent );
102
 
        QString typeString;
103
 
        BibTeX::Entry::EntryType type;
104
 
    };
105
 
 
106
 
    class MergePreambleAlternativesController: public QCheckListItem
107
 
    {
108
 
    public:
109
 
        MergePreambleAlternativesController( QListView *parent );
110
 
    };
111
 
 
112
 
    class MergePreambleAlternatives: public QCheckListItem
113
 
    {
114
 
    public:
115
 
        MergePreambleAlternatives( const QString &text, MergePreambleAlternativesController *parent );
116
 
        QString text;
117
 
    };
118
 
 
119
 
    /**
120
 
     @author Thomas Fischer <fischer@unix-ag.uni-kl.de>
121
 
    */
122
 
    class MergeElements : public KDialogBase
123
 
    {
124
 
        Q_OBJECT
125
 
    public:
126
 
        MergeElements( QWidget *parent );
127
 
        ~MergeElements();
128
 
        int mergeDuplicates( BibTeX::File *bibTeXFile );
129
 
 
130
 
    protected:
131
 
        void showEvent( QShowEvent * );
132
 
 
133
 
    protected slots:
134
 
        void slotRefreshAlternatives();
135
 
        void slotNextClique();
136
 
        void slotPreviousClique();
137
 
        void slotPreviewElement( QListViewItem *item );
138
 
        void saveCurrentMergeSet();
139
 
        void slotRestore();
140
 
 
141
 
    private:
142
 
        typedef struct
143
 
        {
144
 
            BibTeX::Macro *macro;
145
 
            BibTeX::Entry *entry;
146
 
            BibTeX::EntryField *field;
147
 
        } First;
148
 
 
149
 
        typedef struct
150
 
        {
151
 
            QValueList<BibTeX::Macro*> macros;
152
 
            QValueList<BibTeX::Entry*> entries;
153
 
            QValueList<BibTeX::EntryField*> fields;
154
 
            QValueList<BibTeX::Preamble*> preambles;
155
 
            QString macroKey;
156
 
            BibTeX::Value *macroValue;
157
 
            QString id, typeString;
158
 
            BibTeX::Entry::EntryType type;
159
 
            QString preambleText;
160
 
        } MergeSet;
161
 
 
162
 
        KListView *m_listViewClique;
163
 
        KListView *m_listViewAlternatives;
164
 
        QProgressBar *m_progressBar;
165
 
        FindDuplicates::DuplicateCliqueList m_duplicateCliqueList;
166
 
        MergeSet **m_mergeSetList;
167
 
        int m_currentCliqueIndex;
168
 
 
169
 
        void setupGUI();
170
 
        void setClique( int cliqueIndex );
171
 
        void restoreCurrentMergeSet();
172
 
        void applyMergeSet( BibTeX::File *bibTeXFile, BibTeX::File *otherBibTeXFile = NULL );
173
 
        void restoreWindowSize( KConfig *config );
174
 
        void saveWindowSize( KConfig *config ) const;
175
 
    };
176
 
 
177
 
}
178
 
 
179
 
#endif // KBIBTEXMERGEELEMENTS_H