ChangeSelectionDialog: Connect to done() signal instead of finished()

Don't call blocking waitForStarted() and handle failed to start
case inside done() handler.

Change-Id: I6f88703c4ddc2c26af27b449eaa5be9ef087b1a2
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-06-20 17:38:32 +02:00
parent 01398fb1d4
commit d7b1e87fac

View File

@@ -165,6 +165,8 @@ void ChangeSelectionDialog::setDetails()
m_ui->detailsText->setPlainText(m_process->cleanedStdOut());
palette.setColor(QPalette::Text, theme->color(Theme::TextColorNormal));
m_ui->changeNumberEdit->setPalette(palette);
} else if (m_process->result() == ProcessResult::StartFailed) {
m_ui->detailsText->setPlainText(tr("Error: Could not start Git."));
} else {
m_ui->detailsText->setPlainText(tr("Error: Unknown reference"));
palette.setColor(QPalette::Text, theme->color(Theme::TextColorError));
@@ -218,17 +220,12 @@ void ChangeSelectionDialog::recalculateDetails()
}
m_process.reset(new QtcProcess);
connect(m_process.get(), &QtcProcess::done, this, &ChangeSelectionDialog::setDetails);
m_process->setWorkingDirectory(workingDir);
m_process->setEnvironment(m_gitEnvironment);
m_process->setCommand({m_gitExecutable, {"show", "--decorate", "--stat=80", ref}});
connect(m_process.get(), &QtcProcess::finished, this, &ChangeSelectionDialog::setDetails);
m_process->start();
if (!m_process->waitForStarted())
m_ui->detailsText->setPlainText(tr("Error: Could not start Git."));
else
m_ui->detailsText->setPlainText(tr("Fetching commit data..."));
m_ui->detailsText->setPlainText(tr("Fetching commit data..."));
}
void ChangeSelectionDialog::changeTextChanged(const QString &text)