-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathappsettings.h
97 lines (71 loc) · 2.76 KB
/
appsettings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* This file is part of gsshvnc.
*
* gsshvnc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* gsshvnc is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gsshvnc. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _APPSETTINGS_H
#define _APPSETTINGS_H
#include <tuple>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <glibmm/ustring.h>
#define GSSHVNC_VERSION_STR "0.96"
namespace Glib
{
class KeyFile;
}
class AppSettings
{
public:
AppSettings();
~AppSettings();
std::vector<Glib::ustring> get_recent_hosts() const;
void add_recent_host(const Glib::ustring &host);
std::vector<Glib::ustring> get_recent_ssh_hosts() const;
void add_recent_ssh_host(const Glib::ustring &host);
std::vector<Glib::ustring> get_recent_ssh_users() const;
void add_recent_ssh_user(const Glib::ustring &user);
bool get_enable_tunnel() const;
void set_enable_tunnel(bool enable);
bool get_lossy_compression() const;
void set_lossy_compression(bool enable);
Glib::ustring get_color_depth() const;
void set_color_depth(const Glib::ustring &value);
bool get_capture_keyboard() const;
void set_capture_keyboard(bool enable);
bool get_scaled_display() const;
void set_scaled_display(bool enable);
bool get_smooth_scaling() const;
void set_smooth_scaling(bool enable);
bool get_keep_aspect_ratio() const;
void set_keep_aspect_ratio(bool enable);
bool get_allow_resize() const;
void set_allow_resize(bool enable);
bool get_save_ssh_password() const;
void set_save_ssh_password(bool save);
bool get_save_vnc_credentials() const;
void set_save_vnc_credentials(bool save);
std::tuple<int, int> get_window_size() const;
void set_window_size(int w, int h);
private:
std::unordered_map<std::string, Glib::ustring> m_values;
std::unordered_set<std::string> m_modified_keys;
void read_setting(Glib::KeyFile &conf_file, const Glib::ustring &group_name,
const Glib::ustring &key, const Glib::ustring &default_value = "");
std::vector<Glib::ustring> get_string_list(const std::string &key) const;
bool get_bool(const std::string &key) const;
void add_cycle_string_list(const std::string &key, const Glib::ustring &value);
void set_bool(const std::string &key, bool value);
};
#endif