forked from qt-creator/qt-creator
Git: Show commit on double-click in fixup editor
Change-Id: I8cb08b0fcba3ddac7223b39b3762ff71e8d61f8c Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
8bbad43019
commit
325c0beda5
@@ -965,6 +965,7 @@ Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const Commit
|
|||||||
submitEditor->setDisplayName(title);
|
submitEditor->setDisplayName(title);
|
||||||
connect(submitEditor, SIGNAL(diff(QStringList,QStringList)), this, SLOT(submitEditorDiff(QStringList,QStringList)));
|
connect(submitEditor, SIGNAL(diff(QStringList,QStringList)), this, SLOT(submitEditorDiff(QStringList,QStringList)));
|
||||||
connect(submitEditor, SIGNAL(merge(QStringList)), this, SLOT(submitEditorMerge(QStringList)));
|
connect(submitEditor, SIGNAL(merge(QStringList)), this, SLOT(submitEditorMerge(QStringList)));
|
||||||
|
connect(submitEditor, SIGNAL(show(QString,QString)), m_gitClient, SLOT(show(QString,QString)));
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ GitSubmitEditor::GitSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *p
|
|||||||
m_forceClose(false)
|
m_forceClose(false)
|
||||||
{
|
{
|
||||||
connect(this, SIGNAL(diffSelectedFiles(QList<int>)), this, SLOT(slotDiffSelected(QList<int>)));
|
connect(this, SIGNAL(diffSelectedFiles(QList<int>)), this, SLOT(slotDiffSelected(QList<int>)));
|
||||||
|
connect(submitEditorWidget(), SIGNAL(show(QString)), this, SLOT(showCommit(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
GitSubmitEditorWidget *GitSubmitEditor::submitEditorWidget()
|
GitSubmitEditorWidget *GitSubmitEditor::submitEditorWidget()
|
||||||
@@ -160,6 +161,12 @@ void GitSubmitEditor::slotDiffSelected(const QList<int> &rows)
|
|||||||
emit merge(unmergedFiles);
|
emit merge(unmergedFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GitSubmitEditor::showCommit(const QString &commit)
|
||||||
|
{
|
||||||
|
if (!m_workingDirectory.isEmpty())
|
||||||
|
emit show(m_workingDirectory, commit);
|
||||||
|
}
|
||||||
|
|
||||||
void GitSubmitEditor::updateFileModel()
|
void GitSubmitEditor::updateFileModel()
|
||||||
{
|
{
|
||||||
if (m_workingDirectory.isEmpty())
|
if (m_workingDirectory.isEmpty())
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void diff(const QStringList &unstagedFiles, const QStringList &stagedFiles);
|
void diff(const QStringList &unstagedFiles, const QStringList &stagedFiles);
|
||||||
void merge(const QStringList &unmergedFiles);
|
void merge(const QStringList &unmergedFiles);
|
||||||
|
void show(const QString &workingDirectory, const QString &commit);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QByteArray fileContents() const;
|
QByteArray fileContents() const;
|
||||||
@@ -69,6 +70,7 @@ protected:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotDiffSelected(const QList<int> &rows);
|
void slotDiffSelected(const QList<int> &rows);
|
||||||
|
void showCommit(const QString &commit);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline GitSubmitEditorWidget *submitEditorWidget();
|
inline GitSubmitEditorWidget *submitEditorWidget();
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ void GitSubmitEditorWidget::initialize(CommitType commitType, const QString &rep
|
|||||||
logChangeGroupBox->setLayout(logChangeLayout);
|
logChangeGroupBox->setLayout(logChangeLayout);
|
||||||
m_logChangeWidget = new LogChangeWidget;
|
m_logChangeWidget = new LogChangeWidget;
|
||||||
m_logChangeWidget->init(repository, QString(), false);
|
m_logChangeWidget->init(repository, QString(), false);
|
||||||
|
connect(m_logChangeWidget, SIGNAL(doubleClicked(QString)), this, SIGNAL(show(QString)));
|
||||||
logChangeLayout->addWidget(m_logChangeWidget);
|
logChangeLayout->addWidget(m_logChangeWidget);
|
||||||
insertTopWidget(logChangeGroupBox);
|
insertTopWidget(logChangeGroupBox);
|
||||||
m_gitSubmitPanelUi.editGroup->hide();
|
m_gitSubmitPanelUi.editGroup->hide();
|
||||||
|
|||||||
@@ -72,6 +72,9 @@ protected:
|
|||||||
bool canSubmit() const;
|
bool canSubmit() const;
|
||||||
QString cleanupDescription(const QString &) const;
|
QString cleanupDescription(const QString &) const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void show(const QString &commit);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void authorInformationChanged();
|
void authorInformationChanged();
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ LogChangeWidget::LogChangeWidget(QWidget *parent)
|
|||||||
setUniformRowHeights(true);
|
setUniformRowHeights(true);
|
||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(emitDoubleClicked(QModelIndex)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LogChangeWidget::init(const QString &repository, const QString &commit, bool includeRemote)
|
bool LogChangeWidget::init(const QString &repository, const QString &commit, bool includeRemote)
|
||||||
@@ -89,6 +90,15 @@ int LogChangeWidget::commitIndex() const
|
|||||||
return -1;
|
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)
|
bool LogChangeWidget::populateLog(const QString &repository, const QString &commit, bool includeRemote)
|
||||||
{
|
{
|
||||||
if (const int rowCount = m_model->rowCount())
|
if (const int rowCount = m_model->rowCount())
|
||||||
|
|||||||
@@ -57,6 +57,12 @@ public:
|
|||||||
QString commit() const;
|
QString commit() const;
|
||||||
int commitIndex() const;
|
int commitIndex() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void doubleClicked(const QString &commit);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void emitDoubleClicked(const QModelIndex &index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool populateLog(const QString &repository, const QString &commit, bool includeRemote);
|
bool populateLog(const QString &repository, const QString &commit, bool includeRemote);
|
||||||
const QStandardItem *currentItem(int column = 0) const;
|
const QStandardItem *currentItem(int column = 0) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user