Some doxygen documentation improvements.
[dcpomatic.git] / src / lib / config.h
1 /*
2     Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 /** @file src/config.h
21  *  @brief Class holding configuration.
22  */
23
24 #ifndef DVDOMATIC_CONFIG_H
25 #define DVDOMATIC_CONFIG_H
26
27 #include <vector>
28 #include <boost/shared_ptr.hpp>
29 #include <sigc++/signal.h>
30
31 class ServerDescription;
32 class Screen;
33 class Scaler;
34 class Filter;
35 class SoundProcessor;
36
37 /** @class Config
38  *  @brief A singleton class holding configuration.
39  */
40 class Config
41 {
42 public:
43
44         /** @return number of threads to use for J2K encoding on the local machine */
45         int num_local_encoding_threads () const {
46                 return _num_local_encoding_threads;
47         }
48
49         /** @return port to use for J2K encoding servers */
50         int server_port () const {
51                 return _server_port;
52         }
53
54         /** @return index of colour LUT to use when converting RGB to XYZ.
55          *  0: sRGB
56          *  1: Rec 709
57          */
58         int colour_lut_index () const {
59                 return _colour_lut_index;
60         }
61
62         /** @return bandwidth for J2K files in bits per second */
63         int j2k_bandwidth () const {
64                 return _j2k_bandwidth;
65         }
66
67         /** @return J2K encoding servers to use */
68         std::vector<ServerDescription*> servers () const {
69                 return _servers;
70         }
71
72         std::vector<boost::shared_ptr<Screen> > screens () const {
73                 return _screens;
74         }
75
76         Scaler const * reference_scaler () const {
77                 return _reference_scaler;
78         }
79
80         std::vector<Filter const *> reference_filters () const {
81                 return _reference_filters;
82         }
83
84         /** @return The IP address of a TMS that we can copy DCPs to */
85         std::string tms_ip () const {
86                 return _tms_ip;
87         }
88
89         /** @return The path on a TMS that we should write DCPs to */
90         std::string tms_path () const {
91                 return _tms_path;
92         }
93
94         /** @return User name to log into the TMS with */
95         std::string tms_user () const {
96                 return _tms_user;
97         }
98
99         /** @return Password to log into the TMS with */
100         std::string tms_password () const {
101                 return _tms_password;
102         }
103
104         SoundProcessor const * sound_processor () const {
105                 return _sound_processor;
106         }
107
108         /** @param n New number of local encoding threads */
109         void set_num_local_encoding_threads (int n) {
110                 _num_local_encoding_threads = n;
111                 Changed ();
112         }
113
114         /** @param p New server port */
115         void set_server_port (int p) {
116                 _server_port = p;
117                 Changed ();
118         }
119
120         /** @param i New colour LUT index */
121         void set_colour_lut_index (int i) {
122                 _colour_lut_index = i;
123                 Changed ();
124         }
125
126         /** @param b New J2K bandwidth */
127         void set_j2k_bandwidth (int b) {
128                 _j2k_bandwidth = b;
129                 Changed ();
130         }
131
132         /** @param s New list of servers */
133         void set_servers (std::vector<ServerDescription*> s) {
134                 _servers = s;
135                 Changed ();
136         }
137
138         void set_screens (std::vector<boost::shared_ptr<Screen> > s) {
139                 _screens = s;
140                 Changed ();
141         }
142
143         void set_reference_scaler (Scaler const * s) {
144                 _reference_scaler = s;
145                 Changed ();
146         }
147         
148         void set_reference_filters (std::vector<Filter const *> const & f) {
149                 _reference_filters = f;
150                 Changed ();
151         }
152
153         /** @param i IP address of a TMS that we can copy DCPs to */
154         void set_tms_ip (std::string i) {
155                 _tms_ip = i;
156                 Changed ();
157         }
158
159         /** @param p Path on a TMS that we should write DCPs to */
160         void set_tms_path (std::string p) {
161                 _tms_path = p;
162                 Changed ();
163         }
164
165         /** @param u User name to log into the TMS with */
166         void set_tms_user (std::string u) {
167                 _tms_user = u;
168                 Changed ();
169         }
170
171         /** @param p Password to log into the TMS with */
172         void set_tms_password (std::string p) {
173                 _tms_password = p;
174                 Changed ();
175         }
176         
177         void write () const;
178
179         sigc::signal0<void> Changed;
180
181         static Config* instance ();
182
183 private:
184         Config ();
185         std::string file () const;
186
187         /** number of threads to use for J2K encoding on the local machine */
188         int _num_local_encoding_threads;
189         /** port to use for J2K encoding servers */
190         int _server_port;
191         /** index of colour LUT to use when converting RGB to XYZ
192          *  (see colour_lut_index ())
193          */
194         int _colour_lut_index;
195         /** bandwidth for J2K files in bits per second */
196         int _j2k_bandwidth;
197
198         /** J2K encoding servers to use */
199         std::vector<ServerDescription *> _servers;
200         /** Screen definitions */
201         std::vector<boost::shared_ptr<Screen> > _screens;
202         /** Scaler to use for the "A" part of A/B comparisons */
203         Scaler const * _reference_scaler;
204         /** Filters to use for the "A" part of A/B comparisons */
205         std::vector<Filter const *> _reference_filters;
206         /** The IP address of a TMS that we can copy DCPs to */
207         std::string _tms_ip;
208         /** The path on a TMS that we should write DCPs to */
209         std::string _tms_path;
210         /** User name to log into the TMS with */
211         std::string _tms_user;
212         /** Password to log into the TMS with */
213         std::string _tms_password;
214         /** Our sound processor */
215         SoundProcessor const * _sound_processor;
216
217         /** Singleton instance, or 0 */
218         static Config* _instance;
219 };
220
221 #endif