Fixed issues in the various VCS log dialogs related to API differences of QUrl between Qt4 and Qt5.

Wed, 31 Dec 2014 12:44:08 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 31 Dec 2014 12:44:08 +0100
changeset 4013
e3c30bae0d15
parent 4011
0411fc21e40c
child 4016
b72dac09ba02

Fixed issues in the various VCS log dialogs related to API differences of QUrl between Qt4 and Qt5.

Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsPySvn/SvnLogDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsSubversion/SvnLogDialog.py file | annotate | diff | comparison | revisions
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py	Tue Dec 30 19:29:44 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py	Wed Dec 31 12:44:08 2014 +0100
@@ -15,7 +15,8 @@
 
 import os
 
-from PyQt5.QtCore import pyqtSlot, QProcess, QTimer, QUrl
+from PyQt5.QtCore import pyqtSlot, QProcess, QTimer, QUrl, QByteArray, \
+    qVersion
 from PyQt5.QtGui import QTextCursor
 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QApplication, QLineEdit
 
@@ -340,8 +341,13 @@
                 url = QUrl()
                 url.setScheme("file")
                 url.setPath(self.filename)
-                query = parent.split(":")[0] + '_' + rev
-                url.setQuery(query)
+                if qVersion() >= "5.0.0":
+                    query = parent.split(":")[0] + '_' + rev
+                    url.setQuery(query)
+                else:
+                    query = QByteArray()
+                    query.append(parent.split(":")[0]).append('_').append(rev)
+                    url.setEncodedQuery(query)
                 dstr += ' [<a href="{0}" name="{1}" id="{1}">{2}</a>]'.format(
                     url.toString(), query,
                     self.tr('diff to {0}').format(parent),
@@ -487,7 +493,10 @@
         if Utilities.isWindowsPlatform():
             if filename.startswith("/"):
                 filename = filename[1:]
-        ver = url.query()
+        if qVersion() >= "5.0.0":
+            ver = url.query()
+        else:
+            ver = bytes(url.encodedQuery()).decode()
         v1, v2 = ver.split('_')
         if v1 == "" or v2 == "":
             return
--- a/Plugins/VcsPlugins/vcsPySvn/SvnLogDialog.py	Tue Dec 30 19:29:44 2014 +0100
+++ b/Plugins/VcsPlugins/vcsPySvn/SvnLogDialog.py	Wed Dec 31 12:44:08 2014 +0100
@@ -14,7 +14,7 @@
 
 import pysvn
 
-from PyQt5.QtCore import QMutexLocker, QUrl, Qt
+from PyQt5.QtCore import QMutexLocker, QUrl, Qt, QByteArray, qVersion
 from PyQt5.QtGui import QCursor, QTextCursor
 from PyQt5.QtWidgets import QWidget, QApplication, QDialogButtonBox
 
@@ -140,8 +140,13 @@
                     url = QUrl()
                     url.setScheme("file")
                     url.setPath(self.filename)
-                    query = lv + '_' + ver
-                    url.setQuery(query)
+                    if qVersion() >= "5.0.0":
+                        query = lv + '_' + ver
+                        url.setQuery(query)
+                    else:
+                        query = QByteArray()
+                        query.append(lv).append('_').append(ver)
+                        url.setEncodedQuery(query)
                     dstr += ' [<a href="{0}" name="{1}">{2}</a>]'.format(
                         url.toString(), query,
                         self.tr('diff to {0}').format(lv)
@@ -236,7 +241,10 @@
         if Utilities.isWindowsPlatform():
             if filename.startswith("/"):
                 filename = filename[1:]
-        ver = url.query()
+        if qVersion() >= "5.0.0":
+            ver = url.query()
+        else:
+            ver = bytes(url.encodedQuery()).decode()
         v1 = ver.split('_')[0]
         v2 = ver.split('_')[1]
         if not v1 or not v2:
--- a/Plugins/VcsPlugins/vcsSubversion/SvnLogDialog.py	Tue Dec 30 19:29:44 2014 +0100
+++ b/Plugins/VcsPlugins/vcsSubversion/SvnLogDialog.py	Wed Dec 31 12:44:08 2014 +0100
@@ -15,7 +15,8 @@
 
 import os
 
-from PyQt5.QtCore import QTimer, QProcess, QRegExp, QUrl, pyqtSlot
+from PyQt5.QtCore import QTimer, QProcess, QRegExp, QUrl, pyqtSlot, qVersion, \
+    QByteArray
 from PyQt5.QtGui import QTextCursor
 from PyQt5.QtWidgets import QWidget, QLineEdit, QApplication, QDialogButtonBox
 
@@ -182,8 +183,13 @@
                     url = QUrl()
                     url.setScheme("file")
                     url.setPath(self.filename)
-                    query = lv + '_' + ver
-                    url.setQuery(query)
+                    if qVersion() >= "5.0.0":
+                        query = lv + '_' + ver
+                        url.setQuery(query)
+                    else:
+                        query = QByteArray()
+                        query.append(lv).append('_').append(ver)
+                        url.setEncodedQuery(query)
                     dstr += ' [<a href="{0}" name="{1}">{2}</a>]'.format(
                         url.toString(), query,
                         self.tr('diff to {0}').format(lv),
@@ -272,7 +278,10 @@
         if Utilities.isWindowsPlatform():
             if filename.startswith("/"):
                 filename = filename[1:]
-        ver = url.query()
+        if qVersion() >= "5.0.0":
+            ver = url.query()
+        else:
+            ver = bytes(url.encodedQuery()).decode()
         v1 = ver.split('_')[0]
         v2 = ver.split('_')[1]
         if v1 == "" or v2 == "":

eric ide

mercurial