"Fossies" - the Fresh Open Source Software Archive

Member "cb2bib-2.0.1/src/c2b.h" (12 Feb 2021, 2973 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 "c2b.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 C2B_H
    8 #define C2B_H
    9 
   10 #include "c2bBibParser.h"
   11 #include "c2bNetworkQueryInfo.h"
   12 
   13 #include <metadataParser.h>
   14 #include <network.h>
   15 
   16 #include <QObject>
   17 
   18 
   19 class c2bClipboard;
   20 
   21 class QProgressDialog;
   22 class QWidget;
   23 
   24 
   25 class c2b : public QObject
   26 {
   27 
   28     Q_OBJECT
   29 
   30 public:
   31     explicit c2b(QWidget* main, QObject* parento = 0);
   32     ~c2b();
   33 
   34     // Actions
   35     static inline const QString documentMetadata(const QString& fn)
   36     {
   37         return metaParser()->metadata(fn);
   38     }
   39 
   40     static inline const QString encodeLink(const QString& ln)
   41     {
   42         return netqinf()->encodeLink(ln);
   43     }
   44 
   45     static inline void showMessage(const QString& message)
   46     {
   47         instance()->emitMessage(message);
   48     }
   49 
   50     static inline void doSearchInFiles(const QString& string, const QString& fn)
   51     {
   52         instance()->emitSearchInFiles(string, fn);
   53     }
   54 
   55     // Pointers
   56     static inline c2b* instance()
   57     {
   58         Q_ASSERT_X(_c2b_single_instance, "c2b", "cb2Bib resources were not instantiated");
   59         return _c2b_single_instance;
   60     }
   61 
   62     static inline QWidget* mainWidget()
   63     {
   64         return instance()->_c2b_main;
   65     }
   66 
   67     static inline c2bClipboard* clipboard()
   68     {
   69         return instance()->_c2b_clipboard;
   70     }
   71 
   72     static inline network* net()
   73     {
   74         return instance()->_c2b_network;
   75     }
   76 
   77     static inline c2bNetworkQueryInfo* netqinf()
   78     {
   79         return instance()->_c2b_netqinf;
   80     }
   81 
   82     static inline c2bBibParser* bibParser()
   83     {
   84         return instance()->_c2b_bibparser;
   85     }
   86 
   87     static inline metadataParser* metaParser()
   88     {
   89         return instance()->_c2b_metadataparser;
   90     }
   91 
   92 
   93 public slots:
   94     static void configure(int index = -1);
   95     void exitRequested();
   96 
   97 
   98 signals:
   99     void searchInFiles(const QString& string, const QString& fn);
  100     void statusMessage(const QString& message);
  101 
  102 
  103 private:
  104     QProgressDialog* _download_progress;
  105     QWidget* _c2b_main;
  106     c2bBibParser* _c2b_bibparser;
  107     c2bClipboard* _c2b_clipboard;
  108     c2bNetworkQueryInfo* _c2b_netqinf;
  109     metadataParser* _c2b_metadataparser;
  110     network* _c2b_network;
  111     static c2b* _c2b_single_instance;
  112 
  113     inline void emitMessage(const QString& message)
  114     {
  115         emit statusMessage(message);
  116     }
  117 
  118     inline void emitSearchInFiles(const QString& string, const QString& fn)
  119     {
  120         emit searchInFiles(string, fn);
  121     }
  122 
  123 
  124 private slots:
  125     void proxyAuthenticationRequired(const QNetworkProxy& proxy, QAuthenticator* auth);
  126     void showMessage(const QString& title, const QString& ms);
  127     void updateDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
  128 };
  129 
  130 #endif