diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2013-11-30 01:15:57 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2013-12-03 22:14:44 +0100 |
commit | 178947c5e58a388660d101b8f354cdb3eae0cf02 (patch) | |
tree | 8049f03cddac1006d713ff28560d754bbb447f4e /src/settings/appearancewidget.cpp | |
parent | Move "custom CSS path" from Appearance to Advanced settings (diff) | |
download | rekonq-178947c5e58a388660d101b8f354cdb3eae0cf02.tar.xz |
Added option for global zoom settings :)
BUG: 307477
Diffstat (limited to 'src/settings/appearancewidget.cpp')
-rw-r--r-- | src/settings/appearancewidget.cpp | 48 |
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())); } |