KiCad PCB EDA Suite
common_settings.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
5  * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef _COMMON_SETTINGS_H
22 #define _COMMON_SETTINGS_H
23 
24 #include <settings/json_settings.h>
25 
26 
28 {
29 public:
30  struct APPEARANCE
31  {
32  double canvas_scale;
35  };
36 
37  struct AUTO_BACKUP
38  {
39  bool enabled;
44 
46  unsigned long long limit_total_size;
47  };
48 
49  struct ENVIRONMENT
50  {
52  std::map<std::string, wxString> vars;
53  };
54 
55  struct INPUT
56  {
57  bool auto_pan;
64 
68 
72 
75  };
76 
77  struct GRAPHICS
78  {
81  };
82 
83  struct SYSTEM
84  {
86  wxString editor_name;
88  wxString language;
89  wxString pdf_viewer_name;
91  wxString working_dir;
92  };
93 
95 
96  virtual ~COMMON_SETTINGS() {}
97 
98  virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
99 
100  bool Migrate() override;
101 
102 private:
103  bool migrateSchema0to1();
104 
105 public:
107 
109 
111 
113 
115 
117 
118  // TODO: These may not want to be in common
119  wxString m_3DLibsUrl;
120 
122 };
123 
124 #endif
unsigned long long limit_total_size
Maximum total size of backups (bytes), 0 for unlimited.
wxString m_3DLibsDownloadPath
bool enabled
Automatically back up the project when files are saved.
AUTO_BACKUP m_Backup
APPEARANCE m_Appearance
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
bool Migrate() override
Migrates the schema of this settings from the version in the file to the latest version.
std::map< std::string, wxString > vars
virtual ~COMMON_SETTINGS()
ENVIRONMENT m_Env
int min_interval
Minimum time, in seconds, between subsequent backups.
bool backup_on_autosave
Trigger a backup on autosave.
int limit_daily_files
Maximum files to keep per day, 0 for unlimited.
int limit_total_files
Maximum number of backup archives to retain.