Commits

Yuya Nishihara committed 1daecd2

comment

Comments (0)

Files changed (3)

graphdele-portrenderer.diff

 # HG changeset patch
 # Date 1395569533 -32400
-# Parent 15c268dca420f87c9e0409eacf34461ffcd65148
+# Parent 5e0f811d13e2856a2ffe08f91821ae2567c4243b
+graphdelegate: move graph renderer from repomodel (refs #3690)
+
+This change is necessary to scale graph image according to the actual height
+of the view.  The model doesn't have enough information to scale graph image
+appropriately.
+
+GraphRole is superseded by GraphNodeRole.
 
 diff --git a/tortoisehg/hgqt/repomodel.py b/tortoisehg/hgqt/repomodel.py
 --- a/tortoisehg/hgqt/repomodel.py
 +++ b/tortoisehg/hgqt/repomodel.py
-@@ -76,8 +76,7 @@ ALLCOLUMNS = tuple(name for name, _text 
+@@ -75,8 +75,7 @@ ALLCOLUMNS = tuple(name for name, _text 
  UNAPPLIED_PATCH_COLOR = '#999999'
  HIDDENREV_COLOR = '#666666'
  
  
  def get_color(n, ignore=()):
      """
-@@ -90,24 +89,6 @@ def get_color(n, ignore=()):
+@@ -89,24 +88,6 @@ def get_color(n, ignore=()):
          colors = COLORS
      return colors[n % len(colors)]
  
  def _parsebranchcolors(value):
      r"""Parse tortoisehg.branchcolors setting
  
-@@ -200,8 +181,6 @@ class HgRepoListModel(QAbstractTableMode
+@@ -199,8 +180,6 @@ class HgRepoListModel(QAbstractTableMode
          self._cache = []
          self.graph = None
          self.timerHandle = None
          self.rowcount = 0
          self.repo = repo
          self.revset = revset
-@@ -390,149 +369,6 @@ class HgRepoListModel(QAbstractTableMode
+@@ -389,149 +368,6 @@ class HgRepoListModel(QAbstractTableMode
              self._branch_colors[branch] = get_color(len(self._branch_colors))
          return self._branch_colors[branch]
  
      def invalidateCache(self):
          self._cache = []
  
-@@ -542,8 +378,7 @@ class HgRepoListModel(QAbstractTableMode
+@@ -541,8 +377,7 @@ class HgRepoListModel(QAbstractTableMode
          + [(Qt.ForegroundRole, c) for c in xrange(len(ALLCOLUMNS))]
          + [(Qt.DecorationRole, DescColumn),
             (Qt.DecorationRole, ChangesColumn),
  
      def data(self, index, role=Qt.DisplayRole):
          if not index.isValid():
-@@ -616,8 +451,6 @@ class HgRepoListModel(QAbstractTableMode
+@@ -615,8 +450,6 @@ class HgRepoListModel(QAbstractTableMode
                  font = QFont()
                  font.setBold(True)
                  return font

repom-dataroles.diff

 # HG changeset patch
 # Date 1395562004 -32400
-# Parent 6796124de2aafc62ce73da4cbe4ffdf987dff4a4
+# Parent f8ecabf123a88a93be09059806c6eea2573504a3
+repomodel: introduce data role to get GraphNode object in Qt way
+
+Now graphctx() does not depend on the internals of HgRepoListModel, so it can
+be moved to GraphDelegate.
 
 diff --git a/tortoisehg/hgqt/repomodel.py b/tortoisehg/hgqt/repomodel.py
 --- a/tortoisehg/hgqt/repomodel.py
 +++ b/tortoisehg/hgqt/repomodel.py
-@@ -77,6 +77,7 @@ UNAPPLIED_PATCH_COLOR = '#999999'
+@@ -76,6 +76,7 @@ UNAPPLIED_PATCH_COLOR = '#999999'
  HIDDENREV_COLOR = '#666666'
  
  GraphRole = Qt.UserRole + 0
  
  def get_color(n, ignore=()):
      """
-@@ -395,7 +396,8 @@ class HgRepoListModel(QAbstractTableMode
+@@ -396,7 +397,8 @@ class HgRepoListModel(QAbstractTableMode
          maxradius = self.rowheight / 2
          return maxradius * (col + 1)
  
          w = self.col2x(gnode.cols)
          h = self.rowheight
  
-@@ -403,12 +405,12 @@ class HgRepoListModel(QAbstractTableMode
+@@ -404,12 +406,12 @@ class HgRepoListModel(QAbstractTableMode
          pix.fill(QColor(0,0,0,0))
          painter = QPainter(pix)
          try:
          h = self.rowheight
          dot_y = h / 2
  
-@@ -550,6 +552,8 @@ class HgRepoListModel(QAbstractTableMode
+@@ -552,6 +554,8 @@ class HgRepoListModel(QAbstractTableMode
          if (role == Qt.FontRole
              and index.column() in (NodeColumn, ConvertedColumn)):
              return QFont("Monospace")
          if (role, index.column()) not in self._cacheindexmap:
              return nullvariant
          # repo may be changed while reading in case of postpull=rebase for
-@@ -613,7 +617,7 @@ class HgRepoListModel(QAbstractTableMode
+@@ -615,7 +619,7 @@ class HgRepoListModel(QAbstractTableMode
                  font.setBold(True)
                  return font
          elif role == GraphRole:

repom-nographmaxcols.diff

 # HG changeset patch
-# Parent f5a0f2008c4b2fbb065ea0012da422b23cea63f4
+# Parent 7f3298055e605bec516c14ab725f294eae2ea201
 # Date 1403278420 -32400
+repomodel: delegate calculation of graph width to view (refs #3690)
+
+The next commit will move the graph renderer to GraphDelegate, so the model
+will no longer be possible to calculate the size of graph cells.
+
+GraphDelegate.sizeHint will be reimplemented later to not create QPixmap.
 
 diff --git a/tortoisehg/hgqt/graph.py b/tortoisehg/hgqt/graph.py
 --- a/tortoisehg/hgqt/graph.py
 diff --git a/tortoisehg/hgqt/repomodel.py b/tortoisehg/hgqt/repomodel.py
 --- a/tortoisehg/hgqt/repomodel.py
 +++ b/tortoisehg/hgqt/repomodel.py
-@@ -372,9 +372,6 @@ class HgRepoListModel(QAbstractTableMode
+@@ -371,9 +371,6 @@ class HgRepoListModel(QAbstractTableMode
                  pass
          if column == FileColumn:
              return self.filename