aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/fdegen/fdegen.pro8
-rw-r--r--tools/fdegen/main.cpp362
-rw-r--r--tools/qml/main.cpp17
-rw-r--r--tools/qml/qml.pro2
-rw-r--r--tools/qmleasing/mainwindow.cpp1
-rw-r--r--tools/qmleasing/splineeditor.cpp15
-rw-r--r--tools/qmlimportscanner/main.cpp6
-rw-r--r--tools/qmljs/qmljs.cpp8
-rw-r--r--tools/qmlplugindump/main.cpp2
-rw-r--r--tools/qmlprofiler/commandlistener.h2
-rw-r--r--tools/qmlprofiler/main.cpp6
-rw-r--r--tools/qmlprofiler/qmlprofilerapplication.cpp34
-rw-r--r--tools/qmlprofiler/qmlprofilerapplication.h11
-rw-r--r--tools/qmlprofiler/qmlprofilerdata.cpp6
-rw-r--r--tools/qmlprofiler/qmlprofilerdata.h11
-rw-r--r--tools/qmlscene/main.cpp9
-rw-r--r--tools/qmlscene/qmlscene.pro3
17 files changed, 76 insertions, 427 deletions
diff --git a/tools/fdegen/fdegen.pro b/tools/fdegen/fdegen.pro
deleted file mode 100644
index a52533280e..0000000000
--- a/tools/fdegen/fdegen.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = app
-TARGET = fdegen
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp
-
-LIBS += -ldwarf -lelf
diff --git a/tools/fdegen/main.cpp b/tools/fdegen/main.cpp
deleted file mode 100644
index 53ee9dec2a..0000000000
--- a/tools/fdegen/main.cpp
+++ /dev/null
@@ -1,362 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the V4VM module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <libdwarf.h>
-#include <dwarf.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#define DEBUG
-
-#ifdef DEBUG
-#include <libelf.h>
-#endif
-
-#include <qglobal.h>
-
-enum DwarfRegs {
-#if defined(Q_PROCESSOR_X86_64)
- // X86-64
- RAX = 0,
- RDX = 1,
- RCX = 2,
- RBX = 3,
- RSI = 4,
- RDI = 5,
- RBP = 6,
- RSP = 7,
- R8 = 8,
- R9 = 9,
- R10 = 10,
- R11 = 11,
- R12 = 12,
- R13 = 13,
- R14 = 14,
- R15 = 15,
- RIP = 16,
-
- InstructionPointerRegister = RIP,
- StackPointerRegister = RSP,
- StackFrameRegister = RBP
-#elif defined(Q_PROCESSOR_X86)
- // x86
- EAX = 0,
- EDX = 1,
- ECX = 2,
- EBX = 3,
- ESP = 4,
- EBP = 5,
- ESI = 6,
- EDI = 7,
- EIP = 8,
-
- InstructionPointerRegister = EIP,
- StackPointerRegister = ESP,
- StackFrameRegister = EBP
-#else
-#error Not ported yet
-#endif
-};
-
-static const DwarfRegs calleeSavedRegisters[] = {
-#if defined(Q_PROCESSOR_X86_64)
- R12,
- R14
-#elif defined(Q_PROCESSOR_X86)
- ESI,
- EDI
-#endif
-};
-static const int calleeSavedRegisterCount = sizeof(calleeSavedRegisters) / sizeof(calleeSavedRegisters[0]);
-
-#if QT_POINTER_SIZE == 8
-#define Elf_Ehdr Elf64_Ehdr
-#define elf_newehdr elf64_newehdr
-#define Elf_Shdr Elf64_Shdr
-#define elf_getshdr elf64_getshdr
-#else
-#define Elf_Ehdr Elf32_Ehdr
-#define elf_newehdr elf32_newehdr
-#define Elf_Shdr Elf32_Shdr
-#define elf_getshdr elf32_getshdr
-#endif
-
-static void die(const char *msg)
-{
- fprintf(stderr, "error: %s\n", msg);
- exit(1);
-}
-
-static int createSectionCallback(
- char *name,
- int size,
- Dwarf_Unsigned /*type*/,
- Dwarf_Unsigned /*flags*/,
- Dwarf_Unsigned /*link*/,
- Dwarf_Unsigned /*info*/,
- Dwarf_Unsigned* /*sect_name_index*/,
- void * /*user_data*/,
- int* /*error*/)
-{
- if (strcmp(name, ".debug_frame"))
- return 0;
- fprintf(stderr, "createsection called with %s and size %d\n", name, size);
- return 1;
-}
-
-static unsigned char cie_init_instructions[] = {
- DW_CFA_def_cfa, StackPointerRegister, /*offset in bytes */sizeof(void*),
- DW_CFA_offset | InstructionPointerRegister, 1,
-};
-
-int main()
-{
- Dwarf_Error error = 0;
- Dwarf_P_Debug dw = dwarf_producer_init_c(DW_DLC_WRITE | DW_DLC_SIZE_64,
- createSectionCallback,
- /* error handler */0,
- /* error arg */0,
- /* user data */0,
- &error);
- if (error != 0)
- die("dwarf_producer_init_c failed");
-
- Dwarf_Unsigned cie = dwarf_add_frame_cie(dw,
- "",
- /* code alignment factor */sizeof(void*),
- /* data alignment factor */-sizeof(void*),
- /* return address reg*/InstructionPointerRegister,
- cie_init_instructions,
- sizeof(cie_init_instructions),
- &error);
- if (error != 0)
- die("dwarf_add_frame_cie failed");
-
- Dwarf_P_Fde fde = dwarf_new_fde(dw, &error);
- if (error != 0)
- die("dwarf_new_fde failed");
-
- /* New entry in state machine for code offset 1 after push rbp instruction */
- dwarf_add_fde_inst(fde,
- DW_CFA_advance_loc,
- /*offset in code alignment units*/ 1,
- /* unused*/ 0,
- &error);
-
- /* After "push rbp" the offset to the CFA is now 2 instead of 1 */
- dwarf_add_fde_inst(fde,
- DW_CFA_def_cfa_offset_sf,
- /*offset in code alignment units*/ -2,
- /* unused*/ 0,
- &error);
-
- /* After "push rbp" the value of rbp is now stored at offset 1 from CFA */
- dwarf_add_fde_inst(fde,
- DW_CFA_offset,
- StackFrameRegister,
- 2,
- &error);
-
- /* New entry in state machine for code offset 3 for mov rbp, rsp instruction */
- dwarf_add_fde_inst(fde,
- DW_CFA_advance_loc,
- /*offset in code alignment units*/ 3,
- /* unused */ 0,
- &error);
-
- /* After "mov rbp, rsp" the cfa is reachable via rbp */
- dwarf_add_fde_inst(fde,
- DW_CFA_def_cfa_register,
- StackFrameRegister,
- /* unused */0,
- &error);
-
- /* Callee saved registers */
- for (int i = 0; i < calleeSavedRegisterCount; ++i) {
- dwarf_add_fde_inst(fde,
- DW_CFA_offset,
- calleeSavedRegisters[i],
- i + 3,
- &error);
- }
-
- dwarf_add_frame_fde(dw, fde,
- /* die */0,
- cie,
- /*virt addr */0,
- /* length of code */0,
- /* symbol index */0,
- &error);
- if (error != 0)
- die("dwarf_add_frame_fde failed");
-
- dwarf_transform_to_disk_form(dw, &error);
- if (error != 0)
- die("dwarf_transform_to_disk_form failed");
-
- Dwarf_Unsigned len = 0;
- Dwarf_Signed elfIdx = 0;
- unsigned char *bytes = (unsigned char *)dwarf_get_section_bytes(dw, /* section */1,
- &elfIdx, &len, &error);
- if (error != 0)
- die("dwarf_get_section_bytes failed");
-
- // libdwarf doesn't add a terminating FDE with zero length, so let's add one
- // ourselves.
- unsigned char *newBytes = (unsigned char *)alloca(len + 4);
- memcpy(newBytes, bytes, len);
- newBytes[len] = 0;
- newBytes[len + 1] = 0;
- newBytes[len + 2] = 0;
- newBytes[len + 3] = 0;
- newBytes[len + 4] = 0;
- bytes = newBytes;
- len += 4;
-
- // Reset CIE-ID back to 0 as expected for .eh_frames
- bytes[4] = 0;
- bytes[5] = 0;
- bytes[6] = 0;
- bytes[7] = 0;
-
- unsigned fde_offset = bytes[0] + 4;
-
- bytes[fde_offset + 4] = fde_offset + 4;
-
- printf("static const unsigned char cie_fde_data[] = {\n");
- int i = 0;
- while (i < len) {
- printf(" ");
- for (int j = 0; i < len && j < 8; ++j, ++i)
- printf("0x%x, ", bytes[i]);
- printf("\n");
- }
- printf("};\n");
-
- printf("static const int fde_offset = %d;\n", fde_offset);
- printf("static const int initial_location_offset = %d;\n", fde_offset + 8);
- printf("static const int address_range_offset = %d;\n", fde_offset + 8 + sizeof(void*));
-
-#ifdef DEBUG
- {
- if (elf_version(EV_CURRENT) == EV_NONE)
- die("wrong elf version");
- int fd = open("debug.o", O_WRONLY | O_CREAT, 0777);
- if (fd < 0)
- die("cannot create debug.o");
-
- Elf *e = elf_begin(fd, ELF_C_WRITE, 0);
- if (!e)
- die("elf_begin failed");
-
- Elf_Ehdr *ehdr = elf_newehdr(e);
- if (!ehdr)
- die(elf_errmsg(-1));
-
- ehdr->e_ident[EI_DATA] = ELFDATA2LSB;
-#if defined(Q_PROCESSOR_X86_64)
- ehdr->e_machine = EM_X86_64;
-#elif defined(Q_PROCESSOR_X86)
- ehdr->e_machine = EM_386;
-#else
-#error port me :)
-#endif
- ehdr->e_type = ET_EXEC;
- ehdr->e_version = EV_CURRENT;
-
- Elf_Scn *section = elf_newscn(e);
- if (!section)
- die("elf_newscn failed");
-
- Elf_Data *data = elf_newdata(section);
- if (!data)
- die(elf_errmsg(-1));
- data->d_align = 4;
- data->d_off = 0;
- data->d_buf = bytes;
- data->d_size = len;
- data->d_type = ELF_T_BYTE;
- data->d_version = EV_CURRENT;
-
- Elf_Shdr *shdr = elf_getshdr(section);
- if (!shdr)
- die(elf_errmsg(-1));
-
- shdr->sh_name = 1;
- shdr->sh_type = SHT_PROGBITS;
- shdr->sh_entsize = 0;
-
- char stringTable[] = {
- 0,
- '.', 'e', 'h', '_', 'f', 'r', 'a', 'm', 'e', 0,
- '.', 's', 'h', 's', 't', 'r', 't', 'a', 'b', 0
- };
-
- section = elf_newscn(e);
- if (!section)
- die("elf_newscn failed");
-
- data = elf_newdata(section);
- if (!data)
- die(elf_errmsg(-1));
- data->d_align = 1;
- data->d_off = 0;
- data->d_buf = stringTable;
- data->d_size = sizeof(stringTable);
- data->d_type = ELF_T_BYTE;
- data->d_version = EV_CURRENT;
-
- shdr = elf_getshdr(section);
- if (!shdr)
- die(elf_errmsg(-1));
-
- shdr->sh_name = 11;
- shdr->sh_type = SHT_STRTAB;
- shdr->sh_flags = SHF_STRINGS | SHF_ALLOC;
- shdr->sh_entsize = 0;
-
- ehdr->e_shstrndx = elf_ndxscn(section);
-
- if (elf_update(e, ELF_C_WRITE) < 0)
- die(elf_errmsg(-1));
-
- elf_end(e);
- close(fd);
- }
-#endif
-
- dwarf_producer_finish(dw, &error);
- if (error != 0)
- die("dwarf_producer_finish failed");
- return 0;
-}
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index a795144984..d718067616 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -160,18 +160,23 @@ public:
LoadWatcher(QQmlApplicationEngine *e, int expected)
: QObject(e)
, earlyExit(false)
+ , returnCode(0)
, expect(expected)
, haveOne(false)
{
connect(e, SIGNAL(objectCreated(QObject*,QUrl)),
this, SLOT(checkFinished(QObject*)));
// QQmlApplicationEngine also connects quit() to QCoreApplication::quit
- // but if called before exec() then QCoreApplication::quit does nothing
+ // and exit() to QCoreApplication::exit but if called before exec()
+ // then QCoreApplication::quit or QCoreApplication::exit does nothing
connect(e, SIGNAL(quit()),
this, SLOT(quit()));
+ connect(e, &QQmlEngine::exit,
+ this, &LoadWatcher::exit);
}
bool earlyExit;
+ int returnCode;
private:
void contain(QObject *o, const QUrl &containPath);
@@ -196,14 +201,20 @@ public Q_SLOTS:
if (! --expect) {
printf("qml: Did not load any objects, exiting.\n");
- exit(2);//Different return code from qFatal
+ std::exit(2);//Different return code from qFatal
}
}
void quit() {
//Will be checked before calling exec()
earlyExit = true;
+ returnCode = 0;
}
+ void exit(int retCode) {
+ earlyExit = true;
+ returnCode = retCode;
+ }
+
#if defined(QT_GUI_LIB) && !defined(QT_NO_OPENGL)
void onOpenGlContextCreated(QOpenGLContext *context);
#endif
@@ -582,7 +593,7 @@ int main(int argc, char *argv[])
}
if (lw->earlyExit)
- return 0;
+ return lw->returnCode;
return app->exec();
}
diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro
index fe90916980..5f05054d04 100644
--- a/tools/qml/qml.pro
+++ b/tools/qml/qml.pro
@@ -12,6 +12,6 @@ mac {
ICON = qml.icns
}
-DEFINES += QT_QML_DEBUG_NO_WARNING
+!contains(QT_CONFIG, no-qml-debug): DEFINES += QT_QML_DEBUG_NO_WARNING
load(qt_tool)
diff --git a/tools/qmleasing/mainwindow.cpp b/tools/qmleasing/mainwindow.cpp
index e45feea76e..5a5f651396 100644
--- a/tools/qmleasing/mainwindow.cpp
+++ b/tools/qmleasing/mainwindow.cpp
@@ -29,7 +29,6 @@
#include "mainwindow.h"
#include "splineeditor.h"
#include <QtQuick/QQuickView>
-#include <QtQuick>
#include <QtQml/QQmlContext>
#include <QEasingCurve>
#include <QHBoxLayout>
diff --git a/tools/qmleasing/splineeditor.cpp b/tools/qmleasing/splineeditor.cpp
index 78ed9606db..ee55931a46 100644
--- a/tools/qmleasing/splineeditor.cpp
+++ b/tools/qmleasing/splineeditor.cpp
@@ -34,6 +34,7 @@
#include <QContextMenuEvent>
#include <QDebug>
#include <QApplication>
+#include <QVector>
const int canvasWidth = 640;
const int canvasHeight = 320;
@@ -672,25 +673,23 @@ void SplineEditor::setEasingCurve(const QString &code)
if (m_block)
return;
if (code.startsWith(QLatin1Char('[')) && code.endsWith(QLatin1Char(']'))) {
- QString cleanCode = code;
- cleanCode.remove(0, 1);
- cleanCode.chop(1);
- const QStringList stringList = cleanCode.split(QLatin1Char(','), QString::SkipEmptyParts);
+ const QStringRef cleanCode(&code, 1, code.size() - 2);
+ const auto stringList = cleanCode.split(QLatin1Char(','), QString::SkipEmptyParts);
if (stringList.count() >= 6 && (stringList.count() % 6 == 0)) {
- QList<qreal> realList;
+ QVector<qreal> realList;
realList.reserve(stringList.count());
- foreach (const QString &string, stringList) {
+ for (const QStringRef &string : stringList) {
bool ok;
realList.append(string.toDouble(&ok));
if (!ok)
return;
}
- QList<QPointF> points;
+ QVector<QPointF> points;
const int count = realList.count() / 2;
points.reserve(count);
for (int i = 0; i < count; ++i)
points.append(QPointF(realList.at(i * 2), realList.at(i * 2 + 1)));
- if (points.last() == QPointF(1.0, 1.0)) {
+ if (points.constLast() == QPointF(1.0, 1.0)) {
QEasingCurve easingCurve(QEasingCurve::BezierSpline);
for (int i = 0; i < points.count() / 3; ++i) {
diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp
index 2569d78c63..2371057878 100644
--- a/tools/qmlimportscanner/main.cpp
+++ b/tools/qmlimportscanner/main.cpp
@@ -224,11 +224,11 @@ QVariantList findPathsForModuleImports(const QVariantList &imports)
if (plugininfo.contains(QStringLiteral("dependencies"))) {
QStringList dependencies = plugininfo.value(QStringLiteral("dependencies")).toStringList();
foreach (const QString &line, dependencies) {
- QList<QString> dep = line.split(QLatin1Char(' '));
+ const auto dep = line.splitRef(QLatin1Char(' '));
QVariantMap depImport;
depImport[QStringLiteral("type")] = QStringLiteral("module");
- depImport[QStringLiteral("name")] = dep[0];
- depImport[QStringLiteral("version")] = dep[1];
+ depImport[QStringLiteral("name")] = dep[0].toString();
+ depImport[QStringLiteral("version")] = dep[1].toString();
importsCopy.append(depImport);
}
}
diff --git a/tools/qmljs/qmljs.cpp b/tools/qmljs/qmljs.cpp
index 68aa52ce91..4f79546bcc 100644
--- a/tools/qmljs/qmljs.cpp
+++ b/tools/qmljs/qmljs.cpp
@@ -68,7 +68,7 @@ struct Print: FunctionObject
};
V4_OBJECT(FunctionObject)
- static ReturnedValue call(const Managed *, CallData *callData)
+ static void call(const Managed *, Scope &scope, CallData *callData)
{
for (int i = 0; i < callData->argc; ++i) {
QString s = callData->args[i].toQStringNoThrow();
@@ -77,7 +77,7 @@ struct Print: FunctionObject
std::cout << qPrintable(s);
}
std::cout << std::endl;
- return Encode::undefined();
+ scope.result = Encode::undefined();
}
};
@@ -94,10 +94,10 @@ struct GC: public FunctionObject
};
V4_OBJECT(FunctionObject)
- static ReturnedValue call(const Managed *m, CallData *)
+ static void call(const Managed *m, Scope &scope, CallData *)
{
static_cast<const GC *>(m)->engine()->memoryManager->runGC();
- return Encode::undefined();
+ scope.result = Encode::undefined();
}
};
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index 5a39e497d2..0e5d3646c2 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -977,7 +977,7 @@ int main(int argc, char *argv[])
}
}
- if (!requireWindowManager)
+ if (!requireWindowManager && qEnvironmentVariableIsEmpty("QT_QPA_PLATFORM"))
qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("minimal"));
else
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
diff --git a/tools/qmlprofiler/commandlistener.h b/tools/qmlprofiler/commandlistener.h
index c10b199daa..2a994bf449 100644
--- a/tools/qmlprofiler/commandlistener.h
+++ b/tools/qmlprofiler/commandlistener.h
@@ -33,7 +33,7 @@
class CommandListener : public QObject {
Q_OBJECT
-public slots:
+public:
void readCommand();
signals:
diff --git a/tools/qmlprofiler/main.cpp b/tools/qmlprofiler/main.cpp
index d3e2beb83f..c7cb979ff8 100644
--- a/tools/qmlprofiler/main.cpp
+++ b/tools/qmlprofiler/main.cpp
@@ -39,8 +39,10 @@ int main(int argc, char *argv[])
QThread listenerThread;
CommandListener listener;
listener.moveToThread(&listenerThread);
- QObject::connect(&listener, SIGNAL(command(QString)), &app, SLOT(userCommand(QString)));
- QObject::connect(&app, SIGNAL(readyForCommand()), &listener, SLOT(readCommand()));
+ QObject::connect(&listener, &CommandListener::command,
+ &app, &QmlProfilerApplication::userCommand);
+ QObject::connect(&app, &QmlProfilerApplication::readyForCommand,
+ &listener, &CommandListener::readCommand);
listenerThread.start();
int exitValue = app.exec();
listenerThread.quit();
diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp
index b04ff7e558..45c32487a2 100644
--- a/tools/qmlprofiler/qmlprofilerapplication.cpp
+++ b/tools/qmlprofiler/qmlprofilerapplication.cpp
@@ -87,17 +87,21 @@ QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) :
m_connectionAttempts(0)
{
m_connectTimer.setInterval(1000);
- connect(&m_connectTimer, SIGNAL(timeout()), this, SLOT(tryToConnect()));
+ connect(&m_connectTimer, &QTimer::timeout, this, &QmlProfilerApplication::tryToConnect);
- connect(&m_connection, SIGNAL(connected()), this, SLOT(connected()));
+ connect(&m_connection, &QQmlDebugConnection::connected,
+ this, &QmlProfilerApplication::connected);
- connect(&m_qmlProfilerClient, SIGNAL(enabledChanged(bool)),
- this, SLOT(traceClientEnabledChanged(bool)));
- connect(&m_qmlProfilerClient, SIGNAL(recordingStarted()), this, SLOT(notifyTraceStarted()));
- connect(&m_qmlProfilerClient, SIGNAL(error(QString)), this, SLOT(logError(QString)));
+ connect(&m_qmlProfilerClient, &QmlProfilerClient::enabledChanged,
+ this, &QmlProfilerApplication::traceClientEnabledChanged);
+ connect(&m_qmlProfilerClient, &QmlProfilerClient::recordingStarted,
+ this, &QmlProfilerApplication::notifyTraceStarted);
+ connect(&m_qmlProfilerClient, &QmlProfilerClient::error,
+ this, &QmlProfilerApplication::logError);
- connect(&m_profilerData, SIGNAL(error(QString)), this, SLOT(logError(QString)));
- connect(&m_profilerData, SIGNAL(dataReady()), this, SLOT(traceFinished()));
+ connect(&m_profilerData, &QmlProfilerData::error, this, &QmlProfilerApplication::logError);
+ connect(&m_profilerData, &QmlProfilerData::dataReady,
+ this, &QmlProfilerApplication::traceFinished);
}
@@ -257,7 +261,7 @@ void QmlProfilerApplication::parseArguments()
int QmlProfilerApplication::exec()
{
- QTimer::singleShot(0, this, SLOT(run()));
+ QTimer::singleShot(0, this, &QmlProfilerApplication::run);
return QCoreApplication::exec();
}
@@ -343,7 +347,7 @@ bool QmlProfilerApplication::checkOutputFile(PendingRequest pending)
void QmlProfilerApplication::userCommand(const QString &command)
{
- QStringList args = command.split(QChar::Space, QString::SkipEmptyParts);
+ auto args = command.splitRef(QChar::Space, QString::SkipEmptyParts);
if (args.isEmpty()) {
prompt();
return;
@@ -397,7 +401,7 @@ void QmlProfilerApplication::userCommand(const QString &command)
} else if (m_profilerData.isEmpty()) {
prompt(tr("No data was recorded so far."));
} else {
- m_interactiveOutputFile = args.length() > 0 ? args[0] : m_outputFile;
+ m_interactiveOutputFile = args.length() > 0 ? args.at(0).toString() : m_outputFile;
if (checkOutputFile(REQUEST_OUTPUT_FILE))
output();
}
@@ -414,7 +418,7 @@ void QmlProfilerApplication::userCommand(const QString &command)
if (!m_recording && m_profilerData.isEmpty()) {
prompt(tr("No data was recorded so far."));
} else {
- m_interactiveOutputFile = args.length() > 0 ? args[0] : m_outputFile;
+ m_interactiveOutputFile = args.length() > 0 ? args.at(0).toString() : m_outputFile;
if (checkOutputFile(REQUEST_FLUSH_FILE))
flush();
}
@@ -460,9 +464,9 @@ void QmlProfilerApplication::run()
arguments << m_programArguments;
m_process->setProcessChannelMode(QProcess::MergedChannels);
- connect(m_process, SIGNAL(readyRead()), this, SLOT(processHasOutput()));
- connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), this,
- SLOT(processFinished()));
+ connect(m_process, &QIODevice::readyRead, this, &QmlProfilerApplication::processHasOutput);
+ connect(m_process, static_cast<void(QProcess::*)(int)>(&QProcess::finished),
+ this, [this](int){ processFinished(); });
logStatus(QString("Starting '%1 %2' ...").arg(m_programPath,
arguments.join(QLatin1Char(' '))));
m_process->start(m_programPath, arguments);
diff --git a/tools/qmlprofiler/qmlprofilerapplication.h b/tools/qmlprofiler/qmlprofilerapplication.h
index 04f9d43c87..13f0f041f0 100644
--- a/tools/qmlprofiler/qmlprofilerapplication.h
+++ b/tools/qmlprofiler/qmlprofilerapplication.h
@@ -58,16 +58,14 @@ public:
void parseArguments();
int exec();
bool isInteractive() const;
-
-signals:
- void readyForCommand();
-
-public slots:
void userCommand(const QString &command);
void notifyTraceStarted();
void outputData();
-private slots:
+signals:
+ void readyForCommand();
+
+private:
void run();
void tryToConnect();
void connected();
@@ -81,7 +79,6 @@ private slots:
void logError(const QString &error);
void logStatus(const QString &status);
-private:
quint64 parseFeatures(const QStringList &featureList, const QString &values, bool exclude);
bool checkOutputFile(PendingRequest pending);
void flush();
diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp
index 74fa44c1d6..b651b2724f 100644
--- a/tools/qmlprofiler/qmlprofilerdata.cpp
+++ b/tools/qmlprofiler/qmlprofilerdata.cpp
@@ -248,7 +248,7 @@ void QmlProfilerData::addQmlEvent(QQmlProfilerDefinitions::RangeType type,
eventHashStr = getHashStringForQmlEvent(eventLocation, type);
} else {
const QString filePath = QUrl(eventLocation.filename).path();
- displayName = filePath.mid(
+ displayName = filePath.midRef(
filePath.lastIndexOf(QLatin1Char('/')) + 1) +
QLatin1Char(':') + QString::number(eventLocation.line);
eventHashStr = getHashStringForQmlEvent(eventLocation, type);
@@ -327,8 +327,8 @@ void QmlProfilerData::addPixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventTy
QString filePath = QUrl(location).path();
- QString eventHashStr = filePath.mid(filePath.lastIndexOf(QLatin1Char('/')) + 1) +
- QStringLiteral(":") + QString::number(type);
+ const QString eventHashStr = filePath.midRef(filePath.lastIndexOf(QLatin1Char('/')) + 1)
+ + QLatin1Char(':') + QString::number(type);
QmlRangeEventData *newEvent;
if (d->eventDescriptions.contains(eventHashStr)) {
newEvent = d->eventDescriptions[eventHashStr];
diff --git a/tools/qmlprofiler/qmlprofilerdata.h b/tools/qmlprofiler/qmlprofilerdata.h
index 2570513d93..00ef037071 100644
--- a/tools/qmlprofiler/qmlprofilerdata.h
+++ b/tools/qmlprofiler/qmlprofilerdata.h
@@ -58,12 +58,6 @@ public:
bool isEmpty() const;
-signals:
- void error(QString);
- void stateChanged();
- void dataReady();
-
-public slots:
void clear();
void setTraceEndTime(qint64 time);
void setTraceStartTime(qint64 time);
@@ -83,6 +77,11 @@ public slots:
void complete();
bool save(const QString &filename);
+signals:
+ void error(QString);
+ void stateChanged();
+ void dataReady();
+
private:
void sortStartTimes();
void computeQmlTime();
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index c892f60680..0e542ab0c8 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -361,7 +361,7 @@ static void usage()
puts(" ");
exit(1);
}
-
+#ifndef QT_NO_OPENGL
// Listen on GL context creation of the QQuickWindow in order to print diagnostic output.
class DiagnosticGlContextCreationListener : public QObject {
Q_OBJECT
@@ -389,7 +389,9 @@ private slots:
context->doneCurrent();
deleteLater();
}
+
};
+#endif
static void setWindowTitle(bool verbose, const QObject *topLevel, QWindow *window)
{
@@ -403,8 +405,10 @@ static void setWindowTitle(bool verbose, const QObject *topLevel, QWindow *windo
if (verbose) {
newTitle += QLatin1String(" [Qt ") + QLatin1String(QT_VERSION_STR) + QLatin1Char(' ')
+ QGuiApplication::platformName() + QLatin1Char(' ');
+#ifndef QT_NO_OPENGL
newTitle += QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL
? QLatin1String("GL") : QLatin1String("GLES");
+#endif
newTitle += QLatin1Char(']');
}
if (oldTitle != newTitle)
@@ -560,6 +564,7 @@ int main(int argc, char ** argv)
loadDummyDataFiles(engine, fi.path());
}
QObject::connect(&engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
+ QObject::connect(&engine, &QQmlEngine::exit, QCoreApplication::instance(), &QCoreApplication::exit);
component->loadUrl(options.url);
while (component->isLoading())
QCoreApplication::processEvents();
@@ -592,8 +597,10 @@ int main(int argc, char ** argv)
if (window) {
setWindowTitle(options.verbose, topLevel, window.data());
+#ifndef QT_NO_OPENGL
if (options.verbose)
new DiagnosticGlContextCreationListener(window.data());
+#endif
QSurfaceFormat surfaceFormat = window->requestedFormat();
if (options.multisample)
surfaceFormat.setSamples(16);
diff --git a/tools/qmlscene/qmlscene.pro b/tools/qmlscene/qmlscene.pro
index 0411fd8e31..b1267612c5 100644
--- a/tools/qmlscene/qmlscene.pro
+++ b/tools/qmlscene/qmlscene.pro
@@ -4,6 +4,7 @@ CONFIG += no_import_scan
SOURCES += main.cpp
-DEFINES += QML_RUNTIME_TESTING QT_QML_DEBUG_NO_WARNING
+DEFINES += QML_RUNTIME_TESTING
+!contains(QT_CONFIG, no-qml-debug): DEFINES += QT_QML_DEBUG_NO_WARNING
load(qt_tool)