From aae82179bc5f04b4361c57f9a1073ff3af6899c4 Mon Sep 17 00:00:00 2001 From: aqua Date: Fri, 19 Aug 2022 21:20:26 +0300 Subject: Add rekonf script to generate SettingsWidgets - generate General Settings - generate Appearance Settings - removed previous settings widgets --- bitbucket-pipelines.yml | 1 + scripts/rekonf.py | 118 +++++++++ src/CMakeLists.txt | 1 + src/rekonq.kcfg | 305 ++++++----------------- src/rekonq.kcfgc | 5 - src/settings/CMakeLists.txt | 32 +++ src/settings/advancedwidget.cpp | 70 ------ src/settings/advancedwidget.h | 62 ----- src/settings/appearancewidget.cpp | 155 ------------ src/settings/appearancewidget.h | 66 ----- src/settings/generalwidget.cpp | 121 --------- src/settings/generalwidget.h | 61 ----- src/settings/helpers.hpp | 60 +++++ src/settings/networkwidget.cpp | 100 -------- src/settings/networkwidget.h | 63 ----- src/settings/passexceptionswidget.cpp | 73 ------ src/settings/passexceptionswidget.h | 53 ---- src/settings/password_exceptions.ui | 55 ---- src/settings/privacywidget.cpp | 135 ---------- src/settings/privacywidget.h | 67 ----- src/settings/settings_advanced.ui | 245 ------------------ src/settings/settings_appearance.ui | 455 ---------------------------------- src/settings/settings_general.ui | 274 -------------------- src/settings/settings_privacy.ui | 284 --------------------- src/settings/settings_tabs.ui | 297 ---------------------- src/settings/settings_webkit.ui | 254 ------------------- src/settings/settingsdialog.cpp | 226 ++--------------- src/settings/settingsdialog.h | 80 ++---- src/settings/settingsdialog.ui | 122 +++++++++ src/settings/settingswidgets.hpp | 65 +++++ src/settings/tabswidget.cpp | 52 ---- src/settings/tabswidget.h | 58 ----- src/settings/test/dialog.cpp | 12 + src/settings/test/fonts.cpp | 31 +++ src/settings/webkitwidget.cpp | 71 ------ src/settings/webkitwidget.h | 60 ----- 36 files changed, 554 insertions(+), 3635 deletions(-) create mode 100755 scripts/rekonf.py delete mode 100644 src/rekonq.kcfgc create mode 100644 src/settings/CMakeLists.txt delete mode 100644 src/settings/advancedwidget.cpp delete mode 100644 src/settings/advancedwidget.h delete mode 100644 src/settings/appearancewidget.cpp delete mode 100644 src/settings/appearancewidget.h delete mode 100644 src/settings/generalwidget.cpp delete mode 100644 src/settings/generalwidget.h create mode 100644 src/settings/helpers.hpp delete mode 100644 src/settings/networkwidget.cpp delete mode 100644 src/settings/networkwidget.h delete mode 100644 src/settings/passexceptionswidget.cpp delete mode 100644 src/settings/passexceptionswidget.h delete mode 100644 src/settings/password_exceptions.ui delete mode 100644 src/settings/privacywidget.cpp delete mode 100644 src/settings/privacywidget.h delete mode 100644 src/settings/settings_advanced.ui delete mode 100644 src/settings/settings_appearance.ui delete mode 100644 src/settings/settings_general.ui delete mode 100644 src/settings/settings_privacy.ui delete mode 100644 src/settings/settings_tabs.ui delete mode 100644 src/settings/settings_webkit.ui create mode 100644 src/settings/settingsdialog.ui create mode 100644 src/settings/settingswidgets.hpp delete mode 100644 src/settings/tabswidget.cpp delete mode 100644 src/settings/tabswidget.h create mode 100644 src/settings/test/dialog.cpp create mode 100644 src/settings/test/fonts.cpp delete mode 100644 src/settings/webkitwidget.cpp delete mode 100644 src/settings/webkitwidget.h diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 61beefd2..539eee04 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -9,6 +9,7 @@ pipelines: script: - python --version - pylint scripts/check_license.py + - pylint scripts/rekonf.py - step: name: license headers check runs-on: diff --git a/scripts/rekonf.py b/scripts/rekonf.py new file mode 100755 index 00000000..56ded374 --- /dev/null +++ b/scripts/rekonf.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 +# ============================================================ +# The rekonq project +# ============================================================ +# SPDX-License-Identifier: GPL-3.0-only +# Copyright (C) 2022 aqua +# ============================================================ +""" Generate SettingsWidgets from KDE kcfg files """ + + +import argparse +import sys +from xml.etree import ElementTree + + +def write_int_entry(entry): + '''Add a QSpinBox connected to an Int entry''' + print(f' // { entry.attrib["name"] }') + print(f' auto* { entry.attrib["key"] } = new QSpinBox(this);') + print(f' { entry.attrib["key"] }->setValue({ entry.find("{*}default").text });') + print(f' formLayout->addRow(tr("{ entry.attrib["name"] }"), { entry.attrib["key"] });') + + +def write_bool_entry(entry): + '''Add a QCheckBox connected to a Bool entry''' + print(f' // { entry.attrib["name"] }') + print(f' auto* { entry.attrib["key"] } = new QCheckBox(tr("{ entry.attrib["name"] }"), this);') + print(f' { entry.attrib["key"] }->setChecked({ entry.find("{*}default").text });') + print(f' formLayout->addRow(QString(), { entry.attrib["key"] });') + + +def write_string_entry(entry): + '''Add a QLineEdit connected to a String entry''' + print(f' // { entry.attrib["name"] }') + print(f' auto* { entry.attrib["key"] } = new QLineEdit(this);') + print(f' { entry.attrib["key"] }->setText("{ entry.find("{*}default").text }");') + print(f' formLayout->addRow(tr("{ entry.attrib["name"] }"), { entry.attrib["key"] });') + + +def write_font_entry(entry): + '''Add a QFontComboBox connected to a Font entry''' + print(f' // { entry.attrib["name"] }') + print(f' auto* { entry.attrib["key"] } = new QFontComboBox(this);') + print(f' { entry.attrib["key"] }->setCurrentFont({ entry.find("{*}default").text });') + print(f' formLayout->addRow(tr("{ entry.attrib["name"] }"), { entry.attrib["key"] });') + + +def write_shortcut_entry(entry): + '''Add a QKeySequenceEdit connected to a Shortcut entry''' + print(f' // { entry.attrib["name"] }') + print(f' auto* { entry.attrib["key"] } = new QKeySequenceEdit({{ "{entry.find("{*}default").text}" }}, this);') + print(f' formLayout->addRow(tr("{ entry.attrib["name"] }"), { entry.attrib["key"] });') + + +def generate_group_widget(root, group): + '''Generate a class based on the group name''' + class_name = group.attrib["name"].replace(' ', '') + 'SettingsWidget' + + # includes + print('// Includes') + print('#include "settingswidgets.hpp"') + print('#include "helpers.hpp"') + print('#include ') + print('#include ') + print('#include ') + print('#include ') + print('#include ') + print('#include ') + print('// kcfg Includes') + for include in root.findall('{http://www.kde.org/standards/kcfg/1.0}include'): + print(f'#include <{ include.text }>') + print('') + + print(f'{ class_name }::{ class_name }(QWidget *parent) : SettingsWidget(parent) {{') + print(' auto *formLayout = new QFormLayout;') + print(' setLayout(formLayout);') + print('') + + print(' // Entries') + for entry in group.findall('{http://www.kde.org/standards/kcfg/1.0}entry'): + if entry.attrib.get("hidden") == "true": + print(f' // hidden entry { entry.attrib.get("name") }') + elif entry.attrib['type'] == 'Int': + write_int_entry(entry) + elif entry.attrib['type'] == 'Bool': + write_bool_entry(entry) + elif entry.attrib['type'] == 'String': + write_string_entry(entry) + elif entry.attrib['type'] == 'Font': + write_font_entry(entry) + elif entry.attrib['type'] == 'Shortcut': + write_shortcut_entry(entry) + else: + print(f'#error entry with unknown type { entry.attrib["type"] }') + print('') + + print('}\n') + + print(f'void { class_name }::save() {{ }}') + print(f'void { class_name }::reset() {{ }}') + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Generate SettingsWidgets') + parser.add_argument('file', type=str, help='kcfg file') + parser.add_argument('--group', type=str, required=True, help='Group') + parser.add_argument('--output', type=str, default=None, help='Redirect output to file') + args = parser.parse_args() + + with open(args.output, 'w', encoding="utf-8") if args.output else sys.stdout as sys.stdout: + tree = ElementTree.parse(args.file) + root = tree.getroot() + + # groups + for group in root.findall('{http://www.kde.org/standards/kcfg/1.0}group'): + if group.attrib["name"] == args.group: + print('// This is an automatically generated file') + generate_group_widget(root, group) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1877a108..9413217c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,7 @@ ### ------- sub dirs ------- ADD_SUBDIRECTORY( data ) +add_subdirectory(settings) add_subdirectory(plugins) ### ------- sources -------- diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 8bd8b2ad..b51f0526 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -6,294 +6,127 @@ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > -QtWebKit -QDateTime -KUrl -KGlobalSettings - - - - true - - - false - - - - - - 0 - - - true - - - false - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - - - - false - - - false - - - - - - - - - - - KDE Homepage,rekonq site - - - http://www.kde.org/,http://rekonq.kde.org/ - - - - - - 1 + + + TODO: change type to StringList - + http://www.kde.org/ - - KUrl(KGlobalSettings::downloadPath()) + + http://www.kde.org/ - - false + + https://duckduckgo.com/?q=%1 - - false + + TODO: change type to Path - - false + + TODO: change type to Path - - - - - - 0 - - - 0 - - - - 0 - - - false - - - false - - - false + + + + TODO: change type to Path - + true - - false + + TODO - - - KGlobalSettings::generalFont().family() + + getFont(QFont::AnyStyle) - - KGlobalSettings::fixedFont().family() + + getFont(QFont::Monospace) - - QWebSettings::globalSettings()->fontFamily(QWebSettings::SerifFont) + + getFont(QFont::Serif) - - QWebSettings::globalSettings()->fontFamily(QWebSettings::SansSerifFont) + + getFont(QFont::SansSerif) - - QWebSettings::globalSettings()->fontFamily(QWebSettings::CursiveFont) + + getFont(QFont::Cursive) - - QWebSettings::globalSettings()->fontFamily(QWebSettings::FantasyFont) + + getFont(QFont::Fantasy) - + 16 - + 7 - + ISO 8859-1 - - - - + 10 - - - - - false - - - false - - - 0 - - - true - - - - - - - - - true - - - - 0 - - - - true - - - true - - - true - - - 50 - - - - true - - - true - - - false - - - false - - - true - - - true - - - false - - - - - - - - false - - - false - - - false + + + + Ctrl+B - - true + + Ctrl+F - - false + + Ctrl+S - - 2 + + Ctrl+Q - - true + + Ctrl+T - - - - - - - false + + Ctrl+W - - false + + Ctrl+Left - - false + + Ctrl+Right - - false + + F6 - - 0 + + Alt+Left - - + + Alt+Right - - + + F5 - - + + Ctrl+F5 - - + + Ctrl+O - - -1 + + Ctrl+D diff --git a/src/rekonq.kcfgc b/src/rekonq.kcfgc deleted file mode 100644 index 50a9817d..00000000 --- a/src/rekonq.kcfgc +++ /dev/null @@ -1,5 +0,0 @@ -File=rekonq.kcfg -ClassName=ReKonfig -Singleton=true -Mutators=true -UseEnumTypes=true diff --git a/src/settings/CMakeLists.txt b/src/settings/CMakeLists.txt new file mode 100644 index 00000000..91d8e5d6 --- /dev/null +++ b/src/settings/CMakeLists.txt @@ -0,0 +1,32 @@ +add_custom_command(OUTPUT generalsettingswidget.cpp DEPENDS ${PROJECT_SOURCE_DIR}/src/rekonq.kcfg + COMMAND python3 ${PROJECT_SOURCE_DIR}/scripts/rekonf.py + --group=General --output=generalsettingswidget.cpp + ${PROJECT_SOURCE_DIR}/src/rekonq.kcfg) +add_custom_command(OUTPUT appearancesettingswidget.cpp DEPENDS ${PROJECT_SOURCE_DIR}/src/rekonq.kcfg + COMMAND python3 ${PROJECT_SOURCE_DIR}/scripts/rekonf.py + --group=Appearance --output=appearancesettingswidget.cpp + ${PROJECT_SOURCE_DIR}/src/rekonq.kcfg) +add_custom_command(OUTPUT networksettingswidget.cpp DEPENDS ${PROJECT_SOURCE_DIR}/src/rekonq.kcfg + COMMAND python3 ${PROJECT_SOURCE_DIR}/scripts/rekonf.py + --group=Network --output=networksettingswidget.cpp + ${PROJECT_SOURCE_DIR}/src/rekonq.kcfg) +add_custom_command(OUTPUT shortcutssettingswidget.cpp DEPENDS ${PROJECT_SOURCE_DIR}/src/rekonq.kcfg + COMMAND python3 ${PROJECT_SOURCE_DIR}/scripts/rekonf.py + --group=Shortcuts --output=shortcutssettingswidget.cpp + ${PROJECT_SOURCE_DIR}/src/rekonq.kcfg) + +add_library(settings STATIC + settingsdialog.cpp settingsdialog.h settingsdialog.ui + settingswidgets.hpp helpers.hpp + generalsettingswidget.cpp appearancesettingswidget.cpp networksettingswidget.cpp shortcutssettingswidget.cpp +) +target_link_libraries(settings PUBLIC Qt6::Widgets) + +IF(TESTING) + add_executable(test_settingsdialog test/dialog.cpp) + target_link_libraries(test_settingsdialog settings) + + add_executable(test_fonts test/fonts.cpp) + target_link_libraries(test_fonts GTest::gtest Qt6::Gui) + gtest_discover_tests(test_fonts) +endif() diff --git a/src/settings/advancedwidget.cpp b/src/settings/advancedwidget.cpp deleted file mode 100644 index 73c889dc..00000000 --- a/src/settings/advancedwidget.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2012 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -// Local Includes -#include "advancedwidget.h" -#include "advancedwidget.moc" - -// Qt Includes -#include - - -AdvancedWidget::AdvancedWidget(QWidget *parent) - : QWidget(parent) - , _changed(false) -{ - setupUi(this); - - connect(proxyButton, SIGNAL(clicked()), this, SLOT(launchProxySettings())); -} - - -void AdvancedWidget::save() -{ -} - - -bool AdvancedWidget::changed() -{ - return _changed; -} - - -void AdvancedWidget::hasChanged() -{ - _changed = true; - emit changed(true); -} - - -void AdvancedWidget::launchProxySettings() -{ - QString program = QL1S("kcmshell4"); - QStringList arguments; - arguments << QL1S("proxy"); - QProcess *proc = new QProcess(this); - proc->start(program, arguments); -} diff --git a/src/settings/advancedwidget.h b/src/settings/advancedwidget.h deleted file mode 100644 index e7f5793d..00000000 --- a/src/settings/advancedwidget.h +++ /dev/null @@ -1,62 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2012 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -#ifndef ADVANCED_WIDGET_H -#define ADVANCED_WIDGET_H - - -// Rekonq Includes -#include "rekonq_defines.h" - -// Ui Includes -#include "ui_settings_advanced.h" - -// Qt Includes -#include - - -class AdvancedWidget : public QWidget, private Ui::advanced -{ - Q_OBJECT - -public: - explicit AdvancedWidget(QWidget *parent = 0); - - void save(); - bool changed(); - -Q_SIGNALS: - void changed(bool); - -private Q_SLOTS: - void hasChanged(); - void launchProxySettings(); - -private: - bool _changed; -}; - -#endif // ADVANCED_WIDGET_H diff --git a/src/settings/appearancewidget.cpp b/src/settings/appearancewidget.cpp deleted file mode 100644 index 89918ac7..00000000 --- a/src/settings/appearancewidget.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2010-2011 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -// Self Includes -#include "appearancewidget.h" -#include "appearancewidget.moc" - -// Auto Includes -#include "rekonq.h" - -// KDE Includes -#include -#include - - -int zoomFactorList[13] = {5, 6, 7, 8, 9, 10, 11, 13, 15, 20, 25, 30}; - - - -AppearanceWidget::AppearanceWidget(QWidget *parent) - : QWidget(parent) - , _changed(false) -{ - setupUi(this); - - fixedFontChooser->setOnlyFixed(true); - - standardFontChooser->setCurrentFont(QFont(ReKonfig::standardFontFamily())); - fixedFontChooser->setCurrentFont(QFont(ReKonfig::fixedFontFamily())); - serifFontChooser->setCurrentFont(QFont(ReKonfig::serifFontFamily())); - sansSerifFontChooser->setCurrentFont(QFont(ReKonfig::sansSerifFontFamily())); - cursiveFontChooser->setCurrentFont(QFont(ReKonfig::cursiveFontFamily())); - fantasyFontChooser->setCurrentFont(QFont(ReKonfig::fantasyFontFamily())); - - connect(standardFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged())); - connect(fixedFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged())); - connect(serifFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged())); - connect(sansSerifFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged())); - connect(cursiveFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged())); - connect(fantasyFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged())); - - populateEncodingMenu(); - populateZoomMenu(); -} - - -void AppearanceWidget::save() -{ - ReKonfig::setStandardFontFamily(standardFontChooser->currentFont().family()); - ReKonfig::setFixedFontFamily(fixedFontChooser->currentFont().family()); - ReKonfig::setSerifFontFamily(serifFontChooser->currentFont().family()); - ReKonfig::setSansSerifFontFamily(sansSerifFontChooser->currentFont().family()); - ReKonfig::setCursiveFontFamily(cursiveFontChooser->currentFont().family()); - ReKonfig::setFantasyFontFamily(fantasyFontChooser->currentFont().family()); - - // zoom - int index = zoomCombo->currentIndex(); - int zoomFactor = zoomFactorList[index]; - ReKonfig::setDefaultZoom(zoomFactor); -} - - -bool AppearanceWidget::changed() -{ - return _changed; -} - - -void AppearanceWidget::hasChanged() -{ - _changed = true; - emit changed(true); -} - - -bool AppearanceWidget::isDefault() -{ - // TODO: implement me!! - - return !_changed; -} - - -void AppearanceWidget::populateEncodingMenu() -{ - encodingCombo->setEditable(false); - QStringList encodings = KGlobal::charsets()->availableEncodingNames(); - encodingCombo->addItems(encodings); - - encodingCombo->setWhatsThis(i18n("Select the default encoding to be used; normally, you will be fine with 'Use language encoding' " - "and should not have to change this.")); - - QString enc = ReKonfig::defaultEncoding(); - int indexOfEnc = encodings.indexOf(enc); - encodingCombo->setCurrentIndex(indexOfEnc); - - connect(encodingCombo, SIGNAL(activated(QString)), this, SLOT(setEncoding(QString))); - connect(encodingCombo, SIGNAL(activated(QString)), this, SLOT(hasChanged())); -} - - -void AppearanceWidget::populateZoomMenu() -{ - zoomCombo->setEditable(false); - QStringList availableZooms; - - int actualZoom = 0; - int defZoom = ReKonfig::defaultZoom(); - - for (int i = 0; i < 13; i++) - { - int zoomFactor = zoomFactorList[i]; - QString zoomString = QString::number(zoomFactor*10) + QL1S("%"); - availableZooms << zoomString; - - if (zoomFactor == defZoom) - { - actualZoom = i; - } - } - - zoomCombo->addItems(availableZooms); - zoomCombo->setCurrentIndex(actualZoom); - - connect(zoomCombo, SIGNAL(activated(QString)), this, SLOT(hasChanged())); -} - - -void AppearanceWidget::setEncoding(const QString &enc) -{ - ReKonfig::setDefaultEncoding(enc); -} diff --git a/src/settings/appearancewidget.h b/src/settings/appearancewidget.h deleted file mode 100644 index 39dafbaf..00000000 --- a/src/settings/appearancewidget.h +++ /dev/null @@ -1,66 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2010-2011 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -#ifndef APPEARANCE_WIDGET_H -#define APPEARANCE_WIDGET_H - - -// Rekonq Includes -#include "rekonq_defines.h" - -// Ui Includes -#include "ui_settings_appearance.h" - -// Qt Includes -#include - - -class AppearanceWidget : public QWidget, private Ui::appearance -{ - Q_OBJECT - -public: - explicit AppearanceWidget(QWidget *parent = 0); - - void save(); - bool changed(); - bool isDefault(); - -Q_SIGNALS: - void changed(bool); - -private Q_SLOTS: - void hasChanged(); - void setEncoding(const QString &); - -private: - void populateEncodingMenu(); - void populateZoomMenu(); - - bool _changed; -}; - -#endif // APPEARANCE_WIDGET_H diff --git a/src/settings/generalwidget.cpp b/src/settings/generalwidget.cpp deleted file mode 100644 index ed38f35b..00000000 --- a/src/settings/generalwidget.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2010-2012 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -// Self Includes -#include "generalwidget.h" -#include "generalwidget.moc" - -// Auto Includes -#include "rekonq.h" - -// Local Includes -#include "application.h" -#include "rekonqwindow.h" -#include "webwindow.h" - -//KDE Includes -#include -#include - - -GeneralWidget::GeneralWidget(QWidget *parent) - : QWidget(parent) - , _changed(false) -{ - setupUi(this); - - connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage())); - - checkKGetPresence(); - - connect(kcfg_homePage, SIGNAL(editingFinished()), this, SLOT(fixHomePageURL())); - - kcfg_downloadPath->setMode(KFile::Directory); - - askDownloadYes->setChecked(ReKonfig::askDownloadPath()); - askDownloadNo->setChecked(!ReKonfig::askDownloadPath()); - - kcfg_downloadPath->setEnabled(!ReKonfig::askDownloadPath()); - connect(askDownloadNo, SIGNAL(toggled(bool)), kcfg_downloadPath, SLOT(setEnabled(bool))); - connect(askDownloadNo, SIGNAL(toggled(bool)), this, SLOT(hasChanged())); -} - - -void GeneralWidget::save() -{ - ReKonfig::setAskDownloadPath(askDownloadYes->isChecked()); - - _changed = false; -} - - -bool GeneralWidget::changed() -{ - return _changed; -} - - -void GeneralWidget::hasChanged() -{ - _changed = true; - emit changed(true); -} - - -void GeneralWidget::setHomeToCurrentPage() -{ - if (!rApp->rekonqWindow()) - return; - - WebWindow *tab = rApp->rekonqWindow()->currentWebWindow(); - if (!tab) - return; - - kcfg_homePage->setText(tab->url().url()); -} - - -void GeneralWidget::checkKGetPresence() -{ - if (KStandardDirs::findExe("kget").isNull()) - { - kcfg_kgetDownload->setDisabled(true); - kcfg_kgetList->setDisabled(true); - kcfg_kgetDownload->setToolTip(i18n("Install KGet to enable rekonq to use it as download manager")); - } - else - { - kcfg_kgetDownload->setDisabled(false); - kcfg_kgetList->setDisabled(false); - } -} - - -void GeneralWidget::fixHomePageURL() -{ - QString fixedURL = QUrl::fromUserInput(kcfg_homePage->text()).toString(); - kcfg_homePage->setText(fixedURL); -} diff --git a/src/settings/generalwidget.h b/src/settings/generalwidget.h deleted file mode 100644 index b0caa46c..00000000 --- a/src/settings/generalwidget.h +++ /dev/null @@ -1,61 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2010-2012 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -#ifndef GENERAL_WIDGET_H -#define GENERAL_WIDGET_H - - -// Ui Includes -#include "ui_settings_general.h" - -// Qt Includes -#include - - -class GeneralWidget : public QWidget, private Ui::general -{ - Q_OBJECT - -public: - explicit GeneralWidget(QWidget *parent = 0); - - void save(); - bool changed(); - void checkKGetPresence(); - -Q_SIGNALS: - void changed(bool); - -private Q_SLOTS: - void hasChanged(); - void setHomeToCurrentPage(); - void fixHomePageURL(); - -private: - bool _changed; -}; - -#endif // GENERAL_WIDGET_H diff --git a/src/settings/helpers.hpp b/src/settings/helpers.hpp new file mode 100644 index 00000000..d7fcda4f --- /dev/null +++ b/src/settings/helpers.hpp @@ -0,0 +1,60 @@ +/* ============================================================ + * The rekonq project + * ============================================================ + * SPDX-License-Identifier: GPL-3.0-only + * Copyright (C) 2022 aqua + * ============================================================ + * Description: Settings helpers + * ============================================================ */ + +#pragma once + +#include +#include + +[[nodiscard]] static QFont getFont(QFont::StyleHint hint) +{ + switch (hint) { + case QFont::Helvetica: { // sans serif + QFont font("sans serif"); + font.setStyleHint(hint); + return font; + } + case QFont::Times: { // serif + QFont font("serif"); + font.setStyleHint(hint); + return font; + } + + case QFont::Monospace: + case QFont::Courier: { // typewriter + auto font = QFontDatabase::systemFont(QFontDatabase::FixedFont); + font.setStyleHint(hint); + return font; + } + + case QFont::OldEnglish: { // decorative + auto font = QFont("decorative"); + font.setStyleHint(hint); + return font; + } + + case QFont::System: + case QFont::AnyStyle: + return QFontDatabase::systemFont(QFontDatabase::GeneralFont); + + case QFont::Cursive: { + QFont font("cursive"); + font.setStyleHint(hint); + return font; + } + + case QFont::Fantasy: { + QFont font("fantasy"); + font.setStyleHint(hint); + return font; + } + } + + __builtin_unreachable(); +} diff --git a/src/settings/networkwidget.cpp b/src/settings/networkwidget.cpp deleted file mode 100644 index c2988eb1..00000000 --- a/src/settings/networkwidget.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2010-2011 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -// Self Includes -#include "networkwidget.h" -#include "networkwidget.moc" - -// KDE Includes -#include -#include - -// Qt Includes -#include - - -NetworkWidget::NetworkWidget(QWidget *parent) - : QWidget(parent) - , _cacheModule(0) - , _cookiesModule(0) - , _proxyModule(0) - , _changed(false) -{ - QVBoxLayout *l = new QVBoxLayout(this); - l->setMargin(0); - l->setSpacing(0); - - KTabWidget *tabWidget = new KTabWidget(this); - l->addWidget(tabWidget); - - KCModuleInfo cacheInfo("cache.desktop"); - _cacheModule = new KCModuleProxy(cacheInfo, parent); - tabWidget->addTab(_cacheModule, i18n(cacheInfo.moduleName().toUtf8())); - - KCModuleInfo cookiesInfo("cookies.desktop"); - _cookiesModule = new KCModuleProxy(cookiesInfo, parent); - tabWidget->addTab(_cookiesModule, i18n(cookiesInfo.moduleName().toUtf8())); - - KCModuleInfo proxyInfo("proxy.desktop"); - _proxyModule = new KCModuleProxy(proxyInfo, parent); - tabWidget->addTab(_proxyModule, i18n(proxyInfo.moduleName().toUtf8())); - - connect(_cacheModule, SIGNAL(changed(bool)), this, SLOT(hasChanged())); - connect(_cookiesModule, SIGNAL(changed(bool)), this, SLOT(hasChanged())); - connect(_proxyModule, SIGNAL(changed(bool)), this, SLOT(hasChanged())); -} - - -NetworkWidget::~NetworkWidget() -{ - delete _cacheModule; - delete _cookiesModule; - delete _proxyModule; -} - - -void NetworkWidget::save() -{ - _cookiesModule->save(); - _proxyModule->save(); - _cacheModule->save(); - - _changed = false; - emit changed(false); -} - - -void NetworkWidget::hasChanged() -{ - _changed = true; - emit changed(true); -} - - -bool NetworkWidget::changed() -{ - return _changed; -} diff --git a/src/settings/networkwidget.h b/src/settings/networkwidget.h deleted file mode 100644 index f0cf28f1..00000000 --- a/src/settings/networkwidget.h +++ /dev/null @@ -1,63 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2010-2011 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -#ifndef NETWORK_WIDGET_H -#define NETWORK_WIDGET_H - - -// KDE Includes -#include - -// Qt Includes -#include - - -class NetworkWidget : public QWidget -{ - Q_OBJECT - -public: - explicit NetworkWidget(QWidget *parent = 0); - ~NetworkWidget(); - - void save(); - bool changed(); - -Q_SIGNALS: - void changed(bool); - -private Q_SLOTS: - void hasChanged(); - -private: - KCModuleProxy *_cacheModule; - KCModuleProxy *_cookiesModule; - KCModuleProxy *_proxyModule; - - bool _changed; -}; - -#endif // NETWORK_WIDGET_H diff --git a/src/settings/passexceptionswidget.cpp b/src/settings/passexceptionswidget.cpp deleted file mode 100644 index fe20e711..00000000 --- a/src/settings/passexceptionswidget.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2012 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -// Self Includes -#include "passexceptionswidget.h" -#include "passexceptionswidget.moc" - -// Auto Includes -#include "rekonq.h" - - -PassExWidget::PassExWidget(QWidget *parent) - : QWidget(parent) -{ - setupUi(this); - - setAttribute(Qt::WA_DeleteOnClose, true); - - connect(removeOneButton, SIGNAL(clicked()), this, SLOT(removeOne())); - connect(removeAllButton, SIGNAL(clicked()), this, SLOT(removeAll())); - - QStringList exList = ReKonfig::walletBlackList(); - Q_FOREACH(const QString & str, exList) - { - QListWidgetItem *item = new QListWidgetItem(str, listWidget); - listWidget->addItem(item); - } -} - - -void PassExWidget::removeOne() -{ - const int currentRow(listWidget->currentRow()); - if (currentRow == -1) - return; - QString item = listWidget->takeItem(currentRow)->text(); - - QStringList exList = ReKonfig::walletBlackList(); - exList.removeOne(item); - ReKonfig::setWalletBlackList(exList); -} - - -void PassExWidget::removeAll() -{ - listWidget->clear(); - - QStringList clearList; - ReKonfig::setWalletBlackList(clearList); -} diff --git a/src/settings/passexceptionswidget.h b/src/settings/passexceptionswidget.h deleted file mode 100644 index 2a538fcc..00000000 --- a/src/settings/passexceptionswidget.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2012 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -#ifndef PASS_EX_WIDGET_H -#define PASS_EX_WIDGET_H - - -// Rekonq Includes -#include "rekonq_defines.h" - -// Ui Includes -#include "ui_password_exceptions.h" - -// Qt Includes -#include - - -class PassExWidget : public QWidget, private Ui::PassExceptions -{ - Q_OBJECT - -public: - explicit PassExWidget(QWidget *parent = 0); - -private Q_SLOTS: - void removeOne(); - void removeAll(); -}; - -#endif // PASS_EX_WIDGET_H diff --git a/src/settings/password_exceptions.ui b/src/settings/password_exceptions.ui deleted file mode 100644 index 97cf621b..00000000 --- a/src/settings/password_exceptions.ui +++ /dev/null @@ -1,55 +0,0 @@ - - - PassExceptions - - - - 0 - 0 - 400 - 300 - - - - Password Exceptions - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Remove one - - - - - - - Remove all - - - - - - - - - - diff --git a/src/settings/privacywidget.cpp b/src/settings/privacywidget.cpp deleted file mode 100644 index f1523ee9..00000000 --- a/src/settings/privacywidget.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2012 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -// Self Includes -#include "privacywidget.h" -#include "privacywidget.moc" - -// Local Includes -#include "passexceptionswidget.h" - -// Auto Includes -#include "rekonq.h" - -// KDE Includes -#include -#include - -// Qt Includes -#include - - -PrivacyWidget::PrivacyWidget(QWidget *parent) - : QWidget(parent) - , _changed(false) -{ - setupUi(this); - - reload(); - - // DO NOT TRACK - KConfigGroup cg = KConfigGroup(KSharedConfig::openConfig("kioslaverc", KConfig::NoGlobals), QString()); - doNotTrackCheckBox->setChecked(cg.readEntry("DoNotTrack", false)); - connect(doNotTrackCheckBox, SIGNAL(clicked()), this, SLOT(hasChanged())); - - // CACHE & COOKIES - connect(cacheButton, SIGNAL(clicked()), this, SLOT(launchCacheSettings())); - connect(cookiesButton, SIGNAL(clicked()), this, SLOT(launchCookieSettings())); - - // PASSWORDS - connect(managePassExceptionsButton, SIGNAL(clicked()), this, SLOT(showPassExceptions())); -} - - -void PrivacyWidget::save() -{ - KConfigGroup cg = KConfigGroup(KSharedConfig::openConfig("kioslaverc", KConfig::NoGlobals), QString()); - cg.writeEntry("DoNotTrack", doNotTrackCheckBox->isChecked()); - cg.sync(); - - reload(); -} - - -void PrivacyWidget::reload() -{ - bool b = ReKonfig::javascriptEnabled(); - - kcfg_javascriptCanAccessClipboard->setEnabled(b); - kcfg_javascriptCanOpenWindows->setEnabled(b); - - if (b) - { - kcfg_javascriptCanOpenWindows->setToolTip(i18n("If enabled, JavaScript programs are allowed to open new windows.")); - kcfg_javascriptCanAccessClipboard->setToolTip(i18n("If enabled, JavaScript programs are allowed to read from and to write to the clipboard.")); - } - else - { - QString str = i18n("Javascript is not enabled, cannot change these settings"); - kcfg_javascriptCanOpenWindows->setToolTip(str); - kcfg_javascriptCanAccessClipboard->setToolTip(str); - } -} - - -bool PrivacyWidget::changed() -{ - return _changed; -} - - -void PrivacyWidget::hasChanged() -{ - _changed = true; - emit changed(true); -} - - -void PrivacyWidget::launchCacheSettings() -{ - QString program = QL1S("kcmshell4"); - QStringList arguments; - arguments << QL1S("cache"); - QProcess *proc = new QProcess(this); - proc->start(program, arguments); -} - - -void PrivacyWidget::launchCookieSettings() -{ - QString program = QL1S("kcmshell4"); - QStringList arguments; - arguments << QL1S("cookies"); - QProcess *proc = new QProcess(this); - proc->start(program, arguments); -} - - -void PrivacyWidget::showPassExceptions() -{ - PassExWidget *widg = new PassExWidget; - widg->show(); -} diff --git a/src/settings/privacywidget.h b/src/settings/privacywidget.h deleted file mode 100644 index 7bbf70b8..00000000 --- a/src/settings/privacywidget.h +++ /dev/null @@ -1,67 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2012 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -#ifndef PRIVACY_WIDGET_H -#define PRIVACY_WIDGET_H - - -// Rekonq Includes -#include "rekonq_defines.h" - -// Ui Includes -#include "ui_settings_privacy.h" - -// Qt Includes -#include - - -class PrivacyWidget : public QWidget, private Ui::privacy -{ - Q_OBJECT - -public: - explicit PrivacyWidget(QWidget *parent = 0); - - void save(); - void reload(); - - bool changed(); - -Q_SIGNALS: - void changed(bool); - -private Q_SLOTS: - void hasChanged(); - - void launchCacheSettings(); - void launchCookieSettings(); - void showPassExceptions(); - -private: - bool _changed; -}; - -#endif // PRIVACY_WIDGET_H diff --git a/src/settings/settings_advanced.ui b/src/settings/settings_advanced.ui deleted file mode 100644 index c34d24d6..00000000 --- a/src/settings/settings_advanced.ui +++ /dev/null @@ -1,245 +0,0 @@ - - - advanced - - - - 0 - 0 - 570 - 473 - - - - - - - Proxy - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Rekonq is using system proxy settings - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 300 - 0 - - - - Change proxy settings - - - - - - - - - - - - - - - Custom Style Sheet - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Path to custom CSS file: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - *.css - - - - - - - - - - Misc - - - - - - Use horizontal scroll wheel to go through web history - - - - - - - Use favicon of the current website as window icon - - - - - - - Scroll pages with an eye candy effect - - - Enable smooth scrolling - - - true - - - - - - - Enable Vi-like navigation shortcuts - - - - - - - Enable keyboard navigation using the Ctrl key - - - - - - - Enable automatic spell checking - - - - - - - - - - 0 - 0 - - - - Middle click should: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - Auto-scroll - - - - - Load Clipboard URL - - - - - Do Nothing - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 189 - - - - - - - - - KUrlRequester - QFrame -
kurlrequester.h
-
-
- - -
diff --git a/src/settings/settings_appearance.ui b/src/settings/settings_appearance.ui deleted file mode 100644 index 0854d799..00000000 --- a/src/settings/settings_appearance.ui +++ /dev/null @@ -1,455 +0,0 @@ - - - appearance - - - - 0 - 0 - 502 - 558 - - - - Appearance - - - - - - Fonts - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Standard font: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Fixed font: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Serif font: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Sans Serif font: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Cursive font: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Fantasy font: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - - - - Font size - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Default font size: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Minimal font size: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 300 - 0 - - - - - - - - - 300 - 0 - - - - - - - - - - - Zoom - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Default page zoom: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - - - - Character Encoding - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Default character encoding: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - - - - Qt::Vertical - - - - 20 - 149 - - - - - - - - - KFontComboBox - KComboBox -
kfontcombobox.h
-
- - KComboBox - QComboBox -
kcombobox.h
-
- - KIntNumInput - QWidget -
knuminput.h
-
-
- - -
diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui deleted file mode 100644 index e0aea007..00000000 --- a/src/settings/settings_general.ui +++ /dev/null @@ -1,274 +0,0 @@ - - - general - - - - 0 - 0 - 573 - 410 - - - - General - - - - - - First settings - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Qt::LeftToRight - - - When starting rekonq: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 150 - 0 - - - - Home page URL: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - true - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - - - Set to Current Page - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - Open the Home Page - - - - - Open the New Tab Page - - - - - Restore the Last Opened Tabs - - - - - Show session dialog - - - - - - - - - - - Downloads Management - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Save files to: - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - - - Always ask me where to save files - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - - - - - Use KGet for downloading files - - - - - - - If enabled, rekonq will display an additional context menu entry, which, when selected, lists all available links of the current website in KGet. - - - List links with KGet - - - - - - - - - - Qt::Vertical - - - - 20 - 179 - - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
- - KLineEdit - QLineEdit -
klineedit.h
-
- - KUrlRequester - QFrame -
kurlrequester.h
-
-
- - -
diff --git a/src/settings/settings_privacy.ui b/src/settings/settings_privacy.ui deleted file mode 100644 index fd0e60ba..00000000 --- a/src/settings/settings_privacy.ui +++ /dev/null @@ -1,284 +0,0 @@ - - - privacy - - - - 0 - 0 - 535 - 520 - - - - - - - JavaScript - - - - - - Let JavaScript open new windows - - - - - - - Let JavaScript access clipboard - - - - - - - - - - Tracking - - - - - - Tell websites you do not want to be tracked - - - - - - - - - - Passwords - - - - - - - 0 - 0 - - - - Remember passwords for sites - - - - - - - - 300 - 0 - - - - Manage Exceptions - - - - - - - - - - Cookies - - - - - - Rekonq is sharing cookies settings with all other KDE applications - - - false - - - - - - - - - - 150 - 0 - - - - Manage Cookies - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - Cache - - - - - - Rekonq is sharing cache settings with all other KDE applications - - - false - - - - - - - - - - 150 - 0 - - - - Manage Cache - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - History - - - - - - - 0 - 0 - - - - Remove history items: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - Never - - - - - Every 3 months - - - - - Every month - - - - - Every day - - - - - At application exit - - - - - Do not even store them - - - - - - - - - - - Qt::Vertical - - - - 20 - 135 - - - - - - - - - diff --git a/src/settings/settings_tabs.ui b/src/settings/settings_tabs.ui deleted file mode 100644 index 6acc06d8..00000000 --- a/src/settings/settings_tabs.ui +++ /dev/null @@ -1,297 +0,0 @@ - - - tabs - - - - 0 - 0 - 483 - 427 - - - - Tabs - - - - - - New Tab Behavior - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - New tab opens: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - true - - - - 0 - 0 - - - - - 300 - 0 - - - - - New Tab Page - - - - - Blank Page - - - - - Home Page - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - New Tab Page starts with: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - true - - - - 0 - 0 - - - - - 300 - 0 - - - - - Favorites - - - - - Bookmarks - - - - - History - - - - - Downloads - - - - - Closed Tabs - - - - - - - - - - - Tabbed Browsing - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - When hovering a tab show: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - true - - - - 0 - 0 - - - - - 300 - 0 - - - - - Tab Preview - - - - - Tab's Title in a Tooltip - - - - - Tab's URL in a Tooltip - - - - - Nothing - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Open as new window when URL is called externally - - - - - - - Closing last tab closes window - - - - - - - Activate previously used tab when closing the current one - - - false - - - - - - - Open new tabs next to current tab - - - - - - - Open new tabs in the foreground - - - - - - - - - - Qt::Vertical - - - - 20 - 120 - - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
-
- - -
diff --git a/src/settings/settings_webkit.ui b/src/settings/settings_webkit.ui deleted file mode 100644 index 69cc0fdf..00000000 --- a/src/settings/settings_webkit.ui +++ /dev/null @@ -1,254 +0,0 @@ - - - webkit - - - - 0 - 0 - 503 - 514 - - - - - - - General - - - - - - - 0 - 0 - - - - Enable JavaScript - - - - - - - Load Java applets - - - - - - - WebGL - - - - - - - Spatial Navigation - - - - - - - Frame Flattening - - - - - - - Prefetch DNS entries - - - - - - - Print element backgrounds - - - - - - - Zoom Text only - - - - - - - - - - true - - - - 0 - 0 - - - - Plugins - - - - - - true - - - - 0 - 0 - - - - - 0 - 0 - - - - When loading web pages: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - Autoload Plugins - - - - - Manually Load Plugins - - - - - Never Load Plugins - - - - - - - - - - - HTML 5 - - - - - - Offline storage database - - - - - - - Offline web application cache - - - - - - - Local Storage - - - - - - - - - - 0 - 0 - - - - Offline web application quota: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 300 - 0 - - - - 0 - - - Kb - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
- - KIntNumInput - QWidget -
knuminput.h
-
-
- - -
diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index 11575f79..e869fe10 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -1,215 +1,29 @@ /* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2008-2012 by Andrea Diamantini -* Copyright (C) 2009-2011 by Lionel Chauvin -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ + * The rekonq project + * ============================================================ + * SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (C) 2008-2012 by Andrea Diamantini + * Copyright (C) 2009-2011 by Lionel Chauvin + * SPDX-License-Identifier: GPL-3.0-only + * Copyright (C) 2022 aqua + * ============================================================ + * Description: Settings Dialog + * ============================================================ */ - -// Self Includes #include "settingsdialog.h" -#include "settingsdialog.moc" - -// Auto Includes -#include "rekonq.h" - -// Local Includes -#include "searchengine.h" - -// Widget Includes -#include "advancedwidget.h" -#include "appearancewidget.h" -#include "generalwidget.h" -#include "privacywidget.h" -#include "tabswidget.h" -#include "webkitwidget.h" - -// KDE Includes -#include -#include -#include -#include -#include - -// Qt Includes -#include - - -class Private -{ -private: - Private(SettingsDialog *parent); - -private: - GeneralWidget *generalWidg; - TabsWidget *tabsWidg; - AppearanceWidget *appearanceWidg; - WebKitWidget *webkitWidg; - PrivacyWidget *privacyWidg; - AdvancedWidget *advancedWidg; - - KCModuleProxy *ebrowsingModule; - - friend class SettingsDialog; -}; +#include "settingswidgets.hpp" +#include "ui_settingsdialog.h" - -Private::Private(SettingsDialog *parent) +SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SettingsDialog) { - KPageWidgetItem *pageItem; - - // -- 1 - generalWidg = new GeneralWidget(parent); - generalWidg->layout()->setMargin(0); - pageItem = parent->addPage(generalWidg, i18n("General")); - pageItem->setIcon(KIcon("rekonq")); - - // -- 2 - tabsWidg = new TabsWidget(parent); - tabsWidg->layout()->setMargin(0); - pageItem = parent->addPage(tabsWidg, i18n("Tabs")); - pageItem->setIcon(KIcon("tab-duplicate")); - - // -- 3 - appearanceWidg = new AppearanceWidget(parent); - appearanceWidg->layout()->setMargin(0); - pageItem = parent->addPage(appearanceWidg, i18n("Appearance")); - pageItem->setIcon(KIcon("preferences-desktop-font")); - - // -- 4 - webkitWidg = new WebKitWidget(parent); - webkitWidg->layout()->setMargin(0); - pageItem = parent->addPage(webkitWidg, i18n("WebKit")); - QString webkitIconPath = KStandardDirs::locate("appdata", "pics/webkit-icon.png"); - KIcon webkitIcon = KIcon(QIcon(webkitIconPath)); - pageItem->setIcon(webkitIcon); - - // -- 5 - privacyWidg = new PrivacyWidget(parent); - privacyWidg->layout()->setMargin(0); - pageItem = parent->addPage(privacyWidg, i18n("Privacy")); - pageItem->setIcon(KIcon("view-media-artist")); + ui->setupUi(this); - // -- 6 - advancedWidg = new AdvancedWidget(parent); - advancedWidg->layout()->setMargin(0); - pageItem = parent->addPage(advancedWidg, i18n("Advanced")); - pageItem->setIcon(KIcon("applications-system")); + ui->stackedWidget->addWidget(new GeneralSettingsWidget); + ui->stackedWidget->addWidget(new AppearanceSettingsWidget); + ui->stackedWidget->addWidget(new NetworkSettingsWidget); + ui->stackedWidget->addWidget(new ShortcutsSettingsWidget); - // -- 7 - KCModuleInfo ebrowsingInfo("ebrowsing.desktop"); - ebrowsingModule = new KCModuleProxy(ebrowsingInfo, parent); - pageItem = parent->addPage(ebrowsingModule, i18n("Search Engines")); - KIcon wsIcon("edit-web-search"); - if (wsIcon.isNull()) - { - wsIcon = KIcon("preferences-web-browser-shortcuts"); - } - pageItem->setIcon(wsIcon); - - // WARNING - // remember wheh changing here that the smallest netbooks - // have a 1024x576 resolution. So DON'T bother that limits!! - parent->setMinimumSize(700, 525); + connect(ui->listWidget, &QListWidget::currentRowChanged, ui->stackedWidget, &QStackedWidget::setCurrentIndex); } - -// ----------------------------------------------------------------------------------------------------- - - -SettingsDialog::SettingsDialog(QWidget *parent) - : KConfigDialog(parent, "rekonfig", ReKonfig::self()) - , d(new Private(this)) -{ - showButtonSeparator(false); - setWindowTitle(i18nc("Window title of the settings dialog", "Configure – rekonq")); - - // update buttons - connect(d->generalWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->tabsWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->appearanceWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->webkitWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->ebrowsingModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->advancedWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->privacyWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - - // save settings - connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings())); - connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings())); - setHelp("Config-rekonq", "rekonq"); -} - - -SettingsDialog::~SettingsDialog() -{ - kDebug() << "bye bye settings..."; - delete d; -} - - -// we need this function to SAVE settings in rc file.. -void SettingsDialog::saveSettings() -{ - ReKonfig::self()->writeConfig(); - - d->generalWidg->save(); - d->tabsWidg->save(); - d->appearanceWidg->save(); - d->webkitWidg->save(); - d->advancedWidg->save(); - d->privacyWidg->save(); - d->ebrowsingModule->save(); - - d->privacyWidg->reload(); - - SearchEngine::reload(); - - updateButtons(); - emit settingsChanged("ReKonfig"); -} - - -bool SettingsDialog::hasChanged() -{ - return KConfigDialog::hasChanged() - || d->generalWidg->changed() - || d->tabsWidg->changed() - || d->appearanceWidg->changed() - || d->webkitWidg->changed() - || d->advancedWidg->changed() - || d->privacyWidg->changed() - || d->ebrowsingModule->changed() - ; -} - - -bool SettingsDialog::isDefault() -{ - bool isDef = KConfigDialog::isDefault(); - - if (isDef) - { - // check our private widget values - isDef = d->appearanceWidg->isDefault(); - } - return isDef; -} +SettingsDialog::~SettingsDialog() { delete ui; } diff --git a/src/settings/settingsdialog.h b/src/settings/settingsdialog.h index ed05cf27..3f191e1e 100644 --- a/src/settings/settingsdialog.h +++ b/src/settings/settingsdialog.h @@ -1,63 +1,29 @@ /* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2008-2012 by Andrea Diamantini -* Copyright (C) 2009-2011 by Lionel Chauvin -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -#ifndef SETTINGS_DIALOG_H -#define SETTINGS_DIALOG_H - - -// Rekonq Includes -#include "rekonq_defines.h" - -// KDE Includes -#include - -// Forward Declarations -class QWidget; -class Private; - - -class REKONQ_TESTS_EXPORT SettingsDialog : public KConfigDialog -{ - Q_OBJECT + * The rekonq project + * ============================================================ + * SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (C) 2008-2012 by Andrea Diamantini + * Copyright (C) 2009-2011 by Lionel Chauvin + * SPDX-License-Identifier: GPL-3.0-only + * Copyright (C) 2022 aqua + * ============================================================ + * Description: Settings Dialog + * ============================================================ */ + +#pragma once + +#include + +namespace Ui { +class SettingsDialog; +} +class SettingsDialog : public QDialog { + Q_OBJECT public: - explicit SettingsDialog(QWidget *parent = 0); - ~SettingsDialog(); - - virtual bool hasChanged(); - -protected: - virtual bool isDefault(); + explicit SettingsDialog(QWidget *parent = nullptr); + ~SettingsDialog() override; private: - Private* const d; - -private Q_SLOTS: - void saveSettings(); + Ui::SettingsDialog *ui; }; - -#endif // SETTINGS_DIALOG_H diff --git a/src/settings/settingsdialog.ui b/src/settings/settingsdialog.ui new file mode 100644 index 00000000..1c19380d --- /dev/null +++ b/src/settings/settingsdialog.ui @@ -0,0 +1,122 @@ + + + SettingsDialog + + + + 0 + 0 + 800 + 600 + + + + Settings + + + + + + + + + 256 + 16777215 + + + + QAbstractItemView::NoEditTriggers + + + true + + + Qt::AlignVCenter + + + + General + + + AlignCenter + + + + + Appearance + + + AlignCenter + + + + + Network + + + AlignCenter + + + + + Shortcuts + + + AlignCenter + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::RestoreDefaults|QDialogButtonBox::Save + + + + + + + + + buttonBox + accepted() + SettingsDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + SettingsDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/settings/settingswidgets.hpp b/src/settings/settingswidgets.hpp new file mode 100644 index 00000000..31cd4580 --- /dev/null +++ b/src/settings/settingswidgets.hpp @@ -0,0 +1,65 @@ +/* ============================================================ + * The rekonq project + * ============================================================ + * SPDX-License-Identifier: GPL-3.0-only + * Copyright (C) 2022 aqua + * ============================================================ + * Description: Settings Widgets Definitions + * ============================================================ */ + +#pragma once + +#include + +class SettingsWidget : public QWidget { + Q_OBJECT + +public: + explicit SettingsWidget(QWidget *parent = nullptr) : QWidget(parent) {} + +signals: + void changed(); +public slots: + virtual void save() = 0; + virtual void reset() = 0; +}; + +class GeneralSettingsWidget final : public SettingsWidget { + Q_OBJECT +public: + explicit GeneralSettingsWidget(QWidget *parent = nullptr); + +public slots: + void save() override; + void reset() override; +}; + +class AppearanceSettingsWidget final : public SettingsWidget { + Q_OBJECT +public: + explicit AppearanceSettingsWidget(QWidget *parent = nullptr); + +public slots: + void save() override; + void reset() override; +}; + +class NetworkSettingsWidget final : public SettingsWidget { + Q_OBJECT +public: + explicit NetworkSettingsWidget(QWidget *parent = nullptr); + +public slots: + void save() override; + void reset() override; +}; + +class ShortcutsSettingsWidget final : public SettingsWidget { + Q_OBJECT +public: + explicit ShortcutsSettingsWidget(QWidget *parent = nullptr); + +public slots: + void save() override; + void reset() override; +}; diff --git a/src/settings/tabswidget.cpp b/src/settings/tabswidget.cpp deleted file mode 100644 index 67829f82..00000000 --- a/src/settings/tabswidget.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2010-2011 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -// Local Includes -#include "tabswidget.h" -#include "tabswidget.moc" - - -TabsWidget::TabsWidget(QWidget *parent) - : QWidget(parent) - , _changed(false) -{ - setupUi(this); -} - - -void TabsWidget::save() -{ -} - -bool TabsWidget::changed() -{ - return _changed; -} - - -void TabsWidget::hasChanged() -{ -} diff --git a/src/settings/tabswidget.h b/src/settings/tabswidget.h deleted file mode 100644 index 786f95f9..00000000 --- a/src/settings/tabswidget.h +++ /dev/null @@ -1,58 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2010-2011 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -#ifndef TABS_WIDGET_H -#define TABS_WIDGET_H - - -// Ui Includes -#include "ui_settings_tabs.h" - -// Qt Includes -#include - - -class TabsWidget : public QWidget, private Ui::tabs -{ - Q_OBJECT - -public: - explicit TabsWidget(QWidget *parent = 0); - - void save(); - bool changed(); - -Q_SIGNALS: - void changed(bool); - -private Q_SLOTS: - void hasChanged(); - -private: - bool _changed; -}; - -#endif // TABS_WIDGET_H diff --git a/src/settings/test/dialog.cpp b/src/settings/test/dialog.cpp new file mode 100644 index 00000000..2bc9ffe0 --- /dev/null +++ b/src/settings/test/dialog.cpp @@ -0,0 +1,12 @@ +#include "../settingsdialog.h" +#include + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + SettingsDialog dlg; + dlg.show(); + + return QApplication::exec(); +} \ No newline at end of file diff --git a/src/settings/test/fonts.cpp b/src/settings/test/fonts.cpp new file mode 100644 index 00000000..65cc7229 --- /dev/null +++ b/src/settings/test/fonts.cpp @@ -0,0 +1,31 @@ +#include "../helpers.hpp" +#include +#include +#include +#include + +TEST(Settings, getFont) +{ + const auto serif = getFont(QFont::Serif); + EXPECT_EQ(serif.styleHint(), QFont::Serif) << qUtf8Printable(serif.toString()); + + const auto fixed = getFont(QFont::Monospace); + EXPECT_EQ(fixed.styleHint(), QFont::Monospace) << qUtf8Printable(fixed.toString()); +} + +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + + // handling fonts requires a QGuiApplication + // The proper platform name needs to be added to the argument list before the QGuiApplication constructor is called + // This needs to be done here for gtest_discover_tests to work + QList args; + for (int i = 0; i < argc; ++i) args.append(argv[i]); + args.append({"-platform", "offscreen"}); + int args_count = args.count(); + + QGuiApplication app(args_count, args.data()); + + return RUN_ALL_TESTS(); +} diff --git a/src/settings/webkitwidget.cpp b/src/settings/webkitwidget.cpp deleted file mode 100644 index 31224f05..00000000 --- a/src/settings/webkitwidget.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2010-2011 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -// Local Includes -#include "webkitwidget.h" -#include "webkitwidget.moc" - - -WebKitWidget::WebKitWidget(QWidget *parent) - : QWidget(parent) - , _changed(false) -{ - setupUi(this); - setWebSettingsToolTips(); -} - - -void WebKitWidget::save() -{ -} - - -bool WebKitWidget::changed() -{ - return _changed; -} - - -void WebKitWidget::hasChanged() -{ - _changed = true; - emit changed(true); -} - - -void WebKitWidget::setWebSettingsToolTips() -{ - kcfg_webGL->setToolTip(i18n("Enables WebGL technology")); - kcfg_spatialNavigation->setToolTip(i18n("Lets you navigating between focusable elements using arrow keys.")); - kcfg_frameFlattening->setToolTip(i18n("Flatten all the frames to become one scrollable page.")); - kcfg_dnsPrefetch->setToolTip(i18n("Specifies whether WebKit will try to prefetch DNS entries to speed up browsing.")); - kcfg_printElementBackgrounds->setToolTip(i18n("If enabled, background colors and images are also drawn when the page is printed.")); - kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs.")); - kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets.")); - kcfg_offlineStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 offline storage feature.")); - kcfg_offlineWebApplicationCacheEnabled->setToolTip(i18n("Enables support for the HTML 5 web application cache feature.")); - kcfg_localStorageEnabled->setToolTip(i18n("Enables support for the HTML 5 local storage feature.")); -} diff --git a/src/settings/webkitwidget.h b/src/settings/webkitwidget.h deleted file mode 100644 index 16653813..00000000 --- a/src/settings/webkitwidget.h +++ /dev/null @@ -1,60 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2010-2011 by Andrea Diamantini -* -* -* This program 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 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program 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 this program. If not, see . -* -* ============================================================ */ - - -#ifndef WEBKIT_WIDGET_H -#define WEBKIT_WIDGET_H - - -// Ui Includes -#include "ui_settings_webkit.h" - -// Qt Includes -#include - - -class WebKitWidget : public QWidget, private Ui::webkit -{ - Q_OBJECT - -public: - explicit WebKitWidget(QWidget *parent = 0); - - void save(); - bool changed(); - -Q_SIGNALS: - void changed(bool); - -private Q_SLOTS: - void hasChanged(); - -private: - void setWebSettingsToolTips(); - - bool _changed; -}; - -#endif // WEBKIT_WIDGET_H -- cgit v1.2.1