7#include <QtHelp/QHelpEngineCore>
11using namespace Qt::StringLiterals;
14 const QString AboutIconKey(
"AboutIcon"_L1);
15 const QString AboutImagesKey(
"AboutImages"_L1);
16 const QString AboutMenuTextsKey(
"AboutMenuTexts"_L1);
17 const QString AboutTextsKey(
"AboutTexts"_L1);
18 const QString ApplicationIconKey(
"ApplicationIcon"_L1);
19 const QString CacheDirKey(
"CacheDirectory"_L1);
20 const QString CacheDirRelativeToCollectionKey(
"CacheDirRelativeToCollection"_L1);
21 const QString CreationTimeKey(
"CreationTime"_L1);
22 const QString DefaultHomePageKey(
"defaultHomepage"_L1);
23 const QString EnableAddressBarKey(
"EnableAddressBar"_L1);
24 const QString EnableDocManagerKey(
"EnableDocumentationManager"_L1);
25 const QString EnableFilterKey(
"EnableFilterFunctionality"_L1);
26 const QString HideAddressBarKey(
"HideAddressBar"_L1);
27 const QString FilterToolbarHiddenKey(
"HideFilterFunctionality"_L1);
28 const QString LastPageKey(
"LastTabPage"_L1);
29 const QString LastRegisterTime(
"LastRegisterTime"_L1);
30 const QString LastShownPagesKey(
"LastShownPages"_L1);
31 const QString LastZoomFactorsKey(
32#if defined(BROWSER_QTWEBKIT)
33 "LastPagesZoomWebView"_L1
35 "LastPagesZoomTextBrowser"_L1
38 const QString WindowTitleKey(
"WindowTitle"_L1);
39 const QString FullTextSearchFallbackKey(
"FullTextSearchFallback"_L1);
47 return helpEngine.customValue(CreationTimeKey, 0).toUInt();
52 helpEngine.setCustomValue(CreationTimeKey, time);
57 return helpEngine.customValue(WindowTitleKey).toString();
61 const QString &windowTitle)
63 helpEngine.setCustomValue(WindowTitleKey, windowTitle);
68 return helpEngine.customValue(EnableFilterKey,
true).toBool();
74 helpEngine.setCustomValue(EnableFilterKey, enabled);
79 return !helpEngine.customValue(FilterToolbarHiddenKey,
true).toBool();
85 helpEngine.setCustomValue(FilterToolbarHiddenKey, !visible);
90 return helpEngine.customValue(EnableAddressBarKey,
true).toBool();
96 helpEngine.setCustomValue(EnableAddressBarKey, enabled);
101 return !helpEngine.customValue(HideAddressBarKey,
true).toBool();
107 helpEngine.setCustomValue(HideAddressBarKey, !visible);
112 return helpEngine.customValue(CacheDirKey).toString();
117 return helpEngine.customValue(CacheDirRelativeToCollectionKey).toBool();
121 const QString &cacheDir,
bool relativeToCollection)
123 helpEngine.setCustomValue(CacheDirKey, cacheDir);
124 helpEngine.setCustomValue(CacheDirRelativeToCollectionKey,
125 relativeToCollection);
130 return helpEngine.customValue(EnableDocManagerKey,
true).toBool();
136 helpEngine.setCustomValue(EnableDocManagerKey, enabled);
141 return helpEngine.customValue(ApplicationIconKey).toByteArray();
145 const QByteArray &icon)
147 helpEngine.setCustomValue(ApplicationIconKey, icon);
152 return helpEngine.customValue(AboutMenuTextsKey).toByteArray();
156 const QByteArray &texts)
158 helpEngine.setCustomValue(AboutMenuTextsKey, texts);
163 return helpEngine.customValue(AboutIconKey).toByteArray();
167 const QByteArray &icon)
169 helpEngine.setCustomValue(AboutIconKey, icon);
174 return helpEngine.customValue(AboutTextsKey).toByteArray();
178 const QByteArray &texts)
180 helpEngine.setCustomValue(AboutTextsKey, texts);
185 return helpEngine.customValue(AboutImagesKey).toByteArray();
189 const QByteArray &images)
191 helpEngine.setCustomValue(AboutImagesKey, images);
196 return helpEngine.customValue(DefaultHomePageKey,
"help"_L1).toString();
202 helpEngine.setCustomValue(DefaultHomePageKey, page);
207 return helpEngine.customValue(LastShownPagesKey).toString().
208 split(ListSeparator, Qt::SkipEmptyParts);
212 const QStringList &lastShownPages)
214 helpEngine.setCustomValue(LastShownPagesKey,
215 lastShownPages.join(ListSeparator));
220 return helpEngine.customValue(LastZoomFactorsKey).toString().
221 split(ListSeparator, Qt::SkipEmptyParts);
225 const QStringList &lastZoomFactors)
227 helpEngine.setCustomValue(LastZoomFactorsKey,
228 lastZoomFactors.join(ListSeparator));
233 return helpEngine.customValue(LastPageKey, 1).toInt();
239 helpEngine.setCustomValue(LastPageKey, lastPage);
244 return helpEngine.customValue(LastRegisterTime, QDateTime()).toDateTime();
249 helpEngine.setCustomValue(LastRegisterTime, dt);
258 const QHelpEngineCore &older)
260 return creationTime(newer) > creationTime(older);
264 QHelpEngineCore &target)
266 setCreationTime(target, creationTime(source));
267 setWindowTitle(target, windowTitle(source));
268 target.setCurrentFilter(source.currentFilter());
269 setCacheDir(target, cacheDir(source), cacheDirIsRelativeToCollection(source));
275 setApplicationIcon(target, applicationIcon(source));
276 setAboutMenuTexts(target, aboutMenuTexts(source));
277 setAboutIcon(target, aboutIcon(source));
278 setAboutTexts(target, aboutTexts(source));
279 setAboutImages(target, aboutImages(source));
280 setDefaultHomePage(target, defaultHomePage(source));
285 const QHelpEngineCore &helpEngine)
287 return helpEngine.customValue(FullTextSearchFallbackKey,
false).toBool();
291 QHelpEngineCore &helpEngine,
bool on)
293 helpEngine.setCustomValue(FullTextSearchFallbackKey, on);
static void setFullTextSearchFallbackEnabled(QHelpEngineCore &helpEngine, bool on)
static bool filterFunctionalityEnabled(const QHelpEngineCore &helpEngine)
static bool isNewer(const QHelpEngineCore &newer, const QHelpEngineCore &older)
static void setLastTabPage(QHelpEngineCore &helpEngine, int lastPage)
static bool addressBarVisible(const QHelpEngineCore &helpEngine)
static bool addressBarEnabled(const QHelpEngineCore &helpEngine)
static void setAddressBarVisible(QHelpEngineCore &helpEngine, bool visible)
static void setDocumentationManagerEnabled(QHelpEngineCore &helpEngine, bool enabled)
static bool documentationManagerEnabled(const QHelpEngineCore &helpEngine)
static void copyConfiguration(const QHelpEngineCore &source, QHelpEngineCore &target)
static void setAddressBarEnabled(QHelpEngineCore &helpEngine, bool enabled)
static const QString ListSeparator
static const QString DefaultZoomFactor
static void updateLastRegisterTime(QHelpEngineCore &helpEngine)
static int lastTabPage(const QHelpEngineCore &helpEngine)
static bool cacheDirIsRelativeToCollection(const QHelpEngineCore &helpEngine)
static void setFilterToolbarVisible(QHelpEngineCore &helpEngine, bool visible)
static void setFilterFunctionalityEnabled(QHelpEngineCore &helpEngine, bool enabled)
static bool filterToolbarVisible(const QHelpEngineCore &helpEngine)
static bool fullTextSearchFallbackEnabled(const QHelpEngineCore &helpEngine)
Combined button and popup list for selecting options.