Merge "Merge remote-tracking branch 'origin/4.2'"

This commit is contained in:
Eike Ziller
2016-12-09 11:42:58 +00:00
committed by The Qt Project
26 changed files with 200 additions and 130 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -106,24 +106,37 @@
\li In the \uicontrol Options group, select the configuration file that \li In the \uicontrol Options group, select the configuration file that
defines the style to use in the source files. If you select several defines the style to use in the source files. If you select several
options, they are applied from top down. options, they are applied from top down. The available options
depend on the tool.
\list \list
\li Select the \uicontrol {Use file defined in project files} \li Select the \uicontrol {Use file defined in project files}
option to use the configuration file defined in the qmake option to use the configuration file defined in the qmake
DISTFILES variable as the configuration file for the DISTFILES variable as the configuration file for the
selected tool. selected tool. This option is available for Artistic Style
and Uncrustify.
\li Select the \uicontrol {Use file in $HOME} option to use the \li Select the \uicontrol {Use file in $HOME} option to use the
specified file in the user's home directory as the specified file in the user's home directory as the
configuration file for the selected tool. configuration file for the selected tool. This option is
available for Artistic Style and Uncrustify.
\li For Clang Format, you can use a predefined style, by
selecting the \uicontrol {Use predefined style} radio
button, and then selecting the style to use from the list of
available styles.
Select \uicontrol File to load the style configuration from
the \c .clang-format or \c _clang-format file located in the
same directory as the source file or in one of its parent
directories.
\li Select the \uicontrol {Use customized style} option, and \li Select the \uicontrol {Use customized style} option, and
then \uicontrol Add to define your own style. then \uicontrol Add to define your own style.
Define code formatting in the Define code formatting in the
\uicontrol {Edit Configuration} dialog. It provides syntax \uicontrol {Add Configuration} dialog. It provides syntax
highlighting, auto-completion, and context-sensitive help. highlighting, auto-completion, and context-sensitive help.
For these features, you must have the tool installed. For these features, you must have the tool installed.
@@ -143,8 +156,7 @@
In addition to the \uicontrol {Format Current File} command, ClangFormat In addition to the \uicontrol {Format Current File} command, ClangFormat
and Uncrustify provide the \uicontrol {Format Selected Text} command. If you and Uncrustify provide the \uicontrol {Format Selected Text} command. If you
select it when no text is selected, nothing happens. To format the entire select it when no text is selected, the whole file is formatted by default.
file in this case when using Clang, select the To disable this behavior, deselect the
\uicontrol {Format entire file if no text was selected} check box in the \uicontrol {Format entire file if no text was selected} check box.
\uicontrol {Clang Format} options.
*/ */

View File

@@ -79,7 +79,7 @@
kit. kit.
To import an existing build for the project, select To import an existing build for the project, select
\uicontrol {Import Existing Build} in the context menu. \uicontrol {Import Existing Build}.
\section1 Specifying Settings \section1 Specifying Settings

View File

