Merge remote-tracking branch 'origin/5.6' into dev

Conflicts:
	src/corelib/io/qprocess.cpp
	src/corelib/io/qprocess_unix.cpp
	src/network/kernel/qnetworkinterface_winrt.cpp
	tools/configure/configureapp.cpp

Change-Id: I47df00a01597d2e63b334b492b3b4221b29f58ea
This commit is contained in:
Liang Qi 2015-11-18 09:01:51 +01:00
commit c7934f2489
166 changed files with 10841 additions and 7132 deletions

View File

@ -812,6 +812,7 @@ foreach my $lib (@modules_to_sync) {
my $is_qt = !($module =~ s/^!//); my $is_qt = !($module =~ s/^!//);
my @dirs = split(/;/, $module); my @dirs = split(/;/, $module);
my $dir = $dirs[0]; my $dir = $dirs[0];
shift @dirs if ($dir =~ s/^>//);
my $pathtoheaders = ""; my $pathtoheaders = "";
$pathtoheaders = $moduleheaders{$lib} if ($moduleheaders{$lib}); $pathtoheaders = $moduleheaders{$lib} if ($moduleheaders{$lib});

41
configure vendored
View File

@ -621,6 +621,7 @@ CFG_MYSQL_CONFIG=
CFG_PSQL_CONFIG= CFG_PSQL_CONFIG=
CFG_DEBUG_RELEASE=no CFG_DEBUG_RELEASE=no
CFG_FORCEDEBUGINFO=no CFG_FORCEDEBUGINFO=no
CFG_RELEASE_TOOLS=no
CFG_SHARED=yes CFG_SHARED=yes
CFG_SM=auto CFG_SM=auto
CFG_XSHAPE=auto CFG_XSHAPE=auto
@ -658,7 +659,6 @@ CFG_BUILD_PARTS=""
CFG_NOBUILD_PARTS="" CFG_NOBUILD_PARTS=""
CFG_SKIP_MODULES="" CFG_SKIP_MODULES=""
CFG_COMPILE_EXAMPLES=yes CFG_COMPILE_EXAMPLES=yes
CFG_RELEASE_QMAKE=no
CFG_AUDIO_BACKEND=auto CFG_AUDIO_BACKEND=auto
CFG_QML_DEBUG=yes CFG_QML_DEBUG=yes
CFG_PKGCONFIG=auto CFG_PKGCONFIG=auto
@ -1460,13 +1460,6 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes UNKNOWN_OPT=yes
fi fi
;; ;;
optimized-qmake)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_RELEASE_QMAKE="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
release) release)
if [ "$VAL" = "yes" ]; then if [ "$VAL" = "yes" ]; then
CFG_DEBUG=no CFG_DEBUG=no
@ -1482,6 +1475,13 @@ while [ "$#" -gt 0 ]; do
force-debug-info) force-debug-info)
CFG_FORCEDEBUGINFO="$VAL" CFG_FORCEDEBUGINFO="$VAL"
;; ;;
optimized-qmake|optimized-tools)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_RELEASE_TOOLS="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
developer-build) developer-build)
CFG_DEV="yes" CFG_DEV="yes"
;; ;;
@ -2444,6 +2444,9 @@ Configure options:
-developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting) -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting)
* -no-optimized-tools ... Do not build optimized host tools even in debug build.
-optimized-tools ...... Build optimized host tools even in debug build.
-opensource ........ Compile and link the Open-Source Edition of Qt. -opensource ........ Compile and link the Open-Source Edition of Qt.
-commercial ........ Compile and link the Commercial Edition of Qt. -commercial ........ Compile and link the Commercial Edition of Qt.
@ -2635,9 +2638,6 @@ Additional options:
-silent ............ Reduce the build output so that warnings and errors -silent ............ Reduce the build output so that warnings and errors
can be seen more easily. can be seen more easily.
* -no-optimized-qmake ... Do not build qmake optimized.
-optimized-qmake ...... Build qmake optimized.
-no-nis ............ Do not compile NIS support. -no-nis ............ Do not compile NIS support.
* -nis ............... Compile NIS support. * -nis ............... Compile NIS support.
@ -3409,6 +3409,10 @@ if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG force_debug_info" QMAKE_CONFIG="$QMAKE_CONFIG force_debug_info"
fi fi
if [ "$CFG_RELEASE_TOOLS" = "yes" ]; then
QT_CONFIG="$QT_CONFIG release_tools"
fi
if [ "$XPLATFORM_MAC" = "yes" ]; then if [ "$XPLATFORM_MAC" = "yes" ]; then
[ "$CFG_PKGCONFIG" = "auto" ] && CFG_PKGCONFIG="no" [ "$CFG_PKGCONFIG" = "auto" ] && CFG_PKGCONFIG="no"
fi fi
@ -4039,7 +4043,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
setBootstrapVariable QMAKE_LFLAGS setBootstrapVariable QMAKE_LFLAGS
setBootstrapVariable QMAKE_LFLAGS_GCSECTIONS setBootstrapVariable QMAKE_LFLAGS_GCSECTIONS
if [ "$CFG_RELEASE_QMAKE" = "yes" ]; then if [ "$CFG_RELEASE_TOOLS" = "yes" ]; then
setBootstrapVariable QMAKE_CFLAGS_RELEASE setBootstrapVariable QMAKE_CFLAGS_RELEASE
setBootstrapVariable QMAKE_CXXFLAGS_RELEASE setBootstrapVariable QMAKE_CXXFLAGS_RELEASE
EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)" EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)"
@ -7334,10 +7338,12 @@ release="release"
[ "$CFG_FORCEDEBUGINFO" = "yes" ] && release="release (with debug info)" [ "$CFG_FORCEDEBUGINFO" = "yes" ] && release="release (with debug info)"
[ "$CFG_DEBUG" = "yes" ] && build_mode="debug" || build_mode=$release [ "$CFG_DEBUG" = "yes" ] && build_mode="debug" || build_mode=$release
if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
echo " Mode ................... debug and $release; default link: $build_mode" build_mode="debug and $release; default link: $build_mode"
else
echo " Mode ................... $build_mode"
fi fi
if [ "$CFG_RELEASE_TOOLS" = "yes" ]; then
build_mode="$build_mode; optimized tools"
fi
echo " Mode ................... $build_mode"
unset build_mode release unset build_mode release
echo " Using sanitizer(s)...... $CFG_SANITIZERS" echo " Using sanitizer(s)...... $CFG_SANITIZERS"
echo " Using C++ standard ..... $CFG_STDCXX" echo " Using C++ standard ..... $CFG_STDCXX"
@ -7501,6 +7507,11 @@ if [ "$CFG_QREAL" = double ] && [ "$CFG_ARCH" = arm ]; then
echo "NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1." echo "NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1."
echo "Configure with '-qreal float' to create a build that is binary compatible with 5.1." echo "Configure with '-qreal float' to create a build that is binary compatible with 5.1."
fi fi
if [ "$CFG_RELEASE_TOOLS" = "yes" -a \( "$CFG_DEBUG" = "no" -o "$CFG_DEBUG_RELEASE" = "yes" \) ]; then
echo
echo "NOTE: -optimized-tools is not useful in -release mode."
echo
fi
exec 1>&3 3>&- # restore stdout exec 1>&3 3>&- # restore stdout
cat $outpath/config.summary # display config feedback to user cat $outpath/config.summary # display config feedback to user

View File

@ -41,7 +41,11 @@
</widget> </widget>
</item> </item>
<item row="3" column="1" > <item row="3" column="1" >
<widget class="QLineEdit" name="passwordEdit" /> <widget class="QLineEdit" name="passwordEdit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item> </item>
<item row="5" column="0" colspan="2" > <item row="5" column="0" colspan="2" >
<widget class="QDialogButtonBox" name="buttonBox" > <widget class="QDialogButtonBox" name="buttonBox" >

View File

@ -40,85 +40,134 @@
#include <QtWidgets> #include <QtWidgets>
#include <QtNetwork> #include <QtNetwork>
#include <QUrl>
#include "httpwindow.h" #include "httpwindow.h"
#include "ui_authenticationdialog.h" #include "ui_authenticationdialog.h"
#ifndef QT_NO_SSL
static const char defaultUrl[] = "https://qt-project.org/";
#else
static const char defaultUrl[] = "http://qt-project.org/";
#endif
static const char defaultFileName[] = "index.html";
ProgressDialog::ProgressDialog(const QUrl &url, QWidget *parent)
: QProgressDialog(parent)
{
setWindowTitle(tr("Download Progress"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setLabelText(tr("Downloading %1.").arg(url.toDisplayString()));
setMinimum(0);
setValue(0);
setMinimumDuration(0);
}
void ProgressDialog::networkReplyProgress(qint64 bytesRead, qint64 totalBytes)
{
setMaximum(totalBytes);
setValue(bytesRead);
}
HttpWindow::HttpWindow(QWidget *parent) HttpWindow::HttpWindow(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, statusLabel(new QLabel(tr("Please enter the URL of a file you want to download.\n\n"), this))
, urlLineEdit(new QLineEdit(defaultUrl))
, downloadButton(new QPushButton(tr("Download")))
, launchCheckBox(new QCheckBox("Launch file"))
, defaultFileLineEdit(new QLineEdit(defaultFileName))
, downloadDirectoryLineEdit(new QLineEdit)
, reply(Q_NULLPTR)
, file(Q_NULLPTR)
, httpRequestAborted(false)
{ {
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("HTTP"));
connect(&qnam, &QNetworkAccessManager::authenticationRequired,
this, &HttpWindow::slotAuthenticationRequired);
#ifndef QT_NO_SSL #ifndef QT_NO_SSL
urlLineEdit = new QLineEdit("https://qt-project.org/"); connect(&qnam, &QNetworkAccessManager::sslErrors,
#else this, &HttpWindow::sslErrors);
urlLineEdit = new QLineEdit("http://qt-project.org/");
#endif #endif
urlLabel = new QLabel(tr("&URL:")); QFormLayout *formLayout = new QFormLayout;
urlLabel->setBuddy(urlLineEdit); urlLineEdit->setClearButtonEnabled(true);
statusLabel = new QLabel(tr("Please enter the URL of a file you want to " connect(urlLineEdit, &QLineEdit::textChanged,
"download.")); this, &HttpWindow::enableDownloadButton);
formLayout->addRow(tr("&URL:"), urlLineEdit);
QString downloadDirectory = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
if (downloadDirectory.isEmpty() || !QFileInfo(downloadDirectory).isDir())
downloadDirectory = QDir::currentPath();
downloadDirectoryLineEdit->setText(QDir::toNativeSeparators(downloadDirectory));
formLayout->addRow(tr("&Download directory:"), downloadDirectoryLineEdit);
formLayout->addRow(tr("Default &file:"), defaultFileLineEdit);
launchCheckBox->setChecked(true);
formLayout->addRow(launchCheckBox);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->addLayout(formLayout);
mainLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
statusLabel->setWordWrap(true); statusLabel->setWordWrap(true);
mainLayout->addWidget(statusLabel);
downloadButton = new QPushButton(tr("Download"));
downloadButton->setDefault(true); downloadButton->setDefault(true);
quitButton = new QPushButton(tr("Quit")); connect(downloadButton, &QAbstractButton::clicked, this, &HttpWindow::downloadFile);
QPushButton *quitButton = new QPushButton(tr("Quit"));
quitButton->setAutoDefault(false); quitButton->setAutoDefault(false);
connect(quitButton, &QAbstractButton::clicked, this, &QWidget::close);
buttonBox = new QDialogButtonBox; QDialogButtonBox *buttonBox = new QDialogButtonBox;
buttonBox->addButton(downloadButton, QDialogButtonBox::ActionRole); buttonBox->addButton(downloadButton, QDialogButtonBox::ActionRole);
buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole); buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole);
progressDialog = new QProgressDialog(this);
connect(urlLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(enableDownloadButton()));
connect(&qnam, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
this, SLOT(slotAuthenticationRequired(QNetworkReply*,QAuthenticator*)));
#ifndef QT_NO_SSL
connect(&qnam, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
this, SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
#endif
connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload()));
connect(downloadButton, SIGNAL(clicked()), this, SLOT(downloadFile()));
connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
QHBoxLayout *topLayout = new QHBoxLayout;
topLayout->addWidget(urlLabel);
topLayout->addWidget(urlLineEdit);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(topLayout);
mainLayout->addWidget(statusLabel);
mainLayout->addWidget(buttonBox); mainLayout->addWidget(buttonBox);
setLayout(mainLayout);
setWindowTitle(tr("HTTP"));
urlLineEdit->setFocus(); urlLineEdit->setFocus();
} }
void HttpWindow::startRequest(QUrl url) void HttpWindow::startRequest(const QUrl &requestedUrl)
{ {
url = requestedUrl;
httpRequestAborted = false;
reply = qnam.get(QNetworkRequest(url)); reply = qnam.get(QNetworkRequest(url));
connect(reply, SIGNAL(finished()), connect(reply, &QNetworkReply::finished, this, &HttpWindow::httpFinished);
this, SLOT(httpFinished())); connect(reply, &QIODevice::readyRead, this, &HttpWindow::httpReadyRead);
connect(reply, SIGNAL(readyRead()),
this, SLOT(httpReadyRead())); ProgressDialog *progressDialog = new ProgressDialog(url, this);
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), progressDialog->setAttribute(Qt::WA_DeleteOnClose);
this, SLOT(updateDataReadProgress(qint64,qint64))); connect(progressDialog, &QProgressDialog::canceled, this, &HttpWindow::cancelDownload);
connect(reply, &QNetworkReply::downloadProgress, progressDialog, &ProgressDialog::networkReplyProgress);
connect(reply, &QNetworkReply::finished, progressDialog, &ProgressDialog::hide);
progressDialog->show();
statusLabel->setText(tr("Downloading %1...").arg(url.toString()));
} }
void HttpWindow::downloadFile() void HttpWindow::downloadFile()
{ {
url = urlLineEdit->text(); const QString urlSpec = urlLineEdit->text().trimmed();
if (urlSpec.isEmpty())
return;
QFileInfo fileInfo(url.path()); const QUrl newUrl = QUrl::fromUserInput(urlSpec);
QString fileName = fileInfo.fileName(); if (!newUrl.isValid()) {
QMessageBox::information(this, tr("Error"),
tr("Invalid URL: %1: %2").arg(urlSpec, newUrl.errorString()));
return;
}
QString fileName = newUrl.fileName();
if (fileName.isEmpty()) if (fileName.isEmpty())
fileName = "index.html"; fileName = defaultFileLineEdit->text().trimmed();
if (fileName.isEmpty())
fileName = defaultFileName;
QString downloadDirectory = QDir::cleanPath(downloadDirectoryLineEdit->text().trimmed());
if (!downloadDirectory.isEmpty() && QFileInfo(downloadDirectory).isDir())
fileName.prepend(downloadDirectory + '/');
if (QFile::exists(fileName)) { if (QFile::exists(fileName)) {
if (QMessageBox::question(this, tr("HTTP"), if (QMessageBox::question(this, tr("Overwrite Existing File"),
tr("There already exists a file called %1 in " tr("There already exists a file called %1 in "
"the current directory. Overwrite?").arg(fileName), "the current directory. Overwrite?").arg(fileName),
QMessageBox::Yes|QMessageBox::No, QMessageBox::No) QMessageBox::Yes|QMessageBox::No, QMessageBox::No)
@ -127,23 +176,27 @@ void HttpWindow::downloadFile()
QFile::remove(fileName); QFile::remove(fileName);
} }
file = new QFile(fileName); file = openFileForWrite(fileName);
if (!file->open(QIODevice::WriteOnly)) { if (!file)
QMessageBox::information(this, tr("HTTP"),
tr("Unable to save the file %1: %2.")
.arg(fileName).arg(file->errorString()));
delete file;
file = 0;
return; return;
}
progressDialog->setWindowTitle(tr("HTTP"));
progressDialog->setLabelText(tr("Downloading %1.").arg(fileName));
downloadButton->setEnabled(false); downloadButton->setEnabled(false);
// schedule the request // schedule the request
httpRequestAborted = false; startRequest(newUrl);
startRequest(url); }
QFile *HttpWindow::openFileForWrite(const QString &fileName)
{
QScopedPointer<QFile> file(new QFile(fileName));
if (!file->open(QIODevice::WriteOnly)) {
QMessageBox::information(this, tr("Error"),
tr("Unable to save the file %1: %2.")
.arg(QDir::toNativeSeparators(fileName),
file->errorString()));
return Q_NULLPTR;
}
return file.take();
} }
void HttpWindow::cancelDownload() void HttpWindow::cancelDownload()
@ -156,52 +209,56 @@ void HttpWindow::cancelDownload()
void HttpWindow::httpFinished() void HttpWindow::httpFinished()
{ {
QFileInfo fi;
if (file) {
fi.setFile(file->fileName());
file->close();
delete file;
file = Q_NULLPTR;
}
if (httpRequestAborted) { if (httpRequestAborted) {
if (file) {
file->close();
file->remove();
delete file;
file = 0;
}
reply->deleteLater(); reply->deleteLater();
progressDialog->hide(); reply = Q_NULLPTR;
return; return;
} }
progressDialog->hide();
file->flush();
file->close();
QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
if (reply->error()) { if (reply->error()) {
file->remove(); QFile::remove(fi.absoluteFilePath());
QMessageBox::information(this, tr("HTTP"), statusLabel->setText(tr("Download failed:\n%1.").arg(reply->errorString()));
tr("Download failed: %1.")
.arg(reply->errorString()));
downloadButton->setEnabled(true);
} else if (!redirectionTarget.isNull()) {
QUrl newUrl = url.resolved(redirectionTarget.toUrl());
if (QMessageBox::question(this, tr("HTTP"),
tr("Redirect to %1 ?").arg(newUrl.toString()),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
url = newUrl;
reply->deleteLater();
file->open(QIODevice::WriteOnly);
file->resize(0);
startRequest(url);
return;
}
} else {
QString fileName = QFileInfo(QUrl(urlLineEdit->text()).path()).fileName();
statusLabel->setText(tr("Downloaded %1 to %2.").arg(fileName).arg(QDir::currentPath()));
downloadButton->setEnabled(true); downloadButton->setEnabled(true);
reply->deleteLater();
reply = Q_NULLPTR;
return;
} }
const QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
reply->deleteLater(); reply->deleteLater();
reply = 0; reply = Q_NULLPTR;
delete file;
file = 0; if (!redirectionTarget.isNull()) {
const QUrl redirectedUrl = url.resolved(redirectionTarget.toUrl());
if (QMessageBox::question(this, tr("Redirect"),
tr("Redirect to %1 ?").arg(redirectedUrl.toString()),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
downloadButton->setEnabled(true);
return;
}
file = openFileForWrite(fi.absoluteFilePath());
if (!file) {
downloadButton->setEnabled(true);
return;
}
startRequest(redirectedUrl);
return;
}
statusLabel->setText(tr("Downloaded %1 bytes to %2\nin\n%3")
.arg(fi.size()).arg(fi.fileName(), QDir::toNativeSeparators(fi.absolutePath())));
if (launchCheckBox->isChecked())
QDesktopServices::openUrl(QUrl::fromLocalFile(fi.absoluteFilePath()));
downloadButton->setEnabled(true);
} }
void HttpWindow::httpReadyRead() void HttpWindow::httpReadyRead()
@ -214,15 +271,6 @@ void HttpWindow::httpReadyRead()
file->write(reply->readAll()); file->write(reply->readAll());
} }
void HttpWindow::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes)
{
if (httpRequestAborted)
return;
progressDialog->setMaximum(totalBytes);
progressDialog->setValue(bytesRead);
}
void HttpWindow::enableDownloadButton() void HttpWindow::enableDownloadButton()
{ {
downloadButton->setEnabled(!urlLineEdit->text().isEmpty()); downloadButton->setEnabled(!urlLineEdit->text().isEmpty());
@ -230,18 +278,18 @@ void HttpWindow::enableDownloadButton()
void HttpWindow::slotAuthenticationRequired(QNetworkReply*,QAuthenticator *authenticator) void HttpWindow::slotAuthenticationRequired(QNetworkReply*,QAuthenticator *authenticator)
{ {
QDialog dlg; QDialog authenticationDialog;
Ui::Dialog ui; Ui::Dialog ui;
ui.setupUi(&dlg); ui.setupUi(&authenticationDialog);
dlg.adjustSize(); authenticationDialog.adjustSize();
ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm()).arg(url.host())); ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm(), url.host()));
// Did the URL have information? Fill the UI // Did the URL have information? Fill the UI
// This is only relevant if the URL-supplied credentials were wrong // This is only relevant if the URL-supplied credentials were wrong
ui.userEdit->setText(url.userName()); ui.userEdit->setText(url.userName());
ui.passwordEdit->setText(url.password()); ui.passwordEdit->setText(url.password());
if (dlg.exec() == QDialog::Accepted) { if (authenticationDialog.exec() == QDialog::Accepted) {
authenticator->setUser(ui.userEdit->text()); authenticator->setUser(ui.userEdit->text());
authenticator->setPassword(ui.passwordEdit->text()); authenticator->setPassword(ui.passwordEdit->text());
} }
@ -253,12 +301,12 @@ void HttpWindow::sslErrors(QNetworkReply*,const QList<QSslError> &errors)
QString errorString; QString errorString;
foreach (const QSslError &error, errors) { foreach (const QSslError &error, errors) {
if (!errorString.isEmpty()) if (!errorString.isEmpty())
errorString += ", "; errorString += '\n';
errorString += error.errorString(); errorString += error.errorString();
} }
if (QMessageBox::warning(this, tr("HTTP"), if (QMessageBox::warning(this, tr("SSL Errors"),
tr("One or more SSL errors has occurred: %1").arg(errorString), tr("One or more SSL errors has occurred:\n%1").arg(errorString),
QMessageBox::Ignore | QMessageBox::Abort) == QMessageBox::Ignore) { QMessageBox::Ignore | QMessageBox::Abort) == QMessageBox::Ignore) {
reply->ignoreSslErrors(); reply->ignoreSslErrors();
} }

View File

@ -41,39 +41,46 @@
#ifndef HTTPWINDOW_H #ifndef HTTPWINDOW_H
#define HTTPWINDOW_H #define HTTPWINDOW_H
#include <QDialog> #include <QProgressDialog>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QUrl> #include <QUrl>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QDialogButtonBox;
class QFile; class QFile;
class QLabel; class QLabel;
class QLineEdit; class QLineEdit;
class QProgressDialog;
class QPushButton; class QPushButton;
class QSslError; class QSslError;
class QAuthenticator; class QAuthenticator;
class QNetworkReply; class QNetworkReply;
class QCheckBox;
QT_END_NAMESPACE QT_END_NAMESPACE
class ProgressDialog : public QProgressDialog {
Q_OBJECT
public:
explicit ProgressDialog(const QUrl &url, QWidget *parent = Q_NULLPTR);
public slots:
void networkReplyProgress(qint64 bytesRead, qint64 totalBytes);
};
class HttpWindow : public QDialog class HttpWindow : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
HttpWindow(QWidget *parent = 0); explicit HttpWindow(QWidget *parent = Q_NULLPTR);
void startRequest(QUrl url); void startRequest(const QUrl &requestedUrl);
private slots: private slots:
void downloadFile(); void downloadFile();
void cancelDownload(); void cancelDownload();
void httpFinished(); void httpFinished();
void httpReadyRead(); void httpReadyRead();
void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
void enableDownloadButton(); void enableDownloadButton();
void slotAuthenticationRequired(QNetworkReply*,QAuthenticator *); void slotAuthenticationRequired(QNetworkReply*,QAuthenticator *);
#ifndef QT_NO_SSL #ifndef QT_NO_SSL
@ -81,19 +88,19 @@ private slots:
#endif #endif
private: private:
QFile *openFileForWrite(const QString &fileName);
QLabel *statusLabel; QLabel *statusLabel;
QLabel *urlLabel;
QLineEdit *urlLineEdit; QLineEdit *urlLineEdit;
QProgressDialog *progressDialog;
QPushButton *downloadButton; QPushButton *downloadButton;
QPushButton *quitButton; QCheckBox *launchCheckBox;
QDialogButtonBox *buttonBox; QLineEdit *defaultFileLineEdit;
QLineEdit *downloadDirectoryLineEdit;
QUrl url; QUrl url;
QNetworkAccessManager qnam; QNetworkAccessManager qnam;
QNetworkReply *reply; QNetworkReply *reply;
QFile *file; QFile *file;
int httpGetId;
bool httpRequestAborted; bool httpRequestAborted;
}; };

View File

@ -39,6 +39,7 @@
****************************************************************************/ ****************************************************************************/
#include <QApplication> #include <QApplication>
#include <QDesktopWidget>
#include <QDir> #include <QDir>
#include "httpwindow.h" #include "httpwindow.h"
@ -47,8 +48,10 @@ int main(int argc, char *argv[])
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
HttpWindow httpWin; HttpWindow httpWin;
const QRect availableSize = QApplication::desktop()->availableGeometry(&httpWin);
httpWin.resize(availableSize.width() / 5, availableSize.height() / 5);
httpWin.move((availableSize.width() - httpWin.width()) / 2, (availableSize.height() - httpWin.height()) / 2);
httpWin.show(); httpWin.show();
return app.exec(); return app.exec();

View File

@ -285,9 +285,9 @@
\snippet tools/plugandpaint/main.cpp 0 \snippet tools/plugandpaint/main.cpp 0
The argument to Q_IMPORT_PLUGIN() is the plugin's name, as The argument to Q_IMPORT_PLUGIN() is the plugin name, which corresponds
specified with Q_PLUGIN_METADATA() in the \l{Exporting the with the name of the class that declares metadata for the plugin with
Plugin}{plugin}. Q_PLUGIN_METADATA().
In the \c .pro file, we need to specify the static library. In the \c .pro file, we need to specify the static library.
Here's the project file for building Plug & Paint: Here's the project file for building Plug & Paint:

View File

@ -8,13 +8,16 @@ QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/opt/vc/lib
QMAKE_LIBDIR_OPENGL_ES2 = $$[QT_SYSROOT]/opt/vc/lib QMAKE_LIBDIR_OPENGL_ES2 = $$[QT_SYSROOT]/opt/vc/lib
QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2 QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2
QMAKE_LIBDIR_OPENVG = $$QMAKE_LIBDIR_OPENGL_ES2
QMAKE_INCDIR_EGL = $$[QT_SYSROOT]/opt/vc/include \ QMAKE_INCDIR_EGL = $$[QT_SYSROOT]/opt/vc/include \
$$[QT_SYSROOT]/opt/vc/include/interface/vcos/pthreads \ $$[QT_SYSROOT]/opt/vc/include/interface/vcos/pthreads \
$$[QT_SYSROOT]/opt/vc/include/interface/vmcs_host/linux $$[QT_SYSROOT]/opt/vc/include/interface/vmcs_host/linux
QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL} QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL}
QMAKE_INCDIR_OPENVG = $${QMAKE_INCDIR_EGL}
QMAKE_LIBS_EGL = -lEGL -lGLESv2 QMAKE_LIBS_EGL = -lEGL -lGLESv2
QMAKE_LIBS_OPENVG = -lEGL -lOpenVG -lGLESv2
contains(DISTRO, squeeze) { contains(DISTRO, squeeze) {
#Debian Squeeze: Legacy everything #Debian Squeeze: Legacy everything

View File

@ -6,17 +6,21 @@ QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/opt/vc/lib
QMAKE_LIBDIR_OPENGL_ES2 = $$[QT_SYSROOT]/opt/vc/lib QMAKE_LIBDIR_OPENGL_ES2 = $$[QT_SYSROOT]/opt/vc/lib
QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2 QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2
QMAKE_LIBDIR_OPENVG = $$QMAKE_LIBDIR_OPENGL_ES2
QMAKE_INCDIR_EGL = $$[QT_SYSROOT]/opt/vc/include \ QMAKE_INCDIR_EGL = $$[QT_SYSROOT]/opt/vc/include \
$$[QT_SYSROOT]/opt/vc/include/interface/vcos/pthreads \ $$[QT_SYSROOT]/opt/vc/include/interface/vcos/pthreads \
$$[QT_SYSROOT]/opt/vc/include/interface/vmcs_host/linux $$[QT_SYSROOT]/opt/vc/include/interface/vmcs_host/linux
QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL} QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL}
QMAKE_INCDIR_OPENVG = $${QMAKE_INCDIR_EGL}
QMAKE_LIBS_EGL = -lEGL -lGLESv2 QMAKE_LIBS_EGL = -lEGL -lGLESv2
QMAKE_CFLAGS += -march=armv7-a -marm -mthumb-interwork -mfpu=neon-vfpv4 -mtune=cortex-a7 -mabi=aapcs-linux QMAKE_LIBS_OPENVG = -lEGL -lOpenVG -lGLESv2
QMAKE_CFLAGS += -march=armv7-a -marm -mthumb-interwork -mfpu=neon-vfpv4 -mtune=cortex-a7 -mabi=aapcs-linux
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
DISTRO_OPTS += hard-float DISTRO_OPTS += hard-float
DISTRO_OPTS += deb-multi-arch
# Preferred eglfs backend # Preferred eglfs backend
EGLFS_DEVICE_INTEGRATION = eglfs_brcm EGLFS_DEVICE_INTEGRATION = eglfs_brcm

