changeset 207:c694bfb732bc

implement zooming the web view
author dirk
date Wed, 25 Jul 2012 01:49:28 +0200
parents f74fe7cb5091
children e2c70c92da02 1262b1168f1f
files Feedworm.qrc MainWindow.py Ui_MainWindow.ui zoom_in.png zoom_out.png
diffstat 5 files changed, 73 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Feedworm.qrc	Sat Jun 02 04:30:04 2012 +0200
+++ b/Feedworm.qrc	Wed Jul 25 01:49:28 2012 +0200
@@ -1,5 +1,7 @@
 <RCC>
   <qresource prefix="newPrefix">
+    <file>zoom_in.png</file>
+    <file>zoom_out.png</file>
     <file>mark_selected_read.jpg</file>
     <file>mark_all_read.jpg</file>
     <file>open_in_browser.png</file>
--- a/MainWindow.py	Sat Jun 02 04:30:04 2012 +0200
+++ b/MainWindow.py	Wed Jul 25 01:49:28 2012 +0200
@@ -71,6 +71,7 @@
         self.ui.feedEntryList.scrollTo(visibleIndex)
 
     def feedEntrySelected(self, index):
+        self.ui.webView.setZoomFactor(1.0)
         self.ui.menuArticle.setEnabled(True)
         self.ui.actionOpenLink.setEnabled(True)
 
@@ -173,3 +174,11 @@
     def copyArticleURLToClipboard(self):
         clipboard = QApplication.clipboard()
         clipboard.setText(self.backend.selectedFeedEntry.link)
+
+    def zoomIn(self):
+        zoom = self.ui.webView.zoomFactor() + 0.1
+        self.ui.webView.setZoomFactor(zoom)
+
+    def zoomOut(self):
+        zoom = self.ui.webView.zoomFactor() - 0.1
+        self.ui.webView.setZoomFactor(zoom)
--- a/Ui_MainWindow.ui	Sat Jun 02 04:30:04 2012 +0200
+++ b/Ui_MainWindow.ui	Wed Jul 25 01:49:28 2012 +0200
@@ -68,7 +68,7 @@
      <x>0</x>
      <y>0</y>
      <width>992</width>
-     <height>25</height>
+     <height>23</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuFeed">
@@ -121,6 +121,9 @@
    <addaction name="actionMarkFeedRead"/>
    <addaction name="actionMarkSelectedEntriesRead"/>
    <addaction name="actionOpenLink"/>
+   <addaction name="separator"/>
+   <addaction name="actionZoomIn"/>
+   <addaction name="actionZoomOut"/>
   </widget>
   <action name="actionQuit">
    <property name="text">
@@ -259,6 +262,30 @@
     <string>Ctrl+Shift+C</string>
    </property>
   </action>
+  <action name="actionZoomIn">
+   <property name="icon">
+    <iconset resource="Feedworm.qrc">
+     <normaloff>:/newPrefix/zoom_in.png</normaloff>:/newPrefix/zoom_in.png</iconset>
+   </property>
+   <property name="text">
+    <string>Zoom In</string>
+   </property>
+   <property name="toolTip">
+    <string>Zoom In</string>
+   </property>
+  </action>
+  <action name="actionZoomOut">
+   <property name="icon">
+    <iconset resource="Feedworm.qrc">
+     <normaloff>:/newPrefix/zoom_out.png</normaloff>:/newPrefix/zoom_out.png</iconset>
+   </property>
+   <property name="text">
+    <string>Zoom Out</string>
+   </property>
+   <property name="toolTip">
+    <string>Zoom Out</string>
+   </property>
+  </action>
  </widget>
  <customwidgets>
   <customwidget>
@@ -495,6 +522,38 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>actionZoomIn</sender>
+   <signal>activated()</signal>
+   <receiver>MainWindow</receiver>
+   <slot>zoomIn()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>495</x>
+     <y>374</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>actionZoomOut</sender>
+   <signal>activated()</signal>
+   <receiver>MainWindow</receiver>
+   <slot>zoomOut()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>495</x>
+     <y>374</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
  <slots>
   <slot>addFeed()</slot>
@@ -510,5 +569,7 @@
   <slot>feedEntryDoubleClicked()</slot>
   <slot>markSelectedEntriesRead()</slot>
   <slot>copyArticleURLToClipboard()</slot>
+  <slot>zoomIn()</slot>
+  <slot>zoomOut()</slot>
  </slots>
 </ui>
Binary file zoom_in.png has changed
Binary file zoom_out.png has changed