@@ -3499,20 +3499,6 @@ class DumperBase:
val.type = self.createReferenceType(targetType) val.type = self.createReferenceType(targetType)
return val return val
def createBitfieldValue(self, targetType, bitsize):
if not isinstance(targetType, self.Type):
error('Expected type in createBitfieldValue(), got %s'
% type(targetType))
targetTypeId = targetType.typeId
typeId = '%s:%d' % (targetTypeId, bitsize)
tdata = self.TypeData(self)
tdata.name = '%s : %d' % (targetType.name, bitsize)
tdata.typeId = typeId
tdata.code = TypeCodeArray
tdata.ltarget = targetType
self.registerType(typeId, tdata)
return self.Type(self, typeId)
def createPointerType(self, targetType): def createPointerType(self, targetType):
if not isinstance(targetType, self.Type): if not isinstance(targetType, self.Type):
error('Expected type in createPointerType(), got %s' error('Expected type in createPointerType(), got %s'

View File

@@ -789,10 +789,9 @@ class Dumper(DumperBase):
self.breakOnMain_ = args.get('breakonmain', 0) self.breakOnMain_ = args.get('breakonmain', 0)
self.useTerminal_ = args.get('useterminal', 0) self.useTerminal_ = args.get('useterminal', 0)
self.processArgs_ = args.get('processargs', []) self.processArgs_ = args.get('processargs', [])
self.dyldImageSuffix = args.get('dyldimagesuffix', '')
self.dyldLibraryPath = args.get('dyldlibrarypath', '')
self.dyldFrameworkPath = args.get('dyldframeworkpath', '')
self.processArgs_ = list(map(lambda x: self.hexdecode(x), self.processArgs_)) self.processArgs_ = list(map(lambda x: self.hexdecode(x), self.processArgs_))
self.environment_ = args.get('environment', [])
self.environment_ = list(map(lambda x: self.hexdecode(x), self.environment_))
self.attachPid_ = args.get('attachpid', 0) self.attachPid_ = args.get('attachpid', 0)
self.sysRoot_ = args.get('sysroot', '') self.sysRoot_ = args.get('sysroot', '')
self.remoteChannel_ = args.get('remotechannel', '') self.remoteChannel_ = args.get('remotechannel', '')
@@ -883,14 +882,7 @@ class Dumper(DumperBase):
else: else:
launchInfo = lldb.SBLaunchInfo(self.processArgs_) launchInfo = lldb.SBLaunchInfo(self.processArgs_)
launchInfo.SetWorkingDirectory(self.workingDirectory_) launchInfo.SetWorkingDirectory(self.workingDirectory_)
environmentList = [key + '=' + value for key,value in os.environ.items()] launchInfo.SetEnvironmentEntries(self.environment_, False)
if self.dyldImageSuffix:
environmentList.append('DYLD_IMAGE_SUFFIX=' + self.dyldImageSuffix)
if self.dyldLibraryPath:
environmentList.append('DYLD_LIBRARY_PATH=' + self.dyldLibraryPath)
if self.dyldFrameworkPath:
environmentList.append('DYLD_FRAMEWORK_PATH=' + self.dyldFrameworkPath)
launchInfo.SetEnvironmentEntries(environmentList, False)
if self.breakOnMain_: if self.breakOnMain_:
self.createBreakpointAtMain() self.createBreakpointAtMain()
self.process = self.target.Launch(launchInfo, error) self.process = self.target.Launch(launchInfo, error)

View File

@@ -285,6 +285,8 @@ QString AndroidManager::androidNameForApiLevel(int x)
return QLatin1String("Android 6.0"); return QLatin1String("Android 6.0");
case 24: case 24:
return QLatin1String("Android 7.0"); return QLatin1String("Android 7.0");
case 25:
return QLatin1String("Android 7.1");
default: default:
return tr("Unknown Android version. API Level: %1").arg(QString::number(x)); return tr("Unknown Android version. API Level: %1").arg(QString::number(x));
} }

View File

@@ -668,8 +668,9 @@ void AndroidRunnerWorker::onProcessIdChanged(qint64 pid)
logcatReadStandardOutput(); logcatReadStandardOutput();
QTC_ASSERT(!m_psIsAlive, /**/); QTC_ASSERT(!m_psIsAlive, /**/);
m_psIsAlive.reset(new QProcess); m_psIsAlive.reset(new QProcess);
connect(m_psIsAlive.get(), &QIODevice::readyRead, [this](){ m_psIsAlive->setProcessChannelMode(QProcess::MergedChannels);
if (!m_psIsAlive->readAllStandardOutput().simplified().isEmpty()) connect(m_psIsAlive.get(), &QProcess::readyRead, [this](){
if (!m_psIsAlive->readAll().simplified().isEmpty())
onProcessIdChanged(-1); onProcessIdChanged(-1);
}); });
m_psIsAlive->start(m_adb, selector() << QStringLiteral("shell") m_psIsAlive->start(m_adb, selector() << QStringLiteral("shell")

View File

@@ -268,7 +268,7 @@ bool QtTestTreeItem::modify(const TestParseResult *result)
case TestSpecialFunction: case TestSpecialFunction:
return modifyTestFunctionContent(result); return modifyTestFunctionContent(result);
case TestDataTag: case TestDataTag:
return modifyDataTagContent(result->name, result->fileName, result->line, result->line); return modifyDataTagContent(result->name, result->fileName, result->line, result->column);
default: default:
return false; return false;
} }

View File

@@ -1155,7 +1155,7 @@ void MainWindow::restoreWindowState()
QSettings *settings = PluginManager::settings(); QSettings *settings = PluginManager::settings();
settings->beginGroup(QLatin1String(settingsGroup)); settings->beginGroup(QLatin1String(settingsGroup));
if (!restoreGeometry(settings->value(QLatin1String(windowGeometryKey)).toByteArray())) if (!restoreGeometry(settings->value(QLatin1String(windowGeometryKey)).toByteArray()))
resize(1008, 700); // size without window decoration resize(1260, 700); // size without window decoration
restoreState(settings->value(QLatin1String(windowStateKey)).toByteArray()); restoreState(settings->value(QLatin1String(windowStateKey)).toByteArray());
settings->endGroup(); settings->endGroup();
show(); show();

View File