View File

@ -76,11 +76,6 @@ for(ever) {
next() next()
} }
target_qt:isEqual(TARGET, $$MODULE_NAME) {
warning("$$TARGET cannot have a QT$$var_sfx of $$QTLIB")
next()
}
contains(MODULE_CONFIG, internal_module): \ contains(MODULE_CONFIG, internal_module): \
using_privates = true using_privates = true
contains(MODULE_CONFIG, ltcg): \ contains(MODULE_CONFIG, ltcg): \
@ -155,7 +150,7 @@ qt_module_deps = $$resolve_depends(qt_module_deps, "QT.")
!no_qt_rpath:!static:contains(QT_CONFIG, rpath):!contains(QT_CONFIG, static):\ !no_qt_rpath:!static:contains(QT_CONFIG, rpath):!contains(QT_CONFIG, static):\
contains(qt_module_deps, core) { contains(qt_module_deps, core) {
relative_qt_rpath:!isEmpty(QMAKE_LFLAGS_REL_RPATH):contains(INSTALLS, target):\ relative_qt_rpath:!isEmpty(QMAKE_REL_RPATH_BASE):contains(INSTALLS, target):\
isEmpty(target.files):isEmpty(target.commands):isEmpty(target.extra) { isEmpty(target.files):isEmpty(target.commands):isEmpty(target.extra) {
mac { mac {
if(equals(TEMPLATE, app):app_bundle)|\ if(equals(TEMPLATE, app):app_bundle)|\
@ -349,11 +344,7 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) {
QT_PLUGINPATH = $$eval(QT_PLUGIN.$${QTPLUG}.TYPE) QT_PLUGINPATH = $$eval(QT_PLUGIN.$${QTPLUG}.TYPE)
# Generate the plugin linker line # Generate the plugin linker line
target_qt:isEqual(TARGET, QTPLUG) { QT_LINKAGE = -l$${QTPLUG}$$qtPlatformTargetSuffix()
warning($$TARGET cannot have a QTPLUGIN of $$QTPLUG)
} else {
QT_LINKAGE = -l$${QTPLUG}$$qtPlatformTargetSuffix()
}
# Only link against plugin in static builds # Only link against plugin in static builds
isEqual(QT_CURRENT_VERIFY, QTPLUGIN): { isEqual(QT_CURRENT_VERIFY, QTPLUGIN): {

View File

@ -21,7 +21,7 @@ QMAKE_LFLAGS += $$QMAKE_LFLAGS_GCSECTIONS
host_build: QT -= gui # no host tool will ever use gui host_build: QT -= gui # no host tool will ever use gui
host_build:force_bootstrap { host_build:force_bootstrap {
!build_pass: CONFIG += release !build_pass:contains(QT_CONFIG, release_tools): CONFIG += release
contains(QT, core(-private)?|xml) { contains(QT, core(-private)?|xml) {
QT -= core core-private xml QT -= core core-private xml
QT += bootstrap-private QT += bootstrap-private

View File

@ -32,7 +32,7 @@ host_build {
QMAKE_CFLAGS += $$QMAKE_CFLAGS_SPLIT_SECTIONS QMAKE_CFLAGS += $$QMAKE_CFLAGS_SPLIT_SECTIONS
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_SPLIT_SECTIONS QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_SPLIT_SECTIONS
force_bootstrap { force_bootstrap {
!build_pass: CONFIG += release !build_pass:contains(QT_CONFIG, release_tools): CONFIG += release
contains(QT, core(-private)?|xml) { contains(QT, core(-private)?|xml) {
QT -= core core-private xml QT -= core core-private xml
QT += bootstrap-private QT += bootstrap-private
@ -42,6 +42,9 @@ host_build {
} }
} }
mac:CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework): \
CONFIG += qt_framework
CONFIG += relative_qt_rpath # Qt libraries should be relocatable CONFIG += relative_qt_rpath # Qt libraries should be relocatable
ucmodule = $$upper($$MODULE) ucmodule = $$upper($$MODULE)
@ -53,6 +56,8 @@ internal_module: \
else: \ else: \
MODULE_DEPENDS = $$replace(QT, -private$, ) MODULE_DEPENDS = $$replace(QT, -private$, )
MODULE_DEPENDS = $$unique(MODULE_DEPENDS) MODULE_DEPENDS = $$unique(MODULE_DEPENDS)
contains(MODULE_DEPENDS, $$MODULE): \
error("$$TARGET depends on itself.")
contains(TARGET, QtAddOn.*): \ contains(TARGET, QtAddOn.*): \
MODULE_DEFINE = QT_ADDON_$${ucmodule}_LIB MODULE_DEFINE = QT_ADDON_$${ucmodule}_LIB
@ -101,11 +106,11 @@ else: \
DEFINES += QT_BUILD_$${ucmodule}_LIB DEFINES += QT_BUILD_$${ucmodule}_LIB
# OS X and iOS frameworks # OS X and iOS frameworks
mac:CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) { qt_framework {
# Set the CFBundleIdentifier prefix for Qt frameworks # Set the CFBundleIdentifier prefix for Qt frameworks
QMAKE_TARGET_BUNDLE_PREFIX = org.qt-project QMAKE_TARGET_BUNDLE_PREFIX = org.qt-project
#QMAKE_FRAMEWORK_VERSION = 4.0 #QMAKE_FRAMEWORK_VERSION = 4.0
CONFIG += sliced_bundle qt_framework CONFIG += sliced_bundle
header_module { header_module {
CONFIG += bundle CONFIG += bundle
QMAKE_BUNDLE_EXTENSION = .framework QMAKE_BUNDLE_EXTENSION = .framework
@ -189,7 +194,7 @@ equals(QT_ARCH, i386):contains(QT_CPU_FEATURES.$$QT_ARCH, sse2):compiler_support
android: CONFIG += qt_android_deps no_linker_version_script android: CONFIG += qt_android_deps no_linker_version_script
unix:!isEmpty(QMAKE_LFLAGS_VERSION_SCRIPT):!no_linker_version_script:!static { !header_module:unix:!isEmpty(QMAKE_LFLAGS_VERSION_SCRIPT):!no_linker_version_script:!static {
verscript = $$OUT_PWD/$${TARGET}.version verscript = $$OUT_PWD/$${TARGET}.version
QMAKE_LFLAGS += $${QMAKE_LFLAGS_VERSION_SCRIPT}$$verscript QMAKE_LFLAGS += $${QMAKE_LFLAGS_VERSION_SCRIPT}$$verscript
@ -234,7 +239,7 @@ load(qt_installs)
load(qt_targets) load(qt_targets)
# this builds on top of qt_common # this builds on top of qt_common
unix|mingw { !internal_module:!qt_framework:if(unix|mingw) {
CONFIG += create_pc CONFIG += create_pc
QMAKE_PKGCONFIG_DESTDIR = pkgconfig QMAKE_PKGCONFIG_DESTDIR = pkgconfig
host_build: \ host_build: \

View File

@ -25,9 +25,12 @@ load(qt_build_paths)
!silent: message($$QMAKE_SYNCQT) !silent: message($$QMAKE_SYNCQT)
system($$QMAKE_SYNCQT)|error("Failed to run: $$QMAKE_SYNCQT") system($$QMAKE_SYNCQT)|error("Failed to run: $$QMAKE_SYNCQT")
include-distclean.commands = $$QMAKE_DEL_TREE $$shell_quote($$shell_path($$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME)) !minimal_syncqt {
QMAKE_EXTRA_TARGETS += include-distclean include-distclean.commands = \
DISTCLEAN_DEPS += include-distclean $$QMAKE_DEL_TREE $$shell_quote($$shell_path($$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME))
QMAKE_EXTRA_TARGETS += include-distclean
DISTCLEAN_DEPS += include-distclean
}
} }
minimal_syncqt: return() minimal_syncqt: return()
@ -38,6 +41,9 @@ git_build: \
else: \ else: \
INC_PATH = $$MODULE_BASE_INDIR INC_PATH = $$MODULE_BASE_INDIR
include($$INC_PATH/include/$$MODULE_INCNAME/headers.pri, "", true) include($$INC_PATH/include/$$MODULE_INCNAME/headers.pri, "", true)
CONFIG += qt_install_headers
alien_syncqt: return()
for (injection, SYNCQT.INJECTIONS) { for (injection, SYNCQT.INJECTIONS) {
injects = $$split(injection, :) injects = $$split(injection, :)
@ -82,8 +88,6 @@ SYNCQT.HEADER_FILES += $$MODULE_MASTER_DEPS_HEADER
isEmpty(PRECOMPILED_HEADER): PRECOMPILED_HEADER = $$MODULE_MASTER_DEPS_HEADER isEmpty(PRECOMPILED_HEADER): PRECOMPILED_HEADER = $$MODULE_MASTER_DEPS_HEADER
} }
CONFIG += qt_install_headers
headersclean:!internal_module { headersclean:!internal_module {
# Make sure that the header compiles with our strict options # Make sure that the header compiles with our strict options
hcleanDEFS = -DQT_NO_CAST_TO_ASCII=1 \ hcleanDEFS = -DQT_NO_CAST_TO_ASCII=1 \

View File

@ -55,7 +55,7 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri
module_rundep = module_rundep =
static: \ static: \
module_build_type = staticlib module_build_type = staticlib
else:mac:contains(QT_CONFIG, qt_framework): \ else: qt_framework: \
module_build_type = lib_bundle module_build_type = lib_bundle
else: \ else: \
module_build_type = module_build_type =

View File

@ -10,9 +10,9 @@ DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PH
QMAKE_CFLAGS += -FS QMAKE_CFLAGS += -FS
QMAKE_CXXFLAGS += -FS QMAKE_CXXFLAGS += -FS
QMAKE_LFLAGS += /MACHINE:ARM QMAKE_LFLAGS += /MACHINE:ARM /NODEFAULTLIB:kernel32.lib
QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib kernel32.lib QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib
VCPROJ_ARCH = ARM VCPROJ_ARCH = ARM
MSVC_VER = 14.0 MSVC_VER = 14.0

View File

@ -10,9 +10,9 @@ DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PH
QMAKE_CFLAGS += -FS QMAKE_CFLAGS += -FS
QMAKE_CXXFLAGS += -FS QMAKE_CXXFLAGS += -FS
QMAKE_LFLAGS += /MACHINE:X64 QMAKE_LFLAGS += /MACHINE:X64 /NODEFAULTLIB:kernel32.lib
QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib kernel32.lib QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib
VCPROJ_ARCH = x64 VCPROJ_ARCH = x64
MSVC_VER = 14.0 MSVC_VER = 14.0

View File

@ -10,10 +10,9 @@ DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PH
QMAKE_CFLAGS += -FS QMAKE_CFLAGS += -FS
QMAKE_CXXFLAGS += -FS QMAKE_CXXFLAGS += -FS
QMAKE_LFLAGS += /SAFESEH /MACHINE:X86 QMAKE_LFLAGS += /SAFESEH /MACHINE:X86 /NODEFAULTLIB:kernel32.lib
QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib kernel32.lib
QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib
VCPROJ_ARCH = Win32 VCPROJ_ARCH = Win32
MSVC_VER = 14.0 MSVC_VER = 14.0
WINSDK_VER = 10.0 WINSDK_VER = 10.0

View File

@ -853,8 +853,15 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString(); QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString();
suffixSetting = "$(" + suffixSetting + ")"; suffixSetting = "$(" + suffixSetting + ")";
if (!librarySuffix.isEmpty()) { if (!librarySuffix.isEmpty()) {
library.replace(librarySuffix, suffixSetting); int pos = library.lastIndexOf(librarySuffix + '.');
name.remove(librarySuffix); if (pos == -1) {
warn_msg(WarnLogic, "Failed to find expected suffix '%s' for library '%s'.",
qPrintable(librarySuffix), qPrintable(library));
} else {
library.replace(pos, librarySuffix.length(), suffixSetting);
if (name.endsWith(librarySuffix))
name.chop(librarySuffix.length());
}
} else { } else {
library.replace(name, name + suffixSetting); library.replace(name, name + suffixSetting);
} }

View File

@ -185,7 +185,7 @@ protected:
virtual bool doDepends() const { return Option::mkfile::do_deps; } virtual bool doDepends() const { return Option::mkfile::do_deps; }
void filterIncludedFiles(const char *); void filterIncludedFiles(const char *);
virtual void processSources() { void processSources() {
filterIncludedFiles("SOURCES"); filterIncludedFiles("SOURCES");
filterIncludedFiles("GENERATED_SOURCES"); filterIncludedFiles("GENERATED_SOURCES");
} }

View File

@ -75,7 +75,6 @@ public:
protected: protected:
virtual VCProjectWriter *createProjectWriter(); virtual VCProjectWriter *createProjectWriter();
virtual bool doDepends() const { return false; } //never necesary virtual bool doDepends() const { return false; } //never necesary
virtual void processSources() { filterIncludedFiles("SOURCES"); filterIncludedFiles("GENERATED_SOURCES"); }
using Win32MakefileGenerator::replaceExtraCompilerVariables; using Win32MakefileGenerator::replaceExtraCompilerVariables;
virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &, ReplaceFor); virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &, ReplaceFor);
virtual bool supportsMetaBuild() { return true; } virtual bool supportsMetaBuild() { return true; }

View File

@ -42,6 +42,11 @@ licheck.path = $$[QT_HOST_BINS]
licheck.files = $$PWD/bin/$$QT_LICHECK licheck.files = $$PWD/bin/$$QT_LICHECK
!isEmpty(QT_LICHECK): INSTALLS += licheck !isEmpty(QT_LICHECK): INSTALLS += licheck
#fixqt4headers.pl
fixqt4headers.path = $$[QT_HOST_BINS]
fixqt4headers.files = $$PWD/bin/fixqt4headers.pl
INSTALLS += fixqt4headers
#syncqt #syncqt
syncqt.path = $$[QT_HOST_BINS] syncqt.path = $$[QT_HOST_BINS]
syncqt.files = $$PWD/bin/syncqt.pl syncqt.files = $$PWD/bin/syncqt.pl

6
src/3rdparty/png_dependency.pri vendored Normal file
View File

@ -0,0 +1,6 @@
contains(QT_CONFIG, system-png) {
unix|mingw: LIBS_PRIVATE += -lpng
else: LIBS += libpng.lib
} else: contains(QT_CONFIG, png) {
include($$PWD/libpng.pri)
}

View File

@ -1,351 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2011 Thiago Macieira <thiago@kde.org>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QATOMIC_MIPS_H
#define QATOMIC_MIPS_H
#include <QtCore/qgenericatomic.h>
QT_BEGIN_NAMESPACE
#if 0
// silence syncqt warnings
QT_END_NAMESPACE
#pragma qt_sync_skip_header_check
#pragma qt_sync_stop_processing
#endif
#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT32_IS_SUPPORTED
#define Q_ATOMIC_INT32_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT32_TEST_AND_SET_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_ALWAYS_NATIVE
#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE
#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE
#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE
template <int size> struct QBasicAtomicOps: QGenericAtomicOps<QBasicAtomicOps<size> >
{
template <typename T>
static void acquireMemoryFence(const T &) Q_DECL_NOTHROW;
template <typename T>
static void releaseMemoryFence(const T &) Q_DECL_NOTHROW;
template <typename T>
static void orderedMemoryFence(const T &) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return true; }
template <typename T> static bool ref(T &_q_value) Q_DECL_NOTHROW;
template <typename T> static bool deref(T &_q_value) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return false; }
template <typename T> static bool
testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue = 0) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return true; }
template <typename T> static T fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return true; }
template <typename T> static
T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW;
};
template <typename T> struct QAtomicOps : QBasicAtomicOps<sizeof(T)>
{
typedef T Type;
};
#if defined(Q_CC_GNU)
#if defined(_MIPS_ARCH_MIPS1) || (!defined(Q_CC_CLANG) && defined(__mips) && __mips - 0 == 1)
# error "Sorry, the MIPS1 architecture is not supported"
# error "please set '-march=' to your architecture (e.g., -march=mips32)"
#endif
template <int size> template <typename T> inline
void QBasicAtomicOps<size>::acquireMemoryFence(const T &) Q_DECL_NOTHROW
{
asm volatile (".set push\n"
".set mips32\n"
"sync 0x11\n"
".set pop\n" ::: "memory");
}
template <int size> template <typename T> inline
void QBasicAtomicOps<size>::releaseMemoryFence(const T &) Q_DECL_NOTHROW
{
asm volatile (".set push\n"
".set mips32\n"
"sync 0x12\n"
".set pop\n" ::: "memory");
}
template <int size> template <typename T> inline
void QBasicAtomicOps<size>::orderedMemoryFence(const T &) Q_DECL_NOTHROW
{
asm volatile (".set push\n"
".set mips32\n"
"sync 0\n"
".set pop\n" ::: "memory");
}
template<> template<typename T> inline
bool QBasicAtomicOps<4>::ref(T &_q_value) Q_DECL_NOTHROW
{
T originalValue;
T newValue;
asm volatile("0:\n"
"ll %[originalValue], %[_q_value]\n"
"addiu %[newValue], %[originalValue], %[one]\n"
"sc %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
: [one] "i" (1)
: "cc", "memory");
return originalValue != T(-1);
}
template<> template<typename T> inline
bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW
{
T originalValue;
T newValue;
asm volatile("0:\n"
"ll %[originalValue], %[_q_value]\n"
"addiu %[newValue], %[originalValue], %[minusOne]\n"
"sc %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
: [minusOne] "i" (-1)
: "cc", "memory");
return originalValue != 1;
}
template<> template <typename T> inline
bool QBasicAtomicOps<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
{
T result;
T tempValue;
asm volatile("0:\n"
"ll %[tempValue], %[_q_value]\n"
"xor %[result], %[tempValue], %[expectedValue]\n"
"bnez %[result], 0f\n"
"nop\n"
"move %[tempValue], %[newValue]\n"
"sc %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
"0:\n"
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
: [expectedValue] "r" (expectedValue),
[newValue] "r" (newValue)
: "cc", "memory");
if (currentValue)
*currentValue = tempValue;
return result == 0;
}
template<> template <typename T> inline
T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW
{
T originalValue;
T tempValue;
asm volatile("0:\n"
"ll %[originalValue], %[_q_value]\n"
"move %[tempValue], %[newValue]\n"
"sc %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
: [originalValue] "=&r" (originalValue),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
: [newValue] "r" (newValue)
: "cc", "memory");
return originalValue;
}
template<> template <typename T> inline
T QBasicAtomicOps<4>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
{
T originalValue;
T newValue;
asm volatile("0:\n"
"ll %[originalValue], %[_q_value]\n"
"addu %[newValue], %[originalValue], %[valueToAdd]\n"
"sc %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
: [valueToAdd] "r" (valueToAdd * QAtomicAdditiveType<T>::AddScale)
: "cc", "memory");
return originalValue;
}
#if defined(Q_PROCESSOR_MIPS_64)
#define Q_ATOMIC_INT64_IS_SUPPORTED
#define Q_ATOMIC_INT64_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT64_TEST_AND_SET_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_ALWAYS_NATIVE
template<> struct QAtomicOpsSupport<8> { enum { IsSupported = 1 }; };
template<> template<typename T> inline
bool QBasicAtomicOps<8>::ref(T &_q_value) Q_DECL_NOTHROW
{
T originalValue;
T newValue;
asm volatile("0:\n"
"lld %[originalValue], %[_q_value]\n"
"addiu %[newValue], %[originalValue], %[one]\n"
"scd %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
: [one] "i" (1)
: "cc", "memory");
return originalValue != T(-1);
}
template<> template<typename T> inline
bool QBasicAtomicOps<8>::deref(T &_q_value) Q_DECL_NOTHROW
{
T originalValue;
T newValue;
asm volatile("0:\n"
"lld %[originalValue], %[_q_value]\n"
"addiu %[newValue], %[originalValue], %[minusOne]\n"
"scd %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
: [minusOne] "i" (-1)
: "cc", "memory");
return originalValue != 1;
}
template<> template <typename T> inline
bool QBasicAtomicOps<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
{
T result;
T tempValue;
asm volatile("0:\n"
"lld %[tempValue], %[_q_value]\n"
"xor %[result], %[tempValue], %[expectedValue]\n"
"bnez %[result], 0f\n"
"nop\n"
"move %[tempValue], %[newValue]\n"
"scd %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
"0:\n"
: [result] "=&r" (result),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
: [expectedValue] "r" (expectedValue),
[newValue] "r" (newValue)
: "cc", "memory");
if (currentValue)
*currentValue = tempValue;
return result == 0;
}
template<> template <typename T> inline
T QBasicAtomicOps<8>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW
{
T originalValue;
T tempValue;
asm volatile("0:\n"
"lld %[originalValue], %[_q_value]\n"
"move %[tempValue], %[newValue]\n"
"scd %[tempValue], %[_q_value]\n"
"beqz %[tempValue], 0b\n"
"nop\n"
: [originalValue] "=&r" (originalValue),
[tempValue] "=&r" (tempValue),
[_q_value] "+m" (_q_value)
: [newValue] "r" (newValue)
: "cc", "memory");
return originalValue;
}
template<> template <typename T> inline
T QBasicAtomicOps<8>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
{
T originalValue;
T newValue;
asm volatile("0:\n"
"lld %[originalValue], %[_q_value]\n"
"addu %[newValue], %[originalValue], %[valueToAdd]\n"
"scd %[newValue], %[_q_value]\n"
"beqz %[newValue], 0b\n"
"nop\n"
: [originalValue] "=&r" (originalValue),
[_q_value] "+m" (_q_value),
[newValue] "=&r" (newValue)
: [valueToAdd] "r" (valueToAdd * QAtomicAdditiveType<T>::AddScale)
: "cc", "memory");
return originalValue;
}
#endif // MIPS64
#else
# error "This compiler for MIPS is not supported"
#endif // Q_CC_GNU
QT_END_NAMESPACE
#endif // QATOMIC_MIPS_H

View File

@ -993,7 +993,7 @@ QString QTextDecoder::toUnicode(const char *chars, int len)
} }
// in qstring.cpp: // in qstring.cpp:
void qt_from_latin1(ushort *dst, const char *str, size_t size); void qt_from_latin1(ushort *dst, const char *str, size_t size) Q_DECL_NOTHROW;
/*! \overload /*! \overload

View File

@ -296,7 +296,6 @@ QString QUtf8::convertToUnicode(const char *chars, int len, QTextCodec::Converte
{ {
bool headerdone = false; bool headerdone = false;
ushort replacement = QChar::ReplacementCharacter; ushort replacement = QChar::ReplacementCharacter;
int need = 0;
int invalid = 0; int invalid = 0;
int res; int res;
uchar ch = 0; uchar ch = 0;
@ -311,7 +310,7 @@ QString QUtf8::convertToUnicode(const char *chars, int len, QTextCodec::Converte
// 1 of 2 bytes invalid continuation +1 (need to insert replacement and restart) // 1 of 2 bytes invalid continuation +1 (need to insert replacement and restart)
// 2 of 3 bytes same +1 (same) // 2 of 3 bytes same +1 (same)
// 3 of 4 bytes same +1 (same) // 3 of 4 bytes same +1 (same)
QString result(need + len + 1, Qt::Uninitialized); QString result(len + 1, Qt::Uninitialized);
ushort *dst = reinterpret_cast<ushort *>(const_cast<QChar *>(result.constData())); ushort *dst = reinterpret_cast<ushort *>(const_cast<QChar *>(result.constData()));
const uchar *src = reinterpret_cast<const uchar *>(chars); const uchar *src = reinterpret_cast<const uchar *>(chars);

View File

@ -56,16 +56,6 @@
\title IANA character-sets encoding file \title IANA character-sets encoding file
*/ */
/*!
\externalpage http://doc-snapshot.qt-project.org/qt5-5.4/qtdesigner-manual.html
\title Using a Designer UI File in Your Application
*/
/*!
\externalpage http://doc-snapshot.qt-project.org/qt5-5.4/designer-widget-mode.html#the-property-editor
\title Qt Designer's Widget Editing Mode#The Property Editor
*/
/*! /*!
\externalpage http://marcmutz.wordpress.com/effective-qt/containers/#containers-qlist \externalpage http://marcmutz.wordpress.com/effective-qt/containers/#containers-qlist
\title Pros and Cons of Using QList \title Pros and Cons of Using QList

View File

@ -914,6 +914,13 @@
//# define Q_COMPILER_UNIFORM_INIT //# define Q_COMPILER_UNIFORM_INIT
# define Q_COMPILER_UNRESTRICTED_UNIONS # define Q_COMPILER_UNRESTRICTED_UNIONS
# endif # endif
# if _MSC_FULL_VER >= 190023419
# define Q_COMPILER_ATTRIBUTES
// Almost working, see https://connect.microsoft.com/VisualStudio/feedback/details/2011648
//# define Q_COMPILER_CONSTEXPR
# define Q_COMPILER_THREADSAFE_STATICS
# define Q_COMPILER_UNIFORM_INIT
# endif
# endif /* __cplusplus */ # endif /* __cplusplus */
#endif /* Q_CC_MSVC */ #endif /* Q_CC_MSVC */

View File

@ -3842,7 +3842,8 @@ int qrand()
independent copy of the object. independent copy of the object.
\li \c Q_MOVABLE_TYPE specifies that \a Type has a constructor \li \c Q_MOVABLE_TYPE specifies that \a Type has a constructor
and/or a destructor but can be moved in memory using \c and/or a destructor but can be moved in memory using \c
memcpy(). memcpy(). Note: despite the name, this has nothing to do with move
constructors or C++ move semantics.
\li \c Q_COMPLEX_TYPE (the default) specifies that \a Type has \li \c Q_COMPLEX_TYPE (the default) specifies that \a Type has
constructors and/or a destructor and that it may not be moved constructors and/or a destructor and that it may not be moved
in memory. in memory.

View File

@ -973,7 +973,7 @@ QByteArray QIODevice::read(qint64 maxSize)
/*! /*!
\overload \overload
Reads all available data from the device, and returns it as a Reads all remaining data from the device, and returns it as a
byte array. byte array.
This function has no way of reporting errors; returning an empty This function has no way of reporting errors; returning an empty

View File

@ -1179,14 +1179,15 @@ bool QProcessPrivate::_q_startupNotification()
if (startupSocketNotifier) if (startupSocketNotifier)
startupSocketNotifier->setEnabled(false); startupSocketNotifier->setEnabled(false);
if (processStarted()) { QString errorMessage;
if (processStarted(&errorMessage)) {
q->setProcessState(QProcess::Running); q->setProcessState(QProcess::Running);
emit q->started(QProcess::QPrivateSignal()); emit q->started(QProcess::QPrivateSignal());
return true; return true;
} }
q->setProcessState(QProcess::NotRunning); q->setProcessState(QProcess::NotRunning);
setErrorAndEmit(QProcess::FailedToStart, errorString); // the error string was already set setErrorAndEmit(QProcess::FailedToStart, errorMessage);
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
// make sure the process manager removes this entry // make sure the process manager removes this entry
waitForDeadChild(); waitForDeadChild();

View File

@ -352,7 +352,7 @@ public:
#elif defined(QPROCESS_USE_SPAWN) #elif defined(QPROCESS_USE_SPAWN)
pid_t spawnChild(pid_t *ppid, const char *workingDirectory, char **argv, char **envp); pid_t spawnChild(pid_t *ppid, const char *workingDirectory, char **argv, char **envp);
#endif #endif
bool processStarted(); bool processStarted(QString *errorMessage = Q_NULLPTR);
void terminateProcess(); void terminateProcess();
void killProcess(); void killProcess();
void findExitCode(); void findExitCode();

View File

@ -720,7 +720,7 @@ report_errno:
} }
#endif #endif
bool QProcessPrivate::processStarted() bool QProcessPrivate::processStarted(QString *errorMessage)
{ {
char buf[errorBufferMax]; char buf[errorBufferMax];
int i = 0; int i = 0;
@ -744,8 +744,8 @@ bool QProcessPrivate::processStarted()
#endif #endif
// did we read an error message? // did we read an error message?
if (i > 0) if ((i > 0) && errorMessage)
q_func()->setErrorString(QString::fromLocal8Bit(buf, i)); *errorMessage = QString::fromLocal8Bit(buf, i);
return i <= 0; return i <= 0;
} }

View File

@ -543,7 +543,7 @@ void QProcessPrivate::startProcess()
_q_startupNotification(); _q_startupNotification();
} }
bool QProcessPrivate::processStarted() bool QProcessPrivate::processStarted(QString * /*errorMessage*/)
{ {
return processState == QProcess::Running; return processState == QProcess::Running;
} }

View File

@ -160,7 +160,7 @@ void QProcessPrivate::startProcess()
_q_startupNotification(); _q_startupNotification();
} }
bool QProcessPrivate::processStarted() bool QProcessPrivate::processStarted(QString * /*errorMessage*/)
{ {
return processState == QProcess::Running; return processState == QProcess::Running;
} }

View File

@ -1646,6 +1646,7 @@ QModelIndexList QItemSelectionModel::selectedIndexes() const
/*! /*!
\since 4.2 \since 4.2
Returns the indexes in the given \a column for the rows where all columns are selected. Returns the indexes in the given \a column for the rows where all columns are selected.
The list is not sorted.
\sa selectedIndexes(), selectedColumns() \sa selectedIndexes(), selectedColumns()
*/ */

View File

@ -280,7 +280,7 @@ static inline int compressedNumber(double d)
if (non_int) if (non_int)
return INT_MAX; return INT_MAX;
bool neg = (val >> 63); bool neg = (val >> 63) != 0;
val &= fraction_mask; val &= fraction_mask;
val |= ((quint64)1 << 52); val |= ((quint64)1 << 52);
int res = (int)(val >> (52 - exp)); int res = (int)(val >> (52 - exp));
@ -543,7 +543,7 @@ public:
offset tableOffset; offset tableOffset;
// content follows here // content follows here
inline bool isObject() const { return is_object; } inline bool isObject() const { return !!is_object; }
inline bool isArray() const { return !isObject(); } inline bool isArray() const { return !isObject(); }
inline offset *table() const { return (offset *) (((char *) this) + tableOffset); } inline offset *table() const { return (offset *) (((char *) this) + tableOffset); }

View File

@ -173,7 +173,7 @@ QJsonValue::QJsonValue(int n)
QJsonValue::QJsonValue(qint64 n) QJsonValue::QJsonValue(qint64 n)
: d(0), t(Double) : d(0), t(Double)
{ {
this->dbl = n; this->dbl = double(n);
} }
/*! /*!
@ -515,7 +515,7 @@ bool QJsonValue::toBool(bool defaultValue) const
int QJsonValue::toInt(int defaultValue) const int QJsonValue::toInt(int defaultValue) const
{ {
if (t == Double && int(dbl) == dbl) if (t == Double && int(dbl) == dbl)
return dbl; return int(dbl);
return defaultValue; return defaultValue;
} }

View File

@ -101,7 +101,8 @@ winrt {
mac { mac {
HEADERS += \ HEADERS += \
kernel/qcfsocketnotifier_p.h \ kernel/qcfsocketnotifier_p.h \
kernel/qcore_mac_p.h kernel/qcore_mac_p.h \
kernel/qeventdispatcher_cf_p.h
SOURCES += \ SOURCES += \
kernel/qcfsocketnotifier.cpp \ kernel/qcfsocketnotifier.cpp \
@ -109,18 +110,14 @@ mac {
kernel/qcore_mac.cpp kernel/qcore_mac.cpp
OBJECTIVE_SOURCES += \ OBJECTIVE_SOURCES += \
kernel/qcore_mac_objc.mm kernel/qcore_mac_objc.mm \
kernel/qeventdispatcher_cf.mm
LIBS_PRIVATE += -framework Foundation LIBS_PRIVATE += -framework Foundation
osx: LIBS_PRIVATE += -framework CoreServices osx: LIBS_PRIVATE += -framework CoreServices -framework AppKit
ios { ios {
OBJECTIVE_SOURCES += \
kernel/qeventdispatcher_cf.mm
HEADERS += \
kernel/qeventdispatcher_cf_p.h
# We need UIKit for UIDevice # We need UIKit for UIDevice
LIBS_PRIVATE += -framework UIKit LIBS_PRIVATE += -framework UIKit
} }

View File

@ -43,7 +43,11 @@
#include <limits> #include <limits>
#include <UIKit/UIApplication.h> #ifdef Q_OS_OSX
# include <AppKit/NSApplication.h>
#else
# include <UIKit/UIApplication.h>
#endif
@interface RunLoopModeTracker : NSObject { @interface RunLoopModeTracker : NSObject {
QStack<CFStringRef> m_runLoopModes; QStack<CFStringRef> m_runLoopModes;
@ -61,7 +65,11 @@
addObserver:self addObserver:self
selector:@selector(receivedNotification:) selector:@selector(receivedNotification:)
name:nil name:nil
#ifdef Q_OS_OSX
object:[NSApplication sharedApplication]];
#else
object:[UIApplication sharedApplication]]; object:[UIApplication sharedApplication]];
#endif
} }
return self; return self;

View File

@ -103,7 +103,7 @@ struct tm {
int tm_year; /* years since 1900 */ int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday - [0,6] */ int tm_wday; /* days since Sunday - [0,6] */
int tm_yday; /* days since January 1 - [0,365] */ int tm_yday; /* days since January 1 - [0,365] */
int tm_isdst; /* daylight savings time flag */ int tm_isdst; /* daylight-saving time flag */
}; };
#endif // _TM_DEFINED #endif // _TM_DEFINED

View File

@ -93,9 +93,9 @@
\macro Q_IMPORT_PLUGIN(PluginName) \macro Q_IMPORT_PLUGIN(PluginName)
\relates <QtPlugin> \relates <QtPlugin>
This macro imports the plugin named \a PluginName, corresponding This macro imports the plugin named \a PluginName, which corresponds
to the \l{qmake Variable Reference#TARGET}{TARGET} specified in the with the name of the class that declares metadata for the plugin with
plugin's project file. Q_PLUGIN_METADATA().
Inserting this macro into your application's source code will allow Inserting this macro into your application's source code will allow
you to make use of a static plugin. you to make use of a static plugin.

7
src/corelib/qtzlib.pro Normal file
View File

@ -0,0 +1,7 @@
TARGET = QtZlib
MODULE = zlib
MAKEFILE = Makefile.qtzlib
CONFIG += internal_module header_module alien_syncqt
QT =
load(qt_module)

View File

@ -62,8 +62,6 @@
# include "QtCore/qatomic_armv5.h" # include "QtCore/qatomic_armv5.h"
#elif defined(Q_PROCESSOR_IA64) #elif defined(Q_PROCESSOR_IA64)
# include "QtCore/qatomic_ia64.h" # include "QtCore/qatomic_ia64.h"
#elif defined(Q_PROCESSOR_MIPS)
# include "QtCore/qatomic_mips.h"
#elif defined(Q_PROCESSOR_X86) #elif defined(Q_PROCESSOR_X86)
# include <QtCore/qatomic_x86.h> # include <QtCore/qatomic_x86.h>

View File

@ -139,6 +139,11 @@ public:
lock calls unlock(). A non-blocking alternative to lock() is lock calls unlock(). A non-blocking alternative to lock() is
tryLock(). tryLock().
QMutex is optimized to be fast in the non-contended case. A non-recursive
QMutex will not allocate memory if there is no contention on that mutex.
It is constructed and destroyed with almost no overhead,
which means it is fine to have many mutexes as part of other classes.
\sa QMutexLocker, QReadWriteLock, QSemaphore, QWaitCondition \sa QMutexLocker, QReadWriteLock, QSemaphore, QWaitCondition
*/ */
@ -165,6 +170,8 @@ public:
a thread may only lock a mutex once. The default is a thread may only lock a mutex once. The default is
QMutex::NonRecursive. QMutex::NonRecursive.
Recursive mutexes are slower and take more memory than non-recursive ones.
\sa lock(), unlock() \sa lock(), unlock()
*/ */
QMutex::QMutex(RecursionMode mode) QMutex::QMutex(RecursionMode mode)

View File

@ -179,8 +179,9 @@ QT_BEGIN_NAMESPACE
\value Unicode_6_2 Version 6.2 \value Unicode_6_2 Version 6.2
\value Unicode_6_3 Version 6.3 Since Qt 5.3 \value Unicode_6_3 Version 6.3 Since Qt 5.3
\value Unicode_7_0 Version 7.0 Since Qt 5.5 \value Unicode_7_0 Version 7.0 Since Qt 5.5
\value Unicode_8_0 Version 8.0 Since Qt 5.6
\value Unicode_Unassigned The value is not assigned to any character \value Unicode_Unassigned The value is not assigned to any character
in version 6.3 of Unicode. in version 8.0 of Unicode.
\sa unicodeVersion(), currentUnicodeVersion() \sa unicodeVersion(), currentUnicodeVersion()
*/ */
@ -401,6 +402,12 @@ QT_BEGIN_NAMESPACE
\value Script_Khudawadi \value Script_Khudawadi
\value Script_Tirhuta \value Script_Tirhuta
\value Script_WarangCiti \value Script_WarangCiti
\value Script_Ahom
\value Script_AnatolianHieroglyphs
\value Script_Hatran
\value Script_Multani
\value Script_OldHungarian
\value Script_SignWriting
\omitvalue ScriptCount \omitvalue ScriptCount
@ -1423,48 +1430,18 @@ QChar::UnicodeVersion QChar::currentUnicodeVersion() Q_DECL_NOTHROW
} }
template <typename T> template <typename Traits, typename T>
Q_DECL_CONST_FUNCTION static inline T toLowerCase_helper(T uc) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION static inline T convertCase_helper(T uc) Q_DECL_NOTHROW
{ {
const QUnicodeTables::Properties *p = qGetProp(uc); const QUnicodeTables::Properties *prop = qGetProp(uc);
if (p->lowerCaseSpecial) {
const ushort *specialCase = specialCaseMap + p->lowerCaseDiff;
return (*specialCase == 1) ? specialCase[1] : uc;
}
return uc + p->lowerCaseDiff;
}
template <typename T> if (Q_UNLIKELY(Traits::caseSpecial(prop))) {
Q_DECL_CONST_FUNCTION static inline T toUpperCase_helper(T uc) Q_DECL_NOTHROW const ushort *specialCase = specialCaseMap + Traits::caseDiff(prop);
{ // so far, there are no special cases beyond BMP (guaranteed by the qunicodetables generator)
const QUnicodeTables::Properties *p = qGetProp(uc); return *specialCase == 1 ? specialCase[1] : uc;
if (p->upperCaseSpecial) {
const ushort *specialCase = specialCaseMap + p->upperCaseDiff;
return (*specialCase == 1) ? specialCase[1] : uc;
} }
return uc + p->upperCaseDiff;
}
template <typename T> return uc + Traits::caseDiff(prop);
Q_DECL_CONST_FUNCTION static inline T toTitleCase_helper(T uc) Q_DECL_NOTHROW
{
const QUnicodeTables::Properties *p = qGetProp(uc);
if (p->titleCaseSpecial) {
const ushort *specialCase = specialCaseMap + p->titleCaseDiff;
return (*specialCase == 1) ? specialCase[1] : uc;
}
return uc + p->titleCaseDiff;
}
template <typename T>
Q_DECL_CONST_FUNCTION static inline T toCaseFolded_helper(T uc) Q_DECL_NOTHROW
{
const QUnicodeTables::Properties *p = qGetProp(uc);
if (p->caseFoldSpecial) {
const ushort *specialCase = specialCaseMap + p->caseFoldDiff;
return (*specialCase == 1) ? specialCase[1] : uc;
}
return uc + p->caseFoldDiff;
} }
/*! /*!
@ -1484,7 +1461,7 @@ uint QChar::toLower(uint ucs4) Q_DECL_NOTHROW
{ {
if (ucs4 > LastValidCodePoint) if (ucs4 > LastValidCodePoint)
return ucs4; return ucs4;
return toLowerCase_helper<uint>(ucs4); return convertCase_helper<QUnicodeTables::LowercaseTraits>(ucs4);
} }
/*! /*!
@ -1504,7 +1481,7 @@ uint QChar::toUpper(uint ucs4) Q_DECL_NOTHROW
{ {
if (ucs4 > LastValidCodePoint) if (ucs4 > LastValidCodePoint)
return ucs4; return ucs4;
return toUpperCase_helper<uint>(ucs4); return convertCase_helper<QUnicodeTables::UppercaseTraits>(ucs4);
} }
/*! /*!
@ -1524,29 +1501,29 @@ uint QChar::toTitleCase(uint ucs4) Q_DECL_NOTHROW
{ {
if (ucs4 > LastValidCodePoint) if (ucs4 > LastValidCodePoint)
return ucs4; return ucs4;
return toTitleCase_helper<uint>(ucs4); return convertCase_helper<QUnicodeTables::TitlecaseTraits>(ucs4);
} }
static inline uint foldCase(const ushort *ch, const ushort *start) static inline uint foldCase(const ushort *ch, const ushort *start)
{ {
uint c = *ch; uint ucs4 = *ch;
if (QChar(c).isLowSurrogate() && ch > start && QChar(*(ch - 1)).isHighSurrogate()) if (QChar::isLowSurrogate(ucs4) && ch > start && QChar::isHighSurrogate(*(ch - 1)))
c = QChar::surrogateToUcs4(*(ch - 1), c); ucs4 = QChar::surrogateToUcs4(*(ch - 1), ucs4);
return toCaseFolded_helper<uint>(c); return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);
} }
static inline uint foldCase(uint ch, uint &last) Q_DECL_NOTHROW static inline uint foldCase(uint ch, uint &last) Q_DECL_NOTHROW
{ {
uint c = ch; uint ucs4 = ch;
if (QChar(c).isLowSurrogate() && QChar(last).isHighSurrogate()) if (QChar::isLowSurrogate(ucs4) && QChar::isHighSurrogate(last))
c = QChar::surrogateToUcs4(last, c); ucs4 = QChar::surrogateToUcs4(last, ucs4);
last = ch; last = ch;
return toCaseFolded_helper<uint>(c); return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);
} }
static inline ushort foldCase(ushort ch) Q_DECL_NOTHROW static inline ushort foldCase(ushort ch) Q_DECL_NOTHROW
{ {
return toCaseFolded_helper<ushort>(ch); return convertCase_helper<QUnicodeTables::CasefoldTraits>(ch);
} }
/*! /*!
@ -1565,7 +1542,7 @@ uint QChar::toCaseFolded(uint ucs4) Q_DECL_NOTHROW
{ {
if (ucs4 > LastValidCodePoint) if (ucs4 > LastValidCodePoint)
return ucs4; return ucs4;
return toCaseFolded_helper<uint>(ucs4); return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);
} }
/*! /*!

View File

@ -275,6 +275,14 @@ public:
Script_Tirhuta, Script_Tirhuta,
Script_WarangCiti, Script_WarangCiti,
// Unicode 8.0 additions
Script_Ahom,
Script_AnatolianHieroglyphs,
Script_Hatran,
Script_Multani,
Script_OldHungarian,
Script_SignWriting,
ScriptCount ScriptCount
}; };
@ -365,7 +373,8 @@ public:
Unicode_6_1, Unicode_6_1,
Unicode_6_2, Unicode_6_2,
Unicode_6_3, Unicode_6_3,
Unicode_7_0 Unicode_7_0,
Unicode_8_0
}; };
// ****** WHEN ADDING FUNCTIONS, CONSIDER ADDING TO QCharRef TOO // ****** WHEN ADDING FUNCTIONS, CONSIDER ADDING TO QCharRef TOO

View File

@ -1383,7 +1383,7 @@ bool QDate::isLeapYear(int y)
QTime uses the 24-hour clock format; it has no concept of AM/PM. QTime uses the 24-hour clock format; it has no concept of AM/PM.
Unlike QDateTime, QTime knows nothing about time zones or Unlike QDateTime, QTime knows nothing about time zones or
daylight savings time (DST). daylight-saving time (DST).
A QTime object is typically created either by giving the number A QTime object is typically created either by giving the number
of hours, minutes, seconds, and milliseconds explicitly, or by of hours, minutes, seconds, and milliseconds explicitly, or by
@ -1728,7 +1728,7 @@ QTime QTime::addMSecs(int ms) const
QTime t; QTime t;
if (isValid()) { if (isValid()) {
if (ms < 0) { if (ms < 0) {
// % not well-defined for -ve, but / is. // %,/ not well-defined for -ve, so always work with +ve.
int negdays = (MSECS_PER_DAY - ms) / MSECS_PER_DAY; int negdays = (MSECS_PER_DAY - ms) / MSECS_PER_DAY;
t.mds = (ds() + ms + negdays * MSECS_PER_DAY) % MSECS_PER_DAY; t.mds = (ds() + ms + negdays * MSECS_PER_DAY) % MSECS_PER_DAY;
} else { } else {
@ -2059,7 +2059,7 @@ void QTime::start()
\warning If the system's clock setting has been changed since the \warning If the system's clock setting has been changed since the
last time start() or restart() was called, the result is last time start() or restart() was called, the result is
undefined. This can happen when daylight savings time is turned on undefined. This can happen when daylight-saving time is turned on
or off. or off.
\sa start(), elapsed(), currentTime() \sa start(), elapsed(), currentTime()
@ -2087,7 +2087,7 @@ int QTime::restart()
\warning If the system's clock setting has been changed since the \warning If the system's clock setting has been changed since the
last time start() or restart() was called, the result is last time start() or restart() was called, the result is
undefined. This can happen when daylight savings time is turned on undefined. This can happen when daylight-saving time is turned on
or off. or off.
\sa start(), restart() \sa start(), restart()
@ -2301,7 +2301,7 @@ static qint64 qt_mktime(QDate *date, QTime *time, QDateTimePrivate::DaylightStat
} }
// Calls the platform variant of localtime for the given msecs, and updates // Calls the platform variant of localtime for the given msecs, and updates
// the date, time, and daylight status with the returned values. // the date, time, and DST status with the returned values.
static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localTime, static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localTime,
QDateTimePrivate::DaylightStatus *daylightStatus) QDateTimePrivate::DaylightStatus *daylightStatus)
{ {
@ -2417,7 +2417,7 @@ static bool epochMSecsToLocalTime(qint64 msecs, QDate *localDate, QTime *localTi
*daylightStatus = QDateTimePrivate::StandardTime; *daylightStatus = QDateTimePrivate::StandardTime;
return true; return true;
} else if (msecs > (qint64(TIME_T_MAX) * 1000)) { } else if (msecs > (qint64(TIME_T_MAX) * 1000)) {
// Docs state any LocalTime after 2037-12-31 *will* have any Daylight Time applied // Docs state any LocalTime after 2037-12-31 *will* have any DST applied
// but this may fall outside the supported time_t range, so need to fake it. // but this may fall outside the supported time_t range, so need to fake it.
// Use existing method to fake the conversion, but this is deeply flawed as it may // Use existing method to fake the conversion, but this is deeply flawed as it may
// apply the conversion from the wrong day number, e.g. if rule is last Sunday of month // apply the conversion from the wrong day number, e.g. if rule is last Sunday of month
@ -2442,7 +2442,7 @@ static bool epochMSecsToLocalTime(qint64 msecs, QDate *localDate, QTime *localTi
} }
// Convert a LocalTime expressed in local msecs encoding and the corresponding // Convert a LocalTime expressed in local msecs encoding and the corresponding
// daylight status into a UTC epoch msecs. Optionally populate the returned // DST status into a UTC epoch msecs. Optionally populate the returned
// values from mktime for the adjusted local date and time. // values from mktime for the adjusted local date and time.
static qint64 localMSecsToEpochMSecs(qint64 localMsecs, static qint64 localMSecsToEpochMSecs(qint64 localMsecs,
QDateTimePrivate::DaylightStatus *daylightStatus, QDateTimePrivate::DaylightStatus *daylightStatus,
@ -2457,10 +2457,10 @@ static qint64 localMSecsToEpochMSecs(qint64 localMsecs,
if (localMsecs <= qint64(MSECS_PER_DAY)) { if (localMsecs <= qint64(MSECS_PER_DAY)) {
// Docs state any LocalTime before 1970-01-01 will *not* have any Daylight Time applied // Docs state any LocalTime before 1970-01-01 will *not* have any DST applied
// First, if localMsecs is within +/- 1 day of minimum time_t try mktime in case it does // First, if localMsecs is within +/- 1 day of minimum time_t try mktime in case it does
// fall after minimum and needs proper daylight conversion // fall after minimum and needs proper DST conversion
if (localMsecs >= -qint64(MSECS_PER_DAY)) { if (localMsecs >= -qint64(MSECS_PER_DAY)) {
bool valid; bool valid;
qint64 utcMsecs = qt_mktime(&dt, &tm, daylightStatus, abbreviation, &valid); qint64 utcMsecs = qt_mktime(&dt, &tm, daylightStatus, abbreviation, &valid);
@ -2488,11 +2488,11 @@ static qint64 localMSecsToEpochMSecs(qint64 localMsecs,
} else if (localMsecs >= msecsMax - MSECS_PER_DAY) { } else if (localMsecs >= msecsMax - MSECS_PER_DAY) {
// Docs state any LocalTime after 2037-12-31 *will* have any Daylight Time applied // Docs state any LocalTime after 2037-12-31 *will* have any DST applied
// but this may fall outside the supported time_t range, so need to fake it. // but this may fall outside the supported time_t range, so need to fake it.
// First, if localMsecs is within +/- 1 day of maximum time_t try mktime in case it does // First, if localMsecs is within +/- 1 day of maximum time_t try mktime in case it does
// fall before maximum and can use proper daylight conversion // fall before maximum and can use proper DST conversion
if (localMsecs <= msecsMax + MSECS_PER_DAY) { if (localMsecs <= msecsMax + MSECS_PER_DAY) {
bool valid; bool valid;
qint64 utcMsecs = qt_mktime(&dt, &tm, daylightStatus, abbreviation, &valid); qint64 utcMsecs = qt_mktime(&dt, &tm, daylightStatus, abbreviation, &valid);
@ -2662,7 +2662,7 @@ void QDateTimePrivate::setDaylightStatus(QDateTimePrivate::DaylightStatus status
} }
} }
// Get the Daylight Status if LocalTime set via msecs // Get the DST Status if LocalTime set via msecs
QDateTimePrivate::DaylightStatus QDateTimePrivate::daylightStatus() const QDateTimePrivate::DaylightStatus QDateTimePrivate::daylightStatus() const
{ {
if ((m_status & SetToDaylightTime) == SetToDaylightTime) if ((m_status & SetToDaylightTime) == SetToDaylightTime)
@ -2746,7 +2746,7 @@ void QDateTimePrivate::refreshDateTime()
#endif // QT_BOOTSTRAPPED #endif // QT_BOOTSTRAPPED
// We have a valid date and time and a Qt::LocalTime or Qt::TimeZone that needs calculating // We have a valid date and time and a Qt::LocalTime or Qt::TimeZone that needs calculating
// LocalTime and TimeZone might fall into "missing" DaylightTime transition hour // LocalTime and TimeZone might fall into a "missing" DST transition hour
// Calling toEpochMSecs will adjust the returned date/time if it does // Calling toEpochMSecs will adjust the returned date/time if it does
QDate testDate; QDate testDate;
QTime testTime; QTime testTime;
@ -2776,8 +2776,8 @@ qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone
{ {
// Get the effective data from QTimeZone // Get the effective data from QTimeZone
QTimeZonePrivate::Data data = zone.d->dataForLocalTime(zoneMSecs); QTimeZonePrivate::Data data = zone.d->dataForLocalTime(zoneMSecs);
// Docs state any LocalTime before 1970-01-01 will *not* have any Daylight Time applied // Docs state any LocalTime before 1970-01-01 will *not* have any DST applied
// but all times afterwards will have Daylight Time applied. // but all affected times afterwards will have DST applied.
if (data.atMSecsSinceEpoch >= 0) { if (data.atMSecsSinceEpoch >= 0) {
msecsToTime(data.atMSecsSinceEpoch + (data.offsetFromUtc * 1000), localDate, localTime); msecsToTime(data.atMSecsSinceEpoch + (data.offsetFromUtc * 1000), localDate, localTime);
return data.atMSecsSinceEpoch; return data.atMSecsSinceEpoch;
@ -2836,7 +2836,7 @@ qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone
QDateTime expressed as local time; use toUTC() to convert it to QDateTime expressed as local time; use toUTC() to convert it to
UTC. You can also use timeSpec() to find out if a QDateTime UTC. You can also use timeSpec() to find out if a QDateTime
object stores a UTC time or a local time. Operations such as object stores a UTC time or a local time. Operations such as
addSecs() and secsTo() are aware of daylight saving time (DST). addSecs() and secsTo() are aware of daylight-saving time (DST).
\note QDateTime does not account for leap seconds. \note QDateTime does not account for leap seconds.
@ -2866,7 +2866,7 @@ qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone
correctly or not up-to-date, QDateTime will give wrong results as correctly or not up-to-date, QDateTime will give wrong results as
well. well.
\section2 Daylight Savings Time (DST) \section2 Daylight-Saving Time (DST)
QDateTime takes into account the system's time zone information QDateTime takes into account the system's time zone information
when dealing with DST. On modern Unix systems, this means it when dealing with DST. On modern Unix systems, this means it
@ -2884,7 +2884,7 @@ qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone
time zone before 1970, even if the system's time zone database time zone before 1970, even if the system's time zone database
supports that information. supports that information.
QDateTime takes into consideration the Standard Time to Daylight Time QDateTime takes into consideration the Standard Time to Daylight-Saving Time
transition. For example if the transition is at 2am and the clock goes transition. For example if the transition is at 2am and the clock goes
forward to 3am, then there is a "missing" hour from 02:00:00 to 02:59:59.999 forward to 3am, then there is a "missing" hour from 02:00:00 to 02:59:59.999
which QDateTime considers to be invalid. Any date maths performed which QDateTime considers to be invalid. Any date maths performed
@ -2896,7 +2896,7 @@ qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone
to define a QDateTime relative to UTC at a fixed offset of a given number to define a QDateTime relative to UTC at a fixed offset of a given number
of seconds from UTC. For example, an offset of +3600 seconds is one hour of seconds from UTC. For example, an offset of +3600 seconds is one hour
ahead of UTC and is usually written in ISO standard notation as ahead of UTC and is usually written in ISO standard notation as
"UTC+01:00". Daylight Savings Time never applies with this TimeSpec. "UTC+01:00". Daylight-Saving Time never applies with this TimeSpec.
There is no explicit size restriction to the offset seconds, but there is There is no explicit size restriction to the offset seconds, but there is
an implicit limit imposed when using the toString() and fromString() an implicit limit imposed when using the toString() and fromString()
@ -2908,8 +2908,8 @@ qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone
A Qt::TimeSpec of Qt::TimeZone is also supported in conjunction with the A Qt::TimeSpec of Qt::TimeZone is also supported in conjunction with the
QTimeZone class. This allows you to define a datetime in a named time zone QTimeZone class. This allows you to define a datetime in a named time zone
adhering to a consistent set of daylight savings transition rules. For adhering to a consistent set of daylight-saving transition rules. For
example a time zone of "Europe/Berlin" will apply the daylight savings example a time zone of "Europe/Berlin" will apply the daylight-saving
rules as used in Germany since 1970. Note that the transition rules rules as used in Germany since 1970. Note that the transition rules
applied depend on the platform support. See the QTimeZone documentation applied depend on the platform support. See the QTimeZone documentation
for more details. for more details.
@ -3051,7 +3051,7 @@ bool QDateTime::isNull() const
the current Qt::TimeSpec, otherwise returns \c false. the current Qt::TimeSpec, otherwise returns \c false.
If the timeSpec() is Qt::LocalTime or Qt::TimeZone then the date and time are If the timeSpec() is Qt::LocalTime or Qt::TimeZone then the date and time are
checked to see if they fall in the Standard Time to Daylight Time transition checked to see if they fall in the Standard Time to Daylight-Saving Time transition
hour, i.e. if the transition is at 2am and the clock goes forward to 3am hour, i.e. if the transition is at 2am and the clock goes forward to 3am
then the time from 02:00:00 to 02:59:59.999 is considered to be invalid. then the time from 02:00:00 to 02:59:59.999 is considered to be invalid.
@ -3142,10 +3142,10 @@ QTimeZone QDateTime::timeZone() const
If the timeSpec() is Qt::OffsetFromUTC this will be the value originally set. If the timeSpec() is Qt::OffsetFromUTC this will be the value originally set.
If the timeSpec() is Qt::TimeZone this will be the offset effective in the If the timeSpec() is Qt::TimeZone this will be the offset effective in the
Time Zone including any Daylight Saving Offset. Time Zone including any Daylight-Saving Offset.
If the timeSpec() is Qt::LocalTime this will be the difference between the If the timeSpec() is Qt::LocalTime this will be the difference between the
Local Time and UTC including any Daylight Saving Offset. Local Time and UTC including any Daylight-Saving Offset.
If the timeSpec() is Qt::UTC this will be 0. If the timeSpec() is Qt::UTC this will be 0.
@ -3202,7 +3202,7 @@ QString QDateTime::timeZoneAbbreviation() const
/*! /*!
\since 5.2 \since 5.2
Returns if this datetime falls in Daylight Savings Time. Returns if this datetime falls in Daylight-Saving Time.
If the Qt::TimeSpec is not Qt::LocalTime or Qt::TimeZone then will always If the Qt::TimeSpec is not Qt::LocalTime or Qt::TimeZone then will always
return false. return false.
@ -3415,8 +3415,8 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs)
break; break;
case Qt::TimeZone: case Qt::TimeZone:
#ifndef QT_BOOTSTRAPPED #ifndef QT_BOOTSTRAPPED
// Docs state any LocalTime before 1970-01-01 will *not* have any Daylight Time applied // Docs state any LocalTime before 1970-01-01 will *not* have any DST applied
// but all times afterwards will have Daylight Time applied. // but all affected times afterwards will have DST applied.
if (msecs >= 0) if (msecs >= 0)
d->m_offsetFromUtc = d->m_timeZone.d->offsetFromUtc(msecs); d->m_offsetFromUtc = d->m_timeZone.d->offsetFromUtc(msecs);
else else
@ -3658,7 +3658,7 @@ QString QDateTime::toString(const QString& format) const
negative). negative).
If the timeSpec() is Qt::LocalTime and the resulting If the timeSpec() is Qt::LocalTime and the resulting
date and time fall in the Standard Time to Daylight Time transition date and time fall in the Standard Time to Daylight-Saving Time transition
hour then the result will be adjusted accordingly, i.e. if the transition hour then the result will be adjusted accordingly, i.e. if the transition
is at 2am and the clock goes forward to 3am and the result falls between is at 2am and the clock goes forward to 3am and the result falls between
2am and 3am then the result will be adjusted to fall after 3am. 2am and 3am then the result will be adjusted to fall after 3am.
@ -3693,7 +3693,7 @@ QDateTime QDateTime::addDays(qint64 ndays) const
is negative). is negative).
If the timeSpec() is Qt::LocalTime and the resulting If the timeSpec() is Qt::LocalTime and the resulting
date and time fall in the Standard Time to Daylight Time transition date and time fall in the Standard Time to Daylight-Saving Time transition
hour then the result will be adjusted accordingly, i.e. if the transition hour then the result will be adjusted accordingly, i.e. if the transition
is at 2am and the clock goes forward to 3am and the result falls between is at 2am and the clock goes forward to 3am and the result falls between
2am and 3am then the result will be adjusted to fall after 3am. 2am and 3am then the result will be adjusted to fall after 3am.
@ -3728,7 +3728,7 @@ QDateTime QDateTime::addMonths(int nmonths) const
negative). negative).
If the timeSpec() is Qt::LocalTime and the resulting If the timeSpec() is Qt::LocalTime and the resulting
date and time fall in the Standard Time to Daylight Time transition date and time fall in the Standard Time to Daylight-Saving Time transition
hour then the result will be adjusted accordingly, i.e. if the transition hour then the result will be adjusted accordingly, i.e. if the transition
is at 2am and the clock goes forward to 3am and the result falls between is at 2am and the clock goes forward to 3am and the result falls between
2am and 3am then the result will be adjusted to fall after 3am. 2am and 3am then the result will be adjusted to fall after 3am.
@ -3788,7 +3788,7 @@ QDateTime QDateTime::addMSecs(qint64 msecs) const
QDateTime dt(*this); QDateTime dt(*this);
if (d->m_spec == Qt::LocalTime || d->m_spec == Qt::TimeZone) if (d->m_spec == Qt::LocalTime || d->m_spec == Qt::TimeZone)
// Convert to real UTC first in case crosses daylight transition // Convert to real UTC first in case crosses DST transition
dt.setMSecsSinceEpoch(d->toMSecsSinceEpoch() + msecs); dt.setMSecsSinceEpoch(d->toMSecsSinceEpoch() + msecs);
else else
// No need to convert, just add on // No need to convert, just add on
@ -3823,8 +3823,8 @@ qint64 QDateTime::daysTo(const QDateTime &other) const
the value returned is negative. the value returned is negative.
Before performing the comparison, the two datetimes are converted Before performing the comparison, the two datetimes are converted
to Qt::UTC to ensure that the result is correct if one of the two to Qt::UTC to ensure that the result is correct if daylight-saving
datetimes has daylight saving time (DST) and the other doesn't. (DST) applies to one of the two datetimes but not the other.
Returns 0 if either datetime is invalid. Returns 0 if either datetime is invalid.
@ -3845,8 +3845,8 @@ qint64 QDateTime::secsTo(const QDateTime &other) const
the value returned is negative. the value returned is negative.
Before performing the comparison, the two datetimes are converted Before performing the comparison, the two datetimes are converted
to Qt::UTC to ensure that the result is correct if one of the two to Qt::UTC to ensure that the result is correct if daylight-saving
datetimes has daylight saving time (DST) and the other doesn't. (DST) applies to one of the two datetimes and but not the other.
Returns 0 if either datetime is invalid. Returns 0 if either datetime is invalid.

View File

@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE
platforms that support it (see QElapsedTimer::isMonotonic()). This has platforms that support it (see QElapsedTimer::isMonotonic()). This has
the added benefit that QElapsedTimer is immune to time adjustments, such the added benefit that QElapsedTimer is immune to time adjustments, such
as the user correcting the time. Also unlike QTime, QElapsedTimer is as the user correcting the time. Also unlike QTime, QElapsedTimer is
immune to changes in the timezone settings, such as daylight saving immune to changes in the timezone settings, such as daylight-saving
periods. periods.
On the other hand, this means QElapsedTimer values can only be compared On the other hand, this means QElapsedTimer values can only be compared

View File

@ -636,7 +636,7 @@ int ffsll(quint64 i)
#endif #endif
} }
#endif #endif
#elif defined(Q_OS_ANDROID) || defined(Q_OS_QNX) #elif defined(Q_OS_ANDROID) || defined(Q_OS_QNX) || defined(Q_OS_OSX)
# define ffsll __builtin_ffsll # define ffsll __builtin_ffsll
#endif #endif

View File

@ -203,7 +203,7 @@ inline RetType UnrollTailLoop<0>::exec(int, RetType returnIfExited, Functor1, Fu
#endif #endif
// conversion between Latin 1 and UTF-16 // conversion between Latin 1 and UTF-16
void qt_from_latin1(ushort *dst, const char *str, size_t size) void qt_from_latin1(ushort *dst, const char *str, size_t size) Q_DECL_NOTHROW
{ {
/* SIMD: /* SIMD:
* Unpacking with SSE has been shown to improve performance on recent CPUs * Unpacking with SSE has been shown to improve performance on recent CPUs
@ -5666,34 +5666,36 @@ QString QString::rightJustified(int width, QChar fill, bool truncate) const
*/ */
namespace QUnicodeTables { namespace QUnicodeTables {
struct LowercaseTraits /*!
{ \internal
static signed short caseDiff(const Properties *prop) Converts the \a str string starting from the position pointed to by the \a
{ return prop->lowerCaseDiff; } it iterator, using the Unicode case traits \c Traits, and returns the
static bool caseSpecial(const Properties *prop) result. The input string must not be empty (the convertCase function below
{ return prop->lowerCaseSpecial; } guarantees that).
};
struct UppercaseTraits The string type \c{T} is also a template and is either \c{const QString} or
{ \c{QString}. This function can do both copy-conversion and in-place
static signed short caseDiff(const Properties *prop) conversion depending on the state of the \a str parameter:
{ return prop->upperCaseDiff; } \list
static bool caseSpecial(const Properties *prop) \li \c{T} is \c{const QString}: copy-convert
{ return prop->upperCaseSpecial; } \li \c{T} is \c{QString} and its refcount != 1: copy-convert
}; \li \c{T} is \c{QString} and its refcount == 1: in-place convert
\endlist
struct CasefoldTraits In copy-convert mode, the local variable \c{s} is detached from the input
{ \a str. In the in-place convert mode, \a str is in moved-from state (which
static signed short caseDiff(const Properties *prop) this function requires to be a valid, empty string) and \c{s} contains the
{ return prop->caseFoldDiff; } only copy of the string, without reallocation (thus, \a it is still valid).
static bool caseSpecial(const Properties *prop)
{ return prop->caseFoldSpecial; }
};
There's one pathological case left: when the in-place conversion needs to
reallocate memory to grow the buffer. In that case, we need to adjust the \a
it pointer.
*/
template <typename Traits, typename T> template <typename Traits, typename T>
Q_NEVER_INLINE Q_NEVER_INLINE
static QString detachAndConvertCase(T &str, QStringIterator it) static QString detachAndConvertCase(T &str, QStringIterator it)
{ {
Q_ASSERT(!str.isEmpty());
QString s = qMove(str); // will copy if T is const QString QString s = qMove(str); // will copy if T is const QString
QChar *pp = s.begin() + it.index(); // will detach if necessary QChar *pp = s.begin() + it.index(); // will detach if necessary
uint uc = it.nextUnchecked(); uint uc = it.nextUnchecked();
@ -5702,12 +5704,19 @@ static QString detachAndConvertCase(T &str, QStringIterator it)
signed short caseDiff = Traits::caseDiff(prop); signed short caseDiff = Traits::caseDiff(prop);
if (Q_UNLIKELY(Traits::caseSpecial(prop))) { if (Q_UNLIKELY(Traits::caseSpecial(prop))) {
// slow path // slow path: the string is growing
const ushort *specialCase = specialCaseMap + caseDiff; const ushort *specialCase = specialCaseMap + caseDiff;
ushort length = *specialCase++; ushort length = *specialCase++;
int pos = pp - s.constBegin(); int inpos = it.index() - 1;
s.replace(pos, 1, reinterpret_cast<const QChar *>(specialCase), length); int outpos = pp - s.constBegin();
pp = const_cast<QChar *>(s.constBegin()) + pos + length;
s.replace(outpos, 1, reinterpret_cast<const QChar *>(specialCase), length);
pp = const_cast<QChar *>(s.constBegin()) + outpos + length;
// do we need to adjust the input iterator too?
// if it is pointing to s's data, str is empty
if (str.isEmpty())
it = QStringIterator(s.constBegin(), inpos + length, s.constEnd());
} else if (QChar::requiresSurrogates(uc)) { } else if (QChar::requiresSurrogates(uc)) {
*pp++ = QChar::highSurrogate(uc + caseDiff); *pp++ = QChar::highSurrogate(uc + caseDiff);
*pp++ = QChar::lowSurrogate(uc + caseDiff); *pp++ = QChar::lowSurrogate(uc + caseDiff);

View File

@ -69,6 +69,13 @@ public:
{ {
} }
inline explicit QStringIterator(const QChar *begin, int idx, const QChar *end)
: i(begin),
pos(begin + idx),
e(end)
{
}
inline QString::const_iterator position() const inline QString::const_iterator position() const
{ {
return pos; return pos;

View File

@ -116,8 +116,9 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
\class QTimeZone \class QTimeZone
\inmodule QtCore \inmodule QtCore
\since 5.2 \since 5.2
\brief The QTimeZone class converts between between UTC and local time in a
specific time zone. \brief The QTimeZone class converts between UTC and local time in a specific
time zone.
\threadsafe \threadsafe
@ -198,14 +199,15 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
The difference between UTC and the local time in a time zone is expressed The difference between UTC and the local time in a time zone is expressed
as an offset in seconds from UTC, i.e. the number of seconds to add to UTC as an offset in seconds from UTC, i.e. the number of seconds to add to UTC
to obtain the local time. The total offset is comprised of two component to obtain the local time. The total offset is comprised of two component
parts, the standard time offset and the daylight time offset. The standard parts, the standard time offset and the daylight-saving time offset. The
time offset is the number of seconds to add to UTC to obtain standard time standard time offset is the number of seconds to add to UTC to obtain
in the time zone. The daylight time offset is the number of seconds to add standard time in the time zone. The daylight-saving time offset is the
to the standard time offset to obtain daylight time in the time zone. number of seconds to add to the standard time offset to obtain
daylight-saving time (abbreviated DST and sometimes called "daylight time"
or "summer time") in the time zone.
Note that the standard and daylight offsets for a time zone may change over Note that the standard and DST offsets for a time zone may change over time
time as countries have changed daylight time laws or even their standard as countries have changed DST laws or even their standard time offset.
time offset.
\section2 License \section2 License
@ -240,21 +242,20 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
\enum QTimeZone::TimeType \enum QTimeZone::TimeType
The type of time zone time, for example when requesting the name. In time The type of time zone time, for example when requesting the name. In time
zones that do not apply daylight time, all three values may return the zones that do not apply DST, all three values may return the same result.
same result.
\value StandardTime \value StandardTime
The standard time in a time zone, i.e. when Daylight Savings is not The standard time in a time zone, i.e. when Daylight-Saving is not
in effect. in effect.
For example when formatting a display name this will show something For example when formatting a display name this will show something
like "Pacific Standard Time". like "Pacific Standard Time".
\value DaylightTime \value DaylightTime
A time when Daylight Savings is in effect. A time when Daylight-Saving is in effect.
For example when formatting a display name this will show something For example when formatting a display name this will show something
like "Pacific daylight time". like "Pacific daylight-saving time".
\value GenericTime \value GenericTime
A time which is not specifically Standard or Daylight time, either A time which is not specifically Standard or Daylight-Saving time,
an unknown time or a neutral form. either an unknown time or a neutral form.
For example when formatting a display name this will show something For example when formatting a display name this will show something
like "Pacific Time". like "Pacific Time".
*/ */
@ -285,11 +286,11 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
\li OffsetData::atUtc The datetime of the offset data in UTC time. \li OffsetData::atUtc The datetime of the offset data in UTC time.
\li OffsetData::offsetFromUtc The total offset from UTC in effect at the datetime. \li OffsetData::offsetFromUtc The total offset from UTC in effect at the datetime.
\li OffsetData::standardTimeOffset The standard time offset component of the total offset. \li OffsetData::standardTimeOffset The standard time offset component of the total offset.
\li OffsetData::daylightTimeOffset The daylight time offset component of the total offset. \li OffsetData::daylightTimeOffset The DST offset component of the total offset.
\li OffsetData::abbreviation The abbreviation in effect at the datetime. \li OffsetData::abbreviation The abbreviation in effect at the datetime.
\endlist \endlist
For example, for time zone "Europe/Berlin" the OffsetDate in standard and daylight time might be: For example, for time zone "Europe/Berlin" the OffsetDate in standard and DST might be:
\list \list
\li atUtc = QDateTime(QDate(2013, 1, 1), QTime(0, 0, 0), Qt::UTC) \li atUtc = QDateTime(QDate(2013, 1, 1), QTime(0, 0, 0), Qt::UTC)
@ -530,8 +531,7 @@ QString QTimeZone::comment() const
If the \a locale is not provided then the application default locale will If the \a locale is not provided then the application default locale will
be used. be used.
The display name may change depending on daylight time or historical The display name may change depending on DST or historical events.
events.
\sa abbreviation() \sa abbreviation()
*/ */
@ -571,8 +571,7 @@ QString QTimeZone::displayName(TimeType timeType, NameType nameType,
/*! /*!
Returns the time zone abbreviation at the given \a atDateTime. The Returns the time zone abbreviation at the given \a atDateTime. The
abbreviation may change depending on daylight time or even abbreviation may change depending on DST or even historical events.
historical events.
Note that the abbreviation is not guaranteed to be unique to this time zone Note that the abbreviation is not guaranteed to be unique to this time zone
and should not be used in place of the ID or display name. and should not be used in place of the ID or display name.
@ -591,13 +590,13 @@ QString QTimeZone::abbreviation(const QDateTime &atDateTime) const
/*! /*!
Returns the total effective offset at the given \a atDateTime, i.e. the Returns the total effective offset at the given \a atDateTime, i.e. the
number of seconds to add to UTC to obtain the local time. This includes number of seconds to add to UTC to obtain the local time. This includes
any daylight time offset that may be in effect, i.e. it is the sum of any DST offset that may be in effect, i.e. it is the sum of
standardTimeOffset() and daylightTimeOffset() for the given datetime. standardTimeOffset() and daylightTimeOffset() for the given datetime.
For example, for the time zone "Europe/Berlin" the standard time offset is For example, for the time zone "Europe/Berlin" the standard time offset is
+3600 seconds and the daylight time offset is +3600 seconds. During standard +3600 seconds and the DST offset is +3600 seconds. During standard time
time offsetFromUtc() will return +3600 (UTC+01:00), and during daylight time offsetFromUtc() will return +3600 (UTC+01:00), and during DST it will
it will return +7200 (UTC+02:00). return +7200 (UTC+02:00).
\sa standardTimeOffset(), daylightTimeOffset() \sa standardTimeOffset(), daylightTimeOffset()
*/ */
@ -613,11 +612,11 @@ int QTimeZone::offsetFromUtc(const QDateTime &atDateTime) const
/*! /*!
Returns the standard time offset at the given \a atDateTime, i.e. the Returns the standard time offset at the given \a atDateTime, i.e. the
number of seconds to add to UTC to obtain the local Standard Time. This number of seconds to add to UTC to obtain the local Standard Time. This
excludes any daylight time offset that may be in effect. excludes any DST offset that may be in effect.
For example, for the time zone "Europe/Berlin" the standard time offset is For example, for the time zone "Europe/Berlin" the standard time offset is
+3600 seconds. During both standard and daylight time offsetFromUtc() will +3600 seconds. During both standard and DST offsetFromUtc() will return
return +3600 (UTC+01:00). +3600 (UTC+01:00).
\sa offsetFromUtc(), daylightTimeOffset() \sa offsetFromUtc(), daylightTimeOffset()
*/ */
@ -631,13 +630,13 @@ int QTimeZone::standardTimeOffset(const QDateTime &atDateTime) const
} }
/*! /*!
Returns the daylight time offset at the given \a atDateTime, i.e. the Returns the daylight-saving time offset at the given \a atDateTime,
number of seconds to add to the standard time offset to obtain the local i.e. the number of seconds to add to the standard time offset to obtain the
daylight time. local daylight-saving time.
For example, for the time zone "Europe/Berlin" the daylight time offset For example, for the time zone "Europe/Berlin" the DST offset is +3600
is +3600 seconds. During standard time daylightTimeOffset() will return seconds. During standard time daylightTimeOffset() will return 0, and when
0, and during daylight time it will return +3600. daylight-saving is in effect it will return +3600.
\sa offsetFromUtc(), standardTimeOffset() \sa offsetFromUtc(), standardTimeOffset()
*/ */
@ -651,7 +650,7 @@ int QTimeZone::daylightTimeOffset(const QDateTime &atDateTime) const
} }
/*! /*!
Returns \c true if the time zone has observed daylight time at any time. Returns \c true if the time zone has practiced daylight-saving at any time.
\sa isDaylightTime(), daylightTimeOffset() \sa isDaylightTime(), daylightTimeOffset()
*/ */
@ -665,7 +664,7 @@ bool QTimeZone::hasDaylightTime() const
} }
/*! /*!
Returns \c true if the given \a atDateTime is in daylight time. Returns \c true if daylight-saving was in effect at the given \a atDateTime.
\sa hasDaylightTime(), daylightTimeOffset() \sa hasDaylightTime(), daylightTimeOffset()
*/ */

View File

@ -246,8 +246,8 @@ QTimeZonePrivate::Data QTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const
QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs) const QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs) const
{ {
if (!hasDaylightTime() ||!hasTransitions()) { if (!hasDaylightTime() ||!hasTransitions()) {
// No daylight time means same offset for all local msecs // No DST means same offset for all local msecs
// Having daylight time but no transitions means we can't calculate, so use nearest // Having DST but no transitions means we can't calculate, so use nearest
return data(forLocalMSecs - (standardTimeOffset(forLocalMSecs) * 1000)); return data(forLocalMSecs - (standardTimeOffset(forLocalMSecs) * 1000));
} }
@ -276,16 +276,16 @@ QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs)
} }
if (tran.daylightTimeOffset == 0) { if (tran.daylightTimeOffset == 0) {
// If tran is in StandardTime, then need to check if falls close either daylight transition // If tran is in StandardTime, then need to check if falls close to either DST transition.
// If it does, then it may need adjusting for missing hour or for second occurrence // If it does, then it may need adjusting for missing hour or for second occurrence
qint64 diffPrevTran = forLocalMSecs qint64 diffPrevTran = forLocalMSecs
- (tran.atMSecsSinceEpoch + (tran.offsetFromUtc * 1000)); - (tran.atMSecsSinceEpoch + (tran.offsetFromUtc * 1000));
qint64 diffNextTran = nextTran.atMSecsSinceEpoch + (nextTran.offsetFromUtc * 1000) qint64 diffNextTran = nextTran.atMSecsSinceEpoch + (nextTran.offsetFromUtc * 1000)
- forLocalMSecs; - forLocalMSecs;
if (diffPrevTran >= 0 && diffPrevTran < MSECS_TRAN_WINDOW) { if (diffPrevTran >= 0 && diffPrevTran < MSECS_TRAN_WINDOW) {
// If tran picked is for standard time check if changed from daylight in last 6 hours, // If tran picked is for standard time check if changed from DST in last 6 hours,
// as the local msecs may be ambiguous and represent two valid utc msecs. // as the local msecs may be ambiguous and represent two valid utc msecs.
// If in last 6 hours then get prev tran and if diff falls within the daylight offset // If in last 6 hours then get prev tran and if diff falls within the DST offset
// then use the prev tran as we default to the FirstOccurrence // then use the prev tran as we default to the FirstOccurrence
// TODO Check if faster to just always get prev tran, or if faster using 6 hour check. // TODO Check if faster to just always get prev tran, or if faster using 6 hour check.
Data dstTran = previousTransition(tran.atMSecsSinceEpoch); Data dstTran = previousTransition(tran.atMSecsSinceEpoch);

View File

@ -150,7 +150,7 @@ int QAndroidTimeZonePrivate::daylightTimeOffset(qint64 atMSecsSinceEpoch) const
bool QAndroidTimeZonePrivate::hasDaylightTime() const bool QAndroidTimeZonePrivate::hasDaylightTime() const
{ {
if ( androidTimeZone.isValid() ) if ( androidTimeZone.isValid() )
/* note: the Java function only tests for future daylight transtions, not past */ /* note: the Java function only tests for future DST transtions, not past */
return androidTimeZone.callMethod<jboolean>("useDaylightTime" ); return androidTimeZone.callMethod<jboolean>("useDaylightTime" );
else else
return false; return false;
@ -210,34 +210,34 @@ QTimeZonePrivate::Data QAndroidTimeZonePrivate::dataForLocalTime(qint64 forLocal
} else { } else {
qint64 UTCepochMSecs; qint64 UTCepochMSecs;
// compare the UTC time with standard offset against normal daylight offset of one hour // compare the UTC time with standard offset against normal DST offset of one hour
qint64 standardUTCMSecs(forLocalMSecs - (standardTimeOffset(forLocalMSecs) * 1000)); qint64 standardUTCMSecs(forLocalMSecs - (standardTimeOffset(forLocalMSecs) * 1000));
qint64 daylightUTCMsecs; qint64 daylightUTCMsecs;
// Check if daylight time does apply, // Check if daylight-saving time applies,
// checking also for daylight time boundaries // checking also for DST boundaries
if (isDaylightTime(standardUTCMSecs)) { if (isDaylightTime(standardUTCMSecs)) {
// If daylight does apply, then standardUTCMSecs will be an hour or so ahead of the real epoch time // If DST does apply, then standardUTCMSecs will be an hour or so ahead of the real epoch time
// so check that time // so check that time
daylightUTCMsecs = standardUTCMSecs - daylightTimeOffset(standardUTCMSecs)*1000; daylightUTCMsecs = standardUTCMSecs - daylightTimeOffset(standardUTCMSecs)*1000;
if (isDaylightTime(daylightUTCMsecs)) { if (isDaylightTime(daylightUTCMsecs)) {
// daylight time confirmed // DST confirmed
UTCepochMSecs = daylightUTCMsecs; UTCepochMSecs = daylightUTCMsecs;
} else { } else {
// daylight time has just finished // DST has just finished
UTCepochMSecs = standardUTCMSecs; UTCepochMSecs = standardUTCMSecs;
} }
} else { } else {
// Standard time indicated, but check for a false negative. // Standard time indicated, but check for a false negative.
// Would a standard one-hour daylight offset indicate daylight time? // Would a standard one-hour DST offset indicate DST?
daylightUTCMsecs = standardUTCMSecs - 3600000; // 3600000 MSECS_PER_HOUR daylightUTCMsecs = standardUTCMSecs - 3600000; // 3600000 MSECS_PER_HOUR
if (isDaylightTime(daylightUTCMsecs)) { if (isDaylightTime(daylightUTCMsecs)) {
// daylight time may have just started, // DST may have just started,
// but double check against timezone's own daylight offset // but double check against timezone's own DST offset
// (don't necessarily assume a one-hour offset) // (don't necessarily assume a one-hour offset)
daylightUTCMsecs = standardUTCMSecs - daylightTimeOffset(daylightUTCMsecs)*1000; daylightUTCMsecs = standardUTCMSecs - daylightTimeOffset(daylightUTCMsecs)*1000;
if (isDaylightTime(daylightUTCMsecs)) { if (isDaylightTime(daylightUTCMsecs)) {
// daylight time confirmed // DST confirmed
UTCepochMSecs = daylightUTCMsecs; UTCepochMSecs = daylightUTCMsecs;
} else { } else {
// false positive, apply standard time after all // false positive, apply standard time after all

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
** **
****************************************************************************/ ****************************************************************************/
/* This file is autogenerated from the Unicode 7.0 database. Do not edit */ /* This file is autogenerated from the Unicode 8.0 database. Do not edit */
// //
// W A R N I N G // W A R N I N G
@ -51,7 +51,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#define UNICODE_DATA_VERSION QChar::Unicode_7_0 #define UNICODE_DATA_VERSION QChar::Unicode_8_0
namespace QUnicodeTables { namespace QUnicodeTables {
@ -82,6 +82,38 @@ struct Properties {
Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) Q_DECL_NOTHROW; Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) Q_DECL_NOTHROW;
Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) Q_DECL_NOTHROW; Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) Q_DECL_NOTHROW;
struct LowercaseTraits
{
static inline signed short caseDiff(const Properties *prop)
{ return prop->lowerCaseDiff; }
static inline bool caseSpecial(const Properties *prop)
{ return prop->lowerCaseSpecial; }
};
struct UppercaseTraits
{
static inline signed short caseDiff(const Properties *prop)
{ return prop->upperCaseDiff; }
static inline bool caseSpecial(const Properties *prop)
{ return prop->upperCaseSpecial; }
};
struct TitlecaseTraits
{
static inline signed short caseDiff(const Properties *prop)
{ return prop->titleCaseDiff; }
static inline bool caseSpecial(const Properties *prop)
{ return prop->titleCaseSpecial; }
};
struct CasefoldTraits
{
static inline signed short caseDiff(const Properties *prop)
{ return prop->caseFoldDiff; }
static inline bool caseSpecial(const Properties *prop)
{ return prop->caseFoldSpecial; }
};
enum GraphemeBreakClass { enum GraphemeBreakClass {
GraphemeBreak_Other, GraphemeBreak_Other,
GraphemeBreak_CR, GraphemeBreak_CR,

View File

@ -49,7 +49,7 @@ namespace QUnicodeTools {
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// //
// The text boundaries determination algorithm. // The text boundaries determination algorithm.
// See http://www.unicode.org/reports/tr29/tr29-25.html // See http://www.unicode.org/reports/tr29/tr29-27.html
// //
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -244,8 +244,9 @@ namespace SB {
enum State { enum State {
Initial, Initial,
Lower,
Upper, Upper,
UpATerm, LUATerm,
ATerm, ATerm,
ATermC, ATermC,
ACS, ACS,
@ -260,10 +261,11 @@ enum State {
static const uchar breakTable[BAfter + 1][QUnicodeTables::SentenceBreak_Close + 1] = { static const uchar breakTable[BAfter + 1][QUnicodeTables::SentenceBreak_Close + 1] = {
// Other CR LF Sep Extend Sp Lower Upper OLetter Numeric ATerm SContinue STerm Close // Other CR LF Sep Extend Sp Lower Upper OLetter Numeric ATerm SContinue STerm Close
{ Initial, BAfterC, BAfter , BAfter , Initial, Initial, Initial, Upper , Initial, Initial, ATerm , Initial, STerm , Initial }, // Initial { Initial, BAfterC, BAfter , BAfter , Initial, Initial, Lower , Upper , Initial, Initial, ATerm , Initial, STerm , Initial }, // Initial
{ Initial, BAfterC, BAfter , BAfter , Upper , Initial, Initial, Upper , Initial, Initial, UpATerm, STerm , STerm , Initial }, // Upper { Initial, BAfterC, BAfter , BAfter , Lower , Initial, Initial, Initial, Initial, Initial, LUATerm, Initial, STerm , Initial }, // Lower
{ Initial, BAfterC, BAfter , BAfter , Upper , Initial, Initial, Upper , Initial, Initial, LUATerm, STerm , STerm , Initial }, // Upper
{ Lookup , BAfterC, BAfter , BAfter , UpATerm, ACS , Initial, Upper , Break , Initial, ATerm , STerm , STerm , ATermC }, // UpATerm { Lookup , BAfterC, BAfter , BAfter , LUATerm, ACS , Initial, Upper , Break , Initial, ATerm , STerm , STerm , ATermC }, // LUATerm
{ Lookup , BAfterC, BAfter , BAfter , ATerm , ACS , Initial, Break , Break , Initial, ATerm , STerm , STerm , ATermC }, // ATerm { Lookup , BAfterC, BAfter , BAfter , ATerm , ACS , Initial, Break , Break , Initial, ATerm , STerm , STerm , ATermC }, // ATerm
{ Lookup , BAfterC, BAfter , BAfter , ATermC , ACS , Initial, Break , Break , Lookup , ATerm , STerm , STerm , ATermC }, // ATermC { Lookup , BAfterC, BAfter , BAfter , ATermC , ACS , Initial, Break , Break , Lookup , ATerm , STerm , STerm , ATermC }, // ATermC
{ Lookup , BAfterC, BAfter , BAfter , ACS , ACS , Initial, Break , Break , Lookup , ATerm , STerm , STerm , Lookup }, // ACS { Lookup , BAfterC, BAfter , BAfter , ACS , ACS , Initial, Break , Break , Lookup , ATerm , STerm , STerm , Lookup }, // ACS
@ -341,7 +343,7 @@ static void getSentenceBreaks(const ushort *string, quint32 len, QCharAttributes
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// //
// The line breaking algorithm. // The line breaking algorithm.
// See http://www.unicode.org/reports/tr14/tr14-33.html // See http://www.unicode.org/reports/tr14/tr14-35.html
// //
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -408,26 +410,29 @@ inline Class toClass(QUnicodeTables::LineBreakClass lbc, QChar::Category categor
/* In order to support the tailored implementation of LB25 properly /* In order to support the tailored implementation of LB25 properly
the following changes were made in the pair table to allow breaks the following changes were made in the pair table to allow breaks
where the numeric expression doesn't match the template (i.e. [^NU](IS|SY)NU): where the numeric expression doesn't match the template (i.e. [^NU](IS|SY)NU):
CL->PO from IB to DB (CL)(PO) from IB to DB
CP->PO from IB to DB (CP)(PO) from IB to DB
CL->PR from IB to DB (CL)(PR) from IB to DB
CP->PR from IB to DB (CP)(PR) from IB to DB
PO->OP from IB to DB (PO)(OP) from IB to DB
PR->OP from IB to DB (PR)(OP) from IB to DB
IS->NU from IB to DB (IS)(NU) from IB to DB
SY->NU from IB to DB (SY)(NU) from IB to DB
*/ */
// The following line break classes are not treated by the pair table /* In order to implementat LB21a properly a special rule HH has been introduced and
// and must be resolved outside: the following changes were made in the pair table to disallow breaks after Hebrew + Hyphen:
// AI, BK, CB, CJ, CR, LF, NL, SA, SG, SP, XX (HL)(HY|BA) from IB to CI
(HY|BA)(!CB) from DB to HH
*/
enum Action { enum Action {
ProhibitedBreak, PB = ProhibitedBreak, ProhibitedBreak, PB = ProhibitedBreak,
DirectBreak, DB = DirectBreak, DirectBreak, DB = DirectBreak,
IndirectBreak, IB = IndirectBreak, IndirectBreak, IB = IndirectBreak,
CombiningIndirectBreak, CI = CombiningIndirectBreak, CombiningIndirectBreak, CI = CombiningIndirectBreak,
CombiningProhibitedBreak, CP = CombiningProhibitedBreak CombiningProhibitedBreak, CP = CombiningProhibitedBreak,
ProhibitedBreakAfterHebrewPlusHyphen, HH = ProhibitedBreakAfterHebrewPlusHyphen
}; };
static const uchar breakTable[QUnicodeTables::LineBreak_CB + 1][QUnicodeTables::LineBreak_CB + 1] = { static const uchar breakTable[QUnicodeTables::LineBreak_CB + 1][QUnicodeTables::LineBreak_CB + 1] = {
@ -438,18 +443,18 @@ static const uchar breakTable[QUnicodeTables::LineBreak_CB + 1][QUnicodeTables::
/* QU */ { PB, PB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, PB, CI, PB, IB, IB, IB, IB, IB, IB, IB }, /* QU */ { PB, PB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, PB, CI, PB, IB, IB, IB, IB, IB, IB, IB },
/* GL */ { IB, PB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, PB, CI, PB, IB, IB, IB, IB, IB, IB, IB }, /* GL */ { IB, PB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, PB, CI, PB, IB, IB, IB, IB, IB, IB, IB },
/* NS */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, DB, DB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB }, /* NS */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, DB, DB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB },
/* EX */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, DB, DB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB }, /* EX */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, DB, DB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB },
/* SY */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, DB, DB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB }, /* SY */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, DB, IB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB },
/* IS */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, IB, IB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB }, /* IS */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, IB, IB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB },
/* PR */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, IB, IB, IB, IB, DB, IB, IB, DB, DB, PB, CI, PB, IB, IB, IB, IB, IB, DB, DB }, /* PR */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, IB, IB, IB, IB, DB, IB, IB, DB, DB, PB, CI, PB, IB, IB, IB, IB, IB, DB, DB },
/* PO */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, IB, IB, IB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB }, /* PO */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, IB, IB, IB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB },
/* NU */ { IB, PB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, IB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB }, /* NU */ { IB, PB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, IB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB },
/* AL */ { IB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, IB, IB, IB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB }, /* AL */ { IB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, IB, IB, IB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB },
/* HL */ { IB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, IB, IB, IB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB }, /* HL */ { IB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, IB, IB, IB, DB, IB, CI, CI, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB },
/* ID */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, IB, DB, DB, DB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB }, /* ID */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, IB, DB, DB, DB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB },
/* IN */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, DB, DB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB }, /* IN */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, DB, DB, DB, IB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB },
/* HY */ { DB, PB, PB, IB, DB, IB, PB, PB, PB, DB, DB, IB, DB, DB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB }, /* HY */ { HH, PB, PB, IB, HH, IB, PB, PB, PB, HH, HH, IB, HH, HH, HH, HH, IB, IB, HH, HH, PB, CI, PB, HH, HH, HH, HH, HH, HH, DB },
/* BA */ { DB, PB, PB, IB, DB, IB, PB, PB, PB, DB, DB, DB, DB, DB, DB, DB, IB, IB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB }, /* BA */ { HH, PB, PB, IB, HH, IB, PB, PB, PB, HH, HH, HH, HH, HH, HH, HH, IB, IB, HH, HH, PB, CI, PB, HH, HH, HH, HH, HH, HH, DB },
/* BB */ { IB, PB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, PB, CI, PB, IB, IB, IB, IB, IB, IB, DB }, /* BB */ { IB, PB, PB, IB, IB, IB, PB, PB, PB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, IB, PB, CI, PB, IB, IB, IB, IB, IB, IB, DB },
/* B2 */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, DB, DB, DB, DB, IB, IB, DB, PB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB }, /* B2 */ { DB, PB, PB, IB, IB, IB, PB, PB, PB, DB, DB, DB, DB, DB, DB, DB, IB, IB, DB, PB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB },
/* ZW */ { DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, PB, DB, DB, DB, DB, DB, DB, DB, DB, DB }, /* ZW */ { DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, PB, DB, DB, DB, DB, DB, DB, DB, DB, DB },
@ -464,6 +469,10 @@ static const uchar breakTable[QUnicodeTables::LineBreak_CB + 1][QUnicodeTables::
/* CB */ { DB, PB, PB, IB, IB, DB, PB, PB, PB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB } /* CB */ { DB, PB, PB, IB, IB, DB, PB, PB, PB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, DB, PB, CI, PB, DB, DB, DB, DB, DB, DB, DB }
}; };
// The following line break classes are not treated by the pair table
// and must be resolved outside:
// AI, BK, CB, CJ, CR, LF, NL, SA, SG, SP, XX
} // namespace LB } // namespace LB
static void getLineBreaks(const ushort *string, quint32 len, QCharAttributes *attributes) static void getLineBreaks(const ushort *string, quint32 len, QCharAttributes *attributes)
@ -555,6 +564,10 @@ static void getLineBreaks(const ushort *string, quint32 len, QCharAttributes *at
if (lcls != QUnicodeTables::LineBreak_SP) if (lcls != QUnicodeTables::LineBreak_SP)
goto next_no_cls_update; goto next_no_cls_update;
break; break;
case LB::ProhibitedBreakAfterHebrewPlusHyphen:
if (lcls != QUnicodeTables::LineBreak_HL)
attributes[pos].lineBreak = true;
break;
case LB::ProhibitedBreak: case LB::ProhibitedBreak:
// nothing to do // nothing to do
default: default:
@ -659,7 +672,7 @@ Q_CORE_EXPORT void initCharAttributes(const ushort *string, int length,
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// //
// The Unicode script property. See http://www.unicode.org/reports/tr24/tr24-22.html // The Unicode script property. See http://www.unicode.org/reports/tr24/tr24-24.html
// //
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -156,10 +156,6 @@ else:SOURCES += tools/qelapsedtimer_generic.cpp
contains(QT_CONFIG, zlib) { contains(QT_CONFIG, zlib) {
include($$PWD/../../3rdparty/zlib.pri) include($$PWD/../../3rdparty/zlib.pri)
corelib_zlib_headers.files = $$PWD/../../3rdparty/zlib/zconf.h\
$$PWD/../../3rdparty/zlib/zlib.h
corelib_zlib_headers.path = $$[QT_INSTALL_HEADERS]/QtZlib
INSTALLS += corelib_zlib_headers
} else { } else {
include($$PWD/../../3rdparty/zlib_dependency.pri) include($$PWD/../../3rdparty/zlib_dependency.pri)
} }

View File

@ -1398,8 +1398,12 @@ QDebug operator<<(QDebug dbg, const QIcon &i)
Given base foo.png and a target dpr of 2.5, this function will look for Given base foo.png and a target dpr of 2.5, this function will look for
foo@3x.png, then foo@2x, then fall back to foo.png if not found. foo@3x.png, then foo@2x, then fall back to foo.png if not found.
\a sourceDevicePixelRatio will be set to the value of N if the argument is
a non-null pointer
*/ */
QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio) QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio,
qreal *sourceDevicePixelRatio)
{ {
if (targetDevicePixelRatio <= 1.0) if (targetDevicePixelRatio <= 1.0)
return baseFileName; return baseFileName;
@ -1417,8 +1421,11 @@ QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRati
for (int n = qCeil(targetDevicePixelRatio); n > 1; --n) { for (int n = qCeil(targetDevicePixelRatio); n > 1; --n) {
QString atNxfileName = baseFileName; QString atNxfileName = baseFileName;
atNxfileName.insert(dotIndex, atNx.arg(n)); atNxfileName.insert(dotIndex, atNx.arg(n));
if (QFile::exists(atNxfileName)) if (QFile::exists(atNxfileName)) {
if (sourceDevicePixelRatio)
*sourceDevicePixelRatio = n;
return atNxfileName; return atNxfileName;
}
} }
return baseFileName; return baseFileName;

View File

@ -140,7 +140,8 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QIcon &);
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QIcon &); Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QIcon &);
#endif #endif
Q_GUI_EXPORT QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio); Q_GUI_EXPORT QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio,
qreal *sourceDevicePixelRatio = Q_NULLPTR);
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -4388,6 +4388,8 @@ QImage QImage::smoothScaled(int w, int h) const {
static QImage rotated90(const QImage &image) { static QImage rotated90(const QImage &image) {
QImage out(image.height(), image.width(), image.format()); QImage out(image.height(), image.width(), image.format());
out.setDotsPerMeterX(image.dotsPerMeterY());
out.setDotsPerMeterY(image.dotsPerMeterX());
if (image.colorCount() > 0) if (image.colorCount() > 0)
out.setColorTable(image.colorTable()); out.setColorTable(image.colorTable());
int w = image.width(); int w = image.width();
@ -4456,6 +4458,8 @@ static QImage rotated180(const QImage &image) {
static QImage rotated270(const QImage &image) { static QImage rotated270(const QImage &image) {
QImage out(image.height(), image.width(), image.format()); QImage out(image.height(), image.width(), image.format());
out.setDotsPerMeterX(image.dotsPerMeterY());
out.setDotsPerMeterY(image.dotsPerMeterX());
if (image.colorCount() > 0) if (image.colorCount() > 0)
out.setColorTable(image.colorTable()); out.setColorTable(image.colorTable());
int w = image.width(); int w = image.width();

View File

@ -1,9 +1,4 @@
HEADERS += $$PWD/qpnghandler_p.h HEADERS += $$PWD/qpnghandler_p.h
SOURCES += $$PWD/qpnghandler.cpp SOURCES += $$PWD/qpnghandler.cpp
contains(QT_CONFIG, system-png) {
if(unix|mingw): LIBS_PRIVATE += -lpng
else:win32: LIBS += libpng.lib
} else { include($$PWD/../../3rdparty/png_dependency.pri)
include($$PWD/../../3rdparty/libpng.pri)
}

View File

@ -128,6 +128,8 @@ Qt::MouseButtons QGuiApplicationPrivate::tabletState = Qt::NoButton;
QWindow *QGuiApplicationPrivate::tabletPressTarget = 0; QWindow *QGuiApplicationPrivate::tabletPressTarget = 0;
QWindow *QGuiApplicationPrivate::currentMouseWindow = 0; QWindow *QGuiApplicationPrivate::currentMouseWindow = 0;
QString QGuiApplicationPrivate::styleOverride;
Qt::ApplicationState QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive; Qt::ApplicationState QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive;
bool QGuiApplicationPrivate::highDpiScalingUpdated = false; bool QGuiApplicationPrivate::highDpiScalingUpdated = false;
@ -1288,6 +1290,7 @@ void QGuiApplicationPrivate::init()
session_key = QString::fromWCharArray(guidstr); session_key = QString::fromWCharArray(guidstr);
# endif # endif
#endif #endif
QString s;
int j = argc ? 1 : 0; int j = argc ? 1 : 0;
for (int i=1; i<argc; i++) { for (int i=1; i<argc; i++) {
if (argv[i] && *argv[i] != '-') { if (argv[i] && *argv[i] != '-') {
@ -1330,9 +1333,16 @@ void QGuiApplicationPrivate::init()
#endif #endif
} else if (arg == "-testability") { } else if (arg == "-testability") {
loadTestability = true; loadTestability = true;
} else if (arg.indexOf("-style=", 0) != -1) {
s = QString::fromLocal8Bit(arg.right(arg.length() - 7).toLower());
} else if (arg == "-style" && i < argc-1) {
s = QString::fromLocal8Bit(argv[++i]).toLower();
} else { } else {
argv[j++] = argv[i]; argv[j++] = argv[i];
} }
if (!s.isEmpty())
styleOverride = s;
} }
if (j < argc) { if (j < argc) {

View File

@ -221,6 +221,7 @@ public:
static QFont *app_font; static QFont *app_font;
static QString styleOverride;
static QStyleHints *styleHints; static QStyleHints *styleHints;
static bool obey_desktop_settings; static bool obey_desktop_settings;
QInputMethod *inputMethod; QInputMethod *inputMethod;

View File

@ -484,7 +484,9 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co
{ {
QPlatformScreen *currentScreen = screen(); QPlatformScreen *currentScreen = screen();
QPlatformScreen *fallback = currentScreen; QPlatformScreen *fallback = currentScreen;
QPoint center = newGeometry.center(); //QRect::center can return a value outside the rectangle if it's empty
const QPoint center = newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center();
if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) { if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) {
Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) { Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) {
if (screen->geometry().contains(center)) if (screen->geometry().contains(center))

View File

@ -379,9 +379,9 @@ static const uint *QT_FASTCALL convertARGBPMFromARGB32PM(uint *buffer, const uin
template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixelLayoutRGB() template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixelLayoutRGB()
{ {
return QPixelLayout{ return QPixelLayout{
redWidth<Format>(), redShift<Format>(), uchar(redWidth<Format>()), uchar(redShift<Format>()),
greenWidth<Format>(), greenShift<Format>(), uchar(greenWidth<Format>()), uchar(greenShift<Format>()),
blueWidth<Format>(), blueShift<Format>(), uchar(blueWidth<Format>()), uchar(blueShift<Format>()),
0, 0, 0, 0,
false, bitsPerPixel<Format>(), false, bitsPerPixel<Format>(),
convertToRGB32<Format>, convertToRGB32<Format>,
@ -394,10 +394,10 @@ template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixe
template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixelLayoutARGBPM() template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixelLayoutARGBPM()
{ {
return QPixelLayout{ return QPixelLayout{
redWidth<Format>(), redShift<Format>(), uchar(redWidth<Format>()), uchar(redShift<Format>()),
greenWidth<Format>(), greenShift<Format>(), uchar(greenWidth<Format>()), uchar(greenShift<Format>()),
blueWidth<Format>(), blueShift<Format>(), uchar(blueWidth<Format>()), uchar(blueShift<Format>()),
alphaWidth<Format>(), alphaShift<Format>(), uchar(alphaWidth<Format>()), uchar(alphaShift<Format>()),
true, bitsPerPixel<Format>(), true, bitsPerPixel<Format>(),
convertARGBPMToARGB32PM<Format>, convertARGBPMToARGB32PM<Format>,
convertARGBPMFromARGB32PM<Format>, convertARGBPMFromARGB32PM<Format>,

View File

@ -161,12 +161,12 @@ public:
} }
private: private:
static Q_DECL_CONSTEXPR quint64 alphaMask() { return Q_UINT64_C(0xffff) << AlphaShift; } static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE quint64 alphaMask() { return Q_UINT64_C(0xffff) << AlphaShift; }
static Q_DECL_CONSTEXPR uint div_257_floor(uint x) { return (x - (x >> 8)) >> 8; } static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint div_257_floor(uint x) { return (x - (x >> 8)) >> 8; }
static Q_DECL_CONSTEXPR uint div_257(uint x) { return div_257_floor(x + 128); } static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint div_257(uint x) { return div_257_floor(x + 128); }
static Q_DECL_CONSTEXPR uint div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; } static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; }
Q_DECL_RELAXED_CONSTEXPR QRgba64 unpremultiplied_32bit() const Q_DECL_RELAXED_CONSTEXPR Q_ALWAYS_INLINE QRgba64 unpremultiplied_32bit() const
{ {
if (isOpaque() || isTransparent()) if (isOpaque() || isTransparent())
return *this; return *this;
@ -176,7 +176,7 @@ private:
const quint16 b = (quint32(blue()) * 0xffff + a/2) / a; const quint16 b = (quint32(blue()) * 0xffff + a/2) / a;
return fromRgba64(r, g, b, a); return fromRgba64(r, g, b, a);
} }
Q_DECL_RELAXED_CONSTEXPR QRgba64 unpremultiplied_64bit() const Q_DECL_RELAXED_CONSTEXPR Q_ALWAYS_INLINE QRgba64 unpremultiplied_64bit() const
{ {
if (isOpaque() || isTransparent()) if (isOpaque() || isTransparent())
return *this; return *this;

View File

@ -370,17 +370,15 @@ bool QFontEngine::supportsScript(QChar::Script script) const
return true; return true;
} }
#ifdef Q_OS_MAC #ifdef QT_ENABLE_HARFBUZZ_NG
{ if (qt_useHarfbuzzNG()) {
#if defined(Q_OS_DARWIN)
// in AAT fonts, 'gsub' table is effectively replaced by 'mort'/'morx' table // in AAT fonts, 'gsub' table is effectively replaced by 'mort'/'morx' table
uint len; uint len;
if (getSfntTableData(MAKE_TAG('m','o','r','t'), 0, &len) || getSfntTableData(MAKE_TAG('m','o','r','x'), 0, &len)) if (getSfntTableData(MAKE_TAG('m','o','r','t'), 0, &len) || getSfntTableData(MAKE_TAG('m','o','r','x'), 0, &len))
return true; return true;
}
#endif #endif
#ifdef QT_ENABLE_HARFBUZZ_NG
if (qt_useHarfbuzzNG()) {
bool ret = false; bool ret = false;
if (hb_face_t *face = hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this))) { if (hb_face_t *face = hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this))) {
hb_tag_t script_tag_1, script_tag_2; hb_tag_t script_tag_1, script_tag_2;
@ -1837,7 +1835,10 @@ QFontEngine *QFontEngineMulti::loadEngine(int at)
request.family = fallbackFamilyAt(at - 1); request.family = fallbackFamilyAt(at - 1);
if (QFontEngine *engine = QFontDatabase::findFont(request, m_script)) { if (QFontEngine *engine = QFontDatabase::findFont(request, m_script)) {
engine->fontDef = request; if (request.weight > QFont::Normal)
engine->fontDef.weight = request.weight;
if (request.style > QFont::StyleNormal)
engine->fontDef.style = request.style;
return engine; return engine;
} }

View File

@ -534,69 +534,87 @@ QFontEngineFT::Glyph::~Glyph()
delete [] data; delete [] data;
} }
static const uint subpixel_filter[3][3] = { struct LcdFilterDummy
{ 180, 60, 16 }, {
{ 38, 180, 38 }, static inline void filterPixel(uchar &, uchar &, uchar &)
{ 16, 60, 180 } {}
}; };
static inline uint filterPixel(uint red, uint green, uint blue, bool legacyFilter) struct LcdFilterLegacy
{ {
uint res; static inline void filterPixel(uchar &red, uchar &green, uchar &blue)
if (legacyFilter) { {
uint high = (red*subpixel_filter[0][0] + green*subpixel_filter[0][1] + blue*subpixel_filter[0][2]) >> 8; uint r = red, g = green, b = blue;
uint mid = (red*subpixel_filter[1][0] + green*subpixel_filter[1][1] + blue*subpixel_filter[1][2]) >> 8; // intra-pixel filter used by the legacy filter (adopted from _ft_lcd_filter_legacy)
uint low = (red*subpixel_filter[2][0] + green*subpixel_filter[2][1] + blue*subpixel_filter[2][2]) >> 8; red = (r * uint(65538 * 9/13) + g * uint(65538 * 1/6) + b * uint(65538 * 1/13)) / 65536;
res = (mid << 24) + (high << 16) + (mid << 8) + low; green = (r * uint(65538 * 3/13) + g * uint(65538 * 4/6) + b * uint(65538 * 3/13)) / 65536;
} else { blue = (r * uint(65538 * 1/13) + g * uint(65538 * 1/6) + b * uint(65538 * 9/13)) / 65536;
uint alpha = green;
res = (alpha << 24) + (red << 16) + (green << 8) + blue;
} }
return res; };
}
static void convertRGBToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr, bool legacyFilter) template <typename LcdFilter>
static void convertRGBToARGB_helper(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr)
{ {
int h = height;
const int offs = bgr ? -1 : 1; const int offs = bgr ? -1 : 1;
const int w = width * 3; const int w = width * 3;
while (h--) { while (height--) {
uint *dd = dst; uint *dd = dst;
for (int x = 0; x < w; x += 3) { for (int x = 0; x < w; x += 3) {
uint red = src[x+1-offs]; uchar red = src[x + 1 - offs];
uint green = src[x+1]; uchar green = src[x + 1];
uint blue = src[x+1+offs]; uchar blue = src[x + 1 + offs];
*dd = filterPixel(red, green, blue, legacyFilter); LcdFilter::filterPixel(red, green, blue);
++dd; // alpha = green
*dd++ = (green << 24) | (red << 16) | (green << 8) | blue;
} }
dst += width; dst += width;
src += src_pitch; src += src_pitch;
} }
} }
static void convertRGBToARGB_V(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr, bool legacyFilter) static inline void convertRGBToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr, bool legacyFilter)
{
if (!legacyFilter)
convertRGBToARGB_helper<LcdFilterDummy>(src, dst, width, height, src_pitch, bgr);
else
convertRGBToARGB_helper<LcdFilterLegacy>(src, dst, width, height, src_pitch, bgr);
}
template <typename LcdFilter>
static void convertRGBToARGB_V_helper(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr)
{ {
int h = height;
const int offs = bgr ? -src_pitch : src_pitch; const int offs = bgr ? -src_pitch : src_pitch;
while (h--) { while (height--) {
for (int x = 0; x < width; x++) { for (int x = 0; x < width; x++) {
uint red = src[x+src_pitch-offs]; uchar red = src[x + src_pitch - offs];
uint green = src[x+src_pitch]; uchar green = src[x + src_pitch];
uint blue = src[x+src_pitch+offs]; uchar blue = src[x + src_pitch + offs];
dst[x] = filterPixel(red, green, blue, legacyFilter); LcdFilter::filterPixel(red, green, blue);
// alpha = green
*dst++ = (green << 24) | (red << 16) | (green << 8) | blue;
} }
dst += width;
src += 3*src_pitch; src += 3*src_pitch;
} }
} }
static void convertGRAYToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch) { static inline void convertRGBToARGB_V(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr, bool legacyFilter)
for (int y = 0; y < height; ++y) { {
int readpos = (y * src_pitch); if (!legacyFilter)
int writepos = (y * width); convertRGBToARGB_V_helper<LcdFilterDummy>(src, dst, width, height, src_pitch, bgr);
for (int x = 0; x < width; ++x) { else
dst[writepos + x] = (0xFF << 24) + (src[readpos + x] << 16) + (src[readpos + x] << 8) + src[readpos + x]; convertRGBToARGB_V_helper<LcdFilterLegacy>(src, dst, width, height, src_pitch, bgr);
}
static inline void convertGRAYToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch)
{
while (height--) {
const uchar *p = src;
const uchar * const e = p + width;
while (p < e) {
uchar gray = *p++;
*dst++ = (0xFF << 24) | (gray << 16) | (gray << 8) | gray;
} }
src += src_pitch;
} }
} }

View File

@ -188,7 +188,15 @@ static const hb_script_t _qtscript_to_hbscript[] = {
HB_SCRIPT_SIDDHAM, HB_SCRIPT_SIDDHAM,
HB_SCRIPT_KHUDAWADI, HB_SCRIPT_KHUDAWADI,
HB_SCRIPT_TIRHUTA, HB_SCRIPT_TIRHUTA,
HB_SCRIPT_WARANG_CITI HB_SCRIPT_WARANG_CITI,
// Unicode 8.0 additions
HB_SCRIPT_AHOM,
HB_SCRIPT_ANATOLIAN_HIEROGLYPHS,
HB_SCRIPT_HATRAN,
HB_SCRIPT_MULTANI,
HB_SCRIPT_OLD_HUNGARIAN,
HB_SCRIPT_SIGNWRITING
}; };
Q_STATIC_ASSERT(QChar::ScriptCount == sizeof(_qtscript_to_hbscript) / sizeof(_qtscript_to_hbscript[0])); Q_STATIC_ASSERT(QChar::ScriptCount == sizeof(_qtscript_to_hbscript) / sizeof(_qtscript_to_hbscript[0]));

View File

@ -1120,15 +1120,6 @@ QT_BEGIN_INCLUDE_NAMESPACE
QT_END_INCLUDE_NAMESPACE QT_END_INCLUDE_NAMESPACE
#if defined(Q_OS_OSX) && !defined(QT_NO_FREETYPE)
static const char *s_shapersForOsxFreeType[] =
{
"ot",
"fallback",
Q_NULLPTR
};
#endif
int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *string, int itemLength, QFontEngine *fontEngine, const QVector<uint> &itemBoundaries, bool kerningEnabled) const int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *string, int itemLength, QFontEngine *fontEngine, const QVector<uint> &itemBoundaries, bool kerningEnabled) const
{ {
uint glyphs_shaped = 0; uint glyphs_shaped = 0;
@ -1182,13 +1173,21 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
const int num_features = 1; const int num_features = 1;
const char *const *shaper_list = Q_NULLPTR; const char *const *shaper_list = Q_NULLPTR;
#if defined(Q_OS_OSX) && !defined(QT_NO_FREETYPE) #if defined(Q_OS_DARWIN)
// What's behind QFontEngine::FaceData::user_data isn't compatible between CoreText and // What's behind QFontEngine::FaceData::user_data isn't compatible between different font engines
// FreeType font engines - specifically functions in hb-coretext.cc would run into undefined // - specifically functions in hb-coretext.cc would run into undefined behavior with data
// behavior with data from the FreeType engine. The OpenType shaper works with that engine. // from non-CoreText engine. The other shapers works with that engine just fine.
if (actualFontEngine->type() == QFontEngine::Freetype) if (actualFontEngine->type() != QFontEngine::Mac) {
shaper_list = s_shapersForOsxFreeType; static const char *s_shaper_list_without_coretext[] = {
"graphite2",
"ot",
"fallback",
Q_NULLPTR
};
shaper_list = s_shaper_list_without_coretext;
}
#endif #endif
bool shapedOk = hb_shape_full(hb_font, buffer, features, num_features, shaper_list); bool shapedOk = hb_shape_full(hb_font, buffer, features, num_features, shaper_list);
if (Q_UNLIKELY(!shapedOk)) { if (Q_UNLIKELY(!shapedOk)) {
hb_buffer_destroy(buffer); hb_buffer_destroy(buffer);
@ -1268,19 +1267,20 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
g.glyphs[i] |= (engineIdx << 24); g.glyphs[i] |= (engineIdx << 24);
} }
#ifdef Q_OS_MAC #ifdef Q_OS_DARWIN
// CTRunGetPosition has a bug which applies matrix on 10.6, so we disable if (actualFontEngine->type() == QFontEngine::Mac) {
// scaling the advances for this particular version // CTRunGetPosition has a bug which applies matrix on 10.6, so we disable
if (actualFontEngine->fontDef.stretch != 100 // scaling the advances for this particular version
&& QSysInfo::MacintoshVersion != QSysInfo::MV_10_6) { if (QSysInfo::MacintoshVersion != QSysInfo::MV_10_6 && actualFontEngine->fontDef.stretch != 100) {
QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100); QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100);
for (uint i = 0; i < num_glyphs; ++i) for (uint i = 0; i < num_glyphs; ++i)
g.advances[i] *= stretch; g.advances[i] *= stretch;
} }
if (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics) { if (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
for (uint i = 0; i < num_glyphs; ++i) for (uint i = 0; i < num_glyphs; ++i)
g.advances[i] = g.advances[i].round(); g.advances[i] = g.advances[i].round();
}
} }
#endif #endif

View File

@ -45,8 +45,10 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
extern QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio); extern QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio,
static QString resolveFileName(QString fileName, QUrl *url, qreal targetDevicePixelRatio) qreal *sourceDevicePixelRatio);
static QString resolveFileName(QString fileName, QUrl *url, qreal targetDevicePixelRatio,
qreal *sourceDevicePixelRatio)
{ {
// We might use the fileName for loading if url loading fails // We might use the fileName for loading if url loading fails
// try to make sure it is a valid file path. // try to make sure it is a valid file path.
@ -65,7 +67,7 @@ static QString resolveFileName(QString fileName, QUrl *url, qreal targetDevicePi
return fileName; return fileName;
// try to find a Nx version // try to find a Nx version
return qt_findAtNxFile(fileName, targetDevicePixelRatio); return qt_findAtNxFile(fileName, targetDevicePixelRatio, sourceDevicePixelRatio);
} }
@ -77,7 +79,8 @@ static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format, con
if (name.startsWith(QLatin1String(":/"))) // auto-detect resources and convert them to url if (name.startsWith(QLatin1String(":/"))) // auto-detect resources and convert them to url
name.prepend(QLatin1String("qrc")); name.prepend(QLatin1String("qrc"));
QUrl url = QUrl(name); QUrl url = QUrl(name);
name = resolveFileName(name, &url, devicePixelRatio); qreal sourcePixelRatio = 1.0;
name = resolveFileName(name, &url, devicePixelRatio, &sourcePixelRatio);
const QVariant data = doc->resource(QTextDocument::ImageResource, url); const QVariant data = doc->resource(QTextDocument::ImageResource, url);
if (data.type() == QVariant::Pixmap || data.type() == QVariant::Image) { if (data.type() == QVariant::Pixmap || data.type() == QVariant::Image) {
pm = qvariant_cast<QPixmap>(data); pm = qvariant_cast<QPixmap>(data);
@ -103,7 +106,7 @@ static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format, con
} }
if (name.contains(QStringLiteral("@2x"))) if (name.contains(QStringLiteral("@2x")))
pm.setDevicePixelRatio(2.0); pm.setDevicePixelRatio(sourcePixelRatio);
return pm; return pm;
} }
@ -158,7 +161,8 @@ static QImage getImage(QTextDocument *doc, const QTextImageFormat &format, const
if (name.startsWith(QLatin1String(":/"))) // auto-detect resources if (name.startsWith(QLatin1String(":/"))) // auto-detect resources
name.prepend(QLatin1String("qrc")); name.prepend(QLatin1String("qrc"));
QUrl url = QUrl(name); QUrl url = QUrl(name);
name = resolveFileName(name, &url, devicePixelRatio); qreal sourcePixelRatio = 1.0;
name = resolveFileName(name, &url, devicePixelRatio, &sourcePixelRatio);
const QVariant data = doc->resource(QTextDocument::ImageResource, url); const QVariant data = doc->resource(QTextDocument::ImageResource, url);
if (data.type() == QVariant::Image) { if (data.type() == QVariant::Image) {
image = qvariant_cast<QImage>(data); image = qvariant_cast<QImage>(data);
@ -182,8 +186,8 @@ static QImage getImage(QTextDocument *doc, const QTextImageFormat &format, const
doc->addResource(QTextDocument::ImageResource, url, image); doc->addResource(QTextDocument::ImageResource, url, image);
} }
if (name.contains(QStringLiteral("@2x"))) if (sourcePixelRatio != 1.0)
image.setDevicePixelRatio(2.0); image.setDevicePixelRatio(sourcePixelRatio);
return image; return image;
} }

View File

@ -976,7 +976,6 @@ QNetworkAccessManager::NetworkAccessibility QNetworkAccessManager::networkAccess
else else
return NotAccessible; return NotAccessible;
} else { } else {
// Network accessibility is either disabled or unknown.
if (d->defaultAccessControl) { if (d->defaultAccessControl) {
if (d->online) if (d->online)
return d->networkAccessible; return d->networkAccessible;
@ -1161,7 +1160,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT
// Return a disabled network reply if network access is disabled. // Return a disabled network reply if network access is disabled.
// Except if the scheme is empty or file://. // Except if the scheme is empty or file://.
if (!d->networkAccessible && !isLocalFile) { if (d->networkAccessible == NotAccessible && !isLocalFile) {
return new QDisabledNetworkReply(this, req, op); return new QDisabledNetworkReply(this, req, op);
} }

View File

@ -93,6 +93,8 @@ public:
online = (networkConfiguration.state().testFlag(QNetworkConfiguration::Active)); online = (networkConfiguration.state().testFlag(QNetworkConfiguration::Active));
if (online) if (online)
networkAccessible = QNetworkAccessManager::Accessible; networkAccessible = QNetworkAccessManager::Accessible;
else if (networkConfiguration.state().testFlag(QNetworkConfiguration::Undefined))
networkAccessible = QNetworkAccessManager::UnknownAccessibility;
else else
networkAccessible = QNetworkAccessManager::NotAccessible; networkAccessible = QNetworkAccessManager::NotAccessible;
#endif #endif

View File

@ -36,6 +36,8 @@
#ifndef QT_NO_NETWORKINTERFACE #ifndef QT_NO_NETWORKINTERFACE
#include <qfunctions_winrt.h>
#include <wrl.h> #include <wrl.h>
#include <windows.foundation.h> #include <windows.foundation.h>
#include <windows.foundation.collections.h> #include <windows.foundation.collections.h>
@ -72,6 +74,53 @@ QString QNetworkInterfaceManager::interfaceNameFromIndex(uint index)
return QString::number(index); return QString::number(index);
} }
static QNetworkInterfacePrivate *interfaceFromProfile(IConnectionProfile *profile, QList<HostNameInfo> *hostList)
{
if (!profile)
return 0;
QNetworkInterfacePrivate *iface = new QNetworkInterfacePrivate;
NetworkConnectivityLevel connectivityLevel;
HRESULT hr = profile->GetNetworkConnectivityLevel(&connectivityLevel);
Q_ASSERT_SUCCEEDED(hr);
if (connectivityLevel != NetworkConnectivityLevel_None)
iface->flags = QNetworkInterface::IsUp | QNetworkInterface::IsRunning;
ComPtr<INetworkAdapter> adapter;
hr = profile->get_NetworkAdapter(&adapter);
Q_ASSERT_SUCCEEDED(hr);
UINT32 type;
hr = adapter->get_IanaInterfaceType(&type);
Q_ASSERT_SUCCEEDED(hr);
if (type == 23)
iface->flags |= QNetworkInterface::IsPointToPoint;
GUID id;
hr = adapter->get_NetworkAdapterId(&id);
Q_ASSERT_SUCCEEDED(hr);
OLECHAR adapterName[39]={0};
StringFromGUID2(id, adapterName, 39);
iface->name = QString::fromWCharArray(adapterName);
// According to http://stackoverflow.com/questions/12936193/how-unique-is-the-ethernet-network-adapter-id-in-winrt-it-is-derived-from-the-m
// obtaining the MAC address using WinRT API is impossible
// iface->hardwareAddress = ?
for (int i = 0; i < hostList->length(); ++i) {
const HostNameInfo hostInfo = hostList->at(i);
if (id != hostInfo.adapterId)
continue;
QNetworkAddressEntry entry;
entry.setIp(QHostAddress(hostInfo.address));
entry.setPrefixLength(hostInfo.prefixLength);
iface->addressEntries << entry;
hostList->takeAt(i);
--i;
}
return iface;
}
static QList<QNetworkInterfacePrivate *> interfaceListing() static QList<QNetworkInterfacePrivate *> interfaceListing()
{ {
@ -80,36 +129,46 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
QList<HostNameInfo> hostList; QList<HostNameInfo> hostList;
ComPtr<INetworkInformationStatics> hostNameStatics; ComPtr<INetworkInformationStatics> hostNameStatics;
GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Connectivity_NetworkInformation).Get(), &hostNameStatics); HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Connectivity_NetworkInformation).Get(), &hostNameStatics);
Q_ASSERT_SUCCEEDED(hr);
ComPtr<IVectorView<HostName *>> hostNames; ComPtr<IVectorView<HostName *>> hostNames;
hostNameStatics->GetHostNames(&hostNames); hr = hostNameStatics->GetHostNames(&hostNames);
Q_ASSERT_SUCCEEDED(hr);
if (!hostNames) if (!hostNames)
return interfaces; return interfaces;
unsigned int hostNameCount; unsigned int hostNameCount;
hostNames->get_Size(&hostNameCount); hr = hostNames->get_Size(&hostNameCount);
Q_ASSERT_SUCCEEDED(hr);
for (unsigned i = 0; i < hostNameCount; ++i) { for (unsigned i = 0; i < hostNameCount; ++i) {
HostNameInfo hostInfo; HostNameInfo hostInfo;
ComPtr<IHostName> hostName; ComPtr<IHostName> hostName;
hostNames->GetAt(i, &hostName); hr = hostNames->GetAt(i, &hostName);
Q_ASSERT_SUCCEEDED(hr);
HostNameType type; HostNameType type;
hostName->get_Type(&type); hr = hostName->get_Type(&type);
Q_ASSERT_SUCCEEDED(hr);
if (type == HostNameType_DomainName) if (type == HostNameType_DomainName)
continue; continue;
ComPtr<IIPInformation> ipInformation; ComPtr<IIPInformation> ipInformation;
hostName->get_IPInformation(&ipInformation); hr = hostName->get_IPInformation(&ipInformation);
Q_ASSERT_SUCCEEDED(hr);
ComPtr<INetworkAdapter> currentAdapter; ComPtr<INetworkAdapter> currentAdapter;
ipInformation->get_NetworkAdapter(&currentAdapter); hr = ipInformation->get_NetworkAdapter(&currentAdapter);
Q_ASSERT_SUCCEEDED(hr);
currentAdapter->get_NetworkAdapterId(&hostInfo.adapterId); hr = currentAdapter->get_NetworkAdapterId(&hostInfo.adapterId);
Q_ASSERT_SUCCEEDED(hr);
ComPtr<IReference<unsigned char>> prefixLengthReference; ComPtr<IReference<unsigned char>> prefixLengthReference;
ipInformation->get_PrefixLength(&prefixLengthReference); hr = ipInformation->get_PrefixLength(&prefixLengthReference);
Q_ASSERT_SUCCEEDED(hr);
prefixLengthReference->get_Value(&hostInfo.prefixLength); hr = prefixLengthReference->get_Value(&hostInfo.prefixLength);
Q_ASSERT_SUCCEEDED(hr);
// invalid prefixes // invalid prefixes
if ((type == HostNameType_Ipv4 && hostInfo.prefixLength > 32) if ((type == HostNameType_Ipv4 && hostInfo.prefixLength > 32)
@ -117,7 +176,8 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
continue; continue;
HString name; HString name;
hostName->get_CanonicalName(name.GetAddressOf()); hr = hostName->get_CanonicalName(name.GetAddressOf());
Q_ASSERT_SUCCEEDED(hr);
UINT32 length; UINT32 length;
PCWSTR rawString = name.GetRawBuffer(&length); PCWSTR rawString = name.GetRawBuffer(&length);
hostInfo.address = QString::fromWCharArray(rawString, length); hostInfo.address = QString::fromWCharArray(rawString, length);
@ -126,54 +186,35 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
} }
INetworkInformationStatics *networkInfoStatics; INetworkInformationStatics *networkInfoStatics;
GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Connectivity_NetworkInformation).Get(), &networkInfoStatics); hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Connectivity_NetworkInformation).Get(), &networkInfoStatics);
Q_ASSERT_SUCCEEDED(hr);
ComPtr<IConnectionProfile> connectionProfile;
hr = networkInfoStatics->GetInternetConnectionProfile(&connectionProfile);
Q_ASSERT_SUCCEEDED(hr);
QNetworkInterfacePrivate *iface = interfaceFromProfile(connectionProfile.Get(), &hostList);
if (iface) {
iface->index = 0;
interfaces << iface;
}
ComPtr<IVectorView<ConnectionProfile *>> connectionProfiles; ComPtr<IVectorView<ConnectionProfile *>> connectionProfiles;
networkInfoStatics->GetConnectionProfiles(&connectionProfiles); hr = networkInfoStatics->GetConnectionProfiles(&connectionProfiles);
Q_ASSERT_SUCCEEDED(hr);
if (!connectionProfiles) if (!connectionProfiles)
return interfaces; return interfaces;
unsigned int size; unsigned int size;
connectionProfiles->get_Size(&size); hr = connectionProfiles->get_Size(&size);
Q_ASSERT_SUCCEEDED(hr);
for (unsigned int i = 0; i < size; ++i) { for (unsigned int i = 0; i < size; ++i) {
QNetworkInterfacePrivate *iface = new QNetworkInterfacePrivate;
interfaces << iface;
ComPtr<IConnectionProfile> profile; ComPtr<IConnectionProfile> profile;
connectionProfiles->GetAt(i, &profile); hr = connectionProfiles->GetAt(i, &profile);
Q_ASSERT_SUCCEEDED(hr);
NetworkConnectivityLevel connectivityLevel; iface = interfaceFromProfile(profile.Get(), &hostList);
profile->GetNetworkConnectivityLevel(&connectivityLevel); if (iface) {
if (connectivityLevel != NetworkConnectivityLevel_None) iface->index = i + 1;
iface->flags = QNetworkInterface::IsUp | QNetworkInterface::IsRunning; interfaces << iface;
ComPtr<INetworkAdapter> adapter;
profile->get_NetworkAdapter(&adapter);
UINT32 type;
adapter->get_IanaInterfaceType(&type);
if (type == 23)
iface->flags |= QNetworkInterface::IsPointToPoint;
GUID id;
adapter->get_NetworkAdapterId(&id);
OLECHAR adapterName[39]={0};
StringFromGUID2(id, adapterName, 39);
iface->name = QString::fromWCharArray(adapterName);
// According to http://stackoverflow.com/questions/12936193/how-unique-is-the-ethernet-network-adapter-id-in-winrt-it-is-derived-from-the-m
// obtaining the MAC address using WinRT API is impossible
// iface->hardwareAddress = ?
for (int i = 0; i < hostList.length(); ++i) {
const HostNameInfo hostInfo = hostList.at(i);
if (id != hostInfo.adapterId)
continue;
QNetworkAddressEntry entry;
entry.setIp(QHostAddress(hostInfo.address));
entry.setPrefixLength(hostInfo.prefixLength);
iface->addressEntries << entry;
hostList.takeAt(i);
--i;
} }
} }
return interfaces; return interfaces;

View File

@ -899,8 +899,10 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
#if defined (QNATIVESOCKETENGINE_DEBUG) #if defined (QNATIVESOCKETENGINE_DEBUG)
qDebug("QNativeSocketEnginePrivate::nativeReceiveDatagram(%p \"%s\", %lli, %s, %i) == %lli", qDebug("QNativeSocketEnginePrivate::nativeReceiveDatagram(%p \"%s\", %lli, %s, %i) == %lli",
data, qt_prettyDebug(data, qMin(recvResult, ssize_t(16)), recvResult).data(), maxSize, data, qt_prettyDebug(data, qMin(recvResult, ssize_t(16)), recvResult).data(), maxSize,
address ? address->toString().toLatin1().constData() : "(nil)", (recvResult != -1 && options != QAbstractSocketEngine::WantNone)
port ? *port : 0, (qint64) recvResult); ? header->senderAddress.toString().toLatin1().constData() : "(unknown)",
(recvResult != -1 && options != QAbstractSocketEngine::WantNone)
? header->senderPort : 0, (qint64) recvResult);
#endif #endif
return qint64(maxSize ? recvResult : recvResult == -1 ? -1 : 0); return qint64(maxSize ? recvResult : recvResult == -1 ? -1 : 0);
@ -996,8 +998,9 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
#if defined (QNATIVESOCKETENGINE_DEBUG) #if defined (QNATIVESOCKETENGINE_DEBUG)
qDebug("QNativeSocketEngine::sendDatagram(%p \"%s\", %lli, \"%s\", %i) == %lli", data, qDebug("QNativeSocketEngine::sendDatagram(%p \"%s\", %lli, \"%s\", %i) == %lli", data,
qt_prettyDebug(data, qMin<int>(len, 16), len).data(), len, host.toString().toLatin1().constData(), qt_prettyDebug(data, qMin<int>(len, 16), len).data(), len,
port, (qint64) sentBytes); header.destinationAddress.toString().toLatin1().constData(),
header.destinationPort, (qint64) sentBytes);
#endif #endif
return qint64(sentBytes); return qint64(sentBytes);

View File

@ -47,11 +47,13 @@
#include <private/qthread_p.h> #include <private/qthread_p.h>
#include <private/qabstractsocket_p.h> #include <private/qabstractsocket_p.h>
#include <private/qeventdispatcher_winrt_p.h>
#ifndef QT_NO_SSL #ifndef QT_NO_SSL
#include <QSslSocket> #include <QSslSocket>
#endif #endif
#include <functional>
#include <wrl.h> #include <wrl.h>
#include <windows.foundation.collections.h> #include <windows.foundation.collections.h>
#include <windows.storage.streams.h> #include <windows.storage.streams.h>
@ -150,16 +152,10 @@ static AsyncStatus opStatus(const ComPtr<T> &op)
{ {
ComPtr<IAsyncInfo> info; ComPtr<IAsyncInfo> info;
HRESULT hr = op.As(&info); HRESULT hr = op.As(&info);
if (FAILED(hr)) { Q_ASSERT_SUCCEEDED(hr);
qErrnoWarning(hr, "Failed to cast op to IAsyncInfo.");
return Error;
}
AsyncStatus status; AsyncStatus status;
hr = info->get_Status(&status); hr = info->get_Status(&status);
if (FAILED(hr)) { Q_ASSERT_SUCCEEDED(hr);
qErrnoWarning(hr, "Failed to get AsyncStatus.");
return Error;
}
return status; return status;
} }
@ -265,25 +261,26 @@ bool QNativeSocketEngine::connectToHostByName(const QString &name, quint16 port)
Q_D(QNativeSocketEngine); Q_D(QNativeSocketEngine);
HStringReference hostNameRef(reinterpret_cast<LPCWSTR>(name.utf16())); HStringReference hostNameRef(reinterpret_cast<LPCWSTR>(name.utf16()));
ComPtr<IHostNameFactory> hostNameFactory; ComPtr<IHostNameFactory> hostNameFactory;
GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(), HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(),
&hostNameFactory); &hostNameFactory);
Q_ASSERT_SUCCEEDED(hr);
ComPtr<IHostName> remoteHost; ComPtr<IHostName> remoteHost;
if (FAILED(hostNameFactory->CreateHostName(hostNameRef.Get(), &remoteHost))) { hr = hostNameFactory->CreateHostName(hostNameRef.Get(), &remoteHost);
qWarning("QNativeSocketEnginePrivate::nativeConnect:: Could not create hostname"); RETURN_FALSE_IF_FAILED("QNativeSocketEngine::connectToHostByName: Could not create hostname.");
return false;
}
const QString portString = QString::number(port); const QString portString = QString::number(port);
HStringReference portReference(reinterpret_cast<LPCWSTR>(portString.utf16())); HStringReference portReference(reinterpret_cast<LPCWSTR>(portString.utf16()));
HRESULT hr = E_FAIL;
if (d->socketType == QAbstractSocket::TcpSocket) if (d->socketType == QAbstractSocket::TcpSocket)
hr = d->tcpSocket()->ConnectAsync(remoteHost.Get(), portReference.Get(), &d->connectOp); hr = d->tcpSocket()->ConnectAsync(remoteHost.Get(), portReference.Get(), &d->connectOp);
else if (d->socketType == QAbstractSocket::UdpSocket) else if (d->socketType == QAbstractSocket::UdpSocket)
hr = d->udpSocket()->ConnectAsync(remoteHost.Get(), portReference.Get(), &d->connectOp); hr = d->udpSocket()->ConnectAsync(remoteHost.Get(), portReference.Get(), &d->connectOp);
if (FAILED(hr)) { if (hr == E_ACCESSDENIED) {
qWarning("QNativeSocketEnginePrivate::nativeConnect:: Could not obtain connect action"); qErrnoWarning(hr, "QNativeSocketEngine::connectToHostByName: Unable to connect to host. \
Please check your manifest capabilities.");
return false; return false;
} }
Q_ASSERT_SUCCEEDED(hr);
d->socketState = QAbstractSocket::ConnectingState; d->socketState = QAbstractSocket::ConnectingState;
hr = d->connectOp->put_Completed(Callback<IAsyncActionCompletedHandler>( hr = d->connectOp->put_Completed(Callback<IAsyncActionCompletedHandler>(
d, &QNativeSocketEnginePrivate::handleConnectToHost).Get()); d, &QNativeSocketEnginePrivate::handleConnectToHost).Get());
@ -295,68 +292,54 @@ bool QNativeSocketEngine::connectToHostByName(const QString &name, quint16 port)
bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port) bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port)
{ {
Q_D(QNativeSocketEngine); Q_D(QNativeSocketEngine);
HRESULT hr;
ComPtr<IHostName> hostAddress; ComPtr<IHostName> hostAddress;
if (address != QHostAddress::Any && address != QHostAddress::AnyIPv4 && address != QHostAddress::AnyIPv6) { if (address != QHostAddress::Any && address != QHostAddress::AnyIPv4 && address != QHostAddress::AnyIPv6) {
ComPtr<IHostNameFactory> hostNameFactory; ComPtr<IHostNameFactory> hostNameFactory;
GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(), hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(),
&hostNameFactory); &hostNameFactory);
Q_ASSERT_SUCCEEDED(hr);
const QString addressString = address.toString(); const QString addressString = address.toString();
HStringReference addressRef(reinterpret_cast<LPCWSTR>(addressString.utf16())); HStringReference addressRef(reinterpret_cast<LPCWSTR>(addressString.utf16()));
hostNameFactory->CreateHostName(addressRef.Get(), &hostAddress); hr = hostNameFactory->CreateHostName(addressRef.Get(), &hostAddress);
RETURN_FALSE_IF_FAILED("QNativeSocketEngine::bind: Could not create hostname.");
} }
HRESULT hr;
QString portQString = port ? QString::number(port) : QString(); QString portQString = port ? QString::number(port) : QString();
HStringReference portString(reinterpret_cast<LPCWSTR>(portQString.utf16())); HStringReference portString(reinterpret_cast<LPCWSTR>(portQString.utf16()));
ComPtr<IAsyncAction> op; ComPtr<IAsyncAction> op;
if (d->socketType == QAbstractSocket::TcpSocket) { if (d->socketType == QAbstractSocket::TcpSocket) {
if (!d->tcpListener if (!d->tcpListener) {
&& FAILED(RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_StreamSocketListener).Get(), hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_StreamSocketListener).Get(),
&d->tcpListener))) { &d->tcpListener);
qWarning("Failed to create listener"); Q_ASSERT_SUCCEEDED(hr);
return false;
} }
d->tcpListener->add_ConnectionReceived(Callback<ClientConnectedHandler>(d, &QNativeSocketEnginePrivate::handleClientConnection).Get(), &d->connectionToken); hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
return d->tcpListener->add_ConnectionReceived(
Callback<ClientConnectedHandler>(d, &QNativeSocketEnginePrivate::handleClientConnection).Get(),
&d->connectionToken);
});
Q_ASSERT_SUCCEEDED(hr);
hr = d->tcpListener->BindEndpointAsync(hostAddress.Get(), portString.Get(), &op); hr = d->tcpListener->BindEndpointAsync(hostAddress.Get(), portString.Get(), &op);
if (FAILED(hr)) {
qErrnoWarning(hr, "Unable to bind socket."); // ### Set error message
return false;
}
} else if (d->socketType == QAbstractSocket::UdpSocket) { } else if (d->socketType == QAbstractSocket::UdpSocket) {
hr = d->udpSocket()->BindEndpointAsync(hostAddress.Get(), portString.Get(), &op); hr = d->udpSocket()->BindEndpointAsync(hostAddress.Get(), portString.Get(), &op);
if (FAILED(hr)) {
qErrnoWarning(hr, "Unable to bind socket."); // ### Set error message
return false;
}
hr = op->put_Completed(Callback<IAsyncActionCompletedHandler>(d, &QNativeSocketEnginePrivate::handleBindCompleted).Get());
if (FAILED(hr)) {
qErrnoWarning(hr, "Unable to set bind callback.");
return false;
}
} }
if (hr == E_ACCESSDENIED) {
if (op) { qErrnoWarning(hr, "Unable to bind socket. Please check your manifest capabilities.");
while (opStatus(op) == Started) return false;
d->eventLoop.processEvents();
AsyncStatus status = opStatus(op);
if (status == Error || status == Canceled)
return false;
hr = op->GetResults();
if (FAILED(hr)) {
qErrnoWarning(hr, "Failed to bind socket");
return false;
}
d->socketState = QAbstractSocket::BoundState;
d->fetchConnectionParameters();
return true;
} }
Q_ASSERT_SUCCEEDED(hr);
return false; hr = op->put_Completed(Callback<IAsyncActionCompletedHandler>(d, &QNativeSocketEnginePrivate::handleBindCompleted).Get());
Q_ASSERT_SUCCEEDED(hr);
hr = QWinRTFunctions::await(op);
Q_ASSERT_SUCCEEDED(hr);
d->socketState = QAbstractSocket::BoundState;
return d->fetchConnectionParameters();
} }
bool QNativeSocketEngine::listen() bool QNativeSocketEngine::listen()
@ -430,27 +413,36 @@ void QNativeSocketEngine::close()
d->notifyOnWrite = false; d->notifyOnWrite = false;
d->notifyOnException = false; d->notifyOnException = false;
HRESULT hr;
if (d->connectOp) { if (d->connectOp) {
ComPtr<IAsyncInfo> info; ComPtr<IAsyncInfo> info;
d->connectOp.As(&info); hr = d->connectOp.As(&info);
Q_ASSERT_SUCCEEDED(hr);
if (info) { if (info) {
info->Cancel(); hr = info->Cancel();
info->Close(); Q_ASSERT_SUCCEEDED(hr);
hr = info->Close();
Q_ASSERT_SUCCEEDED(hr);
} }
} }
if (d->socketDescriptor != -1) { if (d->socketDescriptor != -1) {
ComPtr<IClosable> socket; ComPtr<IClosable> socket;
if (d->socketType == QAbstractSocket::TcpSocket) { if (d->socketType == QAbstractSocket::TcpSocket) {
d->tcpSocket()->QueryInterface(IID_PPV_ARGS(&socket)); hr = d->tcpSocket()->QueryInterface(IID_PPV_ARGS(&socket));
d->tcpSocket()->Release(); Q_ASSERT_SUCCEEDED(hr);
hr = d->tcpSocket()->Release();
Q_ASSERT_SUCCEEDED(hr);
} else if (d->socketType == QAbstractSocket::UdpSocket) { } else if (d->socketType == QAbstractSocket::UdpSocket) {
d->udpSocket()->QueryInterface(IID_PPV_ARGS(&socket)); hr = d->udpSocket()->QueryInterface(IID_PPV_ARGS(&socket));
d->udpSocket()->Release(); Q_ASSERT_SUCCEEDED(hr);
hr = d->udpSocket()->Release();
Q_ASSERT_SUCCEEDED(hr);
} }
if (socket) { if (socket) {
socket->Close(); hr = socket->Close();
Q_ASSERT_SUCCEEDED(hr);
d->socketDescriptor = -1; d->socketDescriptor = -1;
} }
d->socketDescriptor = -1; d->socketDescriptor = -1;
@ -531,7 +523,7 @@ qint64 QNativeSocketEngine::write(const char *data, qint64 len)
hr = d->tcpSocket()->get_OutputStream(&stream); hr = d->tcpSocket()->get_OutputStream(&stream);
else if (d->socketType == QAbstractSocket::UdpSocket) else if (d->socketType == QAbstractSocket::UdpSocket)
hr = d->udpSocket()->get_OutputStream(&stream); hr = d->udpSocket()->get_OutputStream(&stream);
RETURN_IF_FAILED("Failed to get output stream to socket", return -1); Q_ASSERT_SUCCEEDED(hr);
qint64 bytesWritten = writeIOStream(stream, data, len); qint64 bytesWritten = writeIOStream(stream, data, len);
if (bytesWritten < 0) if (bytesWritten < 0)
@ -580,20 +572,21 @@ qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 len, const QI
HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(), HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(),
&hostNameFactory); &hostNameFactory);
RETURN_IF_FAILED("Could not obtain hostname factory", return -1); Q_ASSERT_SUCCEEDED(hr);
const QString addressString = header.destinationAddress.toString(); const QString addressString = header.destinationAddress.toString();
HStringReference hostNameRef(reinterpret_cast<LPCWSTR>(addressString.utf16())); HStringReference hostNameRef(reinterpret_cast<LPCWSTR>(addressString.utf16()));
hostNameFactory->CreateHostName(hostNameRef.Get(), &remoteHost); hr = hostNameFactory->CreateHostName(hostNameRef.Get(), &remoteHost);
RETURN_IF_FAILED("QNativeSocketEngine::writeDatagram: Could not create hostname.", return -1);
ComPtr<IAsyncOperation<IOutputStream *>> streamOperation; ComPtr<IAsyncOperation<IOutputStream *>> streamOperation;
ComPtr<IOutputStream> stream; ComPtr<IOutputStream> stream;
const QString portString = QString::number(header.destinationPort); const QString portString = QString::number(header.destinationPort);
HStringReference portRef(reinterpret_cast<LPCWSTR>(portString.utf16())); HStringReference portRef(reinterpret_cast<LPCWSTR>(portString.utf16()));
hr = d->udpSocket()->GetOutputStreamAsync(remoteHost.Get(), portRef.Get(), &streamOperation); hr = d->udpSocket()->GetOutputStreamAsync(remoteHost.Get(), portRef.Get(), &streamOperation);
RETURN_IF_FAILED("Failed to get output stream to socket", return -1); Q_ASSERT_SUCCEEDED(hr);
hr = QWinRTFunctions::await(streamOperation, stream.GetAddressOf()); hr = QWinRTFunctions::await(streamOperation, stream.GetAddressOf());
RETURN_IF_FAILED("Failed to get output stream to socket", return -1); Q_ASSERT_SUCCEEDED(hr);
return writeIOStream(stream, data, len); return writeIOStream(stream, data, len);
} }
@ -778,26 +771,23 @@ void QNativeSocketEngine::establishRead()
bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType socketType, QAbstractSocket::NetworkLayerProtocol &socketProtocol) bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType socketType, QAbstractSocket::NetworkLayerProtocol &socketProtocol)
{ {
Q_UNUSED(socketProtocol); Q_UNUSED(socketProtocol);
HRESULT hr;
switch (socketType) { switch (socketType) {
case QAbstractSocket::TcpSocket: { case QAbstractSocket::TcpSocket: {
ComPtr<IStreamSocket> socket; ComPtr<IStreamSocket> socket;
HRESULT hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_StreamSocket).Get(), &socket); hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_StreamSocket).Get(), &socket);
if (FAILED(hr)) { Q_ASSERT_SUCCEEDED(hr);
qWarning("Failed to create StreamSocket instance");
return false;
}
socketDescriptor = qintptr(socket.Detach()); socketDescriptor = qintptr(socket.Detach());
break; break;
} }
case QAbstractSocket::UdpSocket: { case QAbstractSocket::UdpSocket: {
ComPtr<IDatagramSocket> socket; ComPtr<IDatagramSocket> socket;
HRESULT hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_DatagramSocket).Get(), &socket); hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_DatagramSocket).Get(), &socket);
if (FAILED(hr)) { Q_ASSERT_SUCCEEDED(hr);
qWarning("Failed to create stream socket");
return false;
}
socketDescriptor = qintptr(socket.Detach()); socketDescriptor = qintptr(socket.Detach());
udpSocket()->add_MessageReceived(Callback<DatagramReceivedHandler>(this, &QNativeSocketEnginePrivate::handleNewDatagram).Get(), &connectionToken); hr = udpSocket()->add_MessageReceived(Callback<DatagramReceivedHandler>(this, &QNativeSocketEnginePrivate::handleNewDatagram).Get(), &connectionToken);
Q_ASSERT_SUCCEEDED(hr);
break; break;
} }
default: default:
@ -834,10 +824,12 @@ QNativeSocketEnginePrivate::~QNativeSocketEnginePrivate()
if (socketDescriptor == -1 || connectionToken.value == -1) if (socketDescriptor == -1 || connectionToken.value == -1)
return; return;
HRESULT hr;
if (socketType == QAbstractSocket::UdpSocket) if (socketType == QAbstractSocket::UdpSocket)
udpSocket()->remove_MessageReceived(connectionToken); hr = udpSocket()->remove_MessageReceived(connectionToken);
else if (socketType == QAbstractSocket::TcpSocket) else if (socketType == QAbstractSocket::TcpSocket)
tcpListener->remove_ConnectionReceived(connectionToken); hr = tcpListener->remove_ConnectionReceived(connectionToken);
Q_ASSERT_SUCCEEDED(hr);
} }
void QNativeSocketEnginePrivate::setError(QAbstractSocket::SocketError error, ErrorString errorString) const void QNativeSocketEnginePrivate::setError(QAbstractSocket::SocketError error, ErrorString errorString) const
@ -1064,56 +1056,66 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
peerPort = 0; peerPort = 0;
peerAddress.clear(); peerAddress.clear();
HRESULT hr;
if (socketType == QAbstractSocket::TcpSocket) { if (socketType == QAbstractSocket::TcpSocket) {
ComPtr<IHostName> hostName; ComPtr<IHostName> hostName;
HString tmpHString; HString tmpHString;
ComPtr<IStreamSocketInformation> info; ComPtr<IStreamSocketInformation> info;
if (FAILED(tcpSocket()->get_Information(&info))) { hr = tcpSocket()->get_Information(&info);
qWarning("QNativeSocketEnginePrivate::fetchConnectionParameters: Could not obtain socket info"); Q_ASSERT_SUCCEEDED(hr);
return false; hr = info->get_LocalAddress(&hostName);
} Q_ASSERT_SUCCEEDED(hr);
info->get_LocalAddress(&hostName);
if (hostName) { if (hostName) {
hostName->get_CanonicalName(tmpHString.GetAddressOf()); hr = hostName->get_CanonicalName(tmpHString.GetAddressOf());
Q_ASSERT_SUCCEEDED(hr);
localAddress.setAddress(qt_QStringFromHString(tmpHString)); localAddress.setAddress(qt_QStringFromHString(tmpHString));
info->get_LocalPort(tmpHString.GetAddressOf()); hr = info->get_LocalPort(tmpHString.GetAddressOf());
Q_ASSERT_SUCCEEDED(hr);
localPort = qt_QStringFromHString(tmpHString).toInt(); localPort = qt_QStringFromHString(tmpHString).toInt();
} }
if (!localPort && tcpListener) { if (!localPort && tcpListener) {
ComPtr<IStreamSocketListenerInformation> listenerInfo = 0; ComPtr<IStreamSocketListenerInformation> listenerInfo = 0;
tcpListener->get_Information(&listenerInfo); hr = tcpListener->get_Information(&listenerInfo);
listenerInfo->get_LocalPort(tmpHString.GetAddressOf()); Q_ASSERT_SUCCEEDED(hr);
hr = listenerInfo->get_LocalPort(tmpHString.GetAddressOf());
Q_ASSERT_SUCCEEDED(hr);
localPort = qt_QStringFromHString(tmpHString).toInt(); localPort = qt_QStringFromHString(tmpHString).toInt();
localAddress == QHostAddress::Any; localAddress = QHostAddress::Any;
} }
info->get_RemoteAddress(&hostName); info->get_RemoteAddress(&hostName);
if (hostName) { if (hostName) {
hostName->get_CanonicalName(tmpHString.GetAddressOf()); hr = hostName->get_CanonicalName(tmpHString.GetAddressOf());
Q_ASSERT_SUCCEEDED(hr);
peerAddress.setAddress(qt_QStringFromHString(tmpHString)); peerAddress.setAddress(qt_QStringFromHString(tmpHString));
info->get_RemotePort(tmpHString.GetAddressOf()); hr = info->get_RemotePort(tmpHString.GetAddressOf());
Q_ASSERT_SUCCEEDED(hr);
peerPort = qt_QStringFromHString(tmpHString).toInt(); peerPort = qt_QStringFromHString(tmpHString).toInt();
} }
} else if (socketType == QAbstractSocket::UdpSocket) { } else if (socketType == QAbstractSocket::UdpSocket) {
ComPtr<IHostName> hostName; ComPtr<IHostName> hostName;
HString tmpHString; HString tmpHString;
ComPtr<IDatagramSocketInformation> info; ComPtr<IDatagramSocketInformation> info;
if (FAILED(udpSocket()->get_Information(&info))) { hr = udpSocket()->get_Information(&info);
qWarning("QNativeSocketEnginePrivate::fetchConnectionParameters: Could not obtain socket information"); Q_ASSERT_SUCCEEDED(hr);
return false; hr = info->get_LocalAddress(&hostName);
} Q_ASSERT_SUCCEEDED(hr);
info->get_LocalAddress(&hostName);
if (hostName) { if (hostName) {
hostName->get_CanonicalName(tmpHString.GetAddressOf()); hr = hostName->get_CanonicalName(tmpHString.GetAddressOf());
Q_ASSERT_SUCCEEDED(hr);
localAddress.setAddress(qt_QStringFromHString(tmpHString)); localAddress.setAddress(qt_QStringFromHString(tmpHString));
info->get_LocalPort(tmpHString.GetAddressOf()); hr = info->get_LocalPort(tmpHString.GetAddressOf());
Q_ASSERT_SUCCEEDED(hr);
localPort = qt_QStringFromHString(tmpHString).toInt(); localPort = qt_QStringFromHString(tmpHString).toInt();
} }
info->get_RemoteAddress(&hostName); hr = info->get_RemoteAddress(&hostName);
Q_ASSERT_SUCCEEDED(hr);
if (hostName) { if (hostName) {
hostName->get_CanonicalName(tmpHString.GetAddressOf()); hr = hostName->get_CanonicalName(tmpHString.GetAddressOf());
Q_ASSERT_SUCCEEDED(hr);
peerAddress.setAddress(qt_QStringFromHString(tmpHString)); peerAddress.setAddress(qt_QStringFromHString(tmpHString));
info->get_RemotePort(tmpHString.GetAddressOf()); hr = info->get_RemotePort(tmpHString.GetAddressOf());
Q_ASSERT_SUCCEEDED(hr);
peerPort = qt_QStringFromHString(tmpHString).toInt(); peerPort = qt_QStringFromHString(tmpHString).toInt();
} }
} }
@ -1174,12 +1176,16 @@ void QNativeSocketEnginePrivate::handleConnectionEstablished(IAsyncAction *actio
// The callback might be triggered several times if we do not cancel/reset it here // The callback might be triggered several times if we do not cancel/reset it here
if (connectOp) { if (connectOp) {
ComPtr<IAsyncInfo> info; ComPtr<IAsyncInfo> info;
connectOp.As(&info); hr = connectOp.As(&info);
Q_ASSERT_SUCCEEDED(hr);
if (info) { if (info) {
info->Cancel(); hr = info->Cancel();
info->Close(); Q_ASSERT_SUCCEEDED(hr);
hr = info->Close();
Q_ASSERT_SUCCEEDED(hr);
} }
connectOp.Reset(); hr = connectOp.Reset();
Q_ASSERT_SUCCEEDED(hr);
} }
socketState = QAbstractSocket::ConnectedState; socketState = QAbstractSocket::ConnectedState;

View File

@ -6,6 +6,12 @@ SOURCES +=\
HEADERS +=\ HEADERS +=\
$$PWD/qunixeventdispatcher_qpa_p.h\ $$PWD/qunixeventdispatcher_qpa_p.h\
$$PWD/qgenericunixeventdispatcher_p.h\ $$PWD/qgenericunixeventdispatcher_p.h\
} else: win32 {
SOURCES +=\
$$PWD/qwindowsguieventdispatcher.cpp
HEADERS +=\
$$PWD/qwindowsguieventdispatcher_p.h
} }
contains(QT_CONFIG, glib) { contains(QT_CONFIG, glib) {

View File

@ -32,17 +32,13 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qwindowsguieventdispatcher.h" #include "qwindowsguieventdispatcher_p.h"
#include "qwindowscontext.h"
#include <qpa/qwindowsysteminterface.h> #include <qpa/qwindowsysteminterface.h>
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
#include <QtCore/QStack>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <windowsx.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
/*! /*!
@ -69,11 +65,7 @@ bool QWindowsGuiEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags fl
{ {
const QEventLoop::ProcessEventsFlags oldFlags = m_flags; const QEventLoop::ProcessEventsFlags oldFlags = m_flags;
m_flags = flags; m_flags = flags;
if (QWindowsContext::verbose > 2 && lcQpaEvents().isDebugEnabled())
qCDebug(lcQpaEvents) << '>' << __FUNCTION__ << objectName() << flags;
const bool rc = QEventDispatcherWin32::processEvents(flags); const bool rc = QEventDispatcherWin32::processEvents(flags);
if (QWindowsContext::verbose > 2 && lcQpaEvents().isDebugEnabled())
qCDebug(lcQpaEvents) << '<' << __FUNCTION__ << "returns" << rc;
m_flags = oldFlags; m_flags = oldFlags;
return rc; return rc;
} }
@ -100,10 +92,6 @@ messageDebugEntries[] = {
{WM_DESTROY, "WM_DESTROY", true}, {WM_DESTROY, "WM_DESTROY", true},
{WM_MOVE, "WM_MOVE", true}, {WM_MOVE, "WM_MOVE", true},
{WM_SIZE, "WM_SIZE", true}, {WM_SIZE, "WM_SIZE", true},
{WM_MOUSEACTIVATE,"WM_MOUSEACTIVATE", true},
{WM_CHILDACTIVATE, "WM_CHILDACTIVATE", true},
{WM_PARENTNOTIFY, "WM_PARENTNOTIFY", true},
{WM_ENTERIDLE, "WM_ENTERIDLE", false},
{WM_GETICON, "WM_GETICON", false}, {WM_GETICON, "WM_GETICON", false},
{WM_KEYDOWN, "WM_KEYDOWN", true}, {WM_KEYDOWN, "WM_KEYDOWN", true},
{WM_SYSKEYDOWN, "WM_SYSKEYDOWN", true}, {WM_SYSKEYDOWN, "WM_SYSKEYDOWN", true},
@ -119,16 +107,13 @@ messageDebugEntries[] = {
{WM_CHAR, "WM_CHAR", true}, {WM_CHAR, "WM_CHAR", true},
{WM_DEADCHAR, "WM_DEADCHAR", true}, {WM_DEADCHAR, "WM_DEADCHAR", true},
{WM_ACTIVATE, "WM_ACTIVATE", true}, {WM_ACTIVATE, "WM_ACTIVATE", true},
{WM_GETMINMAXINFO, "WM_GETMINMAXINFO", true},
{WM_SETFOCUS, "WM_SETFOCUS", true}, {WM_SETFOCUS, "WM_SETFOCUS", true},
{WM_KILLFOCUS, "WM_KILLFOCUS", true}, {WM_KILLFOCUS, "WM_KILLFOCUS", true},
{WM_ENABLE, "WM_ENABLE", true}, {WM_ENABLE, "WM_ENABLE", true},
{WM_SHOWWINDOW, "WM_SHOWWINDOW", true}, {WM_SHOWWINDOW, "WM_SHOWWINDOW", true},
{WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING", true},
{WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED", true}, {WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED", true},
{WM_SETCURSOR, "WM_SETCURSOR", false}, {WM_SETCURSOR, "WM_SETCURSOR", false},
{WM_GETFONT, "WM_GETFONT", true}, {WM_GETFONT, "WM_GETFONT", true},
{WM_NCMOUSEMOVE, "WM_NCMOUSEMOVE", true},
{WM_LBUTTONDOWN, "WM_LBUTTONDOWN", true}, {WM_LBUTTONDOWN, "WM_LBUTTONDOWN", true},
{WM_LBUTTONUP, "WM_LBUTTONUP", true}, {WM_LBUTTONUP, "WM_LBUTTONUP", true},
{WM_LBUTTONDBLCLK, "WM_LBUTTONDBLCLK", true}, {WM_LBUTTONDBLCLK, "WM_LBUTTONDBLCLK", true},
@ -143,18 +128,6 @@ messageDebugEntries[] = {
{WM_XBUTTONUP, "WM_XBUTTONUP", true}, {WM_XBUTTONUP, "WM_XBUTTONUP", true},
{WM_XBUTTONDBLCLK, "WM_XBUTTONDBLCLK", true}, {WM_XBUTTONDBLCLK, "WM_XBUTTONDBLCLK", true},
{WM_MOUSEHWHEEL, "WM_MOUSEHWHEEL", true}, {WM_MOUSEHWHEEL, "WM_MOUSEHWHEEL", true},
{WM_NCCREATE, "WM_NCCREATE", true},
{WM_NCCALCSIZE, "WM_NCCALCSIZE", true},
{WM_NCACTIVATE, "WM_NCACTIVATE", true},
{WM_NCMOUSELEAVE, "WM_NCMOUSELEAVE", true},
{WM_NCLBUTTONDOWN, "WM_NCLBUTTONDOWN", true},
{WM_NCLBUTTONUP, "WM_NCLBUTTONUP", true},
{WM_ACTIVATEAPP, "WM_ACTIVATEAPP", true},
{WM_NCPAINT, "WM_NCPAINT", true},
{WM_ERASEBKGND, "WM_ERASEBKGND", true},
{WM_MOUSEMOVE, "WM_MOUSEMOVE", true},
{WM_MOUSELEAVE, "WM_MOUSELEAVE", true},
{WM_NCHITTEST, "WM_NCHITTEST", false},
{WM_IME_SETCONTEXT, "WM_IME_SETCONTEXT", true}, {WM_IME_SETCONTEXT, "WM_IME_SETCONTEXT", true},
{WM_INPUTLANGCHANGE, "WM_INPUTLANGCHANGE", true}, {WM_INPUTLANGCHANGE, "WM_INPUTLANGCHANGE", true},
{WM_IME_NOTIFY, "WM_IME_NOTIFY", true}, {WM_IME_NOTIFY, "WM_IME_NOTIFY", true},
@ -163,9 +136,6 @@ messageDebugEntries[] = {
#endif #endif
{WM_IME_SETCONTEXT, "WM_IME_SETCONTEXT", true}, {WM_IME_SETCONTEXT, "WM_IME_SETCONTEXT", true},
{WM_IME_NOTIFY, "WM_IME_NOTIFY", true}, {WM_IME_NOTIFY, "WM_IME_NOTIFY", true},
{WM_TOUCH, "WM_TOUCH", true},
{WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN", true},
{WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD", true},
{WM_RENDERFORMAT, "WM_RENDERFORMAT", true}, {WM_RENDERFORMAT, "WM_RENDERFORMAT", true},
{WM_RENDERALLFORMATS, "WM_RENDERALLFORMATS", true}, {WM_RENDERALLFORMATS, "WM_RENDERALLFORMATS", true},
{WM_DESTROYCLIPBOARD, "WM_DESTROYCLIPBOARD", true}, {WM_DESTROYCLIPBOARD, "WM_DESTROYCLIPBOARD", true},
@ -179,7 +149,33 @@ messageDebugEntries[] = {
{WM_QUERYENDSESSION, "WM_QUERYENDSESSION", true}, {WM_QUERYENDSESSION, "WM_QUERYENDSESSION", true},
{WM_ENDSESSION, "WM_ENDSESSION", true}, {WM_ENDSESSION, "WM_ENDSESSION", true},
#endif #endif
#ifndef Q_OS_WINCE
{WM_MOUSEACTIVATE,"WM_MOUSEACTIVATE", true},
{WM_CHILDACTIVATE, "WM_CHILDACTIVATE", true},
{WM_PARENTNOTIFY, "WM_PARENTNOTIFY", true},
{WM_ENTERIDLE, "WM_ENTERIDLE", false},
{WM_GETMINMAXINFO, "WM_GETMINMAXINFO", true},
{WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING", true},
{WM_NCCREATE, "WM_NCCREATE", true},
{WM_NCCALCSIZE, "WM_NCCALCSIZE", true},
{WM_NCACTIVATE, "WM_NCACTIVATE", true},
{WM_NCMOUSEMOVE, "WM_NCMOUSEMOVE", true},
{WM_NCMOUSELEAVE, "WM_NCMOUSELEAVE", true},
{WM_NCLBUTTONDOWN, "WM_NCLBUTTONDOWN", true},
{WM_NCLBUTTONUP, "WM_NCLBUTTONUP", true},
{WM_ACTIVATEAPP, "WM_ACTIVATEAPP", true},
{WM_NCPAINT, "WM_NCPAINT", true},
{WM_ERASEBKGND, "WM_ERASEBKGND", true},
{WM_MOUSEMOVE, "WM_MOUSEMOVE", true},
{WM_MOUSELEAVE, "WM_MOUSELEAVE", true},
{WM_NCHITTEST, "WM_NCHITTEST", false},
#ifdef WM_TOUCH
{WM_TOUCH, "WM_TOUCH", true},
#endif
{WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN", true},
{WM_DISPLAYCHANGE, "WM_DISPLAYCHANGE", true}, {WM_DISPLAYCHANGE, "WM_DISPLAYCHANGE", true},
{WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD", true},
#endif // !Q_OS_WINCE
{WM_THEMECHANGED, "WM_THEMECHANGED", true} {WM_THEMECHANGED, "WM_THEMECHANGED", true}
}; };

View File

@ -34,7 +34,16 @@
#ifndef QWINDOWSGUIEVENTDISPATCHER_H #ifndef QWINDOWSGUIEVENTDISPATCHER_H
#define QWINDOWSGUIEVENTDISPATCHER_H #define QWINDOWSGUIEVENTDISPATCHER_H
#include "qtwindows_additional.h" //
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of the QLibrary class. This header file may change from
// version to version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/private/qeventdispatcher_win_p.h> #include <QtCore/private/qeventdispatcher_win_p.h>

View File

@ -243,7 +243,13 @@ static const char *specialLanguages[] = {
"sa", // Siddham "sa", // Siddham
"sd", // Khudawadi "sd", // Khudawadi
"mai", // Tirhuta "mai", // Tirhuta
"hoc" // WarangCiti "hoc", // WarangCiti
"", // Ahom
"", // AnatolianHieroglyphs
"", // Hatran
"", // Multani
"", // OldHungarian
"" // SignWriting
}; };
Q_STATIC_ASSERT(sizeof(specialLanguages) / sizeof(const char *) == QChar::ScriptCount); Q_STATIC_ASSERT(sizeof(specialLanguages) / sizeof(const char *) == QChar::ScriptCount);

View File

@ -609,8 +609,9 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
case QPlatformTheme::DialogButtonBoxLayout: case QPlatformTheme::DialogButtonBoxLayout:
return QVariant(QPlatformDialogHelper::GnomeLayout); return QVariant(QPlatformDialogHelper::GnomeLayout);
case QPlatformTheme::SystemIconThemeName: case QPlatformTheme::SystemIconThemeName:
return QVariant(QStringLiteral("Adwaita"));
case QPlatformTheme::SystemIconFallbackThemeName: case QPlatformTheme::SystemIconFallbackThemeName:
return QVariant(QString(QStringLiteral("gnome"))); return QVariant(QStringLiteral("gnome"));
case QPlatformTheme::IconThemeSearchPaths: case QPlatformTheme::IconThemeSearchPaths:
return QVariant(QGenericUnixTheme::xdgIconThemePaths()); return QVariant(QGenericUnixTheme::xdgIconThemePaths());
case QPlatformTheme::StyleNames: { case QPlatformTheme::StyleNames: {

View File

@ -8,7 +8,7 @@ TEMPLATE = subdirs
#win32:SUBDIRS += nla #win32:SUBDIRS += nla
win32:SUBDIRS += generic win32:SUBDIRS += generic
blackberry:SUBDIRS += blackberry blackberry:SUBDIRS += blackberry
win32:!wince: SUBDIRS += nativewifi win32:!wince:!winrt: SUBDIRS += nativewifi
mac:contains(QT_CONFIG, corewlan):SUBDIRS += corewlan mac:contains(QT_CONFIG, corewlan):SUBDIRS += corewlan
mac:SUBDIRS += generic mac:SUBDIRS += generic
android:!android-no-sdk:SUBDIRS += android android:!android-no-sdk:SUBDIRS += android

View File

@ -44,7 +44,7 @@
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
#include <QtCore/private/qcoreapplication_p.h> #include <QtCore/private/qcoreapplication_p.h>
#ifdef Q_OS_WIN #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
#include "../platformdefs_win.h" #include "../platformdefs_win.h"
#endif #endif
@ -55,6 +55,24 @@ typedef ULONG NDIS_OID, *PNDIS_OID;
# endif # endif
#endif // Q_OS_WINCE #endif // Q_OS_WINCE
#ifdef Q_OS_WINRT
#include <qfunctions_winrt.h>
#include <wrl.h>
#include <windows.foundation.h>
#include <windows.foundation.collections.h>
#include <windows.networking.connectivity.h>
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::Foundation::Collections;
using namespace ABI::Windows::Networking;
using namespace ABI::Windows::Networking::Connectivity;
// needed as interface is used as parameter name in qGetInterfaceType
#undef interface
#endif // Q_OS_WINRT
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
@ -68,7 +86,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_NETWORKINTERFACE #ifndef QT_NO_NETWORKINTERFACE
static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interface) static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interface)
{ {
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
DWORD bytesWritten; DWORD bytesWritten;
NDIS_MEDIUM medium; NDIS_MEDIUM medium;
NDIS_PHYSICAL_MEDIUM physicalMedium; NDIS_PHYSICAL_MEDIUM physicalMedium;
@ -163,6 +181,84 @@ static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interf
if (result >= 0 && request.ifr_hwaddr.sa_family == ARPHRD_ETHER) if (result >= 0 && request.ifr_hwaddr.sa_family == ARPHRD_ETHER)
return QNetworkConfiguration::BearerEthernet; return QNetworkConfiguration::BearerEthernet;
#elif defined(Q_OS_WINRT)
ComPtr<INetworkInformationStatics> networkInfoStatics;
HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Connectivity_NetworkInformation).Get(), &networkInfoStatics);
Q_ASSERT_SUCCEEDED(hr);
ComPtr<IVectorView<ConnectionProfile *>> connectionProfiles;
hr = networkInfoStatics->GetConnectionProfiles(&connectionProfiles);
Q_ASSERT_SUCCEEDED(hr);
if (!connectionProfiles)
return QNetworkConfiguration::BearerUnknown;
unsigned int size;
hr = connectionProfiles->get_Size(&size);
Q_ASSERT_SUCCEEDED(hr);
for (unsigned int i = 0; i < size; ++i) {
ComPtr<IConnectionProfile> profile;
hr = connectionProfiles->GetAt(i, &profile);
Q_ASSERT_SUCCEEDED(hr);
ComPtr<INetworkAdapter> adapter;
hr = profile->get_NetworkAdapter(&adapter);
Q_ASSERT_SUCCEEDED(hr);
GUID id;
hr = adapter->get_NetworkAdapterId(&id);
Q_ASSERT_SUCCEEDED(hr);
OLECHAR adapterName[39]={0};
int length = StringFromGUID2(id, adapterName, 39);
// "length - 1" as we have to remove the null terminator from it in order to compare
if (!length
|| QString::fromRawData(reinterpret_cast<const QChar *>(adapterName), length - 1) != interface)
continue;
ComPtr<IConnectionProfile2> profile2;
hr = profile.As(&profile2);
Q_ASSERT_SUCCEEDED(hr);
boolean isWLan;
hr = profile2->get_IsWlanConnectionProfile(&isWLan);
Q_ASSERT_SUCCEEDED(hr);
if (isWLan)
return QNetworkConfiguration::BearerWLAN;
boolean isWWan;
hr = profile2->get_IsWwanConnectionProfile(&isWWan);
Q_ASSERT_SUCCEEDED(hr);
if (isWWan) {
ComPtr<IWwanConnectionProfileDetails> details;
hr = profile2->get_WwanConnectionProfileDetails(&details);
Q_ASSERT_SUCCEEDED(hr);
WwanDataClass dataClass;
hr = details->GetCurrentDataClass(&dataClass);
Q_ASSERT_SUCCEEDED(hr);
switch (dataClass) {
case WwanDataClass_Edge:
case WwanDataClass_Gprs:
return QNetworkConfiguration::Bearer2G;
case WwanDataClass_Umts:
return QNetworkConfiguration::BearerWCDMA;
case WwanDataClass_LteAdvanced:
return QNetworkConfiguration::BearerLTE;
case WwanDataClass_Hsdpa:
case WwanDataClass_Hsupa:
return QNetworkConfiguration::BearerHSPA;
case WwanDataClass_Cdma1xRtt:
case WwanDataClass_Cdma3xRtt:
case WwanDataClass_CdmaUmb:
return QNetworkConfiguration::BearerCDMA2000;
case WwanDataClass_Cdma1xEvdv:
case WwanDataClass_Cdma1xEvdo:
case WwanDataClass_Cdma1xEvdoRevA:
case WwanDataClass_Cdma1xEvdoRevB:
return QNetworkConfiguration::BearerEVDO;
case WwanDataClass_Custom:
case WwanDataClass_None:
default:
return QNetworkConfiguration::BearerUnknown;
}
}
return QNetworkConfiguration::BearerEthernet;
}
#else #else
Q_UNUSED(interface); Q_UNUSED(interface);
#endif #endif
@ -243,9 +339,11 @@ void QGenericEngine::doRequestUpdate()
if (interface.flags() & QNetworkInterface::IsLoopBack) if (interface.flags() & QNetworkInterface::IsLoopBack)
continue; continue;
#ifndef Q_OS_WINRT
// ignore WLAN interface handled in separate engine // ignore WLAN interface handled in separate engine
if (qGetInterfaceType(interface.name()) == QNetworkConfiguration::BearerWLAN) if (qGetInterfaceType(interface.name()) == QNetworkConfiguration::BearerWLAN)
continue; continue;
#endif
uint identifier; uint identifier;
if (interface.index()) if (interface.index())

View File

@ -75,6 +75,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) *m_mouseMoveHelper; QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) *m_mouseMoveHelper;
bool m_resendKeyEvent; bool m_resendKeyEvent;
bool m_scrolling; bool m_scrolling;
bool m_updatingDrag;
bool m_exposedOnMoveToWindow; bool m_exposedOnMoveToWindow;
NSEvent *m_currentlyInterpretedKeyEvent; NSEvent *m_currentlyInterpretedKeyEvent;
bool m_isMenuView; bool m_isMenuView;

View File

@ -153,6 +153,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self]; m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self];
m_resendKeyEvent = false; m_resendKeyEvent = false;
m_scrolling = false; m_scrolling = false;
m_updatingDrag = false;
m_currentlyInterpretedKeyEvent = 0; m_currentlyInterpretedKeyEvent = 0;
if (!touchDevice) { if (!touchDevice) {
@ -1464,8 +1465,10 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
// Popups implicitly grab key events; forward to the active popup if there is one. // Popups implicitly grab key events; forward to the active popup if there is one.
// This allows popups to e.g. intercept shortcuts and close the popup in response. // This allows popups to e.g. intercept shortcuts and close the popup in response.
if (QCocoaWindow *popup = QCocoaIntegration::instance()->activePopupWindow()) if (QCocoaWindow *popup = QCocoaIntegration::instance()->activePopupWindow()) {
window = popup->window(); if (!popup->m_windowFlags.testFlag(Qt::ToolTip))
window = popup->window();
}
if (eventType == QEvent::KeyPress) { if (eventType == QEvent::KeyPress) {
@ -1917,6 +1920,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
// Make sure the cursor is updated correctly if the mouse does not move and window is under cursor // Make sure the cursor is updated correctly if the mouse does not move and window is under cursor
// by creating a fake move event // by creating a fake move event
if (m_updatingDrag)
return;
const QPoint mousePos(QCursor::pos()); const QPoint mousePos(QCursor::pos());
CGEventRef moveEvent(CGEventCreateMouseEvent( CGEventRef moveEvent(CGEventCreateMouseEvent(
NULL, kCGEventMouseMoved, NULL, kCGEventMouseMoved,
@ -1934,7 +1940,11 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender
{ {
return [self handleDrag : sender]; m_updatingDrag = true;
const NSDragOperation ret([self handleDrag : sender]);
m_updatingDrag = false;
return ret;
} }
// Sends drag update to Qt, return the action // Sends drag update to Qt, return the action

View File

@ -219,12 +219,11 @@ QWindowsDirect2DIntegration::~QWindowsDirect2DIntegration()
return static_cast<QWindowsDirect2DIntegration *>(QWindowsIntegration::instance()); return static_cast<QWindowsDirect2DIntegration *>(QWindowsIntegration::instance());
} }
QPlatformWindow *QWindowsDirect2DIntegration::createPlatformWindow(QWindow *window) const
{ QWindowsWindow *QWindowsDirect2DIntegration::createPlatformWindowHelper(QWindow *window, const QWindowsWindowData &data) const
QWindowsWindowData data = createWindowData(window); {
return data.hwnd ? new QWindowsDirect2DWindow(window, data) return new QWindowsDirect2DWindow(window, data);
: Q_NULLPTR; }
}
QPlatformNativeInterface *QWindowsDirect2DIntegration::nativeInterface() const QPlatformNativeInterface *QWindowsDirect2DIntegration::nativeInterface() const
{ {

View File

@ -52,7 +52,6 @@ public:
static QWindowsDirect2DIntegration *instance(); static QWindowsDirect2DIntegration *instance();
QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const Q_DECL_OVERRIDE; QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const Q_DECL_OVERRIDE;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
@ -60,6 +59,9 @@ public:
QWindowsDirect2DContext *direct2DContext() const; QWindowsDirect2DContext *direct2DContext() const;
protected:
QWindowsWindow *createPlatformWindowHelper(QWindow *window, const QWindowsWindowData &) const Q_DECL_OVERRIDE;
private: private:
explicit QWindowsDirect2DIntegration(const QStringList &paramList); explicit QWindowsDirect2DIntegration(const QStringList &paramList);
bool init(); bool init();

View File

@ -6,13 +6,6 @@
TARGET = QtEglDeviceIntegration TARGET = QtEglDeviceIntegration
CONFIG += no_module_headers internal_module CONFIG += no_module_headers internal_module
MODULE_INCLUDES = \
\$\$QT_MODULE_INCLUDE_BASE \
\$\$QT_MODULE_INCLUDE_BASE/QtQGui
MODULE_PRIVATE_INCLUDES = \
\$\$QT_MODULE_INCLUDE_BASE/QtGui/$$QT.gui.VERSION \
\$\$QT_MODULE_INCLUDE_BASE/QtGui/$$QT.gui.VERSION/QtGui
load(qt_module) load(qt_module)
QT += core-private gui-private platformsupport-private QT += core-private gui-private platformsupport-private

View File

@ -48,20 +48,29 @@ static QThreadStorage<QPointer<QIOSAssetData> > g_assetDataCache;
static const int kBufferSize = 10; static const int kBufferSize = 10;
static ALAsset *kNoAsset = 0; static ALAsset *kNoAsset = 0;
static void ensureAuthorizationDialogNotBlocked() static bool ensureAuthorizationDialogNotBlocked()
{ {
if ([ALAssetsLibrary authorizationStatus] != ALAuthorizationStatusNotDetermined) if ([ALAssetsLibrary authorizationStatus] != ALAuthorizationStatusNotDetermined)
return; return true;
if (static_cast<QCoreApplicationPrivate *>(QObjectPrivate::get(qApp))->in_exec)
return;
// Since authorization status has not been determined, the user will be asked if (static_cast<QCoreApplicationPrivate *>(QObjectPrivate::get(qApp))->in_exec)
// to authorize the app. But since main has not finished, the dialog will be held return true;
// back until the launch completes. To avoid a dead-lock below, we start an event
// loop to complete the launch. if ([NSThread isMainThread]) {
QEventLoop loop; // The dialog is about to show, but since main has not finished, the dialog will be held
QTimer::singleShot(1, &loop, &QEventLoop::quit); // back until the launch completes. This is problematic since we cannot successfully return
loop.exec(); // back to the caller before the asset is ready, which also includes showing the dialog. To
// work around this, we create an event loop to that will complete the launch (return from the
// applicationDidFinishLaunching callback). But this will only work if we're on the main thread.
QEventLoop loop;
QTimer::singleShot(1, &loop, &QEventLoop::quit);
loop.exec();
} else {
NSLog(@"QIOSFileEngine: unable to show assets authorization dialog from non-gui thread before QApplication is executing.");
return false;
}
return true;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@ -80,8 +89,10 @@ public:
, m_writeIndex(0) , m_writeIndex(0)
, m_nextAssetReady(false) , m_nextAssetReady(false)
{ {
ensureAuthorizationDialogNotBlocked(); if (!ensureAuthorizationDialogNotBlocked())
startEnumerate(); writeAsset(kNoAsset);
else
startEnumerate();
} }
~QIOSAssetEnumerator() ~QIOSAssetEnumerator()
@ -186,7 +197,8 @@ public:
, m_assetUrl(assetUrl) , m_assetUrl(assetUrl)
, m_assetLibrary(0) , m_assetLibrary(0)
{ {
ensureAuthorizationDialogNotBlocked(); if (!ensureAuthorizationDialogNotBlocked())
return;
if (QIOSAssetData *assetData = g_assetDataCache.localData()) { if (QIOSAssetData *assetData = g_assetDataCache.localData()) {
// It's a common pattern that QFiles pointing to the same path are created and destroyed // It's a common pattern that QFiles pointing to the same path are created and destroyed

View File

@ -37,7 +37,15 @@
#include "qminimaleglbackingstore.h" #include "qminimaleglbackingstore.h"
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h> #include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
#if defined(Q_OS_UNIX)
# include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
#elif defined(Q_OS_WINRT)
# include <QtCore/private/qeventdispatcher_winrt_p.h>
# include <QtGui/qpa/qwindowsysteminterface.h>
#elif defined(Q_OS_WIN)
# include <QtPlatformSupport/private/qwindowsguieventdispatcher_p.h>
#endif
#include <qpa/qplatformwindow.h> #include <qpa/qplatformwindow.h>
#include <QtGui/QSurfaceFormat> #include <QtGui/QSurfaceFormat>
@ -48,6 +56,29 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifdef Q_OS_WINRT
namespace {
class QWinRTEventDispatcher : public QEventDispatcherWinRT {
public:
QWinRTEventDispatcher() {}
protected:
bool hasPendingEvents() Q_DECL_OVERRIDE
{
return QEventDispatcherWinRT::hasPendingEvents() || QWindowSystemInterface::windowSystemEventsQueued();
}
bool sendPostedEvents(QEventLoop::ProcessEventsFlags flags)
{
bool didProcess = QEventDispatcherWinRT::sendPostedEvents(flags);
if (!(flags & QEventLoop::ExcludeUserInputEvents))
didProcess |= QWindowSystemInterface::sendWindowSystemEvents(flags);
return didProcess;
}
};
} // anonymous namespace
#endif // Q_OS_WINRT
QMinimalEglIntegration::QMinimalEglIntegration() QMinimalEglIntegration::QMinimalEglIntegration()
: mFontDb(new QGenericUnixFontDatabase()), mScreen(new QMinimalEglScreen(EGL_DEFAULT_DISPLAY)) : mFontDb(new QGenericUnixFontDatabase()), mScreen(new QMinimalEglScreen(EGL_DEFAULT_DISPLAY))
{ {
@ -104,7 +135,15 @@ QPlatformFontDatabase *QMinimalEglIntegration::fontDatabase() const
QAbstractEventDispatcher *QMinimalEglIntegration::createEventDispatcher() const QAbstractEventDispatcher *QMinimalEglIntegration::createEventDispatcher() const
{ {
#if defined(Q_OS_UNIX)
return createUnixEventDispatcher(); return createUnixEventDispatcher();
#elif defined(Q_OS_WINRT)
return new QWinRTEventDispatcher;
#elif defined(Q_OS_WIN)
return new QWindowsGuiEventDispatcher;
#else
return Q_NULLPTR;
#endif
} }
QVariant QMinimalEglIntegration::styleHint(QPlatformIntegration::StyleHint hint) const QVariant QMinimalEglIntegration::styleHint(QPlatformIntegration::StyleHint hint) const

View File

@ -47,7 +47,7 @@
"id": 4, "id": 4,
"description": "Intel HD Graphics 3000 crashes when initializing the OpenGL driver (QTBUG-42240)", "description": "Intel HD Graphics 3000 crashes when initializing the OpenGL driver (QTBUG-42240)",
"vendor_id": "0x8086", "vendor_id": "0x8086",
"device_id": [ "0x0102", "0x0116" ], "device_id": [ "0x0102", "0x0106", "0x010A", "0x0112", "0x0116", "0x0122", "0x0126" ],
"os": { "os": {
"type": "win" "type": "win"
}, },

View File

@ -35,7 +35,6 @@
#include "qwindowscontext.h" #include "qwindowscontext.h"
#include "qwindowsole.h" #include "qwindowsole.h"
#include "qwindowsmime.h" #include "qwindowsmime.h"
#include "qwindowsguieventdispatcher.h"
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <QtGui/QClipboard> #include <QtGui/QClipboard>
@ -48,6 +47,8 @@
#include <QtCore/QVariant> #include <QtCore/QVariant>
#include <QtCore/QUrl> #include <QtCore/QUrl>
#include <QtPlatformSupport/private/qwindowsguieventdispatcher_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static const char formatTextPlainC[] = "text/plain"; static const char formatTextPlainC[] = "text/plain";

View File

@ -36,7 +36,6 @@
#include "qwindowsintegration.h" #include "qwindowsintegration.h"
#include "qwindowswindow.h" #include "qwindowswindow.h"
#include "qwindowskeymapper.h" #include "qwindowskeymapper.h"
#include "qwindowsguieventdispatcher.h"
#include "qwindowsmousehandler.h" #include "qwindowsmousehandler.h"
#include "qtwindowsglobal.h" #include "qtwindowsglobal.h"
#include "qwindowsmime.h" #include "qwindowsmime.h"
@ -66,6 +65,8 @@
#include <QtCore/QScopedArrayPointer> #include <QtCore/QScopedArrayPointer>
#include <QtCore/private/qsystemlibrary_p.h> #include <QtCore/private/qsystemlibrary_p.h>
#include <QtPlatformSupport/private/qwindowsguieventdispatcher_p.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <windowsx.h> #include <windowsx.h>

View File

@ -39,7 +39,7 @@
#include <QtGui/QOpenGLContext> #include <QtGui/QOpenGLContext>
#if defined(QT_OPENGL_ES_2_ANGLE) || defined(QT_OPENGL_DYNAMIC) #if defined(QT_OPENGL_ES_2_ANGLE) || defined(QT_OPENGL_DYNAMIC)
# include <QtANGLE/EGL/eglext.h> # include <EGL/eglext.h>
#endif #endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -44,7 +44,6 @@
# include "qwindowsfontdatabase_ft.h" # include "qwindowsfontdatabase_ft.h"
#endif #endif
#include "qwindowsfontdatabase.h" #include "qwindowsfontdatabase.h"
#include "qwindowsguieventdispatcher.h"
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
# include "qwindowsclipboard.h" # include "qwindowsclipboard.h"
# ifndef QT_NO_DRAGANDDROP # ifndef QT_NO_DRAGANDDROP
@ -67,7 +66,8 @@
#include <QtGui/private/qhighdpiscaling_p.h> #include <QtGui/private/qhighdpiscaling_p.h>
#include <QtGui/qpa/qplatforminputcontextfactory_p.h> #include <QtGui/qpa/qplatforminputcontextfactory_p.h>
#include <QtCore/private/qeventdispatcher_win_p.h> #include <QtPlatformSupport/private/qwindowsguieventdispatcher_p.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QVariant> #include <QtCore/QVariant>
@ -291,7 +291,7 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
return false; return false;
} }
QWindowsWindowData QWindowsIntegration::createWindowData(QWindow *window) const QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) const
{ {
QWindowsWindowData requested; QWindowsWindowData requested;
requested.flags = window->flags(); requested.flags = window->flags();
@ -310,22 +310,30 @@ QWindowsWindowData QWindowsIntegration::createWindowData(QWindow *window) const
<< "\n Obtained : " << obtained.geometry << " margins=" << obtained.frame << "\n Obtained : " << obtained.geometry << " margins=" << obtained.frame
<< " handle=" << obtained.hwnd << ' ' << obtained.flags << '\n'; << " handle=" << obtained.hwnd << ' ' << obtained.flags << '\n';
if (obtained.hwnd) { if (Q_UNLIKELY(!obtained.hwnd))
if (requested.flags != obtained.flags) return Q_NULLPTR;
window->setFlags(obtained.flags);
// Trigger geometry change signals of QWindow. QWindowsWindow *result = createPlatformWindowHelper(window, obtained);
if ((obtained.flags & Qt::Desktop) != Qt::Desktop && requested.geometry != obtained.geometry) Q_ASSERT(result);
if (requested.flags != obtained.flags)
window->setFlags(obtained.flags);
// Trigger geometry/screen change signals of QWindow.
if ((obtained.flags & Qt::Desktop) != Qt::Desktop) {
if (requested.geometry != obtained.geometry)
QWindowSystemInterface::handleGeometryChange(window, obtained.geometry); QWindowSystemInterface::handleGeometryChange(window, obtained.geometry);
QPlatformScreen *screen = result->screenForGeometry(obtained.geometry);
if (screen && result->screen() != screen)
QWindowSystemInterface::handleWindowScreenChanged(window, screen->screen());
} }
return obtained; return result;
} }
QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) const // Overridden to return a QWindowsDirect2DWindow in Direct2D plugin.
QWindowsWindow *QWindowsIntegration::createPlatformWindowHelper(QWindow *window, const QWindowsWindowData &data) const
{ {
QWindowsWindowData data = createWindowData(window); return new QWindowsWindow(window, data);
return data.hwnd ? new QWindowsWindow(window, data)
: Q_NULLPTR;
} }
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL

View File

@ -62,7 +62,6 @@ public:
bool hasCapability(QPlatformIntegration::Capability cap) const; bool hasCapability(QPlatformIntegration::Capability cap) const;
QWindowsWindowData createWindowData(QWindow *window) const;
QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformWindow *createPlatformWindow(QWindow *window) const;
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE;
@ -101,6 +100,9 @@ public:
QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const Q_DECL_OVERRIDE; QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const Q_DECL_OVERRIDE;
#endif #endif
protected:
virtual QWindowsWindow *createPlatformWindowHelper(QWindow *window, const QWindowsWindowData &) const;
private: private:
QScopedPointer<QWindowsIntegrationPrivate> d; QScopedPointer<QWindowsIntegrationPrivate> d;

View File

@ -35,7 +35,6 @@
#include "qwindowscontext.h" #include "qwindowscontext.h"
#include "qwindowsintegration.h" #include "qwindowsintegration.h"
#include "qwindowswindow.h" #include "qwindowswindow.h"
#include "qwindowsguieventdispatcher.h"
#include "qwindowsinputcontext.h" #include "qwindowsinputcontext.h"
#include <QtGui/QWindow> #include <QtGui/QWindow>
@ -43,6 +42,7 @@
#include <private/qguiapplication_p.h> #include <private/qguiapplication_p.h>
#include <private/qhighdpiscaling_p.h> #include <private/qhighdpiscaling_p.h>
#include <QtGui/QKeyEvent> #include <QtGui/QKeyEvent>
#include <QtPlatformSupport/private/qwindowsguieventdispatcher_p.h>
#if defined(WM_APPCOMMAND) #if defined(WM_APPCOMMAND)
# ifndef FAPPCOMMAND_MOUSE # ifndef FAPPCOMMAND_MOUSE

View File

@ -143,6 +143,8 @@ public:
QWindowsWindow(QWindow *window, const QWindowsWindowData &data); QWindowsWindow(QWindow *window, const QWindowsWindowData &data);
~QWindowsWindow(); ~QWindowsWindow();
using QPlatformWindow::screenForGeometry;
QSurfaceFormat format() const Q_DECL_OVERRIDE { return m_format; } QSurfaceFormat format() const Q_DECL_OVERRIDE { return m_format; }
void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
QRect geometry() const Q_DECL_OVERRIDE { return m_data.geometry; } QRect geometry() const Q_DECL_OVERRIDE { return m_data.geometry; }

View File

@ -29,7 +29,6 @@ SOURCES += \
$$PWD/qwindowsfontengine.cpp \ $$PWD/qwindowsfontengine.cpp \
$$PWD/qwindowsfontdatabase.cpp \ $$PWD/qwindowsfontdatabase.cpp \
$$PWD/qwindowsmousehandler.cpp \ $$PWD/qwindowsmousehandler.cpp \
$$PWD/qwindowsguieventdispatcher.cpp \
$$PWD/qwindowsole.cpp \ $$PWD/qwindowsole.cpp \
$$PWD/qwindowsmime.cpp \ $$PWD/qwindowsmime.cpp \
$$PWD/qwindowsinternalmimedata.cpp \ $$PWD/qwindowsinternalmimedata.cpp \
@ -51,7 +50,6 @@ HEADERS += \
$$PWD/qwindowsfontengine.h \ $$PWD/qwindowsfontengine.h \
$$PWD/qwindowsfontdatabase.h \ $$PWD/qwindowsfontdatabase.h \
$$PWD/qwindowsmousehandler.h \ $$PWD/qwindowsmousehandler.h \
$$PWD/qwindowsguieventdispatcher.h \
$$PWD/qtwindowsglobal.h \ $$PWD/qtwindowsglobal.h \
$$PWD/qtwindows_additional.h \ $$PWD/qtwindows_additional.h \
$$PWD/qwindowsole.h \ $$PWD/qwindowsole.h \

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