Commit a9095ee1 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

VCS: Introduce message style



Similar to compile and app output panes

Change-Id: Ib9ac6d8be880739ae78d0a39f7051cbe616e46c2
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent f9c4889a
......@@ -2885,7 +2885,7 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
const bool rc = fullySynchronousGit(repositoryDirectory, args, &outputText, &errorText);
const QString stdErr = commandOutputFromLocal8Bit(errorText);
if (rc) {
outputWindow()->append(msgCommitted(amendSHA1, commitCount));
outputWindow()->appendMessage(msgCommitted(amendSHA1, commitCount));
outputWindow()->appendError(stdErr);
} else {
outputWindow()->appendError(tr("Cannot commit %n file(s): %1\n", 0, commitCount).arg(stdErr));
......
......@@ -1310,7 +1310,7 @@ void GitPlugin::applyPatch(const QString &workingDirectory, QString file)
QString errorMessage;
if (m_gitClient->synchronousApplyPatch(workingDirectory, file, &errorMessage)) {
if (errorMessage.isEmpty())
outwin->append(tr("Patch %1 successfully applied to %2").arg(file, workingDirectory));
outwin->appendMessage(tr("Patch %1 successfully applied to %2").arg(file, workingDirectory));
else
outwin->appendError(errorMessage);
} else {
......
......@@ -262,7 +262,7 @@ void MergeTool::done()
const QString workingDirectory = m_process->workingDirectory();
int exitCode = m_process->exitCode();
if (!exitCode) {
outputWindow->append(tr("Merge tool process finished successully."));
outputWindow->appendMessage(tr("Merge tool process finished successully."));
m_gitClient->continueCommandIfNeeded(workingDirectory);
} else {
outputWindow->appendError(tr("Merge tool process terminated with exit code %1")
......
......@@ -92,6 +92,8 @@ public:
void appendWarning(const QString &text);
// Append a bold command "10:00 " + "Executing: vcs -diff"
void appendCommand(const QString &text);
// Append a message text (e.g. "command has finished successfully") and pop up.
void appendMessage(const QString &text);
protected:
virtual void contextMenuEvent(QContextMenuEvent *event);
......@@ -103,6 +105,7 @@ private:
QTextCharFormat m_errorFormat;
QTextCharFormat m_warningFormat;
QTextCharFormat m_commandFormat;
QTextCharFormat m_messageFormat;
};
OutputWindowPlainTextEdit::OutputWindowPlainTextEdit(QWidget *parent) :
......@@ -110,13 +113,15 @@ OutputWindowPlainTextEdit::OutputWindowPlainTextEdit(QWidget *parent) :
m_defaultFormat(currentCharFormat()),
m_errorFormat(m_defaultFormat),
m_warningFormat(m_defaultFormat),
m_commandFormat(m_defaultFormat)
m_commandFormat(m_defaultFormat),
m_messageFormat(m_defaultFormat)
{
setReadOnly(true);
setFrameStyle(QFrame::NoFrame);
m_errorFormat.setForeground(Qt::red);
m_warningFormat.setForeground(Qt::darkYellow);
m_commandFormat.setFontWeight(QFont::Bold);
m_messageFormat.setForeground(Qt::blue);
}
// Search back for beginning of word
......@@ -239,6 +244,13 @@ void OutputWindowPlainTextEdit::appendCommand(const QString &text)
setCurrentCharFormat(m_defaultFormat);
}
void OutputWindowPlainTextEdit::appendMessage(const QString &text)
{
setCurrentCharFormat(m_messageFormat);
appendLines(text);
setCurrentCharFormat(m_defaultFormat);
}
} // namespace Internal
// ------------------- VcsBaseOutputWindowPrivate
......@@ -433,6 +445,11 @@ void VcsBaseOutputWindow::appendCommand(const QString &workingDirectory,
appendCommand(msgExecutionLogEntry(workingDirectory, binary, args));
}
void VcsBaseOutputWindow::appendMessage(const QString &text)
{
d->plainTextEdit()->appendMessage(text);
}
VcsBaseOutputWindow *VcsBaseOutputWindow::instance()
{
if (!VcsBaseOutputWindowPrivate::instance) {
......
......@@ -106,6 +106,9 @@ public slots:
const QString &binary,
const QStringList &args);
// Append a blue message text and pop up.
void appendMessage(const QString &text);
private:
VcsBaseOutputWindow();
......
......@@ -485,6 +485,7 @@ public:
connect(this, SIGNAL(appendError(QString)), outputWindow, SLOT(appendError(QString)));
connect(this, SIGNAL(appendCommand(QString,QString,QStringList)),
outputWindow, SLOT(appendCommand(QString,QString,QStringList)));
connect(this, SIGNAL(appendMessage(QString)), outputWindow, SLOT(appendMessage(QString)));
}
signals:
......@@ -494,6 +495,7 @@ signals:
void appendCommand(const QString &workingDirectory,
const QString &binary,
const QStringList &args);
void appendMessage(const QString &text);
};
/*!
......@@ -1038,7 +1040,7 @@ SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir,
// Success/Fail message in appropriate window?
if (response.result == SynchronousProcessResponse::Finished) {
if (flags & ShowSuccessMessage)
emit output.append(response.exitMessage(binary, timeOutMS));
emit output.appendMessage(response.exitMessage(binary, timeOutMS));
} else if (!(flags & SuppressFailMessageInLogWindow)) {
emit output.appendError(response.exitMessage(binary, timeOutMS));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment