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();
|
||||
connect(m_ui.changeNumberEdit, SIGNAL(textChanged(QString)),
|
||||
this, SLOT(recalculateToolTip(QString)));
|
||||
this, SLOT(recalculateDetails(QString)));
|
||||
recalculateDetails(m_ui.changeNumberEdit->text());
|
||||
}
|
||||
|
||||
ChangeSelectionDialog::~ChangeSelectionDialog()
|
||||
@@ -103,16 +104,16 @@ void ChangeSelectionDialog::selectWorkingDirectory()
|
||||
tr("Selected directory is not a Git repository"));
|
||||
}
|
||||
|
||||
//! Set commit message as toolTip
|
||||
void ChangeSelectionDialog::setToolTip(int exitCode)
|
||||
//! Set commit message in details
|
||||
void ChangeSelectionDialog::setDetails(int exitCode)
|
||||
{
|
||||
if (exitCode == 0)
|
||||
m_ui.changeNumberEdit->setToolTip(QString::fromUtf8(m_process->readAllStandardOutput()));
|
||||
m_ui.detailsText->setPlainText(QString::fromUtf8(m_process->readAllStandardOutput()));
|
||||
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) {
|
||||
m_process->kill();
|
||||
@@ -127,14 +128,14 @@ void ChangeSelectionDialog::recalculateToolTip(const QString &ref)
|
||||
m_process->setWorkingDirectory(workingDirectory());
|
||||
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->closeWriteChannel();
|
||||
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
|
||||
m_ui.changeNumberEdit->setToolTip(tr("Fetching commit data..."));
|
||||
m_ui.detailsText->setPlainText(tr("Fetching commit data..."));
|
||||
}
|
||||
|
||||
} // Internal
|
||||
|
@@ -55,8 +55,8 @@ public slots:
|
||||
void selectWorkingDirectory();
|
||||
|
||||
private slots:
|
||||
void setToolTip(int exitCode);
|
||||
void recalculateToolTip(const QString &ref);
|
||||
void setDetails(int exitCode);
|
||||
void recalculateDetails(const QString &ref);
|
||||
|
||||
private:
|
||||
Ui_ChangeSelectionDialog m_ui;
|
||||
|
@@ -6,16 +6,26 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>359</width>
|
||||
<height>115</height>
|
||||
<width>595</width>
|
||||
<height>396</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</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">
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="workingDirectoryLabel">
|
||||
<property name="text">
|
||||
<string>Working directory:</string>
|
||||
</property>
|
||||
@@ -32,22 +42,25 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="changeLabel">
|
||||
<property name="text">
|
||||
<string>Change:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="changeNumberEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<widget class="QPlainTextEdit" name="detailsText">
|
||||
<property name="undoRedoEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<property name="lineWrapMode">
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Reference in New Issue
Block a user