summaryrefslogtreecommitdiff
path: root/src/settings
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings')
-rw-r--r--src/settings/appearancewidget.cpp48
-rw-r--r--src/settings/appearancewidget.h1
-rw-r--r--src/settings/settings_appearance.ui34
3 files changed, 77 insertions, 6 deletions
diff --git a/src/settings/appearancewidget.cpp b/src/settings/appearancewidget.cpp
index 42c9db14..89918ac7 100644
--- a/src/settings/appearancewidget.cpp
+++ b/src/settings/appearancewidget.cpp
@@ -35,6 +35,11 @@
#include <KGlobal>
#include <KCharsets>
+
+int zoomFactorList[13] = {5, 6, 7, 8, 9, 10, 11, 13, 15, 20, 25, 30};
+
+
+
AppearanceWidget::AppearanceWidget(QWidget *parent)
: QWidget(parent)
, _changed(false)
@@ -58,6 +63,7 @@ AppearanceWidget::AppearanceWidget(QWidget *parent)
connect(fantasyFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged()));
populateEncodingMenu();
+ populateZoomMenu();
}
@@ -69,6 +75,11 @@ void AppearanceWidget::save()
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);
}
@@ -87,11 +98,9 @@ void AppearanceWidget::hasChanged()
bool AppearanceWidget::isDefault()
{
- bool def = true;
-
// TODO: implement me!!
- return def;
+ return !_changed;
}
@@ -104,12 +113,39 @@ void AppearanceWidget::populateEncodingMenu()
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(QString)), this, SLOT(setEncoding(QString)));
- connect(encodingCombo, SIGNAL(activated(QString)), this, SLOT(hasChanged()));
-
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()));
}
diff --git a/src/settings/appearancewidget.h b/src/settings/appearancewidget.h
index 2154df81..39dafbaf 100644
--- a/src/settings/appearancewidget.h
+++ b/src/settings/appearancewidget.h
@@ -58,6 +58,7 @@ private Q_SLOTS:
private:
void populateEncodingMenu();
+ void populateZoomMenu();
bool _changed;
};
diff --git a/src/settings/settings_appearance.ui b/src/settings/settings_appearance.ui
index 525881b5..4246a92c 100644
--- a/src/settings/settings_appearance.ui
+++ b/src/settings/settings_appearance.ui
@@ -237,6 +237,40 @@
</widget>
</item>
<item>
+ <widget class="QGroupBox" name="groupBox_5">
+ <property name="title">
+ <string>Zoom</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="label_11">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Default page zoom</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KComboBox" name="zoomCombo"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Character Encoding</string>