diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2011-02-14 23:33:39 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-02-14 23:33:39 +0100 |
commit | 9731934d1c45b7e6f27b58b9083b23ecbc084288 (patch) | |
tree | 20ee22f4b68b75ac54bac2afd09edc038019bf45 /src/settings | |
parent | Added credit for Johannes Troscher (diff) | |
download | rekonq-9731934d1c45b7e6f27b58b9083b23ecbc084288.tar.xz |
This patch cleans up encoding management, moving code to
its real position: The appearance settings widget.
In fact our code is actually changing "default" text encoding, not
the page one "on the fly"
Diffstat (limited to 'src/settings')
-rw-r--r-- | src/settings/appearancewidget.cpp | 33 | ||||
-rw-r--r-- | src/settings/appearancewidget.h | 11 | ||||
-rw-r--r-- | src/settings/settings_appearance.ui | 587 |
3 files changed, 364 insertions, 267 deletions
diff --git a/src/settings/appearancewidget.cpp b/src/settings/appearancewidget.cpp index c444f724..f07f7b8b 100644 --- a/src/settings/appearancewidget.cpp +++ b/src/settings/appearancewidget.cpp @@ -31,6 +31,9 @@ // Auto Includes #include "rekonq.h" +// KDE Includes +#include <KGlobal> +#include <KCharsets> AppearanceWidget::AppearanceWidget(QWidget *parent) : QWidget(parent) @@ -53,6 +56,8 @@ AppearanceWidget::AppearanceWidget(QWidget *parent) connect(sansSerifFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT( hasChanged() )); connect(cursiveFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT( hasChanged() )); connect(fantasyFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT( hasChanged() )); + + populateEncodingMenu(); } @@ -83,8 +88,32 @@ void AppearanceWidget::hasChanged() bool AppearanceWidget::isDefault() { bool def = true; - + // TODO: implement me!! - + return def; } + + +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.") ); + + connect(encodingCombo, SIGNAL(activated(const QString &)), this, SLOT(setEncoding(const QString &))); + connect(encodingCombo, SIGNAL(activated(const QString &)), this, SLOT(hasChanged())); + + QString enc = ReKonfig::defaultEncoding(); + int indexOfEnc = encodings.indexOf(enc); + encodingCombo->setCurrentIndex(indexOfEnc); +} + + +void AppearanceWidget::setEncoding(const QString &enc) +{ + ReKonfig::setDefaultEncoding(enc); +} diff --git a/src/settings/appearancewidget.h b/src/settings/appearancewidget.h index e2696172..5dd78517 100644 --- a/src/settings/appearancewidget.h +++ b/src/settings/appearancewidget.h @@ -48,14 +48,17 @@ public: void save(); bool changed(); bool isDefault(); - -signals: + +Q_SIGNALS: void changed(bool); -private slots: +private Q_SLOTS: void hasChanged(); - + void setEncoding(const QString &); + private: + void populateEncodingMenu(); + bool _changed; }; diff --git a/src/settings/settings_appearance.ui b/src/settings/settings_appearance.ui index b25af436..0a8692d9 100644 --- a/src/settings/settings_appearance.ui +++ b/src/settings/settings_appearance.ui @@ -6,277 +6,342 @@ <rect> <x>0</x> <y>0</y> - <width>364</width> - <height>457</height> + <width>494</width> + <height>472</height> </rect> </property> <property name="windowTitle"> <string>Appearance</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> + <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Fonts</string> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>0</number> </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <widget class="QWidget" name="tabFont"> + <attribute name="title"> + <string>Fonts</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Fonts</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Standard 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_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Fixed font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </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="0" column="1"> + <widget class="KFontComboBox" name="standardFontChooser"/> + </item> + <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="1" column="1"> + <widget class="KFontComboBox" name="fixedFontChooser"/> + </item> + <item row="2" column="1"> + <widget class="KFontComboBox" name="serifFontChooser"/> + </item> + <item row="3" column="1"> + <widget class="KFontComboBox" name="sansSerifFontChooser"/> + </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="4" column="1"> + <widget class="KFontComboBox" name="cursiveFontChooser"/> + </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> + <item row="5" column="1"> + <widget class="KFontComboBox" name="fantasyFontChooser"/> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Size</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_9"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Default 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="KIntNumInput" name="kcfg_defaultFontSize"/> + </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> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Minimal font size:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="KIntNumInput" name="kcfg_minFontSize"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>Encodings</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string>Default Encodings</string> + </property> + </widget> + </item> + <item> + <widget class="KComboBox" name="encodingCombo"/> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer_3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>84</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="tabStyleSheet"> + <attribute name="title"> + <string>Stylesheets</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QGroupBox" name="groupBox_3"> + <property name="title"> + <string>User Style Sheet</string> + </property> + <layout class="QFormLayout" name="formLayout_3"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::ExpandingFieldsGrow</enum> </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Standard font:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="KFontComboBox" name="standardFontChooser"/> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Fixed font:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="KFontComboBox" name="fixedFontChooser"/> - </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="2" column="1"> - <widget class="KFontComboBox" name="serifFontChooser"/> - </item> - <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="3" column="1"> - <widget class="KFontComboBox" name="sansSerifFontChooser"/> - </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="4" column="1"> - <widget class="KFontComboBox" name="cursiveFontChooser"/> - </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> - <item row="5" column="1"> - <widget class="KFontComboBox" name="fantasyFontChooser"/> - </item> - </layout> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label_9"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Default 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="KIntNumInput" name="kcfg_defaultFontSize"/> - </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> - </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Minimal font size:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="KIntNumInput" name="kcfg_minFontSize"/> - </item> - </layout> - </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> - <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> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <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_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>527</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="tabMisc"> + <attribute name="title"> + <string>Misc</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QCheckBox" name="kcfg_autoScroll"> + <property name="toolTip"> + <string>Toggle automatic scrolling on middle click in a web page</string> + </property> + <property name="text"> + <string>Auto-scroll on middle-click</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="kcfg_smoothScrolling"> + <property name="toolTip"> + <string>Scroll pages with an eye candy effect</string> + </property> + <property name="text"> + <string>Enable smooth scrolling</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="kcfg_useFavicon"> + <property name="text"> + <string>Use favicon of the open website</string> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>513</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> </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_autoScroll"> - <property name="toolTip"> - <string>Toggle automatic scrolling on middle click in a web page</string> - </property> - <property name="text"> - <string>Auto-scroll on middle-click</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="kcfg_smoothScrolling"> - <property name="toolTip"> - <string>Scroll pages with an eye candy effect</string> - </property> - <property name="text"> - <string>Enable smooth scrolling</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="kcfg_useFavicon"> - <property name="text"> - <string>Use favicon of the open website</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> </layout> </widget> <customwidgets> |