"Fossies" - the Fresh Open Source Software Archive

Member "cb2bib-2.0.1/src/c2bBibParser.h" (12 Feb 2021, 2278 Bytes) of package /linux/privat/cb2bib-2.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "c2bBibParser.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.0.0_vs_2.0.1.

    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);
   67     void setDocumentFilename();
   68 
   69 
   70 private:
   71     QComboBox* _type_editor;
   72     QHash<QString, c2bLineEdit*> _field_editors;
   73     QPointer<c2bBibPreparserLog> _preparser_logP;
   74     QWidget* _c2b_mainP;
   75     bool _bp_updates_gui;
   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