Merge remote-tracking branch 'origin/4.12'

Change-Id: Ibd37fd7aedbd0bcb1db56f92e6477abf9c9ab686
This commit is contained in:
Eike Ziller
2020-02-17 10:17:31 +01:00
11 changed files with 70 additions and 30 deletions

View File

@@ -169,8 +169,8 @@ public:
return {};
}
QString m_version;
QString m_file;
QString m_version;
QString m_desc;
QString m_vendor;
QString m_url;
@@ -497,7 +497,7 @@ DeviceSelection DeviceSelectionView::buildSelection(const DeviceSelectionItem *i
default:
break;
}
} while (item = item->parentPackItem());
} while ((item = item->parentPackItem()));
return selection;
}

View File

@@ -373,11 +373,6 @@ bool UvscClient::fetchStackFrames(quint32 taskId, quint64 address, GdbMi &data)
if (!checkConnection())
return false;
iSTKENUM istkenum = {};
istkenum.task = taskId;
istkenum.isFull = true;
istkenum.hasExtended = true;
std::vector<STACKENUM> stackenums;
const bool success = enumerateStack(taskId, stackenums);
if (!success) {

View File

@@ -1486,14 +1486,19 @@ bool GitClient::synchronousParentRevisions(const QString &workingDirectory,
return true;
}
// Short SHA1, author, subject
static const char defaultShortLogFormatC[] = "%h (%an \"%s";
static const int maxShortLogLength = 120;
QString GitClient::synchronousShortDescription(const QString &workingDirectory, const QString &revision) const
{
// HACK: The hopefully rare "_-_" will be replaced by quotes in the output,
// leaving it in breaks command line quoting on Windows, see QTCREATORBUG-23208.
const QString quoteReplacement = "_-_";
// Short SHA1, author, subject
const QString defaultShortLogFormat = "%h (%an " + quoteReplacement + "%s";
const int maxShortLogLength = 120;
// Short SHA 1, author, subject
QString output = synchronousShortDescription(workingDirectory, revision, defaultShortLogFormatC);
QString output = synchronousShortDescription(workingDirectory, revision, defaultShortLogFormat);
output.replace(quoteReplacement, "\"");
if (output != revision) {
if (output.length() > maxShortLogLength) {
output.truncate(maxShortLogLength);
@@ -3108,6 +3113,8 @@ void GitClient::push(const QString &workingDirectory, const QStringList &pushArg
this, [this, command, workingDirectory, pushArgs](bool success) {
if (!success) {
switch (static_cast<PushFailure>(command->cookie().toInt())) {
case Unknown:
break;
case NonFastForward: {
const QColor warnColor = Utils::creatorTheme()->color(Theme::TextColorError);
if (QMessageBox::question(

View File

@@ -80,6 +80,7 @@ enum StashFlag {
};
enum PushFailure {
Unknown,
NonFastForward,
NoRemoteBranch
};

View File

@@ -919,6 +919,14 @@ GitPluginPrivate::GitPluginPrivate()
m_gerritPlugin->initialize(remoteRepositoryMenu);
m_gerritPlugin->updateActions(currentState());
m_gerritPlugin->addToLocator(m_commandLocator);
connect(VcsOutputWindow::instance(), &VcsOutputWindow::referenceClicked,
this, [this](const QString &name) {
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient.show(state.topLevel(), name);
});
}
void GitPluginPrivate::diffCurrentFile()

View File

@@ -109,11 +109,6 @@ static NimbleMetadata parseMetadata(const QString &nimblePath, const QString &wo
NimbleBuildSystem::NimbleBuildSystem(Target *target)
: BuildSystem(target), m_projectScanner(target->project())
{
// Not called in parseProject due to nimble behavior to create temporary
// files in project directory. This creation in turn stimulate the fs watcher
// that in turn causes project parsing (thus a loop if invoke in parseProject).
// For this reason we call this function manually during project creation
// See https://github.com/nim-lang/nimble/issues/720
m_projectScanner.watchProjectFilePath();
connect(&m_projectScanner, &NimProjectScanner::fileChanged, this, [this](const QString &path) {
@@ -126,8 +121,11 @@ NimbleBuildSystem::NimbleBuildSystem(Target *target)
connect(&m_projectScanner, &NimProjectScanner::finished, this, &NimbleBuildSystem::updateProject);
connect(&m_projectScanner, &NimProjectScanner::directoryChanged, this, [this] {
if (!isWaitingForParse())
connect(&m_projectScanner, &NimProjectScanner::directoryChanged, this, [this] (const QString &directory){
// Workaround for nimble creating temporary files in project root directory
// when querying the list of tasks.
// See https://github.com/nim-lang/nimble/issues/720
if (directory != projectDirectory().toString())
requestDelayedParse();
});
@@ -151,8 +149,8 @@ void NimbleBuildSystem::updateProject()
QList<BuildTargetInfo> targets = Utils::transform(m_metadata.bin, [&](const QString &bin){
BuildTargetInfo info = {};
info.displayName = bin;
info.targetFilePath = binDir.pathAppended(HostOsInfo::withExecutableSuffix(bin));
info.projectFilePath = srcDir.pathAppended(bin).stringAppended(".nim");
info.targetFilePath = binDir.pathAppended(bin);
info.projectFilePath = projectFilePath();
info.workingDirectory = binDir;
info.buildKey = bin;
return info;

View File

@@ -53,7 +53,7 @@ public:
signals:
void finished();
void requestReparse();
void directoryChanged();
void directoryChanged(const QString &path);
void fileChanged(const QString &path);
private:

View File

@@ -30,17 +30,24 @@
namespace VcsBase {
VcsOutputFormatter::VcsOutputFormatter() : m_urlRegexp("https?://\\S*") {}
VcsOutputFormatter::VcsOutputFormatter() :
m_urlRegexp("https?://\\S*"),
m_referenceRegexp("(v[0-9]+\\.[0-9]+\\.[0-9]+[\\-A-Za-z0-9]*)" // v0.1.2-beta3
"|([0-9a-f]{6,}(?:\\.\\.[0-9a-f]{6,})?)") // 789acf or 123abc..456cde
{
}
void VcsOutputFormatter::appendMessage(const QString &text, Utils::OutputFormat format)
{
QString out = text;
const QRegularExpressionMatch match = m_urlRegexp.match(text);
if (match.hasMatch()) {
const QRegularExpressionMatch urlMatch = m_urlRegexp.match(text);
const QRegularExpressionMatch referenceMatch = m_referenceRegexp.match(text);
auto append = [this](const QRegularExpressionMatch &match,
QString text, Utils::OutputFormat format) {
const QTextCharFormat normalFormat = charFormat(format);
OutputFormatter::appendMessage(text.left(match.capturedStart()), format);
QTextCursor tc = plainTextEdit()->textCursor();
QStringRef url = match.capturedRef();
QStringView url = match.capturedView();
int end = match.capturedEnd();
while (url.rbegin()->isPunct()) {
url.chop(1);
@@ -50,14 +57,22 @@ void VcsOutputFormatter::appendMessage(const QString &text, Utils::OutputFormat
tc.insertText(url.toString(), linkFormat(normalFormat, url.toString()));
tc.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
OutputFormatter::appendMessage(text.mid(end), format);
} else {
};
if (urlMatch.hasMatch())
append(urlMatch, text, format);
else if (referenceMatch.hasMatch())
append(referenceMatch, text, format);
else
OutputFormatter::appendMessage(text, format);
}
}
void VcsOutputFormatter::handleLink(const QString &href)
{
if (href.startsWith("http://") || href.startsWith("https://"))
QDesktopServices::openUrl(QUrl(href));
else if (!href.isEmpty())
emit referenceClicked(href);
}
}

View File

@@ -31,14 +31,19 @@ namespace VcsBase {
class VcsOutputFormatter : public Utils::OutputFormatter
{
Q_OBJECT
public:
VcsOutputFormatter();
~VcsOutputFormatter() override = default;
void appendMessage(const QString &text, Utils::OutputFormat format) override;
void handleLink(const QString &href) override;
signals:
void referenceClicked(const QString &reference);
private:
const QRegularExpression m_urlRegexp;
const QRegularExpression m_referenceRegexp;
};
}

View File

@@ -102,6 +102,7 @@ public:
void appendLines(const QString &s, const QString &repository = QString());
void appendLinesWithStyle(const QString &s, VcsOutputWindow::MessageStyle style,
const QString &repository = QString());
VcsOutputFormatter *formatter();
protected:
void contextMenuEvent(QContextMenuEvent *event) override;
@@ -247,6 +248,11 @@ void OutputWindowPlainTextEdit::appendLinesWithStyle(const QString &s,
}
}
VcsOutputFormatter *OutputWindowPlainTextEdit::formatter()
{
return m_formatter;
}
void OutputWindowPlainTextEdit::setFormat(VcsOutputWindow::MessageStyle style)
{
m_formatter->setBoldFontEnabled(style == VcsOutputWindow::Command);
@@ -305,6 +311,8 @@ VcsOutputWindow::VcsOutputWindow()
connect(this, &IOutputPane::resetZoom, &d->widget, &Core::OutputWindow::resetZoom);
connect(TextEditor::TextEditorSettings::instance(), &TextEditor::TextEditorSettings::behaviorSettingsChanged,
this, updateBehaviorSettings);
connect(d->widget.formatter(), &VcsOutputFormatter::referenceClicked,
VcsOutputWindow::instance(), &VcsOutputWindow::referenceClicked);
}
static QString filterPasswordFromUrls(const QString &input)

View File

@@ -76,6 +76,9 @@ public:
Message, // A blue message text (e.g. "command has finished successfully")
};
signals:
void referenceClicked(const QString &reference);
public slots:
static void setRepository(const QString &);
static void clearRepository();