File: c2bBibParser.h

package info (click to toggle)
cb2bib 1.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,368 kB
  • sloc: cpp: 24,179; sh: 481; makefile: 16
file content (89 lines) | stat: -rw-r--r-- 2,234 bytes parent folder | download
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
89
/***************************************************************************
 *   Copyright (C) 2004-2015 by Pere Constans
 *   constans@molspaces.com
 *   cb2Bib version 1.9.2. Licensed under the GNU GPL version 3.
 *   See the LICENSE file that comes with this distribution.
 ***************************************************************************/
#ifndef C2BBIBPARSER_H
#define C2BBIBPARSER_H

#include "c2bLineEdit.h"
#include "c2bBibPreparserLog.h"

#include <bibParser.h>
#include <journalDB.h>

#include <QPointer>


class QComboBox;

/**
    cb2Bib interface to bibParser

    This class groups Bib Parser functionality related to GUI

    @author Pere Constans
*/
class c2bBibParser : public bibParser
{

    Q_OBJECT

public:
    explicit c2bBibParser(QObject* parento = 0);
    ~c2bBibParser();

    void clearCurrentReference();
    void setWidgetMapping();

    inline void addField(const QString& name, c2bLineEdit* editor)
    {
        _field_editors.insert(name, editor);
    }
    inline void addTypes(QComboBox* types)
    {
        _type_editor = types;
    }
    inline QString field(const QString& name) const
    {
        return _field_editors.value(name)->text();
    }
    inline void setField(const QString& name, const QString& value)
    {
        _field_editors[name]->setText(parse(name, value));
    }
    inline void setField(const QString& name, const QString& value, const QString& init_value)
    {
        if (name == "addauthors")
            _field_editors["author"]->setText(parse(name, value, init_value));
        else if (name == "addeditors")
            _field_editors["editor"]->setText(parse(name, value, init_value));
    }


signals:
    void bibModified(bool modified);
    void setDocumentFilename();


private:
    QComboBox* _type_editor;
    QHash<QString, c2bLineEdit*> _field_editors;
    QPointer<c2bBibPreparserLog> _preparser_logP;
    QWidget* _c2b_mainP;
    bool _bp_updates_gui;
    void checkRegExpFile(const QString& fn);
    void currentReferenceUpdated();
    void setCiteID();
    void setReferenceType(const QString& type);


private slots:
    void referenceEdited(const QString& value);
    void setField();
    void showLog(const QString& log);

};

#endif