cb2bib  2.0.1
About: cb2Bib is a multiplatform application for rapidly extracting unformatted, or unstandardized bibliographic references from email alerts, journal Web pages, and PDF files.
  Fossies Dox: cb2bib-2.0.1.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

c2bBibParser.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004-2021 by Pere Constans
3  * constans@molspaces.com
4  * cb2Bib version 2.0.1. Licensed under the GNU GPL version 3.
5  * See the LICENSE file that comes with this distribution.
6  ***************************************************************************/
7 #ifndef C2BBIBPARSER_H
8 #define C2BBIBPARSER_H
9 
10 #include "c2bBibPreparserLog.h"
11 #include "c2bLineEdit.h"
12 
13 #include <bibParser.h>
14 #include <journalDB.h>
15 
16 #include <QPointer>
17 
18 
19 class QComboBox;
20 
21 /**
22  cb2Bib interface to bibParser
23 
24  This class groups Bib Parser functionality related to GUI
25 
26  @author Pere Constans
27 */
28 class c2bBibParser : public bibParser
29 {
30 
31  Q_OBJECT
32 
33 public:
34  explicit c2bBibParser(QObject* parento = 0);
35  ~c2bBibParser();
36 
37  void clearCurrentReference();
38  void setWidgetMapping();
39 
40  inline void addField(const QString& name, c2bLineEdit* editor)
41  {
42  _field_editors.insert(name, editor);
43  }
44  inline void addTypes(QComboBox* types)
45  {
46  _type_editor = types;
47  }
48  inline QString field(const QString& name) const
49  {
50  return _field_editors.value(name)->text();
51  }
52  inline void setField(const QString& name, const QString& value) override
53  {
54  _field_editors[name]->setText(parse(name, value));
55  }
56  inline void setField(const QString& name, const QString& value, const QString& init_value)
57  {
58  if (name == "addauthors")
59  _field_editors["author"]->setText(parse(name, value, init_value));
60  else if (name == "addeditors")
61  _field_editors["editor"]->setText(parse(name, value, init_value));
62  }
63 
64 
65 signals:
66  void bibModified(bool modified);
68 
69 
70 private:
71  QComboBox* _type_editor;
72  QHash<QString, c2bLineEdit*> _field_editors;
73  QPointer<c2bBibPreparserLog> _preparser_logP;
74  QWidget* _c2b_mainP;
76  void checkRegExpFile(const QString& fn) override;
77  void currentReferenceUpdated() override;
78  void setCiteID() override;
79  void setReferenceType(const QString& type) override;
80 
81 
82 private slots:
83  void referenceEdited(const QString& value);
84  void setField();
85  void showLog(const QString& log);
86 };
87 
88 #endif
QString parse(const QString &field, const QString &value, const QString &init_value=QString())
Definition: bibParser.cpp:56
QWidget * _c2b_mainP
Definition: c2bBibParser.h:74
QPointer< c2bBibPreparserLog > _preparser_logP
Definition: c2bBibParser.h:73
void setField(const QString &name, const QString &value) override
Definition: c2bBibParser.h:52
QComboBox * _type_editor
Definition: c2bBibParser.h:71
void addField(const QString &name, c2bLineEdit *editor)
Definition: c2bBibParser.h:40
void checkRegExpFile(const QString &fn) override
void setWidgetMapping()
QString field(const QString &name) const
Definition: c2bBibParser.h:48
void currentReferenceUpdated() override
bool _bp_updates_gui
Definition: c2bBibParser.h:75
void bibModified(bool modified)
void addTypes(QComboBox *types)
Definition: c2bBibParser.h:44
c2bBibParser(QObject *parento=0)
void clearCurrentReference()
void showLog(const QString &log)
QHash< QString, c2bLineEdit * > _field_editors
Definition: c2bBibParser.h:72
void setReferenceType(const QString &type) override
void setCiteID() override
void setField(const QString &name, const QString &value, const QString &init_value)
Definition: c2bBibParser.h:56
void setDocumentFilename()
void referenceEdited(const QString &value)