@@ -61,6 +61,7 @@
#include <QToolTip> #include <QToolTip>
#include <QVariant> #include <QVariant>
#include <QJsonArray> #include <QJsonArray>
#include <QRegularExpression>
using namespace Core; using namespace Core;
using namespace Utils; using namespace Utils;
@@ -125,7 +126,10 @@ void LldbEngine::runCommand(const DebuggerCommand &cmd)
command.arg("token", tok); command.arg("token", tok);
QString token = QString::number(tok); QString token = QString::number(tok);
QString function = command.function + "(" + command.argsToPython() + ")"; QString function = command.function + "(" + command.argsToPython() + ")";
showMessage(token + function + '\n', LogInput); QString msg = token + function + '\n';
if (cmd.flags == LldbEngine::Silent)
msg.replace(QRegularExpression("\"environment\":.[^]]*."), "<environment suppressed>");
showMessage(msg, LogInput);
m_commandForToken[currentToken()] = command; m_commandForToken[currentToken()] = command;
m_lldbProc.write("script theDumper." + function.toUtf8() + "\n"); m_lldbProc.write("script theDumper." + function.toUtf8() + "\n");
} }
@@ -301,17 +305,6 @@ void LldbEngine::startLldbStage2()
void LldbEngine::setupInferior() void LldbEngine::setupInferior()
{ {
Environment sysEnv = Environment::systemEnvironment();
Environment runEnv = runParameters().inferior.environment;
foreach (const EnvironmentItem &item, sysEnv.diff(runEnv)) {
DebuggerCommand cmd("executeDebuggerCommand");
if (item.unset)
cmd.arg("command", "settings remove target.env-vars " + item.name);
else
cmd.arg("command", "settings set target.env-vars '" + item.name + '=' + item.value + '\'');
runCommand(cmd);
}
const QString path = stringSetting(ExtraDumperFile); const QString path = stringSetting(ExtraDumperFile);
if (!path.isEmpty() && QFileInfo(path).isReadable()) { if (!path.isEmpty() && QFileInfo(path).isReadable()) {
DebuggerCommand cmd("addDumperModule"); DebuggerCommand cmd("addDumperModule");
@@ -345,12 +338,13 @@ void LldbEngine::setupInferior()
cmd2.arg("useterminal", rp.useTerminal); cmd2.arg("useterminal", rp.useTerminal);
cmd2.arg("startmode", rp.startMode); cmd2.arg("startmode", rp.startMode);
cmd2.arg("nativemixed", isNativeMixedActive()); cmd2.arg("nativemixed", isNativeMixedActive());
cmd2.arg("dyldimagesuffix", rp.inferior.environment.value("DYLD_IMAGE_SUFFIX"));
cmd2.arg("dyldframeworkpath", rp.inferior.environment.value("DYLD_LIBRARY_PATH"));
cmd2.arg("dyldlibrarypath", rp.inferior.environment.value("DYLD_FRAMEWORK_PATH"));
cmd2.arg("workingdirectory", rp.inferior.workingDirectory); cmd2.arg("workingdirectory", rp.inferior.workingDirectory);
QJsonArray env;
foreach (const QString &item, rp.inferior.environment.toStringList())
env.append(toHex(item));
cmd2.arg("environment", env);
QJsonArray processArgs; QJsonArray processArgs;
foreach (const QString &arg, args.toUnixArgs()) foreach (const QString &arg, args.toUnixArgs())
processArgs.append(QLatin1String(arg.toUtf8().toHex())); processArgs.append(QLatin1String(arg.toUtf8().toHex()));
@@ -402,6 +396,8 @@ void LldbEngine::setupInferior()
notifyInferiorSetupFailed(); notifyInferiorSetupFailed();
} }
}; };
cmd2.flags = LldbEngine::Silent;
runCommand(cmd2); runCommand(cmd2);
} }

View File

@@ -61,6 +61,12 @@ public:
explicit LldbEngine(const DebuggerRunParameters &runParameters); explicit LldbEngine(const DebuggerRunParameters &runParameters);
~LldbEngine() override; ~LldbEngine() override;
enum LldbCommandFlag {
NoFlags = 0,
// Do not echo to log.
Silent = 1
};
signals: signals:
void outputReady(const QString &data); void outputReady(const QString &data);

View File

