"Fossies" - the Fresh Open Source Software Archive

Member "cb2bib-2.0.1/src/c2bSettings.h" (12 Feb 2021, 2122 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 "c2bSettings.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 C2BSETTINGS_H
    8 #define C2BSETTINGS_H
    9 
   10 #include "c2bColors.h"
   11 
   12 #include <settings.h>
   13 
   14 #include <QFont>
   15 #include <QKeySequence>
   16 
   17 class QAction;
   18 class QProgressBar;
   19 class QShortcut;
   20 
   21 
   22 class c2bSettings : public settings
   23 {
   24 
   25     Q_OBJECT
   26 
   27 public:
   28     ~c2bSettings();
   29 
   30     QFont c2bMonoFont;
   31     c2bColors colors;
   32     void notify();
   33     void update();
   34     static c2bSettings* initSettings();
   35 
   36     void setKeysequence(const QString& fullname, QShortcut* shortcut);
   37     void setKeysequence(const QString& path, QAction* action);
   38     void setKeysequences(const QHash<QString, QKeySequence>& keysequences);
   39     inline QKeySequence keysequence(const QString& fullname) const
   40     {
   41         return value(fullname).value<QKeySequence>();
   42     }
   43     inline QKeySequence defaultKeysequence(const QString& fullname) const
   44     {
   45         return _default_keysequences.value(fullname);
   46     }
   47     inline QByteArray ksname(const QString& fullname) const
   48     {
   49         return value(fullname).value<QKeySequence>().toString(QKeySequence::NativeText).toLatin1();
   50     }
   51     inline QStringList shortcutNames() const
   52     {
   53         return _default_keysequences.keys();
   54     }
   55 
   56 
   57 signals:
   58     void newSettings();
   59 
   60 
   61 private:
   62     c2bSettings(const QString& organization, const QString& application, QObject* parento = 0);
   63     explicit c2bSettings(const QString& fn, QObject* parento = 0);
   64 
   65     QMap<QString, QKeySequence> _default_keysequences;
   66     QProgressBar* _progress_bar;
   67     void init();
   68     void processReferenceFile();
   69     void setDefaults();
   70 #ifdef Q_OS_WIN
   71     QString decodeFilename(const QString& fn) const override;
   72 #endif
   73 
   74 
   75 private slots:
   76     void guiExits();
   77     void processReferenceFileEvent();
   78 };
   79 
   80 #define c2bSettingsP (static_cast<c2bSettings*>(settings::instance()))
   81 
   82 #endif