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/^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_DEPRECATED_X\(.*\)[\r\n]*$/); #qt 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
$$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))
model.setOption(QFileSystemModel::DontUseCustomDirectoryIcons);
if (parser.isSet(dontWatchOption))
model.setOption(QFileSystemModel::DontWatch);
model.setOption(QFileSystemModel::DontWatchForChanges);
QTreeView tree;
tree.setModel(&model);
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.commands = $(MAKE) -f $(MAKEFILE) INSTALL_ROOT=$$OUT_PWD/android-build install
apk.target = apk
apk.depends = apk_install_target
qtPrepareTool(ANDROIDDEPLOYQT, androiddeployqt)
isEmpty(ANDROID_DEPLOYMENT_SETTINGS_FILE): ANDROID_DEPLOYMENT_SETTINGS_FILE = $$OUT_PWD/android-$$TARGET-deployment-settings.json
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
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 {
prepareRecursiveTarget(aab)
prepareRecursiveTarget(apk)
prepareRecursiveTarget(apk_install_target)
}
QMAKE_EXTRA_TARGETS *= apk apk_install_target
build_pass {
contains(TEMPLATE, ".*app") {
@ -34,4 +39,11 @@ build_pass {
target.path = /libs/$$ANDROID_TARGET_ARCH/
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
#if QT_DEPRECATED_SINCE(5, 14)
QT_DEPRECATED_X("Use QLatin1String") typedef QLatin1String QLatin1Literal;
QT_DEPRECATED_X("Use QLatin1String")
typedef QLatin1String QLatin1Literal;
#endif
//

View File

@ -44,6 +44,7 @@
#include <QCoreApplication>
#include <private/qdebug_p.h>
#include <private/qlocking_p.h>
QT_BEGIN_NAMESPACE
@ -201,15 +202,20 @@ void QTouchDevice::setName(const QString &name)
d->name = name;
}
typedef QList<const QTouchDevice *> TouchDevices;
Q_GLOBAL_STATIC(TouchDevices, deviceList)
static QBasicMutex devicesMutex;
static void cleanupDevicesList()
struct TouchDevices {
TouchDevices();
QList<const QTouchDevice *> list;
};
Q_GLOBAL_STATIC(TouchDevices, deviceList)
TouchDevices::TouchDevices()
{
QMutexLocker lock(&devicesMutex);
qDeleteAll(*deviceList());
deviceList()->clear();
qAddPostRoutine([]{
const auto locker = qt_scoped_lock(devicesMutex);
qDeleteAll(qExchange(deviceList->list, {}));
});
}
/*!
@ -223,7 +229,7 @@ static void cleanupDevicesList()
QList<const QTouchDevice *> QTouchDevice::devices()
{
QMutexLocker lock(&devicesMutex);
return *deviceList();
return deviceList->list;
}
/*!
@ -232,13 +238,13 @@ QList<const QTouchDevice *> QTouchDevice::devices()
bool QTouchDevicePrivate::isRegistered(const QTouchDevice *dev)
{
QMutexLocker locker(&devicesMutex);
return deviceList()->contains(dev);
return deviceList->list.contains(dev);
}
const QTouchDevice *QTouchDevicePrivate::deviceById(quint8 id)
{
QMutexLocker locker(&devicesMutex);
for (const QTouchDevice *dev : *deviceList())
for (const QTouchDevice *dev : qAsConst(deviceList->list))
if (QTouchDevicePrivate::get(const_cast<QTouchDevice *>(dev))->id == id)
return dev;
return nullptr;
@ -250,9 +256,7 @@ const QTouchDevice *QTouchDevicePrivate::deviceById(quint8 id)
void QTouchDevicePrivate::registerDevice(const QTouchDevice *dev)
{
QMutexLocker lock(&devicesMutex);
if (deviceList()->isEmpty())
qAddPostRoutine(cleanupDevicesList);
deviceList()->append(dev);
deviceList->list.append(dev);
}
/*!
@ -261,9 +265,7 @@ void QTouchDevicePrivate::registerDevice(const QTouchDevice *dev)
void QTouchDevicePrivate::unregisterDevice(const QTouchDevice *dev)
{
QMutexLocker lock(&devicesMutex);
bool wasRemoved = deviceList()->removeOne(dev);
if (wasRemoved && deviceList()->isEmpty())
qRemovePostRoutine(cleanupDevicesList);
deviceList->list.removeOne(dev);
}
#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.
*/
QColorSpace::QColorSpace(QColorSpace::ColorSpaceId colorSpaceId)
: d_ptr(nullptr)
{
static QExplicitlySharedDataPointer<QColorSpacePrivate> predefinedColorspacePrivates[QColorSpace::Bt2020];
if (colorSpaceId <= QColorSpace::Unknown) {
if (!predefinedColorspacePrivates[0])
predefinedColorspacePrivates[0] = new QColorSpacePrivate(QColorSpace::Undefined);
d_ptr = predefinedColorspacePrivates[0]; // unknown and undefined both returns the static undefined colorspace.
} else {
if (!predefinedColorspacePrivates[colorSpaceId - 1])
predefinedColorspacePrivates[colorSpaceId - 1] = new QColorSpacePrivate(colorSpaceId);
d_ptr = predefinedColorspacePrivates[colorSpaceId - 1];
static QColorSpacePrivate *predefinedColorspacePrivates[QColorSpace::Bt2020];
// Unknown and undefined both returns the static undefined colorspace
if (colorSpaceId > QColorSpace::Unknown) {
if (!predefinedColorspacePrivates[colorSpaceId - 2]) {
predefinedColorspacePrivates[colorSpaceId - 2] = new QColorSpacePrivate(colorSpaceId);
predefinedColorspacePrivates[colorSpaceId - 2]->ref.ref();
}
d_ptr = predefinedColorspacePrivates[colorSpaceId - 2];
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)
: 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)
: 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);
if (!primaries.areValid()) {
qWarning() << "QColorSpace attempted constructed from invalid primaries:" << whitePoint << redPoint << greenPoint << bluePoint;
d_ptr = QColorSpace(QColorSpace::Undefined).d_ptr;
d_ptr = nullptr;
return;
}
d_ptr = new QColorSpacePrivate(primaries, fun, gamma);
d_ptr->ref.ref();
}
QColorSpace::~QColorSpace()
{
}
QColorSpace::QColorSpace(QColorSpace &&colorSpace) noexcept
: d_ptr(std::move(colorSpace.d_ptr))
{
if (d_ptr && !d_ptr->ref.deref())
delete d_ptr;
}
QColorSpace::QColorSpace(const QColorSpace &colorSpace)
: d_ptr(colorSpace.d_ptr)
{
}
QColorSpace &QColorSpace::operator=(QColorSpace &&colorSpace) noexcept
{
d_ptr = std::move(colorSpace.d_ptr);
return *this;
if (d_ptr)
d_ptr->ref.ref();
}
QColorSpace &QColorSpace::operator=(const QColorSpace &colorSpace)
{
QColorSpacePrivate *oldD = d_ptr;
d_ptr = colorSpace.d_ptr;
if (d_ptr)
d_ptr->ref.ref();
if (oldD && !oldD->ref.deref())
delete oldD;
return *this;
}
@ -549,6 +550,8 @@ QColorSpace &QColorSpace::operator=(const QColorSpace &colorSpace)
*/
QColorSpace::ColorSpaceId QColorSpace::colorSpaceId() const noexcept
{
if (Q_UNLIKELY(!d_ptr))
return QColorSpace::Undefined;
return d_ptr->id;
}
@ -571,6 +574,8 @@ QColorSpace::Primaries QColorSpace::primaries() const noexcept
*/
QColorSpace::TransferFunction QColorSpace::transferFunction() const noexcept
{
if (Q_UNLIKELY(!d_ptr))
return QColorSpace::TransferFunction::Custom;
return d_ptr->transferFunction;
}
@ -583,6 +588,8 @@ QColorSpace::TransferFunction QColorSpace::transferFunction() const noexcept
*/
float QColorSpace::gamma() const noexcept
{
if (Q_UNLIKELY(!d_ptr))
return 0.0f;
return d_ptr->gamma;
}
@ -599,7 +606,7 @@ void QColorSpace::setTransferFunction(QColorSpace::TransferFunction transferFunc
return;
if (d_ptr->transferFunction == transferFunction && d_ptr->gamma == gamma)
return;
d_ptr.detach();
QColorSpacePrivate::getWritable(*this); // detach
d_ptr->description.clear();
d_ptr->transferFunction = transferFunction;
d_ptr->gamma = gamma;
@ -637,7 +644,7 @@ void QColorSpace::setPrimaries(QColorSpace::Primaries primariesId)
return;
if (d_ptr->primaries == primariesId)
return;
d_ptr.detach();
QColorSpacePrivate::getWritable(*this); // detach
d_ptr->description.clear();
d_ptr->primaries = primariesId;
d_ptr->identifyColorSpace();
@ -663,7 +670,7 @@ void QColorSpace::setPrimaries(const QPointF &whitePoint, const QPointF &redPoin
QColorMatrix toXyz = primaries.toXyzMatrix();
if (QColorVector(primaries.whitePoint) == d_ptr->whitePoint && toXyz == d_ptr->toXyz)
return;
d_ptr.detach();
QColorSpacePrivate::getWritable(*this); // detach
d_ptr->description.clear();
d_ptr->primaries = QColorSpace::Primaries::Custom;
d_ptr->toXyz = toXyz;
@ -685,6 +692,8 @@ void QColorSpace::setPrimaries(const QPointF &whitePoint, const QPointF &redPoin
*/
QByteArray QColorSpace::iccProfile() const
{
if (Q_UNLIKELY(!d_ptr))
return QByteArray();
if (!d_ptr->iccProfile.isEmpty())
return d_ptr->iccProfile;
if (!isValid())
@ -708,8 +717,9 @@ QColorSpace QColorSpace::fromIccProfile(const QByteArray &iccProfile)
QColorSpace colorSpace;
if (QIcc::fromIccProfile(iccProfile, &colorSpace))
return colorSpace;
colorSpace.d_ptr->id = QColorSpace::Undefined;
colorSpace.d_ptr->iccProfile = iccProfile;
QColorSpacePrivate *d = QColorSpacePrivate::getWritable(colorSpace);
d->id = QColorSpace::Undefined;
d->iccProfile = iccProfile;
return colorSpace;
}
@ -718,7 +728,7 @@ QColorSpace QColorSpace::fromIccProfile(const QByteArray &iccProfile)
*/
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();
}
@ -731,6 +741,8 @@ bool operator==(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2)
{
if (colorSpace1.d_ptr == colorSpace2.d_ptr)
return true;
if (!colorSpace1.d_ptr || !colorSpace2.d_ptr)
return false;
if (colorSpace1.colorSpaceId() == QColorSpace::Undefined && colorSpace2.colorSpaceId() == QColorSpace::Undefined)
return colorSpace1.d_ptr->iccProfile == colorSpace2.d_ptr->iccProfile;
@ -780,7 +792,7 @@ QColorTransform QColorSpace::transformationToColorSpace(const QColorSpace &color
if (!isValid() || !colorspace.isValid())
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/qcolortransform.h>
#include <QtCore/qobjectdefs.h>
#include <QtCore/qshareddata.h>
QT_BEGIN_NAMESPACE
class QColorSpacePrivate;
class QPointF;
class Q_GUI_EXPORT QColorSpace
{
@ -90,11 +92,19 @@ public:
TransferFunction fun, float gamma = 0.0f);
~QColorSpace();
QColorSpace(QColorSpace &&colorSpace) noexcept;
QColorSpace(const QColorSpace &colorSpace);
QColorSpace &operator=(QColorSpace &&colorSpace) noexcept;
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
{ qSwap(d_ptr, colorSpace.d_ptr); }
@ -123,7 +133,7 @@ public:
private:
Q_DECLARE_PRIVATE(QColorSpace)
QExplicitlySharedDataPointer<QColorSpacePrivate> d_ptr;
QColorSpacePrivate *d_ptr;
};
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 QColorSpacePrivate &other) = default;
// named different from get to avoid accidental detachs
static QColorSpacePrivate *getWritable(QColorSpace &colorSpace)
{
colorSpace.d_ptr.detach();
return colorSpace.d_ptr.data();
if (!colorSpace.d_ptr) {
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)
{
return colorSpace.d_ptr.data();
return colorSpace.d_ptr;
}
void initialize();

View File

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

View File

@ -121,8 +121,8 @@ struct Options
, auxMode(false)
, deploymentMechanism(Bundled)
, releasePackage(false)
, digestAlg(QLatin1String("SHA1"))
, sigAlg(QLatin1String("SHA1withRSA"))
, digestAlg(QLatin1String("SHA-256"))
, sigAlg(QLatin1String("SHA256withRSA"))
, internalSf(false)
, sectionsOnly(false)
, protectedAuthenticationPath(false)
@ -182,6 +182,8 @@ struct Options
QString currentArchitecture;
QString toolchainPrefix;
QString ndkHost;
bool buildAAB = false;
// Package information
DeploymentMechanism deploymentMechanism;
@ -416,7 +418,10 @@ Options parseOptions()
options.helpRequested = true;
else
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;
} else if (argument.compare(QLatin1String("--install"), Qt::CaseInsensitive) == 0) {
options.installApk = true;
@ -559,6 +564,7 @@ void printHelp()
" --deployment <mechanism>: Supported deployment mechanisms:\n"
" bundled (default): Include Qt files in stand-alone package.\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"
" a package previously built.\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"));
if (options.buildAAB)
commandLine += QLatin1String(" bundle");
if (options.verbose)
commandLine += QLatin1String(" --info");
@ -2353,28 +2362,38 @@ bool uninstallApk(const Options &options)
}
enum PackageType {
AAB,
UnsignedAPK,
SignedAPK
};
QString apkPath(const Options &options, PackageType pt)
QString packagePath(const Options &options, PackageType pt)
{
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/"));
if (QDir(path + buildType).exists())
path += buildType;
path += QDir(options.outputDirectory).dirName() + QLatin1Char('-');
if (options.releasePackage) {
path += QLatin1String("release-");
if (pt == UnsignedAPK)
path += QLatin1String("un");
path += QLatin1String("signed.apk");
if (pt >= UnsignedAPK) {
if (pt == UnsignedAPK)
path += QLatin1String("un");
path += QLatin1String("signed.apk");
} else {
path.chop(1);
path += QLatin1String(".aab");
}
} else {
path += QLatin1String("debug");
if (pt == SignedAPK)
path += QLatin1String("-signed");
path += QLatin1String(".apk");
if (pt >= UnsignedAPK) {
if (pt == SignedAPK)
path += QLatin1String("-signed");
path += QLatin1String(".apk");
} else {
path += QLatin1String(".aab");
}
}
return shellQuote(path);
}
@ -2391,7 +2410,7 @@ bool installApk(const Options &options)
FILE *adbCommand = runAdb(options,
QLatin1String(" install -r ")
+ apkPath(options, options.keyStore.isEmpty() ? UnsignedAPK
+ packagePath(options, options.keyStore.isEmpty() ? UnsignedAPK
: SignedAPK));
if (adbCommand == 0)
return false;
@ -2417,7 +2436,7 @@ bool installApk(const Options &options)
bool copyPackage(const Options &options)
{
fflush(stdout);
auto from = apkPath(options, options.keyStore.isEmpty() ? UnsignedAPK : SignedAPK);
auto from = packagePath(options, options.keyStore.isEmpty() ? UnsignedAPK : SignedAPK);
QFile::remove(options.apkPath);
return QFile::copy(from, options.apkPath);
}
@ -2500,29 +2519,39 @@ bool jarSignerSignPackage(const Options &options)
if (options.protectedAuthenticationPath)
jarSignerTool += QLatin1String(" -protected");
jarSignerTool += QLatin1String(" %1 %2")
.arg(apkPath(options, UnsignedAPK))
.arg(shellQuote(options.keyStoreAlias));
auto signPackage = [&](const QString &file) {
fprintf(stdout, "Signing file %s\n", qPrintable(file));
fflush(stdout);
auto command = jarSignerTool + QLatin1String(" %1 %2")
.arg(file)
.arg(shellQuote(options.keyStoreAlias));
FILE *jarSignerCommand = openProcess(jarSignerTool);
if (jarSignerCommand == 0) {
fprintf(stderr, "Couldn't run jarsigner.\n");
FILE *jarSignerCommand = openProcess(command);
if (jarSignerCommand == 0) {
fprintf(stderr, "Couldn't run jarsigner.\n");
return false;
}
if (options.verbose) {
char buffer[512];
while (fgets(buffer, sizeof(buffer), jarSignerCommand) != 0)
fprintf(stdout, "%s", buffer);
}
int errorCode = pclose(jarSignerCommand);
if (errorCode != 0) {
fprintf(stderr, "jarsigner command failed.\n");
if (!options.verbose)
fprintf(stderr, " -- Run with --verbose for more information.\n");
return false;
}
return true;
};
if (!signPackage(packagePath(options, UnsignedAPK)))
return false;
}
if (options.verbose) {
char buffer[512];
while (fgets(buffer, sizeof(buffer), jarSignerCommand) != 0)
fprintf(stdout, "%s", buffer);
}
int errorCode = pclose(jarSignerCommand);
if (errorCode != 0) {
fprintf(stderr, "jarsigner command failed.\n");
if (!options.verbose)
fprintf(stderr, " -- Run with --verbose for more information.\n");
if (options.buildAAB && !signPackage(packagePath(options, AAB)))
return false;
}
QString zipAlignTool = options.sdkPath + QLatin1String("/tools/zipalign");
#if defined(Q_OS_WIN32)
@ -2543,8 +2572,8 @@ bool jarSignerSignPackage(const Options &options)
zipAlignTool = QLatin1String("%1%2 -f 4 %3 %4")
.arg(shellQuote(zipAlignTool),
options.verbose ? QLatin1String(" -v") : QLatin1String(),
apkPath(options, UnsignedAPK),
apkPath(options, SignedAPK));
packagePath(options, UnsignedAPK),
packagePath(options, SignedAPK));
FILE *zipAlignCommand = openProcess(zipAlignTool);
if (zipAlignCommand == 0) {
@ -2556,7 +2585,7 @@ bool jarSignerSignPackage(const Options &options)
while (fgets(buffer, sizeof(buffer), zipAlignCommand) != 0)
fprintf(stdout, "%s", buffer);
errorCode = pclose(zipAlignCommand);
int errorCode = pclose(zipAlignCommand);
if (errorCode != 0) {
fprintf(stderr, "zipalign command failed.\n");
if (!options.verbose)
@ -2564,7 +2593,7 @@ bool jarSignerSignPackage(const Options &options)
return false;
}
return QFile::remove(apkPath(options, UnsignedAPK));
return QFile::remove(packagePath(options, UnsignedAPK));
}
bool signPackage(const Options &options)
@ -2598,8 +2627,8 @@ bool signPackage(const Options &options)
zipAlignTool = QLatin1String("%1%2 -f 4 %3 %4")
.arg(shellQuote(zipAlignTool),
options.verbose ? QLatin1String(" -v") : QLatin1String(),
apkPath(options, UnsignedAPK),
apkPath(options, SignedAPK));
packagePath(options, UnsignedAPK),
packagePath(options, SignedAPK));
FILE *zipAlignCommand = openProcess(zipAlignTool);
if (zipAlignCommand == 0) {
@ -2635,7 +2664,7 @@ bool signPackage(const Options &options)
apkSignerCommandLine += QLatin1String(" --verbose");
apkSignerCommandLine += QLatin1String(" %1")
.arg(apkPath(options, SignedAPK));
.arg(packagePath(options, SignedAPK));
auto apkSignerRunner = [&] {
FILE *apkSignerCommand = openProcess(apkSignerCommandLine);
@ -2663,10 +2692,10 @@ bool signPackage(const Options &options)
return false;
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
return apkSignerRunner() && QFile::remove(apkPath(options, UnsignedAPK));
return apkSignerRunner() && QFile::remove(packagePath(options, UnsignedAPK));
}
bool generateAssetsFileList(const Options &options)
@ -2890,7 +2919,7 @@ int main(int argc, char *argv[])
if (options.installApk)
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)));
fflush(stdout);
return 0;