@@ -734,10 +734,8 @@ static QString formattedValue(const WatchItem *item)
if (!isPointerType(item->type) && !item->isVTablePointer()) { if (!isPointerType(item->type) && !item->isVTablePointer()) {
bool ok = false; bool ok = false;
qulonglong integer = item->value.toULongLong(&ok, 0); qulonglong integer = item->value.toULongLong(&ok, 0);
if (ok) { if (ok)
const int format = itemFormat(item);
return reformatInteger(integer, format, item->size, false); return reformatInteger(integer, format, item->size, false);
}
} }
if (item->elided) { if (item->elided) {

View File

@@ -362,6 +362,7 @@ void SimulatorControlPrivate::startSimulator(QFutureInterface<SimulatorControl::
} }
if (!fi.isCanceled()) { if (!fi.isCanceled()) {
QThread::msleep(500); // give it some time. TODO: find an actual fix.
fi.reportResult(response); fi.reportResult(response);
} }
} }
@@ -376,6 +377,7 @@ void SimulatorControlPrivate::installApp(QFutureInterface<SimulatorControl::Resp
response.commandOutput = output; response.commandOutput = output;
if (!fi.isCanceled()) { if (!fi.isCanceled()) {
QThread::msleep(500); // give it some time. TODO: find an actual fix.
fi.reportResult(response); fi.reportResult(response);
} }
} }
@@ -455,6 +457,7 @@ void SimulatorControlPrivate::spawnAppProcess(QFutureInterface<SimulatorControl:
} }
if (!fi.isCanceled()) { if (!fi.isCanceled()) {
QThread::msleep(500); // give it some time. TODO: find an actual fix.
fi.reportResult(response); fi.reportResult(response);
} }
} }
@@ -474,6 +477,7 @@ void SimulatorControlPrivate::launchApp(QFutureInterface<SimulatorControl::Respo
return; return;
if (processSpawned) { if (processSpawned) {
QThread::msleep(500); // give it some time. TODO: find an actual fix.
const QStringList args({QStringLiteral("launch"), simUdid , bundleIdentifier}); const QStringList args({QStringLiteral("launch"), simUdid , bundleIdentifier});
response.commandOutput = runSimCtlCommand(args); response.commandOutput = runSimCtlCommand(args);
const QByteArray pIdStr = response.commandOutput.trimmed().split(' ').last().trimmed(); const QByteArray pIdStr = response.commandOutput.trimmed().split(' ').last().trimmed();

View File

@@ -58,6 +58,7 @@
#include <QHeaderView> #include <QHeaderView>
#include <QLabel> #include <QLabel>
#include <QMenu> #include <QMenu>
#include <QPushButton>
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
#include <QTimer> #include <QTimer>
#include <QTreeView> #include <QTreeView>
@@ -386,6 +387,17 @@ public:
this, &SelectorModel::deregisterProject); this, &SelectorModel::deregisterProject);
connect(sessionManager, &SessionManager::startupProjectChanged, connect(sessionManager, &SessionManager::startupProjectChanged,
this, &SelectorModel::startupProjectChanged); this, &SelectorModel::startupProjectChanged);
m_importBuild = new QPushButton(ProjectWindow::tr("Import Existing Build..."));
connect(m_importBuild, &QPushButton::clicked,
this, &SelectorModel::handleImportBuild);
connect(sessionManager, &SessionManager::startupProjectChanged, this, [this](Project *project) {
m_importBuild->setEnabled(project && project->projectImporter());
});
m_manageKits = new QPushButton(ProjectWindow::tr("Manage Kits..."));
connect(m_manageKits, &QPushButton::clicked,
this, &SelectorModel::handleManageKits);
} }
void updatePanel() void updatePanel()
@@ -457,7 +469,6 @@ public:
ProjectItem *projectItem = m_projectsModel.rootItem()->childAt(0); ProjectItem *projectItem = m_projectsModel.rootItem()->childAt(0);
Project *project = projectItem ? projectItem->project() : nullptr; Project *project = projectItem ? projectItem->project() : nullptr;
ProjectImporter *projectImporter = project ? project->projectImporter() : nullptr;
QModelIndex index = m_selectorTree->indexAt(pos); QModelIndex index = m_selectorTree->indexAt(pos);
TreeItem *item = m_projectsModel.itemForIndex(index); TreeItem *item = m_projectsModel.itemForIndex(index);
@@ -468,49 +479,65 @@ public:
menu.addSeparator(); menu.addSeparator();
QAction *importBuild = menu.addAction(ProjectWindow::tr("Import Existing Build...")); QAction *importBuild = menu.addAction(ProjectWindow::tr("Import Existing Build..."));
importBuild->setEnabled(projectImporter); importBuild->setEnabled(project && project->projectImporter());
QAction *manageKits = menu.addAction(ProjectWindow::tr("Manage Kits...")); QAction *manageKits = menu.addAction(ProjectWindow::tr("Manage Kits..."));
QAction *act = menu.exec(m_selectorTree->mapToGlobal(pos)); QAction *act = menu.exec(m_selectorTree->mapToGlobal(pos));
if (project && projectImporter && act == importBuild) { if (act == importBuild)
QString dir = project->projectDirectory().toString(); handleImportBuild();
QString importDir = QFileDialog::getExistingDirectory(ICore::mainWindow(), else if (act == manageKits)
ProjectWindow::tr("Import directory"), handleManageKits();
dir);
FileName path = FileName::fromString(importDir);
const QList<BuildInfo *> toImport = projectImporter->import(path, false);
for (BuildInfo *info : toImport) {
Target *target = project->target(info->kitId);
if (!target) {
target = project->createTarget(KitManager::find(info->kitId));
if (target)
project->addTarget(target);
}
if (target) {
projectImporter->makePersistent(target->kit());
BuildConfiguration *bc = info->factory()->create(target, info);
QTC_ASSERT(bc, continue);
target->addBuildConfiguration(bc);
}
}
qDeleteAll(toImport);
} else if (act == manageKits) {
if (KitOptionsPage *page = ExtensionSystem::PluginManager::getObject<KitOptionsPage>()) {
if (item)
page->showKit(KitManager::find(Id::fromSetting(item->data(0, KitIdRole))));
}
ICore::showOptionsDialog(Constants::KITS_SETTINGS_PAGE_ID, ICore::mainWindow());
};
} }
public: void handleManageKits()
{
if (ProjectItem *projectItem = m_projectsModel.rootItem()->childAt(0)) {
if (KitOptionsPage *page = ExtensionSystem::PluginManager::getObject<KitOptionsPage>())
page->showKit(KitManager::find(Id::fromSetting(projectItem->data(0, KitIdRole))));
}
ICore::showOptionsDialog(Constants::KITS_SETTINGS_PAGE_ID, ICore::mainWindow());
}
void handleImportBuild()
{
ProjectItem *projectItem = m_projectsModel.rootItem()->childAt(0);
Project *project = projectItem ? projectItem->project() : 0;
ProjectImporter *projectImporter = project ? project->projectImporter() : 0;
QTC_ASSERT(projectImporter, return);
QString dir = project->projectDirectory().toString();
QString importDir = QFileDialog::getExistingDirectory(ICore::mainWindow(),
ProjectWindow::tr("Import directory"),
dir);
FileName path = FileName::fromString(importDir);
const QList<BuildInfo *> toImport = projectImporter->import(path, false);
for (BuildInfo *info : toImport) {
Target *target = project->target(info->kitId);
if (!target) {
target = project->createTarget(KitManager::find(info->kitId));
if (target)
project->addTarget(target);
}
if (target) {
projectImporter->makePersistent(target->kit());
BuildConfiguration *bc = info->factory()->create(target, info);
QTC_ASSERT(bc, continue);
target->addBuildConfiguration(bc);
}
}
qDeleteAll(toImport);
}
std::function<void (QWidget *)> m_changeListener; std::function<void (QWidget *)> m_changeListener;
ProjectsModel m_projectsModel; ProjectsModel m_projectsModel;
ComboBoxModel m_comboBoxModel; ComboBoxModel m_comboBoxModel;
QComboBox *m_projectSelection; QComboBox *m_projectSelection;
SelectorTree *m_selectorTree; SelectorTree *m_selectorTree;
QPushButton *m_importBuild;
QPushButton *m_manageKits;
}; };
// //
@@ -547,6 +574,9 @@ ProjectWindow::ProjectWindow()
auto innerLayout = new QVBoxLayout; auto innerLayout = new QVBoxLayout;
innerLayout->setSpacing(10); innerLayout->setSpacing(10);
innerLayout->setContentsMargins(14, innerLayout->spacing(), 14, 0); innerLayout->setContentsMargins(14, innerLayout->spacing(), 14, 0);
innerLayout->addWidget(selectorModel->m_manageKits);
innerLayout->addWidget(selectorModel->m_importBuild);
innerLayout->addSpacerItem(new QSpacerItem(10, 30, QSizePolicy::Maximum, QSizePolicy::Maximum));
innerLayout->addWidget(activeLabel); innerLayout->addWidget(activeLabel);
innerLayout->addWidget(selectorModel->m_projectSelection); innerLayout->addWidget(selectorModel->m_projectSelection);
innerLayout->addWidget(selectorModel->m_selectorTree); innerLayout->addWidget(selectorModel->m_selectorTree);

