mirror of
https://github.com/zealdocs/zeal.git
synced 2024-08-17 02:00:25 +03:00
refactor: fix naming of boolean properties
This commit is contained in:
parent
a89bed5648
commit
4b252cddb2
@ -72,11 +72,11 @@ void Settings::applySettings()
|
||||
// TODO: Apply to all open pages.
|
||||
m_webProfile->scripts()->clear(); // Remove all scripts first.
|
||||
|
||||
if (m_appSettings->darkModeEnabled) {
|
||||
if (m_appSettings->isDarkModeEnabled) {
|
||||
setCustomStyleSheet(QStringLiteral("_zeal_darkstylesheet"), DarkModeCssUrl);
|
||||
}
|
||||
|
||||
if (m_appSettings->highlightOnNavigateEnabled) {
|
||||
if (m_appSettings->isHighlightOnNavigateEnabled) {
|
||||
setCustomStyleSheet(QStringLiteral("_zeal_highlightstylesheet"), HighlightOnNavigateCssUrl);
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ void Application::checkForUpdates(bool quiet)
|
||||
void Application::applySettings()
|
||||
{
|
||||
m_docsetRegistry->setStoragePath(m_settings->docsetPath);
|
||||
m_docsetRegistry->setFuzzySearchEnabled(m_settings->fuzzySearchEnabled);
|
||||
m_docsetRegistry->setFuzzySearchEnabled(m_settings->isFuzzySearchEnabled);
|
||||
|
||||
// HTTP Proxy Settings
|
||||
switch (m_settings->proxyType) {
|
||||
|
@ -85,7 +85,7 @@ void Settings::load()
|
||||
settings->endGroup();
|
||||
|
||||
settings->beginGroup(GroupSearch);
|
||||
fuzzySearchEnabled = settings->value(QStringLiteral("fuzzy_search_enabled"), false).toBool();
|
||||
isFuzzySearchEnabled = settings->value(QStringLiteral("fuzzy_search_enabled"), false).toBool();
|
||||
settings->endGroup();
|
||||
|
||||
settings->beginGroup(GroupContent);
|
||||
@ -130,8 +130,8 @@ void Settings::load()
|
||||
webSettings->setFontSize(QWebEngineSettings::DefaultFixedFontSize, defaultFixedFontSize);
|
||||
webSettings->setFontSize(QWebEngineSettings::MinimumFontSize, minimumFontSize);
|
||||
|
||||
darkModeEnabled = settings->value(QStringLiteral("dark_mode"), false).toBool();
|
||||
highlightOnNavigateEnabled = settings->value(QStringLiteral("highlight_on_navigate"), true).toBool();
|
||||
isDarkModeEnabled = settings->value(QStringLiteral("dark_mode"), false).toBool();
|
||||
isHighlightOnNavigateEnabled = settings->value(QStringLiteral("highlight_on_navigate"), true).toBool();
|
||||
customCssFile = settings->value(QStringLiteral("custom_css_file")).toString();
|
||||
externalLinkPolicy = settings->value(QStringLiteral("external_link_policy"),
|
||||
QVariant::fromValue(ExternalLinkPolicy::Ask)).value<ExternalLinkPolicy>();
|
||||
@ -206,7 +206,7 @@ void Settings::save()
|
||||
settings->endGroup();
|
||||
|
||||
settings->beginGroup(GroupSearch);
|
||||
settings->setValue(QStringLiteral("fuzzy_search_enabled"), fuzzySearchEnabled);
|
||||
settings->setValue(QStringLiteral("fuzzy_search_enabled"), isFuzzySearchEnabled);
|
||||
settings->endGroup();
|
||||
|
||||
settings->beginGroup(GroupContent);
|
||||
@ -219,8 +219,8 @@ void Settings::save()
|
||||
settings->setValue(QStringLiteral("default_fixed_font_size"), defaultFixedFontSize);
|
||||
settings->setValue(QStringLiteral("minimum_font_size"), minimumFontSize);
|
||||
|
||||
settings->setValue(QStringLiteral("dark_mode"), darkModeEnabled);
|
||||
settings->setValue(QStringLiteral("highlight_on_navigate"), highlightOnNavigateEnabled);
|
||||
settings->setValue(QStringLiteral("dark_mode"), isDarkModeEnabled);
|
||||
settings->setValue(QStringLiteral("highlight_on_navigate"), isHighlightOnNavigateEnabled);
|
||||
settings->setValue(QStringLiteral("custom_css_file"), customCssFile);
|
||||
settings->setValue(QStringLiteral("external_link_policy"), QVariant::fromValue(externalLinkPolicy));
|
||||
settings->setValue(QStringLiteral("smooth_scrolling"), isSmoothScrollingEnabled);
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
bool openNewTabAfterActive;
|
||||
|
||||
// Search
|
||||
bool fuzzySearchEnabled;
|
||||
bool isFuzzySearchEnabled;
|
||||
|
||||
// Content
|
||||
QString defaultFontFamily;
|
||||
@ -79,8 +79,8 @@ public:
|
||||
Q_ENUM(ExternalLinkPolicy)
|
||||
ExternalLinkPolicy externalLinkPolicy = ExternalLinkPolicy::Ask;
|
||||
|
||||
bool darkModeEnabled;
|
||||
bool highlightOnNavigateEnabled;
|
||||
bool isDarkModeEnabled;
|
||||
bool isHighlightOnNavigateEnabled;
|
||||
QString customCssFile;
|
||||
bool isSmoothScrollingEnabled;
|
||||
|
||||
|
@ -168,7 +168,7 @@ Docset::Docset(QString path)
|
||||
}
|
||||
|
||||
if (plist.contains(InfoPlist::IsJavaScriptEnabled)) {
|
||||
m_javaScriptEnabled = plist[InfoPlist::IsJavaScriptEnabled].toBool();
|
||||
m_isJavaScriptEnabled = plist[InfoPlist::IsJavaScriptEnabled].toBool();
|
||||
}
|
||||
|
||||
m_keywords.removeDuplicates();
|
||||
@ -294,7 +294,7 @@ QList<SearchResult> Docset::search(const QString &query, const CancellationToken
|
||||
{
|
||||
QString sql;
|
||||
if (m_type == Docset::Type::Dash) {
|
||||
if (m_fuzzySearchEnabled) {
|
||||
if (m_isFuzzySearchEnabled) {
|
||||
sql = QStringLiteral("SELECT name, type, path, '', zealScore('%1', name) as score"
|
||||
" FROM searchIndex"
|
||||
" WHERE score > 0");
|
||||
@ -304,7 +304,7 @@ QList<SearchResult> Docset::search(const QString &query, const CancellationToken
|
||||
" WHERE (name LIKE '%%1%' ESCAPE '\\')");
|
||||
}
|
||||
} else {
|
||||
if (m_fuzzySearchEnabled) {
|
||||
if (m_isFuzzySearchEnabled) {
|
||||
sql = QStringLiteral("SELECT name, type, path, fragment, zealScore('%1', name) as score"
|
||||
" FROM searchIndex"
|
||||
" WHERE score > 0");
|
||||
@ -421,7 +421,7 @@ void Docset::loadMetadata()
|
||||
}
|
||||
|
||||
if (extra.contains(QStringLiteral("isJavaScriptEnabled"))) {
|
||||
m_javaScriptEnabled = extra[QStringLiteral("isJavaScriptEnabled")].toBool();
|
||||
m_isJavaScriptEnabled = extra[QStringLiteral("isJavaScriptEnabled")].toBool();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -730,17 +730,17 @@ void Docset::setBaseUrl(const QUrl &baseUrl)
|
||||
|
||||
bool Docset::isFuzzySearchEnabled() const
|
||||
{
|
||||
return m_fuzzySearchEnabled;
|
||||
return m_isFuzzySearchEnabled;
|
||||
}
|
||||
|
||||
void Docset::setFuzzySearchEnabled(bool enabled)
|
||||
{
|
||||
m_fuzzySearchEnabled = enabled;
|
||||
m_isFuzzySearchEnabled = enabled;
|
||||
}
|
||||
|
||||
bool Docset::isJavaScriptEnabled() const
|
||||
{
|
||||
return m_javaScriptEnabled;
|
||||
return m_isJavaScriptEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,8 +120,9 @@ private:
|
||||
QMap<QString, int> m_symbolCounts;
|
||||
mutable QMap<QString, QMultiMap<QString, QUrl>> m_symbols;
|
||||
Util::SQLiteDatabase *m_db = nullptr;
|
||||
bool m_fuzzySearchEnabled = false;
|
||||
bool m_javaScriptEnabled = false;
|
||||
|
||||
bool m_isFuzzySearchEnabled = false;
|
||||
bool m_isJavaScriptEnabled = false;
|
||||
|
||||
QUrl m_baseUrl;
|
||||
};
|
||||
|
@ -90,16 +90,16 @@ void DocsetRegistry::setStoragePath(const QString &path)
|
||||
|
||||
bool DocsetRegistry::isFuzzySearchEnabled() const
|
||||
{
|
||||
return m_fuzzySearchEnabled;
|
||||
return m_isFuzzySearchEnabled;
|
||||
}
|
||||
|
||||
void DocsetRegistry::setFuzzySearchEnabled(bool enabled)
|
||||
{
|
||||
if (enabled == m_fuzzySearchEnabled) {
|
||||
if (enabled == m_isFuzzySearchEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_fuzzySearchEnabled = enabled;
|
||||
m_isFuzzySearchEnabled = enabled;
|
||||
|
||||
for (Docset *docset : qAsConst(m_docsets)) {
|
||||
docset->setFuzzySearchEnabled(enabled);
|
||||
@ -137,7 +137,7 @@ void DocsetRegistry::loadDocset(const QString &path)
|
||||
return;
|
||||
}
|
||||
|
||||
docset->setFuzzySearchEnabled(m_fuzzySearchEnabled);
|
||||
docset->setFuzzySearchEnabled(m_isFuzzySearchEnabled);
|
||||
|
||||
const QString name = docset->name();
|
||||
if (m_docsets.contains(name)) {
|
||||
|
@ -85,7 +85,7 @@ private:
|
||||
QAbstractItemModel *m_model = nullptr;
|
||||
|
||||
QString m_storagePath;
|
||||
bool m_fuzzySearchEnabled = false;
|
||||
bool m_isFuzzySearchEnabled = false;
|
||||
|
||||
QThread *m_thread = nullptr;
|
||||
QMap<QString, Docset *> m_docsets;
|
||||
|
@ -186,7 +186,7 @@ void SettingsDialog::loadSettings()
|
||||
ui->openNewTabAfterActive->setChecked(settings->openNewTabAfterActive);
|
||||
|
||||
// Search Tab
|
||||
ui->fuzzySearchCheckBox->setChecked(settings->fuzzySearchEnabled);
|
||||
ui->fuzzySearchCheckBox->setChecked(settings->isFuzzySearchEnabled);
|
||||
|
||||
// Content Tab
|
||||
for (int i = 0; i < ui->defaultFontComboBox->count(); ++i) {
|
||||
@ -203,8 +203,8 @@ void SettingsDialog::loadSettings()
|
||||
ui->fixedFontSizeComboBox->setCurrentText(QString::number(settings->defaultFixedFontSize));
|
||||
ui->minFontSizeComboBox->setCurrentText(QString::number(settings->minimumFontSize));
|
||||
|
||||
ui->darkModeCheckBox->setChecked(settings->darkModeEnabled);
|
||||
ui->highlightOnNavigateCheckBox->setChecked(settings->highlightOnNavigateEnabled);
|
||||
ui->darkModeCheckBox->setChecked(settings->isDarkModeEnabled);
|
||||
ui->highlightOnNavigateCheckBox->setChecked(settings->isHighlightOnNavigateEnabled);
|
||||
ui->customCssFileEdit->setText(QDir::toNativeSeparators(settings->customCssFile));
|
||||
|
||||
switch (settings->externalLinkPolicy) {
|
||||
@ -266,7 +266,7 @@ void SettingsDialog::saveSettings()
|
||||
settings->openNewTabAfterActive = ui->openNewTabAfterActive->isChecked();
|
||||
|
||||
// Search Tab
|
||||
settings->fuzzySearchEnabled = ui->fuzzySearchCheckBox->isChecked();
|
||||
settings->isFuzzySearchEnabled = ui->fuzzySearchCheckBox->isChecked();
|
||||
|
||||
// Content Tab
|
||||
settings->defaultFontFamily = ui->defaultFontComboBox->currentData().toString();
|
||||
@ -278,8 +278,8 @@ void SettingsDialog::saveSettings()
|
||||
settings->defaultFixedFontSize = ui->fixedFontSizeComboBox->currentData().toInt();
|
||||
settings->minimumFontSize = ui->minFontSizeComboBox->currentData().toInt();
|
||||
|
||||
settings->darkModeEnabled = ui->darkModeCheckBox->isChecked();
|
||||
settings->highlightOnNavigateEnabled = ui->highlightOnNavigateCheckBox->isChecked();
|
||||
settings->isDarkModeEnabled = ui->darkModeCheckBox->isChecked();
|
||||
settings->isHighlightOnNavigateEnabled = ui->highlightOnNavigateCheckBox->isChecked();
|
||||
settings->customCssFile = QDir::fromNativeSeparators(ui->customCssFileEdit->text());
|
||||
|
||||
if (ui->radioExternalLinkAsk->isChecked()) {
|
||||
|
Loading…
Reference in New Issue
Block a user