Utils: Introduce a convenience function creatorColor()

... forwarding to creatorTheme()->color(...)

Change-Id: Iefaa043495127b3e500ed225584481d3ec0f8c1f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2024-05-29 11:45:22 +02:00
parent d41f15390f
commit efae651924
100 changed files with 327 additions and 339 deletions

View File

@@ -172,18 +172,16 @@ void ChangeSelectionDialog::acceptCommand(ChangeCommand command)
//! Set commit message in details
void ChangeSelectionDialog::setDetails()
{
Theme *theme = creatorTheme();
QPalette palette;
if (m_process->result() == ProcessResult::FinishedWithSuccess) {
m_detailsText->setPlainText(m_process->cleanedStdOut());
palette.setColor(QPalette::Text, theme->color(Theme::TextColorNormal));
palette.setColor(QPalette::Text, creatorColor(Theme::TextColorNormal));
m_changeNumberEdit->setPalette(palette);
} else if (m_process->result() == ProcessResult::StartFailed) {
m_detailsText->setPlainText(Tr::tr("Error: Could not start Git."));
} else {
m_detailsText->setPlainText(Tr::tr("Error: Unknown reference"));
palette.setColor(QPalette::Text, theme->color(Theme::TextColorError));
palette.setColor(QPalette::Text, creatorColor(Theme::TextColorError));
m_changeNumberEdit->setPalette(palette);
enableButtons(false);
}

View File

@@ -228,7 +228,7 @@ void GerritPushDialog::setChangeRange()
const int currentRange = range.toInt();
QPalette palette = QApplication::palette();
if (currentRange > ReasonableDistance) {
const QColor errorColor = Utils::creatorTheme()->color(Utils::Theme::TextColorError);
const QColor errorColor = Utils::creatorColor(Utils::Theme::TextColorError);
palette.setColor(QPalette::WindowText, errorColor);
palette.setColor(QPalette::ButtonText, errorColor);
labelText.append("\n" + Git::Tr::tr("Are you sure you selected the right target branch?"));

View File

@@ -3154,7 +3154,7 @@ void GitClient::push(const FilePath &workingDirectory, const QStringList &pushAr
return;
if (pushFailure == PushFailure::NonFastForward) {
const QColor warnColor = Utils::creatorTheme()->color(Theme::TextColorError);
const QColor warnColor = Utils::creatorColor(Theme::TextColorError);
if (QMessageBox::question(
Core::ICore::dialogParent(), Tr::tr("Force Push"),
Tr::tr("Push failed. Would you like to force-push <span style=\"color:#%1\">"

View File

@@ -120,8 +120,7 @@ void GitSubmitEditorWidget::setPanelInfo(const GitSubmitEditorPanelInfo &info)
{
m_gitSubmitPanel->repositoryLabel->setText(info.repository.toUserOutput());
if (info.branch.contains("(no branch)")) {
const QString errorColor =
Utils::creatorTheme()->color(Utils::Theme::TextColorError).name();
const QString errorColor = Utils::creatorColor(Utils::Theme::TextColorError).name();
m_gitSubmitPanel->branchLabel->setText(QString::fromLatin1("<span style=\"color:%1\">%2</span>")
.arg(errorColor, Tr::tr("Detached HEAD")));
} else {