Merge branch 'wip/qt6' into wip/cmake

Change-Id: I50ac36b8803c296998149e98cc61e38687cdd14b
This commit is contained in:
Alexandru Croitor 2019-08-15 13:09:55 +02:00
commit c7ec7cd2a1
757 changed files with 9128 additions and 4739 deletions

View File

@ -2,6 +2,7 @@ load(qt_build_config)
CONFIG += warning_clean
DEFINES += QT_NO_JAVA_STYLE_ITERATORS
DEFINES += QT_NO_LINKED_LIST
QT_SOURCE_TREE = $$PWD
QT_BUILD_TREE = $$shadowed($$PWD)

View File

@ -1092,7 +1092,7 @@ foreach my $lib (@modules_to_sync) {
# }
my $class_header = "$class ";
$pri_install_gfiles .= $class_header
unless ($shadow || $pri_install_gfiles =~ $class_header);
unless ($shadow || $pri_install_gfiles =~ m/\b$class_header/);
$injection .= ":$class";
}

View File

@ -1,2 +1 @@
TARGET = arch
SOURCES = arch.cpp

View File

@ -1,2 +1,2 @@
option(host_build)
include(arch.pro)
SOURCES = arch.cpp

2
configure vendored
View File

@ -417,7 +417,7 @@ if [ -z "$QT_MAJOR_VERSION" ]; then
fi
}
#-------------------------------------------------------------------------------
# initalize variables
# initialize variables
#-------------------------------------------------------------------------------
# QTDIR may be set and point to an old or system-wide Qt installation

View File

@ -252,12 +252,14 @@
"label": "target architecture",
"type": "architecture",
"test": "arch",
"output": "arch",
"log": "arch"
},
"host_architecture": {
"label": "host architecture",
"type": "architecture",
"test": "arch",
"output": "arch_host",
"host": true,
"pro": "arch_host.pro",
"log": "arch"
@ -1323,7 +1325,7 @@
"ccache": {
"label": "Using ccache",
"autoDetect": false,
"condition": "config.unix && tests.ccache",
"condition": "tests.ccache",
"output": [ "privateConfig" ]
},
"msvc_mp": {

View File

@ -286,20 +286,39 @@ defineTest(qtConfTest_architecture) {
!qtConfTest_compile($${1}): \
error("Could not determine $$eval($${1}.label). See config.log for details.")
host = $$eval($${1}.host)
isEmpty(host): host = false
file_prefix =
exts = -
$$host {
equals(QMAKE_HOST.os, Windows): \
exts = .exe
} else {
win32 {
exts = .exe
} else:android {
file_prefix = lib
exts = .so
} else:wasm {
exts = .wasm .o
}
}
test = $$eval($${1}.test)
output = $$eval($${1}.output)
test_out_dir = $$OUT_PWD/$$basename(QMAKE_CONFIG_TESTS_DIR)/$$test
unix:exists($$test_out_dir/arch): \
content = $$cat($$test_out_dir/arch, blob)
else: win32:exists($$test_out_dir/arch.exe): \
content = $$cat($$test_out_dir/arch.exe, blob)
else: android:exists($$test_out_dir/libarch.so): \
content = $$cat($$test_out_dir/libarch.so, blob)
else: wasm:exists($$test_out_dir/arch.wasm): \
content = $$cat($$test_out_dir/arch.wasm, blob)
else: wasm:exists($$test_out_dir/arch.o): \
content = $$cat($$test_out_dir/arch.o, blob)
else: \
test_out_file =
for(ext, exts) {
equals(ext, -): ext =
f = $$test_out_dir/$$file_prefix$$output$$ext
exists($$f) {
test_out_file = $$f
break()
}
}
isEmpty(test_out_file): \
error("$$eval($${1}.label) detection binary not found.")
content = $$cat($$test_out_file, blob)
arch_magic = ".*==Qt=magic=Qt== Architecture:([^\\0]*).*"
subarch_magic = ".*==Qt=magic=Qt== Sub-architecture:([^\\0]*).*"

View File

@ -1 +0,0 @@
dependencies: []

View File

@ -140,10 +140,10 @@ void GLWidget::initializeGL()
{
initializeOpenGLFunctions();
qglClearColor(qtPurple.dark());
qglClearColor(qtPurple.darker());
logo = new QtLogo(this, 64);
logo->setColor(qtGreen.dark());
logo->setColor(qtGreen.darker());
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);

View File

@ -130,7 +130,7 @@ void GLWidget::initializeGL()
glEnable(GL_MULTISAMPLE);
logo = new QtLogo(this);
logo->setColor(qtGreen.dark());
logo->setColor(qtGreen.darker());
}
//! [2]
@ -163,7 +163,7 @@ void GLWidget::paintEvent(QPaintEvent *event)
//! [4]
//! [6]
qglClearColor(qtPurple.dark());
qglClearColor(qtPurple.darker());
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);

View File

@ -91,6 +91,9 @@ FragmentToy::FragmentToy(const QString &fragmentSource, QObject *parent)
}
}
FragmentToy::~FragmentToy()
= default;
void FragmentToy::draw(const QSize &windowSize)
{
if (!m_program)
@ -120,7 +123,7 @@ void FragmentToy::draw(const QSize &windowSize)
if (!m_vertex_shader->compileSourceCode(vertex_shader)) {
qWarning() << "Failed to compile the vertex shader:" << m_vertex_shader->log();
}
if (!m_program->addShader(m_vertex_shader.data())) {
if (!m_program->addShader(m_vertex_shader.get())) {
qWarning() << "Failed to add vertex shader to program:" << m_program->log();
}
}
@ -153,7 +156,7 @@ void FragmentToy::draw(const QSize &windowSize)
}
if (m_fragment_shader) {
if (!m_program->addShader(m_fragment_shader.data())) {
if (!m_program->addShader(m_fragment_shader.get())) {
qWarning() << "Failed to add fragment shader to program:" << m_program->log();
}
}
@ -197,14 +200,14 @@ void FragmentToy::fileChanged(const QString &path)
m_fragment_file_last_modified = fragment_source.lastModified();
m_recompile_shaders = true;
if (m_program) {
m_program->removeShader(m_fragment_shader.data());
m_program->removeShader(m_fragment_shader.get());
m_fragment_shader.reset(nullptr);
}
}
} else {
m_recompile_shaders = true;
if (m_program) {
m_program->removeShader(m_fragment_shader.data());
m_program->removeShader(m_fragment_shader.get());
m_fragment_shader.reset(nullptr);
}
}

View File

