Skip to content
Snippets Groups Projects
Commit 325c0bed authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Git: Show commit on double-click in fixup editor


Change-Id: I8cb08b0fcba3ddac7223b39b3762ff71e8d61f8c
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 8bbad430
No related branches found
No related tags found
No related merge requests found
......@@ -965,6 +965,7 @@ Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const Commit
submitEditor->setDisplayName(title);
connect(submitEditor, SIGNAL(diff(QStringList,QStringList)), this, SLOT(submitEditorDiff(QStringList,QStringList)));
connect(submitEditor, SIGNAL(merge(QStringList)), this, SLOT(submitEditorMerge(QStringList)));
connect(submitEditor, SIGNAL(show(QString,QString)), m_gitClient, SLOT(show(QString,QString)));
return editor;
}
......
......@@ -89,6 +89,7 @@ GitSubmitEditor::GitSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *p
m_forceClose(false)
{
connect(this, SIGNAL(diffSelectedFiles(QList<int>)), this, SLOT(slotDiffSelected(QList<int>)));
connect(submitEditorWidget(), SIGNAL(show(QString)), this, SLOT(showCommit(QString)));
}
GitSubmitEditorWidget *GitSubmitEditor::submitEditorWidget()
......@@ -160,6 +161,12 @@ void GitSubmitEditor::slotDiffSelected(const QList<int> &rows)
emit merge(unmergedFiles);
}
void GitSubmitEditor::showCommit(const QString &commit)
{
if (!m_workingDirectory.isEmpty())
emit show(m_workingDirectory, commit);
}
void GitSubmitEditor::updateFileModel()
{
if (m_workingDirectory.isEmpty())
......
......@@ -62,6 +62,7 @@ public:
signals:
void diff(const QStringList &unstagedFiles, const QStringList &stagedFiles);
void merge(const QStringList &unmergedFiles);
void show(const QString &workingDirectory, const QString &commit);
protected:
QByteArray fileContents() const;
......@@ -69,6 +70,7 @@ protected:
private slots:
void slotDiffSelected(const QList<int> &rows);
void showCommit(const QString &commit);
private:
inline GitSubmitEditorWidget *submitEditorWidget();
......
......@@ -169,6 +169,7 @@ void GitSubmitEditorWidget::initialize(CommitType commitType, const QString &rep
logChangeGroupBox->setLayout(logChangeLayout);
m_logChangeWidget = new LogChangeWidget;
m_logChangeWidget->init(repository, QString(), false);
connect(m_logChangeWidget, SIGNAL(doubleClicked(QString)), this, SIGNAL(show(QString)));
logChangeLayout->addWidget(m_logChangeWidget);
insertTopWidget(logChangeGroupBox);
m_gitSubmitPanelUi.editGroup->hide();
......
......@@ -72,6 +72,9 @@ protected:
bool canSubmit() const;
QString cleanupDescription(const QString &) const;
signals:
void show(const QString &commit);
private slots:
void authorInformationChanged();
......
......@@ -62,6 +62,7 @@ LogChangeWidget::LogChangeWidget(QWidget *parent)
setUniformRowHeights(true);
setRootIsDecorated(false);
setSelectionBehavior(QAbstractItemView::SelectRows);
connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(emitDoubleClicked(QModelIndex)));
}
bool LogChangeWidget::init(const QString &repository, const QString &commit, bool includeRemote)
......@@ -89,6 +90,15 @@ int LogChangeWidget::commitIndex() const
return -1;
}
void LogChangeWidget::emitDoubleClicked(const QModelIndex &index)
{
if (index.isValid()) {
QString commit = index.sibling(index.row(), Sha1Column).data().toString();
if (!commit.isEmpty())
emit doubleClicked(commit);
}
}
bool LogChangeWidget::populateLog(const QString &repository, const QString &commit, bool includeRemote)
{
if (const int rowCount = m_model->rowCount())
......
......@@ -57,6 +57,12 @@ public:
QString commit() const;
int commitIndex() const;
signals:
void doubleClicked(const QString &commit);
private slots:
void emitDoubleClicked(const QModelIndex &index);
private:
bool populateLog(const QString &repository, const QString &commit, bool includeRemote);
const QStandardItem *currentItem(int column = 0) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment