diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-05-24 10:51:13 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-05-24 10:51:13 +0200 |
commit | 26a44960973ef75995212417b69774a308cd869f (patch) | |
tree | 07ce4c6777fc5cb575f0bc07e8239d9a56bd54c2 /src | |
parent | Merge branch 'master' of gitorious.org:rekonq/mainline (diff) | |
parent | Improving fonts situation (diff) | |
download | rekonq-26a44960973ef75995212417b69774a308cd869f.tar.xz |
Merge branch 'NewSettings'
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/application.cpp | 51 | ||||
-rw-r--r-- | src/rekonq.kcfg | 13 | ||||
-rw-r--r-- | src/settings/adblockwidget.h | 4 | ||||
-rw-r--r-- | src/settings/appearancewidget.cpp | 55 | ||||
-rw-r--r-- | src/settings/appearancewidget.h | 58 | ||||
-rw-r--r-- | src/settings/generalwidget.cpp | 85 | ||||
-rw-r--r-- | src/settings/generalwidget.h | 60 | ||||
-rw-r--r-- | src/settings/settings_appearance.ui (renamed from src/settings/settings_fonts.ui) | 170 | ||||
-rw-r--r-- | src/settings/settings_general.ui | 23 | ||||
-rw-r--r-- | src/settings/settings_webkit.ui | 41 | ||||
-rw-r--r-- | src/settings/settingsdialog.cpp | 149 | ||||
-rw-r--r-- | src/settings/settingsdialog.h | 4 | ||||
-rw-r--r-- | src/settings/tabswidget.cpp | 53 | ||||
-rw-r--r-- | src/settings/tabswidget.h | 58 | ||||
-rw-r--r-- | src/settings/webkitwidget.cpp | 71 | ||||
-rw-r--r-- | src/settings/webkitwidget.h | 60 |
17 files changed, 720 insertions, 241 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b79e64fa..d0e5721c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -37,6 +37,10 @@ SET( rekonq_KDEINIT_SRCS #---------------------------------------- settings/settingsdialog.cpp settings/adblockwidget.cpp + settings/appearancewidget.cpp + settings/generalwidget.cpp + settings/tabswidget.cpp + settings/webkitwidget.cpp settings/networkwidget.cpp #---------------------------------------- bookmarks/bookmarksmanager.cpp @@ -64,7 +68,7 @@ SET( rekonq_KDEINIT_SRCS KDE4_ADD_UI_FILES( rekonq_KDEINIT_SRCS settings/settings_general.ui settings/settings_tabs.ui - settings/settings_fonts.ui + settings/settings_appearance.ui settings/settings_webkit.ui settings/settings_adblock.ui cleardata.ui diff --git a/src/application.cpp b/src/application.cpp index 412999d8..556c3cf8 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -415,34 +415,45 @@ void Application::newWindow() void Application::updateConfiguration() { - // FIXME: - // all things related to mainview can be - // improved/moved/replicated in all the mainwindows - MainView *view = mainWindow()->mainView(); - - // ============== General ================== - view->updateTabBar(); - // ============== Tabs ================== - if (ReKonfig::closeTabSelectPrevious()) - view->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); - else - view->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectRightTab); + bool b = ReKonfig::closeTabSelectPrevious(); + Q_FOREACH(const QWeakPointer<MainWindow> &w, m_mainWindows) + { + MainView *mv = w.data()->mainView(); + mv->updateTabBar(); + + if (b) + mv->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); + else + mv->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectRightTab); + } + QWebSettings *defaultSettings = QWebSettings::globalSettings(); + // =========== Fonts ============== - QWebSettings *defaultSettings = QWebSettings::globalSettings(); - - int fnSize = ReKonfig::fontSize(); - int minFnSize = ReKonfig::minFontSize(); - QFont standardFont = ReKonfig::standardFont(); + kDebug() << "STANDARD FONT" << standardFont.pixelSize(); defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFontSize, fnSize); - defaultSettings->setFontSize(QWebSettings::MinimumFontSize, minFnSize); + defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize()); QFont fixedFont = ReKonfig::fixedFont(); defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fnSize); + defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize()); + + QFont serifFont = ReKonfig::serifFont(); + defaultSettings->setFontFamily(QWebSettings::SerifFont, serifFont.family()); + + QFont sansSerifFont = ReKonfig::sansSerifFont(); + defaultSettings->setFontFamily(QWebSettings::SansSerifFont, sansSerifFont.family()); + + QFont cursiveFont = ReKonfig::cursiveFont(); + defaultSettings->setFontFamily(QWebSettings::FixedFont, cursiveFont.family()); + + QFont fantasyFont = ReKonfig::fantasyFont(); + defaultSettings->setFontFamily(QWebSettings::FantasyFont, fantasyFont.family()); + + int minimumFontSize = ReKonfig::minFontSize(); + defaultSettings->setFontSize(QWebSettings::MinimumFontSize, minimumFontSize); // ================ WebKit ============================ defaultSettings->setAttribute(QWebSettings::AutoLoadImages, ReKonfig::autoLoadImages()); diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 6769b4f5..07c079a5 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -106,8 +106,17 @@ <entry name="fixedFont" type="Font"> <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::FixedFont))</default> </entry> - <entry name="fontSize" type="Int"> - <default>16</default> + <entry name="serifFont" type="Font"> + <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::SerifFont))</default> + </entry> + <entry name="sansSerifFont" type="Font"> + <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::SansSerifFont))</default> + </entry> + <entry name="cursiveFont" type="Font"> + <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::CursiveFont))</default> + </entry> + <entry name="fantasyFont" type="Font"> + <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::FantasyFont))</default> </entry> <entry name="minFontSize" type="Int"> <default>8</default> diff --git a/src/settings/adblockwidget.h b/src/settings/adblockwidget.h index 1ed9aaa6..38a02636 100644 --- a/src/settings/adblockwidget.h +++ b/src/settings/adblockwidget.h @@ -32,8 +32,8 @@ #include "ui_settings_adblock.h" // Qt Includes -#include <QWidget> -#include <QTreeWidgetItem> +#include <QtGui/QWidget> +#include <QtGui/QTreeWidgetItem> class AdBlockWidget : public QWidget, private Ui::adblock diff --git a/src/settings/appearancewidget.cpp b/src/settings/appearancewidget.cpp new file mode 100644 index 00000000..875b67d2 --- /dev/null +++ b/src/settings/appearancewidget.cpp @@ -0,0 +1,55 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* 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/>. +* +* ============================================================ */ + + +// Self Includes +#include "appearancewidget.h" +#include "appearancewidget.moc" + + +AppearanceWidget::AppearanceWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); + +// kcfg_fixedFont->setOnlyFixed(true); +} + + +void AppearanceWidget::save() +{ +} + + +bool AppearanceWidget::changed() +{ + return _changed; +} + + +void AppearanceWidget::hasChanged() +{ +} diff --git a/src/settings/appearancewidget.h b/src/settings/appearancewidget.h new file mode 100644 index 00000000..0e400031 --- /dev/null +++ b/src/settings/appearancewidget.h @@ -0,0 +1,58 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* 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/>. +* +* ============================================================ */ + + +#ifndef APPEARANCE_WIDGET_H +#define APPEARANCE_WIDGET_H + + +// Ui Includes +#include "ui_settings_appearance.h" + +// Qt Includes +#include <QtGui/QWidget> + + +class AppearanceWidget : public QWidget, private Ui::appearance +{ + Q_OBJECT + +public: + AppearanceWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + +private: + bool _changed; +}; + +#endif // APPEARANCE_WIDGET_H diff --git a/src/settings/generalwidget.cpp b/src/settings/generalwidget.cpp new file mode 100644 index 00000000..fc2d4d5d --- /dev/null +++ b/src/settings/generalwidget.cpp @@ -0,0 +1,85 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* 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/>. +* +* ============================================================ */ + + +// Self Includes +#include "generalwidget.h" +#include "generalwidget.moc" + +// Auto Includes +#include "rekonq.h" + +// Local Includes +#include "application.h" +#include "mainwindow.h" +#include "webtab.h" + + +GeneralWidget::GeneralWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); + + connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage())); + + disableHomeSettings(ReKonfig::useNewTabPage()); + + connect(kcfg_useNewTabPage, SIGNAL(toggled(bool)), this, SLOT(disableHomeSettings(bool))); +} + + +void GeneralWidget::save() +{ +} + + +bool GeneralWidget::changed() +{ + return _changed; +} + + +void GeneralWidget::hasChanged() +{ +} + + +void GeneralWidget::setHomeToCurrentPage() +{ + MainWindow *mw = qobject_cast<MainWindow*>(parent()); + WebTab *webTab = mw->currentTab(); + if (webTab) + { + kcfg_homePage->setText(webTab->url().prettyUrl()); + } +} + + +void GeneralWidget::disableHomeSettings(bool b) +{ + kcfg_homePage->setEnabled(!b); + setHomeToCurrentPageButton->setEnabled(!b); +} diff --git a/src/settings/generalwidget.h b/src/settings/generalwidget.h new file mode 100644 index 00000000..d669fd04 --- /dev/null +++ b/src/settings/generalwidget.h @@ -0,0 +1,60 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* 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/>. +* +* ============================================================ */ + + +#ifndef GENERAL_WIDGET_H +#define GENERAL_WIDGET_H + + +// Ui Includes +#include "ui_settings_general.h" + +// Qt Includes +#include <QtGui/QWidget> + + +class GeneralWidget : public QWidget, private Ui::general +{ + Q_OBJECT + +public: + GeneralWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + void setHomeToCurrentPage(); + void disableHomeSettings(bool); + +private: + bool _changed; +}; + +#endif // GENERAL_WIDGET_H diff --git a/src/settings/settings_fonts.ui b/src/settings/settings_appearance.ui index 52c7872e..b564033c 100644 --- a/src/settings/settings_fonts.ui +++ b/src/settings/settings_appearance.ui @@ -1,25 +1,25 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>fonts</class> - <widget class="QWidget" name="fonts"> + <class>appearance</class> + <widget class="QWidget" name="appearance"> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>414</width> - <height>298</height> + <width>454</width> + <height>371</height> </rect> </property> <property name="windowTitle"> <string>Appearance</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> + <layout class="QVBoxLayout" name="verticalLayout_2"> <item> <widget class="QGroupBox" name="groupBox"> <property name="title"> <string>Fonts</string> </property> - <layout class="QFormLayout" name="formLayout"> + <layout class="QGridLayout" name="gridLayout"> <item row="0" column="0"> <widget class="QLabel" name="label"> <property name="sizePolicy"> @@ -43,14 +43,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="KFontComboBox" name="kcfg_standardFont"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> + <widget class="KFontRequester" name="kcfg_standardFont"/> </item> <item row="1" column="0"> <widget class="QLabel" name="label_2"> @@ -75,26 +68,10 @@ </widget> </item> <item row="1" column="1"> - <widget class="KFontComboBox" name="kcfg_fixedFont"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> + <widget class="KFontRequester" name="kcfg_fixedFont"/> </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>Dimension</string> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label_3"> + <item row="6" column="0"> + <widget class="QLabel" name="label_4"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -108,31 +85,79 @@ </size> </property> <property name="text"> - <string>Font size:</string> + <string>Minimal font size:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="kcfg_fontSize"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item row="6" column="1"> + <widget class="KIntNumInput" name="kcfg_minFontSize"/> + </item> + <item row="2" column="1"> + <widget class="KFontRequester" name="kcfg_serifFont"/> + </item> + <item row="3" column="1"> + <widget class="KFontRequester" name="kcfg_sansSerifFont"/> + </item> + <item row="4" column="1"> + <widget class="KFontRequester" name="kcfg_cursiveFont"/> + </item> + <item row="5" column="1"> + <widget class="KFontRequester" name="kcfg_fantasyFont"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Serif font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item row="3" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>Sans Serif font:</string> </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Cursive font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Fantasy font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_3"> + <property name="title"> + <string>User Style Sheet</string> + </property> + <layout class="QFormLayout" name="formLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> <property name="minimumSize"> <size> <width>150</width> @@ -140,20 +165,36 @@ </size> </property> <property name="text"> - <string>Minimal font size:</string> + <string>User CSS path:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="kcfg_minFontSize"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item row="0" column="1"> + <widget class="KUrlRequester" name="kcfg_userCSS"> + <property name="filter"> + <string>*.css</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_5"> + <property name="title"> + <string>Misc</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QCheckBox" name="kcfg_disableAutoScroll"> + <property name="toolTip"> + <string>Disable automatic scrolling on middle click in a web page</string> + </property> + <property name="text"> + <string>Disable auto scrolling</string> </property> </widget> </item> @@ -177,14 +218,19 @@ </widget> <customwidgets> <customwidget> - <class>KFontComboBox</class> - <extends>KComboBox</extends> - <header>kfontcombobox.h</header> + <class>KUrlRequester</class> + <extends>QFrame</extends> + <header>kurlrequester.h</header> + </customwidget> + <customwidget> + <class>KFontRequester</class> + <extends>QWidget</extends> + <header>kfontrequester.h</header> </customwidget> <customwidget> - <class>KComboBox</class> - <extends>QComboBox</extends> - <header>kcombobox.h</header> + <class>KIntNumInput</class> + <extends>QWidget</extends> + <header>knuminput.h</header> </customwidget> </customwidgets> <resources/> diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui index c0060d76..63ab933c 100644 --- a/src/settings/settings_general.ui +++ b/src/settings/settings_general.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>552</width> - <height>512</height> + <width>464</width> + <height>462</height> </rect> </property> <property name="windowTitle"> @@ -244,25 +244,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_5"> - <property name="title"> - <string>Navigation</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QCheckBox" name="kcfg_disableAutoScroll"> - <property name="toolTip"> - <string>Disable automatic scrolling on middle click in a web page</string> - </property> - <property name="text"> - <string>Disable auto scrolling</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> diff --git a/src/settings/settings_webkit.ui b/src/settings/settings_webkit.ui index e87e3fec..58fbe459 100644 --- a/src/settings/settings_webkit.ui +++ b/src/settings/settings_webkit.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>643</width> - <height>560</height> + <width>480</width> + <height>377</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout"> @@ -192,38 +192,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>User Style Sheet</string> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>User CSS path:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="KUrlRequester" name="kcfg_userCSS"> - <property name="filter"> - <string>*.css</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -240,11 +208,6 @@ </widget> <customwidgets> <customwidget> - <class>KUrlRequester</class> - <extends>QFrame</extends> - <header>kurlrequester.h</header> - </customwidget> - <customwidget> <class>KComboBox</class> <extends>QComboBox</extends> <header>kcombobox.h</header> diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index 3f701c5b..27d40467 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -36,15 +36,15 @@ #include "application.h" #include "mainwindow.h" #include "webtab.h" -#include "adblockwidget.h" -#include "networkwidget.h" #include "searchengine.h" -//Ui Includes -#include "ui_settings_general.h" -#include "ui_settings_tabs.h" -#include "ui_settings_fonts.h" -#include "ui_settings_webkit.h" +// Widget Includes +#include "adblockwidget.h" +#include "networkwidget.h" +#include "generalwidget.h" +#include "appearancewidget.h" +#include "webkitwidget.h" +#include "tabswidget.h" // KDE Includes #include <KConfig> @@ -61,76 +61,79 @@ class Private { private: + Private(SettingsDialog *parent); - Ui::general generalUi; - Ui::tabs tabsUi; - Ui::fonts fontsUi; - Ui::webkit webkitUi; - - AdBlockWidget *adBlockWidg; +private: + GeneralWidget *generalWidg; + TabsWidget *tabsWidg; + AppearanceWidget *appearanceWidg; + WebKitWidget *webkitWidg; NetworkWidget *networkWidg; - + AdBlockWidget *adBlockWidg; + KCModuleProxy *ebrowsingModule; KShortcutsEditor *shortcutsEditor; - Private(SettingsDialog *parent); - friend class SettingsDialog; }; Private::Private(SettingsDialog *parent) { - QWidget *widget; KPageWidgetItem *pageItem; - widget = new QWidget; - generalUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("General")); + // -- 1 + generalWidg = new GeneralWidget(parent); + generalWidg->layout()->setMargin(0); + pageItem = parent->addPage(generalWidg, i18n("General")); pageItem->setIcon(KIcon("rekonq")); - widget = new QWidget; - tabsUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("Tabs")); + // -- 2 + tabsWidg = new TabsWidget(parent); + tabsWidg->layout()->setMargin(0); + pageItem = parent->addPage(tabsWidg, i18n("Tabs")); pageItem->setIcon(KIcon("tab-duplicate")); - - widget = new QWidget; - fontsUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("Fonts")); + + // -- 3 + appearanceWidg = new AppearanceWidget(parent); + appearanceWidg->layout()->setMargin(0); + pageItem = parent->addPage(appearanceWidg, i18n("Appearance")); pageItem->setIcon(KIcon("preferences-desktop-font")); - - widget = new QWidget; - webkitUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("WebKit")); + + // -- 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 networkWidg = new NetworkWidget(parent); networkWidg->layout()->setMargin(0); pageItem = parent->addPage(networkWidg , i18n("Network")); pageItem->setIcon(KIcon("preferences-system-network")); + // -- 6 adBlockWidg = new AdBlockWidget(parent); adBlockWidg->layout()->setMargin(0); pageItem = parent->addPage(adBlockWidg , i18n("Ad Block")); pageItem->setIcon(KIcon("preferences-web-browser-adblock")); + // -- 7 shortcutsEditor = new KShortcutsEditor(Application::instance()->mainWindow()->actionCollection(), parent); pageItem = parent->addPage(shortcutsEditor , i18n("Shortcuts")); pageItem->setIcon(KIcon("configure-shortcuts")); + // -- 8 KCModuleInfo ebrowsingInfo("ebrowsing.desktop"); ebrowsingModule = new KCModuleProxy(ebrowsingInfo, parent); pageItem = parent->addPage(ebrowsingModule, i18n(ebrowsingInfo.moduleName().toLocal8Bit())); pageItem->setIcon(KIcon(ebrowsingInfo.icon())); - // WARNING remember wheh changing here that the smallest netbooks + // WARNING + // remember wheh changing here that the smallest netbooks // have a 1024x576 resolution. So DON'T bother that limits!! parent->setMinimumSize(700, 525); } @@ -148,25 +151,20 @@ SettingsDialog::SettingsDialog(QWidget *parent) setModal(true); readConfig(); - - connect(d->generalUi.setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage())); - - // new tab page - disableHomeSettings(ReKonfig::useNewTabPage()); - connect(d->generalUi.kcfg_useNewTabPage, SIGNAL(toggled(bool)), this, SLOT(disableHomeSettings(bool))); // update buttons - connect(d->adBlockWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + 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->networkWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); + connect(d->adBlockWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); connect(d->ebrowsingModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->shortcutsEditor, SIGNAL(keyChange()), this, SLOT(updateButtons())); // save settings connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings())); connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings())); - - setWebSettingsToolTips(); } @@ -176,29 +174,9 @@ SettingsDialog::~SettingsDialog() } -void SettingsDialog::setWebSettingsToolTips() -{ - d->webkitUi.kcfg_autoLoadImages->setToolTip(i18n("Specifies whether images are automatically loaded in web pages.")); - d->webkitUi.kcfg_dnsPrefetch->setToolTip(i18n("Specifies whether WebKit will try to prefetch DNS entries to speed up browsing.")); - d->webkitUi.kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs.")); - d->webkitUi.kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets.")); - d->webkitUi.kcfg_pluginsEnabled->setToolTip(i18n("Enables support for plugins in web pages.")); - d->webkitUi.kcfg_javascriptCanOpenWindows->setToolTip(i18n("If enabled, JavaScript programs are allowed to open new windows.")); - d->webkitUi.kcfg_javascriptCanAccessClipboard->setToolTip(i18n("If enabled, JavaScript programs are allowed to read from and to write to the clipboard.")); - d->webkitUi.kcfg_linksIncludedInFocusChain->setToolTip(i18n("If enabled, hyperlinks are included in the keyboard focus chain.")); - d->webkitUi.kcfg_zoomTextOnly->setToolTip(i18n("If enabled, the zoom factor on a frame is only applied to the text.")); - d->webkitUi.kcfg_printElementBackgrounds->setToolTip(i18n("If enabled, background colors and images are also drawn when the page is printed.")); - d->webkitUi.kcfg_offlineStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 offline storage feature.")); - d->webkitUi.kcfg_offlineWebApplicationCacheEnabled->setToolTip(i18n("Enables support for the HTML 5 web application cache feature.")); - d->webkitUi.kcfg_localStorageEnabled->setToolTip(i18n("Enables support for the HTML 5 local storage feature.")); -} - - // we need this function to UPDATE the config widget data.. void SettingsDialog::readConfig() { - // ======= Fonts - d->fontsUi.kcfg_fixedFont->setOnlyFixed(true); } @@ -209,15 +187,20 @@ void SettingsDialog::saveSettings() return; ReKonfig::self()->writeConfig(); - d->ebrowsingModule->save(); - d->shortcutsEditor->save(); - d->adBlockWidg->save(); + + d->generalWidg->save(); + d->tabsWidg->save(); + d->appearanceWidg->save(); + d->webkitWidg->save(); d->networkWidg->save(); + d->adBlockWidg->save(); + d->shortcutsEditor->save(); + d->ebrowsingModule->save(); + SearchEngine::loadDefaultWS(); SearchEngine::loadDelimiter(); SearchEngine::loadFavorites(); - updateButtons(); emit settingsChanged("ReKonfig"); } @@ -226,27 +209,13 @@ void SettingsDialog::saveSettings() bool SettingsDialog::hasChanged() { return KConfigDialog::hasChanged() - || d->adBlockWidg->changed() + || d->generalWidg->changed() + || d->tabsWidg->changed() + || d->appearanceWidg->changed() + || d->webkitWidg->changed() || d->networkWidg->changed() + || d->adBlockWidg->changed() || d->ebrowsingModule->changed() || d->shortcutsEditor->isModified(); ; } - - -void SettingsDialog::setHomeToCurrentPage() -{ - MainWindow *mw = static_cast<MainWindow*>(parent()); - WebTab *webTab = mw->currentTab(); - if (webTab) - { - d->generalUi.kcfg_homePage->setText(webTab->url().prettyUrl()); - } -} - - -void SettingsDialog::disableHomeSettings(bool b) -{ - d->generalUi.kcfg_homePage->setEnabled(!b); - d->generalUi.setHomeToCurrentPageButton->setEnabled(!b); -} diff --git a/src/settings/settingsdialog.h b/src/settings/settingsdialog.h index cade78e3..c25db74b 100644 --- a/src/settings/settingsdialog.h +++ b/src/settings/settingsdialog.h @@ -52,14 +52,10 @@ public: private: Private* const d; - void setWebSettingsToolTips(); private slots: void readConfig(); void saveSettings(); - - void setHomeToCurrentPage(); - void disableHomeSettings(bool); }; #endif // SETTINGS_DIALOG_H diff --git a/src/settings/tabswidget.cpp b/src/settings/tabswidget.cpp new file mode 100644 index 00000000..aa555339 --- /dev/null +++ b/src/settings/tabswidget.cpp @@ -0,0 +1,53 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* 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/>. +* +* ============================================================ */ + + +// 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 new file mode 100644 index 00000000..f1ff8a52 --- /dev/null +++ b/src/settings/tabswidget.h @@ -0,0 +1,58 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* 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/>. +* +* ============================================================ */ + + +#ifndef TABS_WIDGET_H +#define TABS_WIDGET_H + + +// Ui Includes +#include "ui_settings_tabs.h" + +// Qt Includes +#include <QtGui/QWidget> + + +class TabsWidget : public QWidget, private Ui::tabs +{ + Q_OBJECT + +public: + TabsWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + +private: + bool _changed; +}; + +#endif // TABS_WIDGET_H diff --git a/src/settings/webkitwidget.cpp b/src/settings/webkitwidget.cpp new file mode 100644 index 00000000..f9d94d76 --- /dev/null +++ b/src/settings/webkitwidget.cpp @@ -0,0 +1,71 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* 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/>. +* +* ============================================================ */ + + +// Local Includes +#include "webkitwidget.h" +#include "webkitwidget.moc" + + +WebKitWidget::WebKitWidget(QWidget *parent) + : QWidget(parent) + , _changed(false) +{ + setupUi(this); +} + + +void WebKitWidget::save() +{ +} + + +bool WebKitWidget::changed() +{ + return _changed; +} + + +void WebKitWidget::hasChanged() +{ +} + + +void WebKitWidget::setWebSettingsToolTips() +{ + kcfg_autoLoadImages->setToolTip(i18n("Specifies whether images are automatically loaded in web pages.")); + kcfg_dnsPrefetch->setToolTip(i18n("Specifies whether WebKit will try to prefetch DNS entries to speed up browsing.")); + kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs.")); + kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets.")); + kcfg_pluginsEnabled->setToolTip(i18n("Enables support for plugins in web pages.")); + 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.")); + kcfg_linksIncludedInFocusChain->setToolTip(i18n("If enabled, hyperlinks are included in the keyboard focus chain.")); + kcfg_zoomTextOnly->setToolTip(i18n("If enabled, the zoom factor on a frame is only applied to the text.")); + kcfg_printElementBackgrounds->setToolTip(i18n("If enabled, background colors and images are also drawn when the page is printed.")); + 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 new file mode 100644 index 00000000..b1eb8d76 --- /dev/null +++ b/src/settings/webkitwidget.h @@ -0,0 +1,60 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* 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/>. +* +* ============================================================ */ + + +#ifndef WEBKIT_WIDGET_H +#define WEBKIT_WIDGET_H + + +// Ui Includes +#include "ui_settings_webkit.h" + +// Qt Includes +#include <QtGui/QWidget> + + +class WebKitWidget : public QWidget, private Ui::webkit +{ + Q_OBJECT + +public: + WebKitWidget(QWidget *parent = 0); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + +private: + void setWebSettingsToolTips(); + + bool _changed; +}; + +#endif // WEBKIT_WIDGET_H |