Commits

Adrian Buehlmann committed 4df33d7

workbench: use saveGeometry/restoreGeometry

According to the docs the restoreGeometry function also checks if the restored geometry is outside
the available screen geometry, and modifies it as appropriate if it is.

Requires at least Qt 4.3 (according to PyQt book).

Comments (0)

Files changed (2)

 application is still reasonably usable with the base library versions listed
 below.
 
-PyGtk: 2.10
+PyQt: 4.3
 
 === Python version ===
 

tortoisehg/hgqt/workbench.py

             self.startrev_entry.setText(str(fromhead))
         self.setupRevisionTable()
 
-        settings = QtCore.QSettings()
-        V = QtCore.QVariant
-        S = QtCore.QSize
-        P = QtCore.QPoint
-        size = settings.value("Workbench/Size", V(S(600, 500))).toSize()
-        self.resize(size)
-        pos = settings.value("Workbench/Position", V(P(0, 0))).toPoint()
-        self.move(pos)
+        s = QtCore.QSettings()
+        self.restoreGeometry(s.value("Workbench/geometry").toByteArray())
 
         self._repodate = self._getrepomtime()
         self._watchrepotimer = self.startTimer(500)
         if not self.okToContinue():
             event.ignore()
         s = QtCore.QSettings()
-        V = QtCore.QVariant
-        s.setValue("Workbench/Size", V(self.size()))
-        s.setValue("Workbench/Position", V(self.pos()))
+        s.setValue("Workbench/geometry", self.saveGeometry());
 
 def run(ui, *pats, **opts):
     from tortoisehg.hgqt import setup_font_substitutions