Merge "Merge remote-tracking branch 'origin/5.14' into dev"

This commit is contained in:
Qt Forward Merge Bot 2019-09-03 01:01:24 +02:00
commit bf8fcab8bb
13 changed files with 204 additions and 106 deletions

View File

@ -228,6 +228,7 @@ sub classNames {
$line .= ";" if($line =~ m/^Q_[A-Z_0-9]*\(.*\)[\r\n]*$/); #qt macro $line .= ";" if($line =~ m/^Q_[A-Z_0-9]*\(.*\)[\r\n]*$/); #qt macro
$line .= ";" if($line =~ m/^QT_(BEGIN|END)_HEADER[\r\n]*$/); #qt macro $line .= ";" if($line =~ m/^QT_(BEGIN|END)_HEADER[\r\n]*$/); #qt macro
$line .= ";" if($line =~ m/^QT_(BEGIN|END)_NAMESPACE(_[A-Z]+)*[\r\n]*$/); #qt macro $line .= ";" if($line =~ m/^QT_(BEGIN|END)_NAMESPACE(_[A-Z]+)*[\r\n]*$/); #qt macro
$line .= ";" if($line =~ m/^QT_DEPRECATED_X\(.*\)[\r\n]*$/); #qt macro
$line .= ";" if($line =~ m/^QT_MODULE\(.*\)[\r\n]*$/); # QT_MODULE macro $line .= ";" if($line =~ m/^QT_MODULE\(.*\)[\r\n]*$/); # QT_MODULE macro
$line .= ";" if($line =~ m/^QT_WARNING_(PUSH|POP|DISABLE_\w+\(.*\))[\r\n]*$/); # qt macros $line .= ";" if($line =~ m/^QT_WARNING_(PUSH|POP|DISABLE_\w+\(.*\))[\r\n]*$/); # qt macros
$$requires = $1 if ($line =~ m/^QT_REQUIRE_CONFIG\((.*)\);[\r\n]*$/); $$requires = $1 if ($line =~ m/^QT_REQUIRE_CONFIG\((.*)\);[\r\n]*$/);

View File

@ -79,7 +79,7 @@ int main(int argc, char *argv[])
if (parser.isSet(dontUseCustomDirectoryIconsOption)) if (parser.isSet(dontUseCustomDirectoryIconsOption))
model.setOption(QFileSystemModel::DontUseCustomDirectoryIcons); model.setOption(QFileSystemModel::DontUseCustomDirectoryIcons);
if (parser.isSet(dontWatchOption)) if (parser.isSet(dontWatchOption))
model.setOption(QFileSystemModel::DontWatch); model.setOption(QFileSystemModel::DontWatchForChanges);
QTreeView tree; QTreeView tree;
tree.setModel(&model); tree.setModel(&model);
if (!rootPath.isEmpty()) { if (!rootPath.isEmpty()) {

View File

@ -4,17 +4,22 @@ APK_PATH = $$shell_path($$OUT_PWD/android-build/$${TARGET}.apk)
apk_install_target.depends = first apk_install_target.depends = first
apk_install_target.commands = $(MAKE) -f $(MAKEFILE) INSTALL_ROOT=$$OUT_PWD/android-build install apk_install_target.commands = $(MAKE) -f $(MAKEFILE) INSTALL_ROOT=$$OUT_PWD/android-build install
apk.target = apk
apk.depends = apk_install_target
qtPrepareTool(ANDROIDDEPLOYQT, androiddeployqt) qtPrepareTool(ANDROIDDEPLOYQT, androiddeployqt)
isEmpty(ANDROID_DEPLOYMENT_SETTINGS_FILE): ANDROID_DEPLOYMENT_SETTINGS_FILE = $$OUT_PWD/android-$$TARGET-deployment-settings.json isEmpty(ANDROID_DEPLOYMENT_SETTINGS_FILE): ANDROID_DEPLOYMENT_SETTINGS_FILE = $$OUT_PWD/android-$$TARGET-deployment-settings.json
contains(QMAKE_HOST.os, Windows): extension = .exe contains(QMAKE_HOST.os, Windows): extension = .exe
apk.target = apk
apk.depends = apk_install_target
apk.commands = $$ANDROIDDEPLOYQT --input $$ANDROID_DEPLOYMENT_SETTINGS_FILE --output $$OUT_PWD/android-build --apk $$APK_PATH apk.commands = $$ANDROIDDEPLOYQT --input $$ANDROID_DEPLOYMENT_SETTINGS_FILE --output $$OUT_PWD/android-build --apk $$APK_PATH
aab.target = aab
aab.depends = apk_install_target
aab.commands = $$ANDROIDDEPLOYQT --input $$ANDROID_DEPLOYMENT_SETTINGS_FILE --output $$OUT_PWD/android-build --aab --apk $$APK_PATH
} else { } else {
prepareRecursiveTarget(aab)
prepareRecursiveTarget(apk) prepareRecursiveTarget(apk)
prepareRecursiveTarget(apk_install_target) prepareRecursiveTarget(apk_install_target)
} }
QMAKE_EXTRA_TARGETS *= apk apk_install_target
build_pass { build_pass {
contains(TEMPLATE, ".*app") { contains(TEMPLATE, ".*app") {
@ -34,4 +39,11 @@ build_pass {
target.path = /libs/$$ANDROID_TARGET_ARCH/ target.path = /libs/$$ANDROID_TARGET_ARCH/
INSTALLS *= target INSTALLS *= target
} }
} else {
QMAKE_EXTRA_TARGETS *= aab apk apk_install_target
android-build-distclean.commands = \
$$QMAKE_DEL_TREE $$shell_quote($$shell_path($$OUT_PWD/android-build))
QMAKE_EXTRA_TARGETS *= android-build-distclean
CLEAN_DEPS += android-build-distclean
} }

View File

@ -220,7 +220,8 @@ Q_DECLARE_TYPEINFO(QLatin1String, Q_MOVABLE_TYPE);
// Qt 4.x compatibility // Qt 4.x compatibility
#if QT_DEPRECATED_SINCE(5, 14) #if QT_DEPRECATED_SINCE(5, 14)
QT_DEPRECATED_X("Use QLatin1String") typedef QLatin1String QLatin1Literal; QT_DEPRECATED_X("Use QLatin1String")
typedef QLatin1String QLatin1Literal;
#endif #endif
// //

View File

@ -44,6 +44,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <private/qdebug_p.h> #include <private/qdebug_p.h>
#include <private/qlocking_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -201,15 +202,20 @@ void QTouchDevice::setName(const QString &name)
d->name = name; d->name = name;
} }
typedef QList<const QTouchDevice *> TouchDevices;
Q_GLOBAL_STATIC(TouchDevices, deviceList)
static QBasicMutex devicesMutex; static QBasicMutex devicesMutex;
static void cleanupDevicesList() struct TouchDevices {
TouchDevices();
QList<const QTouchDevice *> list;
};
Q_GLOBAL_STATIC(TouchDevices, deviceList)
TouchDevices::TouchDevices()
{ {
QMutexLocker lock(&devicesMutex); qAddPostRoutine([]{
qDeleteAll(*deviceList()); const auto locker = qt_scoped_lock(devicesMutex);
deviceList()->clear(); qDeleteAll(qExchange(deviceList->list, {}));
});
} }
/*! /*!
@ -223,7 +229,7 @@ static void cleanupDevicesList()
QList<const QTouchDevice *> QTouchDevice::devices() QList<const QTouchDevice *> QTouchDevice::devices()
{ {
QMutexLocker lock(&devicesMutex); QMutexLocker lock(&devicesMutex);
return *deviceList(); return deviceList->list;
} }
/*! /*!
@ -232,13 +238,13 @@ QList<const QTouchDevice *> QTouchDevice::devices()
bool QTouchDevicePrivate::isRegistered(const QTouchDevice *dev) bool QTouchDevicePrivate::isRegistered(const QTouchDevice *dev)
{ {
QMutexLocker locker(&devicesMutex); QMutexLocker locker(&devicesMutex);
return deviceList()->contains(dev); return deviceList->list.contains(dev);
} }
const QTouchDevice *QTouchDevicePrivate::deviceById(quint8 id) const QTouchDevice *QTouchDevicePrivate::deviceById(quint8 id)
{ {
QMutexLocker locker(&devicesMutex); QMutexLocker locker(&devicesMutex);
for (const QTouchDevice *dev : *deviceList()) for (const QTouchDevice *dev : qAsConst(deviceList->list))
if (QTouchDevicePrivate::get(const_cast<QTouchDevice *>(dev))->id == id) if (QTouchDevicePrivate::get(const_cast<QTouchDevice *>(dev))->id == id)
return dev; return dev;
return nullptr; return nullptr;
@ -250,9 +256,7 @@ const QTouchDevice *QTouchDevicePrivate::deviceById(quint8 id)
void QTouchDevicePrivate::registerDevice(const QTouchDevice *dev) void QTouchDevicePrivate::registerDevice(const QTouchDevice *dev)
{ {
QMutexLocker lock(&devicesMutex); QMutexLocker lock(&devicesMutex);
if (deviceList()->isEmpty()) deviceList->list.append(dev);
qAddPostRoutine(cleanupDevicesList);
deviceList()->append(dev);
} }
/*! /*!
@ -261,9 +265,7 @@ void QTouchDevicePrivate::registerDevice(const QTouchDevice *dev)
void QTouchDevicePrivate::unregisterDevice(const QTouchDevice *dev) void QTouchDevicePrivate::unregisterDevice(const QTouchDevice *dev)
{ {
QMutexLocker lock(&devicesMutex); QMutexLocker lock(&devicesMutex);
bool wasRemoved = deviceList()->removeOne(dev); deviceList->list.removeOne(dev);
if (wasRemoved && deviceList()->isEmpty())
qRemovePostRoutine(cleanupDevicesList);
} }
#ifndef QT_NO_DEBUG_STREAM #ifndef QT_NO_DEBUG_STREAM

View File

@ -461,19 +461,19 @@ QColorTransform QColorSpacePrivate::transformationToColorSpace(const QColorSpace
Creates a new colorspace object that represents \a colorSpaceId. Creates a new colorspace object that represents \a colorSpaceId.
*/ */
QColorSpace::QColorSpace(QColorSpace::ColorSpaceId colorSpaceId) QColorSpace::QColorSpace(QColorSpace::ColorSpaceId colorSpaceId)
: d_ptr(nullptr)
{ {
static QExplicitlySharedDataPointer<QColorSpacePrivate> predefinedColorspacePrivates[QColorSpace::Bt2020]; static QColorSpacePrivate *predefinedColorspacePrivates[QColorSpace::Bt2020];
if (colorSpaceId <= QColorSpace::Unknown) { // Unknown and undefined both returns the static undefined colorspace
if (!predefinedColorspacePrivates[0]) if (colorSpaceId > QColorSpace::Unknown) {
predefinedColorspacePrivates[0] = new QColorSpacePrivate(QColorSpace::Undefined); if (!predefinedColorspacePrivates[colorSpaceId - 2]) {
d_ptr = predefinedColorspacePrivates[0]; // unknown and undefined both returns the static undefined colorspace. predefinedColorspacePrivates[colorSpaceId - 2] = new QColorSpacePrivate(colorSpaceId);
} else { predefinedColorspacePrivates[colorSpaceId - 2]->ref.ref();
if (!predefinedColorspacePrivates[colorSpaceId - 1]) }
predefinedColorspacePrivates[colorSpaceId - 1] = new QColorSpacePrivate(colorSpaceId); d_ptr = predefinedColorspacePrivates[colorSpaceId - 2];
d_ptr = predefinedColorspacePrivates[colorSpaceId - 1]; d_ptr->ref.ref();
Q_ASSERT(isValid());
} }
Q_ASSERT(colorSpaceId == QColorSpace::Undefined || isValid());
} }
/*! /*!
@ -483,6 +483,7 @@ QColorSpace::QColorSpace(QColorSpace::ColorSpaceId colorSpaceId)
QColorSpace::QColorSpace(QColorSpace::Primaries primaries, QColorSpace::TransferFunction fun, float gamma) QColorSpace::QColorSpace(QColorSpace::Primaries primaries, QColorSpace::TransferFunction fun, float gamma)
: d_ptr(new QColorSpacePrivate(primaries, fun, gamma)) : d_ptr(new QColorSpacePrivate(primaries, fun, gamma))
{ {
d_ptr->ref.ref();
} }
/*! /*!
@ -492,6 +493,7 @@ QColorSpace::QColorSpace(QColorSpace::Primaries primaries, QColorSpace::Transfer
QColorSpace::QColorSpace(QColorSpace::Primaries primaries, float gamma) QColorSpace::QColorSpace(QColorSpace::Primaries primaries, float gamma)
: d_ptr(new QColorSpacePrivate(primaries, TransferFunction::Gamma, gamma)) : d_ptr(new QColorSpacePrivate(primaries, TransferFunction::Gamma, gamma))
{ {
d_ptr->ref.ref();
} }
/*! /*!
@ -505,35 +507,34 @@ QColorSpace::QColorSpace(const QPointF &whitePoint, const QPointF &redPoint,
QColorSpacePrimaries primaries(whitePoint, redPoint, greenPoint, bluePoint); QColorSpacePrimaries primaries(whitePoint, redPoint, greenPoint, bluePoint);
if (!primaries.areValid()) { if (!primaries.areValid()) {
qWarning() << "QColorSpace attempted constructed from invalid primaries:" << whitePoint << redPoint << greenPoint << bluePoint; qWarning() << "QColorSpace attempted constructed from invalid primaries:" << whitePoint << redPoint << greenPoint << bluePoint;
d_ptr = QColorSpace(QColorSpace::Undefined).d_ptr; d_ptr = nullptr;
return; return;
} }
d_ptr = new QColorSpacePrivate(primaries, fun, gamma); d_ptr = new QColorSpacePrivate(primaries, fun, gamma);
d_ptr->ref.ref();
} }
QColorSpace::~QColorSpace() QColorSpace::~QColorSpace()
{ {
} if (d_ptr && !d_ptr->ref.deref())
delete d_ptr;
QColorSpace::QColorSpace(QColorSpace &&colorSpace) noexcept
: d_ptr(std::move(colorSpace.d_ptr))
{
} }
QColorSpace::QColorSpace(const QColorSpace &colorSpace) QColorSpace::QColorSpace(const QColorSpace &colorSpace)
: d_ptr(colorSpace.d_ptr) : d_ptr(colorSpace.d_ptr)
{ {
} if (d_ptr)
d_ptr->ref.ref();
QColorSpace &QColorSpace::operator=(QColorSpace &&colorSpace) noexcept
{
d_ptr = std::move(colorSpace.d_ptr);
return *this;
} }
QColorSpace &QColorSpace::operator=(const QColorSpace &colorSpace) QColorSpace &QColorSpace::operator=(const QColorSpace &colorSpace)
{ {
QColorSpacePrivate *oldD = d_ptr;
d_ptr = colorSpace.d_ptr; d_ptr = colorSpace.d_ptr;
if (d_ptr)
d_ptr->ref.ref();
if (oldD && !oldD->ref.deref())
delete oldD;
return *this; return *this;
} }
@ -549,6 +550,8 @@ QColorSpace &QColorSpace::operator=(const QColorSpace &colorSpace)
*/ */
QColorSpace::ColorSpaceId QColorSpace::colorSpaceId() const noexcept QColorSpace::ColorSpaceId QColorSpace::colorSpaceId() const noexcept
{ {
if (Q_UNLIKELY(!d_ptr))
return QColorSpace::Undefined;
return d_ptr->id; return d_ptr->id;
} }
@ -571,6 +574,8 @@ QColorSpace::Primaries QColorSpace::primaries() const noexcept
*/ */
QColorSpace::TransferFunction QColorSpace::transferFunction() const noexcept QColorSpace::TransferFunction QColorSpace::transferFunction() const noexcept
{ {
if (Q_UNLIKELY(!d_ptr))
return QColorSpace::TransferFunction::Custom;
return d_ptr->transferFunction; return d_ptr->transferFunction;
} }
@ -583,6 +588,8 @@ QColorSpace::TransferFunction QColorSpace::transferFunction() const noexcept
*/ */
float QColorSpace::gamma() const noexcept float QColorSpace::gamma() const noexcept
{ {
if (Q_UNLIKELY(!d_ptr))
return 0.0f;
return d_ptr->gamma; return d_ptr->gamma;
} }
@ -599,7 +606,7 @@ void QColorSpace::setTransferFunction(QColorSpace::TransferFunction transferFunc
return; return;
if (d_ptr->transferFunction == transferFunction && d_ptr->gamma == gamma) if (d_ptr->transferFunction == transferFunction && d_ptr->gamma == gamma)
return; return;
d_ptr.detach(); QColorSpacePrivate::getWritable(*this); // detach
d_ptr->description.clear(); d_ptr->description.clear();
d_ptr->transferFunction = transferFunction; d_ptr->transferFunction = transferFunction;
d_ptr->gamma = gamma; d_ptr->gamma = gamma;
@ -637,7 +644,7 @@ void QColorSpace::setPrimaries(QColorSpace::Primaries primariesId)
return; return;
if (d_ptr->primaries == primariesId) if (d_ptr->primaries == primariesId)
return; return;
d_ptr.detach(); QColorSpacePrivate::getWritable(*this); // detach
d_ptr->description.clear(); d_ptr->description.clear();
d_ptr->primaries = primariesId; d_ptr->primaries = primariesId;
d_ptr->identifyColorSpace(); d_ptr->identifyColorSpace();
@ -663,7 +670,7 @@ void QColorSpace::setPrimaries(const QPointF &whitePoint, const QPointF &redPoin
QColorMatrix toXyz = primaries.toXyzMatrix(); QColorMatrix toXyz = primaries.toXyzMatrix();
if (QColorVector(primaries.whitePoint) == d_ptr->whitePoint && toXyz == d_ptr->toXyz) if (QColorVector(primaries.whitePoint) == d_ptr->whitePoint && toXyz == d_ptr->toXyz)
return; return;
d_ptr.detach(); QColorSpacePrivate::getWritable(*this); // detach
d_ptr->description.clear(); d_ptr->description.clear();
d_ptr->primaries = QColorSpace::Primaries::Custom; d_ptr->primaries = QColorSpace::Primaries::Custom;
d_ptr->toXyz = toXyz; d_ptr->toXyz = toXyz;
@ -685,6 +692,8 @@ void QColorSpace::setPrimaries(const QPointF &whitePoint, const QPointF &redPoin
*/ */
QByteArray QColorSpace::iccProfile() const QByteArray QColorSpace::iccProfile() const
{ {
if (Q_UNLIKELY(!d_ptr))
return QByteArray();
if (!d_ptr->iccProfile.isEmpty()) if (!d_ptr->iccProfile.isEmpty())
return d_ptr->iccProfile; return d_ptr->iccProfile;
if (!isValid()) if (!isValid())
@ -708,8 +717,9 @@ QColorSpace QColorSpace::fromIccProfile(const QByteArray &iccProfile)
QColorSpace colorSpace; QColorSpace colorSpace;
if (QIcc::fromIccProfile(iccProfile, &colorSpace)) if (QIcc::fromIccProfile(iccProfile, &colorSpace))
return colorSpace; return colorSpace;
colorSpace.d_ptr->id = QColorSpace::Undefined; QColorSpacePrivate *d = QColorSpacePrivate::getWritable(colorSpace);
colorSpace.d_ptr->iccProfile = iccProfile; d->id = QColorSpace::Undefined;
d->iccProfile = iccProfile;
return colorSpace; return colorSpace;
} }
@ -718,7 +728,7 @@ QColorSpace QColorSpace::fromIccProfile(const QByteArray &iccProfile)
*/ */
bool QColorSpace::isValid() const noexcept bool QColorSpace::isValid() const noexcept
{ {
return d_ptr->id != QColorSpace::Undefined && d_ptr->toXyz.isValid() return d_ptr && d_ptr->id != QColorSpace::Undefined && d_ptr->toXyz.isValid()
&& d_ptr->trc[0].isValid() && d_ptr->trc[1].isValid() && d_ptr->trc[2].isValid(); && d_ptr->trc[0].isValid() && d_ptr->trc[1].isValid() && d_ptr->trc[2].isValid();
} }
@ -731,6 +741,8 @@ bool operator==(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2)
{ {
if (colorSpace1.d_ptr == colorSpace2.d_ptr) if (colorSpace1.d_ptr == colorSpace2.d_ptr)
return true; return true;
if (!colorSpace1.d_ptr || !colorSpace2.d_ptr)
return false;
if (colorSpace1.colorSpaceId() == QColorSpace::Undefined && colorSpace2.colorSpaceId() == QColorSpace::Undefined) if (colorSpace1.colorSpaceId() == QColorSpace::Undefined && colorSpace2.colorSpaceId() == QColorSpace::Undefined)
return colorSpace1.d_ptr->iccProfile == colorSpace2.d_ptr->iccProfile; return colorSpace1.d_ptr->iccProfile == colorSpace2.d_ptr->iccProfile;
@ -780,7 +792,7 @@ QColorTransform QColorSpace::transformationToColorSpace(const QColorSpace &color
if (!isValid() || !colorspace.isValid()) if (!isValid() || !colorspace.isValid())
return QColorTransform(); return QColorTransform();
return d_ptr->transformationToColorSpace(colorspace.d_ptr.constData()); return d_ptr->transformationToColorSpace(colorspace.d_ptr);
} }
/***************************************************************************** /*****************************************************************************

View File

@ -42,11 +42,13 @@
#include <QtGui/qtguiglobal.h> #include <QtGui/qtguiglobal.h>
#include <QtGui/qcolortransform.h> #include <QtGui/qcolortransform.h>
#include <QtCore/qobjectdefs.h>
#include <QtCore/qshareddata.h> #include <QtCore/qshareddata.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QColorSpacePrivate; class QColorSpacePrivate;
class QPointF;
class Q_GUI_EXPORT QColorSpace class Q_GUI_EXPORT QColorSpace
{ {
@ -90,11 +92,19 @@ public:
TransferFunction fun, float gamma = 0.0f); TransferFunction fun, float gamma = 0.0f);
~QColorSpace(); ~QColorSpace();
QColorSpace(QColorSpace &&colorSpace) noexcept;
QColorSpace(const QColorSpace &colorSpace); QColorSpace(const QColorSpace &colorSpace);
QColorSpace &operator=(QColorSpace &&colorSpace) noexcept;
QColorSpace &operator=(const QColorSpace &colorSpace); QColorSpace &operator=(const QColorSpace &colorSpace);
QColorSpace(QColorSpace &&colorSpace) noexcept
: d_ptr(qExchange(colorSpace.d_ptr, nullptr))
{ }
QColorSpace &operator=(QColorSpace &&colorSpace) noexcept
{
// Make the deallocation of this->d_ptr happen in ~QColorSpace()
QColorSpace(std::move(colorSpace)).swap(*this);
return *this;
}
void swap(QColorSpace &colorSpace) noexcept void swap(QColorSpace &colorSpace) noexcept
{ qSwap(d_ptr, colorSpace.d_ptr); } { qSwap(d_ptr, colorSpace.d_ptr); }
@ -123,7 +133,7 @@ public:
private: private:
Q_DECLARE_PRIVATE(QColorSpace) Q_DECLARE_PRIVATE(QColorSpace)
QExplicitlySharedDataPointer<QColorSpacePrivate> d_ptr; QColorSpacePrivate *d_ptr;
}; };
bool Q_GUI_EXPORT operator==(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2); bool Q_GUI_EXPORT operator==(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2);

View File

@ -95,15 +95,24 @@ public:
QColorSpacePrivate(const QColorSpacePrimaries &primaries, QColorSpace::TransferFunction fun, float gamma); QColorSpacePrivate(const QColorSpacePrimaries &primaries, QColorSpace::TransferFunction fun, float gamma);
QColorSpacePrivate(const QColorSpacePrivate &other) = default; QColorSpacePrivate(const QColorSpacePrivate &other) = default;
// named different from get to avoid accidental detachs
static QColorSpacePrivate *getWritable(QColorSpace &colorSpace) static QColorSpacePrivate *getWritable(QColorSpace &colorSpace)
{ {
colorSpace.d_ptr.detach(); if (!colorSpace.d_ptr) {
return colorSpace.d_ptr.data(); colorSpace.d_ptr = new QColorSpacePrivate;
colorSpace.d_ptr->ref.ref();
} else if (colorSpace.d_ptr->ref.loadRelaxed() != 1) {
colorSpace.d_ptr->ref.deref();
colorSpace.d_ptr = new QColorSpacePrivate(*colorSpace.d_ptr);
colorSpace.d_ptr->ref.ref();
}
Q_ASSERT(colorSpace.d_ptr->ref.loadRelaxed() == 1);
return colorSpace.d_ptr;
} }
static const QColorSpacePrivate *get(const QColorSpace &colorSpace) static const QColorSpacePrivate *get(const QColorSpace &colorSpace)
{ {
return colorSpace.d_ptr.data(); return colorSpace.d_ptr;
} }
void initialize(); void initialize();

View File

@ -41,7 +41,6 @@
#define QCOLORTRANSFORM_H #define QCOLORTRANSFORM_H
#include <QtGui/qtguiglobal.h> #include <QtGui/qtguiglobal.h>
#include <QtCore/qsharedpointer.h>
#include <QtGui/qrgb.h> #include <QtGui/qrgb.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -121,8 +121,8 @@ struct Options
, auxMode(false) , auxMode(false)
, deploymentMechanism(Bundled) , deploymentMechanism(Bundled)
, releasePackage(false) , releasePackage(false)
, digestAlg(QLatin1String("SHA1")) , digestAlg(QLatin1String("SHA-256"))
, sigAlg(QLatin1String("SHA1withRSA")) , sigAlg(QLatin1String("SHA256withRSA"))
, internalSf(false) , internalSf(false)
, sectionsOnly(false) , sectionsOnly(false)
, protectedAuthenticationPath(false) , protectedAuthenticationPath(false)
@ -182,6 +182,8 @@ struct Options
QString currentArchitecture; QString currentArchitecture;
QString toolchainPrefix; QString toolchainPrefix;
QString ndkHost; QString ndkHost;
bool buildAAB = false;
// Package information // Package information
DeploymentMechanism deploymentMechanism; DeploymentMechanism deploymentMechanism;
@ -416,7 +418,10 @@ Options parseOptions()
options.helpRequested = true; options.helpRequested = true;
else else
options.inputFileName = arguments.at(++i); options.inputFileName = arguments.at(++i);
} else if (argument.compare(QLatin1String("--no-build"), Qt::CaseInsensitive) == 0) { } else if (argument.compare(QLatin1String("--aab"), Qt::CaseInsensitive) == 0) {
options.buildAAB = true;
options.build = true;
} else if (options.buildAAB && argument.compare(QLatin1String("--no-build"), Qt::CaseInsensitive) == 0) {
options.build = false; options.build = false;
} else if (argument.compare(QLatin1String("--install"), Qt::CaseInsensitive) == 0) { } else if (argument.compare(QLatin1String("--install"), Qt::CaseInsensitive) == 0) {
options.installApk = true; options.installApk = true;
@ -559,6 +564,7 @@ void printHelp()
" --deployment <mechanism>: Supported deployment mechanisms:\n" " --deployment <mechanism>: Supported deployment mechanisms:\n"
" bundled (default): Include Qt files in stand-alone package.\n" " bundled (default): Include Qt files in stand-alone package.\n"
" ministro: Use the Ministro service to manage Qt files.\n" " ministro: Use the Ministro service to manage Qt files.\n"
" --aab: Build an Android App Bundle.\n"
" --no-build: Do not build the package, it is useful to just install\n" " --no-build: Do not build the package, it is useful to just install\n"
" a package previously built.\n" " a package previously built.\n"
" --install: Installs apk to device/emulator. By default this step is\n" " --install: Installs apk to device/emulator. By default this step is\n"
@ -2293,6 +2299,9 @@ bool buildAndroidProject(const Options &options)
} }
QString commandLine = QLatin1String("%1 --no-daemon %2").arg(shellQuote(gradlePath), options.releasePackage ? QLatin1String(" assembleRelease") : QLatin1String(" assembleDebug")); QString commandLine = QLatin1String("%1 --no-daemon %2").arg(shellQuote(gradlePath), options.releasePackage ? QLatin1String(" assembleRelease") : QLatin1String(" assembleDebug"));
if (options.buildAAB)
commandLine += QLatin1String(" bundle");
if (options.verbose) if (options.verbose)
commandLine += QLatin1String(" --info"); commandLine += QLatin1String(" --info");
@ -2353,28 +2362,38 @@ bool uninstallApk(const Options &options)
} }
enum PackageType { enum PackageType {
AAB,
UnsignedAPK, UnsignedAPK,
SignedAPK SignedAPK
}; };
QString apkPath(const Options &options, PackageType pt) QString packagePath(const Options &options, PackageType pt)
{ {
QString path(options.outputDirectory); QString path(options.outputDirectory);
path += QLatin1String("/build/outputs/apk/"); path += QLatin1String("/build/outputs/%1/").arg(pt >= UnsignedAPK ? QStringLiteral("apk") : QStringLiteral("bundle"));
QString buildType(options.releasePackage ? QLatin1String("release/") : QLatin1String("debug/")); QString buildType(options.releasePackage ? QLatin1String("release/") : QLatin1String("debug/"));
if (QDir(path + buildType).exists()) if (QDir(path + buildType).exists())
path += buildType; path += buildType;
path += QDir(options.outputDirectory).dirName() + QLatin1Char('-'); path += QDir(options.outputDirectory).dirName() + QLatin1Char('-');
if (options.releasePackage) { if (options.releasePackage) {
path += QLatin1String("release-"); path += QLatin1String("release-");
if (pt >= UnsignedAPK) {
if (pt == UnsignedAPK) if (pt == UnsignedAPK)
path += QLatin1String("un"); path += QLatin1String("un");
path += QLatin1String("signed.apk"); path += QLatin1String("signed.apk");
} else {
path.chop(1);
path += QLatin1String(".aab");
}
} else { } else {
path += QLatin1String("debug"); path += QLatin1String("debug");
if (pt >= UnsignedAPK) {
if (pt == SignedAPK) if (pt == SignedAPK)
path += QLatin1String("-signed"); path += QLatin1String("-signed");
path += QLatin1String(".apk"); path += QLatin1String(".apk");
} else {
path += QLatin1String(".aab");
}
} }
return shellQuote(path); return shellQuote(path);
} }
@ -2391,7 +2410,7 @@ bool installApk(const Options &options)
FILE *adbCommand = runAdb(options, FILE *adbCommand = runAdb(options,
QLatin1String(" install -r ") QLatin1String(" install -r ")
+ apkPath(options, options.keyStore.isEmpty() ? UnsignedAPK + packagePath(options, options.keyStore.isEmpty() ? UnsignedAPK
: SignedAPK)); : SignedAPK));
if (adbCommand == 0) if (adbCommand == 0)
return false; return false;
@ -2417,7 +2436,7 @@ bool installApk(const Options &options)
bool copyPackage(const Options &options) bool copyPackage(const Options &options)
{ {
fflush(stdout); fflush(stdout);
auto from = apkPath(options, options.keyStore.isEmpty() ? UnsignedAPK : SignedAPK); auto from = packagePath(options, options.keyStore.isEmpty() ? UnsignedAPK : SignedAPK);
QFile::remove(options.apkPath); QFile::remove(options.apkPath);
return QFile::copy(from, options.apkPath); return QFile::copy(from, options.apkPath);
} }
@ -2500,11 +2519,14 @@ bool jarSignerSignPackage(const Options &options)
if (options.protectedAuthenticationPath) if (options.protectedAuthenticationPath)
jarSignerTool += QLatin1String(" -protected"); jarSignerTool += QLatin1String(" -protected");
jarSignerTool += QLatin1String(" %1 %2") auto signPackage = [&](const QString &file) {
.arg(apkPath(options, UnsignedAPK)) fprintf(stdout, "Signing file %s\n", qPrintable(file));
fflush(stdout);
auto command = jarSignerTool + QLatin1String(" %1 %2")
.arg(file)
.arg(shellQuote(options.keyStoreAlias)); .arg(shellQuote(options.keyStoreAlias));
FILE *jarSignerCommand = openProcess(jarSignerTool); FILE *jarSignerCommand = openProcess(command);
if (jarSignerCommand == 0) { if (jarSignerCommand == 0) {
fprintf(stderr, "Couldn't run jarsigner.\n"); fprintf(stderr, "Couldn't run jarsigner.\n");
return false; return false;
@ -2523,6 +2545,13 @@ bool jarSignerSignPackage(const Options &options)
fprintf(stderr, " -- Run with --verbose for more information.\n"); fprintf(stderr, " -- Run with --verbose for more information.\n");
return false; return false;
} }
return true;
};
if (!signPackage(packagePath(options, UnsignedAPK)))
return false;
if (options.buildAAB && !signPackage(packagePath(options, AAB)))
return false;
QString zipAlignTool = options.sdkPath + QLatin1String("/tools/zipalign"); QString zipAlignTool = options.sdkPath + QLatin1String("/tools/zipalign");
#if defined(Q_OS_WIN32) #if defined(Q_OS_WIN32)
@ -2543,8 +2572,8 @@ bool jarSignerSignPackage(const Options &options)
zipAlignTool = QLatin1String("%1%2 -f 4 %3 %4") zipAlignTool = QLatin1String("%1%2 -f 4 %3 %4")
.arg(shellQuote(zipAlignTool), .arg(shellQuote(zipAlignTool),
options.verbose ? QLatin1String(" -v") : QLatin1String(), options.verbose ? QLatin1String(" -v") : QLatin1String(),
apkPath(options, UnsignedAPK), packagePath(options, UnsignedAPK),
apkPath(options, SignedAPK)); packagePath(options, SignedAPK));
FILE *zipAlignCommand = openProcess(zipAlignTool); FILE *zipAlignCommand = openProcess(zipAlignTool);
if (zipAlignCommand == 0) { if (zipAlignCommand == 0) {
@ -2556,7 +2585,7 @@ bool jarSignerSignPackage(const Options &options)
while (fgets(buffer, sizeof(buffer), zipAlignCommand) != 0) while (fgets(buffer, sizeof(buffer), zipAlignCommand) != 0)
fprintf(stdout, "%s", buffer); fprintf(stdout, "%s", buffer);
errorCode = pclose(zipAlignCommand); int errorCode = pclose(zipAlignCommand);
if (errorCode != 0) { if (errorCode != 0) {
fprintf(stderr, "zipalign command failed.\n"); fprintf(stderr, "zipalign command failed.\n");
if (!options.verbose) if (!options.verbose)
@ -2564,7 +2593,7 @@ bool jarSignerSignPackage(const Options &options)
return false; return false;
} }
return QFile::remove(apkPath(options, UnsignedAPK)); return QFile::remove(packagePath(options, UnsignedAPK));
} }
bool signPackage(const Options &options) bool signPackage(const Options &options)
@ -2598,8 +2627,8 @@ bool signPackage(const Options &options)
zipAlignTool = QLatin1String("%1%2 -f 4 %3 %4") zipAlignTool = QLatin1String("%1%2 -f 4 %3 %4")
.arg(shellQuote(zipAlignTool), .arg(shellQuote(zipAlignTool),
options.verbose ? QLatin1String(" -v") : QLatin1String(), options.verbose ? QLatin1String(" -v") : QLatin1String(),
apkPath(options, UnsignedAPK), packagePath(options, UnsignedAPK),
apkPath(options, SignedAPK)); packagePath(options, SignedAPK));
FILE *zipAlignCommand = openProcess(zipAlignTool); FILE *zipAlignCommand = openProcess(zipAlignTool);
if (zipAlignCommand == 0) { if (zipAlignCommand == 0) {
@ -2635,7 +2664,7 @@ bool signPackage(const Options &options)
apkSignerCommandLine += QLatin1String(" --verbose"); apkSignerCommandLine += QLatin1String(" --verbose");
apkSignerCommandLine += QLatin1String(" %1") apkSignerCommandLine += QLatin1String(" %1")
.arg(apkPath(options, SignedAPK)); .arg(packagePath(options, SignedAPK));
auto apkSignerRunner = [&] { auto apkSignerRunner = [&] {
FILE *apkSignerCommand = openProcess(apkSignerCommandLine); FILE *apkSignerCommand = openProcess(apkSignerCommandLine);
@ -2663,10 +2692,10 @@ bool signPackage(const Options &options)
return false; return false;
apkSignerCommandLine = QLatin1String("%1 verify --verbose %2") apkSignerCommandLine = QLatin1String("%1 verify --verbose %2")
.arg(shellQuote(apksignerTool), apkPath(options, SignedAPK)); .arg(shellQuote(apksignerTool), packagePath(options, SignedAPK));
// Verify the package and remove the unsigned apk // Verify the package and remove the unsigned apk
return apkSignerRunner() && QFile::remove(apkPath(options, UnsignedAPK)); return apkSignerRunner() && QFile::remove(packagePath(options, UnsignedAPK));
} }
bool generateAssetsFileList(const Options &options) bool generateAssetsFileList(const Options &options)
@ -2890,7 +2919,7 @@ int main(int argc, char *argv[])
if (options.installApk) if (options.installApk)
fprintf(stdout, " -- It can now be run from the selected device/emulator.\n"); fprintf(stdout, " -- It can now be run from the selected device/emulator.\n");
fprintf(stdout, " -- File: %s\n", qPrintable(apkPath(options, options.keyStore.isEmpty() ? UnsignedAPK fprintf(stdout, " -- File: %s\n", qPrintable(packagePath(options, options.keyStore.isEmpty() ? UnsignedAPK
: SignedAPK))); : SignedAPK)));
fflush(stdout); fflush(stdout);
return 0; return 0;

View File

@ -1267,7 +1267,7 @@ Qt::DropActions QFileSystemModel::supportedDropActions() const
\enum QFileSystemModel::Option \enum QFileSystemModel::Option
\since 5.14 \since 5.14
\value DontWatch Do not add file watchers to the paths. \value DontWatchForChanges Do not add file watchers to the paths.
This reduces overhead when using the model for simple tasks This reduces overhead when using the model for simple tasks
like line edit completion. like line edit completion.
@ -1331,8 +1331,8 @@ void QFileSystemModel::setOptions(Options options)
#if QT_CONFIG(filesystemwatcher) #if QT_CONFIG(filesystemwatcher)
Q_D(QFileSystemModel); Q_D(QFileSystemModel);
if (changed.testFlag(DontWatch)) if (changed.testFlag(DontWatchForChanges))
d->fileInfoGatherer.setWatching(!options.testFlag(DontWatch)); d->fileInfoGatherer.setWatching(!options.testFlag(DontWatchForChanges));
#endif #endif
if (changed.testFlag(DontUseCustomDirectoryIcons)) { if (changed.testFlag(DontUseCustomDirectoryIcons)) {
@ -1353,9 +1353,9 @@ QFileSystemModel::Options QFileSystemModel::options() const
result.setFlag(DontResolveSymlinks, !resolveSymlinks()); result.setFlag(DontResolveSymlinks, !resolveSymlinks());
#if QT_CONFIG(filesystemwatcher) #if QT_CONFIG(filesystemwatcher)
Q_D(const QFileSystemModel); Q_D(const QFileSystemModel);
result.setFlag(DontWatch, !d->fileInfoGatherer.isWatching()); result.setFlag(DontWatchForChanges, !d->fileInfoGatherer.isWatching());
#else #else
result.setFlag(DontWatch); result.setFlag(DontWatchForChanges);
#endif #endif
if (auto provider = iconProvider()) { if (auto provider = iconProvider()) {
result.setFlag(DontUseCustomDirectoryIcons, result.setFlag(DontUseCustomDirectoryIcons,

View File

@ -78,7 +78,7 @@ public:
enum Option enum Option
{ {
DontWatch = 0x00000001, DontWatchForChanges = 0x00000001,
DontResolveSymlinks = 0x00000002, DontResolveSymlinks = 0x00000002,
DontUseCustomDirectoryIcons = 0x00000004 DontUseCustomDirectoryIcons = 0x00000004
}; };

View File

@ -47,6 +47,7 @@ public:
tst_QColorSpace(); tst_QColorSpace();
private slots: private slots:
void movable();
void namedColorSpaces_data(); void namedColorSpaces_data();
void namedColorSpaces(); void namedColorSpaces();
@ -75,6 +76,28 @@ tst_QColorSpace::tst_QColorSpace()
{ } { }
void tst_QColorSpace::movable()
{
QColorSpace cs1 = QColorSpace::SRgb;
QColorSpace cs2 = QColorSpace::SRgbLinear;
QVERIFY(cs1.isValid());
QVERIFY(cs2.isValid());
QCOMPARE(cs1.colorSpaceId(), QColorSpace::SRgb);
cs2 = std::move(cs1);
QVERIFY(!cs1.isValid());
QVERIFY(cs2.isValid());
QCOMPARE(cs2.colorSpaceId(), QColorSpace::SRgb);
QCOMPARE(cs1.colorSpaceId(), QColorSpace::Undefined);
QCOMPARE(cs1, QColorSpace());
QColorSpace cs3(std::move(cs2));
QVERIFY(!cs2.isValid());
QVERIFY(cs3.isValid());
QCOMPARE(cs3.colorSpaceId(), QColorSpace::SRgb);
QCOMPARE(cs2.colorSpaceId(), QColorSpace::Undefined);
}
void tst_QColorSpace::namedColorSpaces_data() void tst_QColorSpace::namedColorSpaces_data()
{ {
QTest::addColumn<QColorSpace::ColorSpaceId>("colorSpaceId"); QTest::addColumn<QColorSpace::ColorSpaceId>("colorSpaceId");