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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
|
/************************************************************************
**
** Copyright (C) 2016-2024 Kevin B. Hendricks, Stratford, ON
** Copyright (C) 2016-2024 Doug Massay
** Copyright (C) 2011-2013 John Schember <john@nachtimwald.com>
** Copyright (C) 2012-2013 Dave Heiland
**
** This file is part of PageEdit.
**
** PageEdit 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 3 of the License, or
** (at your option) any later version.
**
** PageEdit 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 PageEdit. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#pragma once
#ifndef SETTINGSSTORE_H
#define SETTINGSSTORE_H
#include <QSettings>
#include <QString>
#include <utility>
/**
* Provides access for reading and writing user configurable
* settings. This should be used instead of QSettings because it
* sets up the settings to use INI format on all platforms except
* OS X. Also, it implements a variety of settings that are used in
* a large number of places throughout the application.
*/
class SettingsStore : public QSettings
{
Q_OBJECT
public:
SettingsStore();
SettingsStore(QString filename);
/**
* The langauge to use for the user interface
*
* @return The language as a string.
*/
QString uiLanguage();
QString uiDictionary();
QString uiFont();
QString originalUIFont();
bool disableGPU();
int previewDark();
int printPreviewDPI();
int printDPI();
// bool spellCheck();
bool uiUseCustomDarkTheme();
/**
* The zoom factor used by the component.
*
* @return The zoom factor.
*/
float zoomImage();
float zoomText();
float zoomWeb();
float zoomPreview();
float zoomInspector();
/**
* All appearance settings related to PageEdit.
*/
struct WebViewAppearance {
QString font_family_standard;
QString font_family_serif;
QString font_family_sans_serif;
int font_size;
};
/**
* All appearance settings related to Special Characters.
*/
struct SpecialCharacterAppearance {
QString font_family;
int font_size;
};
int appearancePrefsTabIndex();
/**
* The appearance settings to use for the WebView.
*/
WebViewAppearance webViewAppearance();
/**
* The appearance settings to use for Special Characters.
*/
SpecialCharacterAppearance specialCharacterAppearance();
/**
* The icon size to use for the main menu.
*/
double mainMenuIconSize();
void clearAppearanceSettings();
int javascriptOn();
int remoteOn();
int usePrettify();
int useWSPreWrap();
bool skipPrintWarnings();
bool skipPrintPreview();
public slots:
/**
* Set the language to use for the user interface
*
* @param lang The language to set.
*/
void setUILanguage(const QString &language_code);
void setUIDictionary(const QString &dictionary_name);
void setUIFont(const QString &font_data);
void setOriginalUIFont(const QString &font_data);
void setDisableGPU(bool value);
void setPreviewDark(int enabled);
void setPrintPreviewDPI(int dpi);
void setPrintDPI(int dpi);
// void setSpellCheck(bool enabled);
void setUiUseCustomDarkTheme(bool enable);
/**
* Set the zoom factor used by the component.
*
* @param zoom The zoom factor.
*/
void setZoomImage(float zoom);
void setZoomText(float zoom);
void setZoomWeb(float zoom);
void setZoomPreview(float zoom);
void setZoomInspector(float zoom);
void setAppearancePrefsTabIndex(int index);
/**
* Set the default font settings to use for rendering Book View/Preview
*/
void setWebViewAppearance(const WebViewAppearance &webview_appearance);
/**
* Set the default font settings to use for Special Characters popup window
*/
void setSpecialCharacterAppearance(const SpecialCharacterAppearance &special_character_appearance);
/**
* Set the icon size to use for the main menu.
*/
void setMainMenuIconSize(double icon_size);
void setJavascriptOn(int on);
void setRemoteOn(int on);
void setUsePrettify(int on);
void setUseWSPreWrap(int on);
void setSkipPrintWarnings(bool skip);
void setSkipPrintPreview(bool skip);
private:
/**
* Ensures there is not an open settings group which will cause the settings
* this class implements to be set in the wrong place.
*/
void clearSettingsGroup();
};
#endif // SETTINGSSTORE_H
|