1 /* UserPrefValues.cpp
2 *
3 * Copyright (C) 2021 by RStudio, PBC
4 *
5 * Unless you have received this program directly from RStudio pursuant
6 * to the terms of a commercial license agreement with RStudio, then
7 * this program is licensed to you under the terms of version 3 of the
8 * GNU Affero General Public License. This program is distributed WITHOUT
9 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
11 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
12 *
13 */
14
15 /* DO NOT HAND-EDIT! This file is automatically generated from the formal user preference schema
16 * JSON. To add a preference, add it to "user-prefs-schema.json", then run "generate-prefs.R" to
17 * rebuild this file.
18 */
19
20 #include <session/prefs/UserStateValues.hpp>
21
22 namespace rstudio {
23 namespace session {
24 namespace prefs {
25
26 /**
27 * A unique identifier representing the user and machine.
28 */
contextId()29 std::string UserStateValues::contextId()
30 {
31 return readPref<std::string>("context_id");
32 }
33
setContextId(std::string val)34 core::Error UserStateValues::setContextId(std::string val)
35 {
36 return writePref("context_id", val);
37 }
38
39 /**
40 * Whether we have automatically created an .Rprofile for this user.
41 */
autoCreatedProfile()42 bool UserStateValues::autoCreatedProfile()
43 {
44 return readPref<bool>("auto_created_profile");
45 }
46
setAutoCreatedProfile(bool val)47 core::Error UserStateValues::setAutoCreatedProfile(bool val)
48 {
49 return writePref("auto_created_profile", val);
50 }
51
52 /**
53 * The color theme to apply.
54 */
theme()55 core::json::Object UserStateValues::theme()
56 {
57 return readPref<core::json::Object>("theme");
58 }
59
setTheme(core::json::Object val)60 core::Error UserStateValues::setTheme(core::json::Object val)
61 {
62 return writePref("theme", val);
63 }
64
65 /**
66 * The directory path under which to place new projects by default. Shadows a uipref.
67 */
defaultProjectLocation()68 std::string UserStateValues::defaultProjectLocation()
69 {
70 return readPref<std::string>("default_project_location");
71 }
72
setDefaultProjectLocation(std::string val)73 core::Error UserStateValues::setDefaultProjectLocation(std::string val)
74 {
75 return writePref("default_project_location", val);
76 }
77
78 /**
79 * Whether to clear hidden objects along with visible objects when clearing the workspace. Set automatically to remember last action.
80 */
clearHidden()81 bool UserStateValues::clearHidden()
82 {
83 return readPref<bool>("clear_hidden");
84 }
85
setClearHidden(bool val)86 core::Error UserStateValues::setClearHidden(bool val)
87 {
88 return writePref("clear_hidden", val);
89 }
90
91 /**
92 * The most recently used plot export options.
93 */
exportPlotOptions()94 core::json::Object UserStateValues::exportPlotOptions()
95 {
96 return readPref<core::json::Object>("export_plot_options");
97 }
98
setExportPlotOptions(core::json::Object val)99 core::Error UserStateValues::setExportPlotOptions(core::json::Object val)
100 {
101 return writePref("export_plot_options", val);
102 }
103
104 /**
105 * The most recently used viewer export options.
106 */
exportViewerOptions()107 core::json::Object UserStateValues::exportViewerOptions()
108 {
109 return readPref<core::json::Object>("export_viewer_options");
110 }
111
setExportViewerOptions(core::json::Object val)112 core::Error UserStateValues::setExportViewerOptions(core::json::Object val)
113 {
114 return writePref("export_viewer_options", val);
115 }
116
117 /**
118 * The most recently used options for saving a plot as a PDF.
119 */
savePlotAsPdfOptions()120 core::json::Object UserStateValues::savePlotAsPdfOptions()
121 {
122 return readPref<core::json::Object>("save_plot_as_pdf_options");
123 }
124
setSavePlotAsPdfOptions(core::json::Object val)125 core::Error UserStateValues::setSavePlotAsPdfOptions(core::json::Object val)
126 {
127 return writePref("save_plot_as_pdf_options", val);
128 }
129
130 /**
131 * Most recently used settings for compiling a notebook from an R script.
132 */
compileRNotebookPrefs()133 core::json::Object UserStateValues::compileRNotebookPrefs()
134 {
135 return readPref<core::json::Object>("compile_r_notebook_prefs");
136 }
137
setCompileRNotebookPrefs(core::json::Object val)138 core::Error UserStateValues::setCompileRNotebookPrefs(core::json::Object val)
139 {
140 return writePref("compile_r_notebook_prefs", val);
141 }
142
143 /**
144 * Most recently used settings for compiling a notebook using R Markdown.
145 */
compileRMarkdownNotebookPrefs()146 core::json::Object UserStateValues::compileRMarkdownNotebookPrefs()
147 {
148 return readPref<core::json::Object>("compile_r_markdown_notebook_prefs");
149 }
150
setCompileRMarkdownNotebookPrefs(core::json::Object val)151 core::Error UserStateValues::setCompileRMarkdownNotebookPrefs(core::json::Object val)
152 {
153 return writePref("compile_r_markdown_notebook_prefs", val);
154 }
155
156 /**
157 * Whether to show UI for publishing content.
158 */
showPublishUi()159 bool UserStateValues::showPublishUi()
160 {
161 return readPref<bool>("show_publish_ui");
162 }
163
setShowPublishUi(bool val)164 core::Error UserStateValues::setShowPublishUi(bool val)
165 {
166 return writePref("show_publish_ui", val);
167 }
168
169 /**
170 * Whether to show UI for publishing content to RStudio Connect.
171 */
enableRsconnectPublishUi()172 bool UserStateValues::enableRsconnectPublishUi()
173 {
174 return readPref<bool>("enable_rsconnect_publish_ui");
175 }
176
setEnableRsconnectPublishUi(bool val)177 core::Error UserStateValues::setEnableRsconnectPublishUi(bool val)
178 {
179 return writePref("enable_rsconnect_publish_ui", val);
180 }
181
182 /**
183 * The default (last) account used for publishing
184 */
publishAccount()185 core::json::Object UserStateValues::publishAccount()
186 {
187 return readPref<core::json::Object>("publish_account");
188 }
189
setPublishAccount(core::json::Object val)190 core::Error UserStateValues::setPublishAccount(core::json::Object val)
191 {
192 return writePref("publish_account", val);
193 }
194
195 /**
196 * The preferred width, in pixels, of the document outline pane.
197 */
documentOutlineWidth()198 int UserStateValues::documentOutlineWidth()
199 {
200 return readPref<int>("document_outline_width");
201 }
202
setDocumentOutlineWidth(int val)203 core::Error UserStateValues::setDocumentOutlineWidth(int val)
204 {
205 return writePref("document_outline_width", val);
206 }
207
208 /**
209 * How to create new connections to data sources.
210 */
connectVia()211 std::string UserStateValues::connectVia()
212 {
213 return readPref<std::string>("connect_via");
214 }
215
setConnectVia(std::string val)216 core::Error UserStateValues::setConnectVia(std::string val)
217 {
218 return writePref("connect_via", val);
219 }
220
221 /**
222 * The kind of handler to invoke when errors occur.
223 */
errorHandlerType()224 std::string UserStateValues::errorHandlerType()
225 {
226 return readPref<std::string>("error_handler_type");
227 }
228
setErrorHandlerType(std::string val)229 core::Error UserStateValues::setErrorHandlerType(std::string val)
230 {
231 return writePref("error_handler_type", val);
232 }
233
234 /**
235 * Whether or not the MinGW compiler with GCC 4.9 is used.
236 */
usingMingwGcc49()237 bool UserStateValues::usingMingwGcc49()
238 {
239 return readPref<bool>("using_mingw_gcc49");
240 }
241
setUsingMingwGcc49(bool val)242 core::Error UserStateValues::setUsingMingwGcc49(bool val)
243 {
244 return writePref("using_mingw_gcc49", val);
245 }
246
247 /**
248 * Whether or not the use of Visual Mode has been confirmed.
249 */
visualModeConfirmed()250 bool UserStateValues::visualModeConfirmed()
251 {
252 return readPref<bool>("visual_mode_confirmed");
253 }
254
setVisualModeConfirmed(bool val)255 core::Error UserStateValues::setVisualModeConfirmed(bool val)
256 {
257 return writePref("visual_mode_confirmed", val);
258 }
259
260 /**
261 * The default type for new bibliographies.
262 */
bibliographyDefaultType()263 std::string UserStateValues::bibliographyDefaultType()
264 {
265 return readPref<std::string>("bibliography_default_type");
266 }
267
setBibliographyDefaultType(std::string val)268 core::Error UserStateValues::setBibliographyDefaultType(std::string val)
269 {
270 return writePref("bibliography_default_type", val);
271 }
272
273 /**
274 * The default style for inserting citations.
275 */
citationDefaultInText()276 bool UserStateValues::citationDefaultInText()
277 {
278 return readPref<bool>("citation_default_in_text");
279 }
280
setCitationDefaultInText(bool val)281 core::Error UserStateValues::setCitationDefaultInText(bool val)
282 {
283 return writePref("citation_default_in_text", val);
284 }
285
286 /**
287 * Zotero connection type (local or web)
288 */
zoteroConnectionType()289 std::string UserStateValues::zoteroConnectionType()
290 {
291 return readPref<std::string>("zotero_connection_type");
292 }
293
setZoteroConnectionType(std::string val)294 core::Error UserStateValues::setZoteroConnectionType(std::string val)
295 {
296 return writePref("zotero_connection_type", val);
297 }
298
299 /**
300 * Whether to use Better BibTeX when suggesting citation keys and writing citations to BibTeX bibliographies
301 */
zoteroUseBetterBibtex()302 bool UserStateValues::zoteroUseBetterBibtex()
303 {
304 return readPref<bool>("zotero_use_better_bibtex");
305 }
306
setZoteroUseBetterBibtex(bool val)307 core::Error UserStateValues::setZoteroUseBetterBibtex(bool val)
308 {
309 return writePref("zotero_use_better_bibtex", val);
310 }
311
312 /**
313 * Key for making Zotero API calls
314 */
zoteroApiKey()315 std::string UserStateValues::zoteroApiKey()
316 {
317 return readPref<std::string>("zotero_api_key");
318 }
319
setZoteroApiKey(std::string val)320 core::Error UserStateValues::setZoteroApiKey(std::string val)
321 {
322 return writePref("zotero_api_key", val);
323 }
324
325 /**
326 * Directory containing Zotero data files
327 */
zoteroDataDir()328 std::string UserStateValues::zoteroDataDir()
329 {
330 return readPref<std::string>("zotero_data_dir");
331 }
332
setZoteroDataDir(std::string val)333 core::Error UserStateValues::setZoteroDataDir(std::string val)
334 {
335 return writePref("zotero_data_dir", val);
336 }
337
allKeys()338 std::vector<std::string> UserStateValues::allKeys()
339 {
340 return std::vector<std::string>({
341 kContextId,
342 kAutoCreatedProfile,
343 kTheme,
344 kDefaultProjectLocation,
345 kClearHidden,
346 kExportPlotOptions,
347 kExportViewerOptions,
348 kSavePlotAsPdfOptions,
349 kCompileRNotebookPrefs,
350 kCompileRMarkdownNotebookPrefs,
351 kShowPublishUi,
352 kEnableRsconnectPublishUi,
353 kPublishAccount,
354 kDocumentOutlineWidth,
355 kConnectVia,
356 kErrorHandlerType,
357 kUsingMingwGcc49,
358 kVisualModeConfirmed,
359 kBibliographyDefaultType,
360 kCitationDefaultInText,
361 kZoteroConnectionType,
362 kZoteroUseBetterBibtex,
363 kZoteroApiKey,
364 kZoteroDataDir,
365 });
366 }
367
368
369 }
370 }
371 }
372