Commit 6b8c9363 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

VCS: Un-data functions that accept QString

Change-Id: Iffa82f4ab06162ab57e77301e77fb37ed7230bd5
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 706d0a82
...@@ -260,7 +260,7 @@ void GitDiffHandler::collectShowDescription(const QString &id) ...@@ -260,7 +260,7 @@ void GitDiffHandler::collectShowDescription(const QString &id)
m_editor->clear(m_waitMessage); m_editor->clear(m_waitMessage);
VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment); VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment);
command->setCodec(m_editor->editorWidget()->codec()); command->setCodec(m_editor->editorWidget()->codec());
connect(command, SIGNAL(outputData(QString)), this, SLOT(slotShowDescriptionReceived(QString))); connect(command, SIGNAL(output(QString)), this, SLOT(slotShowDescriptionReceived(QString)));
QStringList arguments; QStringList arguments;
arguments << QLatin1String("show") << QLatin1String("-s") << QLatin1String("--format=fuller") arguments << QLatin1String("show") << QLatin1String("-s") << QLatin1String("--format=fuller")
<< QLatin1String(noColorOption) << QLatin1String(decorateOption) << id; << QLatin1String(noColorOption) << QLatin1String(decorateOption) << id;
...@@ -288,7 +288,7 @@ void GitDiffHandler::collectFilesList(const QStringList &additionalArguments) ...@@ -288,7 +288,7 @@ void GitDiffHandler::collectFilesList(const QStringList &additionalArguments)
m_editor->clear(m_waitMessage); m_editor->clear(m_waitMessage);
VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment); VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment);
command->setCodec(m_editor->editorWidget()->codec()); command->setCodec(m_editor->editorWidget()->codec());
connect(command, SIGNAL(outputData(QString)), this, SLOT(slotFileListReceived(QString))); connect(command, SIGNAL(output(QString)), this, SLOT(slotFileListReceived(QString)));
QStringList arguments; QStringList arguments;
arguments << QLatin1String("diff") << QLatin1String("--name-only") << additionalArguments; arguments << QLatin1String("diff") << QLatin1String("--name-only") << additionalArguments;
command->addJob(arguments, m_timeout); command->addJob(arguments, m_timeout);
...@@ -356,7 +356,7 @@ void GitDiffHandler::collectFilesContents() ...@@ -356,7 +356,7 @@ void GitDiffHandler::collectFilesContents()
VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment); VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment);
if (m_editor) if (m_editor)
command->setCodec(m_editor->editorWidget()->codec()); command->setCodec(m_editor->editorWidget()->codec());
connect(command, SIGNAL(outputData(QString)), this, SLOT(slotFileContentsReceived(QString))); connect(command, SIGNAL(output(QString)), this, SLOT(slotFileContentsReceived(QString)));
QString revisionArgument = (revision.type == Other) QString revisionArgument = (revision.type == Other)
? revision.id : QString(); ? revision.id : QString();
...@@ -690,7 +690,7 @@ public: ...@@ -690,7 +690,7 @@ public:
{ {
if (parentCommand) { if (parentCommand) {
parentCommand->setExpectChanges(true); parentCommand->setExpectChanges(true);
connect(parentCommand, SIGNAL(outputData(QString)), this, SLOT(readStdOut(QString))); connect(parentCommand, SIGNAL(output(QString)), this, SLOT(readStdOut(QString)));
connect(parentCommand, SIGNAL(errorText(QString)), this, SLOT(readStdErr(QString))); connect(parentCommand, SIGNAL(errorText(QString)), this, SLOT(readStdErr(QString)));
} }
} }
...@@ -1228,14 +1228,14 @@ void GitClient::slotBlameRevisionRequested(const QString &source, QString change ...@@ -1228,14 +1228,14 @@ void GitClient::slotBlameRevisionRequested(const QString &source, QString change
blame(fi.absolutePath(), QStringList(), fi.fileName(), change, lineNumber); blame(fi.absolutePath(), QStringList(), fi.fileName(), change, lineNumber);
} }
void GitClient::appendOutputData(const QString &data) const void GitClient::appendOutput(const QString &text) const
{ {
outputWindow()->append(data); outputWindow()->append(text);
} }
void GitClient::appendOutputDataSilently(const QString &data) const void GitClient::appendOutputSilently(const QString &text) const
{ {
outputWindow()->appendSilently(data); outputWindow()->appendSilently(text);
} }
QTextCodec *GitClient::getSourceCodec(const QString &file) const QTextCodec *GitClient::getSourceCodec(const QString &file) const
...@@ -2216,12 +2216,11 @@ VcsBase::Command *GitClient::createCommand(const QString &workingDirectory, ...@@ -2216,12 +2216,11 @@ VcsBase::Command *GitClient::createCommand(const QString &workingDirectory,
connect(command, SIGNAL(finished(bool,int,QVariant)), editor, SLOT(commandFinishedGotoLine(bool,int,QVariant))); connect(command, SIGNAL(finished(bool,int,QVariant)), editor, SLOT(commandFinishedGotoLine(bool,int,QVariant)));
if (useOutputToWindow) { if (useOutputToWindow) {
if (editor) // assume that the commands output is the important thing if (editor) // assume that the commands output is the important thing
connect(command, SIGNAL(outputData(QString)), this, SLOT(appendOutputDataSilently(QString))); connect(command, SIGNAL(output(QString)), this, SLOT(appendOutputSilently(QString)));
else else
connect(command, SIGNAL(outputData(QString)), this, SLOT(appendOutputData(QString))); connect(command, SIGNAL(output(QString)), this, SLOT(appendOutput(QString)));
} else { } else if (editor) {
if (editor) connect(command, SIGNAL(output(QString)), editor, SLOT(setPlainTextFiltered(QString)));
connect(command, SIGNAL(outputData(QString)), editor, SLOT(setPlainTextDataFiltered(QString)));
} }
connect(command, SIGNAL(errorText(QString)), outputWindow(), SLOT(appendError(QString))); connect(command, SIGNAL(errorText(QString)), outputWindow(), SLOT(appendError(QString)));
......
...@@ -327,8 +327,8 @@ public slots: ...@@ -327,8 +327,8 @@ public slots:
private slots: private slots:
void slotBlameRevisionRequested(const QString &source, QString change, int lineNumber); void slotBlameRevisionRequested(const QString &source, QString change, int lineNumber);
void appendOutputData(const QString &data) const; void appendOutput(const QString &text) const;
void appendOutputDataSilently(const QString &data) const; void appendOutputSilently(const QString &text) const;
void finishSubmoduleUpdate(); void finishSubmoduleUpdate();
void fetchFinished(const QVariant &cookie); void fetchFinished(const QVariant &cookie);
......
...@@ -170,9 +170,9 @@ static QString removeAnnotationDate(const QString &b) ...@@ -170,9 +170,9 @@ static QString removeAnnotationDate(const QString &b)
return result; return result;
} }
void GitEditor::setPlainTextDataFiltered(const QString &a) void GitEditor::setPlainTextFiltered(const QString &text)
{ {
QString array = a; QString modText = text;
GitPlugin *plugin = GitPlugin::instance(); GitPlugin *plugin = GitPlugin::instance();
// If desired, filter out the date from annotation // If desired, filter out the date from annotation
switch (contentType()) switch (contentType())
...@@ -180,22 +180,22 @@ void GitEditor::setPlainTextDataFiltered(const QString &a) ...@@ -180,22 +180,22 @@ void GitEditor::setPlainTextDataFiltered(const QString &a)
case VcsBase::AnnotateOutput: { case VcsBase::AnnotateOutput: {
const bool omitAnnotationDate = plugin->settings().boolValue(GitSettings::omitAnnotationDateKey); const bool omitAnnotationDate = plugin->settings().boolValue(GitSettings::omitAnnotationDateKey);
if (omitAnnotationDate) if (omitAnnotationDate)
array = removeAnnotationDate(a); modText = removeAnnotationDate(text);
break; break;
} }
case VcsBase::DiffOutput: { case VcsBase::DiffOutput: {
if (array.isEmpty()) if (modText.isEmpty())
array = QLatin1String("No difference to HEAD"); modText = QLatin1String("No difference to HEAD");
const QFileInfo fi(source()); const QFileInfo fi(source());
const QString workingDirectory = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath(); const QString workingDirectory = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath();
QString precedes, follows; QString precedes, follows;
if (array.startsWith(QLatin1String("commit "))) { // show if (modText.startsWith(QLatin1String("commit "))) { // show
int lastHeaderLine = array.indexOf(QLatin1String("\n\n")) + 1; int lastHeaderLine = modText.indexOf(QLatin1String("\n\n")) + 1;
plugin->gitClient()->synchronousTagsForCommit(workingDirectory, array.mid(7, 8), precedes, follows); plugin->gitClient()->synchronousTagsForCommit(workingDirectory, modText.mid(7, 8), precedes, follows);
if (!precedes.isEmpty()) if (!precedes.isEmpty())
array.insert(lastHeaderLine, QLatin1String("Precedes: ") + precedes + QLatin1Char('\n')); modText.insert(lastHeaderLine, QLatin1String("Precedes: ") + precedes + QLatin1Char('\n'));
if (!follows.isEmpty()) if (!follows.isEmpty())
array.insert(lastHeaderLine, QLatin1String("Follows: ") + follows + QLatin1Char('\n')); modText.insert(lastHeaderLine, QLatin1String("Follows: ") + follows + QLatin1Char('\n'));
} }
break; break;
} }
...@@ -203,7 +203,7 @@ void GitEditor::setPlainTextDataFiltered(const QString &a) ...@@ -203,7 +203,7 @@ void GitEditor::setPlainTextDataFiltered(const QString &a)
break; break;
} }
setPlainText(array); setPlainText(modText);
} }
void GitEditor::commandFinishedGotoLine(bool ok, int exitCode, const QVariant &v) void GitEditor::commandFinishedGotoLine(bool ok, int exitCode, const QVariant &v)
......
...@@ -50,7 +50,7 @@ public: ...@@ -50,7 +50,7 @@ public:
QWidget *parent); QWidget *parent);
public slots: public slots:
void setPlainTextDataFiltered(const QString &a); void setPlainTextFiltered(const QString &text);
// Matches the signature of the finished signal of GitCommand // Matches the signature of the finished signal of GitCommand
void commandFinishedGotoLine(bool ok, int exitCode, const QVariant &v); void commandFinishedGotoLine(bool ok, int exitCode, const QVariant &v);
......
...@@ -261,7 +261,7 @@ void Command::run() ...@@ -261,7 +261,7 @@ void Command::run()
d->m_lastExecExitCode = exitCode; d->m_lastExecExitCode = exitCode;
if (ok) if (ok)
emit outputData(stdOutS); emit output(stdOutS);
if (!error.isEmpty()) if (!error.isEmpty())
emit errorText(error); emit errorText(error);
......
...@@ -84,7 +84,7 @@ private: ...@@ -84,7 +84,7 @@ private:
void run(); void run();
signals: signals:
void outputData(const QString &); void output(const QString &);
void errorText(const QString &); void errorText(const QString &);
void finished(bool ok, int exitCode, const QVariant &cookie); void finished(bool ok, int exitCode, const QVariant &cookie);
void success(const QVariant &cookie); void success(const QVariant &cookie);
......
...@@ -436,7 +436,7 @@ void VcsBaseClient::emitParsedStatus(const QString &repository, const QStringLis ...@@ -436,7 +436,7 @@ void VcsBaseClient::emitParsedStatus(const QString &repository, const QStringLis
QStringList args(vcsCommandString(StatusCommand)); QStringList args(vcsCommandString(StatusCommand));
args << extraOptions; args << extraOptions;
Command *cmd = createCommand(repository); Command *cmd = createCommand(repository);
connect(cmd, SIGNAL(outputData(QString)), this, SLOT(statusParser(QString))); connect(cmd, SIGNAL(output(QString)), this, SLOT(statusParser(QString)));
enqueueJob(cmd, args); enqueueJob(cmd, args);
} }
...@@ -598,15 +598,14 @@ Command *VcsBaseClient::createCommand(const QString &workingDirectory, ...@@ -598,15 +598,14 @@ Command *VcsBaseClient::createCommand(const QString &workingDirectory,
d->bindCommandToEditor(cmd, editor); d->bindCommandToEditor(cmd, editor);
if (mode == VcsWindowOutputBind) { if (mode == VcsWindowOutputBind) {
if (editor) { // assume that the commands output is the important thing if (editor) { // assume that the commands output is the important thing
connect(cmd, SIGNAL(outputData(QString)), connect(cmd, SIGNAL(output(QString)),
::vcsOutputWindow(), SLOT(appendSilently(QString))); ::vcsOutputWindow(), SLOT(appendSilently(QString)));
} else { } else {
connect(cmd, SIGNAL(outputData(QString)), connect(cmd, SIGNAL(output(QString)),
::vcsOutputWindow(), SLOT(append(QString))); ::vcsOutputWindow(), SLOT(append(QString)));
} }
} else if (editor) { } else if (editor) {
connect(cmd, SIGNAL(outputData(QString)), connect(cmd, SIGNAL(output(QString)), editor, SLOT(setPlainText(QString)));
editor, SLOT(setPlainTextData(QString)));
} }
if (::vcsOutputWindow()) if (::vcsOutputWindow())
......
...@@ -433,19 +433,6 @@ void VcsBaseOutputWindow::appendCommand(const QString &workingDirectory, ...@@ -433,19 +433,6 @@ void VcsBaseOutputWindow::appendCommand(const QString &workingDirectory,
appendCommand(msgExecutionLogEntry(workingDirectory, binary, args)); appendCommand(msgExecutionLogEntry(workingDirectory, binary, args));
} }
void VcsBaseOutputWindow::appendData(const QByteArray &data)
{
appendDataSilently(data);
if (!d->plainTextEdit()->isVisible())
popup(Core::IOutputPane::NoModeSwitch);
}
void VcsBaseOutputWindow::appendDataSilently(const QByteArray &data)
{
appendSilently(QTextCodec::codecForLocale()->toUnicode(data));
}
VcsBaseOutputWindow *VcsBaseOutputWindow::instance() VcsBaseOutputWindow *VcsBaseOutputWindow::instance()
{ {
if (!VcsBaseOutputWindowPrivate::instance) { if (!VcsBaseOutputWindowPrivate::instance) {
......
...@@ -87,13 +87,9 @@ public slots: ...@@ -87,13 +87,9 @@ public slots:
// Append text and pop up. // Append text and pop up.
void append(const QString &text); void append(const QString &text);
// Append data using the Locale's converter and pop up.
void appendData(const QByteArray &data);
// Silently append text, do not pop up. // Silently append text, do not pop up.
void appendSilently(const QString &text); void appendSilently(const QString &text);
// Silently append data using the Locale's converter, do not pop up.
void appendDataSilently(const QByteArray &data);
// Append red error text and pop up. // Append red error text and pop up.
void appendError(const QString &text); void appendError(const QString &text);
......
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