View File

@@ -701,7 +701,7 @@ TargetGroupItem::TargetGroupItem(const QString &displayName, Project *project)
QObject::connect(project, &Project::removedTarget, QObject::connect(project, &Project::removedTarget,
d, &TargetGroupItemPrivate::handleTargetRemoved); d, &TargetGroupItemPrivate::handleTargetRemoved);
QObject::connect(project, &Project::activeTargetChanged, QObject::connect(project, &Project::activeTargetChanged,
d, &TargetGroupItemPrivate::handleTargetChanged); d, &TargetGroupItemPrivate::handleTargetChanged, Qt::QueuedConnection);
} }
TargetGroupItem::~TargetGroupItem() TargetGroupItem::~TargetGroupItem()

View File

@@ -236,13 +236,13 @@ static const char *const variableKeywords[] = {
}; };
static const char *const functionKeywords[] = { static const char *const functionKeywords[] = {
"CONFIG",
"absolute_path", "absolute_path",
"basename", "basename",
"cache", "cache",
"cat", "cat",
"clean_path", "clean_path",
"clear", "clear",
"CONFIG",
"contains", "contains",
"count", "count",
"debug", "debug",
@@ -252,9 +252,9 @@ static const char *const functionKeywords[] = {
"equals", "equals",
"error", "error",
"escape_expand", "escape_expand",
"eval",
"exists", "exists",
"export", "export",
"eval",
"files", "files",
"find", "find",
"first", "first",
@@ -269,9 +269,9 @@ static const char *const functionKeywords[] = {
"isActiveConfig", "isActiveConfig",
"isEmpty", "isEmpty",
"isEqual", "isEqual",
"lessThan",
"join", "join",
"last", "last",
"lessThan",
"list", "list",
"load", "load",
"log", "log",
@@ -283,20 +283,20 @@ static const char *const functionKeywords[] = {
"parseJson", "parseJson",
"prompt", "prompt",
"quote", "quote",
"re_escape",
"relative_path", "relative_path",
"replace", "replace",
"requires", "requires",
"resolve_depends", "resolve_depends",
"reverse", "reverse",
"re_escape",
"section", "section",
"shadowed", "shadowed",
"shell_path", "shell_path",
"shell_quote", "shell_quote",
"size", "size",
"sort_depends",
"split", "split",
"sprintf", "sprintf",
"sort_depends",
"system", "system",
"system_path", "system_path",
"system_quote", "system_quote",
@@ -306,8 +306,8 @@ static const char *const functionKeywords[] = {
"unset", "unset",
"upper", "upper",
"val_escape", "val_escape",
"write_file",
"warning", "warning",
"write_file",
0 0
}; };

View File

@@ -73,6 +73,7 @@
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QTextCodec>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include <QMessageBox> #include <QMessageBox>
@@ -1203,7 +1204,8 @@ QPair<ProFile *, QStringList> QmakePriFileNode::readProFile(const QString &file)
QmakeProject::proFileParseError(reader.errorString()); QmakeProject::proFileParseError(reader.errorString());
return qMakePair(includeFile, lines); return qMakePair(includeFile, lines);
} }
contents = QString::fromLocal8Bit(reader.data()); const QTextCodec *codec = Core::EditorManager::defaultTextCodec();
contents = codec->toUnicode(reader.data());
lines = contents.split(QLatin1Char('\n')); lines = contents.split(QLatin1Char('\n'));
} }
@@ -1321,7 +1323,8 @@ void QmakePriFileNode::save(const QStringList &lines)
{ {
FileChangeBlocker changeGuard(m_projectFilePath.toString()); FileChangeBlocker changeGuard(m_projectFilePath.toString());
FileSaver saver(m_projectFilePath.toString(), QIODevice::Text); FileSaver saver(m_projectFilePath.toString(), QIODevice::Text);
saver.write(lines.join(QLatin1Char('\n')).toLocal8Bit()); const QTextCodec *codec = Core::EditorManager::defaultTextCodec();
saver.write(codec->fromUnicode(lines.join(QLatin1Char('\n'))));
saver.finalize(Core::ICore::mainWindow()); saver.finalize(Core::ICore::mainWindow());
} }

