forked from qt-creator/qt-creator
Utils: Add a QString-based write to QtcProcess
Centralize some boiler plate and warn about best-guessed cases. Keep the QByteArray based access as writeRaw() Fixes: QTCREATORBUG-27445 Change-Id: I948d80fba78b36cf85cc73664175ab05eb7707d4 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -176,7 +176,6 @@ void MergeTool::chooseAction()
|
||||
}
|
||||
|
||||
msgBox.exec();
|
||||
QByteArray ba;
|
||||
QVariant key;
|
||||
QAbstractButton *button = msgBox.clickedButton();
|
||||
if (button)
|
||||
@@ -184,9 +183,8 @@ void MergeTool::chooseAction()
|
||||
// either the message box was closed without clicking anything, or abort was clicked
|
||||
if (!key.isValid())
|
||||
key = QVariant('a'); // abort
|
||||
ba.append(key.toChar().toLatin1());
|
||||
ba.append('\n');
|
||||
write(ba);
|
||||
|
||||
write(QString(key.toChar()) + '\n');
|
||||
}
|
||||
|
||||
void MergeTool::addButton(QMessageBox *msgBox, const QString &text, char key)
|
||||
@@ -268,10 +266,10 @@ void MergeTool::done()
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void MergeTool::write(const QByteArray &bytes)
|
||||
void MergeTool::write(const QString &str)
|
||||
{
|
||||
m_process->write(bytes);
|
||||
VcsOutputWindow::append(QString::fromLocal8Bit(bytes));
|
||||
m_process->write(str);
|
||||
VcsOutputWindow::append(str);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user