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:
commit
c7934f2489
@ -812,6 +812,7 @@ foreach my $lib (@modules_to_sync) {
|
||||
my $is_qt = !($module =~ s/^!//);
|
||||
my @dirs = split(/;/, $module);
|
||||
my $dir = $dirs[0];
|
||||
shift @dirs if ($dir =~ s/^>//);
|
||||
|
||||
my $pathtoheaders = "";
|
||||
$pathtoheaders = $moduleheaders{$lib} if ($moduleheaders{$lib});
|
||||
|
41
configure
vendored
41
configure
vendored
@ -621,6 +621,7 @@ CFG_MYSQL_CONFIG=
|
||||
CFG_PSQL_CONFIG=
|
||||
CFG_DEBUG_RELEASE=no
|
||||
CFG_FORCEDEBUGINFO=no
|
||||
CFG_RELEASE_TOOLS=no
|
||||
CFG_SHARED=yes
|
||||
CFG_SM=auto
|
||||
CFG_XSHAPE=auto
|
||||
@ -658,7 +659,6 @@ CFG_BUILD_PARTS=""
|
||||
CFG_NOBUILD_PARTS=""
|
||||
CFG_SKIP_MODULES=""
|
||||
CFG_COMPILE_EXAMPLES=yes
|
||||
CFG_RELEASE_QMAKE=no
|
||||
CFG_AUDIO_BACKEND=auto
|
||||
CFG_QML_DEBUG=yes
|
||||
CFG_PKGCONFIG=auto
|
||||
@ -1460,13 +1460,6 @@ while [ "$#" -gt 0 ]; do
|
||||
UNKNOWN_OPT=yes
|
||||
fi
|
||||
;;
|
||||
optimized-qmake)
|
||||
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
|
||||
CFG_RELEASE_QMAKE="$VAL"
|
||||
else
|
||||
UNKNOWN_OPT=yes
|
||||
fi
|
||||
;;
|
||||
release)
|
||||
if [ "$VAL" = "yes" ]; then
|
||||
CFG_DEBUG=no
|
||||
@ -1482,6 +1475,13 @@ while [ "$#" -gt 0 ]; do
|
||||
force-debug-info)
|
||||
CFG_FORCEDEBUGINFO="$VAL"
|
||||
;;
|
||||
optimized-qmake|optimized-tools)
|
||||
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
|
||||
CFG_RELEASE_TOOLS="$VAL"
|
||||
else
|
||||
UNKNOWN_OPT=yes
|
||||
fi
|
||||
;;
|
||||
developer-build)
|
||||
CFG_DEV="yes"
|
||||
;;
|
||||
@ -2444,6 +2444,9 @@ Configure options:
|
||||
|
||||
-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.
|
||||
-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
|
||||
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.
|
||||
* -nis ............... Compile NIS support.
|
||||
|
||||
@ -3409,6 +3409,10 @@ if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then
|
||||
QMAKE_CONFIG="$QMAKE_CONFIG force_debug_info"
|
||||
fi
|
||||
|
||||
if [ "$CFG_RELEASE_TOOLS" = "yes" ]; then
|
||||
QT_CONFIG="$QT_CONFIG release_tools"
|
||||
fi
|
||||
|
||||
if [ "$XPLATFORM_MAC" = "yes" ]; then
|
||||
[ "$CFG_PKGCONFIG" = "auto" ] && CFG_PKGCONFIG="no"
|
||||
fi
|
||||
@ -4039,7 +4043,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
|
||||
setBootstrapVariable QMAKE_LFLAGS
|
||||
setBootstrapVariable QMAKE_LFLAGS_GCSECTIONS
|
||||
|
||||
if [ "$CFG_RELEASE_QMAKE" = "yes" ]; then
|
||||
if [ "$CFG_RELEASE_TOOLS" = "yes" ]; then
|
||||
setBootstrapVariable QMAKE_CFLAGS_RELEASE
|
||||
setBootstrapVariable QMAKE_CXXFLAGS_RELEASE
|
||||
EXTRA_CFLAGS="$EXTRA_CFLAGS \$(QMAKE_CFLAGS_RELEASE)"
|
||||
@ -7334,10 +7338,12 @@ release="release"
|
||||
[ "$CFG_FORCEDEBUGINFO" = "yes" ] && release="release (with debug info)"
|
||||
[ "$CFG_DEBUG" = "yes" ] && build_mode="debug" || build_mode=$release
|
||||
if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
|
||||
echo " Mode ................... debug and $release; default link: $build_mode"
|
||||
else
|
||||
echo " Mode ................... $build_mode"
|
||||
build_mode="debug and $release; default link: $build_mode"
|
||||
fi
|
||||
if [ "$CFG_RELEASE_TOOLS" = "yes" ]; then
|
||||
build_mode="$build_mode; optimized tools"
|
||||
fi
|
||||
echo " Mode ................... $build_mode"
|
||||
unset build_mode release
|
||||
echo " Using sanitizer(s)...... $CFG_SANITIZERS"
|
||||
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 "Configure with '-qreal float' to create a build that is binary compatible with 5.1."
|
||||
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
|
||||
cat $outpath/config.summary # display config feedback to user
|
||||
|
@ -41,7 +41,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<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 row="5" column="0" colspan="2" >
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
|
@ -40,85 +40,134 @@
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <QtNetwork>
|
||||
#include <QUrl>
|
||||
|
||||
#include "httpwindow.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)
|
||||
: 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
|
||||
urlLineEdit = new QLineEdit("https://qt-project.org/");
|
||||
#else
|
||||
urlLineEdit = new QLineEdit("http://qt-project.org/");
|
||||
connect(&qnam, &QNetworkAccessManager::sslErrors,
|
||||
this, &HttpWindow::sslErrors);
|
||||
#endif
|
||||
|
||||
urlLabel = new QLabel(tr("&URL:"));
|
||||
urlLabel->setBuddy(urlLineEdit);
|
||||
statusLabel = new QLabel(tr("Please enter the URL of a file you want to "
|
||||
"download."));
|
||||
QFormLayout *formLayout = new QFormLayout;
|
||||
urlLineEdit->setClearButtonEnabled(true);
|
||||
connect(urlLineEdit, &QLineEdit::textChanged,
|
||||
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);
|
||||
mainLayout->addWidget(statusLabel);
|
||||
|
||||
downloadButton = new QPushButton(tr("Download"));
|
||||
downloadButton->setDefault(true);
|
||||
quitButton = new QPushButton(tr("Quit"));
|
||||
connect(downloadButton, &QAbstractButton::clicked, this, &HttpWindow::downloadFile);
|
||||
QPushButton *quitButton = new QPushButton(tr("Quit"));
|
||||
quitButton->setAutoDefault(false);
|
||||
|
||||
buttonBox = new QDialogButtonBox;
|
||||
connect(quitButton, &QAbstractButton::clicked, this, &QWidget::close);
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox;
|
||||
buttonBox->addButton(downloadButton, QDialogButtonBox::ActionRole);
|
||||
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);
|
||||
setLayout(mainLayout);
|
||||
|
||||
setWindowTitle(tr("HTTP"));
|
||||
urlLineEdit->setFocus();
|
||||
}
|
||||
|
||||
void HttpWindow::startRequest(QUrl url)
|
||||
void HttpWindow::startRequest(const QUrl &requestedUrl)
|
||||
{
|
||||
url = requestedUrl;
|
||||
httpRequestAborted = false;
|
||||
|
||||
reply = qnam.get(QNetworkRequest(url));
|
||||
connect(reply, SIGNAL(finished()),
|
||||
this, SLOT(httpFinished()));
|
||||
connect(reply, SIGNAL(readyRead()),
|
||||
this, SLOT(httpReadyRead()));
|
||||
connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
|
||||
this, SLOT(updateDataReadProgress(qint64,qint64)));
|
||||
connect(reply, &QNetworkReply::finished, this, &HttpWindow::httpFinished);
|
||||
connect(reply, &QIODevice::readyRead, this, &HttpWindow::httpReadyRead);
|
||||
|
||||
ProgressDialog *progressDialog = new ProgressDialog(url, this);
|
||||
progressDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
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()
|
||||
{
|
||||
url = urlLineEdit->text();
|
||||
const QString urlSpec = urlLineEdit->text().trimmed();
|
||||
if (urlSpec.isEmpty())
|
||||
return;
|
||||
|
||||
QFileInfo fileInfo(url.path());
|
||||
QString fileName = fileInfo.fileName();
|
||||
const QUrl newUrl = QUrl::fromUserInput(urlSpec);
|
||||
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())
|
||||
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 (QMessageBox::question(this, tr("HTTP"),
|
||||
if (QMessageBox::question(this, tr("Overwrite Existing File"),
|
||||
tr("There already exists a file called %1 in "
|
||||
"the current directory. Overwrite?").arg(fileName),
|
||||
QMessageBox::Yes|QMessageBox::No, QMessageBox::No)
|
||||
@ -127,23 +176,27 @@ void HttpWindow::downloadFile()
|
||||
QFile::remove(fileName);
|
||||
}
|
||||
|
||||
file = new QFile(fileName);
|
||||
if (!file->open(QIODevice::WriteOnly)) {
|
||||
QMessageBox::information(this, tr("HTTP"),
|
||||
tr("Unable to save the file %1: %2.")
|
||||
.arg(fileName).arg(file->errorString()));
|
||||
delete file;
|
||||
file = 0;
|
||||
file = openFileForWrite(fileName);
|
||||
if (!file)
|
||||
return;
|
||||
}
|
||||
|
||||
progressDialog->setWindowTitle(tr("HTTP"));
|
||||
progressDialog->setLabelText(tr("Downloading %1.").arg(fileName));
|
||||
downloadButton->setEnabled(false);
|
||||
|
||||
// schedule the request
|
||||
httpRequestAborted = false;
|
||||
startRequest(url);
|
||||
startRequest(newUrl);
|
||||
}
|
||||
|
||||
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()
|
||||
@ -156,52 +209,56 @@ void HttpWindow::cancelDownload()
|
||||
|
||||
void HttpWindow::httpFinished()
|
||||
{
|
||||
QFileInfo fi;
|
||||
if (file) {
|
||||
fi.setFile(file->fileName());
|
||||
file->close();
|
||||
delete file;
|
||||
file = Q_NULLPTR;
|
||||
}
|
||||
|
||||
if (httpRequestAborted) {
|
||||
if (file) {
|
||||
file->close();
|
||||
file->remove();
|
||||
delete file;
|
||||
file = 0;
|
||||
}
|
||||
reply->deleteLater();
|
||||
progressDialog->hide();
|
||||
reply = Q_NULLPTR;
|
||||
return;
|
||||
}
|
||||
|
||||
progressDialog->hide();
|
||||
file->flush();
|
||||
file->close();
|
||||
|
||||
|
||||
QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
|
||||
if (reply->error()) {
|
||||
file->remove();
|
||||
QMessageBox::information(this, tr("HTTP"),
|
||||
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()));
|
||||
QFile::remove(fi.absoluteFilePath());
|
||||
statusLabel->setText(tr("Download failed:\n%1.").arg(reply->errorString()));
|
||||
downloadButton->setEnabled(true);
|
||||
reply->deleteLater();
|
||||
reply = Q_NULLPTR;
|
||||
return;
|
||||
}
|
||||
|
||||
const QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
|
||||
|
||||
reply->deleteLater();
|
||||
reply = 0;
|
||||
delete file;
|
||||
file = 0;
|
||||
reply = Q_NULLPTR;
|
||||
|
||||
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()
|
||||
@ -214,15 +271,6 @@ void HttpWindow::httpReadyRead()
|
||||
file->write(reply->readAll());
|
||||
}
|
||||
|
||||
void HttpWindow::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes)
|
||||
{
|
||||
if (httpRequestAborted)
|
||||
return;
|
||||
|
||||
progressDialog->setMaximum(totalBytes);
|
||||
progressDialog->setValue(bytesRead);
|
||||
}
|
||||
|
||||
void HttpWindow::enableDownloadButton()
|
||||
{
|
||||
downloadButton->setEnabled(!urlLineEdit->text().isEmpty());
|
||||
@ -230,18 +278,18 @@ void HttpWindow::enableDownloadButton()
|
||||
|
||||
void HttpWindow::slotAuthenticationRequired(QNetworkReply*,QAuthenticator *authenticator)
|
||||
{
|
||||
QDialog dlg;
|
||||
QDialog authenticationDialog;
|
||||
Ui::Dialog ui;
|
||||
ui.setupUi(&dlg);
|
||||
dlg.adjustSize();
|
||||
ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm()).arg(url.host()));
|
||||
ui.setupUi(&authenticationDialog);
|
||||
authenticationDialog.adjustSize();
|
||||
ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm(), url.host()));
|
||||
|
||||
// Did the URL have information? Fill the UI
|
||||
// This is only relevant if the URL-supplied credentials were wrong
|
||||
ui.userEdit->setText(url.userName());
|
||||
ui.passwordEdit->setText(url.password());
|
||||
|
||||
if (dlg.exec() == QDialog::Accepted) {
|
||||
if (authenticationDialog.exec() == QDialog::Accepted) {
|
||||
authenticator->setUser(ui.userEdit->text());
|
||||
authenticator->setPassword(ui.passwordEdit->text());
|
||||
}
|
||||
@ -253,12 +301,12 @@ void HttpWindow::sslErrors(QNetworkReply*,const QList<QSslError> &errors)
|
||||
QString errorString;
|
||||
foreach (const QSslError &error, errors) {
|
||||
if (!errorString.isEmpty())
|
||||
errorString += ", ";
|
||||
errorString += '\n';
|
||||
errorString += error.errorString();
|
||||
}
|
||||
|
||||
if (QMessageBox::warning(this, tr("HTTP"),
|
||||
tr("One or more SSL errors has occurred: %1").arg(errorString),
|
||||
if (QMessageBox::warning(this, tr("SSL Errors"),
|
||||
tr("One or more SSL errors has occurred:\n%1").arg(errorString),
|
||||
QMessageBox::Ignore | QMessageBox::Abort) == QMessageBox::Ignore) {
|
||||
reply->ignoreSslErrors();
|
||||
}
|
||||
|
@ -41,39 +41,46 @@
|
||||
#ifndef HTTPWINDOW_H
|
||||
#define HTTPWINDOW_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QProgressDialog>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QUrl>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QDialogButtonBox;
|
||||
class QFile;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QProgressDialog;
|
||||
class QPushButton;
|
||||
class QSslError;
|
||||
class QAuthenticator;
|
||||
class QNetworkReply;
|
||||
|
||||
class QCheckBox;
|
||||
|
||||
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
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
HttpWindow(QWidget *parent = 0);
|
||||
explicit HttpWindow(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
void startRequest(QUrl url);
|
||||
void startRequest(const QUrl &requestedUrl);
|
||||
|
||||
private slots:
|
||||
void downloadFile();
|
||||
void cancelDownload();
|
||||
void httpFinished();
|
||||
void httpReadyRead();
|
||||
void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
|
||||
void enableDownloadButton();
|
||||
void slotAuthenticationRequired(QNetworkReply*,QAuthenticator *);
|
||||
#ifndef QT_NO_SSL
|
||||
@ -81,19 +88,19 @@ private slots:
|
||||
#endif
|
||||
|
||||
private:
|
||||
QFile *openFileForWrite(const QString &fileName);
|
||||
|
||||
QLabel *statusLabel;
|
||||
QLabel *urlLabel;
|
||||
QLineEdit *urlLineEdit;
|
||||
QProgressDialog *progressDialog;
|
||||
QPushButton *downloadButton;
|
||||
QPushButton *quitButton;
|
||||
QDialogButtonBox *buttonBox;
|
||||
QCheckBox *launchCheckBox;
|
||||
QLineEdit *defaultFileLineEdit;
|
||||
QLineEdit *downloadDirectoryLineEdit;
|
||||
|
||||
QUrl url;
|
||||
QNetworkAccessManager qnam;
|
||||
QNetworkReply *reply;
|
||||
QFile *file;
|
||||
int httpGetId;
|
||||
bool httpRequestAborted;
|
||||
};
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDir>
|
||||
|
||||
#include "httpwindow.h"
|
||||
@ -47,8 +48,10 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
|
||||
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();
|
||||
return app.exec();
|
||||
|
@ -285,9 +285,9 @@
|
||||
|
||||
\snippet tools/plugandpaint/main.cpp 0
|
||||
|
||||
The argument to Q_IMPORT_PLUGIN() is the plugin's name, as
|
||||
specified with Q_PLUGIN_METADATA() in the \l{Exporting the
|
||||
Plugin}{plugin}.
|
||||
The argument to Q_IMPORT_PLUGIN() is the plugin name, which corresponds
|
||||
with the name of the class that declares metadata for the plugin with
|
||||
Q_PLUGIN_METADATA().
|
||||
|
||||
In the \c .pro file, we need to specify the static library.
|
||||
Here's the project file for building Plug & Paint:
|
||||
|
@ -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_EGL = $$QMAKE_LIBDIR_OPENGL_ES2
|
||||
QMAKE_LIBDIR_OPENVG = $$QMAKE_LIBDIR_OPENGL_ES2
|
||||
|
||||
QMAKE_INCDIR_EGL = $$[QT_SYSROOT]/opt/vc/include \
|
||||
$$[QT_SYSROOT]/opt/vc/include/interface/vcos/pthreads \
|
||||
$$[QT_SYSROOT]/opt/vc/include/interface/vmcs_host/linux
|
||||
QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL}
|
||||
QMAKE_INCDIR_OPENVG = $${QMAKE_INCDIR_EGL}
|
||||
|
||||
QMAKE_LIBS_EGL = -lEGL -lGLESv2
|
||||
QMAKE_LIBS_OPENVG = -lEGL -lOpenVG -lGLESv2
|
||||
|
||||
contains(DISTRO, squeeze) {
|
||||
#Debian Squeeze: Legacy everything
|
||||
|
@ -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_EGL = $$QMAKE_LIBDIR_OPENGL_ES2
|
||||
QMAKE_LIBDIR_OPENVG = $$QMAKE_LIBDIR_OPENGL_ES2
|
||||
|
||||
QMAKE_INCDIR_EGL = $$[QT_SYSROOT]/opt/vc/include \
|
||||
$$[QT_SYSROOT]/opt/vc/include/interface/vcos/pthreads \
|
||||
$$[QT_SYSROOT]/opt/vc/include/interface/vmcs_host/linux
|
||||
QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL}
|
||||
QMAKE_INCDIR_OPENVG = $${QMAKE_INCDIR_EGL}
|
||||
|
||||
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
|
||||
|
||||
DISTRO_OPTS += hard-float
|
||||
DISTRO_OPTS += deb-multi-arch
|
||||
|
||||
# Preferred eglfs backend
|
||||
EGLFS_DEVICE_INTEGRATION = eglfs_brcm
|
||||
|
@ -76,11 +76,6 @@ for(ever) {
|
||||
next()
|
||||
}
|
||||
|
||||
target_qt:isEqual(TARGET, $$MODULE_NAME) {
|
||||
warning("$$TARGET cannot have a QT$$var_sfx of $$QTLIB")
|
||||
next()
|
||||
}
|
||||
|
||||
contains(MODULE_CONFIG, internal_module): \
|
||||
using_privates = true
|
||||
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):\
|
||||
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) {
|
||||
mac {
|
||||
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)
|
||||
|
||||
# Generate the plugin linker line
|
||||
target_qt:isEqual(TARGET, QTPLUG) {
|
||||
warning($$TARGET cannot have a QTPLUGIN of $$QTPLUG)
|
||||
} else {
|
||||
QT_LINKAGE = -l$${QTPLUG}$$qtPlatformTargetSuffix()
|
||||
}
|
||||
QT_LINKAGE = -l$${QTPLUG}$$qtPlatformTargetSuffix()
|
||||
|
||||
# Only link against plugin in static builds
|
||||
isEqual(QT_CURRENT_VERIFY, QTPLUGIN): {
|
||||
|
@ -21,7 +21,7 @@ QMAKE_LFLAGS += $$QMAKE_LFLAGS_GCSECTIONS
|
||||
|
||||
host_build: QT -= gui # no host tool will ever use gui
|
||||
host_build:force_bootstrap {
|
||||
!build_pass: CONFIG += release
|
||||
!build_pass:contains(QT_CONFIG, release_tools): CONFIG += release
|
||||
contains(QT, core(-private)?|xml) {
|
||||
QT -= core core-private xml
|
||||
QT += bootstrap-private
|
||||
|
@ -32,7 +32,7 @@ host_build {
|
||||
QMAKE_CFLAGS += $$QMAKE_CFLAGS_SPLIT_SECTIONS
|
||||
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_SPLIT_SECTIONS
|
||||
force_bootstrap {
|
||||
!build_pass: CONFIG += release
|
||||
!build_pass:contains(QT_CONFIG, release_tools): CONFIG += release
|
||||
contains(QT, core(-private)?|xml) {
|
||||
QT -= core core-private xml
|
||||
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
|
||||
|
||||
ucmodule = $$upper($$MODULE)
|
||||
@ -53,6 +56,8 @@ internal_module: \
|
||||
else: \
|
||||
MODULE_DEPENDS = $$replace(QT, -private$, )
|
||||
MODULE_DEPENDS = $$unique(MODULE_DEPENDS)
|
||||
contains(MODULE_DEPENDS, $$MODULE): \
|
||||
error("$$TARGET depends on itself.")
|
||||
|
||||
contains(TARGET, QtAddOn.*): \
|
||||
MODULE_DEFINE = QT_ADDON_$${ucmodule}_LIB
|
||||
@ -101,11 +106,11 @@ else: \
|
||||
DEFINES += QT_BUILD_$${ucmodule}_LIB
|
||||
|
||||
# OS X and iOS frameworks
|
||||
mac:CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) {
|
||||
qt_framework {
|
||||
# Set the CFBundleIdentifier prefix for Qt frameworks
|
||||
QMAKE_TARGET_BUNDLE_PREFIX = org.qt-project
|
||||
#QMAKE_FRAMEWORK_VERSION = 4.0
|
||||
CONFIG += sliced_bundle qt_framework
|
||||
CONFIG += sliced_bundle
|
||||
header_module {
|
||||
CONFIG += bundle
|
||||
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
|
||||
|
||||
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
|
||||
QMAKE_LFLAGS += $${QMAKE_LFLAGS_VERSION_SCRIPT}$$verscript
|
||||
|
||||
@ -234,7 +239,7 @@ load(qt_installs)
|
||||
load(qt_targets)
|
||||
|
||||
# this builds on top of qt_common
|
||||
unix|mingw {
|
||||
!internal_module:!qt_framework:if(unix|mingw) {
|
||||
CONFIG += create_pc
|
||||
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
|
||||
host_build: \
|
||||
|
@ -25,9 +25,12 @@ load(qt_build_paths)
|
||||
!silent: message($$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))
|
||||
QMAKE_EXTRA_TARGETS += include-distclean
|
||||
DISTCLEAN_DEPS += include-distclean
|
||||
!minimal_syncqt {
|
||||
include-distclean.commands = \
|
||||
$$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()
|
||||
@ -38,6 +41,9 @@ git_build: \
|
||||
else: \
|
||||
INC_PATH = $$MODULE_BASE_INDIR
|
||||
include($$INC_PATH/include/$$MODULE_INCNAME/headers.pri, "", true)
|
||||
CONFIG += qt_install_headers
|
||||
|
||||
alien_syncqt: return()
|
||||
|
||||
for (injection, SYNCQT.INJECTIONS) {
|
||||
injects = $$split(injection, :)
|
||||
@ -82,8 +88,6 @@ SYNCQT.HEADER_FILES += $$MODULE_MASTER_DEPS_HEADER
|
||||
isEmpty(PRECOMPILED_HEADER): PRECOMPILED_HEADER = $$MODULE_MASTER_DEPS_HEADER
|
||||
}
|
||||
|
||||
CONFIG += qt_install_headers
|
||||
|
||||
headersclean:!internal_module {
|
||||
# Make sure that the header compiles with our strict options
|
||||
hcleanDEFS = -DQT_NO_CAST_TO_ASCII=1 \
|
||||
|
@ -55,7 +55,7 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri
|
||||
module_rundep =
|
||||
static: \
|
||||
module_build_type = staticlib
|
||||
else:mac:contains(QT_CONFIG, qt_framework): \
|
||||
else: qt_framework: \
|
||||
module_build_type = lib_bundle
|
||||
else: \
|
||||
module_build_type =
|
||||
|
@ -10,9 +10,9 @@ DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PH
|
||||
|
||||
QMAKE_CFLAGS += -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
|
||||
MSVC_VER = 14.0
|
||||
|
@ -10,9 +10,9 @@ DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PH
|
||||
|
||||
QMAKE_CFLAGS += -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
|
||||
MSVC_VER = 14.0
|
||||
|
@ -10,10 +10,9 @@ DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PC_APP WINAPI_PARTITION_PH
|
||||
|
||||
QMAKE_CFLAGS += -FS
|
||||
QMAKE_CXXFLAGS += -FS
|
||||
QMAKE_LFLAGS += /SAFESEH /MACHINE:X86
|
||||
|
||||
QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib kernel32.lib
|
||||
QMAKE_LFLAGS += /SAFESEH /MACHINE:X86 /NODEFAULTLIB:kernel32.lib
|
||||
|
||||
QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib OneCore.lib
|
||||
VCPROJ_ARCH = Win32
|
||||
MSVC_VER = 14.0
|
||||
WINSDK_VER = 10.0
|
||||
|
@ -853,8 +853,15 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString();
|
||||
suffixSetting = "$(" + suffixSetting + ")";
|
||||
if (!librarySuffix.isEmpty()) {
|
||||
library.replace(librarySuffix, suffixSetting);
|
||||
name.remove(librarySuffix);
|
||||
int pos = library.lastIndexOf(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 {
|
||||
library.replace(name, name + suffixSetting);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ protected:
|
||||
virtual bool doDepends() const { return Option::mkfile::do_deps; }
|
||||
|
||||
void filterIncludedFiles(const char *);
|
||||
virtual void processSources() {
|
||||
void processSources() {
|
||||
filterIncludedFiles("SOURCES");
|
||||
filterIncludedFiles("GENERATED_SOURCES");
|
||||
}
|
||||
|
@ -75,7 +75,6 @@ public:
|
||||
protected:
|
||||
virtual VCProjectWriter *createProjectWriter();
|
||||
virtual bool doDepends() const { return false; } //never necesary
|
||||
virtual void processSources() { filterIncludedFiles("SOURCES"); filterIncludedFiles("GENERATED_SOURCES"); }
|
||||
using Win32MakefileGenerator::replaceExtraCompilerVariables;
|
||||
virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &, ReplaceFor);
|
||||
virtual bool supportsMetaBuild() { return true; }
|
||||
|
@ -42,6 +42,11 @@ licheck.path = $$[QT_HOST_BINS]
|
||||
licheck.files = $$PWD/bin/$$QT_LICHECK
|
||||
!isEmpty(QT_LICHECK): INSTALLS += licheck
|
||||
|
||||
#fixqt4headers.pl
|
||||
fixqt4headers.path = $$[QT_HOST_BINS]
|
||||
fixqt4headers.files = $$PWD/bin/fixqt4headers.pl
|
||||
INSTALLS += fixqt4headers
|
||||
|
||||
#syncqt
|
||||
syncqt.path = $$[QT_HOST_BINS]
|
||||
syncqt.files = $$PWD/bin/syncqt.pl
|
||||
|
6
src/3rdparty/png_dependency.pri
vendored
Normal file
6
src/3rdparty/png_dependency.pri
vendored
Normal 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)
|
||||
}
|
@ -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
|
@ -993,7 +993,7 @@ QString QTextDecoder::toUnicode(const char *chars, int len)
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
|
@ -296,7 +296,6 @@ QString QUtf8::convertToUnicode(const char *chars, int len, QTextCodec::Converte
|
||||
{
|
||||
bool headerdone = false;
|
||||
ushort replacement = QChar::ReplacementCharacter;
|
||||
int need = 0;
|
||||
int invalid = 0;
|
||||
int res;
|
||||
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)
|
||||
// 2 of 3 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()));
|
||||
const uchar *src = reinterpret_cast<const uchar *>(chars);
|
||||
|
@ -56,16 +56,6 @@
|
||||
\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
|
||||
\title Pros and Cons of Using QList
|
||||
|
@ -914,6 +914,13 @@
|
||||
//# define Q_COMPILER_UNIFORM_INIT
|
||||
# define Q_COMPILER_UNRESTRICTED_UNIONS
|
||||
# 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 /* Q_CC_MSVC */
|
||||
|
||||
|
@ -3842,7 +3842,8 @@ int qrand()
|
||||
independent copy of the object.
|
||||
\li \c Q_MOVABLE_TYPE specifies that \a Type has a constructor
|
||||
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
|
||||
constructors and/or a destructor and that it may not be moved
|
||||
in memory.
|
||||
|
@ -973,7 +973,7 @@ QByteArray QIODevice::read(qint64 maxSize)
|
||||
/*!
|
||||
\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.
|
||||
|
||||
This function has no way of reporting errors; returning an empty
|
||||
|
@ -1179,14 +1179,15 @@ bool QProcessPrivate::_q_startupNotification()
|
||||
|
||||
if (startupSocketNotifier)
|
||||
startupSocketNotifier->setEnabled(false);
|
||||
if (processStarted()) {
|
||||
QString errorMessage;
|
||||
if (processStarted(&errorMessage)) {
|
||||
q->setProcessState(QProcess::Running);
|
||||
emit q->started(QProcess::QPrivateSignal());
|
||||
return true;
|
||||
}
|
||||
|
||||
q->setProcessState(QProcess::NotRunning);
|
||||
setErrorAndEmit(QProcess::FailedToStart, errorString); // the error string was already set
|
||||
setErrorAndEmit(QProcess::FailedToStart, errorMessage);
|
||||
#ifdef Q_OS_UNIX
|
||||
// make sure the process manager removes this entry
|
||||
waitForDeadChild();
|
||||
|
@ -352,7 +352,7 @@ public:
|
||||
#elif defined(QPROCESS_USE_SPAWN)
|
||||
pid_t spawnChild(pid_t *ppid, const char *workingDirectory, char **argv, char **envp);
|
||||
#endif
|
||||
bool processStarted();
|
||||
bool processStarted(QString *errorMessage = Q_NULLPTR);
|
||||
void terminateProcess();
|
||||
void killProcess();
|
||||
void findExitCode();
|
||||
|
@ -720,7 +720,7 @@ report_errno:
|
||||
}
|
||||
#endif
|
||||
|
||||
bool QProcessPrivate::processStarted()
|
||||
bool QProcessPrivate::processStarted(QString *errorMessage)
|
||||
{
|
||||
char buf[errorBufferMax];
|
||||
int i = 0;
|
||||
@ -744,8 +744,8 @@ bool QProcessPrivate::processStarted()
|
||||
#endif
|
||||
|
||||
// did we read an error message?
|
||||
if (i > 0)
|
||||
q_func()->setErrorString(QString::fromLocal8Bit(buf, i));
|
||||
if ((i > 0) && errorMessage)
|
||||
*errorMessage = QString::fromLocal8Bit(buf, i);
|
||||
|
||||
return i <= 0;
|
||||
}
|
||||
|
@ -543,7 +543,7 @@ void QProcessPrivate::startProcess()
|
||||
_q_startupNotification();
|
||||
}
|
||||
|
||||
bool QProcessPrivate::processStarted()
|
||||
bool QProcessPrivate::processStarted(QString * /*errorMessage*/)
|
||||
{
|
||||
return processState == QProcess::Running;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ void QProcessPrivate::startProcess()
|
||||
_q_startupNotification();
|
||||
}
|
||||
|
||||
bool QProcessPrivate::processStarted()
|
||||
bool QProcessPrivate::processStarted(QString * /*errorMessage*/)
|
||||
{
|
||||
return processState == QProcess::Running;
|
||||
}
|
||||
|
@ -1646,6 +1646,7 @@ QModelIndexList QItemSelectionModel::selectedIndexes() const
|
||||
/*!
|
||||
\since 4.2
|
||||
Returns the indexes in the given \a column for the rows where all columns are selected.
|
||||
The list is not sorted.
|
||||
|
||||
\sa selectedIndexes(), selectedColumns()
|
||||
*/
|
||||
|
@ -280,7 +280,7 @@ static inline int compressedNumber(double d)
|
||||
if (non_int)
|
||||
return INT_MAX;
|
||||
|
||||
bool neg = (val >> 63);
|
||||
bool neg = (val >> 63) != 0;
|
||||
val &= fraction_mask;
|
||||
val |= ((quint64)1 << 52);
|
||||
int res = (int)(val >> (52 - exp));
|
||||
@ -543,7 +543,7 @@ public:
|
||||
offset tableOffset;
|
||||
// content follows here
|
||||
|
||||
inline bool isObject() const { return is_object; }
|
||||
inline bool isObject() const { return !!is_object; }
|
||||
inline bool isArray() const { return !isObject(); }
|
||||
|
||||
inline offset *table() const { return (offset *) (((char *) this) + tableOffset); }
|
||||
|
@ -173,7 +173,7 @@ QJsonValue::QJsonValue(int n)
|
||||
QJsonValue::QJsonValue(qint64 n)
|
||||
: 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
|
||||
{
|
||||
if (t == Double && int(dbl) == dbl)
|
||||
return dbl;
|
||||
return int(dbl);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,8 @@ winrt {
|
||||
mac {
|
||||
HEADERS += \
|
||||
kernel/qcfsocketnotifier_p.h \
|
||||
kernel/qcore_mac_p.h
|
||||
kernel/qcore_mac_p.h \
|
||||
kernel/qeventdispatcher_cf_p.h
|
||||
|
||||
SOURCES += \
|
||||
kernel/qcfsocketnotifier.cpp \
|
||||
@ -109,18 +110,14 @@ mac {
|
||||
kernel/qcore_mac.cpp
|
||||
|
||||
OBJECTIVE_SOURCES += \
|
||||
kernel/qcore_mac_objc.mm
|
||||
kernel/qcore_mac_objc.mm \
|
||||
kernel/qeventdispatcher_cf.mm
|
||||
|
||||
LIBS_PRIVATE += -framework Foundation
|
||||
|
||||
osx: LIBS_PRIVATE += -framework CoreServices
|
||||
osx: LIBS_PRIVATE += -framework CoreServices -framework AppKit
|
||||
|
||||
ios {
|
||||
OBJECTIVE_SOURCES += \
|
||||
kernel/qeventdispatcher_cf.mm
|
||||
HEADERS += \
|
||||
kernel/qeventdispatcher_cf_p.h
|
||||
|
||||
# We need UIKit for UIDevice
|
||||
LIBS_PRIVATE += -framework UIKit
|
||||
}
|
||||
|
@ -43,7 +43,11 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include <UIKit/UIApplication.h>
|
||||
#ifdef Q_OS_OSX
|
||||
# include <AppKit/NSApplication.h>
|
||||
#else
|
||||
# include <UIKit/UIApplication.h>
|
||||
#endif
|
||||
|
||||
@interface RunLoopModeTracker : NSObject {
|
||||
QStack<CFStringRef> m_runLoopModes;
|
||||
@ -61,7 +65,11 @@
|
||||
addObserver:self
|
||||
selector:@selector(receivedNotification:)
|
||||
name:nil
|
||||
#ifdef Q_OS_OSX
|
||||
object:[NSApplication sharedApplication]];
|
||||
#else
|
||||
object:[UIApplication sharedApplication]];
|
||||
#endif
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -103,7 +103,7 @@ struct tm {
|
||||
int tm_year; /* years since 1900 */
|
||||
int tm_wday; /* days since Sunday - [0,6] */
|
||||
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
|
||||
|
||||
|
@ -93,9 +93,9 @@
|
||||
\macro Q_IMPORT_PLUGIN(PluginName)
|
||||
\relates <QtPlugin>
|
||||
|
||||
This macro imports the plugin named \a PluginName, corresponding
|
||||
to the \l{qmake Variable Reference#TARGET}{TARGET} specified in the
|
||||
plugin's project file.
|
||||
This macro imports the plugin named \a PluginName, which corresponds
|
||||
with the name of the class that declares metadata for the plugin with
|
||||
Q_PLUGIN_METADATA().
|
||||
|
||||
Inserting this macro into your application's source code will allow
|
||||
you to make use of a static plugin.
|
||||
|
7
src/corelib/qtzlib.pro
Normal file
7
src/corelib/qtzlib.pro
Normal file
@ -0,0 +1,7 @@
|
||||
TARGET = QtZlib
|
||||
MODULE = zlib
|
||||
MAKEFILE = Makefile.qtzlib
|
||||
CONFIG += internal_module header_module alien_syncqt
|
||||
QT =
|
||||
|
||||
load(qt_module)
|
@ -62,8 +62,6 @@
|
||||
# include "QtCore/qatomic_armv5.h"
|
||||
#elif defined(Q_PROCESSOR_IA64)
|
||||
# include "QtCore/qatomic_ia64.h"
|
||||
#elif defined(Q_PROCESSOR_MIPS)
|
||||
# include "QtCore/qatomic_mips.h"
|
||||
#elif defined(Q_PROCESSOR_X86)
|
||||
# include <QtCore/qatomic_x86.h>
|
||||
|
||||
|
@ -139,6 +139,11 @@ public:
|
||||
lock calls unlock(). A non-blocking alternative to lock() is
|
||||
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
|
||||
*/
|
||||
|
||||
@ -165,6 +170,8 @@ public:
|
||||
a thread may only lock a mutex once. The default is
|
||||
QMutex::NonRecursive.
|
||||
|
||||
Recursive mutexes are slower and take more memory than non-recursive ones.
|
||||
|
||||
\sa lock(), unlock()
|
||||
*/
|
||||
QMutex::QMutex(RecursionMode mode)
|
||||
|
@ -179,8 +179,9 @@ QT_BEGIN_NAMESPACE
|
||||
\value Unicode_6_2 Version 6.2
|
||||
\value Unicode_6_3 Version 6.3 Since Qt 5.3
|
||||
\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
|
||||
in version 6.3 of Unicode.
|
||||
in version 8.0 of Unicode.
|
||||
|
||||
\sa unicodeVersion(), currentUnicodeVersion()
|
||||
*/
|
||||
@ -401,6 +402,12 @@ QT_BEGIN_NAMESPACE
|
||||
\value Script_Khudawadi
|
||||
\value Script_Tirhuta
|
||||
\value Script_WarangCiti
|
||||
\value Script_Ahom
|
||||
\value Script_AnatolianHieroglyphs
|
||||
\value Script_Hatran
|
||||
\value Script_Multani
|
||||
\value Script_OldHungarian
|
||||
\value Script_SignWriting
|
||||
|
||||
\omitvalue ScriptCount
|
||||
|
||||
@ -1423,48 +1430,18 @@ QChar::UnicodeVersion QChar::currentUnicodeVersion() Q_DECL_NOTHROW
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
Q_DECL_CONST_FUNCTION static inline T toLowerCase_helper(T uc) Q_DECL_NOTHROW
|
||||
template <typename Traits, typename T>
|
||||
Q_DECL_CONST_FUNCTION static inline T convertCase_helper(T uc) Q_DECL_NOTHROW
|
||||
{
|
||||
const QUnicodeTables::Properties *p = qGetProp(uc);
|
||||
if (p->lowerCaseSpecial) {
|
||||
const ushort *specialCase = specialCaseMap + p->lowerCaseDiff;
|
||||
return (*specialCase == 1) ? specialCase[1] : uc;
|
||||
}
|
||||
return uc + p->lowerCaseDiff;
|
||||
}
|
||||
const QUnicodeTables::Properties *prop = qGetProp(uc);
|
||||
|
||||
template <typename T>
|
||||
Q_DECL_CONST_FUNCTION static inline T toUpperCase_helper(T uc) Q_DECL_NOTHROW
|
||||
{
|
||||
const QUnicodeTables::Properties *p = qGetProp(uc);
|
||||
if (p->upperCaseSpecial) {
|
||||
const ushort *specialCase = specialCaseMap + p->upperCaseDiff;
|
||||
return (*specialCase == 1) ? specialCase[1] : uc;
|
||||
if (Q_UNLIKELY(Traits::caseSpecial(prop))) {
|
||||
const ushort *specialCase = specialCaseMap + Traits::caseDiff(prop);
|
||||
// so far, there are no special cases beyond BMP (guaranteed by the qunicodetables generator)
|
||||
return *specialCase == 1 ? specialCase[1] : uc;
|
||||
}
|
||||
return uc + p->upperCaseDiff;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
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;
|
||||
return uc + Traits::caseDiff(prop);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1484,7 +1461,7 @@ uint QChar::toLower(uint ucs4) Q_DECL_NOTHROW
|
||||
{
|
||||
if (ucs4 > LastValidCodePoint)
|
||||
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)
|
||||
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)
|
||||
return ucs4;
|
||||
return toTitleCase_helper<uint>(ucs4);
|
||||
return convertCase_helper<QUnicodeTables::TitlecaseTraits>(ucs4);
|
||||
}
|
||||
|
||||
static inline uint foldCase(const ushort *ch, const ushort *start)
|
||||
{
|
||||
uint c = *ch;
|
||||
if (QChar(c).isLowSurrogate() && ch > start && QChar(*(ch - 1)).isHighSurrogate())
|
||||
c = QChar::surrogateToUcs4(*(ch - 1), c);
|
||||
return toCaseFolded_helper<uint>(c);
|
||||
uint ucs4 = *ch;
|
||||
if (QChar::isLowSurrogate(ucs4) && ch > start && QChar::isHighSurrogate(*(ch - 1)))
|
||||
ucs4 = QChar::surrogateToUcs4(*(ch - 1), ucs4);
|
||||
return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);
|
||||
}
|
||||
|
||||
static inline uint foldCase(uint ch, uint &last) Q_DECL_NOTHROW
|
||||
{
|
||||
uint c = ch;
|
||||
if (QChar(c).isLowSurrogate() && QChar(last).isHighSurrogate())
|
||||
c = QChar::surrogateToUcs4(last, c);
|
||||
uint ucs4 = ch;
|
||||
if (QChar::isLowSurrogate(ucs4) && QChar::isHighSurrogate(last))
|
||||
ucs4 = QChar::surrogateToUcs4(last, ucs4);
|
||||
last = ch;
|
||||
return toCaseFolded_helper<uint>(c);
|
||||
return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);
|
||||
}
|
||||
|
||||
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)
|
||||
return ucs4;
|
||||
return toCaseFolded_helper<uint>(ucs4);
|
||||
return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -275,6 +275,14 @@ public:
|
||||
Script_Tirhuta,
|
||||
Script_WarangCiti,
|
||||
|
||||
// Unicode 8.0 additions
|
||||
Script_Ahom,
|
||||
Script_AnatolianHieroglyphs,
|
||||
Script_Hatran,
|
||||
Script_Multani,
|
||||
Script_OldHungarian,
|
||||
Script_SignWriting,
|
||||
|
||||
ScriptCount
|
||||
};
|
||||
|
||||
@ -365,7 +373,8 @@ public:
|
||||
Unicode_6_1,
|
||||
Unicode_6_2,
|
||||
Unicode_6_3,
|
||||
Unicode_7_0
|
||||
Unicode_7_0,
|
||||
Unicode_8_0
|
||||
};
|
||||
// ****** WHEN ADDING FUNCTIONS, CONSIDER ADDING TO QCharRef TOO
|
||||
|
||||
|
@ -1383,7 +1383,7 @@ bool QDate::isLeapYear(int y)
|
||||
|
||||
QTime uses the 24-hour clock format; it has no concept of AM/PM.
|
||||
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
|
||||
of hours, minutes, seconds, and milliseconds explicitly, or by
|
||||
@ -1728,7 +1728,7 @@ QTime QTime::addMSecs(int ms) const
|
||||
QTime t;
|
||||
if (isValid()) {
|
||||
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;
|
||||
t.mds = (ds() + ms + negdays * MSECS_PER_DAY) % MSECS_PER_DAY;
|
||||
} else {
|
||||
@ -2059,7 +2059,7 @@ void QTime::start()
|
||||
|
||||
\warning If the system's clock setting has been changed since the
|
||||
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.
|
||||
|
||||
\sa start(), elapsed(), currentTime()
|
||||
@ -2087,7 +2087,7 @@ int QTime::restart()
|
||||
|
||||
\warning If the system's clock setting has been changed since the
|
||||
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.
|
||||
|
||||
\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
|
||||
// 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,
|
||||
QDateTimePrivate::DaylightStatus *daylightStatus)
|
||||
{
|
||||
@ -2417,7 +2417,7 @@ static bool epochMSecsToLocalTime(qint64 msecs, QDate *localDate, QTime *localTi
|
||||
*daylightStatus = QDateTimePrivate::StandardTime;
|
||||
return true;
|
||||
} 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.
|
||||
// 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
|
||||
@ -2442,7 +2442,7 @@ static bool epochMSecsToLocalTime(qint64 msecs, QDate *localDate, QTime *localTi
|
||||
}
|
||||
|
||||
// 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.
|
||||
static qint64 localMSecsToEpochMSecs(qint64 localMsecs,
|
||||
QDateTimePrivate::DaylightStatus *daylightStatus,
|
||||
@ -2457,10 +2457,10 @@ static qint64 localMSecsToEpochMSecs(qint64 localMsecs,
|
||||
|
||||
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
|
||||
// fall after minimum and needs proper daylight conversion
|
||||
// fall after minimum and needs proper DST conversion
|
||||
if (localMsecs >= -qint64(MSECS_PER_DAY)) {
|
||||
bool 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) {
|
||||
|
||||
// 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.
|
||||
|
||||
// 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) {
|
||||
bool 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
|
||||
{
|
||||
if ((m_status & SetToDaylightTime) == SetToDaylightTime)
|
||||
@ -2746,7 +2746,7 @@ void QDateTimePrivate::refreshDateTime()
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
|
||||
// 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
|
||||
QDate testDate;
|
||||
QTime testTime;
|
||||
@ -2776,8 +2776,8 @@ qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone
|
||||
{
|
||||
// Get the effective data from QTimeZone
|
||||
QTimeZonePrivate::Data data = zone.d->dataForLocalTime(zoneMSecs);
|
||||
// Docs state any LocalTime before 1970-01-01 will *not* have any Daylight Time applied
|
||||
// but all times afterwards will have Daylight Time applied.
|
||||
// Docs state any LocalTime before 1970-01-01 will *not* have any DST applied
|
||||
// but all affected times afterwards will have DST applied.
|
||||
if (data.atMSecsSinceEpoch >= 0) {
|
||||
msecsToTime(data.atMSecsSinceEpoch + (data.offsetFromUtc * 1000), localDate, localTime);
|
||||
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
|
||||
UTC. You can also use timeSpec() to find out if a QDateTime
|
||||
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.
|
||||
|
||||
@ -2866,7 +2866,7 @@ qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone
|
||||
correctly or not up-to-date, QDateTime will give wrong results as
|
||||
well.
|
||||
|
||||
\section2 Daylight Savings Time (DST)
|
||||
\section2 Daylight-Saving Time (DST)
|
||||
|
||||
QDateTime takes into account the system's time zone information
|
||||
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
|
||||
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
|
||||
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
|
||||
@ -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
|
||||
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
|
||||
"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
|
||||
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
|
||||
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
|
||||
example a time zone of "Europe/Berlin" will apply the daylight savings
|
||||
adhering to a consistent set of daylight-saving transition rules. For
|
||||
example a time zone of "Europe/Berlin" will apply the daylight-saving
|
||||
rules as used in Germany since 1970. Note that the transition rules
|
||||
applied depend on the platform support. See the QTimeZone documentation
|
||||
for more details.
|
||||
@ -3051,7 +3051,7 @@ bool QDateTime::isNull() const
|
||||
the current Qt::TimeSpec, otherwise returns \c false.
|
||||
|
||||
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
|
||||
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::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
|
||||
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.
|
||||
|
||||
@ -3202,7 +3202,7 @@ QString QDateTime::timeZoneAbbreviation() const
|
||||
/*!
|
||||
\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
|
||||
return false.
|
||||
@ -3415,8 +3415,8 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs)
|
||||
break;
|
||||
case Qt::TimeZone:
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
// Docs state any LocalTime before 1970-01-01 will *not* have any Daylight Time applied
|
||||
// but all times afterwards will have Daylight Time applied.
|
||||
// Docs state any LocalTime before 1970-01-01 will *not* have any DST applied
|
||||
// but all affected times afterwards will have DST applied.
|
||||
if (msecs >= 0)
|
||||
d->m_offsetFromUtc = d->m_timeZone.d->offsetFromUtc(msecs);
|
||||
else
|
||||
@ -3658,7 +3658,7 @@ QString QDateTime::toString(const QString& format) const
|
||||
negative).
|
||||
|
||||
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
|
||||
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.
|
||||
@ -3693,7 +3693,7 @@ QDateTime QDateTime::addDays(qint64 ndays) const
|
||||
is negative).
|
||||
|
||||
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
|
||||
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.
|
||||
@ -3728,7 +3728,7 @@ QDateTime QDateTime::addMonths(int nmonths) const
|
||||
negative).
|
||||
|
||||
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
|
||||
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.
|
||||
@ -3788,7 +3788,7 @@ QDateTime QDateTime::addMSecs(qint64 msecs) const
|
||||
|
||||
QDateTime dt(*this);
|
||||
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);
|
||||
else
|
||||
// No need to convert, just add on
|
||||
@ -3823,8 +3823,8 @@ qint64 QDateTime::daysTo(const QDateTime &other) const
|
||||
the value returned is negative.
|
||||
|
||||
Before performing the comparison, the two datetimes are converted
|
||||
to Qt::UTC to ensure that the result is correct if one of the two
|
||||
datetimes has daylight saving time (DST) and the other doesn't.
|
||||
to Qt::UTC to ensure that the result is correct if daylight-saving
|
||||
(DST) applies to one of the two datetimes but not the other.
|
||||
|
||||
Returns 0 if either datetime is invalid.
|
||||
|
||||
@ -3845,8 +3845,8 @@ qint64 QDateTime::secsTo(const QDateTime &other) const
|
||||
the value returned is negative.
|
||||
|
||||
Before performing the comparison, the two datetimes are converted
|
||||
to Qt::UTC to ensure that the result is correct if one of the two
|
||||
datetimes has daylight saving time (DST) and the other doesn't.
|
||||
to Qt::UTC to ensure that the result is correct if daylight-saving
|
||||
(DST) applies to one of the two datetimes and but not the other.
|
||||
|
||||
Returns 0 if either datetime is invalid.
|
||||
|
||||
|
@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE
|
||||
platforms that support it (see QElapsedTimer::isMonotonic()). This has
|
||||
the added benefit that QElapsedTimer is immune to time adjustments, such
|
||||
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.
|
||||
|
||||
On the other hand, this means QElapsedTimer values can only be compared
|
||||
|
@ -636,7 +636,7 @@ int ffsll(quint64 i)
|
||||
#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
|
||||
#endif
|
||||
|
||||
|
@ -203,7 +203,7 @@ inline RetType UnrollTailLoop<0>::exec(int, RetType returnIfExited, Functor1, Fu
|
||||
#endif
|
||||
|
||||
// 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:
|
||||
* 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 {
|
||||
struct LowercaseTraits
|
||||
{
|
||||
static signed short caseDiff(const Properties *prop)
|
||||
{ return prop->lowerCaseDiff; }
|
||||
static bool caseSpecial(const Properties *prop)
|
||||
{ return prop->lowerCaseSpecial; }
|
||||
};
|
||||
/*!
|
||||
\internal
|
||||
Converts the \a str string starting from the position pointed to by the \a
|
||||
it iterator, using the Unicode case traits \c Traits, and returns the
|
||||
result. The input string must not be empty (the convertCase function below
|
||||
guarantees that).
|
||||
|
||||
struct UppercaseTraits
|
||||
{
|
||||
static signed short caseDiff(const Properties *prop)
|
||||
{ return prop->upperCaseDiff; }
|
||||
static bool caseSpecial(const Properties *prop)
|
||||
{ return prop->upperCaseSpecial; }
|
||||
};
|
||||
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
|
||||
conversion depending on the state of the \a str parameter:
|
||||
\list
|
||||
\li \c{T} is \c{const QString}: copy-convert
|
||||
\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
|
||||
{
|
||||
static signed short caseDiff(const Properties *prop)
|
||||
{ return prop->caseFoldDiff; }
|
||||
static bool caseSpecial(const Properties *prop)
|
||||
{ return prop->caseFoldSpecial; }
|
||||
};
|
||||
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
|
||||
this function requires to be a valid, empty string) and \c{s} contains the
|
||||
only copy of the string, without reallocation (thus, \a it is still valid).
|
||||
|
||||
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>
|
||||
Q_NEVER_INLINE
|
||||
static QString detachAndConvertCase(T &str, QStringIterator it)
|
||||
{
|
||||
Q_ASSERT(!str.isEmpty());
|
||||
QString s = qMove(str); // will copy if T is const QString
|
||||
QChar *pp = s.begin() + it.index(); // will detach if necessary
|
||||
uint uc = it.nextUnchecked();
|
||||
@ -5702,12 +5704,19 @@ static QString detachAndConvertCase(T &str, QStringIterator it)
|
||||
signed short caseDiff = Traits::caseDiff(prop);
|
||||
|
||||
if (Q_UNLIKELY(Traits::caseSpecial(prop))) {
|
||||
// slow path
|
||||
// slow path: the string is growing
|
||||
const ushort *specialCase = specialCaseMap + caseDiff;
|
||||
ushort length = *specialCase++;
|
||||
int pos = pp - s.constBegin();
|
||||
s.replace(pos, 1, reinterpret_cast<const QChar *>(specialCase), length);
|
||||
pp = const_cast<QChar *>(s.constBegin()) + pos + length;
|
||||
int inpos = it.index() - 1;
|
||||
int outpos = pp - s.constBegin();
|
||||
|
||||
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)) {
|
||||
*pp++ = QChar::highSurrogate(uc + caseDiff);
|
||||
*pp++ = QChar::lowSurrogate(uc + caseDiff);
|
||||
|
@ -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
|
||||
{
|
||||
return pos;
|
||||
|
@ -116,8 +116,9 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
|
||||
\class QTimeZone
|
||||
\inmodule QtCore
|
||||
\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
|
||||
|
||||
@ -198,14 +199,15 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
|
||||
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
|
||||
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
|
||||
time offset is the number of seconds to add to UTC to obtain standard time
|
||||
in the time zone. The daylight time offset is the number of seconds to add
|
||||
to the standard time offset to obtain daylight time in the time zone.
|
||||
parts, the standard time offset and the daylight-saving time offset. The
|
||||
standard time offset is the number of seconds to add to UTC to obtain
|
||||
standard time in the time zone. The daylight-saving time offset is the
|
||||
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
|
||||
time as countries have changed daylight time laws or even their standard
|
||||
time offset.
|
||||
Note that the standard and DST offsets for a time zone may change over time
|
||||
as countries have changed DST laws or even their standard time offset.
|
||||
|
||||
\section2 License
|
||||
|
||||
@ -240,21 +242,20 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
|
||||
\enum QTimeZone::TimeType
|
||||
|
||||
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
|
||||
same result.
|
||||
zones that do not apply DST, all three values may return the same result.
|
||||
|
||||
\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.
|
||||
For example when formatting a display name this will show something
|
||||
like "Pacific Standard Time".
|
||||
\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
|
||||
like "Pacific daylight time".
|
||||
like "Pacific daylight-saving time".
|
||||
\value GenericTime
|
||||
A time which is not specifically Standard or Daylight time, either
|
||||
an unknown time or a neutral form.
|
||||
A time which is not specifically Standard or Daylight-Saving time,
|
||||
either an unknown time or a neutral form.
|
||||
For example when formatting a display name this will show something
|
||||
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::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::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.
|
||||
\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
|
||||
\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
|
||||
be used.
|
||||
|
||||
The display name may change depending on daylight time or historical
|
||||
events.
|
||||
The display name may change depending on DST or historical events.
|
||||
|
||||
\sa abbreviation()
|
||||
*/
|
||||
@ -571,8 +571,7 @@ QString QTimeZone::displayName(TimeType timeType, NameType nameType,
|
||||
|
||||
/*!
|
||||
Returns the time zone abbreviation at the given \a atDateTime. The
|
||||
abbreviation may change depending on daylight time or even
|
||||
historical events.
|
||||
abbreviation may change depending on DST or even historical events.
|
||||
|
||||
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.
|
||||
@ -591,13 +590,13 @@ QString QTimeZone::abbreviation(const QDateTime &atDateTime) const
|
||||
/*!
|
||||
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
|
||||
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.
|
||||
|
||||
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
|
||||
time offsetFromUtc() will return +3600 (UTC+01:00), and during daylight time
|
||||
it will return +7200 (UTC+02:00).
|
||||
+3600 seconds and the DST offset is +3600 seconds. During standard time
|
||||
offsetFromUtc() will return +3600 (UTC+01:00), and during DST it will
|
||||
return +7200 (UTC+02:00).
|
||||
|
||||
\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
|
||||
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
|
||||
+3600 seconds. During both standard and daylight time offsetFromUtc() will
|
||||
return +3600 (UTC+01:00).
|
||||
+3600 seconds. During both standard and DST offsetFromUtc() will return
|
||||
+3600 (UTC+01:00).
|
||||
|
||||
\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
|
||||
number of seconds to add to the standard time offset to obtain the local
|
||||
daylight time.
|
||||
Returns the daylight-saving time offset at the given \a atDateTime,
|
||||
i.e. the number of seconds to add to the standard time offset to obtain the
|
||||
local daylight-saving time.
|
||||
|
||||
For example, for the time zone "Europe/Berlin" the daylight time offset
|
||||
is +3600 seconds. During standard time daylightTimeOffset() will return
|
||||
0, and during daylight time it will return +3600.
|
||||
For example, for the time zone "Europe/Berlin" the DST offset is +3600
|
||||
seconds. During standard time daylightTimeOffset() will return 0, and when
|
||||
daylight-saving is in effect it will return +3600.
|
||||
|
||||
\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()
|
||||
*/
|
||||
@ -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()
|
||||
*/
|
||||
|
@ -246,8 +246,8 @@ QTimeZonePrivate::Data QTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const
|
||||
QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs) const
|
||||
{
|
||||
if (!hasDaylightTime() ||!hasTransitions()) {
|
||||
// No daylight time means same offset for all local msecs
|
||||
// Having daylight time but no transitions means we can't calculate, so use nearest
|
||||
// No DST means same offset for all local msecs
|
||||
// Having DST but no transitions means we can't calculate, so use nearest
|
||||
return data(forLocalMSecs - (standardTimeOffset(forLocalMSecs) * 1000));
|
||||
}
|
||||
|
||||
@ -276,16 +276,16 @@ QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs)
|
||||
}
|
||||
|
||||
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
|
||||
qint64 diffPrevTran = forLocalMSecs
|
||||
- (tran.atMSecsSinceEpoch + (tran.offsetFromUtc * 1000));
|
||||
qint64 diffNextTran = nextTran.atMSecsSinceEpoch + (nextTran.offsetFromUtc * 1000)
|
||||
- forLocalMSecs;
|
||||
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.
|
||||
// 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
|
||||
// TODO Check if faster to just always get prev tran, or if faster using 6 hour check.
|
||||
Data dstTran = previousTransition(tran.atMSecsSinceEpoch);
|
||||
|
@ -150,7 +150,7 @@ int QAndroidTimeZonePrivate::daylightTimeOffset(qint64 atMSecsSinceEpoch) const
|
||||
bool QAndroidTimeZonePrivate::hasDaylightTime() const
|
||||
{
|
||||
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" );
|
||||
else
|
||||
return false;
|
||||
@ -210,34 +210,34 @@ QTimeZonePrivate::Data QAndroidTimeZonePrivate::dataForLocalTime(qint64 forLocal
|
||||
} else {
|
||||
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 daylightUTCMsecs;
|
||||
|
||||
// Check if daylight time does apply,
|
||||
// checking also for daylight time boundaries
|
||||
// Check if daylight-saving time applies,
|
||||
// checking also for DST boundaries
|
||||
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
|
||||
daylightUTCMsecs = standardUTCMSecs - daylightTimeOffset(standardUTCMSecs)*1000;
|
||||
if (isDaylightTime(daylightUTCMsecs)) {
|
||||
// daylight time confirmed
|
||||
// DST confirmed
|
||||
UTCepochMSecs = daylightUTCMsecs;
|
||||
} else {
|
||||
// daylight time has just finished
|
||||
// DST has just finished
|
||||
UTCepochMSecs = standardUTCMSecs;
|
||||
}
|
||||
} else {
|
||||
// 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
|
||||
if (isDaylightTime(daylightUTCMsecs)) {
|
||||
// daylight time may have just started,
|
||||
// but double check against timezone's own daylight offset
|
||||
// DST may have just started,
|
||||
// but double check against timezone's own DST offset
|
||||
// (don't necessarily assume a one-hour offset)
|
||||
daylightUTCMsecs = standardUTCMSecs - daylightTimeOffset(daylightUTCMsecs)*1000;
|
||||
if (isDaylightTime(daylightUTCMsecs)) {
|
||||
// daylight time confirmed
|
||||
// DST confirmed
|
||||
UTCepochMSecs = daylightUTCMsecs;
|
||||
} else {
|
||||
// false positive, apply standard time after all
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
@ -51,7 +51,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#define UNICODE_DATA_VERSION QChar::Unicode_7_0
|
||||
#define UNICODE_DATA_VERSION QChar::Unicode_8_0
|
||||
|
||||
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(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 {
|
||||
GraphemeBreak_Other,
|
||||
GraphemeBreak_CR,
|
||||
|
@ -49,7 +49,7 @@ namespace QUnicodeTools {
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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 {
|
||||
Initial,
|
||||
Lower,
|
||||
Upper,
|
||||
UpATerm,
|
||||
LUATerm,
|
||||
ATerm,
|
||||
ATermC,
|
||||
ACS,
|
||||
@ -260,10 +261,11 @@ enum State {
|
||||
|
||||
static const uchar breakTable[BAfter + 1][QUnicodeTables::SentenceBreak_Close + 1] = {
|
||||
// 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 , Upper , Initial, Initial, Upper , Initial, Initial, UpATerm, STerm , STerm , Initial }, // Upper
|
||||
{ Initial, BAfterC, BAfter , BAfter , Initial, Initial, Lower , Upper , Initial, Initial, ATerm , Initial, STerm , Initial }, // Initial
|
||||
{ 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 , 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
|
||||
@ -341,7 +343,7 @@ static void getSentenceBreaks(const ushort *string, quint32 len, QCharAttributes
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// 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
|
||||
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):
|
||||
CL->PO from IB to DB
|
||||
CP->PO from IB to DB
|
||||
CL->PR from IB to DB
|
||||
CP->PR from IB to DB
|
||||
PO->OP from IB to DB
|
||||
PR->OP from IB to DB
|
||||
IS->NU from IB to DB
|
||||
SY->NU from IB to DB
|
||||
(CL)(PO) from IB to DB
|
||||
(CP)(PO) from IB to DB
|
||||
(CL)(PR) from IB to DB
|
||||
(CP)(PR) from IB to DB
|
||||
(PO)(OP) from IB to DB
|
||||
(PR)(OP) from IB to DB
|
||||
(IS)(NU) from IB to DB
|
||||
(SY)(NU) from IB to 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
|
||||
/* In order to implementat LB21a properly a special rule HH has been introduced and
|
||||
the following changes were made in the pair table to disallow breaks after Hebrew + Hyphen:
|
||||
(HL)(HY|BA) from IB to CI
|
||||
(HY|BA)(!CB) from DB to HH
|
||||
*/
|
||||
|
||||
enum Action {
|
||||
ProhibitedBreak, PB = ProhibitedBreak,
|
||||
DirectBreak, DB = DirectBreak,
|
||||
IndirectBreak, IB = IndirectBreak,
|
||||
CombiningIndirectBreak, CI = CombiningIndirectBreak,
|
||||
CombiningProhibitedBreak, CP = CombiningProhibitedBreak
|
||||
CombiningProhibitedBreak, CP = CombiningProhibitedBreak,
|
||||
ProhibitedBreakAfterHebrewPlusHyphen, HH = ProhibitedBreakAfterHebrewPlusHyphen
|
||||
};
|
||||
|
||||
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 },
|
||||
/* 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 },
|
||||
/* 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 },
|
||||
/* 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 },
|
||||
/* 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, 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 },
|
||||
/* 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 },
|
||||
/* 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 },
|
||||
/* 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 },
|
||||
/* 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 },
|
||||
/* 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 */ { 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 },
|
||||
/* 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 },
|
||||
@ -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 }
|
||||
};
|
||||
|
||||
// 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
|
||||
|
||||
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)
|
||||
goto next_no_cls_update;
|
||||
break;
|
||||
case LB::ProhibitedBreakAfterHebrewPlusHyphen:
|
||||
if (lcls != QUnicodeTables::LineBreak_HL)
|
||||
attributes[pos].lineBreak = true;
|
||||
break;
|
||||
case LB::ProhibitedBreak:
|
||||
// nothing to do
|
||||
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
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
@ -156,10 +156,6 @@ else:SOURCES += tools/qelapsedtimer_generic.cpp
|
||||
|
||||
contains(QT_CONFIG, zlib) {
|
||||
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 {
|
||||
include($$PWD/../../3rdparty/zlib_dependency.pri)
|
||||
}
|
||||
|
@ -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
|
||||
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)
|
||||
return baseFileName;
|
||||
@ -1417,8 +1421,11 @@ QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRati
|
||||
for (int n = qCeil(targetDevicePixelRatio); n > 1; --n) {
|
||||
QString atNxfileName = baseFileName;
|
||||
atNxfileName.insert(dotIndex, atNx.arg(n));
|
||||
if (QFile::exists(atNxfileName))
|
||||
if (QFile::exists(atNxfileName)) {
|
||||
if (sourceDevicePixelRatio)
|
||||
*sourceDevicePixelRatio = n;
|
||||
return atNxfileName;
|
||||
}
|
||||
}
|
||||
|
||||
return baseFileName;
|
||||
|
@ -140,7 +140,8 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QIcon &);
|
||||
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QIcon &);
|
||||
#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
|
||||
|
||||
|
@ -4388,6 +4388,8 @@ QImage QImage::smoothScaled(int w, int h) const {
|
||||
|
||||
static QImage rotated90(const QImage &image) {
|
||||
QImage out(image.height(), image.width(), image.format());
|
||||
out.setDotsPerMeterX(image.dotsPerMeterY());
|
||||
out.setDotsPerMeterY(image.dotsPerMeterX());
|
||||
if (image.colorCount() > 0)
|
||||
out.setColorTable(image.colorTable());
|
||||
int w = image.width();
|
||||
@ -4456,6 +4458,8 @@ static QImage rotated180(const QImage &image) {
|
||||
|
||||
static QImage rotated270(const QImage &image) {
|
||||
QImage out(image.height(), image.width(), image.format());
|
||||
out.setDotsPerMeterX(image.dotsPerMeterY());
|
||||
out.setDotsPerMeterY(image.dotsPerMeterX());
|
||||
if (image.colorCount() > 0)
|
||||
out.setColorTable(image.colorTable());
|
||||
int w = image.width();
|
||||
|
@ -1,9 +1,4 @@
|
||||
HEADERS += $$PWD/qpnghandler_p.h
|
||||
SOURCES += $$PWD/qpnghandler.cpp
|
||||
contains(QT_CONFIG, system-png) {
|
||||
if(unix|mingw): LIBS_PRIVATE += -lpng
|
||||
else:win32: LIBS += libpng.lib
|
||||
|
||||
} else {
|
||||
include($$PWD/../../3rdparty/libpng.pri)
|
||||
}
|
||||
include($$PWD/../../3rdparty/png_dependency.pri)
|
||||
|
@ -128,6 +128,8 @@ Qt::MouseButtons QGuiApplicationPrivate::tabletState = Qt::NoButton;
|
||||
QWindow *QGuiApplicationPrivate::tabletPressTarget = 0;
|
||||
QWindow *QGuiApplicationPrivate::currentMouseWindow = 0;
|
||||
|
||||
QString QGuiApplicationPrivate::styleOverride;
|
||||
|
||||
Qt::ApplicationState QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive;
|
||||
|
||||
bool QGuiApplicationPrivate::highDpiScalingUpdated = false;
|
||||
@ -1288,6 +1290,7 @@ void QGuiApplicationPrivate::init()
|
||||
session_key = QString::fromWCharArray(guidstr);
|
||||
# endif
|
||||
#endif
|
||||
QString s;
|
||||
int j = argc ? 1 : 0;
|
||||
for (int i=1; i<argc; i++) {
|
||||
if (argv[i] && *argv[i] != '-') {
|
||||
@ -1330,9 +1333,16 @@ void QGuiApplicationPrivate::init()
|
||||
#endif
|
||||
} else if (arg == "-testability") {
|
||||
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 {
|
||||
argv[j++] = argv[i];
|
||||
}
|
||||
|
||||
if (!s.isEmpty())
|
||||
styleOverride = s;
|
||||
}
|
||||
|
||||
if (j < argc) {
|
||||
|
@ -221,6 +221,7 @@ public:
|
||||
|
||||
static QFont *app_font;
|
||||
|
||||
static QString styleOverride;
|
||||
static QStyleHints *styleHints;
|
||||
static bool obey_desktop_settings;
|
||||
QInputMethod *inputMethod;
|
||||
|
@ -484,7 +484,9 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co
|
||||
{
|
||||
QPlatformScreen *currentScreen = screen();
|
||||
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)) {
|
||||
Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) {
|
||||
if (screen->geometry().contains(center))
|
||||
|
@ -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()
|
||||
{
|
||||
return QPixelLayout{
|
||||
redWidth<Format>(), redShift<Format>(),
|
||||
greenWidth<Format>(), greenShift<Format>(),
|
||||
blueWidth<Format>(), blueShift<Format>(),
|
||||
uchar(redWidth<Format>()), uchar(redShift<Format>()),
|
||||
uchar(greenWidth<Format>()), uchar(greenShift<Format>()),
|
||||
uchar(blueWidth<Format>()), uchar(blueShift<Format>()),
|
||||
0, 0,
|
||||
false, bitsPerPixel<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()
|
||||
{
|
||||
return QPixelLayout{
|
||||
redWidth<Format>(), redShift<Format>(),
|
||||
greenWidth<Format>(), greenShift<Format>(),
|
||||
blueWidth<Format>(), blueShift<Format>(),
|
||||
alphaWidth<Format>(), alphaShift<Format>(),
|
||||
uchar(redWidth<Format>()), uchar(redShift<Format>()),
|
||||
uchar(greenWidth<Format>()), uchar(greenShift<Format>()),
|
||||
uchar(blueWidth<Format>()), uchar(blueShift<Format>()),
|
||||
uchar(alphaWidth<Format>()), uchar(alphaShift<Format>()),
|
||||
true, bitsPerPixel<Format>(),
|
||||
convertARGBPMToARGB32PM<Format>,
|
||||
convertARGBPMFromARGB32PM<Format>,
|
||||
|
@ -161,12 +161,12 @@ public:
|
||||
}
|
||||
|
||||
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 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; }
|
||||
Q_DECL_RELAXED_CONSTEXPR QRgba64 unpremultiplied_32bit() const
|
||||
static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint div_257_floor(uint x) { return (x - (x >> 8)) >> 8; }
|
||||
static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint div_257(uint x) { return div_257_floor(x + 128); }
|
||||
static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; }
|
||||
Q_DECL_RELAXED_CONSTEXPR Q_ALWAYS_INLINE QRgba64 unpremultiplied_32bit() const
|
||||
{
|
||||
if (isOpaque() || isTransparent())
|
||||
return *this;
|
||||
@ -176,7 +176,7 @@ private:
|
||||
const quint16 b = (quint32(blue()) * 0xffff + a/2) / 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())
|
||||
return *this;
|
||||
|
@ -370,17 +370,15 @@ bool QFontEngine::supportsScript(QChar::Script script) const
|
||||
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
|
||||
uint len;
|
||||
if (getSfntTableData(MAKE_TAG('m','o','r','t'), 0, &len) || getSfntTableData(MAKE_TAG('m','o','r','x'), 0, &len))
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
if (qt_useHarfbuzzNG()) {
|
||||
bool ret = false;
|
||||
if (hb_face_t *face = hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this))) {
|
||||
hb_tag_t script_tag_1, script_tag_2;
|
||||
@ -1837,7 +1835,10 @@ QFontEngine *QFontEngineMulti::loadEngine(int at)
|
||||
request.family = fallbackFamilyAt(at - 1);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -534,69 +534,87 @@ QFontEngineFT::Glyph::~Glyph()
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
static const uint subpixel_filter[3][3] = {
|
||||
{ 180, 60, 16 },
|
||||
{ 38, 180, 38 },
|
||||
{ 16, 60, 180 }
|
||||
struct LcdFilterDummy
|
||||
{
|
||||
static inline void filterPixel(uchar &, uchar &, uchar &)
|
||||
{}
|
||||
};
|
||||
|
||||
static inline uint filterPixel(uint red, uint green, uint blue, bool legacyFilter)
|
||||
struct LcdFilterLegacy
|
||||
{
|
||||
uint res;
|
||||
if (legacyFilter) {
|
||||
uint high = (red*subpixel_filter[0][0] + green*subpixel_filter[0][1] + blue*subpixel_filter[0][2]) >> 8;
|
||||
uint mid = (red*subpixel_filter[1][0] + green*subpixel_filter[1][1] + blue*subpixel_filter[1][2]) >> 8;
|
||||
uint low = (red*subpixel_filter[2][0] + green*subpixel_filter[2][1] + blue*subpixel_filter[2][2]) >> 8;
|
||||
res = (mid << 24) + (high << 16) + (mid << 8) + low;
|
||||
} else {
|
||||
uint alpha = green;
|
||||
res = (alpha << 24) + (red << 16) + (green << 8) + blue;
|
||||
static inline void filterPixel(uchar &red, uchar &green, uchar &blue)
|
||||
{
|
||||
uint r = red, g = green, b = blue;
|
||||
// intra-pixel filter used by the legacy filter (adopted from _ft_lcd_filter_legacy)
|
||||
red = (r * uint(65538 * 9/13) + g * uint(65538 * 1/6) + b * uint(65538 * 1/13)) / 65536;
|
||||
green = (r * uint(65538 * 3/13) + g * uint(65538 * 4/6) + b * uint(65538 * 3/13)) / 65536;
|
||||
blue = (r * uint(65538 * 1/13) + g * uint(65538 * 1/6) + b * uint(65538 * 9/13)) / 65536;
|
||||
}
|
||||
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 w = width * 3;
|
||||
while (h--) {
|
||||
while (height--) {
|
||||
uint *dd = dst;
|
||||
for (int x = 0; x < w; x += 3) {
|
||||
uint red = src[x+1-offs];
|
||||
uint green = src[x+1];
|
||||
uint blue = src[x+1+offs];
|
||||
*dd = filterPixel(red, green, blue, legacyFilter);
|
||||
++dd;
|
||||
uchar red = src[x + 1 - offs];
|
||||
uchar green = src[x + 1];
|
||||
uchar blue = src[x + 1 + offs];
|
||||
LcdFilter::filterPixel(red, green, blue);
|
||||
// alpha = green
|
||||
*dd++ = (green << 24) | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
dst += width;
|
||||
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;
|
||||
while (h--) {
|
||||
while (height--) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
uint red = src[x+src_pitch-offs];
|
||||
uint green = src[x+src_pitch];
|
||||
uint blue = src[x+src_pitch+offs];
|
||||
dst[x] = filterPixel(red, green, blue, legacyFilter);
|
||||
uchar red = src[x + src_pitch - offs];
|
||||
uchar green = src[x + src_pitch];
|
||||
uchar blue = src[x + src_pitch + offs];
|
||||
LcdFilter::filterPixel(red, green, blue);
|
||||
// alpha = green
|
||||
*dst++ = (green << 24) | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
dst += width;
|
||||
src += 3*src_pitch;
|
||||
}
|
||||
}
|
||||
|
||||
static void convertGRAYToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch) {
|
||||
for (int y = 0; y < height; ++y) {
|
||||
int readpos = (y * src_pitch);
|
||||
int writepos = (y * width);
|
||||
for (int x = 0; x < width; ++x) {
|
||||
dst[writepos + x] = (0xFF << 24) + (src[readpos + x] << 16) + (src[readpos + x] << 8) + src[readpos + x];
|
||||
static inline void convertRGBToARGB_V(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr, bool legacyFilter)
|
||||
{
|
||||
if (!legacyFilter)
|
||||
convertRGBToARGB_V_helper<LcdFilterDummy>(src, dst, width, height, src_pitch, bgr);
|
||||
else
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,15 @@ static const hb_script_t _qtscript_to_hbscript[] = {
|
||||
HB_SCRIPT_SIDDHAM,
|
||||
HB_SCRIPT_KHUDAWADI,
|
||||
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]));
|
||||
|
||||
|
@ -1120,15 +1120,6 @@ QT_BEGIN_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
|
||||
{
|
||||
uint glyphs_shaped = 0;
|
||||
@ -1182,13 +1173,21 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
|
||||
const int num_features = 1;
|
||||
|
||||
const char *const *shaper_list = Q_NULLPTR;
|
||||
#if defined(Q_OS_OSX) && !defined(QT_NO_FREETYPE)
|
||||
// What's behind QFontEngine::FaceData::user_data isn't compatible between CoreText and
|
||||
// FreeType font engines - specifically functions in hb-coretext.cc would run into undefined
|
||||
// behavior with data from the FreeType engine. The OpenType shaper works with that engine.
|
||||
if (actualFontEngine->type() == QFontEngine::Freetype)
|
||||
shaper_list = s_shapersForOsxFreeType;
|
||||
#if defined(Q_OS_DARWIN)
|
||||
// What's behind QFontEngine::FaceData::user_data isn't compatible between different font engines
|
||||
// - specifically functions in hb-coretext.cc would run into undefined behavior with data
|
||||
// from non-CoreText engine. The other shapers works with that engine just fine.
|
||||
if (actualFontEngine->type() != QFontEngine::Mac) {
|
||||
static const char *s_shaper_list_without_coretext[] = {
|
||||
"graphite2",
|
||||
"ot",
|
||||
"fallback",
|
||||
Q_NULLPTR
|
||||
};
|
||||
shaper_list = s_shaper_list_without_coretext;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool shapedOk = hb_shape_full(hb_font, buffer, features, num_features, shaper_list);
|
||||
if (Q_UNLIKELY(!shapedOk)) {
|
||||
hb_buffer_destroy(buffer);
|
||||
@ -1268,19 +1267,20 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
|
||||
g.glyphs[i] |= (engineIdx << 24);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
// CTRunGetPosition has a bug which applies matrix on 10.6, so we disable
|
||||
// scaling the advances for this particular version
|
||||
if (actualFontEngine->fontDef.stretch != 100
|
||||
&& QSysInfo::MacintoshVersion != QSysInfo::MV_10_6) {
|
||||
QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100);
|
||||
for (uint i = 0; i < num_glyphs; ++i)
|
||||
g.advances[i] *= stretch;
|
||||
}
|
||||
#ifdef Q_OS_DARWIN
|
||||
if (actualFontEngine->type() == QFontEngine::Mac) {
|
||||
// CTRunGetPosition has a bug which applies matrix on 10.6, so we disable
|
||||
// scaling the advances for this particular version
|
||||
if (QSysInfo::MacintoshVersion != QSysInfo::MV_10_6 && actualFontEngine->fontDef.stretch != 100) {
|
||||
QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100);
|
||||
for (uint i = 0; i < num_glyphs; ++i)
|
||||
g.advances[i] *= stretch;
|
||||
}
|
||||
|
||||
if (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
|
||||
for (uint i = 0; i < num_glyphs; ++i)
|
||||
g.advances[i] = g.advances[i].round();
|
||||
if (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
|
||||
for (uint i = 0; i < num_glyphs; ++i)
|
||||
g.advances[i] = g.advances[i].round();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -45,8 +45,10 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
extern QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio);
|
||||
static QString resolveFileName(QString fileName, QUrl *url, qreal targetDevicePixelRatio)
|
||||
extern QString qt_findAtNxFile(const QString &baseFileName, 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
|
||||
// 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;
|
||||
|
||||
// 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
|
||||
name.prepend(QLatin1String("qrc"));
|
||||
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);
|
||||
if (data.type() == QVariant::Pixmap || data.type() == QVariant::Image) {
|
||||
pm = qvariant_cast<QPixmap>(data);
|
||||
@ -103,7 +106,7 @@ static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format, con
|
||||
}
|
||||
|
||||
if (name.contains(QStringLiteral("@2x")))
|
||||
pm.setDevicePixelRatio(2.0);
|
||||
pm.setDevicePixelRatio(sourcePixelRatio);
|
||||
|
||||
return pm;
|
||||
}
|
||||
@ -158,7 +161,8 @@ static QImage getImage(QTextDocument *doc, const QTextImageFormat &format, const
|
||||
if (name.startsWith(QLatin1String(":/"))) // auto-detect resources
|
||||
name.prepend(QLatin1String("qrc"));
|
||||
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);
|
||||
if (data.type() == QVariant::Image) {
|
||||
image = qvariant_cast<QImage>(data);
|
||||
@ -182,8 +186,8 @@ static QImage getImage(QTextDocument *doc, const QTextImageFormat &format, const
|
||||
doc->addResource(QTextDocument::ImageResource, url, image);
|
||||
}
|
||||
|
||||
if (name.contains(QStringLiteral("@2x")))
|
||||
image.setDevicePixelRatio(2.0);
|
||||
if (sourcePixelRatio != 1.0)
|
||||
image.setDevicePixelRatio(sourcePixelRatio);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
@ -976,7 +976,6 @@ QNetworkAccessManager::NetworkAccessibility QNetworkAccessManager::networkAccess
|
||||
else
|
||||
return NotAccessible;
|
||||
} else {
|
||||
// Network accessibility is either disabled or unknown.
|
||||
if (d->defaultAccessControl) {
|
||||
if (d->online)
|
||||
return d->networkAccessible;
|
||||
@ -1161,7 +1160,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
// Return a disabled network reply if network access is disabled.
|
||||
// Except if the scheme is empty or file://.
|
||||
if (!d->networkAccessible && !isLocalFile) {
|
||||
if (d->networkAccessible == NotAccessible && !isLocalFile) {
|
||||
return new QDisabledNetworkReply(this, req, op);
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,8 @@ public:
|
||||
online = (networkConfiguration.state().testFlag(QNetworkConfiguration::Active));
|
||||
if (online)
|
||||
networkAccessible = QNetworkAccessManager::Accessible;
|
||||
else if (networkConfiguration.state().testFlag(QNetworkConfiguration::Undefined))
|
||||
networkAccessible = QNetworkAccessManager::UnknownAccessibility;
|
||||
else
|
||||
networkAccessible = QNetworkAccessManager::NotAccessible;
|
||||
#endif
|
||||
|
@ -36,6 +36,8 @@
|
||||
|
||||
#ifndef QT_NO_NETWORKINTERFACE
|
||||
|
||||
#include <qfunctions_winrt.h>
|
||||
|
||||
#include <wrl.h>
|
||||
#include <windows.foundation.h>
|
||||
#include <windows.foundation.collections.h>
|
||||
@ -72,6 +74,53 @@ QString QNetworkInterfaceManager::interfaceNameFromIndex(uint 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()
|
||||
{
|
||||
@ -80,36 +129,46 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
|
||||
QList<HostNameInfo> hostList;
|
||||
|
||||
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;
|
||||
hostNameStatics->GetHostNames(&hostNames);
|
||||
hr = hostNameStatics->GetHostNames(&hostNames);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
if (!hostNames)
|
||||
return interfaces;
|
||||
|
||||
unsigned int hostNameCount;
|
||||
hostNames->get_Size(&hostNameCount);
|
||||
hr = hostNames->get_Size(&hostNameCount);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
for (unsigned i = 0; i < hostNameCount; ++i) {
|
||||
HostNameInfo hostInfo;
|
||||
ComPtr<IHostName> hostName;
|
||||
hostNames->GetAt(i, &hostName);
|
||||
hr = hostNames->GetAt(i, &hostName);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
|
||||
HostNameType type;
|
||||
hostName->get_Type(&type);
|
||||
hr = hostName->get_Type(&type);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
if (type == HostNameType_DomainName)
|
||||
continue;
|
||||
|
||||
ComPtr<IIPInformation> ipInformation;
|
||||
hostName->get_IPInformation(&ipInformation);
|
||||
hr = hostName->get_IPInformation(&ipInformation);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
ComPtr<INetworkAdapter> currentAdapter;
|
||||
ipInformation->get_NetworkAdapter(¤tAdapter);
|
||||
hr = ipInformation->get_NetworkAdapter(¤tAdapter);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
|
||||
currentAdapter->get_NetworkAdapterId(&hostInfo.adapterId);
|
||||
hr = currentAdapter->get_NetworkAdapterId(&hostInfo.adapterId);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
|
||||
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
|
||||
if ((type == HostNameType_Ipv4 && hostInfo.prefixLength > 32)
|
||||
@ -117,7 +176,8 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
|
||||
continue;
|
||||
|
||||
HString name;
|
||||
hostName->get_CanonicalName(name.GetAddressOf());
|
||||
hr = hostName->get_CanonicalName(name.GetAddressOf());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
UINT32 length;
|
||||
PCWSTR rawString = name.GetRawBuffer(&length);
|
||||
hostInfo.address = QString::fromWCharArray(rawString, length);
|
||||
@ -126,54 +186,35 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
|
||||
}
|
||||
|
||||
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;
|
||||
networkInfoStatics->GetConnectionProfiles(&connectionProfiles);
|
||||
hr = networkInfoStatics->GetConnectionProfiles(&connectionProfiles);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
if (!connectionProfiles)
|
||||
return interfaces;
|
||||
|
||||
unsigned int size;
|
||||
connectionProfiles->get_Size(&size);
|
||||
hr = connectionProfiles->get_Size(&size);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
for (unsigned int i = 0; i < size; ++i) {
|
||||
QNetworkInterfacePrivate *iface = new QNetworkInterfacePrivate;
|
||||
interfaces << iface;
|
||||
|
||||
ComPtr<IConnectionProfile> profile;
|
||||
connectionProfiles->GetAt(i, &profile);
|
||||
hr = connectionProfiles->GetAt(i, &profile);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
|
||||
NetworkConnectivityLevel connectivityLevel;
|
||||
profile->GetNetworkConnectivityLevel(&connectivityLevel);
|
||||
if (connectivityLevel != NetworkConnectivityLevel_None)
|
||||
iface->flags = QNetworkInterface::IsUp | QNetworkInterface::IsRunning;
|
||||
|
||||
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;
|
||||
iface = interfaceFromProfile(profile.Get(), &hostList);
|
||||
if (iface) {
|
||||
iface->index = i + 1;
|
||||
interfaces << iface;
|
||||
}
|
||||
}
|
||||
return interfaces;
|
||||
|
@ -899,8 +899,10 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativeReceiveDatagram(%p \"%s\", %lli, %s, %i) == %lli",
|
||||
data, qt_prettyDebug(data, qMin(recvResult, ssize_t(16)), recvResult).data(), maxSize,
|
||||
address ? address->toString().toLatin1().constData() : "(nil)",
|
||||
port ? *port : 0, (qint64) recvResult);
|
||||
(recvResult != -1 && options != QAbstractSocketEngine::WantNone)
|
||||
? header->senderAddress.toString().toLatin1().constData() : "(unknown)",
|
||||
(recvResult != -1 && options != QAbstractSocketEngine::WantNone)
|
||||
? header->senderPort : 0, (qint64) recvResult);
|
||||
#endif
|
||||
|
||||
return qint64(maxSize ? recvResult : recvResult == -1 ? -1 : 0);
|
||||
@ -996,8 +998,9 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEngine::sendDatagram(%p \"%s\", %lli, \"%s\", %i) == %lli", data,
|
||||
qt_prettyDebug(data, qMin<int>(len, 16), len).data(), len, host.toString().toLatin1().constData(),
|
||||
port, (qint64) sentBytes);
|
||||
qt_prettyDebug(data, qMin<int>(len, 16), len).data(), len,
|
||||
header.destinationAddress.toString().toLatin1().constData(),
|
||||
header.destinationPort, (qint64) sentBytes);
|
||||
#endif
|
||||
|
||||
return qint64(sentBytes);
|
||||
|
@ -47,11 +47,13 @@
|
||||
|
||||
#include <private/qthread_p.h>
|
||||
#include <private/qabstractsocket_p.h>
|
||||
#include <private/qeventdispatcher_winrt_p.h>
|
||||
|
||||
#ifndef QT_NO_SSL
|
||||
#include <QSslSocket>
|
||||
#endif
|
||||
|
||||
#include <functional>
|
||||
#include <wrl.h>
|
||||
#include <windows.foundation.collections.h>
|
||||
#include <windows.storage.streams.h>
|
||||
@ -150,16 +152,10 @@ static AsyncStatus opStatus(const ComPtr<T> &op)
|
||||
{
|
||||
ComPtr<IAsyncInfo> info;
|
||||
HRESULT hr = op.As(&info);
|
||||
if (FAILED(hr)) {
|
||||
qErrnoWarning(hr, "Failed to cast op to IAsyncInfo.");
|
||||
return Error;
|
||||
}
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
AsyncStatus status;
|
||||
hr = info->get_Status(&status);
|
||||
if (FAILED(hr)) {
|
||||
qErrnoWarning(hr, "Failed to get AsyncStatus.");
|
||||
return Error;
|
||||
}
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -265,25 +261,26 @@ bool QNativeSocketEngine::connectToHostByName(const QString &name, quint16 port)
|
||||
Q_D(QNativeSocketEngine);
|
||||
HStringReference hostNameRef(reinterpret_cast<LPCWSTR>(name.utf16()));
|
||||
ComPtr<IHostNameFactory> hostNameFactory;
|
||||
GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(),
|
||||
&hostNameFactory);
|
||||
HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(),
|
||||
&hostNameFactory);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
ComPtr<IHostName> remoteHost;
|
||||
if (FAILED(hostNameFactory->CreateHostName(hostNameRef.Get(), &remoteHost))) {
|
||||
qWarning("QNativeSocketEnginePrivate::nativeConnect:: Could not create hostname");
|
||||
return false;
|
||||
}
|
||||
hr = hostNameFactory->CreateHostName(hostNameRef.Get(), &remoteHost);
|
||||
RETURN_FALSE_IF_FAILED("QNativeSocketEngine::connectToHostByName: Could not create hostname.");
|
||||
|
||||
const QString portString = QString::number(port);
|
||||
HStringReference portReference(reinterpret_cast<LPCWSTR>(portString.utf16()));
|
||||
HRESULT hr = E_FAIL;
|
||||
if (d->socketType == QAbstractSocket::TcpSocket)
|
||||
hr = d->tcpSocket()->ConnectAsync(remoteHost.Get(), portReference.Get(), &d->connectOp);
|
||||
else if (d->socketType == QAbstractSocket::UdpSocket)
|
||||
hr = d->udpSocket()->ConnectAsync(remoteHost.Get(), portReference.Get(), &d->connectOp);
|
||||
if (FAILED(hr)) {
|
||||
qWarning("QNativeSocketEnginePrivate::nativeConnect:: Could not obtain connect action");
|
||||
if (hr == E_ACCESSDENIED) {
|
||||
qErrnoWarning(hr, "QNativeSocketEngine::connectToHostByName: Unable to connect to host. \
|
||||
Please check your manifest capabilities.");
|
||||
return false;
|
||||
}
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
|
||||
d->socketState = QAbstractSocket::ConnectingState;
|
||||
hr = d->connectOp->put_Completed(Callback<IAsyncActionCompletedHandler>(
|
||||
d, &QNativeSocketEnginePrivate::handleConnectToHost).Get());
|
||||
@ -295,68 +292,54 @@ bool QNativeSocketEngine::connectToHostByName(const QString &name, quint16 port)
|
||||
bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port)
|
||||
{
|
||||
Q_D(QNativeSocketEngine);
|
||||
HRESULT hr;
|
||||
ComPtr<IHostName> hostAddress;
|
||||
|
||||
if (address != QHostAddress::Any && address != QHostAddress::AnyIPv4 && address != QHostAddress::AnyIPv6) {
|
||||
ComPtr<IHostNameFactory> hostNameFactory;
|
||||
GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(),
|
||||
hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(),
|
||||
&hostNameFactory);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
const QString addressString = address.toString();
|
||||
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();
|
||||
HStringReference portString(reinterpret_cast<LPCWSTR>(portQString.utf16()));
|
||||
|
||||
ComPtr<IAsyncAction> op;
|
||||
if (d->socketType == QAbstractSocket::TcpSocket) {
|
||||
if (!d->tcpListener
|
||||
&& FAILED(RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_StreamSocketListener).Get(),
|
||||
&d->tcpListener))) {
|
||||
qWarning("Failed to create listener");
|
||||
return false;
|
||||
if (!d->tcpListener) {
|
||||
hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_StreamSocketListener).Get(),
|
||||
&d->tcpListener);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
}
|
||||
|
||||
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);
|
||||
if (FAILED(hr)) {
|
||||
qErrnoWarning(hr, "Unable to bind socket."); // ### Set error message
|
||||
return false;
|
||||
}
|
||||
} else if (d->socketType == QAbstractSocket::UdpSocket) {
|
||||
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 (op) {
|
||||
while (opStatus(op) == Started)
|
||||
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;
|
||||
if (hr == E_ACCESSDENIED) {
|
||||
qErrnoWarning(hr, "Unable to bind socket. Please check your manifest capabilities.");
|
||||
return false;
|
||||
}
|
||||
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()
|
||||
@ -430,27 +413,36 @@ void QNativeSocketEngine::close()
|
||||
d->notifyOnWrite = false;
|
||||
d->notifyOnException = false;
|
||||
|
||||
HRESULT hr;
|
||||
if (d->connectOp) {
|
||||
ComPtr<IAsyncInfo> info;
|
||||
d->connectOp.As(&info);
|
||||
hr = d->connectOp.As(&info);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
if (info) {
|
||||
info->Cancel();
|
||||
info->Close();
|
||||
hr = info->Cancel();
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = info->Close();
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
}
|
||||
}
|
||||
|
||||
if (d->socketDescriptor != -1) {
|
||||
ComPtr<IClosable> socket;
|
||||
if (d->socketType == QAbstractSocket::TcpSocket) {
|
||||
d->tcpSocket()->QueryInterface(IID_PPV_ARGS(&socket));
|
||||
d->tcpSocket()->Release();
|
||||
hr = d->tcpSocket()->QueryInterface(IID_PPV_ARGS(&socket));
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = d->tcpSocket()->Release();
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
} else if (d->socketType == QAbstractSocket::UdpSocket) {
|
||||
d->udpSocket()->QueryInterface(IID_PPV_ARGS(&socket));
|
||||
d->udpSocket()->Release();
|
||||
hr = d->udpSocket()->QueryInterface(IID_PPV_ARGS(&socket));
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = d->udpSocket()->Release();
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
}
|
||||
|
||||
if (socket) {
|
||||
socket->Close();
|
||||
hr = socket->Close();
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
d->socketDescriptor = -1;
|
||||
}
|
||||
d->socketDescriptor = -1;
|
||||
@ -531,7 +523,7 @@ qint64 QNativeSocketEngine::write(const char *data, qint64 len)
|
||||
hr = d->tcpSocket()->get_OutputStream(&stream);
|
||||
else if (d->socketType == QAbstractSocket::UdpSocket)
|
||||
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);
|
||||
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(),
|
||||
&hostNameFactory);
|
||||
RETURN_IF_FAILED("Could not obtain hostname factory", return -1);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
const QString addressString = header.destinationAddress.toString();
|
||||
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<IOutputStream> stream;
|
||||
const QString portString = QString::number(header.destinationPort);
|
||||
HStringReference portRef(reinterpret_cast<LPCWSTR>(portString.utf16()));
|
||||
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());
|
||||
RETURN_IF_FAILED("Failed to get output stream to socket", return -1);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
|
||||
return writeIOStream(stream, data, len);
|
||||
}
|
||||
@ -778,26 +771,23 @@ void QNativeSocketEngine::establishRead()
|
||||
bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType socketType, QAbstractSocket::NetworkLayerProtocol &socketProtocol)
|
||||
{
|
||||
Q_UNUSED(socketProtocol);
|
||||
HRESULT hr;
|
||||
|
||||
switch (socketType) {
|
||||
case QAbstractSocket::TcpSocket: {
|
||||
ComPtr<IStreamSocket> socket;
|
||||
HRESULT hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_StreamSocket).Get(), &socket);
|
||||
if (FAILED(hr)) {
|
||||
qWarning("Failed to create StreamSocket instance");
|
||||
return false;
|
||||
}
|
||||
hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_StreamSocket).Get(), &socket);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
socketDescriptor = qintptr(socket.Detach());
|
||||
break;
|
||||
}
|
||||
case QAbstractSocket::UdpSocket: {
|
||||
ComPtr<IDatagramSocket> socket;
|
||||
HRESULT hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_DatagramSocket).Get(), &socket);
|
||||
if (FAILED(hr)) {
|
||||
qWarning("Failed to create stream socket");
|
||||
return false;
|
||||
}
|
||||
hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_DatagramSocket).Get(), &socket);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
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;
|
||||
}
|
||||
default:
|
||||
@ -834,10 +824,12 @@ QNativeSocketEnginePrivate::~QNativeSocketEnginePrivate()
|
||||
if (socketDescriptor == -1 || connectionToken.value == -1)
|
||||
return;
|
||||
|
||||
HRESULT hr;
|
||||
if (socketType == QAbstractSocket::UdpSocket)
|
||||
udpSocket()->remove_MessageReceived(connectionToken);
|
||||
hr = udpSocket()->remove_MessageReceived(connectionToken);
|
||||
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
|
||||
@ -1064,56 +1056,66 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
|
||||
peerPort = 0;
|
||||
peerAddress.clear();
|
||||
|
||||
HRESULT hr;
|
||||
if (socketType == QAbstractSocket::TcpSocket) {
|
||||
ComPtr<IHostName> hostName;
|
||||
HString tmpHString;
|
||||
ComPtr<IStreamSocketInformation> info;
|
||||
if (FAILED(tcpSocket()->get_Information(&info))) {
|
||||
qWarning("QNativeSocketEnginePrivate::fetchConnectionParameters: Could not obtain socket info");
|
||||
return false;
|
||||
}
|
||||
info->get_LocalAddress(&hostName);
|
||||
hr = tcpSocket()->get_Information(&info);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = info->get_LocalAddress(&hostName);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
if (hostName) {
|
||||
hostName->get_CanonicalName(tmpHString.GetAddressOf());
|
||||
hr = hostName->get_CanonicalName(tmpHString.GetAddressOf());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
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();
|
||||
}
|
||||
if (!localPort && tcpListener) {
|
||||
ComPtr<IStreamSocketListenerInformation> listenerInfo = 0;
|
||||
tcpListener->get_Information(&listenerInfo);
|
||||
listenerInfo->get_LocalPort(tmpHString.GetAddressOf());
|
||||
hr = tcpListener->get_Information(&listenerInfo);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = listenerInfo->get_LocalPort(tmpHString.GetAddressOf());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
localPort = qt_QStringFromHString(tmpHString).toInt();
|
||||
localAddress == QHostAddress::Any;
|
||||
localAddress = QHostAddress::Any;
|
||||
}
|
||||
info->get_RemoteAddress(&hostName);
|
||||
if (hostName) {
|
||||
hostName->get_CanonicalName(tmpHString.GetAddressOf());
|
||||
hr = hostName->get_CanonicalName(tmpHString.GetAddressOf());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
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();
|
||||
}
|
||||
} else if (socketType == QAbstractSocket::UdpSocket) {
|
||||
ComPtr<IHostName> hostName;
|
||||
HString tmpHString;
|
||||
ComPtr<IDatagramSocketInformation> info;
|
||||
if (FAILED(udpSocket()->get_Information(&info))) {
|
||||
qWarning("QNativeSocketEnginePrivate::fetchConnectionParameters: Could not obtain socket information");
|
||||
return false;
|
||||
}
|
||||
info->get_LocalAddress(&hostName);
|
||||
hr = udpSocket()->get_Information(&info);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = info->get_LocalAddress(&hostName);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
if (hostName) {
|
||||
hostName->get_CanonicalName(tmpHString.GetAddressOf());
|
||||
hr = hostName->get_CanonicalName(tmpHString.GetAddressOf());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
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();
|
||||
}
|
||||
|
||||
info->get_RemoteAddress(&hostName);
|
||||
hr = info->get_RemoteAddress(&hostName);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
if (hostName) {
|
||||
hostName->get_CanonicalName(tmpHString.GetAddressOf());
|
||||
hr = hostName->get_CanonicalName(tmpHString.GetAddressOf());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
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();
|
||||
}
|
||||
}
|
||||
@ -1174,12 +1176,16 @@ void QNativeSocketEnginePrivate::handleConnectionEstablished(IAsyncAction *actio
|
||||
// The callback might be triggered several times if we do not cancel/reset it here
|
||||
if (connectOp) {
|
||||
ComPtr<IAsyncInfo> info;
|
||||
connectOp.As(&info);
|
||||
hr = connectOp.As(&info);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
if (info) {
|
||||
info->Cancel();
|
||||
info->Close();
|
||||
hr = info->Cancel();
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = info->Close();
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
}
|
||||
connectOp.Reset();
|
||||
hr = connectOp.Reset();
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
}
|
||||
|
||||
socketState = QAbstractSocket::ConnectedState;
|
||||
|
@ -6,6 +6,12 @@ SOURCES +=\
|
||||
HEADERS +=\
|
||||
$$PWD/qunixeventdispatcher_qpa_p.h\
|
||||
$$PWD/qgenericunixeventdispatcher_p.h\
|
||||
} else: win32 {
|
||||
SOURCES +=\
|
||||
$$PWD/qwindowsguieventdispatcher.cpp
|
||||
|
||||
HEADERS +=\
|
||||
$$PWD/qwindowsguieventdispatcher_p.h
|
||||
}
|
||||
|
||||
contains(QT_CONFIG, glib) {
|
||||
|
@ -32,17 +32,13 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qwindowsguieventdispatcher.h"
|
||||
#include "qwindowscontext.h"
|
||||
#include "qwindowsguieventdispatcher_p.h"
|
||||
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QStack>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include <windowsx.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
@ -69,11 +65,7 @@ bool QWindowsGuiEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags fl
|
||||
{
|
||||
const QEventLoop::ProcessEventsFlags oldFlags = m_flags;
|
||||
m_flags = flags;
|
||||
if (QWindowsContext::verbose > 2 && lcQpaEvents().isDebugEnabled())
|
||||
qCDebug(lcQpaEvents) << '>' << __FUNCTION__ << objectName() << flags;
|
||||
const bool rc = QEventDispatcherWin32::processEvents(flags);
|
||||
if (QWindowsContext::verbose > 2 && lcQpaEvents().isDebugEnabled())
|
||||
qCDebug(lcQpaEvents) << '<' << __FUNCTION__ << "returns" << rc;
|
||||
m_flags = oldFlags;
|
||||
return rc;
|
||||
}
|
||||
@ -100,10 +92,6 @@ messageDebugEntries[] = {
|
||||
{WM_DESTROY, "WM_DESTROY", true},
|
||||
{WM_MOVE, "WM_MOVE", 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_KEYDOWN, "WM_KEYDOWN", true},
|
||||
{WM_SYSKEYDOWN, "WM_SYSKEYDOWN", true},
|
||||
@ -119,16 +107,13 @@ messageDebugEntries[] = {
|
||||
{WM_CHAR, "WM_CHAR", true},
|
||||
{WM_DEADCHAR, "WM_DEADCHAR", true},
|
||||
{WM_ACTIVATE, "WM_ACTIVATE", true},
|
||||
{WM_GETMINMAXINFO, "WM_GETMINMAXINFO", true},
|
||||
{WM_SETFOCUS, "WM_SETFOCUS", true},
|
||||
{WM_KILLFOCUS, "WM_KILLFOCUS", true},
|
||||
{WM_ENABLE, "WM_ENABLE", true},
|
||||
{WM_SHOWWINDOW, "WM_SHOWWINDOW", true},
|
||||
{WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING", true},
|
||||
{WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED", true},
|
||||
{WM_SETCURSOR, "WM_SETCURSOR", false},
|
||||
{WM_GETFONT, "WM_GETFONT", true},
|
||||
{WM_NCMOUSEMOVE, "WM_NCMOUSEMOVE", true},
|
||||
{WM_LBUTTONDOWN, "WM_LBUTTONDOWN", true},
|
||||
{WM_LBUTTONUP, "WM_LBUTTONUP", true},
|
||||
{WM_LBUTTONDBLCLK, "WM_LBUTTONDBLCLK", true},
|
||||
@ -143,18 +128,6 @@ messageDebugEntries[] = {
|
||||
{WM_XBUTTONUP, "WM_XBUTTONUP", true},
|
||||
{WM_XBUTTONDBLCLK, "WM_XBUTTONDBLCLK", 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_INPUTLANGCHANGE, "WM_INPUTLANGCHANGE", true},
|
||||
{WM_IME_NOTIFY, "WM_IME_NOTIFY", true},
|
||||
@ -163,9 +136,6 @@ messageDebugEntries[] = {
|
||||
#endif
|
||||
{WM_IME_SETCONTEXT, "WM_IME_SETCONTEXT", 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_RENDERALLFORMATS, "WM_RENDERALLFORMATS", true},
|
||||
{WM_DESTROYCLIPBOARD, "WM_DESTROYCLIPBOARD", true},
|
||||
@ -179,7 +149,33 @@ messageDebugEntries[] = {
|
||||
{WM_QUERYENDSESSION, "WM_QUERYENDSESSION", true},
|
||||
{WM_ENDSESSION, "WM_ENDSESSION", true},
|
||||
#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_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD", true},
|
||||
#endif // !Q_OS_WINCE
|
||||
{WM_THEMECHANGED, "WM_THEMECHANGED", true}
|
||||
};
|
||||
|
@ -34,7 +34,16 @@
|
||||
#ifndef 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>
|
||||
|
@ -243,7 +243,13 @@ static const char *specialLanguages[] = {
|
||||
"sa", // Siddham
|
||||
"sd", // Khudawadi
|
||||
"mai", // Tirhuta
|
||||
"hoc" // WarangCiti
|
||||
"hoc", // WarangCiti
|
||||
"", // Ahom
|
||||
"", // AnatolianHieroglyphs
|
||||
"", // Hatran
|
||||
"", // Multani
|
||||
"", // OldHungarian
|
||||
"" // SignWriting
|
||||
};
|
||||
Q_STATIC_ASSERT(sizeof(specialLanguages) / sizeof(const char *) == QChar::ScriptCount);
|
||||
|
||||
|
@ -609,8 +609,9 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
|
||||
case QPlatformTheme::DialogButtonBoxLayout:
|
||||
return QVariant(QPlatformDialogHelper::GnomeLayout);
|
||||
case QPlatformTheme::SystemIconThemeName:
|
||||
return QVariant(QStringLiteral("Adwaita"));
|
||||
case QPlatformTheme::SystemIconFallbackThemeName:
|
||||
return QVariant(QString(QStringLiteral("gnome")));
|
||||
return QVariant(QStringLiteral("gnome"));
|
||||
case QPlatformTheme::IconThemeSearchPaths:
|
||||
return QVariant(QGenericUnixTheme::xdgIconThemePaths());
|
||||
case QPlatformTheme::StyleNames: {
|
||||
|
@ -8,7 +8,7 @@ TEMPLATE = subdirs
|
||||
#win32:SUBDIRS += nla
|
||||
win32:SUBDIRS += generic
|
||||
blackberry:SUBDIRS += blackberry
|
||||
win32:!wince: SUBDIRS += nativewifi
|
||||
win32:!wince:!winrt: SUBDIRS += nativewifi
|
||||
mac:contains(QT_CONFIG, corewlan):SUBDIRS += corewlan
|
||||
mac:SUBDIRS += generic
|
||||
android:!android-no-sdk:SUBDIRS += android
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QtCore/private/qcoreapplication_p.h>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
|
||||
#include "../platformdefs_win.h"
|
||||
#endif
|
||||
|
||||
@ -55,6 +55,24 @@ typedef ULONG NDIS_OID, *PNDIS_OID;
|
||||
# endif
|
||||
#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
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
@ -68,7 +86,7 @@ QT_BEGIN_NAMESPACE
|
||||
#ifndef QT_NO_NETWORKINTERFACE
|
||||
static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interface)
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
|
||||
DWORD bytesWritten;
|
||||
NDIS_MEDIUM medium;
|
||||
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)
|
||||
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
|
||||
Q_UNUSED(interface);
|
||||
#endif
|
||||
@ -243,9 +339,11 @@ void QGenericEngine::doRequestUpdate()
|
||||
if (interface.flags() & QNetworkInterface::IsLoopBack)
|
||||
continue;
|
||||
|
||||
#ifndef Q_OS_WINRT
|
||||
// ignore WLAN interface handled in separate engine
|
||||
if (qGetInterfaceType(interface.name()) == QNetworkConfiguration::BearerWLAN)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
uint identifier;
|
||||
if (interface.index())
|
||||
|
@ -75,6 +75,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
|
||||
QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) *m_mouseMoveHelper;
|
||||
bool m_resendKeyEvent;
|
||||
bool m_scrolling;
|
||||
bool m_updatingDrag;
|
||||
bool m_exposedOnMoveToWindow;
|
||||
NSEvent *m_currentlyInterpretedKeyEvent;
|
||||
bool m_isMenuView;
|
||||
|
@ -153,6 +153,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
|
||||
m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self];
|
||||
m_resendKeyEvent = false;
|
||||
m_scrolling = false;
|
||||
m_updatingDrag = false;
|
||||
m_currentlyInterpretedKeyEvent = 0;
|
||||
|
||||
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.
|
||||
// This allows popups to e.g. intercept shortcuts and close the popup in response.
|
||||
if (QCocoaWindow *popup = QCocoaIntegration::instance()->activePopupWindow())
|
||||
window = popup->window();
|
||||
if (QCocoaWindow *popup = QCocoaIntegration::instance()->activePopupWindow()) {
|
||||
if (!popup->m_windowFlags.testFlag(Qt::ToolTip))
|
||||
window = popup->window();
|
||||
}
|
||||
|
||||
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
|
||||
// by creating a fake move event
|
||||
if (m_updatingDrag)
|
||||
return;
|
||||
|
||||
const QPoint mousePos(QCursor::pos());
|
||||
CGEventRef moveEvent(CGEventCreateMouseEvent(
|
||||
NULL, kCGEventMouseMoved,
|
||||
@ -1934,7 +1940,11 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
|
||||
|
||||
- (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
|
||||
|
@ -219,12 +219,11 @@ QWindowsDirect2DIntegration::~QWindowsDirect2DIntegration()
|
||||
return static_cast<QWindowsDirect2DIntegration *>(QWindowsIntegration::instance());
|
||||
}
|
||||
|
||||
QPlatformWindow *QWindowsDirect2DIntegration::createPlatformWindow(QWindow *window) const
|
||||
{
|
||||
QWindowsWindowData data = createWindowData(window);
|
||||
return data.hwnd ? new QWindowsDirect2DWindow(window, data)
|
||||
: Q_NULLPTR;
|
||||
}
|
||||
|
||||
QWindowsWindow *QWindowsDirect2DIntegration::createPlatformWindowHelper(QWindow *window, const QWindowsWindowData &data) const
|
||||
{
|
||||
return new QWindowsDirect2DWindow(window, data);
|
||||
}
|
||||
|
||||
QPlatformNativeInterface *QWindowsDirect2DIntegration::nativeInterface() const
|
||||
{
|
||||
|
@ -52,7 +52,6 @@ public:
|
||||
|
||||
static QWindowsDirect2DIntegration *instance();
|
||||
|
||||
QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
|
||||
QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
|
||||
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const Q_DECL_OVERRIDE;
|
||||
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
|
||||
@ -60,6 +59,9 @@ public:
|
||||
|
||||
QWindowsDirect2DContext *direct2DContext() const;
|
||||
|
||||
protected:
|
||||
QWindowsWindow *createPlatformWindowHelper(QWindow *window, const QWindowsWindowData &) const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
explicit QWindowsDirect2DIntegration(const QStringList ¶mList);
|
||||
bool init();
|
||||
|
@ -6,13 +6,6 @@
|
||||
TARGET = QtEglDeviceIntegration
|
||||
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)
|
||||
|
||||
QT += core-private gui-private platformsupport-private
|
||||
|
@ -48,20 +48,29 @@ static QThreadStorage<QPointer<QIOSAssetData> > g_assetDataCache;
|
||||
static const int kBufferSize = 10;
|
||||
static ALAsset *kNoAsset = 0;
|
||||
|
||||
static void ensureAuthorizationDialogNotBlocked()
|
||||
static bool ensureAuthorizationDialogNotBlocked()
|
||||
{
|
||||
if ([ALAssetsLibrary authorizationStatus] != ALAuthorizationStatusNotDetermined)
|
||||
return;
|
||||
if (static_cast<QCoreApplicationPrivate *>(QObjectPrivate::get(qApp))->in_exec)
|
||||
return;
|
||||
return true;
|
||||
|
||||
// Since authorization status has not been determined, the user will be asked
|
||||
// to authorize the app. But since main has not finished, the dialog will be held
|
||||
// back until the launch completes. To avoid a dead-lock below, we start an event
|
||||
// loop to complete the launch.
|
||||
QEventLoop loop;
|
||||
QTimer::singleShot(1, &loop, &QEventLoop::quit);
|
||||
loop.exec();
|
||||
if (static_cast<QCoreApplicationPrivate *>(QObjectPrivate::get(qApp))->in_exec)
|
||||
return true;
|
||||
|
||||
if ([NSThread isMainThread]) {
|
||||
// The dialog is about to show, but since main has not finished, the dialog will be held
|
||||
// back until the launch completes. This is problematic since we cannot successfully return
|
||||
// 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_nextAssetReady(false)
|
||||
{
|
||||
ensureAuthorizationDialogNotBlocked();
|
||||
startEnumerate();
|
||||
if (!ensureAuthorizationDialogNotBlocked())
|
||||
writeAsset(kNoAsset);
|
||||
else
|
||||
startEnumerate();
|
||||
}
|
||||
|
||||
~QIOSAssetEnumerator()
|
||||
@ -186,7 +197,8 @@ public:
|
||||
, m_assetUrl(assetUrl)
|
||||
, m_assetLibrary(0)
|
||||
{
|
||||
ensureAuthorizationDialogNotBlocked();
|
||||
if (!ensureAuthorizationDialogNotBlocked())
|
||||
return;
|
||||
|
||||
if (QIOSAssetData *assetData = g_assetDataCache.localData()) {
|
||||
// It's a common pattern that QFiles pointing to the same path are created and destroyed
|
||||
|
@ -37,7 +37,15 @@
|
||||
#include "qminimaleglbackingstore.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 <QtGui/QSurfaceFormat>
|
||||
@ -48,6 +56,29 @@
|
||||
|
||||
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()
|
||||
: mFontDb(new QGenericUnixFontDatabase()), mScreen(new QMinimalEglScreen(EGL_DEFAULT_DISPLAY))
|
||||
{
|
||||
@ -104,7 +135,15 @@ QPlatformFontDatabase *QMinimalEglIntegration::fontDatabase() const
|
||||
|
||||
QAbstractEventDispatcher *QMinimalEglIntegration::createEventDispatcher() const
|
||||
{
|
||||
#if defined(Q_OS_UNIX)
|
||||
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
|
||||
|
@ -47,7 +47,7 @@
|
||||
"id": 4,
|
||||
"description": "Intel HD Graphics 3000 crashes when initializing the OpenGL driver (QTBUG-42240)",
|
||||
"vendor_id": "0x8086",
|
||||
"device_id": [ "0x0102", "0x0116" ],
|
||||
"device_id": [ "0x0102", "0x0106", "0x010A", "0x0112", "0x0116", "0x0122", "0x0126" ],
|
||||
"os": {
|
||||
"type": "win"
|
||||
},
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "qwindowscontext.h"
|
||||
#include "qwindowsole.h"
|
||||
#include "qwindowsmime.h"
|
||||
#include "qwindowsguieventdispatcher.h"
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QClipboard>
|
||||
@ -48,6 +47,8 @@
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QUrl>
|
||||
|
||||
#include <QtPlatformSupport/private/qwindowsguieventdispatcher_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static const char formatTextPlainC[] = "text/plain";
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "qwindowsintegration.h"
|
||||
#include "qwindowswindow.h"
|
||||
#include "qwindowskeymapper.h"
|
||||
#include "qwindowsguieventdispatcher.h"
|
||||
#include "qwindowsmousehandler.h"
|
||||
#include "qtwindowsglobal.h"
|
||||
#include "qwindowsmime.h"
|
||||
@ -66,6 +65,8 @@
|
||||
#include <QtCore/QScopedArrayPointer>
|
||||
#include <QtCore/private/qsystemlibrary_p.h>
|
||||
|
||||
#include <QtPlatformSupport/private/qwindowsguieventdispatcher_p.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <windowsx.h>
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <QtGui/QOpenGLContext>
|
||||
|
||||
#if defined(QT_OPENGL_ES_2_ANGLE) || defined(QT_OPENGL_DYNAMIC)
|
||||
# include <QtANGLE/EGL/eglext.h>
|
||||
# include <EGL/eglext.h>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -44,7 +44,6 @@
|
||||
# include "qwindowsfontdatabase_ft.h"
|
||||
#endif
|
||||
#include "qwindowsfontdatabase.h"
|
||||
#include "qwindowsguieventdispatcher.h"
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
# include "qwindowsclipboard.h"
|
||||
# ifndef QT_NO_DRAGANDDROP
|
||||
@ -67,7 +66,8 @@
|
||||
#include <QtGui/private/qhighdpiscaling_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/QVariant>
|
||||
|
||||
@ -291,7 +291,7 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
|
||||
return false;
|
||||
}
|
||||
|
||||
QWindowsWindowData QWindowsIntegration::createWindowData(QWindow *window) const
|
||||
QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) const
|
||||
{
|
||||
QWindowsWindowData requested;
|
||||
requested.flags = window->flags();
|
||||
@ -310,22 +310,30 @@ QWindowsWindowData QWindowsIntegration::createWindowData(QWindow *window) const
|
||||
<< "\n Obtained : " << obtained.geometry << " margins=" << obtained.frame
|
||||
<< " handle=" << obtained.hwnd << ' ' << obtained.flags << '\n';
|
||||
|
||||
if (obtained.hwnd) {
|
||||
if (requested.flags != obtained.flags)
|
||||
window->setFlags(obtained.flags);
|
||||
// Trigger geometry change signals of QWindow.
|
||||
if ((obtained.flags & Qt::Desktop) != Qt::Desktop && requested.geometry != obtained.geometry)
|
||||
if (Q_UNLIKELY(!obtained.hwnd))
|
||||
return Q_NULLPTR;
|
||||
|
||||
QWindowsWindow *result = createPlatformWindowHelper(window, obtained);
|
||||
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);
|
||||
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 data.hwnd ? new QWindowsWindow(window, data)
|
||||
: Q_NULLPTR;
|
||||
return new QWindowsWindow(window, data);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
|
@ -62,7 +62,6 @@ public:
|
||||
|
||||
bool hasCapability(QPlatformIntegration::Capability cap) const;
|
||||
|
||||
QWindowsWindowData createWindowData(QWindow *window) const;
|
||||
QPlatformWindow *createPlatformWindow(QWindow *window) const;
|
||||
#ifndef QT_NO_OPENGL
|
||||
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;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual QWindowsWindow *createPlatformWindowHelper(QWindow *window, const QWindowsWindowData &) const;
|
||||
|
||||
private:
|
||||
QScopedPointer<QWindowsIntegrationPrivate> d;
|
||||
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "qwindowscontext.h"
|
||||
#include "qwindowsintegration.h"
|
||||
#include "qwindowswindow.h"
|
||||
#include "qwindowsguieventdispatcher.h"
|
||||
#include "qwindowsinputcontext.h"
|
||||
|
||||
#include <QtGui/QWindow>
|
||||
@ -43,6 +42,7 @@
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <private/qhighdpiscaling_p.h>
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtPlatformSupport/private/qwindowsguieventdispatcher_p.h>
|
||||
|
||||
#if defined(WM_APPCOMMAND)
|
||||
# ifndef FAPPCOMMAND_MOUSE
|
||||
|
@ -143,6 +143,8 @@ public:
|
||||
QWindowsWindow(QWindow *window, const QWindowsWindowData &data);
|
||||
~QWindowsWindow();
|
||||
|
||||
using QPlatformWindow::screenForGeometry;
|
||||
|
||||
QSurfaceFormat format() const Q_DECL_OVERRIDE { return m_format; }
|
||||
void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
|
||||
QRect geometry() const Q_DECL_OVERRIDE { return m_data.geometry; }
|
||||
|
@ -29,7 +29,6 @@ SOURCES += \
|
||||
$$PWD/qwindowsfontengine.cpp \
|
||||
$$PWD/qwindowsfontdatabase.cpp \
|
||||
$$PWD/qwindowsmousehandler.cpp \
|
||||
$$PWD/qwindowsguieventdispatcher.cpp \
|
||||
$$PWD/qwindowsole.cpp \
|
||||
$$PWD/qwindowsmime.cpp \
|
||||
$$PWD/qwindowsinternalmimedata.cpp \
|
||||
@ -51,7 +50,6 @@ HEADERS += \
|
||||
$$PWD/qwindowsfontengine.h \
|
||||
$$PWD/qwindowsfontdatabase.h \
|
||||
$$PWD/qwindowsmousehandler.h \
|
||||
$$PWD/qwindowsguieventdispatcher.h \
|
||||
$$PWD/qtwindowsglobal.h \
|
||||
$$PWD/qtwindows_additional.h \
|
||||
$$PWD/qwindowsole.h \
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user