View File

@@ -29,6 +29,7 @@
#include "qmljseditordocument.h" #include "qmljseditordocument.h"
#include "qmlexpressionundercursor.h" #include "qmlexpressionundercursor.h"
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/helpmanager.h> #include <coreplugin/helpmanager.h>
@@ -49,6 +50,8 @@
#include <QDir> #include <QDir>
#include <QList> #include <QList>
#include <QStringRef> #include <QStringRef>
#include <QRegularExpression>
#include <QRegularExpressionMatch>
using namespace Core; using namespace Core;
using namespace QmlJS; using namespace QmlJS;
@@ -143,30 +146,57 @@ bool QmlJSHoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Docum
const ObjectValue *value, const QStringList &qName) const ObjectValue *value, const QStringList &qName)
{ {
QString moduleName = getModuleName(scopeChain, qmlDocument, value); QString moduleName = getModuleName(scopeChain, qmlDocument, value);
QMap<QString, QUrl> urlMap;
QString helpId; QString helpId;
do { do {
QStringList helpIdPieces(qName); QStringList helpIdPieces(qName);
helpIdPieces.prepend(moduleName); helpIdPieces.prepend(moduleName);
helpIdPieces.prepend(QLatin1String("QML")); helpIdPieces.prepend(QLatin1String("QML"));
helpId = helpIdPieces.join(QLatin1Char('.')); helpId = helpIdPieces.join(QLatin1Char('.'));
if (!HelpManager::linksForIdentifier(helpId).isEmpty()) urlMap = HelpManager::linksForIdentifier(helpId);
if (!urlMap.isEmpty())
break; break;
if (helpIdPieces.size() > 3) { if (helpIdPieces.size() > 3) {
QString lm = helpIdPieces.value(2); QString lm = helpIdPieces.value(2);
helpIdPieces.removeAt(2); helpIdPieces.removeAt(2);
helpId = helpIdPieces.join(QLatin1Char('.')); helpId = helpIdPieces.join(QLatin1Char('.'));
if (!HelpManager::linksForIdentifier(helpId).isEmpty()) urlMap = HelpManager::linksForIdentifier(helpId);
if (!urlMap.isEmpty())
break; break;
helpIdPieces.replace(1, lm); helpIdPieces.replace(1, lm);
if (!HelpManager::linksForIdentifier(helpId).isEmpty()) urlMap = HelpManager::linksForIdentifier(helpId);
if (!urlMap.isEmpty())
break; break;
} }
helpIdPieces.removeAt(1); helpIdPieces.removeAt(1);
helpId = helpIdPieces.join(QLatin1Char('.')); helpId = helpIdPieces.join(QLatin1Char('.'));
if (!HelpManager::linksForIdentifier(helpId).isEmpty()) urlMap = HelpManager::linksForIdentifier(helpId);
if (!urlMap.isEmpty())
break; break;
return false; return false;
} while (0); } while (0);
// Check if the module name contains a major version.
QRegularExpression version("^([^\\d]*)(\\d+)\\.*\\d*$");
QRegularExpressionMatch m = version.match(moduleName);
if (m.hasMatch()) {
QMap<QString, QUrl> filteredUrlMap;
QStringRef maj = m.capturedRef(2);
for (auto x = urlMap.begin(); x != urlMap.end(); ++x) {
QString urlModuleName = x.value().path().split('/')[1];
if (urlModuleName.contains(maj))
filteredUrlMap.insert(x.key(), x.value());
}
if (!filteredUrlMap.isEmpty()) {
// Use the url as helpId, to disambiguate different versions
helpId = filteredUrlMap.first().toString();
const HelpItem helpItem(helpId, qName.join(QLatin1Char('.')), HelpItem::QmlComponent, filteredUrlMap);
setLastHelpItemIdentified(helpItem);
return true;
}
}
setLastHelpItemIdentified(HelpItem(helpId, qName.join(QLatin1Char('.')), HelpItem::QmlComponent)); setLastHelpItemIdentified(HelpItem(helpId, qName.join(QLatin1Char('.')), HelpItem::QmlComponent));
return true; return true;
} }

