summaryrefslogtreecommitdiff
path: root/src/settings/appearancewidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings/appearancewidget.cpp')
-rw-r--r--src/settings/appearancewidget.cpp48
1 files changed, 42 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()));
}