Improved the icon handling in the web browser.

Thu, 12 Apr 2012 19:06:03 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 12 Apr 2012 19:06:03 +0200
changeset 1781
34a44041c4cb
parent 1780
f42757fd021b
child 1782
90bd49fec9ff

Improved the icon handling in the web browser.

Helpviewer/HelpTabWidget.py file | annotate | diff | comparison | revisions
Helpviewer/HelpWindow.py file | annotate | diff | comparison | revisions
icons/default/qthelp.png file | annotate | diff | comparison | revisions
--- a/Helpviewer/HelpTabWidget.py	Wed Apr 11 19:11:49 2012 +0200
+++ b/Helpviewer/HelpTabWidget.py	Thu Apr 12 19:06:03 2012 +0200
@@ -699,7 +699,7 @@
         if browser is not None:
             index = self.indexOf(browser)
             self.resetAnimation(index)
-            self.setTabIcon(index, browser.icon())
+            self.setTabIcon(index, Helpviewer.HelpWindow.HelpWindow.icon(browser.url()))
             if ok:
                 self.showMessage.emit(self.trUtf8("Finished loading"))
             else:
@@ -714,7 +714,8 @@
         browser = self.sender()
         
         if browser is not None:
-            self.setTabIcon(self.indexOf(browser), browser.icon())
+            self.setTabIcon(self.indexOf(browser),
+                Helpviewer.HelpWindow.HelpWindow.icon(browser.url()))
             Helpviewer.HelpWindow.HelpWindow.bookmarksManager().iconChanged(browser.url())
     
     def getSourceFileList(self):
--- a/Helpviewer/HelpWindow.py	Wed Apr 11 19:11:49 2012 +0200
+++ b/Helpviewer/HelpWindow.py	Thu Apr 12 19:06:03 2012 +0200
@@ -2657,6 +2657,11 @@
         @return icon for the URL (QIcon)
         """
         icon = HelpWindow.__getWebIcon(url)
+        if icon.isNull():
+            hostUrl = QUrl()
+            hostUrl.setScheme(url.scheme())
+            hostUrl.setHost(url.host())
+            icon = HelpWindow.__getWebIcon(hostUrl)
         
         if icon.isNull():
             pixmap = QWebSettings.webGraphic(QWebSettings.DefaultFrameIconGraphic)
@@ -2675,6 +2680,16 @@
         @param url URL to get icon for (QUrl)
         @return icon for the URL (QIcon)
         """
+        scheme = url.scheme()
+        if scheme in ["eric", "about"]:
+            return UI.PixmapCache.getIcon("ericWeb.png")
+        elif scheme == "qthelp":
+            return UI.PixmapCache.getIcon("qthelp.png")
+        elif scheme == "file":
+            return UI.PixmapCache.getIcon("fileMisc.png")
+        elif scheme == "abp":
+            return UI.PixmapCache.getIcon("adBlockPlus.png")
+        
         icon = QWebSettings.iconForUrl(url)
         if icon.isNull():
             # try again
Binary file icons/default/qthelp.png has changed

eric ide

mercurial