Read@CVL
Settings.h
Go to the documentation of this file.
1 /*******************************************************************************************************
2  ReadFramework is the basis for modules developed at CVL/TU Wien for the EU project READ.
3 
4  Copyright (C) 2016 Markus Diem <diem@caa.tuwien.ac.at>
5  Copyright (C) 2016 Stefan Fiel <fiel@caa.tuwien.ac.at>
6  Copyright (C) 2016 Florian Kleber <kleber@caa.tuwien.ac.at>
7 
8  This file is part of ReadFramework.
9 
10  ReadFramework is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  ReadFramework is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program. If not, see <http://www.gnu.org/licenses/>.
22 
23  The READ project has received funding from the European Union’s Horizon 2020
24  research and innovation programme under grant agreement No 674943
25 
26  related links:
27  [1] http://www.caa.tuwien.ac.at/cvl/
28  [2] https://transkribus.eu/Transkribus/
29  [3] https://github.com/TUWien/
30  [4] http://nomacs.org
31  *******************************************************************************************************/
32 
33 #pragma once
34 
35 #include "BaseModule.h"
36 
37 #pragma warning(push, 0) // no warnings from includes
38 #include <QSharedPointer>
39 #include <QSettings>
40 #pragma warning(pop)
41 
42 #pragma warning (disable: 4251) // inlined Qt functions in dll interface
43 
44 #ifndef DllCoreExport
45 #ifdef DLL_CORE_EXPORT
46 #define DllCoreExport Q_DECL_EXPORT
47 #else
48 #define DllCoreExport Q_DECL_IMPORT
49 #endif
50 #endif
51 
52 // Qt defines
53 
54 namespace rdf {
55 
60 class DllCoreExport DefaultSettings : public QSettings {
61 
62 public:
64 };
65 
67 
68 public:
69  GlobalConfig();
70 
71  virtual QString toString() const override;
72 
73  QString workingDir() const;
74  QString xmlSubDir() const;
75 
76  void setNumScales(int ns);
77  int numScales() const;
78 
79 protected:
80  QString mWorkingDir = "C:/read/configs"; // defaults to your system's temp path
81  QString mXmlSubDir = "page";
82 
83  // number of scales in the scale space
84  // this value is assigned by ScaleSpaceSuperPixel
85  int mNumScales = 1;
86 
87  void load(const QSettings& settings) override;
88  void save(QSettings& settings) const override;
89 };
90 
91 // read defines
93 
94 public:
95  static Config& instance();
96  static GlobalConfig& global(); // convenience
97 
98  void load();
99  void save() const;
100 
101  bool isPortable() const;
102  void setSettingsFile(const QString& filePath);
103  QString settingsFilePath() const;
104 
105 private:
106  Config();
107  Config(const Config&);
108 
109  QString settingsPath() const;
110 
111  GlobalConfig mGlobal;
112  QString mSettingsFileName = "rdf-settings.ini";
113  QString mSettingsPath = "";
114 
115 };
116 
117 }
Definition: Settings.h:66
Definition: BaseModule.h:63
Definition: Settings.h:92
#define DllCoreExport
Definition: Settings.h:48
DllCoreExport bool save(const QImage &img, const QString &savePath, int compression=-1)
Saves the specified QImage img.
Definition: Image.cpp:180
DllCoreExport QImage load(const QString &path, bool *ok=0)
Definition: Image.cpp:152
Definition: Algorithms.cpp:45
Convenience class that instantiates QSettings with the correct file.
Definition: Settings.h:60