View File

@ -1267,7 +1267,7 @@ Qt::DropActions QFileSystemModel::supportedDropActions() const
\enum QFileSystemModel::Option
\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
like line edit completion.
@ -1331,8 +1331,8 @@ void QFileSystemModel::setOptions(Options options)
#if QT_CONFIG(filesystemwatcher)
Q_D(QFileSystemModel);
if (changed.testFlag(DontWatch))
d->fileInfoGatherer.setWatching(!options.testFlag(DontWatch));
if (changed.testFlag(DontWatchForChanges))
d->fileInfoGatherer.setWatching(!options.testFlag(DontWatchForChanges));
#endif
if (changed.testFlag(DontUseCustomDirectoryIcons)) {
@ -1353,9 +1353,9 @@ QFileSystemModel::Options QFileSystemModel::options() const
result.setFlag(DontResolveSymlinks, !resolveSymlinks());
#if QT_CONFIG(filesystemwatcher)
Q_D(const QFileSystemModel);
result.setFlag(DontWatch, !d->fileInfoGatherer.isWatching());
result.setFlag(DontWatchForChanges, !d->fileInfoGatherer.isWatching());
#else
result.setFlag(DontWatch);
result.setFlag(DontWatchForChanges);
#endif
if (auto provider = iconProvider()) {
result.setFlag(DontUseCustomDirectoryIcons,

View File

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

View File

@ -47,6 +47,7 @@ public:
tst_QColorSpace();
private slots:
void movable();
void namedColorSpaces_data();
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()
{
QTest::addColumn<QColorSpace::ColorSpaceId>("colorSpaceId");