@ -62,11 +62,14 @@
#include <QOpenGLShaderProgram>
#include <QOpenGLFunctions>
#include <memory>
class FragmentToy : public QObject, protected QOpenGLFunctions
{
Q_OBJECT
public:
FragmentToy(const QString &fragmentSource, QObject *parent = 0);
explicit FragmentToy(const QString &fragmentSource, QObject *parent = nullptr);
~FragmentToy();
void draw(const QSize &windowSize);
@ -79,9 +82,9 @@ private:
QString m_fragment_file;
QDateTime m_fragment_file_last_modified;
QScopedPointer<QOpenGLShaderProgram> m_program;
QScopedPointer<QOpenGLShader> m_vertex_shader;
QScopedPointer<QOpenGLShader> m_fragment_shader;
std::unique_ptr<QOpenGLShaderProgram> m_program;
std::unique_ptr<QOpenGLShader> m_vertex_shader;
std::unique_ptr<QOpenGLShader> m_fragment_shader;
QOpenGLVertexArrayObject m_vao;
QOpenGLBuffer m_vertex_buffer;
GLuint m_vertex_coord_pos;

View File

@ -160,9 +160,10 @@ void Window::iconActivated(QSystemTrayIcon::ActivationReason reason)
void Window::showMessage()
{
showIconCheckBox->setChecked(true);
QSystemTrayIcon::MessageIcon msgIcon = QSystemTrayIcon::MessageIcon(
typeComboBox->itemData(typeComboBox->currentIndex()).toInt());
if (msgIcon == QSystemTrayIcon::NoIcon) {
int selectedIcon = typeComboBox->itemData(typeComboBox->currentIndex()).toInt();
QSystemTrayIcon::MessageIcon msgIcon = QSystemTrayIcon::MessageIcon(selectedIcon);
if (selectedIcon == -1) { // custom icon
QIcon icon(iconComboBox->itemIcon(iconComboBox->currentIndex()));
trayIcon->showMessage(titleEdit->text(), bodyEdit->toPlainText(), icon,
durationSpinBox->value() * 1000);
@ -222,7 +223,7 @@ void Window::createMessageGroupBox()
QStyle::SP_MessageBoxCritical), tr("Critical"),
QSystemTrayIcon::Critical);
typeComboBox->addItem(QIcon(), tr("Custom icon"),
QSystemTrayIcon::NoIcon);
-1);
typeComboBox->setCurrentIndex(1);
durationLabel = new QLabel(tr("Duration:"));

View File

@ -317,7 +317,7 @@ void Dialog::setInteger()
{
//! [0]
bool ok;
int i = QInputDialog::getInt(this, tr("QInputDialog::getInteger()"),
int i = QInputDialog::getInt(this, tr("QInputDialog::getInt()"),
tr("Percentage:"), 25, 0, 100, 1, &ok);
if (ok)
integerLabel->setText(tr("%1%").arg(i));

View File

@ -457,7 +457,7 @@ void ArthurStyle::polish(QWidget *widget)
QPalette pal = widget->palette();
if (widget->isWindow()) {
pal.setColor(QPalette::Background, QColor(241, 241, 241));
pal.setColor(QPalette::Window, QColor(241, 241, 241));
widget->setPalette(pal);
}
@ -474,7 +474,7 @@ void ArthurStyle::unpolish(QWidget *widget)
void ArthurStyle::polish(QPalette &palette)
{
palette.setColor(QPalette::Background, QColor(241, 241, 241));
palette.setColor(QPalette::Window, QColor(241, 241, 241));
}
QRect ArthurStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const

View File

@ -153,7 +153,7 @@ void ArthurFrame::paintEvent(QPaintEvent *e)
int o = 10;
QBrush bg = palette().brush(QPalette::Background);
QBrush bg = palette().brush(QPalette::Window);
painter.fillRect(0, 0, o, o, bg);
painter.fillRect(width() - o, 0, o, o, bg);
painter.fillRect(0, height() - o, o, o, bg);

View File

@ -105,7 +105,7 @@ public:
m_green = new LightWidget(Qt::green);
vbox->addWidget(m_green);
QPalette pal = palette();
pal.setColor(QPalette::Background, Qt::black);
pal.setColor(QPalette::Window, Qt::black);
setPalette(pal);
setAutoFillBackground(true);
}

View File

@ -26,6 +26,10 @@ contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND
CMAKE_OUT_DIR = $$MODULE_BASE_OUTDIR/lib/cmake
internal_module {
MODULE = "$${MODULE}_private"
}
# Core, Network, an external module named Foo
CMAKE_MODULE_NAME = $$cmakeModuleName($${MODULE})
@ -112,6 +116,10 @@ win32:!static:!staticlib {
static|staticlib:CMAKE_STATIC_TYPE = true
internal_module {
CMAKE_INTERNAL_MODULE = true
}
CMAKE_DEBUG_TYPE =
CMAKE_RELEASE_TYPE =
@ -133,6 +141,24 @@ equals(QMAKE_HOST.os, Windows): CMAKE_BIN_SUFFIX = ".exe"
if(build_all|CONFIG(debug, debug|release)): CMAKE_DEBUG_TYPE = debug
if(build_all|CONFIG(release, debug|release)): CMAKE_RELEASE_TYPE = release
# CMAKE_DEBUG_AND_RELEASE is used to tell the _populate_$${CMAKE_MODULE_NAME}_target_properties
# functions whether a Configuration specific generator expression needs to be added to the values
# of INTERFACE_LINK_LIBRARIES and INTERFACE_LINK_OPTIONS. For debug_and_release builds, we do need
# configuration specific values. For singular builds (only release or only debug), we want the
# values to be applied regardless of the configuration.
# This would allow on Linux and macOS (and with a recent enough version of CMake on Windows) to
# build a Debug configuration of an application, even if Qt was built in a Release configuration.
#
# All IMPORTED_LOCATION_<CONFIG> paths are automatically considered by CMake if there is no
# <CONFIG> equivalent to the value specified by CMAKE_BUILD_TYPE.
# This means that when Qt was built in a Release configuration, and the application in a Debug
# configuration, IMPORTED_LOCATION_RELEASE will be used for the Qt libraries.
debug_and_release {
CMAKE_DEBUG_AND_RELEASE = TRUE
} else {
CMAKE_DEBUG_AND_RELEASE = FALSE
}
contains(CONFIG, plugin) {
!isEmpty(PLUGIN_EXTENDS):!equals(PLUGIN_EXTENDS, -) {
count(PLUGIN_EXTENDS, 1, greaterThan): \
@ -341,7 +367,7 @@ cmake_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
# Other modules should either create proper tests in tests/auto/cmake or, as
# a temporary measure, disable the generation of cmake files
# with 'CONFIG -= create_cmake'
!equals(CMAKE_MODULE_TESTS, -) {
!internal_module:!equals(CMAKE_MODULE_TESTS, -) {
isEmpty(CMAKE_MODULE_TESTS): CMAKE_MODULE_TESTS = $$MODULE_BASE_INDIR/tests/auto/cmake
!exists($$CMAKE_MODULE_TESTS): \
error("Missing CMake tests. Either create tests in tests/auto/cmake," \

View File

@ -75,7 +75,7 @@ function(_qt5_$${CMAKE_MODULE_NAME}_process_prl_file prl_file_location Configura
# Handle normal libraries passed as -lfoo
set(_lib \"${CMAKE_MATCH_1}\")
foreach(_standard_library ${_standard_libraries})
if(_standard_library MATCHES \"^${_lib}(\\.lib)?$\")
if(_standard_library MATCHES \"^${_lib}(\\\\.lib)?$\")
set(_lib_is_default_linked TRUE)
break()
endif()
@ -119,7 +119,8 @@ endfunction()
!!ENDIF
!!IF !equals(TEMPLATE, aux)
macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION
IsDebugAndRelease)
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
@ -130,24 +131,48 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI
_qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
set(_deps
${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}
)
set(_static_deps
!!IF !isEmpty(CMAKE_STATIC_TYPE)
${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LIB_DEPENDENCIES}
!!ENDIF
)
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
\"INTERFACE_LINK_LIBRARIES\" \"${_deps}\"
\"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
!!IF !isEmpty(CMAKE_LIB_SONAME)
\"IMPORTED_SONAME_${Configuration}\" \"$${CMAKE_LIB_SONAME}\"
!!ENDIF
# For backward compatibility with CMake < 2.8.12
\"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_deps}\"
\"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_deps};${_static_deps}\"
)
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY INTERFACE_LINK_LIBRARIES
\"${_deps}\"
)
!!IF !isEmpty(CMAKE_STATIC_TYPE)
if(NOT CMAKE_VERSION VERSION_LESS \"3.13\")
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
\"INTERFACE_LINK_OPTIONS\" \"${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LINK_FLAGS}\"
!!IF !isEmpty(CMAKE_STATIC_TYPE)
if(NOT "${IsDebugAndRelease}")
set(_genex_condition \"1\")
else()
if("${Configuration}" STREQUAL "DEBUG")
set(_genex_condition \"$<CONFIG:Debug>\")
else()
set(_genex_condition \"$<NOT:$<CONFIG:Debug>>\")
endif()
endif()
if(_static_deps)
set(_static_deps_genex \"$<${_genex_condition}:${_static_deps}>\")
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY INTERFACE_LINK_LIBRARIES
\"${_static_deps_genex}\"
)
endif()
set(_static_link_flags \"${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${Configuration}_LINK_FLAGS}\")
if(NOT CMAKE_VERSION VERSION_LESS \"3.13\" AND _static_link_flags)
set(_static_link_flags_genex \"$<${_genex_condition}:${_static_link_flags}>\")
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY INTERFACE_LINK_OPTIONS
\"${_static_link_flags_genex}\"
)
endif()
!!ENDIF
@ -382,9 +407,9 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!IF !equals(TEMPLATE, aux)
!!IF !isEmpty(CMAKE_RELEASE_TYPE)
!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
_populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" )
_populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
!!ELSE
_populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
_populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" $${CMAKE_DEBUG_AND_RELEASE})
!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
!!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
@ -395,7 +420,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
_populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
_populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
!!ELSE // CMAKE_STATIC_WINDOWS_BUILD
if (EXISTS
!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
@ -409,7 +434,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!ELSE
\"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
!!ENDIF
_populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
_populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" $${CMAKE_DEBUG_AND_RELEASE})
!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
endif()
!!ENDIF // CMAKE_DEBUG_TYPE
@ -419,9 +444,9 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!IF !isEmpty(CMAKE_DEBUG_TYPE)
!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
_populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
_populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
!!ELSE
_populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
_populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" $${CMAKE_DEBUG_AND_RELEASE})
!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
!!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
@ -432,7 +457,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
_populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" )
_populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" $${CMAKE_DEBUG_AND_RELEASE})
!!ELSE // CMAKE_STATIC_WINDOWS_BUILD
if (EXISTS
!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
@ -446,7 +471,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
!!ELSE
\"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
!!ENDIF
_populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
_populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" $${CMAKE_DEBUG_AND_RELEASE})
!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
endif()
!!ENDIF // CMAKE_RELEASE_TYPE
@ -459,6 +484,8 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
)
!!ENDIF // TEMPLATE != aux
!!IF isEmpty(CMAKE_INTERNAL_MODULE)
file(GLOB pluginTargets \"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}_*Plugin.cmake\")
macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
@ -481,6 +508,8 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
endforeach()
endif()
!!ENDIF // isEmpty(CMAKE_INTERNAL_MODULE)
!!IF !isEmpty(CMAKE_MODULE_EXTRAS)
include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake\")

View File

@ -37,6 +37,9 @@ defineTest(addExclusiveBuilds) {
addExclusiveBuildsProper($$join(ARGS, _and_), $$ARGS)
}
# Default directories to process
QMAKE_DIR_REPLACE_SANE += QGLTF_DIR TRACEGEN_DIR QMLCACHE_DIR LRELEASE_DIR LEX_DIR YACC_DIR
QMAKE_DIR_REPLACE = OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR DESTDIR $$QMAKE_DIR_REPLACE_SANE
QMAKE_DEFAULT_DIRS_TO_PROCESS = QGLTF_DIR TRACEGEN_DIR QMLCACHE_DIR LRELEASE_DIR LEX_DIR YACC_DIR
QMAKE_DIR_REPLACE_SANE += $$QMAKE_DEFAULT_DIRS_TO_PROCESS
QMAKE_DIR_REPLACE = \
OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR DESTDIR \
$$QMAKE_DEFAULT_DIRS_TO_PROCESS
unset(QMAKE_DEFAULT_DIRS_TO_PROCESS)

View File

@ -27,6 +27,24 @@ QT_TOOL_ENV = qtver qtmver qtvertag qtdocs builddir
qtPrepareTool(QDOC, qdoc)
QT_TOOL_ENV =
# On Windows, put the includes into a .inc file which QDoc will read, if the project
# has too many includes. We do this to overcome a command-line limit on Windows.
WIN_INCLUDETEMP=
INCLUDE_PATHS=$$INCPATH
win32:count(INCLUDE_PATHS, 30, >) {
WIN_INCLUDETEMP = $$OUT_PWD/qdocincludepaths.inc
WIN_INCLUDETEMP_CONTENT =
for (inc, INCLUDE_PATHS): \
WIN_INCLUDETEMP_CONTENT += -I$$inc
write_file($$absolute_path($$WIN_INCLUDETEMP, $$OUT_PWD), WIN_INCLUDETEMP_CONTENT)|error()
}
isEmpty(WIN_INCLUDETEMP) {
QDOC_INCLUDE_PATHS=$(INCPATH)
} else {
QDOC_INCLUDE_PATHS=@$$shell_quote($$WIN_INCLUDETEMP)
}
!build_online_docs: qtPrepareTool(QHELPGENERATOR, qhelpgenerator)
qtPrepareTool(QTATTRIBUTIONSSCANNER, qtattributionsscanner)
@ -75,12 +93,13 @@ qtattributionsscanner.CONFIG += phony
QMAKE_EXTRA_TARGETS += qtattributionsscanner
doc_command = $$QDOC $$QMAKE_DOCS
prepare_docs {
prepare_docs.commands += $$doc_command -prepare $$PREP_DOC_INDEXES -no-link-errors $(INCPATH)
generate_docs.commands += $$doc_command -generate $$DOC_INDEXES $(INCPATH)
prepare_docs.commands += $$doc_command -prepare $$PREP_DOC_INDEXES -no-link-errors $$QDOC_INCLUDE_PATHS
generate_docs.commands += $$doc_command -generate $$DOC_INDEXES $$QDOC_INCLUDE_PATHS
prepare_docs.depends += qtattributionsscanner
} else {
html_docs.commands += $$doc_command $$DOC_INDEXES $(INCPATH)
html_docs.commands += $$doc_command $$DOC_INDEXES $(QDOC_INCLUDE_PATHS)
html_docs.depends += qtattributionsscanner
}

View File

@ -117,7 +117,7 @@ unset(QT_FOR_PRIVATE)
QMAKE_USE_PRIVATE += $$QMAKE_USE_FOR_PRIVATE
unset(QMAKE_USE_FOR_PRIVATE)
!internal_module:CONFIG += create_cmake
CONFIG += create_cmake
contains(TARGET, QtAddOn.*): \
DEFINES += QT_BUILD_ADDON_$${ucmodule}_LIB

View File

@ -304,7 +304,6 @@ headersclean:!internal_module {
header_check.variable_out = PRE_TARGETDEPS
header_check.name = headercheck ${QMAKE_FILE_IN}
header_check.commands = $$hcleanCOMMAND
silent:header_check.commands = @echo compiling[header] ${QMAKE_FILE_IN} && $$hcleanCOMMAND
QMAKE_EXTRA_COMPILERS += header_check
}
unset(hcleanCOMMAND)

View File

@ -46,11 +46,17 @@ import json
import subprocess
from distutils.version import StrictVersion
def is_available(object):
if "isAvailable" in object:
return object["isAvailable"] # introduced in Xcode 11
else:
return "unavailable" not in object["availability"]
def is_suitable_runtime(runtimes, runtime_name, platform, min_version):
for runtime in runtimes:
identifier = runtime["identifier"]
if (runtime["name"] == runtime_name or identifier == runtime_name) \
and "unavailable" not in runtime["availability"] \
and is_available(runtime) \
and identifier.startswith("com.apple.CoreSimulator.SimRuntime.{}".format(platform)) \
and StrictVersion(runtime["version"]) >= min_version:
return True
@ -77,6 +83,6 @@ if __name__ == "__main__":
for runtime_name in device_dict:
if is_suitable_runtime(runtimes, runtime_name, args.platform, args.minimum_deployment_target):
for device in device_dict[runtime_name]:
if "unavailable" not in device["availability"] \
if is_available(device) \
and (args.state is None or device["state"].lower() in args.state):
print(device["udid"])

View File

@ -58,9 +58,9 @@ debug_and_release:!build_pass: return()
DOCKER_ENABLED = 1
equals(QMAKE_HOST.os, Darwin) | equals(QMAKE_HOST.os, Windows) {
equals(QMAKE_HOST.os, Darwin) {
DOCKER_ENABLED = 0
message("Not using docker network test server on macOS and Windows, see QTQAINFRA-2717 and QTQAINFRA-2750")
message("Not using docker network test server on macOS, see QTQAINFRA-2717 and QTQAINFRA-2750")
}
TESTSERVER_VERSION = ""

View File

@ -44,22 +44,12 @@ add_qt_executable(qmake
../src/corelib/tools/qarraydataops.h
../src/corelib/tools/qarraydatapointer.h
../src/corelib/tools/qbitarray.cpp ../src/corelib/tools/qbitarray.h
../src/corelib/tools/qbytearray.cpp ../src/corelib/tools/qbytearray.h
../src/corelib/tools/qbytearraymatcher.cpp ../src/corelib/tools/qbytearraymatcher.h
../src/corelib/tools/qchar.h
../src/corelib/tools/qcryptographichash.cpp ../src/corelib/tools/qcryptographichash.h
../src/corelib/tools/qhash.cpp ../src/corelib/tools/qhash.h
../src/corelib/tools/qlist.cpp ../src/corelib/tools/qlist.h
../src/corelib/tools/qlocale.cpp ../src/corelib/tools/qlocale.h
../src/corelib/tools/qlocale_tools.cpp ../src/corelib/tools/qlocale_tools_p.h
../src/corelib/tools/qmap.cpp ../src/corelib/tools/qmap.h
../src/corelib/tools/qregexp.cpp ../src/corelib/tools/qregexp.h
../src/corelib/tools/qstring.cpp ../src/corelib/tools/qstring.h
../src/corelib/tools/qstringlist.cpp ../src/corelib/tools/qstringlist.h
../src/corelib/tools/qstringmatcher.h
../src/corelib/tools/qvector.h
../src/corelib/tools/qversionnumber.cpp ../src/corelib/tools/qversionnumber.h
../src/corelib/tools/qvsnprintf.cpp
cachekeys.h
generators/mac/pbuilder_pbx.cpp generators/mac/pbuilder_pbx.h
generators/makefile.cpp generators/makefile.h
@ -89,9 +79,18 @@ add_qt_executable(qmake
option.cpp option.h
project.cpp project.h
property.cpp property.h
qbytearray.cpp-NOTFOUND qbytearray.h-NOTFOUND
qbytearraymatcher.cpp-NOTFOUND qbytearraymatcher.h-NOTFOUND
qchar.h-NOTFOUND
qdatetime.cpp-NOTFOUND qdatetime.h-NOTFOUND qdatetime_p.h-NOTFOUND
qlocale.cpp-NOTFOUND qlocale.h-NOTFOUND
qlocale_tools.cpp-NOTFOUND qlocale_tools_p.h-NOTFOUND
qregexp.cpp-NOTFOUND qregexp.h-NOTFOUND
qstring.cpp-NOTFOUND qstring.h-NOTFOUND
qstringlist.cpp-NOTFOUND qstringlist.h-NOTFOUND
qstringmatcher.h-NOTFOUND
qvsnprintf.cpp-NOTFOUND
DEFINES
=\"\"
PROEVALUATOR_FULL
QT_BOOTSTRAPPED
QT_BUILD_QMAKE
@ -99,21 +98,23 @@ add_qt_executable(qmake
QT_VERSION_MAJOR=
QT_VERSION_MINOR=
QT_VERSION_PATCH=
join(QT_VERSION_STR=\"\")
INCLUDE_DIRECTORIES
.
../include
../include/QtCore ../include/QtCore
../include/QtCore//QtCore
../src/corelib/global
generators
generators/mac
generators/unix
generators/win32
join(..)/include
join(..)/include/QtCore join(..)/include/QtCore
join(..)/include/QtCore//QtCore
join(..)/src/corelib/global
library
PUBLIC_LIBRARIES
Qt::Gui
)
#### Keys ignored in scope 1:.:.:qmake.pro:<TRUE>:
# CONFIG = "cmdline" "-qt"
# PRECOMPILED_HEADER = "qmake_pch.h"
# _OPTION = "host_build"
@ -128,7 +129,7 @@ extend_target(qmake CONDITION WIN32
../src/corelib/io/qfsfileengine_win.cpp
../src/corelib/io/qsettings_win.cpp
../src/corelib/plugin/qsystemlibrary.cpp
../src/corelib/tools/qlocale_win.cpp
qlocale_win.cpp-NOTFOUND
registry.cpp-NOTFOUND
DEFINES
UNICODE
@ -148,7 +149,7 @@ extend_target(qmake CONDITION UNIX
../src/corelib/io/qfilesystemiterator_unix.cpp
../src/corelib/io/qfsfileengine_unix.cpp
../src/corelib/kernel/qcore_unix.cpp
../src/corelib/tools/qlocale_unix.cpp
qlocale_unix.cpp-NOTFOUND
)
extend_target(qmake CONDITION APPLE_OSX

View File

@ -51,24 +51,24 @@ add_qt_tool(qmake # special case
../src/corelib/tools/qarraydataops.h
../src/corelib/tools/qarraydatapointer.h
../src/corelib/tools/qbitarray.cpp ../src/corelib/tools/qbitarray.h
../src/corelib/tools/qbytearray.cpp ../src/corelib/tools/qbytearray.h
../src/corelib/tools/qbytearraymatcher.cpp ../src/corelib/tools/qbytearraymatcher.h
../src/corelib/tools/qchar.h
../src/corelib/text/qbytearray.cpp ../src/corelib/text/qbytearray.h
../src/corelib/text/qbytearraymatcher.cpp ../src/corelib/text/qbytearraymatcher.h
../src/corelib/text/qchar.h
../src/corelib/tools/qcryptographichash.cpp ../src/corelib/tools/qcryptographichash.h
../src/corelib/time/qdatetime.cpp ../src/corelib/time/qdatetime.h ../src/corelib/time/qdatetime_p.h # special case
../src/corelib/tools/qhash.cpp ../src/corelib/tools/qhash.h
../src/corelib/tools/qlist.cpp ../src/corelib/tools/qlist.h
../src/corelib/tools/qlocale.cpp ../src/corelib/tools/qlocale.h
../src/corelib/tools/qlocale_tools.cpp ../src/corelib/tools/qlocale_tools_p.h
../src/corelib/text/qlocale.cpp ../src/corelib/text/qlocale.h
../src/corelib/text/qlocale_tools.cpp ../src/corelib/text/qlocale_tools_p.h
../src/corelib/tools/qmap.cpp ../src/corelib/tools/qmap.h
../src/corelib/tools/qregexp.cpp ../src/corelib/tools/qregexp.h
../src/corelib/text/qregexp.cpp ../src/corelib/text/qregexp.h
../src/corelib/tools/qringbuffer.cpp # special case
../src/corelib/tools/qstring.cpp ../src/corelib/tools/qstring.h
../src/corelib/tools/qstringlist.cpp ../src/corelib/tools/qstringlist.h
../src/corelib/tools/qstringmatcher.h
../src/corelib/text/qstring.cpp ../src/corelib/text/qstring.h
../src/corelib/text/qstringlist.cpp ../src/corelib/text/qstringlist.h
../src/corelib/text/qstringmatcher.h
../src/corelib/tools/qvector.h
../src/corelib/tools/qversionnumber.cpp ../src/corelib/tools/qversionnumber.h
../src/corelib/tools/qvsnprintf.cpp
../src/corelib/text/qvsnprintf.cpp
cachekeys.h
generators/mac/pbuilder_pbx.cpp generators/mac/pbuilder_pbx.h
generators/makefile.cpp generators/makefile.h
@ -108,8 +108,7 @@ add_qt_tool(qmake # special case
QT_VERSION_MINOR=${PROJECT_VERSION_MINOR} # special case
QT_VERSION_PATCH=${PROJECT_VERSION_PATCH} # special case
INCLUDE_DIRECTORIES
# . # special case
library
# . # special case remove
generators
generators/mac
generators/unix
@ -122,7 +121,6 @@ add_qt_tool(qmake # special case
qt_internal_add_target_aliases(Bootstrap) # special case
#### Keys ignored in scope 1:.:.:qmake.pro:<TRUE>:
# CONFIG = "cmdline" "-qt"
# PRECOMPILED_HEADER = "qmake_pch.h"
# _OPTION = "host_build"
@ -137,7 +135,7 @@ extend_target(qmake CONDITION WIN32
../src/corelib/io/qfsfileengine_win.cpp
../src/corelib/io/qsettings_win.cpp
../src/corelib/plugin/qsystemlibrary.cpp
../src/corelib/tools/qlocale_win.cpp
../src/corelib/text/qlocale_win.cpp # special case
library/registry.cpp # special case
DEFINES
UNICODE
@ -157,7 +155,7 @@ extend_target(qmake CONDITION UNIX
../src/corelib/io/qfilesystemiterator_unix.cpp
../src/corelib/io/qfsfileengine_unix.cpp
../src/corelib/kernel/qcore_unix.cpp
../src/corelib/tools/qlocale_unix.cpp
../src/corelib/text/qlocale_unix.cpp
)
extend_target(qmake CONDITION APPLE_OSX
@ -180,7 +178,7 @@ extend_target(qmake CONDITION WIN32
../src/corelib/io/qfilesystemengine_win.cpp
../src/corelib/io/qfilesystemiterator_win.cpp
../src/corelib/io/qfsfileengine_win.cpp
../src/corelib/tools/qlocale_win.cpp
../src/corelib/text/qlocale_win.cpp
../src/corelib/io/qsettings_win.cpp
# ../src/corelib/global/qoperatingsystemversion.cpp special case: remove this
../src/corelib/plugin/qsystemlibrary.cpp

View File

@ -105,24 +105,24 @@ DEPEND_SRC = \
$(SOURCE_PATH)/src/corelib/serialization/qtextstream.cpp \
$(SOURCE_PATH)/src/corelib/serialization/qxmlstream.cpp \
$(SOURCE_PATH)/src/corelib/serialization/qxmlutils.cpp \
$(SOURCE_PATH)/src/corelib/text/qbytearray.cpp\
$(SOURCE_PATH)/src/corelib/text/qbytearraymatcher.cpp \
$(SOURCE_PATH)/src/corelib/text/qlocale.cpp \
$(SOURCE_PATH)/src/corelib/text/qlocale_tools.cpp \
$(SOURCE_PATH)/src/corelib/text/qregexp.cpp \
$(SOURCE_PATH)/src/corelib/text/qstringbuilder.cpp \
$(SOURCE_PATH)/src/corelib/text/qstring.cpp \
$(SOURCE_PATH)/src/corelib/text/qstringlist.cpp \
$(SOURCE_PATH)/src/corelib/text/qvsnprintf.cpp \
$(SOURCE_PATH)/src/corelib/time/qdatetime.cpp \
$(SOURCE_PATH)/src/corelib/tools/qarraydata.cpp \
$(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp \
$(SOURCE_PATH)/src/corelib/tools/qbytearray.cpp\
$(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp \
$(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp \
$(SOURCE_PATH)/src/corelib/tools/qhash.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlist.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlocale.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp \
$(SOURCE_PATH)/src/corelib/tools/qmap.cpp \
$(SOURCE_PATH)/src/corelib/tools/qregexp.cpp \
$(SOURCE_PATH)/src/corelib/tools/qringbuffer.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstringbuilder.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstring.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp \
$(SOURCE_PATH)/src/corelib/tools/qversionnumber.cpp \
$(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp \
$(QTSRCS) $(QTSRCS2)
# QTSRCS and QTSRCS2 come from Makefile.unix.* (concatenated with this
# by configure); QTSRCS2 may include *.mm entries on macOS.
@ -302,13 +302,13 @@ qglobal.o: $(SOURCE_PATH)/src/corelib/global/qglobal.cpp
qarraydata.o: $(SOURCE_PATH)/src/corelib/tools/qarraydata.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qbytearray.o: $(SOURCE_PATH)/src/corelib/tools/qbytearray.cpp
qbytearray.o: $(SOURCE_PATH)/src/corelib/text/qbytearray.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qvsnprintf.o: $(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp
qvsnprintf.o: $(SOURCE_PATH)/src/corelib/text/qvsnprintf.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qbytearraymatcher.o: $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp
qbytearraymatcher.o: $(SOURCE_PATH)/src/corelib/text/qbytearraymatcher.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qmetatype.o: $(SOURCE_PATH)/src/corelib/kernel/qmetatype.cpp
@ -338,22 +338,22 @@ qcore_foundation.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm
qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp
qstring.o: $(SOURCE_PATH)/src/corelib/text/qstring.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qstringbuilder.o: $(SOURCE_PATH)/src/corelib/tools/qstringbuilder.cpp
qstringbuilder.o: $(SOURCE_PATH)/src/corelib/text/qstringbuilder.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qlocale.o: $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp
qlocale.o: $(SOURCE_PATH)/src/corelib/text/qlocale.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qlocale_tools.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp
qlocale_tools.o: $(SOURCE_PATH)/src/corelib/text/qlocale_tools.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qlocale_unix.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_unix.cpp
qlocale_unix.o: $(SOURCE_PATH)/src/corelib/text/qlocale_unix.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qlocale_win.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp
qlocale_win.o: $(SOURCE_PATH)/src/corelib/text/qlocale_win.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qversionnumber.o: $(SOURCE_PATH)/src/corelib/tools/qversionnumber.cpp
@ -407,7 +407,7 @@ qabstractfileengine.o: $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp
qtemporaryfile.o: $(SOURCE_PATH)/src/corelib/io/qtemporaryfile.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qregexp.o: $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp
qregexp.o: $(SOURCE_PATH)/src/corelib/text/qregexp.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qbitarray.o: $(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp
@ -428,7 +428,7 @@ qfileinfo.o: $(SOURCE_PATH)/src/corelib/io/qfileinfo.cpp
qdatetime.o: $(SOURCE_PATH)/src/corelib/time/qdatetime.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qstringlist.o: $(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp
qstringlist.o: $(SOURCE_PATH)/src/corelib/text/qstringlist.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qmap.o: $(SOURCE_PATH)/src/corelib/tools/qmap.cpp

View File

@ -196,6 +196,9 @@ qmake_pch.obj:
{$(SOURCE_PATH)\src\corelib\serialization}.cpp{}.obj::
$(CXX) $(CXXFLAGS) $<
{$(SOURCE_PATH)\src\corelib\text}.cpp{}.obj::
$(CXX) $(CXXFLAGS) $<
{$(SOURCE_PATH)\src\corelib\time}.cpp{}.obj::
$(CXX) $(CXXFLAGS) $<

View File

@ -167,14 +167,8 @@ MakefileGenerator::initOutPaths()
ProString &pathRef = v[dkey].first();
pathRef = fileFixify(pathRef.toQString(), FileFixifyFromOutdir);
#ifdef Q_OS_WIN
// We don't want to add a separator for DLLDESTDIR on Windows (###why?)
if (dkey != "DLLDESTDIR")
#endif
{
if(!pathRef.endsWith(Option::dir_sep))
pathRef += Option::dir_sep;
}
if (!pathRef.endsWith(Option::dir_sep))
pathRef += Option::dir_sep;
if (noIO() || (project->first("TEMPLATE") == "subdirs"))
continue;
@ -2233,21 +2227,6 @@ MakefileGenerator::writeDummyMakefile(QTextStream &t)
return true;
}
bool
MakefileGenerator::writeStubMakefile(QTextStream &t)
{
t << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl;
const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " ";
//const QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName()));
t << "first all clean install distclean uninstall: qmake\n"
<< "qmake_all:\n";
writeMakeQmake(t);
t << "FORCE:\n\n";
return true;
}
bool
MakefileGenerator::writeMakefile(QTextStream &t)
{
@ -2299,9 +2278,9 @@ QString MakefileGenerator::buildArgs(bool withExtra)
//could get stored argv, but then it would have more options than are
//probably necesary this will try to guess the bare minimum..
QString MakefileGenerator::build_args()
QString MakefileGenerator::fullBuildArgs()
{
QString ret = "$(QMAKE)";
QString ret;
//output
QString ofile = fileFixify(Option::output.fileName());
@ -2326,7 +2305,7 @@ MakefileGenerator::writeHeader(QTextStream &t)
t << "# Project: " << fileFixify(project->projectFile()) << Qt::endl;
t << "# Template: " << var("TEMPLATE") << Qt::endl;
if(!project->isActiveConfig("build_pass"))
t << "# Command: " << build_args().replace(QLatin1String("$(QMAKE)"), var("QMAKE_QMAKE")) << Qt::endl;
t << "# Command: " << var("QMAKE_QMAKE") << fullBuildArgs() << Qt::endl;
t << "#############################################################################\n";
t << Qt::endl;
QString ofile = Option::fixPathToTargetOS(Option::output.fileName());
@ -2792,7 +2771,7 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll)
<< "@$(QMAKE) -prl " << files.join(' ') << ' ' << buildArgs(true) << Qt::endl;
}
QString qmake = build_args();
QString qmake = "$(QMAKE)" + fullBuildArgs();
if(!ofile.isEmpty() && !project->isActiveConfig("no_autoqmake")) {
t << escapeDependencyPath(ofile) << ": "
<< escapeDependencyPath(fileFixify(project->projectFile())) << " ";
@ -3429,9 +3408,9 @@ MakefileGenerator::writePkgConfigFile()
t << Qt::endl;
// requires
const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(' ');
if (!requires.isEmpty()) {
t << "Requires: " << requires << Qt::endl;
const QString requiresString = project->values("QMAKE_PKGCONFIG_REQUIRES").join(' ');
if (!requiresString.isEmpty()) {
t << "Requires: " << requiresString << Qt::endl;
}
t << Qt::endl;

View File

@ -58,7 +58,7 @@ class MakefileGenerator : protected QMakeSourceFileInfo
bool resolveDependenciesInFrameworks = false;
QHash<QString, bool> init_compiler_already;
QString makedir, chkexists;
QString build_args();
QString fullBuildArgs();
//internal caches
mutable QHash<QString, QMakeLocalFileName> depHeuristicsCache;
@ -90,7 +90,6 @@ protected:
void writeExtraCompilerTargets(QTextStream &t);
void writeExtraCompilerVariables(QTextStream &t);
bool writeDummyMakefile(QTextStream &t);
virtual bool writeStubMakefile(QTextStream &t);
virtual bool writeMakefile(QTextStream &t);
virtual void writeDefaultVariables(QTextStream &t);

View File

@ -57,6 +57,7 @@ private:
QList<Build *> makefiles;
void clearBuilds();
MakefileGenerator *processBuild(const ProString &);
void accumulateVariableFromBuilds(const ProKey &name, Build *build) const;
public:
@ -95,9 +96,6 @@ BuildsMetaMakefileGenerator::init()
if(builds.count() > 1 && Option::output.fileName() == "-") {
use_single_build = true;
warn_msg(WarnLogic, "Cannot direct to stdout when using multiple BUILDS.");
} else if(0 && !use_single_build && project->first("TEMPLATE") == "subdirs") {
use_single_build = true;
warn_msg(WarnLogic, "Cannot specify multiple builds with TEMPLATE subdirs.");
}
if(!use_single_build) {
for(int i = 0; i < builds.count(); i++) {
@ -188,6 +186,7 @@ BuildsMetaMakefileGenerator::write()
if(!build->makefile) {
ret = false;
} else if(build == glue) {
accumulateVariableFromBuilds("QMAKE_INTERNAL_INCLUDED_FILES", build);
ret = build->makefile->writeProjectMakefile();
} else {
ret = build->makefile->write();
@ -230,6 +229,16 @@ MakefileGenerator
return nullptr;
}
void BuildsMetaMakefileGenerator::accumulateVariableFromBuilds(const ProKey &name, Build *dst) const
{
ProStringList &values = dst->makefile->projectFile()->values(name);
for (auto build : makefiles) {
if (build != dst)
values += build->makefile->projectFile()->values(name);
}
values.removeDuplicates();
}
class SubdirsMetaMakefileGenerator : public MetaMakefileGenerator
{
protected:
@ -327,17 +336,13 @@ SubdirsMetaMakefileGenerator::init()
hasError |= tmpError;
}
sub->makefile = MetaMakefileGenerator::createMetaGenerator(sub_proj, sub_name);
if(0 && sub->makefile->type() == SUBDIRSMETATYPE) {
subs.append(sub);
} else {
const QString output_name = Option::output.fileName();
Option::output.setFileName(sub->output_file);
hasError |= !sub->makefile->write();
delete sub;
qmakeClearCaches();
sub = nullptr;
Option::output.setFileName(output_name);
}
const QString output_name = Option::output.fileName();
Option::output.setFileName(sub->output_file);
hasError |= !sub->makefile->write();
delete sub;
qmakeClearCaches();
sub = nullptr;
Option::output.setFileName(output_name);
Option::output_dir = old_output_dir;
qmake_setpwd(oldpwd);

View File

@ -497,21 +497,20 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
// Make sure we keep the dependency order of libraries
lflags[arch].removeAll(opt);
lflags[arch].append(opt);
} else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) {
if (opt.length() > 10) {
opt = opt.mid(10).trimmed();
} else {
opt = l.at(++lit);
if (opt.startsWith("-Xarch"))
opt = l.at(++lit); // The user has done the right thing and prefixed each part
}
} else if (target_mode == TARG_MAC_MODE
&& (opt == "-framework" || opt == "-force_load")) {
// Handle space separated options
ProString dashOpt = opt;
opt = l.at(++lit);
if (opt.startsWith("-Xarch"))
opt = l.at(++lit); // The user has done the right thing and prefixed each part
for(int x = 0; x < lflags[arch].size(); ++x) {
if (lflags[arch].at(x) == "-framework" && lflags[arch].at(++x) == opt) {
if (lflags[arch].at(x) == dashOpt && lflags[arch].at(++x) == opt) {
lflags[arch].remove(x - 1, 2);
break;
}
}
lflags[arch].append("-framework");
lflags[arch].append(dashOpt);
lflags[arch].append(opt);
} else {
lflags[arch].append(opt);

View File

@ -42,7 +42,6 @@ class UnixMakefileGenerator : public MakefileGenerator
protected:
virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); }
bool doDepends() const override { return !Option::mkfile::do_stub_makefile && MakefileGenerator::doDepends(); }
#ifdef Q_OS_WIN // MinGW x-compiling for QNX
QString installRoot() const override;
#endif

View File

@ -66,8 +66,6 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t)
if (project->first("TEMPLATE") == "app" ||
project->first("TEMPLATE") == "lib" ||
project->first("TEMPLATE") == "aux") {
if(Option::mkfile::do_stub_makefile && MakefileGenerator::writeStubMakefile(t))
return true;
writeMakeParts(t);
return MakefileGenerator::writeMakefile(t);
} else if (project->first("TEMPLATE") == "subdirs") {

View File

@ -93,18 +93,6 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
project->first("TEMPLATE") == "aux") {
if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib")
writePkgConfigFile();
if(Option::mkfile::do_stub_makefile) {
t << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl;
const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << escapeDependencyPath(*it) << ' ';
t << "first all clean install distclean uninstall: qmake\n"
<< "qmake_all:\n";
writeMakeQmake(t);
t << "FORCE:\n\n";
return true;
}
writeMingwParts(t);
return MakefileGenerator::writeMakefile(t);
}
@ -127,7 +115,7 @@ QString MingwMakefileGenerator::installRoot() const
return QStringLiteral("$(INSTALL_ROOT:@msyshack@%=%)");
}
void createLdResponseFile(const QString &fileName, const ProStringList &objList)
static void createResponseFile(const QString &fileName, const ProStringList &objList)
{
QString filePath = Option::output_dir + QDir::separator() + fileName;
QFile file(filePath);
@ -151,23 +139,6 @@ void createLdResponseFile(const QString &fileName, const ProStringList &objList)
}
}
void createArObjectScriptFile(const QString &fileName, const QString &target, const ProStringList &objList)
{
QString filePath = Option::output_dir + QDir::separator() + fileName;
QFile file(filePath);
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream t(&file);
// ### quoting?
t << "CREATE " << target << Qt::endl;
for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) {
t << "ADDMOD " << *it << Qt::endl;
}
t << "SAVE\n";
t.flush();
file.close();
}
}
void MingwMakefileGenerator::writeMingwParts(QTextStream &t)
{
writeStandardParts(t);
@ -294,26 +265,25 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) {
objectsLinkLine = "$(OBJECTS)";
} else if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
QString ar_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
QString ar_response_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
if (!var("BUILD_NAME").isEmpty()) {
ar_script_file += "." + var("BUILD_NAME");
ar_response_file += "." + var("BUILD_NAME");
}
if (!var("MAKEFILE").isEmpty())
ar_script_file += "." + var("MAKEFILE");
ar_response_file += "." + var("MAKEFILE");
// QMAKE_LIB is used for win32, including mingw, whereas QMAKE_AR is used on Unix.
// Strip off any options since the ar commands will be read from file.
QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);
QString ar_cmd = var("QMAKE_LIB");
if (ar_cmd.isEmpty())
ar_cmd = "ar";
createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS"));
objectsLinkLine = ar_cmd + " -M < " + escapeFilePath(ar_script_file);
ar_cmd = "ar -rc";
createResponseFile(ar_response_file, project->values("OBJECTS"));
objectsLinkLine = ar_cmd + ' ' + var("DEST_TARGET") + " @" + escapeFilePath(ar_response_file);
} else {
QString ld_response_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
if (!var("BUILD_NAME").isEmpty())
ld_response_file += "." + var("BUILD_NAME");
if (!var("MAKEFILE").isEmpty())
ld_response_file += "." + var("MAKEFILE");
createLdResponseFile(ld_response_file, project->values("OBJECTS"));
createResponseFile(ld_response_file, project->values("OBJECTS"));
objectsLinkLine = "@" + escapeFilePath(ld_response_file);
}
Win32MakefileGenerator::writeObjectsPart(t);

View File

@ -48,10 +48,6 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
if(project->first("TEMPLATE") == "app" ||
project->first("TEMPLATE") == "lib" ||
project->first("TEMPLATE") == "aux") {
#if 0
if(Option::mkfile::do_stub_makefile)
return MakefileGenerator::writeStubMakefile(t);
#endif
writeNmakeParts(t);
return MakefileGenerator::writeMakefile(t);
}

View File

@ -238,7 +238,7 @@ ProString &ProString::append(const ProString &other, bool *pending)
QChar *ptr;
if (pending && !*pending) {
ptr = prepareExtend(1 + other.m_length, 0, m_length);
*ptr++ = 32;
*ptr++ = QLatin1Char(' ');
} else {
ptr = prepareExtend(other.m_length, 0, m_length);
}
@ -276,7 +276,7 @@ ProString &ProString::append(const ProStringList &other, bool *pending, bool ski
QChar *ptr = prepareExtend(totalLength, 0, m_length);
for (int i = startIdx; i < sz; ++i) {
if (putSpace)
*ptr++ = 32;
*ptr++ = QLatin1Char(' ');
else
putSpace = true;
const ProString &str = other.at(i);

View File

@ -68,6 +68,7 @@ class ProString {
public:
ProString();
ProString(const ProString &other);
ProString &operator=(const ProString &) = default;
PROITEM_EXPLICIT ProString(const QString &str);
PROITEM_EXPLICIT ProString(const QStringRef &str);
PROITEM_EXPLICIT ProString(const char *str);
@ -432,11 +433,12 @@ public:
ProFunctionDef(const ProFunctionDef &o) : m_pro(o.m_pro), m_offset(o.m_offset) { m_pro->ref(); }
ProFunctionDef(ProFunctionDef &&other) noexcept
: m_pro(other.m_pro), m_offset(other.m_offset) { other.m_pro = nullptr; }
~ProFunctionDef() { m_pro->deref(); }
~ProFunctionDef() { if (m_pro) m_pro->deref(); }
ProFunctionDef &operator=(const ProFunctionDef &o)
{
if (this != &o) {
m_pro->deref();
if (m_pro)
m_pro->deref();
m_pro = o.m_pro;
m_pro->ref();
m_offset = o.m_offset;

View File

@ -1130,48 +1130,35 @@ bool QMakeEvaluator::prepareProject(const QString &inDir)
}
superdir = qdfi.path();
}
QString sdir = inDir;
QString dir = m_outputDir;
forever {
conffile = sdir + QLatin1String("/.qmake.conf");
if (!m_vfs->exists(conffile, flags))
conffile.clear();
cachefile = dir + QLatin1String("/.qmake.cache");
if (!m_vfs->exists(cachefile, flags))
cachefile.clear();
if (!cachefile.isEmpty()) {
if (!conffile.isEmpty() || !cachefile.isEmpty()) {
if (dir != sdir)
m_sourceRoot = sdir;
m_buildRoot = dir;
break;
}
if (dir == superdir)
goto no_cache;
QFileInfo qdfi(dir);
if (qdfi.isRoot()) {
cachefile.clear();
break;
}
dir = qdfi.path();
}
QString sdir = inDir;
forever {
conffile = sdir + QLatin1String("/.qmake.conf");
if (!m_vfs->exists(conffile, flags))
conffile.clear();
if (!conffile.isEmpty()) {
if (sdir != m_buildRoot)
m_sourceRoot = sdir;
break;
}
QFileInfo qsdfi(sdir);
if (qsdfi.isRoot()) {
conffile.clear();
break;
}
QFileInfo qdfi(dir);
if (qsdfi.isRoot() || qdfi.isRoot())
goto no_cache;
sdir = qsdfi.path();
dir = qdfi.path();
}
} else {
m_buildRoot = QFileInfo(cachefile).path();
}
if (!conffile.isEmpty())
m_conffile = QDir::cleanPath(conffile);
if (!cachefile.isEmpty())
m_cachefile = QDir::cleanPath(cachefile);
m_conffile = QDir::cleanPath(conffile);
m_cachefile = QDir::cleanPath(cachefile);
}
no_cache:
@ -1583,8 +1570,8 @@ void QMakeEvaluator::updateFeaturePaths()
}
for (int i = 0; i < feature_roots.count(); ++i)
if (!feature_roots.at(i).endsWith((ushort)'/'))
feature_roots[i].append((ushort)'/');
if (!feature_roots.at(i).endsWith(QLatin1Char('/')))
feature_roots[i].append(QLatin1Char('/'));
feature_roots.removeDuplicates();

View File

@ -621,7 +621,7 @@ void QMakeParser::read(ProFile *pro, const QStringRef &in, int line, SubGrammar
if (c != term) {
parseError(fL1S("Missing %1 terminator [found %2]")
.arg(QChar(term))
.arg(c ? QString(c) : QString::fromLatin1("end-of-line")));
.arg(c ? QString(QChar(c)) : QString::fromLatin1("end-of-line")));
m_inError = true;
// Just parse on, as if there was a terminator ...
} else {

View File

@ -111,7 +111,6 @@ private:
struct BlockScope {
BlockScope() : start(nullptr), braceLevel(0), special(false), inBranch(false), nest(NestNone) {}
BlockScope(const BlockScope &other) { *this = other; }
ushort *start; // Where this block started; store length here
int braceLevel; // Nesting of braces in scope
bool special; // Single-line conditionals inside loops, etc. cannot have else branches

View File

@ -93,7 +93,6 @@ bool Option::mkfile::do_deps = true;
bool Option::mkfile::do_mocs = true;
bool Option::mkfile::do_dep_heuristics = true;
bool Option::mkfile::do_preprocess = false;
bool Option::mkfile::do_stub_makefile = false;
QStringList Option::mkfile::project_files;
static Option::QMAKE_MODE default_mode(QString progname)
@ -254,8 +253,6 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state)
Option::mkfile::do_deps = false;
} else if (arg == "-nomoc") {
Option::mkfile::do_mocs = false;
} else if (arg == "-createstub") {
Option::mkfile::do_stub_makefile = true;
} else if (arg == "-nodependheuristics") {
Option::mkfile::do_dep_heuristics = false;
} else if (arg == "-E") {

View File

@ -189,7 +189,6 @@ struct Option
static bool do_mocs;
static bool do_dep_heuristics;
static bool do_preprocess;
static bool do_stub_makefile;
static int cachefile_depth;
static QStringList project_files;
};

View File

@ -178,6 +178,9 @@ public class QtNative
return fdDesc.detachFd();
} catch (FileNotFoundException e) {
return -1;
} catch (SecurityException e) {
Log.e(QtTAG, "Exception when opening file", e);
return -1;
}
}

View File

@ -143,6 +143,31 @@ add_qt_module(Core
statemachine/qsignaltransition.cpp statemachine/qsignaltransition.h statemachine/qsignaltransition_p.h
statemachine/qstate.cpp statemachine/qstate.h statemachine/qstate_p.h
statemachine/qstatemachine.cpp statemachine/qstatemachine.h statemachine/qstatemachine_p.h
text/qbytearray.cpp text/qbytearray.h text/qbytearray_p.h
text/qbytearraylist.cpp text/qbytearraylist.h
text/qbytearraymatcher.cpp text/qbytearraymatcher.h
text/qbytedata_p.h
text/qchar.h
text/qcollator.cpp text/qcollator.h text/qcollator_p.h
text/qdoublescanprint_p.h
text/qharfbuzz.cpp text/qharfbuzz_p.h
text/qlocale.cpp text/qlocale.h text/qlocale_p.h
text/qlocale_data_p.h
text/qlocale_tools.cpp text/qlocale_tools_p.h
text/qregexp.cpp text/qregexp.h
text/qstring.cpp text/qstring.h
text/qstring_compat.cpp
text/qstringalgorithms.h text/qstringalgorithms_p.h
text/qstringbuilder.cpp text/qstringbuilder.h
text/qstringiterator_p.h
text/qstringlist.cpp text/qstringlist.h
text/qstringliteral.h
text/qstringmatcher.h
text/qstringview.cpp text/qstringview.h
text/qtextboundaryfinder.cpp text/qtextboundaryfinder.h
text/qunicodetables_p.h
text/qunicodetools.cpp text/qunicodetools_p.h
text/qvsnprintf.cpp
thread/qmutex.h
thread/qreadwritelock.h
thread/qrunnable.cpp thread/qrunnable.h
@ -155,30 +180,19 @@ add_qt_module(Core
tools/qarraydataops.h
tools/qarraydatapointer.h
tools/qbitarray.cpp tools/qbitarray.h
tools/qbytearray.cpp tools/qbytearray.h tools/qbytearray_p.h
tools/qbytearraylist.cpp tools/qbytearraylist.h
tools/qbytearraymatcher.cpp tools/qbytearraymatcher.h
tools/qbytedata_p.h
tools/qcache.h
tools/qchar.h
tools/qcollator.cpp tools/qcollator.h tools/qcollator_p.h
tools/qcontainerfwd.h
tools/qcontainertools_impl.h
tools/qcontiguouscache.cpp tools/qcontiguouscache.h
tools/qcryptographichash.cpp tools/qcryptographichash.h
tools/qdoublescanprint_p.h
tools/qeasingcurve.cpp tools/qeasingcurve.h
tools/qfreelist.cpp tools/qfreelist_p.h
tools/qharfbuzz.cpp tools/qharfbuzz_p.h
tools/qhash.cpp tools/qhash.h
tools/qhashfunctions.h
tools/qiterator.h
tools/qline.cpp tools/qline.h
tools/qlinkedlist.cpp tools/qlinkedlist.h
tools/qlist.cpp tools/qlist.h
tools/qlocale.cpp tools/qlocale.h tools/qlocale_p.h
tools/qlocale_data_p.h
tools/qlocale_tools.cpp tools/qlocale_tools_p.h
tools/qmakearray_p.h
tools/qmap.cpp tools/qmap.h
tools/qmargins.cpp tools/qmargins.h
@ -189,7 +203,6 @@ add_qt_module(Core
tools/qqueue.h
tools/qrect.cpp tools/qrect.h
tools/qrefcount.cpp tools/qrefcount.h
tools/qregexp.cpp tools/qregexp.h
tools/qringbuffer.cpp tools/qringbuffer_p.h
tools/qscopedpointer.h tools/qscopedpointer_p.h
tools/qscopedvaluerollback.h
@ -201,24 +214,11 @@ add_qt_module(Core
tools/qsimd.cpp tools/qsimd_p.h
tools/qsize.cpp tools/qsize.h
tools/qstack.h
tools/qstring.cpp tools/qstring.h
tools/qstring_compat.cpp
tools/qstringalgorithms.h tools/qstringalgorithms_p.h
tools/qstringbuilder.cpp tools/qstringbuilder.h
tools/qstringiterator_p.h
tools/qstringlist.cpp tools/qstringlist.h
tools/qstringliteral.h
tools/qstringmatcher.h
tools/qstringview.cpp tools/qstringview.h
tools/qtextboundaryfinder.cpp tools/qtextboundaryfinder.h
tools/qtimeline.cpp tools/qtimeline.h
tools/qtools_p.h
tools/qunicodetables_p.h
tools/qunicodetools.cpp tools/qunicodetools_p.h
tools/qvarlengtharray.h
tools/qvector.h
tools/qversionnumber.cpp tools/qversionnumber.h
tools/qvsnprintf.cpp
DEFINES
QT_NO_FOREACH
QT_NO_USING_NAMESPACE
@ -236,7 +236,7 @@ add_qt_module(Core
add_qt_simd_part(Core SIMD mips_dsp
SOURCES
../gui/painting/qt_mips_asm_dsp_p.h
tools/qstring_mips_dsp_asm.S
text/qstring_mips_dsp_asm.S
)
@ -254,10 +254,9 @@ if(ANDROID)
endif()
#### Keys ignored in scope 1:.:.:corelib.pro:<TRUE>:
# CMAKE_DISABLED_FEATURES = "$$joinQT_DISABLED_FEATURES,"$$escape_expand(\\n) ""
# CMAKE_HOST_DATA_DIR = "$$cmakeRelativePath$$[QT_HOST_DATA/src],$$[QT_INSTALL_PREFIX]"
# CMAKE_INSTALL_DATA_DIR = "$$cmakeRelativePath$$[QT_HOST_DATA],$$[QT_INSTALL_PREFIX]"
# CONFIG = "exceptions" "qt_tracepoints" "$$MODULE_CONFIG" "simd" "optimize_full"
# CMAKE_DISABLED_FEATURES = "join(QT_DISABLED_FEATURES,"$$escape_expand(\\n) ")"
# CMAKE_HOST_DATA_DIR = "join($$[QT_HOST_DATA/src],$$[QT_INSTALL_PREFIX])"
# CMAKE_INSTALL_DATA_DIR = "join($$[QT_HOST_DATA],$$[QT_INSTALL_PREFIX])"
# HOST_BINS = "$$[QT_HOST_BINS]"
# INSTALLS = "ctest_qt5_module_files" "cmake_qt5_umbrella_module_files"
# MODULE = "core"
@ -432,7 +431,7 @@ extend_target(Core CONDITION _ss_f16c_cxx
extend_target(Core CONDITION linux_x_ OR hurd_x_ AND NOT cross_compile AND NOT static AND NOT _x_-armcc_x_
DEFINES
ELF_INTERPRETER=\\\"=Creadelf-l/bin/ls|perl-n-e\'/programinterpreter:.*]/{print$1;}\'\\\"
ELF_INTERPRETER=\\\"=Creadelf-l/bin/ls|perl-n-e\'['quote', ['if', ['/program', 'interpreter:', ['.*'], ']/'], '{', 'print', '$1;', '}']]\'\\\"
LINK_OPTIONS
"-Wl,-e,qt_core_boilerplate"
)
@ -508,7 +507,6 @@ extend_target(Core CONDITION QT_FEATURE_thread
thread/qfutex_p.h
thread/qgenericatomic.h
thread/qmutex.cpp thread/qmutex_p.h
thread/qmutexpool.cpp thread/qmutexpool_p.h
thread/qorderedmutexlocker_p.h
thread/qreadwritelock.cpp thread/qreadwritelock_p.h
thread/qsemaphore.cpp thread/qsemaphore.h
@ -569,52 +567,6 @@ extend_target(Core CONDITION MSVC
tools/qvector_msvc.cpp
)
extend_target(Core CONDITION APPLE AND NOT NACL
SOURCES
kernel/qelapsedtimer_mac.cpp
tools/qlocale_mac.mm
)
extend_target(Core CONDITION UNIX AND (NACL OR NOT APPLE)
SOURCES
tools/qlocale_unix.cpp
)
extend_target(Core CONDITION WIN32 AND (NACL OR NOT APPLE)
SOURCES
tools/qlocale_win.cpp
)
extend_target(Core CONDITION QT_FEATURE_icu
SOURCES
tools/qcollator_icu.cpp
tools/qlocale_icu.cpp
LIBRARIES
ICU::i18n ICU::uc ICU::data
)
extend_target(Core CONDITION WIN32 AND NOT QT_FEATURE_icu
SOURCES
tools/qcollator_win.cpp
)
extend_target(Core CONDITION APPLE_OSX AND NOT QT_FEATURE_icu
SOURCES
tools/qcollator_macx.cpp
)
extend_target(Core CONDITION UNIX AND NOT APPLE_OSX AND NOT QT_FEATURE_icu
SOURCES
tools/qcollator_posix.cpp
)
extend_target(Core CONDITION QT_FEATURE_regularexpression
SOURCES
tools/qregularexpression.cpp tools/qregularexpression.h
LIBRARIES
WrapPCRE2::WrapPCRE2
)
extend_target(Core CONDITION QT_FEATURE_commandlineparser
SOURCES
tools/qcommandlineoption.cpp tools/qcommandlineoption.h
@ -626,6 +578,51 @@ extend_target(Core CONDITION UNIX AND NOT HAIKU AND NOT INTEGRITY AND NOT VXWORK
m
)
extend_target(Core CONDITION APPLE_OSX AND NOT NACL
SOURCES
text/qlocale_mac.mm
)
extend_target(Core CONDITION UNIX AND (NACL OR NOT APPLE_OSX)
SOURCES
text/qlocale_unix.cpp
)
extend_target(Core CONDITION WIN32 AND (NACL OR NOT APPLE_OSX)
SOURCES
text/qlocale_win.cpp
)
extend_target(Core CONDITION QT_FEATURE_icu
SOURCES
text/qcollator_icu.cpp
text/qlocale_icu.cpp
LIBRARIES
ICU::i18n ICU::uc ICU::data
)
extend_target(Core CONDITION WIN32 AND NOT QT_FEATURE_icu
SOURCES
text/qcollator_win.cpp
)
extend_target(Core CONDITION APPLE_OSX AND NOT QT_FEATURE_icu
SOURCES
text/qcollator_macx.cpp
)
extend_target(Core CONDITION UNIX AND NOT APPLE_OSX AND NOT QT_FEATURE_icu
SOURCES
text/qcollator_posix.cpp
)
extend_target(Core CONDITION QT_FEATURE_regularexpression
SOURCES
text/qregularexpression.cpp text/qregularexpression.h
LIBRARIES
WrapPCRE2::WrapPCRE2
)
extend_target(Core CONDITION QT_FEATURE_timezone
SOURCES
time/qtimezone.cpp time/qtimezone.h
@ -841,6 +838,11 @@ extend_target(Core CONDITION QT_FEATURE_dlopen AND QT_FEATURE_library
${CMAKE_DL_LIBS}
)
extend_target(Core CONDITION APPLE AND NOT NACL
SOURCES
kernel/qelapsedtimer_mac.cpp
)
extend_target(Core CONDITION APPLE AND (APPLE_IOS OR APPLE_TVOS)
LIBRARIES
${FWUIKit}
@ -968,15 +970,19 @@ extend_target(Core CONDITION QT_FEATURE_mimetype
# Resources:
set_source_files_properties("mimetypes/mime/packages/freedesktop.org.xml"
PROPERTIES alias "freedesktop.org.xml"
PROPERTIES QT_RESOURCE_ALIAS "freedesktop.org.xml"
)
set(mimetypes_resource_files
"mime/packages/freedesktop.org.xml"
)
add_qt_resource(Core "mimetypes"
PREFIX
"/qt-project.org/qmime/packages"
BASE
"mimetypes"
FILES
mime/packages/freedesktop.org.xml
${mimetypes_resource_files}
)

View File

@ -157,6 +157,31 @@ add_qt_module(Core
statemachine/qsignaltransition.cpp statemachine/qsignaltransition.h statemachine/qsignaltransition_p.h
statemachine/qstate.cpp statemachine/qstate.h statemachine/qstate_p.h
statemachine/qstatemachine.cpp statemachine/qstatemachine.h statemachine/qstatemachine_p.h
text/qbytearray.cpp text/qbytearray.h text/qbytearray_p.h
text/qbytearraylist.cpp text/qbytearraylist.h
text/qbytearraymatcher.cpp text/qbytearraymatcher.h
text/qbytedata_p.h
text/qchar.h
text/qcollator.cpp text/qcollator.h text/qcollator_p.h
text/qdoublescanprint_p.h
text/qharfbuzz.cpp text/qharfbuzz_p.h
text/qlocale.cpp text/qlocale.h text/qlocale_p.h
text/qlocale_data_p.h
text/qlocale_tools.cpp text/qlocale_tools_p.h
text/qregexp.cpp text/qregexp.h
text/qstring.cpp text/qstring.h
text/qstring_compat.cpp
text/qstringalgorithms.h text/qstringalgorithms_p.h
text/qstringbuilder.cpp text/qstringbuilder.h
text/qstringiterator_p.h
text/qstringlist.cpp text/qstringlist.h
text/qstringliteral.h
text/qstringmatcher.h
text/qstringview.cpp text/qstringview.h
text/qtextboundaryfinder.cpp text/qtextboundaryfinder.h
text/qunicodetables_p.h
text/qunicodetools.cpp text/qunicodetools_p.h
text/qvsnprintf.cpp
thread/qmutex.h
thread/qreadwritelock.h
thread/qrunnable.cpp thread/qrunnable.h
@ -169,30 +194,19 @@ add_qt_module(Core
tools/qarraydataops.h
tools/qarraydatapointer.h
tools/qbitarray.cpp tools/qbitarray.h
tools/qbytearray.cpp tools/qbytearray.h tools/qbytearray_p.h
tools/qbytearraylist.cpp tools/qbytearraylist.h
tools/qbytearraymatcher.cpp tools/qbytearraymatcher.h
tools/qbytedata_p.h
tools/qcache.h
tools/qchar.h
tools/qcollator.cpp tools/qcollator.h tools/qcollator_p.h
tools/qcontainerfwd.h
tools/qcontainertools_impl.h
tools/qcontiguouscache.cpp tools/qcontiguouscache.h
tools/qcryptographichash.cpp tools/qcryptographichash.h
tools/qdoublescanprint_p.h
tools/qeasingcurve.cpp tools/qeasingcurve.h
tools/qfreelist.cpp tools/qfreelist_p.h
tools/qharfbuzz.cpp tools/qharfbuzz_p.h
tools/qhash.cpp tools/qhash.h
tools/qhashfunctions.h
tools/qiterator.h
tools/qline.cpp tools/qline.h
tools/qlinkedlist.cpp tools/qlinkedlist.h
tools/qlist.cpp tools/qlist.h
tools/qlocale.cpp tools/qlocale.h tools/qlocale_p.h
tools/qlocale_data_p.h
tools/qlocale_tools.cpp tools/qlocale_tools_p.h
tools/qmakearray_p.h
tools/qmap.cpp tools/qmap.h
tools/qmargins.cpp tools/qmargins.h
@ -203,7 +217,6 @@ add_qt_module(Core
tools/qqueue.h
tools/qrect.cpp tools/qrect.h
tools/qrefcount.cpp tools/qrefcount.h
tools/qregexp.cpp tools/qregexp.h
tools/qringbuffer.cpp tools/qringbuffer_p.h
tools/qscopedpointer.h tools/qscopedpointer_p.h
tools/qscopedvaluerollback.h
@ -215,24 +228,11 @@ add_qt_module(Core
tools/qsimd.cpp tools/qsimd_p.h
tools/qsize.cpp tools/qsize.h
tools/qstack.h
tools/qstring.cpp tools/qstring.h
tools/qstring_compat.cpp
tools/qstringalgorithms.h tools/qstringalgorithms_p.h
tools/qstringbuilder.cpp tools/qstringbuilder.h
tools/qstringiterator_p.h
tools/qstringlist.cpp tools/qstringlist.h
tools/qstringliteral.h
tools/qstringmatcher.h
tools/qstringview.cpp tools/qstringview.h
tools/qtextboundaryfinder.cpp tools/qtextboundaryfinder.h
tools/qtimeline.cpp tools/qtimeline.h
tools/qtools_p.h
tools/qunicodetables_p.h
tools/qunicodetools.cpp tools/qunicodetools_p.h
tools/qvarlengtharray.h
tools/qvector.h
tools/qversionnumber.cpp tools/qversionnumber.h
tools/qvsnprintf.cpp
DEFINES
QT_NO_FOREACH
QT_NO_USING_NAMESPACE
@ -318,7 +318,7 @@ endif()
add_qt_simd_part(Core SIMD mips_dsp
SOURCES
../gui/painting/qt_mips_asm_dsp_p.h
tools/qstring_mips_dsp_asm.S
text/qstring_mips_dsp_asm.S
)
@ -336,10 +336,9 @@ if(ANDROID)
endif()
#### Keys ignored in scope 1:.:.:corelib.pro:<TRUE>:
# CMAKE_DISABLED_FEATURES = "$$joinQT_DISABLED_FEATURES,"$$escape_expand(\\n) ""
# CMAKE_HOST_DATA_DIR = "$$cmakeRelativePath$$[QT_HOST_DATA/src],$$[QT_INSTALL_PREFIX]"
# CMAKE_INSTALL_DATA_DIR = "$$cmakeRelativePath$$[QT_HOST_DATA],$$[QT_INSTALL_PREFIX]"
# CONFIG = "exceptions" "qt_tracepoints" "$$MODULE_CONFIG" "simd" "optimize_full"
# CMAKE_DISABLED_FEATURES = "join(QT_DISABLED_FEATURES,"$$escape_expand(\\n) ")"
# CMAKE_HOST_DATA_DIR = "join($$[QT_HOST_DATA/src],$$[QT_INSTALL_PREFIX])"
# CMAKE_INSTALL_DATA_DIR = "join($$[QT_HOST_DATA],$$[QT_INSTALL_PREFIX])"
# HOST_BINS = "$$[QT_HOST_BINS]"
# INSTALLS = "ctest_qt5_module_files" "cmake_qt5_umbrella_module_files"
# MODULE = "core"
@ -508,12 +507,15 @@ extend_target(Core CONDITION INTEGRITY
#### Keys ignored in scope 27:.:global:global/global.pri:else:
# F16C_SOURCES = "global/qfloat16_f16c.c"
extend_target(Core CONDITION linux_x_ OR hurd_x_ AND NOT cross_compile AND NOT static AND NOT _x_-armcc_x_
DEFINES
ELF_INTERPRETER=\\\"=Creadelf-l/bin/ls|perl-n-e\'/programinterpreter:.*]/{print$1;}\'\\\"
LINK_OPTIONS
"-Wl,-e,qt_core_boilerplate"
)
# special case begin
# Remove this because it's handled manually
#extend_target(Core CONDITION linux_x_ OR hurd_x_ AND NOT cross_compile AND NOT static AND NOT _x_-armcc_x_
# DEFINES
# ELF_INTERPRETER=\\\"=Creadelf-l/bin/ls|perl-n-e\'['quote', ['if', ['/program', 'interpreter:', ['.*'], ']/'], '{', 'print', '$1;', '}']]\'\\\"
# LINK_OPTIONS
# "-Wl,-e,qt_core_boilerplate"
#)
# special case end
extend_target(Core CONDITION LINUX AND NOT static
SOURCES
@ -586,7 +588,6 @@ extend_target(Core CONDITION QT_FEATURE_thread
thread/qfutex_p.h
thread/qgenericatomic.h
thread/qmutex.cpp thread/qmutex_p.h
thread/qmutexpool.cpp thread/qmutexpool_p.h
thread/qorderedmutexlocker_p.h
thread/qreadwritelock.cpp thread/qreadwritelock_p.h
thread/qsemaphore.cpp thread/qsemaphore.h
@ -647,52 +648,6 @@ extend_target(Core CONDITION MSVC
tools/qvector_msvc.cpp
)
extend_target(Core CONDITION APPLE AND NOT NACL
SOURCES
kernel/qelapsedtimer_mac.cpp
tools/qlocale_mac.mm
)
extend_target(Core CONDITION UNIX AND (NACL OR NOT APPLE)
SOURCES
tools/qlocale_unix.cpp
)
extend_target(Core CONDITION WIN32 AND (NACL OR NOT APPLE)
SOURCES
tools/qlocale_win.cpp
)
extend_target(Core CONDITION QT_FEATURE_icu
SOURCES
tools/qcollator_icu.cpp
tools/qlocale_icu.cpp
LIBRARIES
ICU::i18n ICU::uc ICU::data
)
extend_target(Core CONDITION WIN32 AND NOT QT_FEATURE_icu
SOURCES
tools/qcollator_win.cpp
)
extend_target(Core CONDITION APPLE_OSX AND NOT QT_FEATURE_icu
SOURCES
tools/qcollator_macx.cpp
)
extend_target(Core CONDITION UNIX AND NOT APPLE_OSX AND NOT QT_FEATURE_icu
SOURCES
tools/qcollator_posix.cpp
)
extend_target(Core CONDITION QT_FEATURE_regularexpression
SOURCES
tools/qregularexpression.cpp tools/qregularexpression.h
LIBRARIES
WrapPCRE2::WrapPCRE2
)
extend_target(Core CONDITION QT_FEATURE_commandlineparser
SOURCES
tools/qcommandlineoption.cpp tools/qcommandlineoption.h
@ -704,6 +659,51 @@ extend_target(Core CONDITION UNIX AND NOT HAIKU AND NOT INTEGRITY AND NOT VXWORK
m
)
extend_target(Core CONDITION APPLE_OSX AND NOT NACL
SOURCES
text/qlocale_mac.mm
)
extend_target(Core CONDITION UNIX AND (NACL OR NOT APPLE_OSX)
SOURCES
text/qlocale_unix.cpp
)
extend_target(Core CONDITION WIN32 AND (NACL OR NOT APPLE_OSX)
SOURCES
text/qlocale_win.cpp
)
extend_target(Core CONDITION QT_FEATURE_icu
SOURCES
text/qcollator_icu.cpp
text/qlocale_icu.cpp
LIBRARIES
ICU::i18n ICU::uc ICU::data
)
extend_target(Core CONDITION WIN32 AND NOT QT_FEATURE_icu
SOURCES
text/qcollator_win.cpp
)
extend_target(Core CONDITION APPLE_OSX AND NOT QT_FEATURE_icu
SOURCES
text/qcollator_macx.cpp
)
extend_target(Core CONDITION UNIX AND NOT APPLE_OSX AND NOT QT_FEATURE_icu
SOURCES
text/qcollator_posix.cpp
)
extend_target(Core CONDITION QT_FEATURE_regularexpression
SOURCES
text/qregularexpression.cpp text/qregularexpression.h
LIBRARIES
WrapPCRE2::WrapPCRE2
)
extend_target(Core CONDITION QT_FEATURE_timezone
SOURCES
time/qtimezone.cpp time/qtimezone.h
@ -919,6 +919,11 @@ extend_target(Core CONDITION QT_FEATURE_dlopen AND QT_FEATURE_library
${CMAKE_DL_LIBS}
)
extend_target(Core CONDITION APPLE AND NOT NACL
SOURCES
kernel/qelapsedtimer_mac.cpp
)
extend_target(Core CONDITION APPLE AND (APPLE_IOS OR APPLE_TVOS)
LIBRARIES
${FWUIKit}

View File

@ -62,7 +62,7 @@ QByteArray QLatin1Codec::convertFromUnicode(const QChar *ch, int len, ConverterS
char *d = r.data();
int invalid = 0;
for (int i = 0; i < len; ++i) {
if (ch[i] > 0xff) {
if (ch[i] > QChar(0xff)) {
d[i] = replacement;
++invalid;
} else {
@ -112,28 +112,28 @@ QString QLatin15Codec::convertToUnicode(const char* chars, int len, ConverterSta
while(len--) {
switch(uc->unicode()) {
case 0xa4:
*uc = 0x20ac;
*uc = QChar(0x20ac);
break;
case 0xa6:
*uc = 0x0160;
*uc = QChar(0x0160);
break;
case 0xa8:
*uc = 0x0161;
*uc = QChar(0x0161);
break;
case 0xb4:
*uc = 0x017d;
*uc = QChar(0x017d);
break;
case 0xb8:
*uc = 0x017e;
*uc = QChar(0x017e);
break;
case 0xbc:
*uc = 0x0152;
*uc = QChar(0x0152);
break;
case 0xbd:
*uc = 0x0153;
*uc = QChar(0x0153);
break;
case 0xbe:
*uc = 0x0178;
*uc = QChar(0x0178);
break;
default:
break;

View File

@ -544,11 +544,9 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
#if !QT_CONFIG(icu)
QTextCodecCache *cache = &globalData->codecCache;
QTextCodec *codec;
if (cache) {
codec = cache->value(name);
if (codec)
return codec;
}
codec = cache->value(name);
if (codec)
return codec;
for (TextCodecListConstIt it = globalData->allCodecs.constBegin(), cend = globalData->allCodecs.constEnd(); it != cend; ++it) {
QTextCodec *cursor = *it;
@ -560,8 +558,7 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
QList<QByteArray> aliases = cursor->aliases();
for (ByteArrayListConstIt ait = aliases.constBegin(), acend = aliases.constEnd(); ait != acend; ++ait) {
if (qTextCodecNameMatch(*ait, name)) {
if (cache)
cache->insert(name, cursor);
cache->insert(name, cursor);
return cursor;
}
}

View File

@ -951,10 +951,10 @@ QString QUtf32::convertToUnicode(const char *chars, int len, QTextCodec::Convert
}
uint code = (endian == BigEndianness) ? qFromBigEndian<quint32>(tuple) : qFromLittleEndian<quint32>(tuple);
if (QChar::requiresSurrogates(code)) {
*qch++ = QChar::highSurrogate(code);
*qch++ = QChar::lowSurrogate(code);
*qch++ = QChar(QChar::highSurrogate(code));
*qch++ = QChar(QChar::lowSurrogate(code));
} else {
*qch++ = code;
*qch++ = QChar(code);
}
num = 0;
}

View File

@ -472,7 +472,7 @@ qDoubleSscanf(argv[0], invalidLocale, \"invalid format\", &a, &argc);
/* END TEST: */
return 0;
}
"# FIXME: qmake: DEFINES += QDSP_P_H=$$shell_quote(\"@PWD@/tools/qdoublescanprint_p.h\")
"# FIXME: qmake: DEFINES += QDSP_P_H=$$shell_quote(\"@PWD@/text/qdoublescanprint_p.h\")
)

View File

@ -596,7 +596,7 @@
"qDoubleSnprintf(argv[0], 1, invalidLocale, \"invalid format\", a);",
"qDoubleSscanf(argv[0], invalidLocale, \"invalid format\", &a, &argc);"
],
"qmake": "DEFINES += QDSP_P_H=$$shell_quote(\\\"@PWD@/tools/qdoublescanprint_p.h\\\")"
"qmake": "DEFINES += QDSP_P_H=$$shell_quote(\\\"@PWD@/text/qdoublescanprint_p.h\\\")"
}
}
},

View File

@ -36,6 +36,7 @@ qtConfig(animation): include(animation/animation.pri)
include(global/global.pri)
include(thread/thread.pri)
include(tools/tools.pri)
include(text/text.pri)
include(time/time.pri)
include(io/io.pri)
include(itemmodels/itemmodels.pri)

View File

@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2019 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@ -613,7 +613,8 @@ using qsizetype = QIntegerForSizeof<std::size_t>::Signed;
# define Q_ALWAYS_INLINE inline
#endif
#if defined(Q_CC_GNU) && defined(Q_OS_WIN)
#if defined(Q_CC_GNU) && defined(Q_OS_WIN) && !defined(QT_NO_DATA_RELOCATION)
// ### Qt6: you can remove me
# define QT_INIT_METAOBJECT __attribute__((init_priority(101)))
#else
# define QT_INIT_METAOBJECT
@ -1002,6 +1003,29 @@ QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantic
# endif
#endif
// Work around MSVC warning about use of 3-arg algorithms
// until we can depend on the C++14 4-arg ones.
//
// These algortithms do NOT check for equal length.
// They need to be treated as if they called the 3-arg version (which they do)!
#ifdef Q_CC_MSVC
# define QT_3ARG_ALG(alg, f1, l1, f2, l2) \
std::alg(f1, l1, f2, l2)
#else
# define QT_3ARG_ALG(alg, f1, l1, f2, l2) \
[&f1, &l1, &f2, &l2]() { \
Q_UNUSED(l2); \
return std::alg(f1, l1, f2); \
}()
#endif
template <typename ForwardIterator1, typename ForwardIterator2>
inline bool qt_is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2)
{
return QT_3ARG_ALG(is_permutation, first1, last1, first2, last2);
}
#undef QT_3ARG_ALG
// this adds const to non-const objects (like std::as_const)
template <typename T>
Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }

View File

@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2019 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@ -180,6 +181,12 @@
#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINRT)
# define Q_OS_WINDOWS
# define Q_OS_WIN
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// On Windows, pointers to dllimport'ed variables are not constant expressions,
// so to keep to certain initializations (like QMetaObject) constexpr, we need
// to use functions instead.
# define QT_NO_DATA_RELOCATION
# endif
#endif
#if defined(Q_OS_WIN)

View File

@ -55,6 +55,10 @@
#include <stdlib.h>
#include <qglobal.h>
#ifdef Q_OS_WIN
# ifdef Q_CC_MINGW
// <unistd.h> must be included before any other header pulls in <time.h>.
# include <unistd.h> // Define _POSIX_THREAD_SAFE_FUNCTIONS to obtain localtime_r()
# endif
# define _POSIX_
# include <limits.h>
# undef _POSIX_

View File

@ -153,7 +153,7 @@ QDirPrivate::QDirPrivate(const QDirPrivate &copy)
bool QDirPrivate::exists() const
{
if (fileEngine.isNull()) {
if (!fileEngine) {
QFileSystemEngine::fillMetaData(dirEntry, metaData,
QFileSystemMetaData::ExistsAttribute | QFileSystemMetaData::DirectoryType); // always stat
return metaData.exists() && metaData.isDirectory();
@ -226,7 +226,7 @@ inline void QDirPrivate::resolveAbsoluteEntry() const
return;
QString absoluteName;
if (fileEngine.isNull()) {
if (!fileEngine) {
if (!dirEntry.isRelative() && dirEntry.isClean()) {
absoluteDirEntry = dirEntry;
return;
@ -693,7 +693,7 @@ QString QDir::absolutePath() const
QString QDir::canonicalPath() const
{
const QDirPrivate* d = d_ptr.constData();
if (d->fileEngine.isNull()) {
if (!d->fileEngine) {
QFileSystemEntry answer = QFileSystemEngine::canonicalName(d->dirEntry, d->metaData);
return answer.filePath();
}
@ -947,6 +947,12 @@ QString QDir::fromNativeSeparators(const QString &pathName)
int i = pathName.indexOf(QLatin1Char('\\'));
if (i != -1) {
QString n(pathName);
if (n.startsWith(QLatin1String("\\\\?\\"))) {
n.remove(0, 4);
i = n.indexOf(QLatin1Char('\\'));
if (i == -1)
return n;
}
QChar * const data = n.data();
data[i++] = QLatin1Char('/');
@ -1496,7 +1502,7 @@ bool QDir::mkdir(const QString &dirName) const
}
QString fn = filePath(dirName);
if (d->fileEngine.isNull())
if (!d->fileEngine)
return QFileSystemEngine::createDirectory(QFileSystemEntry(fn), false);
return d->fileEngine->mkdir(fn, false);
}
@ -1520,7 +1526,7 @@ bool QDir::rmdir(const QString &dirName) const
}
QString fn = filePath(dirName);
if (d->fileEngine.isNull())
if (!d->fileEngine)
return QFileSystemEngine::removeDirectory(QFileSystemEntry(fn), false);
return d->fileEngine->rmdir(fn, false);
@ -1548,7 +1554,7 @@ bool QDir::mkpath(const QString &dirPath) const
}
QString fn = filePath(dirPath);
if (d->fileEngine.isNull())
if (!d->fileEngine)
return QFileSystemEngine::createDirectory(QFileSystemEntry(fn), true);
return d->fileEngine->mkdir(fn, true);
}
@ -1574,7 +1580,7 @@ bool QDir::rmpath(const QString &dirPath) const
}
QString fn = filePath(dirPath);
if (d->fileEngine.isNull())
if (!d->fileEngine)
return QFileSystemEngine::removeDirectory(QFileSystemEntry(fn), true);
return d->fileEngine->rmdir(fn, true);
}
@ -1647,7 +1653,7 @@ bool QDir::isReadable() const
{
const QDirPrivate* d = d_ptr.constData();
if (d->fileEngine.isNull()) {
if (!d->fileEngine) {
if (!d->metaData.hasFlags(QFileSystemMetaData::UserReadPermission))
QFileSystemEngine::fillMetaData(d->dirEntry, d->metaData, QFileSystemMetaData::UserReadPermission);
@ -1692,7 +1698,7 @@ bool QDir::exists() const
*/
bool QDir::isRoot() const
{
if (d_ptr->fileEngine.isNull())
if (!d_ptr->fileEngine)
return d_ptr->dirEntry.isRoot();
return d_ptr->fileEngine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::RootFlag;
}
@ -1724,7 +1730,7 @@ bool QDir::isRoot() const
*/
bool QDir::isRelative() const
{
if (d_ptr->fileEngine.isNull())
if (!d_ptr->fileEngine)
return d_ptr->dirEntry.isRelative();
return d_ptr->fileEngine->isRelativePath();
}
@ -1741,7 +1747,7 @@ bool QDir::makeAbsolute()
{
const QDirPrivate *d = d_ptr.constData();
QScopedPointer<QDirPrivate> dir;
if (!d->fileEngine.isNull()) {
if (!!d->fileEngine) {
QString absolutePath = d->fileEngine->fileName(QAbstractFileEngine::AbsoluteName);
if (QDir::isRelativePath(absolutePath))
return false;
@ -1774,8 +1780,8 @@ bool QDir::operator==(const QDir &dir) const
if (d == other)
return true;
Qt::CaseSensitivity sensitive;
if (d->fileEngine.isNull() || other->fileEngine.isNull()) {
if (d->fileEngine.data() != other->fileEngine.data()) // one is native, the other is a custom file-engine
if (!d->fileEngine || !other->fileEngine) {
if (d->fileEngine.get() != other->fileEngine.get()) // one is native, the other is a custom file-engine
return false;
sensitive = QFileSystemEngine::isCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive;
@ -2339,6 +2345,11 @@ static QString qt_cleanPath(const QString &path, bool *ok)
if (path.isEmpty())
return path;
QString name = path;
#if defined (Q_OS_WIN)
if (name.startsWith(QLatin1String("\\\\?\\")))
name.remove(0, 4);
#endif
QChar dir_separator = QDir::separator();
if (dir_separator != QLatin1Char('/'))
name.replace(dir_separator, QLatin1Char('/'));

View File

@ -54,6 +54,8 @@
#include "qfilesystementry_p.h"
#include "qfilesystemmetadata_p.h"
#include <memory>
QT_BEGIN_NAMESPACE
class QDirPrivate : public QSharedData
@ -82,7 +84,7 @@ public:
static inline QChar getFilterSepChar(const QString &nameFilter);
static inline QStringList splitFilters(const QString &nameFilter, QChar sep = 0);
static inline QStringList splitFilters(const QString &nameFilter, QChar sep = {});
void setPath(const QString &path);
@ -98,7 +100,7 @@ public:
QDir::SortFlags sort;
QDir::Filters filters;
QScopedPointer<QAbstractFileEngine> fileEngine;
std::unique_ptr<QAbstractFileEngine> fileEngine;
QFileSystemEntry dirEntry;
mutable QFileSystemEntry absoluteDirEntry;

View File

@ -107,6 +107,8 @@
#include <QtCore/private/qfilesystemengine_p.h>
#include <QtCore/private/qfileinfo_p.h>
#include <memory>
QT_BEGIN_NAMESPACE
template <class Iterator>
@ -132,7 +134,7 @@ public:
void checkAndPushDirectory(const QFileInfo &);
bool matchesFilters(const QString &fileName, const QFileInfo &fi) const;
QScopedPointer<QAbstractFileEngine> engine;
std::unique_ptr<QAbstractFileEngine> engine;
QFileSystemEntry dirEntry;
const QStringList nameFilters;
@ -435,7 +437,7 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf
QDirIterator::QDirIterator(const QDir &dir, IteratorFlags flags)
{
const QDirPrivate *other = dir.d_ptr.constData();
d.reset(new QDirIteratorPrivate(other->dirEntry, other->nameFilters, other->filters, flags, !other->fileEngine.isNull()));
d.reset(new QDirIteratorPrivate(other->dirEntry, other->nameFilters, other->filters, flags, bool(other->fileEngine)));
}
/*!

View File

@ -55,6 +55,8 @@
# include "qcoreapplication.h"
#endif
#include <private/qmemory_p.h>
#ifdef QT_NO_QOBJECT
#define tr(X) QString::fromLatin1(X)
#endif
@ -85,10 +87,9 @@ QFilePrivate::openExternalFile(int flags, int fd, QFile::FileHandleFlags handleF
Q_UNUSED(fd);
return false;
#else
delete fileEngine;
fileEngine = nullptr;
QFSFileEngine *fe = new QFSFileEngine;
fileEngine = fe;
auto fs = qt_make_unique<QFSFileEngine>();
auto fe = fs.get();
fileEngine = std::move(fs);
return fe->open(QIODevice::OpenMode(flags), fd, handleFlags);
#endif
}
@ -101,10 +102,9 @@ QFilePrivate::openExternalFile(int flags, FILE *fh, QFile::FileHandleFlags handl
Q_UNUSED(fh);
return false;
#else
delete fileEngine;
fileEngine = nullptr;
QFSFileEngine *fe = new QFSFileEngine;
fileEngine = fe;
auto fs = qt_make_unique<QFSFileEngine>();
auto fe = fs.get();
fileEngine = std::move(fs);
return fe->open(QIODevice::OpenMode(flags), fh, handleFlags);
#endif
}
@ -112,8 +112,8 @@ QFilePrivate::openExternalFile(int flags, FILE *fh, QFile::FileHandleFlags handl
QAbstractFileEngine *QFilePrivate::engine() const
{
if (!fileEngine)
fileEngine = QAbstractFileEngine::create(fileName);
return fileEngine;
fileEngine.reset(QAbstractFileEngine::create(fileName));
return fileEngine.get();
}
//************* QFile
@ -334,10 +334,7 @@ QFile::setFileName(const QString &name)
file_already_open(*this, "setFileName");
close();
}
if(d->fileEngine) { //get a new file engine later
delete d->fileEngine;
d->fileEngine = nullptr;
}
d->fileEngine.reset(); //get a new file engine later
d->fileName = name;
}

View File

@ -42,6 +42,8 @@
#include "qfiledevice_p.h"
#include "qfsfileengine_p.h"
#include <private/qmemory_p.h>
#ifdef QT_NO_QOBJECT
#define tr(X) QString::fromLatin1(X)
#endif
@ -53,24 +55,20 @@ QT_BEGIN_NAMESPACE
#endif
QFileDevicePrivate::QFileDevicePrivate()
: fileEngine(nullptr),
cachedSize(0),
: cachedSize(0),
error(QFile::NoError), lastWasWrite(false)
{
writeBufferChunkSize = QFILE_WRITEBUFFER_SIZE;
}
QFileDevicePrivate::~QFileDevicePrivate()
{
delete fileEngine;
fileEngine = nullptr;
}
= default;
QAbstractFileEngine * QFileDevicePrivate::engine() const
{
if (!fileEngine)
fileEngine = new QFSFileEngine;
return fileEngine;
fileEngine = qt_make_unique<QFSFileEngine>();
return fileEngine.get();
}
void QFileDevicePrivate::setError(QFileDevice::FileError err)

View File

@ -53,6 +53,8 @@
#include "private/qiodevice_p.h"
#include <memory>
QT_BEGIN_NAMESPACE
class QAbstractFileEngine;
@ -75,7 +77,7 @@ protected:
void setError(QFileDevice::FileError err, const QString &errorString);
void setError(QFileDevice::FileError err, int errNum);
mutable QAbstractFileEngine *fileEngine;
mutable std::unique_ptr<QAbstractFileEngine> fileEngine;
mutable qint64 cachedSize;
QFileDevice::FileHandleFlags handleFlags;

View File

@ -707,11 +707,11 @@ bool QFileInfo::exists(const QString &file)
return false;
QFileSystemEntry entry(file);
QFileSystemMetaData data;
QAbstractFileEngine *engine =
QFileSystemEngine::resolveEntryAndCreateLegacyEngine(entry, data);
std::unique_ptr<QAbstractFileEngine> engine
{QFileSystemEngine::resolveEntryAndCreateLegacyEngine(entry, data)};
// Expensive fallback to non-QFileSystemEngine implementation
if (engine)
return QFileInfo(new QFileInfoPrivate(entry, data, engine)).exists();
return QFileInfo(new QFileInfoPrivate(entry, data, std::move(engine))).exists();
QFileSystemEngine::fillMetaData(entry, data, QFileSystemMetaData::ExistsAttribute);
return data.exists();

View File

@ -61,6 +61,8 @@
#include <QtCore/private/qfilesystementry_p.h>
#include <QtCore/private/qfilesystemmetadata_p.h>
#include <memory>
QT_BEGIN_NAMESPACE
class QFileInfoPrivate : public QSharedData
@ -126,10 +128,10 @@ public:
metaData = QFileSystemMetaData();
}
inline QFileInfoPrivate(const QFileSystemEntry &file, const QFileSystemMetaData &data, QAbstractFileEngine *engine)
inline QFileInfoPrivate(const QFileSystemEntry &file, const QFileSystemMetaData &data, std::unique_ptr<QAbstractFileEngine> engine)
: fileEntry(file),
metaData(data),
fileEngine(engine),
fileEngine{std::move(engine)},
cachedFlags(0),
#ifndef QT_NO_FSFILEENGINE
isDefaultConstructed(false),
@ -163,7 +165,7 @@ public:
QFileSystemEntry fileEntry;
mutable QFileSystemMetaData metaData;
QScopedPointer<QAbstractFileEngine> const fileEngine;
std::unique_ptr<QAbstractFileEngine> const fileEngine;
mutable QString fileNames[QAbstractFileEngine::NFileNames];
mutable QString fileOwners[2]; // QAbstractFileEngine::FileOwner: OwnerUser and OwnerGroup

View File

@ -822,6 +822,8 @@ QString QFileSystemEngine::resolveUserName(uint userId)
#endif
if (pw)
return QFile::decodeName(QByteArray(pw->pw_name));
#else // Integrity || WASM
Q_UNUSED(userId);
#endif
return QString();
}
@ -859,6 +861,8 @@ QString QFileSystemEngine::resolveGroupName(uint groupId)
#endif
if (gr)
return QFile::decodeName(QByteArray(gr->gr_name));
#else // Integrity || WASM
Q_UNUSED(groupId);
#endif
return QString();
}

View File

@ -40,13 +40,54 @@
#include "qplatformdefs.h"
#include "qfilesystemiterator_p.h"
#if QT_CONFIG(textcodec)
# include <qtextcodec.h>
# include <private/qutfcodec_p.h>
#endif
#ifndef QT_NO_FILESYSTEMITERATOR
#include <memory>
#include <stdlib.h>
#include <errno.h>
QT_BEGIN_NAMESPACE
static bool checkNameDecodable(const char *d_name, qsizetype len)
{
// This function is called in a loop from advance() below, but the loop is
// usually run only once.
#if QT_CONFIG(textcodec)
// We identify the codecs by their RFC 2978 MIBenum values. In this
// function:
// 3 US-ASCII (ANSI X3.4-1986)
// 4 Latin1 (ISO-8859-1)
// 106 UTF-8
QTextCodec *codec = QTextCodec::codecForLocale();
# ifdef QT_LOCALE_IS_UTF8
int mibEnum = 106;
# else
int mibEnum = codec->mibEnum();
# endif
if (Q_LIKELY(mibEnum == 106)) // UTF-8
return QUtf8::isValidUtf8(d_name, len).isValidUtf8;
if (mibEnum == 3) // US-ASCII
return QtPrivate::isAscii(QLatin1String(d_name, len));
if (mibEnum == 4) // Latin 1
return true;
// fall back to generic QTextCodec
QTextCodec::ConverterState cs(QTextCodec::IgnoreHeader);
codec->toUnicode(d_name, len, &cs);
return cs.invalidChars == 0 && cs.remainingChars == 0;
#else
// if we have no text codecs, then QString::fromLocal8Bit is fromLatin1
return true;
#endif
}
QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Filters filters,
const QStringList &nameFilters, QDirIterator::IteratorFlags flags)
: nativePath(entry.nativeFilePath())
@ -81,9 +122,9 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa
dirEntry = QT_READDIR(dir);
if (dirEntry) {
// process entries with correct UTF-8 names only
if (QFile::encodeName(QFile::decodeName(dirEntry->d_name)) == dirEntry->d_name) {
fileEntry = QFileSystemEntry(nativePath + QByteArray(dirEntry->d_name), QFileSystemEntry::FromNativePath());
qsizetype len = strlen(dirEntry->d_name);
if (checkNameDecodable(dirEntry->d_name, len)) {
fileEntry = QFileSystemEntry(nativePath + QByteArray(dirEntry->d_name, len), QFileSystemEntry::FromNativePath());
metaData.fillFromDirEnt(*dirEntry);
return true;
}

View File

@ -422,16 +422,27 @@ void QInotifyFileSystemWatcherEngine::readFromInotify()
}
}
template <typename Hash, typename Key>
typename Hash::const_iterator
find_last_in_equal_range(const Hash &c, const Key &key)
{
// find c.equal_range(key).second - 1 without backwards iteration:
auto i = c.find(key);
const auto end = c.cend();
if (i == end)
return end;
decltype(i) prev;
do {
prev = i;
++i;
} while (i != end && i.key() == key);
return prev;
}
QString QInotifyFileSystemWatcherEngine::getPathFromID(int id) const
{
QHash<int, QString>::const_iterator i = idToPath.find(id);
while (i != idToPath.constEnd() && i.key() == id) {
if ((i + 1) == idToPath.constEnd() || (i + 1).key() != id) {
return i.value();
}
++i;
}
return QString();
auto i = find_last_in_equal_range(idToPath, id);
return i == idToPath.cend() ? QString() : i.value() ;
}
QT_END_NAMESPACE

View File

@ -167,19 +167,21 @@ QFSFileEngine::QFSFileEngine(QFSFileEnginePrivate &dd)
/*!
\internal
*/
bool QFSFileEngine::processOpenModeFlags(QIODevice::OpenMode *mode)
ProcessOpenModeResult processOpenModeFlags(QIODevice::OpenMode openMode)
{
QIODevice::OpenMode &openMode = *mode;
ProcessOpenModeResult result;
result.ok = false;
if ((openMode & QFile::NewOnly) && (openMode & QFile::ExistingOnly)) {
qWarning("NewOnly and ExistingOnly are mutually exclusive");
setError(QFile::OpenError, QLatin1String("NewOnly and ExistingOnly are mutually exclusive"));
return false;
result.error = QLatin1String("NewOnly and ExistingOnly are mutually exclusive");
return result;
}
if ((openMode & QFile::ExistingOnly) && !(openMode & (QFile::ReadOnly | QFile::WriteOnly))) {
qWarning("ExistingOnly must be specified alongside ReadOnly, WriteOnly, or ReadWrite");
setError(QFile::OpenError, QLatin1String("ExistingOnly must be specified alongside ReadOnly, WriteOnly, or ReadWrite"));
return false;
result.error = QLatin1String(
"ExistingOnly must be specified alongside ReadOnly, WriteOnly, or ReadWrite");
return result;
}
// Either Append or NewOnly implies WriteOnly
@ -190,7 +192,9 @@ bool QFSFileEngine::processOpenModeFlags(QIODevice::OpenMode *mode)
if ((openMode & QFile::WriteOnly) && !(openMode & (QFile::ReadOnly | QFile::Append | QFile::NewOnly)))
openMode |= QFile::Truncate;
return true;
result.ok = true;
result.openMode = openMode;
return result;
}
/*!
@ -234,16 +238,19 @@ bool QFSFileEngine::open(QIODevice::OpenMode openMode)
return false;
}
if (!processOpenModeFlags(&openMode))
const ProcessOpenModeResult res = processOpenModeFlags(openMode);
if (!res.ok) {
setError(QFileDevice::OpenError, res.error);
return false;
}
d->openMode = openMode;
d->openMode = res.openMode;
d->lastFlushFailed = false;
d->tried_stat = 0;
d->fh = nullptr;
d->fd = -1;
return d->nativeOpen(openMode);
return d->nativeOpen(d->openMode);
}
/*!
@ -262,17 +269,20 @@ bool QFSFileEngine::open(QIODevice::OpenMode openMode, FILE *fh, QFile::FileHand
Q_D(QFSFileEngine);
if (!processOpenModeFlags(&openMode))
const ProcessOpenModeResult res = processOpenModeFlags(openMode);
if (!res.ok) {
setError(QFileDevice::OpenError, res.error);
return false;
}
d->openMode = openMode;
d->openMode = res.openMode;
d->lastFlushFailed = false;
d->closeFileHandle = (handleFlags & QFile::AutoCloseHandle);
d->fileEntry.clear();
d->tried_stat = 0;
d->fd = -1;
return d->openFh(openMode, fh);
return d->openFh(d->openMode, fh);
}
/*!
@ -321,10 +331,13 @@ bool QFSFileEngine::open(QIODevice::OpenMode openMode, int fd, QFile::FileHandle
{
Q_D(QFSFileEngine);
if (!processOpenModeFlags(&openMode))
const ProcessOpenModeResult res = processOpenModeFlags(openMode);
if (!res.ok) {
setError(QFileDevice::OpenError, res.error);
return false;
}
d->openMode = openMode;
d->openMode = res.openMode;
d->lastFlushFailed = false;
d->closeFileHandle = (handleFlags & QFile::AutoCloseHandle);
d->fileEntry.clear();
@ -332,7 +345,7 @@ bool QFSFileEngine::open(QIODevice::OpenMode openMode, int fd, QFile::FileHandle
d->fd = -1;
d->tried_stat = 0;
return d->openFd(openMode, fd);
return d->openFd(d->openMode, fd);
}

View File

@ -61,6 +61,13 @@
QT_BEGIN_NAMESPACE
struct ProcessOpenModeResult {
bool ok;
QIODevice::OpenMode openMode;
QString error;
};
Q_CORE_EXPORT ProcessOpenModeResult processOpenModeFlags(QIODevice::OpenMode mode);
class QFSFileEnginePrivate;
class Q_CORE_EXPORT QFSFileEngine : public QAbstractFileEngine
@ -131,9 +138,6 @@ public:
protected:
QFSFileEngine(QFSFileEnginePrivate &dd);
private:
inline bool processOpenModeFlags(QIODevice::OpenMode *mode);
};
class Q_AUTOTEST_EXPORT QFSFileEnginePrivate : public QAbstractFileEnginePrivate

View File

@ -312,7 +312,7 @@ void toString(QString &appendTo, const IPv6Address address)
}
}
const QChar colon = ushort(':');
const QChar colon = u':';
if (zeroRunLength < 4)
zeroRunOffset = -1;
else if (zeroRunOffset == 0)

View File

@ -202,6 +202,7 @@ void QProcessEnvironmentPrivate::insert(const QProcessEnvironmentPrivate &other)
vars.insert(it.key(), it.value());
#ifdef Q_OS_UNIX
const OrderedNameMapMutexLocker locker(this, &other);
auto nit = other.nameMap.constBegin();
const auto nend = other.nameMap.constEnd();
for ( ; nit != nend; ++nit)
@ -275,7 +276,6 @@ bool QProcessEnvironment::operator==(const QProcessEnvironment &other) const
return true;
if (d) {
if (other.d) {
QProcessEnvironmentPrivate::OrderedMutexLocker locker(d, other.d);
return d->vars == other.d->vars;
} else {
return isEmpty();
@ -322,7 +322,6 @@ bool QProcessEnvironment::contains(const QString &name) const
{
if (!d)
return false;
QProcessEnvironmentPrivate::MutexLocker locker(d);
return d->vars.contains(d->prepareName(name));
}
@ -373,7 +372,6 @@ QString QProcessEnvironment::value(const QString &name, const QString &defaultVa
if (!d)
return defaultValue;
QProcessEnvironmentPrivate::MutexLocker locker(d);
const auto it = d->vars.constFind(d->prepareName(name));
if (it == d->vars.constEnd())
return defaultValue;
@ -398,7 +396,6 @@ QStringList QProcessEnvironment::toStringList() const
{
if (!d)
return QStringList();
QProcessEnvironmentPrivate::MutexLocker locker(d);
return d->toList();
}
@ -412,7 +409,6 @@ QStringList QProcessEnvironment::keys() const
{
if (!d)
return QStringList();
QProcessEnvironmentPrivate::MutexLocker locker(d);
return d->keys();
}
@ -429,7 +425,6 @@ void QProcessEnvironment::insert(const QProcessEnvironment &e)
return;
// our re-impl of detach() detaches from null
QProcessEnvironmentPrivate::MutexLocker locker(e.d);
d->insert(*e.d);
}

View File

@ -146,16 +146,22 @@ public:
inline QString nameToString(const Key &name) const { return name; }
inline Value prepareValue(const QString &value) const { return value; }
inline QString valueToString(const Value &value) const { return value; }
struct MutexLocker {
MutexLocker(const QProcessEnvironmentPrivate *) {}
};
struct OrderedMutexLocker {
OrderedMutexLocker(const QProcessEnvironmentPrivate *,
const QProcessEnvironmentPrivate *) {}
};
#else
struct NameMapMutexLocker : public QMutexLocker
{
NameMapMutexLocker(const QProcessEnvironmentPrivate *d) : QMutexLocker(&d->nameMapMutex) {}
};
struct OrderedNameMapMutexLocker : public QOrderedMutexLocker
{
OrderedNameMapMutexLocker(const QProcessEnvironmentPrivate *d1,
const QProcessEnvironmentPrivate *d2)
: QOrderedMutexLocker(&d1->nameMapMutex, &d2->nameMapMutex)
{}
};
inline Key prepareName(const QString &name) const
{
const NameMapMutexLocker locker(this);
Key &ent = nameMap[name];
if (ent.isEmpty())
ent = name.toLocal8Bit();
@ -164,40 +170,27 @@ public:
inline QString nameToString(const Key &name) const
{
const QString sname = QString::fromLocal8Bit(name);
nameMap[sname] = name;
{
const NameMapMutexLocker locker(this);
nameMap[sname] = name;
}
return sname;
}
inline Value prepareValue(const QString &value) const { return Value(value); }
inline QString valueToString(const Value &value) const { return value.string(); }
struct MutexLocker : public QMutexLocker
{
MutexLocker(const QProcessEnvironmentPrivate *d) : QMutexLocker(&d->mutex) {}
};
struct OrderedMutexLocker : public QOrderedMutexLocker
{
OrderedMutexLocker(const QProcessEnvironmentPrivate *d1,
const QProcessEnvironmentPrivate *d2) :
QOrderedMutexLocker(&d1->mutex, &d2->mutex)
{}
};
QProcessEnvironmentPrivate() : QSharedData() {}
QProcessEnvironmentPrivate(const QProcessEnvironmentPrivate &other) :
QSharedData()
QSharedData(), vars(other.vars)
{
// This being locked ensures that the functions that only assign
// d pointers don't need explicit locking.
// We don't need to lock our own mutex, as this object is new and
// consequently not shared. For the same reason, non-const methods
// do not need a lock, as they detach objects (however, we need to
// ensure that they really detach before using prepareName()).
MutexLocker locker(&other);
vars = other.vars;
NameMapMutexLocker locker(&other);
nameMap = other.nameMap;
// We need to detach our members, so that our mutex can protect them.
// As we are being detached, they likely would be detached a moment later anyway.
vars.detach();
// We need to detach our nameMap, so that our mutex can protect it.
// As we are being detached, it likely would be detached a moment later anyway.
nameMap.detach();
}
#endif
@ -208,8 +201,7 @@ public:
#ifdef Q_OS_UNIX
typedef QHash<QString, Key> NameHash;
mutable NameHash nameMap;
mutable QMutex mutex;
mutable QMutex nameMapMutex;
#endif
static QProcessEnvironment fromList(const QStringList &list);

View File

@ -438,7 +438,6 @@ void QProcessPrivate::startProcess()
int envc = 0;
char **envp = 0;
if (environment.d.constData()) {
QProcessEnvironmentPrivate::MutexLocker locker(environment.d);
envp = _q_dupEnvironment(environment.d.constData()->vars, &envc);
}
@ -970,7 +969,6 @@ bool QProcessPrivate::startDetached(qint64 *pid)
int envc = 0;
char **envp = nullptr;
if (environment.d.constData()) {
QProcessEnvironmentPrivate::MutexLocker locker(environment.d);
envp = _q_dupEnvironment(environment.d.constData()->vars, &envc);
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Copyright (C) 2018 Intel Corporation.
** Copyright (C) 2019 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@ -279,14 +279,14 @@ static inline QStringList *resourceSearchPaths()
This enum is used by compressionAlgorithm() to indicate which algorithm the
RCC tool used to compress the payload.
\value NoCompression Contents are not compressed (isCompressed() is false).
\value NoCompression Contents are not compressed
\value ZlibCompression Contents are compressed using \l{zlib}{https://zlib.net} and can
be decompressed using the qUncompress() function.
\value ZstdCompression Contents are compressed using \l{zstd}{https://zstd.net}. To
decompress, use the \c{ZSTD_decompress} function from the zstd
library.
\sa compressionAlgorithm(), isCompressed()
\sa compressionAlgorithm()
*/
class QResourcePrivate {
@ -551,13 +551,20 @@ bool QResource::isValid() const
\sa isDir()
*/
#if QT_DEPRECATED_SINCE(5, 13)
/*!
\obsolete
Returns \c true if the resource represents a file and the data backing it
is in a compressed format, false otherwise. If the data is compressed,
check compressionAlgorithm() to verify what algorithm to use to decompress
the data.
\note This function is deprecated and can be replaced with
\code
compressionAlgorithm() != NoCompression
\endcode
\sa data(), compressionAlgorithm(), isFile()
*/
@ -565,6 +572,7 @@ bool QResource::isCompressed() const
{
return compressionAlgorithm() != NoCompression;
}
#endif
/*!
\since 5.13
@ -582,7 +590,7 @@ bool QResource::isCompressed() const
See \l{http://facebook.github.io/zstd/zstd_manual.html}{Zstandard manual}.
\sa isCompressed(), data(), isFile()
\sa data(), isFile()
*/
QResource::Compression QResource::compressionAlgorithm() const
{
@ -606,11 +614,11 @@ qint64 QResource::size() const
/*!
Returns direct access to a read only segment of data that this resource
represents. If the resource is compressed the data returns is
compressed and qUncompress() must be used to access the data. If the
resource is a directory \nullptr is returned.
represents. If the resource is compressed the data returned is compressed
and the appropriate library functions must be used to access the data. If
the resource is a directory \nullptr is returned.
\sa size(), isCompressed(), isFile()
\sa size(), compressionAlgorithm(), isFile()
*/
const uchar *QResource::data() const
@ -940,12 +948,15 @@ bool QResourceRoot::mappingRootSubdir(const QString &path, QString *match) const
Q_CORE_EXPORT bool qRegisterResourceData(int version, const unsigned char *tree,
const unsigned char *name, const unsigned char *data)
{
if (resourceGlobalData.isDestroyed())
return false;
QMutexLocker lock(resourceMutex());
if (version >= 0x01 && version <= 0x3 && resourceList()) {
ResourceList *list = resourceList();
if (version >= 0x01 && version <= 0x3) {
bool found = false;
QResourceRoot res(version, tree, name, data);
for(int i = 0; i < resourceList()->size(); ++i) {
if(*resourceList()->at(i) == res) {
for (int i = 0; i < list->size(); ++i) {
if (*list->at(i) == res) {
found = true;
break;
}
@ -953,7 +964,7 @@ Q_CORE_EXPORT bool qRegisterResourceData(int version, const unsigned char *tree,
if(!found) {
QResourceRoot *root = new QResourceRoot(version, tree, name, data);
root->ref.ref();
resourceList()->append(root);
list->append(root);
}
return true;
}
@ -967,11 +978,12 @@ Q_CORE_EXPORT bool qUnregisterResourceData(int version, const unsigned char *tre
return false;
QMutexLocker lock(resourceMutex());
if (version >= 0x01 && version <= 0x3 && resourceList()) {
if (version >= 0x01 && version <= 0x3) {
QResourceRoot res(version, tree, name, data);
for(int i = 0; i < resourceList()->size(); ) {
if(*resourceList()->at(i) == res) {
QResourceRoot *root = resourceList()->takeAt(i);
ResourceList *list = resourceList();
for (int i = 0; i < list->size(); ) {
if (*list->at(i) == res) {
QResourceRoot *root = list->takeAt(i);
if(!root->ref.deref())
delete root;
} else {
@ -1217,7 +1229,7 @@ QResource::unregisterResource(const QString &rccFilename, const QString &resourc
if(res->type() == QResourceRoot::Resource_File) {
QDynamicFileResourceRoot *root = reinterpret_cast<QDynamicFileResourceRoot*>(res);
if (root->mappingFile() == rccFilename && root->mappingRoot() == r) {
resourceList()->removeAt(i);
list->removeAt(i);
if(!root->ref.deref()) {
delete root;
return true;
@ -1288,7 +1300,7 @@ QResource::unregisterResource(const uchar *rccData, const QString &resourceRoot)
if(res->type() == QResourceRoot::Resource_Buffer) {
QDynamicBufferResourceRoot *root = reinterpret_cast<QDynamicBufferResourceRoot*>(res);
if (root->mappingBuffer() == rccData && root->mappingRoot() == r) {
resourceList()->removeAt(i);
list->removeAt(i);
if(!root->ref.deref()) {
delete root;
return true;
@ -1366,9 +1378,15 @@ bool QResourceFileEngine::open(QIODevice::OpenMode flags)
qWarning("QResourceFileEngine::open: Missing file name");
return false;
}
if(flags & QIODevice::WriteOnly)
if (flags & QIODevice::WriteOnly)
return false;
d->uncompress();
if (d->resource.compressionAlgorithm() != QResource::NoCompression) {
d->uncompress();
if (d->uncompressed.isNull()) {
d->errorString = QSystemError::stdString(EIO);
return false;
}
}
if (!d->resource.isValid()) {
d->errorString = QSystemError::stdString(ENOENT);
return false;
@ -1395,7 +1413,7 @@ qint64 QResourceFileEngine::read(char *data, qint64 len)
len = size()-d->offset;
if(len <= 0)
return 0;
if(d->resource.isCompressed())
if (!d->uncompressed.isNull())
memcpy(data, d->uncompressed.constData()+d->offset, len);
else
memcpy(data, d->resource.data()+d->offset, len);
@ -1431,9 +1449,9 @@ bool QResourceFileEngine::link(const QString &)
qint64 QResourceFileEngine::size() const
{
Q_D(const QResourceFileEngine);
if(!d->resource.isValid())
if (!d->resource.isValid())
return 0;
if (d->resource.isCompressed()) {
if (d->resource.compressionAlgorithm() != QResource::NoCompression) {
d->uncompress();
return d->uncompressed.size();
}
@ -1596,7 +1614,7 @@ uchar *QResourceFileEnginePrivate::map(qint64 offset, qint64 size, QFile::Memory
Q_UNUSED(flags);
qint64 max = resource.size();
if (resource.isCompressed()) {
if (resource.compressionAlgorithm() != QResource::NoCompression) {
uncompress();
max = uncompressed.size();
}
@ -1609,7 +1627,7 @@ uchar *QResourceFileEnginePrivate::map(qint64 offset, qint64 size, QFile::Memory
}
const uchar *address = resource.data();
if (resource.isCompressed())
if (resource.compressionAlgorithm() != QResource::NoCompression)
address = reinterpret_cast<const uchar *>(uncompressed.constData());
return const_cast<uchar *>(address) + offset;

View File

@ -72,7 +72,6 @@ public:
bool isValid() const;
bool isCompressed() const;
Compression compressionAlgorithm() const;
qint64 size() const;
const uchar *data() const;
@ -84,6 +83,10 @@ public:
QT_DEPRECATED_X("Use QDir::searchPaths() instead")
static QStringList searchPaths();
#endif
#if QT_DEPRECATED_SINCE(5, 15)
QT_DEPRECATED_VERSION_X_5_15("Use QResource::compressionAlgorithm() instead")
bool isCompressed() const;
#endif
static bool registerResource(const QString &rccFilename, const QString &resourceRoot=QString());
static bool unregisterResource(const QString &rccFilename, const QString &resourceRoot=QString());

View File

@ -150,8 +150,7 @@ QSaveFile::~QSaveFile()
QFileDevice::close();
if (d->fileEngine) {
d->fileEngine->remove();
delete d->fileEngine;
d->fileEngine = nullptr;
d->fileEngine.reset();
}
}
@ -197,6 +196,7 @@ bool QSaveFile::open(OpenMode mode)
return false;
}
unsetError();
d->writeError = QFileDevice::NoError;
if ((mode & (ReadOnly | WriteOnly)) == 0) {
qWarning("QSaveFile::open: Open mode not specified");
return false;
@ -234,7 +234,7 @@ bool QSaveFile::open(OpenMode mode)
}
auto openDirectly = [&]() {
d->fileEngine = QAbstractFileEngine::create(d->finalFileName);
d->fileEngine.reset(QAbstractFileEngine::create(d->finalFileName));
if (d->fileEngine->open(mode | QIODevice::Unbuffered)) {
d->useTemporaryFile = false;
QFileDevice::open(mode);
@ -251,8 +251,7 @@ bool QSaveFile::open(OpenMode mode)
if (openDirectly())
return true;
d->setError(d->fileEngine->error(), d->fileEngine->errorString());
delete d->fileEngine;
d->fileEngine = nullptr;
d->fileEngine.reset();
} else {
QString msg =
QSaveFile::tr("QSaveFile cannot open '%1' without direct write fallback "
@ -264,18 +263,17 @@ bool QSaveFile::open(OpenMode mode)
}
#endif
d->fileEngine = new QTemporaryFileEngine(&d->finalFileName, QTemporaryFileEngine::Win32NonShared);
d->fileEngine.reset(new QTemporaryFileEngine(&d->finalFileName, QTemporaryFileEngine::Win32NonShared));
// if the target file exists, we'll copy its permissions below,
// but until then, let's ensure the temporary file is not accessible
// to a third party
int perm = (existingFile.exists() ? 0600 : 0666);
static_cast<QTemporaryFileEngine *>(d->fileEngine)->initialize(d->finalFileName, perm);
static_cast<QTemporaryFileEngine *>(d->fileEngine.get())->initialize(d->finalFileName, perm);
// Same as in QFile: QIODevice provides the buffering, so there's no need to request it from the file engine.
if (!d->fileEngine->open(mode | QIODevice::Unbuffered)) {
QFileDevice::FileError err = d->fileEngine->error();
#ifdef Q_OS_UNIX
if (d->directWriteFallback && err == QFileDevice::OpenError && errno == EACCES) {
delete d->fileEngine;
if (openDirectly())
return true;
err = d->fileEngine->error();
@ -284,8 +282,7 @@ bool QSaveFile::open(OpenMode mode)
if (err == QFileDevice::UnspecifiedError)
err = QFileDevice::OpenError;
d->setError(err, d->fileEngine->errorString());
delete d->fileEngine;
d->fileEngine = nullptr;
d->fileEngine.reset();
return false;
}
@ -331,30 +328,26 @@ bool QSaveFile::commit()
}
QFileDevice::close(); // calls flush()
const auto fe = std::move(d->fileEngine);
// Sync to disk if possible. Ignore errors (e.g. not supported).
d->fileEngine->syncToDisk();
fe->syncToDisk();
if (d->useTemporaryFile) {
if (d->writeError != QFileDevice::NoError) {
d->fileEngine->remove();
fe->remove();
d->writeError = QFileDevice::NoError;
delete d->fileEngine;
d->fileEngine = nullptr;
return false;
}
// atomically replace old file with new file
// Can't use QFile::rename for that, must use the file engine directly
Q_ASSERT(d->fileEngine);
if (!d->fileEngine->renameOverwrite(d->finalFileName)) {
d->setError(d->fileEngine->error(), d->fileEngine->errorString());
d->fileEngine->remove();
delete d->fileEngine;
d->fileEngine = nullptr;
Q_ASSERT(fe);
if (!fe->renameOverwrite(d->finalFileName)) {
d->setError(fe->error(), fe->errorString());
fe->remove();
return false;
}
}
delete d->fileEngine;
d->fileEngine = nullptr;
return true;
}

View File

@ -297,7 +297,7 @@ QT_BEGIN_NAMESPACE
\li "<APPROOT>/tmp"
\row \li HomeLocation
\li "<APPROOT>/files"
\li "<APPROOT>" (not writable)
\li system defined
\row \li DataLocation
\li "<APPROOT>/files", "<USER>/<APPNAME>/files"
\li "<APPROOT>/Library/Application Support"

View File

@ -71,6 +71,28 @@ static void appendOrganizationAndApp(QString &path)
#endif
}
#if QT_CONFIG(regularexpression)
static QLatin1String xdg_key_name(QStandardPaths::StandardLocation type)
{
switch (type) {
case QStandardPaths::DesktopLocation:
return QLatin1String("DESKTOP");
case QStandardPaths::DocumentsLocation:
return QLatin1String("DOCUMENTS");
case QStandardPaths::PicturesLocation:
return QLatin1String("PICTURES");
case QStandardPaths::MusicLocation:
return QLatin1String("MUSIC");
case QStandardPaths::MoviesLocation:
return QLatin1String("VIDEOS");
case QStandardPaths::DownloadLocation:
return QLatin1String("DOWNLOAD");
default:
return QLatin1String();
}
}
#endif
QString QStandardPaths::writableLocation(StandardLocation type)
{
switch (type) {
@ -182,61 +204,32 @@ QString QStandardPaths::writableLocation(StandardLocation type)
if (xdgConfigHome.isEmpty())
xdgConfigHome = QDir::homePath() + QLatin1String("/.config");
QFile file(xdgConfigHome + QLatin1String("/user-dirs.dirs"));
if (!isTestModeEnabled() && file.open(QIODevice::ReadOnly)) {
QHash<QString, QString> lines;
const QLatin1String key = xdg_key_name(type);
if (!key.isEmpty() && !isTestModeEnabled() && file.open(QIODevice::ReadOnly)) {
QTextStream stream(&file);
// Only look for lines like: XDG_DESKTOP_DIR="$HOME/Desktop"
QRegularExpression exp(QLatin1String("^XDG_(.*)_DIR=(.*)$"));
QString result;
while (!stream.atEnd()) {
const QString &line = stream.readLine();
QRegularExpressionMatch match = exp.match(line);
if (match.hasMatch()) {
const QStringList lst = match.capturedTexts();
const QString key = lst.at(1);
QString value = lst.at(2);
if (match.hasMatch() && match.capturedView(1) == key) {
QStringView value = match.capturedView(2);
if (value.length() > 2
&& value.startsWith(QLatin1Char('\"'))
&& value.endsWith(QLatin1Char('\"')))
value = value.mid(1, value.length() - 2);
// Store the key and value: "DESKTOP", "$HOME/Desktop"
lines[key] = value;
}
}
QString key;
switch (type) {
case DesktopLocation:
key = QLatin1String("DESKTOP");
break;
case DocumentsLocation:
key = QLatin1String("DOCUMENTS");
break;
case PicturesLocation:
key = QLatin1String("PICTURES");
break;
case MusicLocation:
key = QLatin1String("MUSIC");
break;
case MoviesLocation:
key = QLatin1String("VIDEOS");
break;
case DownloadLocation:
key = QLatin1String("DOWNLOAD");
break;
default:
break;
}
if (!key.isEmpty()) {
QString value = lines.value(key);
if (!value.isEmpty()) {
// value can start with $HOME
if (value.startsWith(QLatin1String("$HOME")))
value = QDir::homePath() + value.midRef(5);
if (value.length() > 1 && value.endsWith(QLatin1Char('/')))
value.chop(1);
return value;
result = QDir::homePath() + value.mid(5);
else
result = value.toString();
if (result.length() > 1 && result.endsWith(QLatin1Char('/')))
result.chop(1);
}
}
if (!result.isNull())
return result;
}
#endif // QT_CONFIG(regularexpression)

View File

@ -468,8 +468,18 @@ inline bool QStorageIterator::next()
size_t len = strlen(buffer.data());
if (len == 0)
return false;
if (ptr[len - 1] == '\n')
ptr[len - 1] = '\0';
while (Q_UNLIKELY(ptr[len - 1] != '\n' && !feof(fp))) {
// buffer wasn't large enough. Enlarge and try again.
// (we're readidng from the kernel, so OOM is unlikely)
buffer.resize((buffer.size() + 4096) & ~4095);
ptr = buffer.data();
if (fgets(ptr + len, buffer.size() - len, fp) == nullptr)
return false;
len += strlen(ptr + len);
Q_ASSERT(len < size_t(buffer.size()));
}
ptr[len - 1] = '\0';
// parse the line
bool ok;

View File

@ -544,10 +544,10 @@ QTemporaryFilePrivate::~QTemporaryFilePrivate()
QAbstractFileEngine *QTemporaryFilePrivate::engine() const
{
if (!fileEngine) {
fileEngine = new QTemporaryFileEngine(&templateName);
fileEngine.reset(new QTemporaryFileEngine(&templateName));
resetFileEngine();
}
return fileEngine;
return fileEngine.get();
}
void QTemporaryFilePrivate::resetFileEngine() const
@ -555,7 +555,7 @@ void QTemporaryFilePrivate::resetFileEngine() const
if (!fileEngine)
return;
QTemporaryFileEngine *tef = static_cast<QTemporaryFileEngine *>(fileEngine);
QTemporaryFileEngine *tef = static_cast<QTemporaryFileEngine *>(fileEngine.get());
if (fileName.isEmpty())
tef->initialize(templateName, 0600);
else
@ -568,7 +568,7 @@ void QTemporaryFilePrivate::materializeUnnamedFile()
if (!fileName.isEmpty() || !fileEngine)
return;
auto *tef = static_cast<QTemporaryFileEngine *>(fileEngine);
auto *tef = static_cast<QTemporaryFileEngine *>(fileEngine.get());
fileName = tef->fileName(QAbstractFileEngine::DefaultName);
#endif
}
@ -792,7 +792,7 @@ void QTemporaryFile::setAutoRemove(bool b)
QString QTemporaryFile::fileName() const
{
Q_D(const QTemporaryFile);
auto tef = static_cast<QTemporaryFileEngine *>(d->fileEngine);
auto tef = static_cast<QTemporaryFileEngine *>(d->fileEngine.get());
if (tef && tef->isReallyOpen())
const_cast<QTemporaryFilePrivate *>(d)->materializeUnnamedFile();
@ -841,7 +841,7 @@ void QTemporaryFile::setFileTemplate(const QString &name)
bool QTemporaryFile::rename(const QString &newName)
{
Q_D(QTemporaryFile);
auto tef = static_cast<QTemporaryFileEngine *>(d->fileEngine);
auto tef = static_cast<QTemporaryFileEngine *>(d->fileEngine.get());
if (!tef || !tef->isReallyOpen() || !tef->filePathWasTemplate)
return QFile::rename(newName);
@ -947,7 +947,7 @@ QTemporaryFile *QTemporaryFile::createNativeFile(QFile &file)
bool QTemporaryFile::open(OpenMode flags)
{
Q_D(QTemporaryFile);
auto tef = static_cast<QTemporaryFileEngine *>(d->fileEngine);
auto tef = static_cast<QTemporaryFileEngine *>(d->fileEngine.get());
if (tef && tef->isReallyOpen()) {
setOpenMode(flags);
return true;
@ -961,7 +961,7 @@ bool QTemporaryFile::open(OpenMode flags)
d->resetFileEngine();
if (QFile::open(flags)) {
tef = static_cast<QTemporaryFileEngine *>(d->fileEngine);
tef = static_cast<QTemporaryFileEngine *>(d->fileEngine.get());
if (tef->isUnnamedFile())
d->fileName.clear();
else

View File

@ -59,9 +59,9 @@ enum TLDMatchType {
static bool containsTLDEntry(QStringView entry, TLDMatchType match)
{
const QStringView matchSymbols[] = {
QStringViewLiteral(""),
QStringViewLiteral("*"),
QStringViewLiteral("!"),
u"",
u"*",
u"!",
};
const auto symbol = matchSymbols[match];
int index = qt_hash(entry, qt_hash(symbol)) % tldCount;

View File

@ -1010,7 +1010,7 @@ inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetErro
for (int i = needsLowercasing; i >= 0; --i) {
ushort c = schemeData[i].unicode();
if (c >= 'A' && c <= 'Z')
schemeData[i] = c + 0x20;
schemeData[i] = QChar(c + 0x20);
}
}

View File

@ -2220,9 +2220,8 @@ Q_AUTOTEST_EXPORT void qt_punycodeEncoder(const QChar *s, int ucLength, QString
bool skipped = false;
// copy all basic code points verbatim to output.
for (uint j = 0; j < (uint) ucLength; ++j) {
ushort js = s[j].unicode();
if (js < 0x80)
*d++ = js;
if (s[j].unicode() < 0x80)
*d++ = s[j];
else
skipped = true;
}

View File

@ -146,7 +146,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
\fn QUrlQuery(std::initializer_list<QPair<QString, QString>> list)
\fn QUrlQuery::QUrlQuery(std::initializer_list<QPair<QString, QString>> list)
\since 5.13
@ -293,9 +293,9 @@ void QUrlQueryPrivate::setQuery(const QString &query)
const QChar *delimiter = nullptr;
while (pos != end) {
// scan for the component parts of this pair
if (!delimiter && pos->unicode() == valueDelimiter)
if (!delimiter && *pos == valueDelimiter)
delimiter = pos;
if (pos->unicode() == pairDelimiter)
if (*pos == pairDelimiter)
break;
++pos;
}
@ -584,8 +584,8 @@ QString QUrlQuery::query(QUrl::ComponentFormattingOptions encoding) const
*/
void QUrlQuery::setQueryDelimiters(QChar valueDelimiter, QChar pairDelimiter)
{
d->valueDelimiter = valueDelimiter.unicode();
d->pairDelimiter = pairDelimiter.unicode();
d->valueDelimiter = valueDelimiter;
d->pairDelimiter = pairDelimiter;
}
/*!

View File

@ -532,21 +532,16 @@ void QAbstractItemModelPrivate::invalidatePersistentIndex(const QModelIndex &ind
}
}
namespace {
struct DefaultRoleNames : public QHash<int, QByteArray>
using DefaultRoleNames = QHash<int, QByteArray>;
Q_GLOBAL_STATIC_WITH_ARGS(DefaultRoleNames, qDefaultRoleNames, (
{
DefaultRoleNames() {
(*this)[Qt::DisplayRole] = "display";
(*this)[Qt::DecorationRole] = "decoration";
(*this)[Qt::EditRole] = "edit";
(*this)[Qt::ToolTipRole] = "toolTip";
(*this)[Qt::StatusTipRole] = "statusTip";
(*this)[Qt::WhatsThisRole] = "whatsThis";
}
};
}
Q_GLOBAL_STATIC(DefaultRoleNames, qDefaultRoleNames)
{ Qt::DisplayRole, "display" },
{ Qt::DecorationRole, "decoration" },
{ Qt::EditRole, "edit" },
{ Qt::ToolTipRole, "toolTip" },
{ Qt::StatusTipRole, "statusTip" },
{ Qt::WhatsThisRole, "whatsThis" },
}))
const QHash<int,QByteArray> &QAbstractItemModelPrivate::defaultRoleNames()
{

View File

@ -64,11 +64,7 @@ struct QSortFilterProxyModelDataChanged
static inline QSet<int> qVectorToSet(const QVector<int> &vector)
{
QSet<int> set;
set.reserve(vector.size());
for(int i=0; i < vector.size(); ++i)
set << vector.at(i);
return set;
return {vector.begin(), vector.end()};
}
class QSortFilterProxyModelLessThan
@ -130,7 +126,7 @@ struct QRowsRemoval
{
}
bool contains(QModelIndex parent, int row)
bool contains(QModelIndex parent, int row) const
{
do {
if (parent == parent_source)
@ -470,8 +466,8 @@ bool QSortFilterProxyModelPrivate::filterRecursiveAcceptsRow(int source_row, con
void QSortFilterProxyModelPrivate::remove_from_mapping(const QModelIndex &source_parent)
{
if (Mapping *m = source_index_mapping.take(source_parent)) {
for (int i = 0; i < m->mapped_children.size(); ++i)
remove_from_mapping(m->mapped_children.at(i));
for (const QModelIndex &mappedIdx : qAsConst(m->mapped_children))
remove_from_mapping(mappedIdx);
delete m;
}
}
@ -607,9 +603,9 @@ void QSortFilterProxyModelPrivate::sort()
Q_Q(QSortFilterProxyModel);
emit q->layoutAboutToBeChanged(QList<QPersistentModelIndex>(), QAbstractItemModel::VerticalSortHint);
QModelIndexPairList source_indexes = store_persistent_indexes();
IndexMap::const_iterator it = source_index_mapping.constBegin();
for (; it != source_index_mapping.constEnd(); ++it) {
QModelIndex source_parent = it.key();
const auto end = source_index_mapping.constEnd();
for (auto it = source_index_mapping.constBegin(); it != end; ++it) {
const QModelIndex &source_parent = it.key();
Mapping *m = it.value();
sort_source_rows(m->source_rows, source_parent);
build_source_to_proxy_mapping(m->source_rows, m->proxy_rows);
@ -735,13 +731,14 @@ void QSortFilterProxyModelPrivate::remove_source_items(
if (!proxy_parent.isValid() && source_parent.isValid())
return; // nothing to do (already removed)
QVector<QPair<int, int> > proxy_intervals;
proxy_intervals = proxy_intervals_for_source_items(source_to_proxy, source_items);
const auto proxy_intervals = proxy_intervals_for_source_items(
source_to_proxy, source_items);
for (int i = proxy_intervals.size()-1; i >= 0; --i) {
QPair<int, int> interval = proxy_intervals.at(i);
int proxy_start = interval.first;
int proxy_end = interval.second;
const auto end = proxy_intervals.rend();
for (auto it = proxy_intervals.rbegin(); it != end; ++it) {
const QPair<int, int> &interval = *it;
const int proxy_start = interval.first;
const int proxy_end = interval.second;
remove_proxy_interval(source_to_proxy, proxy_to_source, proxy_start, proxy_end,
proxy_parent, orient, emit_signal);
}
@ -875,15 +872,15 @@ void QSortFilterProxyModelPrivate::insert_source_items(
if (!proxy_parent.isValid() && source_parent.isValid())
return; // nothing to do (source_parent is not mapped)
QVector<QPair<int, QVector<int> > > proxy_intervals;
proxy_intervals = proxy_intervals_for_source_items_to_add(
const auto proxy_intervals = proxy_intervals_for_source_items_to_add(
proxy_to_source, source_items, source_parent, orient);
for (int i = proxy_intervals.size()-1; i >= 0; --i) {
QPair<int, QVector<int> > interval = proxy_intervals.at(i);
int proxy_start = interval.first;
QVector<int> source_items = interval.second;
int proxy_end = proxy_start + source_items.size() - 1;
const auto end = proxy_intervals.rend();
for (auto it = proxy_intervals.rbegin(); it != end; ++it) {
const QPair<int, QVector<int> > &interval = *it;
const int proxy_start = interval.first;
const QVector<int> &source_items = interval.second;
const int proxy_end = proxy_start + source_items.size() - 1;
if (emit_signal) {
if (orient == Qt::Vertical)
@ -1195,8 +1192,8 @@ QModelIndexPairList QSortFilterProxyModelPrivate::store_persistent_indexes() con
Q_Q(const QSortFilterProxyModel);
QModelIndexPairList source_indexes;
source_indexes.reserve(persistent.indexes.count());
for (QPersistentModelIndexData *data : qAsConst(persistent.indexes)) {
QModelIndex proxy_index = data->index;
for (const QPersistentModelIndexData *data : qAsConst(persistent.indexes)) {
const QModelIndex &proxy_index = data->index;
QModelIndex source_index = q->mapToSource(proxy_index);
source_indexes.append(qMakePair(proxy_index, QPersistentModelIndex(source_index)));
}
@ -1217,9 +1214,9 @@ void QSortFilterProxyModelPrivate::update_persistent_indexes(
const int numSourceIndexes = source_indexes.count();
from.reserve(numSourceIndexes);
to.reserve(numSourceIndexes);
for (int i = 0; i < numSourceIndexes; ++i) {
QModelIndex source_index = source_indexes.at(i).second;
QModelIndex old_proxy_index = source_indexes.at(i).first;
for (const auto &indexPair : source_indexes) {
const QPersistentModelIndex &source_index = indexPair.second;
const QModelIndex &old_proxy_index = indexPair.first;
create_mapping(source_index.parent());
QModelIndex proxy_index = q->mapFromSource(source_index);
from << old_proxy_index;
@ -1264,7 +1261,7 @@ void QSortFilterProxyModelPrivate::filter_changed(const QModelIndex &source_pare
const QVector<QModelIndex> mappedChildren = m->mapped_children;
QVector<int> indexesToRemove;
for (int i = 0; i < mappedChildren.size(); ++i) {
const QModelIndex source_child_index = mappedChildren.at(i);
const QModelIndex &source_child_index = mappedChildren.at(i);
if (rows_removed.contains(source_child_index.row()) || columns_removed.contains(source_child_index.column())) {
indexesToRemove.push_back(i);
remove_from_mapping(source_child_index);
@ -2296,10 +2293,9 @@ QMimeData *QSortFilterProxyModel::mimeData(const QModelIndexList &indexes) const
{
Q_D(const QSortFilterProxyModel);
QModelIndexList source_indexes;
const int numIndexes = indexes.count();
source_indexes.reserve(numIndexes);
for (int i = 0; i < numIndexes; ++i)
source_indexes << mapToSource(indexes.at(i));
source_indexes.reserve(indexes.count());
for (const QModelIndex &idx : indexes)
source_indexes << mapToSource(idx);
return d->model->mimeData(source_indexes);
}

View File

@ -514,10 +514,9 @@ Q_CONSTRUCTOR_FUNCTION(qt_apple_check_os_version);
// -------------------------------------------------------------------------
void QMacKeyValueObserver::addObserver()
void QMacKeyValueObserver::addObserver(NSKeyValueObservingOptions options)
{
[object addObserver:observer forKeyPath:keyPath
options:NSKeyValueObservingOptionNew context:callback.get()];
[object addObserver:observer forKeyPath:keyPath options:options context:callback.get()];
}
void QMacKeyValueObserver::removeObserver() {

View File

@ -350,8 +350,12 @@ public:
QMacKeyValueObserver() {}
// Note: QMacKeyValueObserver must not outlive the object observed!
QMacKeyValueObserver(id object, NSString *keyPath, Callback callback)
: object(object), keyPath(keyPath), callback(new Callback(callback)) { addObserver(); }
QMacKeyValueObserver(id object, NSString *keyPath, Callback callback,
NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew)
: object(object), keyPath(keyPath), callback(new Callback(callback))
{
addObserver(options);
}
QMacKeyValueObserver(const QMacKeyValueObserver &other)
: QMacKeyValueObserver(other.object, other.keyPath, *other.callback.get()) {}
@ -381,7 +385,7 @@ private:
std::swap(first.callback, second.callback);
}
void addObserver();
void addObserver(NSKeyValueObservingOptions options);
id object = nil;
NSString *keyPath = nullptr;

View File

@ -57,7 +57,7 @@
#include <qt_windows.h>
namespace std { template <typename T> class function; }
#include <functional>
QT_BEGIN_NAMESPACE

View File

@ -953,7 +953,7 @@ static const QMetaObject *QMetaObject_findMetaObject(const QMetaObject *self, co
return self;
if (self->d.relatedMetaObjects) {
Q_ASSERT(priv(self->d.data)->revision >= 2);
const QMetaObject * const *e = self->d.relatedMetaObjects;
const auto *e = self->d.relatedMetaObjects;
if (e) {
while (*e) {
if (const QMetaObject *m =QMetaObject_findMetaObject((*e), name))

View File

@ -747,7 +747,7 @@ void QMetaObjectBuilder::addMetaObject
if ((members & RelatedMetaObjects) != 0) {
Q_ASSERT(priv(prototype->d.data)->revision >= 2);
const QMetaObject * const *objects = prototype->d.relatedMetaObjects;
const auto *objects = prototype->d.relatedMetaObjects;
if (objects) {
while (*objects != 0) {
addRelatedMetaObject(*objects);
@ -1464,16 +1464,16 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
// Create the relatedMetaObjects block if we need one.
if (d->relatedMetaObjects.size() > 0) {
ALIGN(size, QMetaObject *);
const QMetaObject **objects =
reinterpret_cast<const QMetaObject **>(buf + size);
using SuperData = QMetaObject::SuperData;
ALIGN(size, SuperData);
auto objects = reinterpret_cast<SuperData *>(buf + size);
if (buf) {
meta->d.relatedMetaObjects = objects;
for (index = 0; index < d->relatedMetaObjects.size(); ++index)
objects[index] = d->relatedMetaObjects[index];
objects[index] = 0;
objects[index] = nullptr;
}
size += sizeof(QMetaObject *) * (d->relatedMetaObjects.size() + 1);
size += sizeof(SuperData) * (d->relatedMetaObjects.size() + 1);
}
// Align the final size and return it.

View File

@ -216,7 +216,7 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId();
F(QQueue) \
F(QStack) \
F(QSet) \
F(QLinkedList)
/*end*/
#define QT_FOR_EACH_AUTOMATIC_TEMPLATE_2ARG(F) \
F(QHash, class) \

View File

@ -93,12 +93,6 @@ QAbstractDynamicMetaObject::~QAbstractDynamicMetaObject()
{
}
struct QSlotObjectBaseDeleter { // for use with QScopedPointer<QSlotObjectBase,...>
static void cleanup(QtPrivate::QSlotObjectBase *slot) {
if (slot) slot->destroyIfLastRef();
}
};
static int *queuedConnectionTypes(const QList<QByteArray> &typeNames)
{
int *types = new int [typeNames.count() + 1];
@ -3380,7 +3374,7 @@ QObjectPrivate::Connection *QMetaObjectPrivate::connect(const QObject *sender,
type &= Qt::UniqueConnection - 1;
}
QScopedPointer<QObjectPrivate::Connection> c(new QObjectPrivate::Connection);
std::unique_ptr<QObjectPrivate::Connection> c{new QObjectPrivate::Connection};
c->sender = s;
c->signal_index = signal_index;
c->receiver.storeRelaxed(r);
@ -3394,14 +3388,14 @@ QObjectPrivate::Connection *QMetaObjectPrivate::connect(const QObject *sender,
c->argumentTypes.storeRelaxed(types);
c->callFunction = callFunction;
QObjectPrivate::get(s)->addConnection(signal_index, c.data());
QObjectPrivate::get(s)->addConnection(signal_index, c.get());
locker.unlock();
QMetaMethod smethod = QMetaObjectPrivate::signal(smeta, signal_index);
if (smethod.isValid())
s->connectNotify(smethod);
return c.take();
return c.release();
}
/*!
@ -3791,10 +3785,16 @@ void doActivate(QObject *sender, int signal_index, void **argv)
if (c->isSlotObject) {
c->slotObj->ref();
QScopedPointer<QtPrivate::QSlotObjectBase, QSlotObjectBaseDeleter> obj(c->slotObj);
struct Deleter {
void operator()(QtPrivate::QSlotObjectBase *slot) const {
if (slot) slot->destroyIfLastRef();
}
};
const std::unique_ptr<QtPrivate::QSlotObjectBase, Deleter> obj{c->slotObj};
{
Q_TRACE_SCOPE(QMetaObject_activate_slot_functor, obj.data());
Q_TRACE_SCOPE(QMetaObject_activate_slot_functor, obj.get());
obj->call(receiver, argv);
}
} else if (c->callFunction && c->method_offset <= receiver->metaObject()->methodOffset()) {
@ -4947,7 +4947,7 @@ QMetaObject::Connection QObjectPrivate::connectImpl(const QObject *sender, int s
type = static_cast<Qt::ConnectionType>(type ^ Qt::UniqueConnection);
}
QScopedPointer<QObjectPrivate::Connection> c(new QObjectPrivate::Connection);
std::unique_ptr<QObjectPrivate::Connection> c{new QObjectPrivate::Connection};
c->sender = s;
c->signal_index = signal_index;
QThreadData *td = r->d_func()->threadData;
@ -4962,8 +4962,8 @@ QMetaObject::Connection QObjectPrivate::connectImpl(const QObject *sender, int s
c->ownArgumentTypes = false;
}
QObjectPrivate::get(s)->addConnection(signal_index, c.data());
QMetaObject::Connection ret(c.take());
QObjectPrivate::get(s)->addConnection(signal_index, c.get());
QMetaObject::Connection ret(c.release());
locker.unlock();
QMetaMethod method = QMetaObjectPrivate::signal(senderMetaObject, signal_index);

View File

@ -486,8 +486,11 @@ class Q_CORE_EXPORT QAbstractMetaCallEvent : public QEvent
{
public:
QAbstractMetaCallEvent(const QObject *sender, int signalId, QSemaphore *semaphore = nullptr)
: QEvent(MetaCall), signalId_(signalId), sender_(sender), semaphore_(semaphore)
{}
: QEvent(MetaCall), signalId_(signalId), sender_(sender)
#if QT_CONFIG(thread)
, semaphore_(semaphore)
#endif
{ Q_UNUSED(semaphore); }
~QAbstractMetaCallEvent();
virtual void placeMetaCall(QObject *object) = 0;
@ -498,7 +501,9 @@ public:
private:
int signalId_;
const QObject *sender_;
#if QT_CONFIG(thread)
QSemaphore *semaphore_;
#endif
};
class Q_CORE_EXPORT QMetaCallEvent : public QAbstractMetaCallEvent

View File

@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2019 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@ -572,13 +572,42 @@ struct Q_CORE_EXPORT QMetaObject
int static_metacall(Call, int, void **) const;
static int metacall(QObject *, Call, int, void **);
template <const QMetaObject &MO> static constexpr const QMetaObject *staticMetaObject()
{
return &MO;
}
struct SuperData {
const QMetaObject *direct;
SuperData() = default;
constexpr SuperData(std::nullptr_t) : direct(nullptr) {}
constexpr SuperData(const QMetaObject *mo) : direct(mo) {}
constexpr const QMetaObject *operator->() const { return operator const QMetaObject *(); }
#ifdef QT_NO_DATA_RELOCATION
using Getter = const QMetaObject *(*)();
Getter indirect = nullptr;
constexpr SuperData(Getter g) : direct(nullptr), indirect(g) {}
constexpr operator const QMetaObject *() const
{ return indirect ? indirect() : direct; }
template <const QMetaObject &MO> static constexpr SuperData link()
{ return SuperData(QMetaObject::staticMetaObject<MO>); }
#else
constexpr operator const QMetaObject *() const
{ return direct; }
template <const QMetaObject &MO> static constexpr SuperData link()
{ return SuperData(QMetaObject::staticMetaObject<MO>()); }
#endif
};
struct { // private data
const QMetaObject *superdata;
SuperData superdata;
const QByteArrayData *stringdata;
const uint *data;
typedef void (*StaticMetacallFunction)(QObject *, QMetaObject::Call, int, void **);
StaticMetacallFunction static_metacall;
const QMetaObject * const *relatedMetaObjects;
const SuperData *relatedMetaObjects;
void *extradata; //reserved for future use
} d;

View File

@ -38,7 +38,6 @@
****************************************************************************/
#include "qglobal.h"
#if QT_DEPRECATED_SINCE(5, 10)
#include "qsignalmapper.h"
#include "qhash.h"
@ -64,7 +63,6 @@ public:
/*!
\class QSignalMapper
\inmodule QtCore
\obsolete The recommended solution is connecting the signal to a lambda.
\brief The QSignalMapper class bundles signals from identifiable senders.
\ingroup objectmodel
@ -72,7 +70,9 @@ public:
This class collects a set of parameterless signals, and re-emits
them with integer, string or widget parameters corresponding to
the object that sent the signal.
the object that sent the signal. Note that in most cases you can
use lambdas for passing custom parameters to slots. This is less
costly and will simplify the code.
The class supports the mapping of particular strings or integers
with particular objects using setMapping(). The objects' signals
@ -314,5 +314,3 @@ void QSignalMapper::map(QObject *sender)
QT_END_NAMESPACE
#include "moc_qsignalmapper.cpp"
#endif

View File

@ -42,8 +42,6 @@
#include <QtCore/qobject.h>
#if QT_DEPRECATED_SINCE(5, 10)
QT_BEGIN_NAMESPACE
class QSignalMapperPrivate;
@ -53,7 +51,7 @@ class Q_CORE_EXPORT QSignalMapper : public QObject
Q_OBJECT
Q_DECLARE_PRIVATE(QSignalMapper)
public:
QT_DEPRECATED explicit QSignalMapper(QObject *parent = nullptr);
explicit QSignalMapper(QObject *parent = nullptr);
~QSignalMapper();
void setMapping(QObject *sender, int id);
@ -84,6 +82,4 @@ private:
QT_END_NAMESPACE
#endif
#endif // QSIGNALMAPPER_H

View File

@ -528,7 +528,8 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo
// memory, so no need to use QFile to copy it again.
Q_ASSERT(!d->resource);
d->resource = new QResource(realname);
if (resource->isValid() && !resource->isCompressed() && resource->size() >= MagicLength
if (resource->isValid() && resource->compressionAlgorithm() == QResource::NoCompression
&& resource->size() >= MagicLength
&& !memcmp(resource->data(), magic, MagicLength)) {
d->unmapLength = resource->size();
d->unmapPointer = reinterpret_cast<char *>(const_cast<uchar *>(resource->data()));

View File

@ -362,7 +362,7 @@ class Q_CORE_EXPORT QVariant
static inline QVariant fromValue(const T &value)
{ return QVariant(qMetaTypeId<T>(), &value, QTypeInfo<T>::isPointer); }
#if QT_HAS_INCLUDE(<variant>) && __cplusplus >= 201703L
#if (QT_HAS_INCLUDE(<variant>) && __cplusplus >= 201703L) || defined(Q_CLANG_QDOC)
template<typename... Types>
static inline QVariant fromStdVariant(const std::variant<Types...> &value)
{

View File

@ -92,7 +92,7 @@ QT_BEGIN_NAMESPACE
but if other instances of QPluginLoader are using the same
library, the call will fail, and unloading will only happen when
every instance has called unload(). Right before the unloading
happen, the root component will also be deleted.
happens, the root component will also be deleted.
See \l{How to Create Qt Plugins} for more information about
how to make your application extensible through plugins.

Some files were not shown because too many files have changed in this diff Show More