forked from qt-creator/qt-creator
VCS: Un-data functions that accept QString
Change-Id: Iffa82f4ab06162ab57e77301e77fb37ed7230bd5 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
706d0a821e
commit
6b8c93637b
@@ -260,7 +260,7 @@ void GitDiffHandler::collectShowDescription(const QString &id)
|
||||
m_editor->clear(m_waitMessage);
|
||||
VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment);
|
||||
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;
|
||||
arguments << QLatin1String("show") << QLatin1String("-s") << QLatin1String("--format=fuller")
|
||||
<< QLatin1String(noColorOption) << QLatin1String(decorateOption) << id;
|
||||
@@ -288,7 +288,7 @@ void GitDiffHandler::collectFilesList(const QStringList &additionalArguments)
|
||||
m_editor->clear(m_waitMessage);
|
||||
VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment);
|
||||
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;
|
||||
arguments << QLatin1String("diff") << QLatin1String("--name-only") << additionalArguments;
|
||||
command->addJob(arguments, m_timeout);
|
||||
@@ -356,7 +356,7 @@ void GitDiffHandler::collectFilesContents()
|
||||
VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment);
|
||||
if (m_editor)
|
||||
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)
|
||||
? revision.id : QString();
|
||||
@@ -690,7 +690,7 @@ public:
|
||||
{
|
||||
if (parentCommand) {
|
||||
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)));
|
||||
}
|
||||
}
|
||||
@@ -1228,14 +1228,14 @@ void GitClient::slotBlameRevisionRequested(const QString &source, QString change
|
||||
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
|
||||
@@ -2216,12 +2216,11 @@ VcsBase::Command *GitClient::createCommand(const QString &workingDirectory,
|
||||
connect(command, SIGNAL(finished(bool,int,QVariant)), editor, SLOT(commandFinishedGotoLine(bool,int,QVariant)));
|
||||
if (useOutputToWindow) {
|
||||
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
|
||||
connect(command, SIGNAL(outputData(QString)), this, SLOT(appendOutputData(QString)));
|
||||
} else {
|
||||
if (editor)
|
||||
connect(command, SIGNAL(outputData(QString)), editor, SLOT(setPlainTextDataFiltered(QString)));
|
||||
connect(command, SIGNAL(output(QString)), this, SLOT(appendOutput(QString)));
|
||||
} else if (editor) {
|
||||
connect(command, SIGNAL(output(QString)), editor, SLOT(setPlainTextFiltered(QString)));
|
||||
}
|
||||
|
||||
connect(command, SIGNAL(errorText(QString)), outputWindow(), SLOT(appendError(QString)));
|
||||
|
@@ -327,8 +327,8 @@ public slots:
|
||||
|
||||
private slots:
|
||||
void slotBlameRevisionRequested(const QString &source, QString change, int lineNumber);
|
||||
void appendOutputData(const QString &data) const;
|
||||
void appendOutputDataSilently(const QString &data) const;
|
||||
void appendOutput(const QString &text) const;
|
||||
void appendOutputSilently(const QString &text) const;
|
||||
void finishSubmoduleUpdate();
|
||||
void fetchFinished(const QVariant &cookie);
|
||||
|
||||
|
@@ -170,9 +170,9 @@ static QString removeAnnotationDate(const QString &b)
|
||||
return result;
|
||||
}
|
||||
|
||||
void GitEditor::setPlainTextDataFiltered(const QString &a)
|
||||
void GitEditor::setPlainTextFiltered(const QString &text)
|
||||
{
|
||||
QString array = a;
|
||||
QString modText = text;
|
||||
GitPlugin *plugin = GitPlugin::instance();
|
||||
// If desired, filter out the date from annotation
|
||||
switch (contentType())
|
||||
@@ -180,22 +180,22 @@ void GitEditor::setPlainTextDataFiltered(const QString &a)
|
||||
case VcsBase::AnnotateOutput: {
|
||||
const bool omitAnnotationDate = plugin->settings().boolValue(GitSettings::omitAnnotationDateKey);
|
||||
if (omitAnnotationDate)
|
||||
array = removeAnnotationDate(a);
|
||||
modText = removeAnnotationDate(text);
|
||||
break;
|
||||
}
|
||||
case VcsBase::DiffOutput: {
|
||||
if (array.isEmpty())
|
||||
array = QLatin1String("No difference to HEAD");
|
||||
if (modText.isEmpty())
|
||||
modText = QLatin1String("No difference to HEAD");
|
||||
const QFileInfo fi(source());
|
||||
const QString workingDirectory = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath();
|
||||
QString precedes, follows;
|
||||
if (array.startsWith(QLatin1String("commit "))) { // show
|
||||
int lastHeaderLine = array.indexOf(QLatin1String("\n\n")) + 1;
|
||||
plugin->gitClient()->synchronousTagsForCommit(workingDirectory, array.mid(7, 8), precedes, follows);
|
||||
if (modText.startsWith(QLatin1String("commit "))) { // show
|
||||
int lastHeaderLine = modText.indexOf(QLatin1String("\n\n")) + 1;
|
||||
plugin->gitClient()->synchronousTagsForCommit(workingDirectory, modText.mid(7, 8), precedes, follows);
|
||||
if (!precedes.isEmpty())
|
||||
array.insert(lastHeaderLine, QLatin1String("Precedes: ") + precedes + QLatin1Char('\n'));
|
||||
modText.insert(lastHeaderLine, QLatin1String("Precedes: ") + precedes + QLatin1Char('\n'));
|
||||
if (!follows.isEmpty())
|
||||
array.insert(lastHeaderLine, QLatin1String("Follows: ") + follows + QLatin1Char('\n'));
|
||||
modText.insert(lastHeaderLine, QLatin1String("Follows: ") + follows + QLatin1Char('\n'));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -203,7 +203,7 @@ void GitEditor::setPlainTextDataFiltered(const QString &a)
|
||||
break;
|
||||
}
|
||||
|
||||
setPlainText(array);
|
||||
setPlainText(modText);
|
||||
}
|
||||
|
||||
void GitEditor::commandFinishedGotoLine(bool ok, int exitCode, const QVariant &v)
|
||||
|
@@ -50,7 +50,7 @@ public:
|
||||
QWidget *parent);
|
||||
|
||||
public slots:
|
||||
void setPlainTextDataFiltered(const QString &a);
|
||||
void setPlainTextFiltered(const QString &text);
|
||||
// Matches the signature of the finished signal of GitCommand
|
||||
void commandFinishedGotoLine(bool ok, int exitCode, const QVariant &v);
|
||||
|
||||
|
@@ -261,7 +261,7 @@ void Command::run()
|
||||
d->m_lastExecExitCode = exitCode;
|
||||
|
||||
if (ok)
|
||||
emit outputData(stdOutS);
|
||||
emit output(stdOutS);
|
||||
|
||||
if (!error.isEmpty())
|
||||
emit errorText(error);
|
||||
|
@@ -84,7 +84,7 @@ private:
|
||||
void run();
|
||||
|
||||
signals:
|
||||
void outputData(const QString &);
|
||||
void output(const QString &);
|
||||
void errorText(const QString &);
|
||||
void finished(bool ok, int exitCode, const QVariant &cookie);
|
||||
void success(const QVariant &cookie);
|
||||
|
@@ -436,7 +436,7 @@ void VcsBaseClient::emitParsedStatus(const QString &repository, const QStringLis
|
||||
QStringList args(vcsCommandString(StatusCommand));
|
||||
args << extraOptions;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -598,15 +598,14 @@ Command *VcsBaseClient::createCommand(const QString &workingDirectory,
|
||||
d->bindCommandToEditor(cmd, editor);
|
||||
if (mode == VcsWindowOutputBind) {
|
||||
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)));
|
||||
} else {
|
||||
connect(cmd, SIGNAL(outputData(QString)),
|
||||
connect(cmd, SIGNAL(output(QString)),
|
||||
::vcsOutputWindow(), SLOT(append(QString)));
|
||||
}
|
||||
} else if (editor) {
|
||||
connect(cmd, SIGNAL(outputData(QString)),
|
||||
editor, SLOT(setPlainTextData(QString)));
|
||||
connect(cmd, SIGNAL(output(QString)), editor, SLOT(setPlainText(QString)));
|
||||
}
|
||||
|
||||
if (::vcsOutputWindow())
|
||||
|
@@ -433,19 +433,6 @@ void VcsBaseOutputWindow::appendCommand(const QString &workingDirectory,
|
||||
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()
|
||||
{
|
||||
if (!VcsBaseOutputWindowPrivate::instance) {
|
||||
|
@@ -87,13 +87,9 @@ public slots:
|
||||
|
||||
// Append text and pop up.
|
||||
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.
|
||||
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.
|
||||
void appendError(const QString &text);
|
||||
|
Reference in New Issue
Block a user