forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/9.0'
Change-Id: I2123e09f75199a63af6e8505fb8889e7f9d025d2
This commit is contained in:
@@ -343,15 +343,17 @@ QStringView FilePath::host() const
|
||||
|
||||
QString FilePath::path() const
|
||||
{
|
||||
if (m_data.startsWith("/./"))
|
||||
return m_data.mid(3, m_pathLen - 3);
|
||||
QTC_ASSERT(!m_data.startsWith(u"/./"), return m_data.mid(3, m_pathLen - 3));
|
||||
return m_data.left(m_pathLen);
|
||||
}
|
||||
|
||||
void FilePath::setParts(const QStringView scheme, const QStringView host, const QStringView path)
|
||||
void FilePath::setParts(const QStringView scheme, const QStringView host, QStringView path)
|
||||
{
|
||||
QTC_CHECK(!scheme.contains('/'));
|
||||
|
||||
if (path.startsWith(u"/./"))
|
||||
path = path.mid(3);
|
||||
|
||||
m_data = path.toString() + scheme.toString() + host.toString();
|
||||
m_schemeLen = scheme.size();
|
||||
m_hostLen = host.size();
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
#include <qt_windows.h>
|
||||
#else
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
@@ -127,7 +129,7 @@ void ProcessHelper::interruptPid(qint64 pid)
|
||||
#ifdef Q_OS_WIN
|
||||
EnumWindows(sendInterruptMessageToAllWindowsOfProcess_enumWnd, pid);
|
||||
#else
|
||||
Q_UNUSED(pid)
|
||||
::kill(pid, SIGINT);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -459,8 +459,7 @@ private:
|
||||
m_handle->kill();
|
||||
break;
|
||||
case ControlSignal::Interrupt:
|
||||
if (m_setup.m_useCtrlCStub) // bypass launcher and interrupt directly
|
||||
ProcessHelper::interruptPid(m_handle->processId());
|
||||
ProcessHelper::interruptPid(m_handle->processId());
|
||||
break;
|
||||
case ControlSignal::KickOff:
|
||||
QTC_CHECK(false);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "qdbutils.h"
|
||||
#include "qdbconstants.h"
|
||||
#include "qdbdevicedebugsupport.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
@@ -17,6 +16,7 @@
|
||||
#include <utils/portlist.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/theme/theme.h>
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
~QdbProcessImpl() { killIfRunning(); }
|
||||
|
||||
private:
|
||||
void sendControlSignal(ControlSignal controlSignal) final
|
||||
void handleSendControlSignal(ControlSignal controlSignal) final
|
||||
{
|
||||
QTC_ASSERT(controlSignal != ControlSignal::Interrupt, return);
|
||||
QTC_ASSERT(controlSignal != ControlSignal::KickOff, return);
|
||||
|
||||
@@ -2534,6 +2534,9 @@ bool EditorManagerPrivate::saveDocumentAs(IDocument *document)
|
||||
// re-think part of the editors design.
|
||||
|
||||
if (success) {
|
||||
// if document had been temporary before (scratch buffer) - remove the temporary flag
|
||||
document->setTemporary(false);
|
||||
|
||||
addDocumentToRecentFiles(document);
|
||||
emit m_instance->saved(document);
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ GeneralSettingsWidget::GeneralSettingsWidget(GeneralSettings *q)
|
||||
, m_themeChooser(new ThemeChooser)
|
||||
, m_resetWarningsButton(new QPushButton)
|
||||
{
|
||||
m_languageBox->setObjectName("languageBox");
|
||||
m_languageBox->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
|
||||
m_languageBox->setMinimumContentsLength(20);
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ void GdbMi::parseResultOrValue(DebuggerOutputParser &parser)
|
||||
}
|
||||
|
||||
// Reads one \ooo entity.
|
||||
static bool parseOctalEscapedHelper(DebuggerOutputParser &parser, QString &buffer)
|
||||
static bool parseOctalEscapedHelper(DebuggerOutputParser &parser, QByteArray &buffer)
|
||||
{
|
||||
if (parser.remainingChars() < 4)
|
||||
return false;
|
||||
@@ -130,7 +130,7 @@ static bool parseOctalEscapedHelper(DebuggerOutputParser &parser, QString &buffe
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool parseHexEscapedHelper(DebuggerOutputParser &parser, QString &buffer)
|
||||
static bool parseHexEscapedHelper(DebuggerOutputParser &parser, QByteArray &buffer)
|
||||
{
|
||||
if (parser.remainingChars() < 4)
|
||||
return false;
|
||||
@@ -178,16 +178,15 @@ static void parseSimpleEscape(DebuggerOutputParser &parser, QString &result)
|
||||
// *or* one escaped char, *or* one unescaped char.
|
||||
static void parseCharOrEscape(DebuggerOutputParser &parser, QString &result)
|
||||
{
|
||||
const int oldSize = result.size();
|
||||
while (parseOctalEscapedHelper(parser, result))
|
||||
QByteArray buffer;
|
||||
while (parseOctalEscapedHelper(parser, buffer))
|
||||
;
|
||||
while (parseHexEscapedHelper(parser, result))
|
||||
while (parseHexEscapedHelper(parser, buffer))
|
||||
;
|
||||
|
||||
if (result.size() != oldSize)
|
||||
return;
|
||||
|
||||
if (parser.isCurrent('\\')) {
|
||||
if (!buffer.isEmpty()) {
|
||||
result.append(QString::fromUtf8(buffer));
|
||||
} else if (parser.isCurrent('\\')) {
|
||||
parser.advance();
|
||||
parseSimpleEscape(parser, result);
|
||||
} else {
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
private:
|
||||
QString fullCommandLine(const CommandLine &commandLine) const final;
|
||||
void sendControlSignal(Utils::ControlSignal controlSignal) final;
|
||||
void handleSendControlSignal(Utils::ControlSignal controlSignal) final;
|
||||
|
||||
const QString m_pidFile;
|
||||
};
|
||||
@@ -71,7 +71,7 @@ QString QnxProcessImpl::fullCommandLine(const CommandLine &commandLine) const
|
||||
return fullCommandLine;
|
||||
}
|
||||
|
||||
void QnxProcessImpl::sendControlSignal(Utils::ControlSignal controlSignal)
|
||||
void QnxProcessImpl::handleSendControlSignal(Utils::ControlSignal controlSignal)
|
||||
{
|
||||
QTC_ASSERT(controlSignal != ControlSignal::KickOff, return);
|
||||
const QString args = QString::fromLatin1("-%1 `cat %2`")
|
||||
|
||||
@@ -481,7 +481,17 @@ qint64 SshProcessInterface::processId() const
|
||||
|
||||
bool SshProcessInterface::runInShell(const CommandLine &command, const QByteArray &data)
|
||||
{
|
||||
return d->m_devicePrivate->runInShell(command, data).exitCode == 0;
|
||||
QtcProcess process;
|
||||
CommandLine cmd = {d->m_device->filePath("/bin/sh"), {"-c"}};
|
||||
QString tmp;
|
||||
ProcessArgs::addArg(&tmp, command.executable().path());
|
||||
ProcessArgs::addArgs(&tmp, command.arguments());
|
||||
cmd.addArg(tmp);
|
||||
process.setCommand(cmd);
|
||||
process.setWriteData(data);
|
||||
process.start();
|
||||
QTC_CHECK(process.waitForFinished()); // otherwise we may start producing killers for killers
|
||||
return process.exitCode() == 0;
|
||||
}
|
||||
|
||||
void SshProcessInterface::start()
|
||||
@@ -494,6 +504,20 @@ qint64 SshProcessInterface::write(const QByteArray &data)
|
||||
return d->m_process.writeRaw(data);
|
||||
}
|
||||
|
||||
void SshProcessInterface::sendControlSignal(Utils::ControlSignal controlSignal)
|
||||
{
|
||||
if (d->m_process.usesTerminal()) {
|
||||
switch (controlSignal) {
|
||||
case Utils::ControlSignal::Terminate: d->m_process.terminate(); break;
|
||||
case Utils::ControlSignal::Kill: d->m_process.kill(); break;
|
||||
case Utils::ControlSignal::Interrupt: d->m_process.interrupt(); break;
|
||||
case Utils::ControlSignal::KickOff: d->m_process.kickoffProcess(); break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
handleSendControlSignal(controlSignal);
|
||||
}
|
||||
|
||||
LinuxProcessInterface::LinuxProcessInterface(const LinuxDevice *linuxDevice)
|
||||
: SshProcessInterface(linuxDevice)
|
||||
{
|
||||
@@ -504,7 +528,7 @@ LinuxProcessInterface::~LinuxProcessInterface()
|
||||
killIfRunning();
|
||||
}
|
||||
|
||||
void LinuxProcessInterface::sendControlSignal(ControlSignal controlSignal)
|
||||
void LinuxProcessInterface::handleSendControlSignal(ControlSignal controlSignal)
|
||||
{
|
||||
QTC_ASSERT(controlSignal != ControlSignal::KickOff, return);
|
||||
const qint64 pid = processId();
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
~LinuxProcessInterface();
|
||||
|
||||
private:
|
||||
void sendControlSignal(Utils::ControlSignal controlSignal) override;
|
||||
void handleSendControlSignal(Utils::ControlSignal controlSignal) override;
|
||||
|
||||
void handleStarted(qint64 processId) final;
|
||||
void handleDone(const Utils::ProcessResultData &resultData) final;
|
||||
|
||||
@@ -31,12 +31,13 @@ private:
|
||||
virtual void handleDone(const Utils::ProcessResultData &resultData);
|
||||
virtual void handleReadyReadStandardOutput(const QByteArray &outputData);
|
||||
virtual void handleReadyReadStandardError(const QByteArray &errorData);
|
||||
virtual void handleSendControlSignal(Utils::ControlSignal controlSignal) = 0;
|
||||
|
||||
virtual QString fullCommandLine(const Utils::CommandLine &commandLine) const = 0;
|
||||
|
||||
void start() final;
|
||||
qint64 write(const QByteArray &data) final;
|
||||
void sendControlSignal(Utils::ControlSignal controlSignal) override = 0;
|
||||
void sendControlSignal(Utils::ControlSignal controlSignal) final;
|
||||
|
||||
friend class SshProcessInterfacePrivate;
|
||||
SshProcessInterfacePrivate *d = nullptr;
|
||||
|
||||
@@ -686,6 +686,8 @@ public:
|
||||
{
|
||||
QRectF rect;
|
||||
const TextMark *mark;
|
||||
friend bool operator==(const AnnotationRect &a, const AnnotationRect &b)
|
||||
{ return a.mark == b.mark && a.rect == b.rect; }
|
||||
};
|
||||
QMap<int, QList<AnnotationRect>> m_annotationRects;
|
||||
QRectF getLastLineLineRect(const QTextBlock &block);
|
||||
@@ -4026,7 +4028,7 @@ void TextEditorWidgetPrivate::updateLineAnnotation(const PaintEventData &data,
|
||||
const PaintEventBlockData &blockData,
|
||||
QPainter &painter)
|
||||
{
|
||||
m_annotationRects.remove(data.block.blockNumber());
|
||||
const QList<AnnotationRect> previousRects = m_annotationRects.take(data.block.blockNumber());
|
||||
|
||||
if (!m_displaySettings.m_displayAnnotations)
|
||||
return;
|
||||
@@ -4084,6 +4086,7 @@ void TextEditorWidgetPrivate::updateLineAnnotation(const PaintEventData &data,
|
||||
}
|
||||
}
|
||||
|
||||
QList<AnnotationRect> newRects;
|
||||
for (const TextMark *mark : std::as_const(marks)) {
|
||||
boundingRect = QRectF(x, boundingRect.top(), q->viewport()->width() - x, boundingRect.height());
|
||||
if (boundingRect.isEmpty())
|
||||
@@ -4098,8 +4101,16 @@ void TextEditorWidgetPrivate::updateLineAnnotation(const PaintEventData &data,
|
||||
|
||||
x = boundingRect.right();
|
||||
offset = itemOffset / 2;
|
||||
m_annotationRects[data.block.blockNumber()].append({boundingRect, mark});
|
||||
newRects.append({boundingRect, mark});
|
||||
}
|
||||
|
||||
if (previousRects != newRects) {
|
||||
for (const AnnotationRect &annotationRect : qAsConst(newRects))
|
||||
q->viewport()->update(annotationRect.rect.toAlignedRect());
|
||||
for (const AnnotationRect &annotationRect : previousRects)
|
||||
q->viewport()->update(annotationRect.rect.toAlignedRect());
|
||||
}
|
||||
m_annotationRects[data.block.blockNumber()] = newRects;
|
||||
}
|
||||
|
||||
QColor blendRightMarginColor(const FontSettings &settings, bool areaColor)
|
||||
|
||||
Reference in New Issue
Block a user