Commit f8b81347 authored by Steve Borho's avatar Steve Borho
Browse files

revdetails: create a 'show all' action for merge changesets

The action behavior is currently broken, it somehow jumps to the merge parent.
Also removed unused revdetails.actionActivateFile
parent 105be55e034a
......@@ -33,19 +33,22 @@ class HgFileListModel(QAbstractTableModel):
contextChanged = pyqtSignal(object)
def __init__(self, repo, parent=None):
def __init__(self, repo, parent):
"""
data is a HgHLRepo instance
"""
QAbstractTableModel.__init__(self, parent)
self.repo = repo
self._boldfont = parent.font()
self._boldfont.setBold(True)
self._ctx = None
self._files = []
self._filesdict = {}
self._fulllist = False
def toggleFullFileList(self):
self._fulllist = not self._fulllist
@pyqtSlot(bool)
def toggleFullFileList(self, value):
self._fulllist = value
self.loadFiles()
self.layoutChanged.emit()
......@@ -153,8 +156,6 @@ class HgFileListModel(QAbstractTableModel):
return QVariant(geticon('filedelete'))
elif role == Qt.FontRole:
if self._fulllist and current_file_desc['infiles']:
font = self.font()
font.setBold(True)
return QVariant(font)
return QVariant(self._boldfont)
else:
return nullvariant
......@@ -56,6 +56,8 @@ class HgFileListView(QTableView):
model.contextChanged.connect(self.contextChanged)
self.selectionModel().currentRowChanged.connect(self.fileSelected)
self.horizontalHeader().setResizeMode(1, QHeaderView.Stretch)
self.actionShowAllMerge.setChecked(False)
self.actionShowAllMerge.toggled.connect(model.toggleFullFileList)
if model._ctx is not None:
self.contextChanged(model._ctx)
......@@ -66,6 +68,7 @@ class HgFileListView(QTableView):
self._actions[act].setEnabled(real)
for act in ['diff', 'revert']:
self._actions[act].setEnabled(real or wd)
self.actionShowAllMerge.setVisible(len(ctx.parents()) == 2)
def currentFile(self):
index = self.currentIndex()
......@@ -187,6 +190,11 @@ class HgFileListView(QTableView):
dlg.activateWindow()
def createActions(self):
self.actionShowAllMerge = QAction('Show All', self)
self.actionShowAllMerge.setCheckable(True)
self.actionShowAllMerge.setChecked(False)
self.actionShowAllMerge.setVisible(False)
self._actions = {}
for name, desc, icon, key, tip, cb in [
('navigate', _('File history'), None, 'Shift+Return',
......@@ -285,4 +293,3 @@ class HgFileListView(QTableView):
return QTableView.mouseMoveEvent(self, event)
self.dragObject()
return QTableView.mouseMoveEvent(self, event)
......@@ -177,15 +177,14 @@ class RevDetailsWidget(QWidget):
self.filelist.clearDisplay.connect(self.fileview.clearDisplay)
def createActions(self):
# Activate file (file diff navigator)
self.actionActivateFile = QAction('Activate file', self)
def fileActivated():
idx = self.filelist.currentIndex()
self.filelist.fileActivated(idx, alternate=True)
self.actionActivateFileAlt = QAction('Activate alt. file', self)
self.actionActivateFileAlt.setShortcuts([Qt.ALT+Qt.Key_Return,
Qt.ALT+Qt.Key_Enter])
self.actionActivateFileAlt.triggered.connect(
lambda self=self:
self.filelist.fileActivated(self.filelist.currentIndex(),
alternate=True))
self.actionActivateFileAlt.triggered.connect(fileActivated)
self.mergeToolBar.addAction(self.filelist.actionShowAllMerge)
@pyqtSlot()
def toggleSearchBar(self):
......@@ -204,7 +203,7 @@ class RevDetailsWidget(QWidget):
self.searchbar.caseInsensitive())
def create_models(self):
self.filelistmodel = HgFileListModel(self.repo, parent=self)
self.filelistmodel = HgFileListModel(self.repo, self)
def setupModels(self):
self.create_models()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment