summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rekonq.kcfg3
-rw-r--r--src/settings/appearancewidget.cpp48
-rw-r--r--src/settings/appearancewidget.h1
-rw-r--r--src/settings/settings_appearance.ui34
-rw-r--r--src/webtab/webpage.cpp7
-rw-r--r--src/webtab/webtab.cpp18
6 files changed, 94 insertions, 17 deletions
diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg
index 0dc2f3df..8bd8b2ad 100644
--- a/src/rekonq.kcfg
+++ b/src/rekonq.kcfg
@@ -166,6 +166,9 @@
<entry name="userCSS" type="Url">
<default></default>
</entry>
+ <entry name="defaultZoom" type="Int">
+ <default>10</default>
+ </entry>
</group>
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>
diff --git a/src/webtab/webpage.cpp b/src/webtab/webpage.cpp
index c488ee9b..e4ff22d5 100644
--- a/src/webtab/webpage.cpp
+++ b/src/webtab/webpage.cpp
@@ -579,14 +579,13 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)
void WebPage::loadStarted()
{
// set zoom factor
- QString val;
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup group(config, "Zoom");
- val = group.readEntry(_loadingUrl.host(), QString("10"));
+ QString stringValue = group.readEntry(_loadingUrl.host(), QString::number(ReKonfig::defaultZoom()));
- int value = val.toInt();
+ int value = stringValue.toInt();
if (value != 10)
- mainFrame()->setZoomFactor(QVariant(value).toReal() / 10); // Don't allox max +1 values
+ mainFrame()->setZoomFactor(value / 10.0); // Don't allox max +1 values
}
diff --git a/src/webtab/webtab.cpp b/src/webtab/webtab.cpp
index 93d1b38c..eb887304 100644
--- a/src/webtab/webtab.cpp
+++ b/src/webtab/webtab.cpp
@@ -76,7 +76,7 @@ WebTab::WebTab(QWidget *parent, bool isPrivateBrowsing)
, m_webView(0)
, m_progress(0)
, m_part(0)
- , m_zoomFactor(10)
+ , m_zoomFactor(ReKonfig::defaultZoom())
, m_isPrivateBrowsing(isPrivateBrowsing)
, m_isWebApp(false)
, m_splitter(new QSplitter(this))
@@ -435,7 +435,7 @@ void WebTab::zoomIn()
else
m_zoomFactor++;
- view()->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
+ view()->setZoomFactor(m_zoomFactor / 10.0);
setZoom(m_zoomFactor);
}
@@ -449,8 +449,12 @@ void WebTab::zoomOut()
return;
}
- m_zoomFactor--;
- view()->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
+ if (m_zoomFactor > 20)
+ m_zoomFactor -= 5;
+ else
+ m_zoomFactor--;
+
+ view()->setZoomFactor(m_zoomFactor / 10.0);
setZoom(m_zoomFactor);
}
@@ -458,8 +462,8 @@ void WebTab::zoomOut()
void WebTab::zoomDefault()
{
- m_zoomFactor = 10;
- view()->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
+ m_zoomFactor = ReKonfig::defaultZoom();
+ view()->setZoomFactor(m_zoomFactor / 10.0);
setZoom(m_zoomFactor);
}
@@ -475,7 +479,7 @@ void WebTab::setZoom(int zoomFactor)
KConfigGroup group(config, "Zoom");
group.writeEntry(url().host(), m_zoomFactor);
- if (m_zoomFactor == 10)
+ if (m_zoomFactor == ReKonfig::defaultZoom())
emit infoToShow(i18n("Default zoom: %1%", QString::number(m_zoomFactor * 10)));
else
emit infoToShow(i18n("Zooming: %1%", QString::number(m_zoomFactor * 10)));