forked from qt-creator/qt-creator
Git: Show change details in a text edit instead of a tooltip
Change-Id: Iefaf860da291ef700593b6c41cbe14592d152c1a Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Tobias Hunger
parent
57738988f2
commit
e3017dff5f
@@ -59,7 +59,8 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, QW
|
|||||||
|
|
||||||
m_gitEnvironment = GitPlugin::instance()->gitClient()->processEnvironment();
|
m_gitEnvironment = GitPlugin::instance()->gitClient()->processEnvironment();
|
||||||
connect(m_ui.changeNumberEdit, SIGNAL(textChanged(QString)),
|
connect(m_ui.changeNumberEdit, SIGNAL(textChanged(QString)),
|
||||||
this, SLOT(recalculateToolTip(QString)));
|
this, SLOT(recalculateDetails(QString)));
|
||||||
|
recalculateDetails(m_ui.changeNumberEdit->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeSelectionDialog::~ChangeSelectionDialog()
|
ChangeSelectionDialog::~ChangeSelectionDialog()
|
||||||
@@ -103,16 +104,16 @@ void ChangeSelectionDialog::selectWorkingDirectory()
|
|||||||
tr("Selected directory is not a Git repository"));
|
tr("Selected directory is not a Git repository"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Set commit message as toolTip
|
//! Set commit message in details
|
||||||
void ChangeSelectionDialog::setToolTip(int exitCode)
|
void ChangeSelectionDialog::setDetails(int exitCode)
|
||||||
{
|
{
|
||||||
if (exitCode == 0)
|
if (exitCode == 0)
|
||||||
m_ui.changeNumberEdit->setToolTip(QString::fromUtf8(m_process->readAllStandardOutput()));
|
m_ui.detailsText->setPlainText(QString::fromUtf8(m_process->readAllStandardOutput()));
|
||||||
else
|
else
|
||||||
m_ui.changeNumberEdit->setToolTip(tr("Error: unknown reference"));
|
m_ui.detailsText->setPlainText(tr("Error: unknown reference"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChangeSelectionDialog::recalculateToolTip(const QString &ref)
|
void ChangeSelectionDialog::recalculateDetails(const QString &ref)
|
||||||
{
|
{
|
||||||
if (m_process) {
|
if (m_process) {
|
||||||
m_process->kill();
|
m_process->kill();
|
||||||
@@ -127,14 +128,14 @@ void ChangeSelectionDialog::recalculateToolTip(const QString &ref)
|
|||||||
m_process->setWorkingDirectory(workingDirectory());
|
m_process->setWorkingDirectory(workingDirectory());
|
||||||
m_process->setProcessEnvironment(m_gitEnvironment);
|
m_process->setProcessEnvironment(m_gitEnvironment);
|
||||||
|
|
||||||
connect(m_process, SIGNAL(finished(int)), this, SLOT(setToolTip(int)));
|
connect(m_process, SIGNAL(finished(int)), this, SLOT(setDetails(int)));
|
||||||
|
|
||||||
m_process->start(m_gitBinaryPath, args);
|
m_process->start(m_gitBinaryPath, args);
|
||||||
m_process->closeWriteChannel();
|
m_process->closeWriteChannel();
|
||||||
if (!m_process->waitForStarted())
|
if (!m_process->waitForStarted())
|
||||||
m_ui.changeNumberEdit->setToolTip(tr("Error: could not start git"));
|
m_ui.detailsText->setPlainText(tr("Error: could not start git"));
|
||||||
else
|
else
|
||||||
m_ui.changeNumberEdit->setToolTip(tr("Fetching commit data..."));
|
m_ui.detailsText->setPlainText(tr("Fetching commit data..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
@@ -55,8 +55,8 @@ public slots:
|
|||||||
void selectWorkingDirectory();
|
void selectWorkingDirectory();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setToolTip(int exitCode);
|
void setDetails(int exitCode);
|
||||||
void recalculateToolTip(const QString &ref);
|
void recalculateDetails(const QString &ref);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_ChangeSelectionDialog m_ui;
|
Ui_ChangeSelectionDialog m_ui;
|
||||||
|
@@ -6,16 +6,26 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>359</width>
|
<width>595</width>
|
||||||
<height>115</height>
|
<height>396</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<item row="3" column="0" colspan="3">
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="workingDirectoryLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Working directory:</string>
|
<string>Working directory:</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -32,22 +42,25 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="changeLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Change:</string>
|
<string>Change:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1" colspan="2">
|
||||||
<widget class="QLineEdit" name="changeNumberEdit"/>
|
<widget class="QLineEdit" name="changeNumberEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="3">
|
<item row="2" column="0" colspan="3">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QPlainTextEdit" name="detailsText">
|
||||||
<property name="orientation">
|
<property name="undoRedoEnabled">
|
||||||
<enum>Qt::Horizontal</enum>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons">
|
<property name="lineWrapMode">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<enum>QPlainTextEdit::NoWrap</enum>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Reference in New Issue
Block a user