1 /*
2     Copyright (C) 2013 Andrew Caudwell (acaudwell@gmail.com)
3 
4     This program is free software; you can redistribute it and/or
5     modify it under the terms of the GNU General Public License
6     as published by the Free Software Foundation; either version
7     3 of the License, or (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, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef LOGSTALGIA_SETTINGS_H
19 #define LOGSTALGIA_SETTINGS_H
20 
21 #define LOGSTALGIA_VERSION "1.1.2"
22 
23 #include "core/settings.h"
24 
25 #define PADDLE_NONE   0
26 #define PADDLE_SINGLE 1
27 #define PADDLE_PID    2
28 #define PADDLE_VHOST  3
29 
30 class SummarizerGroup {
31 public:
32     SummarizerGroup();
33 
34     std::string title;
35     std::string type;
36     std::string regex;
37     std::string separators;
38     int max_depth;
39     int abbrev_depth;
40     int percent;
41     vec3 colour;
42 
43     std::string definition;
44 
45     static bool parse(const std::string& group_string, SummarizerGroup& group, std::string& error);
46 };
47 
48 class LogstalgiaSettings : public SDLAppSettings {
49 protected:
50     void commandLineOption(const std::string& name, const std::string& value);
51 public:
52     int log_level;
53     bool ffp;
54 
55     std::string path;
56     std::vector<SummarizerGroup> groups;
57 
58     std::string load_config;
59     std::string save_config;
60 
61     std::vector<std::string> display_fields;
62     bool display_log_entry;
63 
64     bool detect_changes;
65     bool run_tests;
66 
67     time_t start_time;
68     time_t stop_time;
69 
70     float splash;
71 
72     float simulation_speed;
73     float pitch_speed;
74     float update_rate;
75 
76     int   paddle_mode;
77     float paddle_position;
78 
79     float start_position;
80     float stop_position;
81 
82     bool sync;
83 
84     bool hide_response_code;
85     bool hide_url_prefix;
86     bool hide_paddle;
87     bool hide_paddle_tokens;
88 
89     bool no_bounce;
90 
91     bool disable_auto_skip;
92     bool disable_progress;
93     bool disable_glow;
94 
95     bool mask_hostnames;
96 
97     vec3 background_colour;
98 
99     float glow_intensity;
100     float glow_multiplier;
101     float glow_duration;
102 
103     int address_max_depth;
104     int address_abbr_depth;
105     std::string address_separators;
106 
107     int path_max_depth;
108     int path_abbr_depth;
109     std::string path_separators;
110 
111     int font_size;
112 
113     std::string title;
114 
115     LogstalgiaSettings();
116 
117     void setLogstalgiaDefaults();
118 
119     void importLogstalgiaSettings(ConfFile& conf, ConfSection* settings = 0);
120     void exportLogstalgiaSettings(ConfFile& conf);
121 
122     void help(bool extended_help=false);
123 };
124 
125 extern LogstalgiaSettings settings;
126 
127 #endif
128