diff options
author | aqua <aqua@iserlohn-fortress.net> | 2022-08-19 21:20:26 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2022-08-28 09:47:51 +0300 |
commit | aae82179bc5f04b4361c57f9a1073ff3af6899c4 (patch) | |
tree | 7c5728b70c74497e50c9d078f09f2ec742c6dd50 /src/settings/settingsdialog.cpp | |
parent | Add parseCommandLine tests (diff) | |
download | rekonq-aae82179bc5f04b4361c57f9a1073ff3af6899c4.tar.xz |
Add rekonf script to generate SettingsWidgets
- generate General Settings
- generate Appearance Settings
- removed previous settings widgets
Diffstat (limited to 'src/settings/settingsdialog.cpp')
-rw-r--r-- | src/settings/settingsdialog.cpp | 226 |
1 files changed, 20 insertions, 206 deletions
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 <adjam7 at gmail dot com> -* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr> -* -* -* 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 <http://www.gnu.org/licenses/>. -* -* ============================================================ */ + * The rekonq project + * ============================================================ + * SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com> + * Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr> + * SPDX-License-Identifier: GPL-3.0-only + * Copyright (C) 2022 aqua <aqua@iserlohn-fortress.net> + * ============================================================ + * 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 <KConfig> -#include <KStandardDirs> -#include <KPageWidgetItem> -#include <KCModuleInfo> -#include <KCModuleProxy> - -// Qt Includes -#include <QtGui/QWidget> - - -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; } |