View File

@@ -233,10 +233,6 @@ void FontSettings::addMixinStyle(QTextCharFormat &textCharFormat,
textCharFormat.setBackground(mixBrush(textCharFormat.background(), textCharFormat.setBackground(mixBrush(textCharFormat.background(),
format.relativeBackgroundSaturation(), format.relativeBackgroundSaturation(),
format.relativeBackgroundLightness())); format.relativeBackgroundLightness()));
} else {
textCharFormat.setBackground(mixBrush(m_scheme.formatFor(C_TEXT).background(),
format.relativeBackgroundSaturation(),
format.relativeBackgroundLightness()));
} }
if (!textCharFormat.fontItalic()) if (!textCharFormat.fontItalic())

View File

@@ -103,7 +103,7 @@ class RelayServer: public QObject
public: public:
RelayServer(IosTool *parent); RelayServer(IosTool *parent);
~RelayServer(); ~RelayServer();
bool startServer(int port); bool startServer();
void stopServer(); void stopServer();
quint16 serverPort(); quint16 serverPort();
IosTool *iosTool(); IosTool *iosTool();
@@ -115,6 +115,7 @@ protected:
QTcpServer m_ipv4Server; QTcpServer m_ipv4Server;
QTcpServer m_ipv6Server; QTcpServer m_ipv6Server;
quint16 m_port = 0;
QList<Relayer *> m_connections; QList<Relayer *> m_connections;
}; };
@@ -404,20 +405,23 @@ RelayServer::~RelayServer()
stopServer(); stopServer();
} }
bool RelayServer::startServer(int port) bool RelayServer::startServer()
{ {
QTC_CHECK(!m_ipv4Server.isListening()); QTC_CHECK(!m_ipv4Server.isListening());
QTC_CHECK(!m_ipv6Server.isListening()); QTC_CHECK(!m_ipv6Server.isListening());
connect(&m_ipv4Server, &QTcpServer::newConnection, connect(&m_ipv4Server, &QTcpServer::newConnection,
this, &RelayServer::handleNewRelayConnection); this, &RelayServer::handleNewRelayConnection);
connect(&m_ipv6Server, &QTcpServer::newConnection, connect(&m_ipv6Server, &QTcpServer::newConnection,
this, &RelayServer::handleNewRelayConnection); this, &RelayServer::handleNewRelayConnection);
quint16 portValue = static_cast<quint16>(port);
if (port < 0 || port > 0xFFFF) m_port = 0;
return false; if (m_ipv4Server.listen(QHostAddress(QHostAddress::LocalHost), 0))
m_ipv4Server.listen(QHostAddress(QHostAddress::LocalHostIPv6), portValue); m_port = m_ipv4Server.serverPort();
m_ipv6Server.listen(QHostAddress(QHostAddress::LocalHost), portValue); if (m_ipv6Server.listen(QHostAddress(QHostAddress::LocalHostIPv6), m_port))
return m_ipv4Server.isListening() || m_ipv6Server.isListening(); m_port = m_ipv6Server.serverPort();
return m_port > 0;
} }
void RelayServer::stopServer() void RelayServer::stopServer()
@@ -432,11 +436,7 @@ void RelayServer::stopServer()
quint16 RelayServer::serverPort() quint16 RelayServer::serverPort()
{ {
if (m_ipv4Server.isListening()) return m_port;
return m_ipv4Server.serverPort();
if (m_ipv6Server.isListening())
return m_ipv6Server.serverPort();
return 0;
} }
IosTool *RelayServer::iosTool() IosTool *RelayServer::iosTool()
@@ -728,12 +728,12 @@ void IosTool::didStartApp(const QString &bundlePath, const QString &deviceId,
int qmlPort = deviceSession->qmljsDebugPort(); int qmlPort = deviceSession->qmljsDebugPort();
if (qmlPort) { if (qmlPort) {
qmlServer = new GenericRelayServer(this, qmlPort, deviceSession); qmlServer = new GenericRelayServer(this, qmlPort, deviceSession);
qmlServer->startServer(0); qmlServer->startServer();
} }
} }
if (debug) { if (debug) {
gdbServer = new SingleRelayServer(this, gdbFd); gdbServer = new SingleRelayServer(this, gdbFd);
if (!gdbServer->startServer(0)) { if (!gdbServer->startServer()) {
doExit(-4); doExit(-4);
return; return;
} }

View File

@@ -5278,6 +5278,20 @@ void tst_Dumpers::dumper_data()
+ Check("p.a", "0", "int") + Check("p.a", "0", "int")
+ Check("p.b", "2", "int"); + Check("p.b", "2", "int");
QTest::newRow("This")
<< Data("struct Foo {\n"
" Foo() : x(143) {}\n"
" int foo() {\n"
" BREAK;\n"
" return x;\n"
" }\n\n"
" int x;\n"
"};\n",
"Foo f;\n"
"f.foo();\n")
+ Check("this", "", "Foo")
+ Check("this.x", "143", "int");
QTest::newRow("Union") QTest::newRow("Union")
<< Data("union U { int a; int b; };", "U u;\n" << Data("union U { int a; int b; };", "U u;\n"

View File

@@ -122,14 +122,14 @@ protected:
protected: protected:
Data d; Data d;
Utf8String &filePath{d.filePath}; Utf8String &filePath = d.filePath;
Utf8String &projectPartId{d.projectPartId}; Utf8String &projectPartId = d.projectPartId;
ProjectParts projects{d.projects}; ProjectParts projects = d.projects;
Document &document{d.document}; Document &document = d.document;
Documents &documents{d.documents}; Documents &documents = d.documents;
Jobs &jobs{d.jobs}; Jobs &jobs = d.jobs;
ClangBackEnd::SupportiveTranslationUnitInitializer &initializer{*d.initializer}; ClangBackEnd::SupportiveTranslationUnitInitializer &initializer = *d.initializer;
}; };
TEST_F(SupportiveTranslationUnitInitializer, HasInitiallyNotInitializedState) TEST_F(SupportiveTranslationUnitInitializer, HasInitiallyNotInitializedState)