Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev
This commit is contained in:
commit
3ed944b843
@ -1,6 +1,10 @@
|
||||
SOURCES = journald.c
|
||||
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG_PRIVATE += libsystemd-journal
|
||||
|
||||
packagesExist(libsystemd): \
|
||||
PKGCONFIG_PRIVATE += libsystemd
|
||||
else: \
|
||||
PKGCONFIG_PRIVATE += libsystemd-journal
|
||||
|
||||
CONFIG -= qt
|
||||
|
2
configure
vendored
2
configure
vendored
@ -2872,7 +2872,7 @@ if [ -z "$PLATFORM" ]; then
|
||||
PLATFORM=ultrix-g++
|
||||
;;
|
||||
FreeBSD:*)
|
||||
PLATFORM=freebsd-g++
|
||||
PLATFORM=freebsd-clang
|
||||
PLATFORM_NOTES="
|
||||
- Also available for FreeBSD: freebsd-icc
|
||||
"
|
||||
|
@ -161,3 +161,7 @@ Cpp.ignoredirectives += \
|
||||
QT_WARNING_DISABLE_MSVC \
|
||||
Q_ATTRIBUTE_FORMAT_PRINTF \
|
||||
Q_MV_IOS
|
||||
|
||||
# Qt 6: Remove
|
||||
falsehoods += \
|
||||
"QT_VERSION >= QT_VERSION_CHECK\\(6,0,0\\)"
|
||||
|
@ -14,6 +14,9 @@ load(qt_build_paths)
|
||||
TEMPLATE = lib
|
||||
CONFIG -= qt
|
||||
|
||||
CONFIG -= warning_clean # Don't presume 3rd party code to be clean
|
||||
load(qt_common)
|
||||
|
||||
contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release
|
||||
contains(QT_CONFIG, build_all): CONFIG += build_all
|
||||
|
||||
|
@ -117,7 +117,6 @@ lib_bundle {
|
||||
QMAKE_BUNDLE_EXTENSION = .framework
|
||||
QMAKE_INFO_PLIST = $$QMAKESPEC/Info.plist.lib
|
||||
}
|
||||
CONFIG -= qt_install_headers #no need to install these as well
|
||||
!build_all| \
|
||||
if(if(!debug_and_release|CONFIG(release, debug|release)): \
|
||||
if(!simulator_and_device|CONFIG(device, simulator|device))) {
|
||||
@ -197,7 +196,7 @@ equals(QT_ARCH, i386):contains(QT_CPU_FEATURES.$$QT_ARCH, sse2):compiler_support
|
||||
android: CONFIG += qt_android_deps no_linker_version_script
|
||||
|
||||
!header_module:unix:!isEmpty(QMAKE_LFLAGS_VERSION_SCRIPT):!no_linker_version_script:!static {
|
||||
verscript = $$OUT_PWD/$${TARGET}.version
|
||||
verscript = $${TARGET}.version
|
||||
QMAKE_LFLAGS += $${QMAKE_LFLAGS_VERSION_SCRIPT}$$verscript
|
||||
|
||||
internal_module {
|
||||
@ -222,16 +221,20 @@ android: CONFIG += qt_android_deps no_linker_version_script
|
||||
}
|
||||
|
||||
# Add a post-processing step to replace the @FILE:filename@
|
||||
verscriptprocess.commands = perl $${PWD}/data/unix/findclasslist.pl < $${verscript}.in > $@
|
||||
verscriptprocess.target = $$verscript
|
||||
verscript_in = $${verscript}.in
|
||||
verscriptprocess.name = linker version script ${QMAKE_FILE_BASE}
|
||||
verscriptprocess.input = verscript_in
|
||||
verscriptprocess.CONFIG += no_link target_predeps
|
||||
for(header, SYNCQT.PRIVATE_HEADER_FILES): \
|
||||
verscriptprocess.depends += $${_PRO_FILE_PWD_}/$$header
|
||||
verscriptprocess.depends += $${verscript}.in
|
||||
QMAKE_EXTRA_TARGETS += verscriptprocess
|
||||
PRE_TARGETDEPS += $$verscript
|
||||
verscript = $${verscript}.in
|
||||
verscriptprocess.output = $$verscript
|
||||
verscriptprocess.commands = perl $${PWD}/data/unix/findclasslist.pl < ${QMAKE_FILE_IN} > $@
|
||||
silent:verscriptprocess.commands = @echo creating linker version script ${QMAKE_FILE_BASE} && $$verscriptprocess.commands
|
||||
QMAKE_EXTRA_COMPILERS += verscriptprocess
|
||||
|
||||
verscript = $$verscript_in
|
||||
}
|
||||
write_file($$verscript, verscript_content)|error("Aborting.")
|
||||
write_file($$OUT_PWD/$$verscript, verscript_content)|error("Aborting.")
|
||||
unset(current)
|
||||
unset(previous)
|
||||
unset(verscript)
|
||||
|
@ -99,7 +99,8 @@ git_build: \
|
||||
else: \
|
||||
INC_PATH = $$MODULE_BASE_INDIR
|
||||
include($$INC_PATH/include/$$MODULE_INCNAME/headers.pri, "", true)
|
||||
CONFIG += qt_install_headers
|
||||
!lib_bundle: \ # Headers are embedded into the bundle, so don't install them separately.
|
||||
CONFIG += qt_install_headers
|
||||
|
||||
alien_syncqt: return()
|
||||
|
||||
|
@ -30,7 +30,7 @@ QMAKE_OBJCOPY = objcopy
|
||||
QMAKE_NM = nm -P
|
||||
QMAKE_RANLIB =
|
||||
|
||||
include(../../common/gcc-base-unix.conf)
|
||||
include(../../common/clang.conf)
|
||||
include(../common/gcc-base-unix.conf)
|
||||
include(../common/clang.conf)
|
||||
|
||||
load(qt_config)
|
@ -5,7 +5,7 @@
|
||||
MAKEFILE_GENERATOR = UNIX
|
||||
QMAKE_PLATFORM = freebsd bsd
|
||||
|
||||
include(../common/unix.conf)
|
||||
include(../../common/unix.conf)
|
||||
|
||||
QMAKE_CFLAGS_THREAD = -pthread -D_THREAD_SAFE
|
||||
|
||||
@ -29,6 +29,6 @@ QMAKE_OBJCOPY = objcopy
|
||||
QMAKE_NM = nm -P
|
||||
QMAKE_RANLIB =
|
||||
|
||||
include(../common/gcc-base-unix.conf)
|
||||
include(../common/g++-unix.conf)
|
||||
include(../../common/gcc-base-unix.conf)
|
||||
include(../../common/g++-unix.conf)
|
||||
load(qt_config)
|
@ -37,4 +37,4 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "../../freebsd-g++/qplatformdefs.h"
|
||||
#include "../../freebsd-clang/qplatformdefs.h"
|
@ -5,7 +5,7 @@
|
||||
MAKEFILE_GENERATOR = UNIX
|
||||
QMAKE_PLATFORM = freebsd bsd
|
||||
|
||||
include(../common/unix.conf)
|
||||
include(../../common/unix.conf)
|
||||
|
||||
QMAKE_CFLAGS_THREAD = -pthread -D_THREAD_SAFE
|
||||
|
||||
@ -29,8 +29,8 @@ QMAKE_OBJCOPY = objcopy
|
||||
QMAKE_NM = nm -P
|
||||
QMAKE_RANLIB =
|
||||
|
||||
include(../common/gcc-base-unix.conf)
|
||||
include(../common/g++-unix.conf)
|
||||
include(../../common/gcc-base-unix.conf)
|
||||
include(../../common/g++-unix.conf)
|
||||
|
||||
# Redefined here because g++-base.conf sets QMAKE_CC and QMAKE_CXX
|
||||
# to gcc and g++, respectively.
|
@ -37,4 +37,4 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "../freebsd-g++/qplatformdefs.h"
|
||||
#include "../../freebsd-clang/qplatformdefs.h"
|
@ -31,6 +31,7 @@ QMAKE_CFLAGS_DEPS = -M
|
||||
QMAKE_CFLAGS_WARN_ON = -Wall -Wextra
|
||||
QMAKE_CFLAGS_WARN_OFF = -w
|
||||
QMAKE_CFLAGS_RELEASE = -O2
|
||||
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -O2 -g
|
||||
QMAKE_CFLAGS_DEBUG = -g
|
||||
QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
|
||||
QMAKE_CFLAGS_SPLIT_SECTIONS = -ffunction-sections
|
||||
|
@ -98,19 +98,6 @@ struct ProjectBuilderSubDirs {
|
||||
bool
|
||||
ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
|
||||
{
|
||||
if(project->isActiveConfig("generate_pbxbuild_makefile")) {
|
||||
QString mkwrap = fileFixify(pbx_dir + Option::dir_sep + ".." + Option::dir_sep + project->first("MAKEFILE"),
|
||||
FileFixifyToIndir);
|
||||
QFile mkwrapf(mkwrap);
|
||||
if(mkwrapf.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
debug_msg(1, "pbuilder: Creating file: %s", mkwrap.toLatin1().constData());
|
||||
QTextStream mkwrapt(&mkwrapf);
|
||||
writingUnixMakefileGenerator = true;
|
||||
UnixMakefileGenerator::writeSubDirs(mkwrapt);
|
||||
writingUnixMakefileGenerator = false;
|
||||
}
|
||||
}
|
||||
|
||||
//HEADER
|
||||
const int pbVersion = pbuilderVersion();
|
||||
t << "// !$*UTF8*$!\n"
|
||||
@ -1664,32 +1651,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
<< "\t" << writeSettings("rootObject", keyFor("QMAKE_PBX_ROOT")) << ";\n"
|
||||
<< "}\n";
|
||||
|
||||
if(project->isActiveConfig("generate_pbxbuild_makefile")) {
|
||||
QString mkwrap = Option::output_dir + project->first("/MAKEFILE");
|
||||
QFile mkwrapf(mkwrap);
|
||||
if(mkwrapf.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
writingUnixMakefileGenerator = true;
|
||||
debug_msg(1, "pbuilder: Creating file: %s", mkwrap.toLatin1().constData());
|
||||
QTextStream mkwrapt(&mkwrapf);
|
||||
writeHeader(mkwrapt);
|
||||
const char cleans[] = "preprocess_clean ";
|
||||
const QString cmd = escapeFilePath(project->first("QMAKE_ORIG_TARGET") + projectSuffix() + "/") + " && " + pbxbuild();
|
||||
mkwrapt << "#This is a makefile wrapper for PROJECT BUILDER\n"
|
||||
<< "all:\n\t"
|
||||
<< "cd " << cmd << "\n"
|
||||
<< "install: all\n\t"
|
||||
<< "cd " << cmd << " install\n"
|
||||
<< "distclean clean: preprocess_clean\n\t"
|
||||
<< "cd " << cmd << " clean\n"
|
||||
<< (!did_preprocess ? cleans : "") << ":\n";
|
||||
if(did_preprocess)
|
||||
mkwrapt << cleans << ":\n\t"
|
||||
<< "make -f "
|
||||
<< pbx_dir << Option::dir_sep << "qt_preprocess.mak $@\n";
|
||||
writingUnixMakefileGenerator = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Scheme
|
||||
{
|
||||
QString xcodeSpecDir = project->first("QMAKE_XCODE_SPECDIR").toQString();
|
||||
|
56
src/3rdparty/dbus-ifaces/com.canonical.AppMenu.Registrar.xml
vendored
Normal file
56
src/3rdparty/dbus-ifaces/com.canonical.AppMenu.Registrar.xml
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node xmlns:dox="http://www.ayatana.org/dbus/dox.dtd">
|
||||
<dox:d><![CDATA[
|
||||
@mainpage
|
||||
|
||||
An interface to register menus that are associated with a window in an application. The
|
||||
main interface is documented here: @ref com::canonical::AppMenu::Registrar.
|
||||
|
||||
The actual menus are transported using the dbusmenu protocol which is available
|
||||
here: @ref com::canonical::dbusmenu.
|
||||
]]></dox:d>
|
||||
<interface name="com.canonical.AppMenu.Registrar" xmlns:dox="http://www.ayatana.org/dbus/dox.dtd">
|
||||
<dox:d>
|
||||
An interface to register a menu from an application's window to be displayed in another
|
||||
window. This manages that association between XWindow Window IDs and the dbus
|
||||
address and object that provides the menu using the dbusmenu dbus interface.
|
||||
</dox:d>
|
||||
<method name="RegisterWindow">
|
||||
<dox:d><![CDATA[
|
||||
Associates a dbusmenu with a window
|
||||
|
||||
/note this method assumes that the connection from the caller is the DBus connection
|
||||
to use for the object. Applications that use multiple DBus connections will need to
|
||||
ensure this method is called with the same connection that implmenets the object.
|
||||
]]></dox:d>
|
||||
<arg name="windowId" type="u" direction="in">
|
||||
<dox:d>The XWindow ID of the window</dox:d>
|
||||
</arg>
|
||||
<arg name="menuObjectPath" type="o" direction="in">
|
||||
<dox:d>The object on the dbus interface implementing the dbusmenu interface</dox:d>
|
||||
</arg>
|
||||
</method>
|
||||
<method name="UnregisterWindow">
|
||||
<dox:d>
|
||||
A method to allow removing a window from the database. Windows will also be removed
|
||||
when the client drops off DBus so this is not required. It is polite though. And
|
||||
important for testing.
|
||||
</dox:d>
|
||||
<arg name="windowId" type="u" direction="in">
|
||||
<dox:d>The XWindow ID of the window</dox:d>
|
||||
</arg>
|
||||
</method>
|
||||
<method name="GetMenuForWindow">
|
||||
<dox:d>Gets the registered menu for a given window ID.</dox:d>
|
||||
<arg name="windowId" type="u" direction="in">
|
||||
<dox:d>The XWindow ID of the window to get</dox:d>
|
||||
</arg>
|
||||
<arg name="service" type="s" direction="out">
|
||||
<dox:d>The address of the connection on DBus (e.g. :1.23 or org.example.service)</dox:d>
|
||||
</arg>
|
||||
<arg name="menuObjectPath" type="o" direction="out">
|
||||
<dox:d>The path to the object which implements the com.canonical.dbusmenu interface.</dox:d>
|
||||
</arg>
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
@ -48,6 +48,7 @@ import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.Rect;
|
||||
import android.net.LocalServerSocket;
|
||||
import android.net.LocalSocket;
|
||||
@ -74,6 +75,7 @@ import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.PopupMenu;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@ -101,6 +103,7 @@ public class QtActivityDelegate
|
||||
private Method m_super_onConfigurationChanged = null;
|
||||
private Method m_super_onActivityResult = null;
|
||||
private Method m_super_dispatchGenericMotionEvent = null;
|
||||
private Method m_super_onWindowFocusChanged = null;
|
||||
|
||||
private static final String NATIVE_LIBRARIES_KEY = "native.libraries";
|
||||
private static final String BUNDLED_LIBRARIES_KEY = "bundled.libraries";
|
||||
@ -126,6 +129,8 @@ public class QtActivityDelegate
|
||||
private HashMap<Integer, QtSurface> m_surfaces = null;
|
||||
private HashMap<Integer, View> m_nativeViews = null;
|
||||
private QtLayout m_layout = null;
|
||||
private ImageView m_splashScreen = null;
|
||||
private boolean m_splashScreenSticky = false;
|
||||
private QtEditText m_editText = null;
|
||||
private InputMethodManager m_imm = null;
|
||||
private boolean m_quitApp = true;
|
||||
@ -516,6 +521,7 @@ public class QtActivityDelegate
|
||||
m_super_onKeyUp = m_activity.getClass().getMethod("super_onKeyUp", Integer.TYPE, KeyEvent.class);
|
||||
m_super_onConfigurationChanged = m_activity.getClass().getMethod("super_onConfigurationChanged", Configuration.class);
|
||||
m_super_onActivityResult = m_activity.getClass().getMethod("super_onActivityResult", Integer.TYPE, Integer.TYPE, Intent.class);
|
||||
m_super_onWindowFocusChanged = m_activity.getClass().getMethod("super_onWindowFocusChanged", Boolean.TYPE);
|
||||
m_super_dispatchGenericMotionEvent = m_activity.getClass().getMethod("super_dispatchGenericMotionEvent", MotionEvent.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -871,6 +877,22 @@ public class QtActivityDelegate
|
||||
};
|
||||
}
|
||||
m_layout = new QtLayout(m_activity, startApplication);
|
||||
|
||||
try {
|
||||
ActivityInfo info = m_activity.getPackageManager().getActivityInfo(m_activity.getComponentName(), PackageManager.GET_META_DATA);
|
||||
if (info.metaData.containsKey("android.app.splash_screen_drawable")) {
|
||||
m_splashScreenSticky = info.metaData.containsKey("android.app.splash_screen_sticky") && info.metaData.getBoolean("android.app.splash_screen_sticky");
|
||||
int id = info.metaData.getInt("android.app.splash_screen_drawable");
|
||||
m_splashScreen = new ImageView(m_activity);
|
||||
m_splashScreen.setImageDrawable(m_activity.getResources().getDrawable(id));
|
||||
m_splashScreen.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
m_splashScreen.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
m_layout.addView(m_splashScreen);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
m_editText = new QtEditText(m_activity, this);
|
||||
m_imm = (InputMethodManager)m_activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
m_surfaces = new HashMap<Integer, QtSurface>();
|
||||
@ -912,11 +934,30 @@ public class QtActivityDelegate
|
||||
});
|
||||
}
|
||||
|
||||
public void hideSplashScreen()
|
||||
{
|
||||
if (m_splashScreen == null)
|
||||
return;
|
||||
m_layout.removeView(m_splashScreen);
|
||||
m_splashScreen = null;
|
||||
}
|
||||
|
||||
|
||||
public void initializeAccessibility()
|
||||
{
|
||||
new QtAccessibilityDelegate(m_activity, m_layout, this);
|
||||
}
|
||||
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
try {
|
||||
m_super_onWindowFocusChanged.invoke(m_activity, hasFocus);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (hasFocus)
|
||||
updateFullScreen();
|
||||
}
|
||||
|
||||
public void onConfigurationChanged(Configuration configuration)
|
||||
{
|
||||
try {
|
||||
@ -925,22 +966,6 @@ public class QtActivityDelegate
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// if splash screen is defined, then show it
|
||||
// Note: QtActivity handles settting the splash screen
|
||||
// in onCreate, change that too if you are changing
|
||||
// how the splash screen should be displayed
|
||||
try {
|
||||
if (m_surfaces.size() == 0) {
|
||||
ActivityInfo info = m_activity.getPackageManager().getActivityInfo(m_activity.getComponentName(), PackageManager.GET_META_DATA);
|
||||
if (info.metaData.containsKey("android.app.splash_screen_drawable"))
|
||||
m_activity.getWindow().setBackgroundDrawableResource(info.metaData.getInt("android.app.splash_screen_drawable"));
|
||||
else
|
||||
m_activity.getWindow().setBackgroundDrawable(new ColorDrawable(0xff000000));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
int rotation = m_activity.getWindowManager().getDefaultDisplay().getRotation();
|
||||
if (rotation != m_currentRotation) {
|
||||
QtNative.handleOrientationChanged(rotation, m_nativeOrientation);
|
||||
@ -1262,6 +1287,8 @@ public class QtActivityDelegate
|
||||
m_layout.addView(surface, surfaceCount);
|
||||
|
||||
m_surfaces.put(id, surface);
|
||||
if (!m_splashScreenSticky)
|
||||
hideSplashScreen();
|
||||
}
|
||||
|
||||
public void setSurfaceGeometry(int id, int x, int y, int w, int h) {
|
||||
|
@ -728,6 +728,17 @@ public class QtNative
|
||||
});
|
||||
}
|
||||
|
||||
private static void hideSplashScreen()
|
||||
{
|
||||
runAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (m_activityDelegate != null)
|
||||
m_activityDelegate.hideSplashScreen();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// screen methods
|
||||
public static native void setDisplayMetrics(int screenWidthPixels,
|
||||
int screenHeightPixels,
|
||||
|
@ -166,15 +166,6 @@ public class QtActivityLoader extends QtLoader {
|
||||
+ "/\tQT_ANDROID_THEME_DISPLAY_DPI=" + m_displayDensity + "\t";
|
||||
|
||||
if (null == m_activity.getLastNonConfigurationInstance()) {
|
||||
// if splash screen is defined, then show it
|
||||
// Note: QtActivityDelegate handles updating the splash screen
|
||||
// in onConfigurationChanged, change that too if you are changing
|
||||
// how the splash screen should be displayed
|
||||
if (m_contextInfo.metaData.containsKey("android.app.splash_screen_drawable"))
|
||||
m_activity.getWindow().setBackgroundDrawableResource(m_contextInfo.metaData.getInt("android.app.splash_screen_drawable"));
|
||||
else
|
||||
m_activity.getWindow().setBackgroundDrawable(new ColorDrawable(0xff000000));
|
||||
|
||||
if (m_contextInfo.metaData.containsKey("android.app.background_running")
|
||||
&& m_contextInfo.metaData.getBoolean("android.app.background_running")) {
|
||||
ENVIRONMENT_VARIABLES += "QT_BLOCK_EVENT_LOOPS_WHEN_SUSPENDED=0\t";
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
<!-- Splash screen -->
|
||||
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
|
||||
<!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
|
||||
<!-- Splash screen -->
|
||||
|
||||
<!-- Background running -->
|
||||
|
@ -151,7 +151,7 @@ template <typename X> struct QAtomicOps
|
||||
static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return false; }
|
||||
|
||||
template <typename T>
|
||||
static bool testAndSetRelaxed(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = 0) Q_DECL_NOTHROW
|
||||
static bool testAndSetRelaxed(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW
|
||||
{
|
||||
bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_relaxed);
|
||||
if (currentValue)
|
||||
@ -160,7 +160,7 @@ template <typename X> struct QAtomicOps
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static bool testAndSetAcquire(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = 0) Q_DECL_NOTHROW
|
||||
static bool testAndSetAcquire(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW
|
||||
{
|
||||
bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acquire);
|
||||
if (currentValue)
|
||||
@ -169,7 +169,7 @@ template <typename X> struct QAtomicOps
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static bool testAndSetRelease(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = 0) Q_DECL_NOTHROW
|
||||
static bool testAndSetRelease(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW
|
||||
{
|
||||
bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_release);
|
||||
if (currentValue)
|
||||
@ -178,7 +178,7 @@ template <typename X> struct QAtomicOps
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static bool testAndSetOrdered(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = 0) Q_DECL_NOTHROW
|
||||
static bool testAndSetOrdered(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW
|
||||
{
|
||||
bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acq_rel);
|
||||
if (currentValue)
|
||||
|
@ -25,6 +25,10 @@ ANDROID_PERMISSIONS = \
|
||||
android.permission.INTERNET \
|
||||
android.permission.WRITE_EXTERNAL_STORAGE
|
||||
|
||||
# QtCore can't be compiled with -Wl,-no-undefined because it uses the "environ"
|
||||
# variable and on FreeBSD, this variable is in the final executable itself
|
||||
freebsd: QMAKE_LFLAGS_NOUNDEF =
|
||||
|
||||
load(qt_module)
|
||||
load(qfeatures)
|
||||
|
||||
|
@ -53,7 +53,10 @@ slog2 {
|
||||
|
||||
journald {
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG_PRIVATE += libsystemd-journal
|
||||
packagesExist(libsystemd): \
|
||||
PKGCONFIG_PRIVATE += libsystemd
|
||||
else: \
|
||||
PKGCONFIG_PRIVATE += libsystemd-journal
|
||||
DEFINES += QT_USE_JOURNALD
|
||||
}
|
||||
|
||||
|
@ -430,7 +430,7 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in
|
||||
\since 5.7
|
||||
|
||||
Sets the indicated \a flag if \a on is \c true or unsets it if
|
||||
it if \a on is \c false. Returns a reference to this object.
|
||||
\a on is \c false. Returns a reference to this object.
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -65,11 +65,7 @@ QT_BEGIN_NAMESPACE
|
||||
#elif defined(Q_CC_GNU) && !defined(Q_OS_ANDROID)
|
||||
# if defined(Q_PROCESSOR_X86) && (defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD_KERNEL))
|
||||
# if defined(Q_PROCESSOR_X86_64) // x86-64 or x32
|
||||
# if defined(__code_model_large__)
|
||||
# define QT_VERSION_TAG_RELOC(sym) ".quad " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOT\n"
|
||||
# else
|
||||
# define QT_VERSION_TAG_RELOC(sym) ".long " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOTPCREL\n"
|
||||
# endif
|
||||
# define QT_VERSION_TAG_RELOC(sym) ".quad " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOT\n"
|
||||
# else // x86
|
||||
# define QT_VERSION_TAG_RELOC(sym) ".long " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOT\n"
|
||||
# endif
|
||||
|
@ -581,7 +581,7 @@ QFile::rename(const QString &newName)
|
||||
#ifdef Q_OS_LINUX
|
||||
// rename() on Linux simply does nothing when renaming "foo" to "Foo" on a case-insensitive
|
||||
// FS, such as FAT32. Move the file away and rename in 2 steps to work around.
|
||||
QTemporaryFile tempFile(d->fileName + QStringLiteral(".XXXXXX"));
|
||||
QTemporaryFile tempFile(d->fileName + QLatin1String(".XXXXXX"));
|
||||
tempFile.setAutoRemove(false);
|
||||
if (!tempFile.open(QIODevice::ReadWrite)) {
|
||||
d->setError(QFile::RenameError, tempFile.errorString());
|
||||
|
@ -227,7 +227,7 @@ bool QLockFile::tryLock(int timeout)
|
||||
if (!d->isLocked && d->isApparentlyStale()) {
|
||||
// Stale lock from another thread/process
|
||||
// Ensure two processes don't remove it at the same time
|
||||
QLockFile rmlock(d->fileName + QStringLiteral(".rmlock"));
|
||||
QLockFile rmlock(d->fileName + QLatin1String(".rmlock"));
|
||||
if (rmlock.tryLock()) {
|
||||
if (d->isApparentlyStale() && d->removeStaleLock())
|
||||
continue;
|
||||
|
@ -4271,7 +4271,7 @@ QUrl QUrl::fromUserInput(const QString &userInput)
|
||||
return QUrl::fromLocalFile(trimmedString);
|
||||
|
||||
QUrl url = QUrl(trimmedString, QUrl::TolerantMode);
|
||||
QUrl urlPrepended = QUrl(QStringLiteral("http://") + trimmedString, QUrl::TolerantMode);
|
||||
QUrl urlPrepended = QUrl(QLatin1String("http://") + trimmedString, QUrl::TolerantMode);
|
||||
|
||||
// Check the most common case of a valid url with a scheme
|
||||
// We check if the port would be valid by adding the scheme to handle the case host:port
|
||||
|
@ -49,13 +49,8 @@ QWindowsPipeWriter::QWindowsPipeWriter(HANDLE pipe, QObject * parent)
|
||||
quitNow(false),
|
||||
hasWritten(false)
|
||||
{
|
||||
#if !defined(Q_OS_WINCE) || (_WIN32_WCE >= 0x600)
|
||||
DuplicateHandle(GetCurrentProcess(), pipe, GetCurrentProcess(),
|
||||
&writePipe, 0, FALSE, DUPLICATE_SAME_ACCESS);
|
||||
#else
|
||||
Q_UNUSED(pipe);
|
||||
writePipe = GetCurrentProcess();
|
||||
#endif
|
||||
}
|
||||
|
||||
QWindowsPipeWriter::~QWindowsPipeWriter()
|
||||
@ -66,9 +61,7 @@ QWindowsPipeWriter::~QWindowsPipeWriter()
|
||||
lock.unlock();
|
||||
if (!wait(30000))
|
||||
terminate();
|
||||
#if !defined(Q_OS_WINCE) || (_WIN32_WCE >= 0x600)
|
||||
CloseHandle(writePipe);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool QWindowsPipeWriter::waitForWrite(int msecs)
|
||||
@ -159,7 +152,6 @@ void QWindowsPipeWriter::run()
|
||||
msleep(100);
|
||||
continue;
|
||||
}
|
||||
#ifndef Q_OS_WINCE
|
||||
if (writeError != ERROR_IO_PENDING) {
|
||||
qErrnoWarning(writeError, "QWindowsPipeWriter: async WriteFile failed.");
|
||||
return;
|
||||
@ -168,9 +160,6 @@ void QWindowsPipeWriter::run()
|
||||
qErrnoWarning(GetLastError(), "QWindowsPipeWriter: GetOverlappedResult failed.");
|
||||
return;
|
||||
}
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
totalWritten += written;
|
||||
#if defined QPIPEWRITER_DEBUG
|
||||
|
@ -81,6 +81,22 @@ QT_BEGIN_NAMESPACE
|
||||
or WriteFile() is ignored and can be used for other purposes.
|
||||
|
||||
\warning This class is only available on Windows.
|
||||
|
||||
Due to peculiarities of the Windows I/O completion port API, users of
|
||||
QWinOverlappedIoNotifier must pay attention to the following restrictions:
|
||||
\list
|
||||
\li File handles with a QWinOverlappedIoNotifer are assigned to an I/O
|
||||
completion port until the handle is closed. It is impossible to
|
||||
disassociate the file handle from the I/O completion port.
|
||||
\li There can be only one QWinOverlappedIoNotifer per file handle. Creating
|
||||
another QWinOverlappedIoNotifier for that file, even with a duplicated
|
||||
handle, will fail.
|
||||
\li Certain Windows API functions are unavailable for file handles that are
|
||||
assigned to an I/O completion port. This includes the functions
|
||||
\c{ReadFileEx} and \c{WriteFileEx}.
|
||||
\endlist
|
||||
See also the remarks in the MSDN documentation for the
|
||||
\c{CreateIoCompletionPort} function.
|
||||
*/
|
||||
|
||||
struct IOResult
|
||||
|
@ -795,7 +795,11 @@ public:
|
||||
if (reserve) {
|
||||
if (reserve < 128)
|
||||
reserve = 128;
|
||||
size = qMax(size + reserve, size *2);
|
||||
size = qMax(size + reserve, qMin(size *2, (int)Value::MaxSize));
|
||||
if (size > Value::MaxSize) {
|
||||
qWarning("QJson: Document too large to store in data structure");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
char *raw = (char *)malloc(size);
|
||||
Q_CHECK_PTR(raw);
|
||||
|
@ -262,8 +262,45 @@ QJsonArray QJsonArray::fromStringList(const QStringList &list)
|
||||
QJsonArray QJsonArray::fromVariantList(const QVariantList &list)
|
||||
{
|
||||
QJsonArray array;
|
||||
for (QVariantList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it)
|
||||
array.append(QJsonValue::fromVariant(*it));
|
||||
if (list.isEmpty())
|
||||
return array;
|
||||
|
||||
array.detach2(1024);
|
||||
|
||||
QVector<QJsonPrivate::Value> values;
|
||||
values.resize(list.size());
|
||||
QJsonPrivate::Value *valueData = values.data();
|
||||
uint currentOffset = sizeof(QJsonPrivate::Base);
|
||||
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
QJsonValue val = QJsonValue::fromVariant(list.at(i));
|
||||
|
||||
bool latinOrIntValue;
|
||||
int valueSize = QJsonPrivate::Value::requiredStorage(val, &latinOrIntValue);
|
||||
|
||||
if (!array.detach2(valueSize))
|
||||
return QJsonArray();
|
||||
|
||||
QJsonPrivate::Value *v = valueData + i;
|
||||
v->type = (val.t == QJsonValue::Undefined ? QJsonValue::Null : val.t);
|
||||
v->latinOrIntValue = latinOrIntValue;
|
||||
v->latinKey = false;
|
||||
v->value = QJsonPrivate::Value::valueToStore(val, currentOffset);
|
||||
if (valueSize)
|
||||
QJsonPrivate::Value::copyData(val, (char *)array.a + currentOffset, latinOrIntValue);
|
||||
|
||||
currentOffset += valueSize;
|
||||
array.a->size = currentOffset;
|
||||
}
|
||||
|
||||
// write table
|
||||
array.a->tableOffset = currentOffset;
|
||||
if (!array.detach2(sizeof(QJsonPrivate::offset)*values.size()))
|
||||
return QJsonArray();
|
||||
memcpy(array.a->table(), values.constData(), values.size()*sizeof(uint));
|
||||
array.a->length = values.size();
|
||||
array.a->size = currentOffset + sizeof(QJsonPrivate::offset)*values.size();
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
@ -388,7 +425,7 @@ void QJsonArray::removeAt(int i)
|
||||
if (!a || i < 0 || i >= (int)a->length)
|
||||
return;
|
||||
|
||||
detach();
|
||||
detach2();
|
||||
a->removeItems(i, 1);
|
||||
++d->compactionCounter;
|
||||
if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(a->length) / 2u)
|
||||
@ -448,7 +485,8 @@ void QJsonArray::insert(int i, const QJsonValue &value)
|
||||
bool compressed;
|
||||
int valueSize = QJsonPrivate::Value::requiredStorage(val, &compressed);
|
||||
|
||||
detach(valueSize + sizeof(QJsonPrivate::Value));
|
||||
if (!detach2(valueSize + sizeof(QJsonPrivate::Value)))
|
||||
return;
|
||||
|
||||
if (!a->length)
|
||||
a->tableOffset = sizeof(QJsonPrivate::Array);
|
||||
@ -498,7 +536,8 @@ void QJsonArray::replace(int i, const QJsonValue &value)
|
||||
bool compressed;
|
||||
int valueSize = QJsonPrivate::Value::requiredStorage(val, &compressed);
|
||||
|
||||
detach(valueSize);
|
||||
if (!detach2(valueSize))
|
||||
return;
|
||||
|
||||
if (!a->length)
|
||||
a->tableOffset = sizeof(QJsonPrivate::Array);
|
||||
@ -1128,22 +1167,39 @@ bool QJsonArray::operator!=(const QJsonArray &other) const
|
||||
\internal
|
||||
*/
|
||||
void QJsonArray::detach(uint reserve)
|
||||
{
|
||||
Q_UNUSED(reserve)
|
||||
Q_ASSERT(!reserve);
|
||||
detach2(0);
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
bool QJsonArray::detach2(uint reserve)
|
||||
{
|
||||
if (!d) {
|
||||
if (reserve >= QJsonPrivate::Value::MaxSize) {
|
||||
qWarning("QJson: Document too large to store in data structure");
|
||||
return false;
|
||||
}
|
||||
d = new QJsonPrivate::Data(reserve, QJsonValue::Array);
|
||||
a = static_cast<QJsonPrivate::Array *>(d->header->root());
|
||||
d->ref.ref();
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
if (reserve == 0 && d->ref.load() == 1)
|
||||
return;
|
||||
return true;
|
||||
|
||||
QJsonPrivate::Data *x = d->clone(a, reserve);
|
||||
if (!x)
|
||||
return false;
|
||||
x->ref.ref();
|
||||
if (!d->ref.deref())
|
||||
delete d;
|
||||
d = x;
|
||||
a = static_cast<QJsonPrivate::Array *>(d->header->root());
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1154,7 +1210,7 @@ void QJsonArray::compact()
|
||||
if (!d || !d->compactionCounter)
|
||||
return;
|
||||
|
||||
detach();
|
||||
detach2();
|
||||
d->compact();
|
||||
a = static_cast<QJsonPrivate::Array *>(d->header->root());
|
||||
}
|
||||
|
@ -191,10 +191,10 @@ public:
|
||||
friend class const_iterator;
|
||||
|
||||
// stl style
|
||||
inline iterator begin() { detach(); return iterator(this, 0); }
|
||||
inline iterator begin() { detach2(); return iterator(this, 0); }
|
||||
inline const_iterator begin() const { return const_iterator(this, 0); }
|
||||
inline const_iterator constBegin() const { return const_iterator(this, 0); }
|
||||
inline iterator end() { detach(); return iterator(this, size()); }
|
||||
inline iterator end() { detach2(); return iterator(this, size()); }
|
||||
inline const_iterator end() const { return const_iterator(this, size()); }
|
||||
inline const_iterator constEnd() const { return const_iterator(this, size()); }
|
||||
iterator insert(iterator before, const QJsonValue &value) { insert(before.i, value); return before; }
|
||||
@ -235,7 +235,9 @@ private:
|
||||
QJsonArray(QJsonPrivate::Data *data, QJsonPrivate::Array *array);
|
||||
void initialize();
|
||||
void compact();
|
||||
// ### Qt 6: remove me and merge with detach2
|
||||
void detach(uint reserve = 0);
|
||||
bool detach2(uint reserve = 0);
|
||||
|
||||
QJsonPrivate::Data *d;
|
||||
QJsonPrivate::Array *a;
|
||||
|
@ -488,7 +488,7 @@ void QJsonDocument::setObject(const QJsonObject &object)
|
||||
if (d->compactionCounter)
|
||||
o.compact();
|
||||
else
|
||||
o.detach();
|
||||
o.detach2();
|
||||
d = o.d;
|
||||
d->ref.ref();
|
||||
return;
|
||||
@ -515,7 +515,7 @@ void QJsonDocument::setArray(const QJsonArray &array)
|
||||
if (d->compactionCounter)
|
||||
a.compact();
|
||||
else
|
||||
a.detach();
|
||||
a.detach2();
|
||||
d = a.d;
|
||||
d->ref.ref();
|
||||
return;
|
||||
|
@ -203,11 +203,54 @@ QJsonObject &QJsonObject::operator =(const QJsonObject &other)
|
||||
*/
|
||||
QJsonObject QJsonObject::fromVariantMap(const QVariantMap &map)
|
||||
{
|
||||
// ### this is implemented the trivial way, not the most efficient way
|
||||
|
||||
QJsonObject object;
|
||||
for (QVariantMap::const_iterator it = map.constBegin(); it != map.constEnd(); ++it)
|
||||
object.insert(it.key(), QJsonValue::fromVariant(it.value()));
|
||||
if (map.isEmpty())
|
||||
return object;
|
||||
|
||||
object.detach2(1024);
|
||||
|
||||
QVector<QJsonPrivate::offset> offsets;
|
||||
QJsonPrivate::offset currentOffset;
|
||||
currentOffset = sizeof(QJsonPrivate::Base);
|
||||
|
||||
// the map is already sorted, so we can simply append one entry after the other and
|
||||
// write the offset table at the end
|
||||
for (QVariantMap::const_iterator it = map.constBegin(); it != map.constEnd(); ++it) {
|
||||
QString key = it.key();
|
||||
QJsonValue val = QJsonValue::fromVariant(it.value());
|
||||
|
||||
bool latinOrIntValue;
|
||||
int valueSize = QJsonPrivate::Value::requiredStorage(val, &latinOrIntValue);
|
||||
|
||||
bool latinKey = QJsonPrivate::useCompressed(key);
|
||||
int valueOffset = sizeof(QJsonPrivate::Entry) + QJsonPrivate::qStringSize(key, latinKey);
|
||||
int requiredSize = valueOffset + valueSize;
|
||||
|
||||
if (!object.detach2(requiredSize + sizeof(QJsonPrivate::offset))) // offset for the new index entry
|
||||
return QJsonObject();
|
||||
|
||||
QJsonPrivate::Entry *e = reinterpret_cast<QJsonPrivate::Entry *>(reinterpret_cast<char *>(object.o) + currentOffset);
|
||||
e->value.type = val.t;
|
||||
e->value.latinKey = latinKey;
|
||||
e->value.latinOrIntValue = latinOrIntValue;
|
||||
e->value.value = QJsonPrivate::Value::valueToStore(val, (char *)e - (char *)object.o + valueOffset);
|
||||
QJsonPrivate::copyString((char *)(e + 1), key, latinKey);
|
||||
if (valueSize)
|
||||
QJsonPrivate::Value::copyData(val, (char *)e + valueOffset, latinOrIntValue);
|
||||
|
||||
offsets << currentOffset;
|
||||
currentOffset += requiredSize;
|
||||
object.o->size = currentOffset;
|
||||
}
|
||||
|
||||
// write table
|
||||
object.o->tableOffset = currentOffset;
|
||||
if (!object.detach2(sizeof(QJsonPrivate::offset)*offsets.size()))
|
||||
return QJsonObject();
|
||||
memcpy(object.o->table(), offsets.constData(), offsets.size()*sizeof(uint));
|
||||
object.o->length = offsets.size();
|
||||
object.o->size = currentOffset + sizeof(QJsonPrivate::offset)*offsets.size();
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
@ -276,16 +319,14 @@ QVariantHash QJsonObject::toVariantHash() const
|
||||
*/
|
||||
QStringList QJsonObject::keys() const
|
||||
{
|
||||
if (!d)
|
||||
return QStringList();
|
||||
|
||||
QStringList keys;
|
||||
keys.reserve(o->length);
|
||||
for (uint i = 0; i < o->length; ++i) {
|
||||
QJsonPrivate::Entry *e = o->entryAt(i);
|
||||
keys.append(e->key());
|
||||
if (o) {
|
||||
keys.reserve(o->length);
|
||||
for (uint i = 0; i < o->length; ++i) {
|
||||
QJsonPrivate::Entry *e = o->entryAt(i);
|
||||
keys.append(e->key());
|
||||
}
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
@ -397,7 +438,8 @@ QJsonObject::iterator QJsonObject::insert(const QString &key, const QJsonValue &
|
||||
int valueOffset = sizeof(QJsonPrivate::Entry) + QJsonPrivate::qStringSize(key, latinKey);
|
||||
int requiredSize = valueOffset + valueSize;
|
||||
|
||||
detach(requiredSize + sizeof(QJsonPrivate::offset)); // offset for the new index entry
|
||||
if (!detach2(requiredSize + sizeof(QJsonPrivate::offset))) // offset for the new index entry
|
||||
return iterator();
|
||||
|
||||
if (!o->length)
|
||||
o->tableOffset = sizeof(QJsonPrivate::Object);
|
||||
@ -441,7 +483,7 @@ void QJsonObject::remove(const QString &key)
|
||||
if (!keyExists)
|
||||
return;
|
||||
|
||||
detach();
|
||||
detach2();
|
||||
o->removeItems(index, 1);
|
||||
++d->compactionCounter;
|
||||
if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(o->length) / 2u)
|
||||
@ -468,7 +510,7 @@ QJsonValue QJsonObject::take(const QString &key)
|
||||
return QJsonValue(QJsonValue::Undefined);
|
||||
|
||||
QJsonValue v(d, o, o->entryAt(index)->value);
|
||||
detach();
|
||||
detach2();
|
||||
o->removeItems(index, 1);
|
||||
++d->compactionCounter;
|
||||
if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(o->length) / 2u)
|
||||
@ -562,7 +604,7 @@ QJsonObject::iterator QJsonObject::find(const QString &key)
|
||||
int index = o ? o->indexOf(key, &keyExists) : 0;
|
||||
if (!keyExists)
|
||||
return end();
|
||||
detach();
|
||||
detach2();
|
||||
return iterator(this, index);
|
||||
}
|
||||
|
||||
@ -1068,22 +1110,36 @@ QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const
|
||||
\internal
|
||||
*/
|
||||
void QJsonObject::detach(uint reserve)
|
||||
{
|
||||
Q_UNUSED(reserve)
|
||||
Q_ASSERT(!reserve);
|
||||
detach2(reserve);
|
||||
}
|
||||
|
||||
bool QJsonObject::detach2(uint reserve)
|
||||
{
|
||||
if (!d) {
|
||||
if (reserve >= QJsonPrivate::Value::MaxSize) {
|
||||
qWarning("QJson: Document too large to store in data structure");
|
||||
return false;
|
||||
}
|
||||
d = new QJsonPrivate::Data(reserve, QJsonValue::Object);
|
||||
o = static_cast<QJsonPrivate::Object *>(d->header->root());
|
||||
d->ref.ref();
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
if (reserve == 0 && d->ref.load() == 1)
|
||||
return;
|
||||
return true;
|
||||
|
||||
QJsonPrivate::Data *x = d->clone(o, reserve);
|
||||
if (!x)
|
||||
return false;
|
||||
x->ref.ref();
|
||||
if (!d->ref.deref())
|
||||
delete d;
|
||||
d = x;
|
||||
o = static_cast<QJsonPrivate::Object *>(d->header->root());
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1094,7 +1150,7 @@ void QJsonObject::compact()
|
||||
if (!d || !d->compactionCounter)
|
||||
return;
|
||||
|
||||
detach();
|
||||
detach2();
|
||||
d->compact();
|
||||
o = static_cast<QJsonPrivate::Object *>(d->header->root());
|
||||
}
|
||||
|
@ -188,10 +188,10 @@ public:
|
||||
friend class const_iterator;
|
||||
|
||||
// STL style
|
||||
inline iterator begin() { detach(); return iterator(this, 0); }
|
||||
inline iterator begin() { detach2(); return iterator(this, 0); }
|
||||
inline const_iterator begin() const { return const_iterator(this, 0); }
|
||||
inline const_iterator constBegin() const { return const_iterator(this, 0); }
|
||||
inline iterator end() { detach(); return iterator(this, size()); }
|
||||
inline iterator end() { detach2(); return iterator(this, size()); }
|
||||
inline const_iterator end() const { return const_iterator(this, size()); }
|
||||
inline const_iterator constEnd() const { return const_iterator(this, size()); }
|
||||
iterator erase(iterator it);
|
||||
@ -221,7 +221,9 @@ private:
|
||||
|
||||
QJsonObject(QJsonPrivate::Data *data, QJsonPrivate::Object *object);
|
||||
void initialize();
|
||||
// ### Qt 6: remove me and merge with detach2
|
||||
void detach(uint reserve = 0);
|
||||
bool detach2(uint reserve = 0);
|
||||
void compact();
|
||||
|
||||
QString keyAt(int i) const;
|
||||
|
@ -113,6 +113,7 @@ QAppleOperatingSystemVersion qt_apple_os_version()
|
||||
// Use temporary variables so we can return 0.0.0 (unknown version)
|
||||
// in case of an error partway through determining the OS version
|
||||
qint32 major = 0, minor = 0, patch = 0;
|
||||
#if QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_10_10, __IPHONE_8_0)
|
||||
#if defined(Q_OS_IOS)
|
||||
@autoreleasepool {
|
||||
NSArray *parts = [UIDevice.currentDevice.systemVersion componentsSeparatedByString:@"."];
|
||||
@ -135,6 +136,7 @@ QAppleOperatingSystemVersion qt_apple_os_version()
|
||||
return v;
|
||||
if (pGestalt('sys3', &patch) != 0)
|
||||
return v;
|
||||
#endif
|
||||
#endif
|
||||
v.major = major;
|
||||
v.minor = minor;
|
||||
|
@ -588,7 +588,8 @@ void QCoreApplicationPrivate::initLocale()
|
||||
This class is used by non-GUI applications to provide their event
|
||||
loop. For non-GUI application that uses Qt, there should be exactly
|
||||
one QCoreApplication object. For GUI applications, see
|
||||
QApplication.
|
||||
QGuiApplication. For applications that use the Qt Widgets module,
|
||||
see QApplication.
|
||||
|
||||
QCoreApplication contains the main event loop, where all events
|
||||
from the operating system (e.g., timer and network events) and
|
||||
@ -602,10 +603,10 @@ void QCoreApplicationPrivate::initLocale()
|
||||
operations can call processEvents() to keep the application
|
||||
responsive.
|
||||
|
||||
In general, we recommend that you create a QCoreApplication or a
|
||||
QApplication object in your \c main() function as early as
|
||||
possible. exec() will not return until the event loop exits; e.g.,
|
||||
when quit() is called.
|
||||
In general, we recommend that you create a QCoreApplication,
|
||||
QGuiApplication or a QApplication object in your \c main()
|
||||
function as early as possible. exec() will not return until
|
||||
the event loop exits; e.g., when quit() is called.
|
||||
|
||||
Several static convenience functions are also provided. The
|
||||
QCoreApplication object is available from instance(). Events can
|
||||
@ -647,8 +648,8 @@ void QCoreApplicationPrivate::initLocale()
|
||||
instance, when converting between data types such as floats and
|
||||
strings, since the notation may differ between locales. To get
|
||||
around this problem, call the POSIX function \c{setlocale(LC_NUMERIC,"C")}
|
||||
right after initializing QApplication or QCoreApplication to reset
|
||||
the locale that is used for number formatting to "C"-locale.
|
||||
right after initializing QApplication, QGuiApplication or QCoreApplication
|
||||
to reset the locale that is used for number formatting to "C"-locale.
|
||||
|
||||
\sa QGuiApplication, QAbstractEventDispatcher, QEventLoop,
|
||||
{Semaphores Example}, {Wait Conditions Example}
|
||||
@ -658,7 +659,7 @@ void QCoreApplicationPrivate::initLocale()
|
||||
\fn static QCoreApplication *QCoreApplication::instance()
|
||||
|
||||
Returns a pointer to the application's QCoreApplication (or
|
||||
QApplication) instance.
|
||||
QGuiApplication/QApplication) instance.
|
||||
|
||||
If no instance has been allocated, \c null is returned.
|
||||
*/
|
||||
@ -1865,7 +1866,7 @@ void QCoreApplication::quit()
|
||||
|
||||
Installing or removing a QTranslator, or changing an installed QTranslator
|
||||
generates a \l{QEvent::LanguageChange}{LanguageChange} event for the
|
||||
QCoreApplication instance. A QApplication instance will propagate the event
|
||||
QCoreApplication instance. A QGuiApplication instance will propagate the event
|
||||
to all toplevel windows, where a reimplementation of changeEvent can
|
||||
re-translate the user interface by passing user-visible strings via the
|
||||
tr() function to the respective property setters. User-interface classes
|
||||
|
@ -942,9 +942,8 @@ void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier)
|
||||
void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier)
|
||||
{
|
||||
Q_ASSERT(notifier);
|
||||
int sockfd = notifier->socket();
|
||||
int type = notifier->type();
|
||||
#ifndef QT_NO_DEBUG
|
||||
int sockfd = notifier->socket();
|
||||
if (sockfd < 0) {
|
||||
qWarning("QSocketNotifier: Internal error");
|
||||
return;
|
||||
@ -953,8 +952,16 @@ void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
doUnregisterSocketNotifier(notifier);
|
||||
}
|
||||
|
||||
void QEventDispatcherWin32::doUnregisterSocketNotifier(QSocketNotifier *notifier)
|
||||
{
|
||||
Q_D(QEventDispatcherWin32);
|
||||
int type = notifier->type();
|
||||
int sockfd = notifier->socket();
|
||||
Q_ASSERT(sockfd >= 0);
|
||||
|
||||
QSFDict::iterator it = d->active_fd.find(sockfd);
|
||||
if (it != d->active_fd.end()) {
|
||||
QSockFd &sd = it.value();
|
||||
@ -1210,11 +1217,11 @@ void QEventDispatcherWin32::closingDown()
|
||||
|
||||
// clean up any socketnotifiers
|
||||
while (!d->sn_read.isEmpty())
|
||||
unregisterSocketNotifier((*(d->sn_read.begin()))->obj);
|
||||
doUnregisterSocketNotifier((*(d->sn_read.begin()))->obj);
|
||||
while (!d->sn_write.isEmpty())
|
||||
unregisterSocketNotifier((*(d->sn_write.begin()))->obj);
|
||||
doUnregisterSocketNotifier((*(d->sn_write.begin()))->obj);
|
||||
while (!d->sn_except.isEmpty())
|
||||
unregisterSocketNotifier((*(d->sn_except.begin()))->obj);
|
||||
doUnregisterSocketNotifier((*(d->sn_except.begin()))->obj);
|
||||
Q_ASSERT(d->active_fd.isEmpty());
|
||||
|
||||
// clean up any timers
|
||||
|
@ -109,6 +109,7 @@ public:
|
||||
protected:
|
||||
QEventDispatcherWin32(QEventDispatcherWin32Private &dd, QObject *parent = 0);
|
||||
virtual void sendPostedEvents();
|
||||
void doUnregisterSocketNotifier(QSocketNotifier *notifier);
|
||||
|
||||
private:
|
||||
friend LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);
|
||||
|
@ -56,6 +56,7 @@ static jobject g_jClassLoader = Q_NULLPTR;
|
||||
static jint g_androidSdkVersion = 0;
|
||||
static jclass g_jNativeClass = Q_NULLPTR;
|
||||
static jmethodID g_runPendingCppRunnablesMethodID = Q_NULLPTR;
|
||||
static jmethodID g_hideSplashScreenMethodID = Q_NULLPTR;
|
||||
Q_GLOBAL_STATIC(std::deque<QtAndroidPrivate::Runnable>, g_pendingRunnables);
|
||||
Q_GLOBAL_STATIC(QMutex, g_pendingRunnablesMutex);
|
||||
|
||||
@ -338,7 +339,7 @@ jint QtAndroidPrivate::initJNI(JavaVM *vm, JNIEnv *env)
|
||||
g_runPendingCppRunnablesMethodID = env->GetStaticMethodID(jQtNative,
|
||||
"runPendingCppRunnablesOnUiThread",
|
||||
"()V");
|
||||
|
||||
g_hideSplashScreenMethodID = env->GetStaticMethodID(jQtNative, "hideSplashScreen", "()V");
|
||||
g_jNativeClass = static_cast<jclass>(env->NewGlobalRef(jQtNative));
|
||||
env->DeleteLocalRef(jQtNative);
|
||||
|
||||
@ -424,4 +425,9 @@ void QtAndroidPrivate::unregisterKeyEventListener(QtAndroidPrivate::KeyEventList
|
||||
g_keyEventListeners()->listeners.removeOne(listener);
|
||||
}
|
||||
|
||||
void QtAndroidPrivate::hideSplashScreen(JNIEnv *env)
|
||||
{
|
||||
env->CallStaticVoidMethod(g_jNativeClass, g_hideSplashScreenMethodID);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -127,6 +127,8 @@ namespace QtAndroidPrivate
|
||||
|
||||
Q_CORE_EXPORT void registerKeyEventListener(KeyEventListener *listener);
|
||||
Q_CORE_EXPORT void unregisterKeyEventListener(KeyEventListener *listener);
|
||||
|
||||
Q_CORE_EXPORT void hideSplashScreen(JNIEnv *env);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -234,14 +234,14 @@ QMimeMagicRule::QMimeMagicRule(const QString &type,
|
||||
m_matchFunction(nullptr)
|
||||
{
|
||||
if (m_type == Invalid)
|
||||
*errorString = QStringLiteral("Type %s is not supported").arg(type);
|
||||
*errorString = QLatin1String("Type ") + type + QLatin1String(" is not supported");
|
||||
|
||||
// Parse for offset as "1" or "1:10"
|
||||
const int colonIndex = offsets.indexOf(QLatin1Char(':'));
|
||||
const QString startPosStr = colonIndex == -1 ? offsets : offsets.mid(0, colonIndex);
|
||||
const QString endPosStr = colonIndex == -1 ? offsets : offsets.mid(colonIndex + 1);
|
||||
if (!QMimeTypeParserBase::parseNumber(startPosStr, &m_startPos, errorString) ||
|
||||
!QMimeTypeParserBase::parseNumber(endPosStr, &m_endPos, errorString)) {
|
||||
const QStringRef startPosStr = offsets.midRef(0, colonIndex); // \ These decay to returning 'offsets'
|
||||
const QStringRef endPosStr = offsets.midRef(colonIndex + 1);// / unchanged when colonIndex == -1
|
||||
if (Q_UNLIKELY(!QMimeTypeParserBase::parseNumber(startPosStr, &m_startPos, errorString)) ||
|
||||
Q_UNLIKELY(!QMimeTypeParserBase::parseNumber(endPosStr, &m_endPos, errorString))) {
|
||||
m_type = Invalid;
|
||||
return;
|
||||
}
|
||||
@ -249,7 +249,7 @@ QMimeMagicRule::QMimeMagicRule(const QString &type,
|
||||
if (m_value.isEmpty()) {
|
||||
m_type = Invalid;
|
||||
if (errorString)
|
||||
*errorString = QLatin1String("Invalid empty magic rule value");
|
||||
*errorString = QStringLiteral("Invalid empty magic rule value");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -259,8 +259,7 @@ QMimeMagicRule::QMimeMagicRule(const QString &type,
|
||||
if (!ok) {
|
||||
m_type = Invalid;
|
||||
if (errorString)
|
||||
*errorString = QString::fromLatin1("Invalid magic rule value \"%1\"").arg(
|
||||
QString::fromLatin1(m_value));
|
||||
*errorString = QLatin1String("Invalid magic rule value \"") + QLatin1String(m_value) + QLatin1Char('"');
|
||||
return;
|
||||
}
|
||||
m_numberMask = !m_mask.isEmpty() ? m_mask.toUInt(&ok, 0) : 0; // autodetect base
|
||||
@ -274,8 +273,7 @@ QMimeMagicRule::QMimeMagicRule(const QString &type,
|
||||
if (m_mask.size() < 4 || !m_mask.startsWith("0x")) {
|
||||
m_type = Invalid;
|
||||
if (errorString)
|
||||
*errorString = QString::fromLatin1("Invalid magic rule mask \"%1\"").arg(
|
||||
QString::fromLatin1(m_mask));
|
||||
*errorString = QLatin1String("Invalid magic rule mask \"") + QLatin1String(m_mask) + QLatin1Char('"');
|
||||
return;
|
||||
}
|
||||
const QByteArray &tempMask = QByteArray::fromHex(QByteArray::fromRawData(
|
||||
@ -283,8 +281,7 @@ QMimeMagicRule::QMimeMagicRule(const QString &type,
|
||||
if (tempMask.size() != m_pattern.size()) {
|
||||
m_type = Invalid;
|
||||
if (errorString)
|
||||
*errorString = QString::fromLatin1("Invalid magic rule mask size \"%1\"").arg(
|
||||
QString::fromLatin1(m_mask));
|
||||
*errorString = QLatin1String("Invalid magic rule mask size \"") + QLatin1String(m_mask) + QLatin1Char('"');
|
||||
return;
|
||||
}
|
||||
m_mask = tempMask;
|
||||
|
@ -160,25 +160,36 @@ QMimeTypeParserBase::ParseState QMimeTypeParserBase::nextState(ParseState curren
|
||||
}
|
||||
|
||||
// Parse int number from an (attribute) string
|
||||
bool QMimeTypeParserBase::parseNumber(const QString &n, int *target, QString *errorMessage)
|
||||
bool QMimeTypeParserBase::parseNumber(const QStringRef &n, int *target, QString *errorMessage)
|
||||
{
|
||||
bool ok;
|
||||
*target = n.toInt(&ok);
|
||||
if (!ok) {
|
||||
*errorMessage = QString::fromLatin1("Not a number '%1'.").arg(n);
|
||||
*errorMessage = QLatin1String("Not a number '") + n + QLatin1String("'.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_XMLSTREAMREADER
|
||||
static QMimeMagicRule *createMagicMatchRule(const QXmlStreamAttributes &atts, QString *errorMessage)
|
||||
struct CreateMagicMatchRuleResult {
|
||||
QString errorMessage; // must be first
|
||||
QMimeMagicRule rule;
|
||||
|
||||
CreateMagicMatchRuleResult(const QStringRef &type, const QStringRef &value, const QStringRef &offsets, const QStringRef &mask)
|
||||
: errorMessage(), rule(type.toString(), value.toUtf8(), offsets.toString(), mask.toLatin1(), &errorMessage)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
static CreateMagicMatchRuleResult createMagicMatchRule(const QXmlStreamAttributes &atts)
|
||||
{
|
||||
const QString type = atts.value(QLatin1String(matchTypeAttributeC)).toString();
|
||||
const QString value = atts.value(QLatin1String(matchValueAttributeC)).toString();
|
||||
const QString offsets = atts.value(QLatin1String(matchOffsetAttributeC)).toString();
|
||||
const QString mask = atts.value(QLatin1String(matchMaskAttributeC)).toString();
|
||||
return new QMimeMagicRule(type, value.toUtf8(), offsets, mask.toLatin1(), errorMessage);
|
||||
const QStringRef type = atts.value(QLatin1String(matchTypeAttributeC));
|
||||
const QStringRef value = atts.value(QLatin1String(matchValueAttributeC));
|
||||
const QStringRef offsets = atts.value(QLatin1String(matchOffsetAttributeC));
|
||||
const QStringRef mask = atts.value(QLatin1String(matchMaskAttributeC));
|
||||
return CreateMagicMatchRuleResult(type, value, offsets, mask);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -195,17 +206,16 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
|
||||
QList<QMimeMagicRule> rules; // toplevel rules
|
||||
QXmlStreamReader reader(dev);
|
||||
ParseState ps = ParseBeginning;
|
||||
QXmlStreamAttributes atts;
|
||||
while (!reader.atEnd()) {
|
||||
switch (reader.readNext()) {
|
||||
case QXmlStreamReader::StartElement:
|
||||
case QXmlStreamReader::StartElement: {
|
||||
ps = nextState(ps, reader.name());
|
||||
atts = reader.attributes();
|
||||
const QXmlStreamAttributes atts = reader.attributes();
|
||||
switch (ps) {
|
||||
case ParseMimeType: { // start parsing a MIME type name
|
||||
const QString name = atts.value(QLatin1String(mimeTypeAttributeC)).toString();
|
||||
if (name.isEmpty()) {
|
||||
reader.raiseError(QString::fromLatin1("Missing '%1'-attribute").arg(QString::fromLatin1(mimeTypeAttributeC)));
|
||||
reader.raiseError(QStringLiteral("Missing 'type'-attribute"));
|
||||
} else {
|
||||
data.name = name;
|
||||
}
|
||||
@ -219,8 +229,8 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
|
||||
break;
|
||||
case ParseGlobPattern: {
|
||||
const QString pattern = atts.value(QLatin1String(patternAttributeC)).toString();
|
||||
unsigned weight = atts.value(QLatin1String(weightAttributeC)).toString().toInt();
|
||||
const bool caseSensitive = atts.value(QLatin1String(caseSensitiveAttributeC)).toString() == QLatin1String("true");
|
||||
unsigned weight = atts.value(QLatin1String(weightAttributeC)).toInt();
|
||||
const bool caseSensitive = atts.value(QLatin1String(caseSensitiveAttributeC)) == QLatin1String("true");
|
||||
|
||||
if (weight == 0)
|
||||
weight = QMimeGlobPattern::DefaultWeight;
|
||||
@ -255,7 +265,7 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
|
||||
break;
|
||||
case ParseMagic: {
|
||||
priority = 50;
|
||||
const QString priorityS = atts.value(QLatin1String(priorityAttributeC)).toString();
|
||||
const QStringRef priorityS = atts.value(QLatin1String(priorityAttributeC));
|
||||
if (!priorityS.isEmpty()) {
|
||||
if (!parseNumber(priorityS, &priority, errorMessage))
|
||||
return false;
|
||||
@ -266,28 +276,27 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
|
||||
}
|
||||
break;
|
||||
case ParseMagicMatchRule: {
|
||||
QString magicErrorMessage;
|
||||
QMimeMagicRule *rule = createMagicMatchRule(atts, &magicErrorMessage);
|
||||
if (!rule->isValid())
|
||||
qWarning("QMimeDatabase: Error parsing %s\n%s", qPrintable(fileName), qPrintable(magicErrorMessage));
|
||||
auto result = createMagicMatchRule(atts);
|
||||
if (Q_UNLIKELY(!result.rule.isValid()))
|
||||
qWarning("QMimeDatabase: Error parsing %ls\n%ls",
|
||||
qUtf16Printable(fileName), qUtf16Printable(result.errorMessage));
|
||||
QList<QMimeMagicRule> *ruleList;
|
||||
if (currentRules.isEmpty())
|
||||
ruleList = &rules;
|
||||
else // nest this rule into the proper parent
|
||||
ruleList = ¤tRules.top()->m_subMatches;
|
||||
ruleList->append(*rule);
|
||||
ruleList->append(std::move(result.rule));
|
||||
//qDebug() << " MATCH added. Stack size was" << currentRules.size();
|
||||
currentRules.push(&ruleList->last());
|
||||
delete rule;
|
||||
break;
|
||||
}
|
||||
case ParseError:
|
||||
reader.raiseError(QString::fromLatin1("Unexpected element <%1>").
|
||||
arg(reader.name().toString()));
|
||||
reader.raiseError(QLatin1String("Unexpected element <") + reader.name() + QLatin1Char('>'));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
// continue switch QXmlStreamReader::Token...
|
||||
case QXmlStreamReader::EndElement: // Finished element
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
|
||||
bool parse(QIODevice *dev, const QString &fileName, QString *errorMessage);
|
||||
|
||||
static bool parseNumber(const QString &n, int *target, QString *errorMessage);
|
||||
static bool parseNumber(const QStringRef &n, int *target, QString *errorMessage);
|
||||
|
||||
protected:
|
||||
virtual bool process(const QMimeType &t, QString *errorMessage) = 0;
|
||||
|
@ -1029,7 +1029,7 @@ QString QCommandLineParser::helpText() const
|
||||
static QString wrapText(const QString &names, int longestOptionNameString, const QString &description)
|
||||
{
|
||||
const QLatin1Char nl('\n');
|
||||
QString text = QStringLiteral(" ") + names.leftJustified(longestOptionNameString) + QLatin1Char(' ');
|
||||
QString text = QLatin1String(" ") + names.leftJustified(longestOptionNameString) + QLatin1Char(' ');
|
||||
const int indent = text.length();
|
||||
int lineStart = 0;
|
||||
int lastBreakable = -1;
|
||||
|
@ -1181,7 +1181,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
|
||||
/*!
|
||||
\fn QPair<iterator, iterator> QMap::equal_range(const Key &key)
|
||||
|
||||
Returns a pair of iterators delimiting the range of values that
|
||||
Returns a pair of iterators delimiting the range of values \c{[first, second)}, that
|
||||
are stored under \a key.
|
||||
*/
|
||||
|
||||
|
@ -276,7 +276,6 @@ QByteArray QRingBuffer::read()
|
||||
if (tailBuffer == 0) {
|
||||
qba.resize(tail);
|
||||
tail = 0;
|
||||
buffers.append(QByteArray());
|
||||
} else {
|
||||
--tailBuffer;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/qatomic.h>
|
||||
#if QT_DEPRECATED_SINCE(5, 5)
|
||||
#if QT_DEPRECATED_SINCE(5, 6)
|
||||
#include <QtCore/qhash.h>
|
||||
#endif
|
||||
#include <QtCore/qhashfunctions.h>
|
||||
|
@ -63,7 +63,7 @@ QT_END_NAMESPACE
|
||||
#include <QtCore/qatomic.h>
|
||||
#include <QtCore/qobject.h> // for qobject_cast
|
||||
#include <QtCore/qdebug.h>
|
||||
#if QT_DEPRECATED_SINCE(5, 5)
|
||||
#if QT_DEPRECATED_SINCE(5, 6)
|
||||
#include <QtCore/qhash.h>
|
||||
#endif
|
||||
#include <QtCore/qhashfunctions.h>
|
||||
|
@ -378,7 +378,7 @@ void QWinTimeZonePrivate::init(const QByteArray &ianaId)
|
||||
m_standardName = readRegistryString(baseKey, L"Std");
|
||||
m_daylightName = readRegistryString(baseKey, L"Dlt");
|
||||
// On Vista and later the optional dynamic key holds historic data
|
||||
const QString dynamicKeyPath = baseKeyPath + QStringLiteral("\\Dynamic DST");
|
||||
const QString dynamicKeyPath = baseKeyPath + QLatin1String("\\Dynamic DST");
|
||||
HKEY dynamicKey = NULL;
|
||||
if (openRegistryKey(dynamicKeyPath, &dynamicKey)) {
|
||||
// Find out the start and end years stored, then iterate over them
|
||||
|
@ -49,6 +49,10 @@
|
||||
#include <QtDBus/qdbusextratypes.h>
|
||||
#include <QtDBus/qdbusconnection.h>
|
||||
|
||||
#ifdef interface
|
||||
#undef interface
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_DBUS
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -60,6 +60,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef interface
|
||||
#undef interface
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_DBUS
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <QtCore/qvariant.h>
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtDBus/qdbusmacros.h>
|
||||
#if QT_DEPRECATED_SINCE(5, 5)
|
||||
#if QT_DEPRECATED_SINCE(5, 6)
|
||||
#include <QtCore/qhash.h>
|
||||
#endif
|
||||
#include <QtCore/qhashfunctions.h>
|
||||
|
@ -69,6 +69,9 @@
|
||||
#include "qdbusthreaddebug_p.h"
|
||||
|
||||
#include <algorithm>
|
||||
#ifdef interface
|
||||
#undef interface
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_DBUS
|
||||
|
||||
|
@ -300,7 +300,7 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int
|
||||
|
||||
if (depth != 32) {
|
||||
ncols = bi.biClrUsed ? bi.biClrUsed : 1 << nbits;
|
||||
if (ncols > 256) // sanity check - don't run out of mem if color table is broken
|
||||
if (ncols < 1 || ncols > 256) // sanity check - don't run out of mem if color table is broken
|
||||
return false;
|
||||
image.setColorCount(ncols);
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ void QGIFFormat::disposePrevious(QImage *image)
|
||||
fillRect(image, l, t, r-l+1, b-t+1, color(bgcol));
|
||||
} else {
|
||||
// Impossible: We don't know of a bgcol - use pixel 0
|
||||
QRgb *bits = (QRgb*)image->bits();
|
||||
const QRgb *bits = reinterpret_cast<const QRgb *>(image->constBits());
|
||||
fillRect(image, l, t, r-l+1, b-t+1, bits[0]);
|
||||
}
|
||||
// ### Changed: QRect(l, t, r-l+1, b-t+1)
|
||||
@ -214,7 +214,7 @@ void QGIFFormat::disposePrevious(QImage *image)
|
||||
if (frame >= 0) {
|
||||
for (int ln=t; ln<=b; ln++) {
|
||||
memcpy(image->scanLine(ln)+l,
|
||||
backingstore.scanLine(ln-t),
|
||||
backingstore.constScanLine(ln-t),
|
||||
(r-l+1)*sizeof(QRgb));
|
||||
}
|
||||
// ### Changed: QRect(l, t, r-l+1, b-t+1)
|
||||
|
@ -144,7 +144,7 @@ public:
|
||||
QImage(const QImage &);
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
inline QImage(QImage &&other) Q_DECL_NOEXCEPT
|
||||
: QPaintDevice(), d(0)
|
||||
: QPaintDevice(), d(Q_NULLPTR)
|
||||
{ qSwap(d, other.d); }
|
||||
#endif
|
||||
~QImage();
|
||||
|
@ -195,6 +195,12 @@ inline QImage::Format qt_alphaVersion(QImage::Format format)
|
||||
return QImage::Format_ARGB32_Premultiplied;
|
||||
}
|
||||
|
||||
inline QImage::Format qt_maybeAlphaVersionWithSameDepth(QImage::Format format)
|
||||
{
|
||||
const QImage::Format toFormat = qt_alphaVersion(format);
|
||||
return qt_depthForFormat(format) == qt_depthForFormat(toFormat) ? toFormat : format;
|
||||
}
|
||||
|
||||
inline QImage::Format qt_alphaVersionForPainting(QImage::Format format)
|
||||
{
|
||||
QImage::Format toFormat = qt_alphaVersion(format);
|
||||
|
@ -189,7 +189,7 @@ void QBlittablePlatformPixmap::fromImage(const QImage &image,
|
||||
correctFormatPic = correctFormatPic.convertToFormat(thisImg->format(), flags);
|
||||
|
||||
uchar *mem = thisImg->bits();
|
||||
const uchar *bits = correctFormatPic.bits();
|
||||
const uchar *bits = correctFormatPic.constBits();
|
||||
int bytesCopied = 0;
|
||||
while (bytesCopied < correctFormatPic.byteCount()) {
|
||||
memcpy(mem,bits,correctFormatPic.bytesPerLine());
|
||||
|
@ -204,7 +204,7 @@ Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap)
|
||||
QScopedArrayPointer<uchar> bits(new uchar[bpl * h]);
|
||||
bm.invertPixels();
|
||||
for (int y = 0; y < h; ++y)
|
||||
memcpy(bits.data() + y * bpl, bm.scanLine(y), bpl);
|
||||
memcpy(bits.data() + y * bpl, bm.constScanLine(y), bpl);
|
||||
HBITMAP hbm = CreateBitmap(w, h, 1, 1, bits.data());
|
||||
return hbm;
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy
|
||||
if (image.format() == QImage::Format_Indexed8) {
|
||||
QVector<QRgb> color = image.colorTable();
|
||||
for (uint y=0; y<h; y++) {
|
||||
uchar *b = image.scanLine(y);
|
||||
const uchar *b = image.constScanLine(y);
|
||||
uchar *p = buf;
|
||||
uchar *end = buf+bpl;
|
||||
if (gray) {
|
||||
@ -356,7 +356,7 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy
|
||||
}
|
||||
} else {
|
||||
for (uint y=0; y<h; y++) {
|
||||
uchar *b = image.scanLine(y);
|
||||
const uchar *b = image.constScanLine(y);
|
||||
uchar *p = buf;
|
||||
uchar *end = buf + bpl;
|
||||
if (gray) {
|
||||
@ -386,7 +386,7 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy
|
||||
uint bpl = w * 3;
|
||||
uchar *buf = new uchar[bpl];
|
||||
for (uint y=0; y<h; y++) {
|
||||
QRgb *b = (QRgb*)image.scanLine(y);
|
||||
const QRgb *b = reinterpret_cast<const QRgb *>(image.constScanLine(y));
|
||||
uchar *p = buf;
|
||||
uchar *end = buf+bpl;
|
||||
while (p < end) {
|
||||
|
@ -216,7 +216,7 @@ static bool write_xbm_image(const QImage &sourceImage, QIODevice *device, const
|
||||
char *p = buf;
|
||||
int bpl = (w+7)/8;
|
||||
for (int y = 0; y < h; ++y) {
|
||||
uchar *b = image.scanLine(y);
|
||||
const uchar *b = image.constScanLine(y);
|
||||
for (i = 0; i < bpl; ++i) {
|
||||
*p++ = '0'; *p++ = 'x';
|
||||
*p++ = hexrep[*b >> 4];
|
||||
|
@ -1104,7 +1104,7 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const
|
||||
|
||||
// build color table
|
||||
for(y=0; y<h; y++) {
|
||||
QRgb * yp = (QRgb *)image.scanLine(y);
|
||||
const QRgb *yp = reinterpret_cast<const QRgb *>(image.constScanLine(y));
|
||||
for(x=0; x<w; x++) {
|
||||
QRgb color = *(yp + x);
|
||||
if (!colorMap.contains(color))
|
||||
@ -1150,7 +1150,7 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const
|
||||
// write pixels, limit to 4 characters per pixel
|
||||
line.truncate(cpp*w);
|
||||
for(y=0; y<h; y++) {
|
||||
QRgb * yp = (QRgb *) image.scanLine(y);
|
||||
const QRgb *yp = reinterpret_cast<const QRgb *>(image.constScanLine(y));
|
||||
int cc = 0;
|
||||
for(x=0; x<w; x++) {
|
||||
int color = (int)(*(yp + x));
|
||||
|
@ -3586,6 +3586,7 @@ static inline void formatTouchEvent(QDebug d, const QTouchEvent &t)
|
||||
{
|
||||
d << "QTouchEvent(";
|
||||
QtDebugUtils::formatQEnum(d, t.type());
|
||||
d << " device: " << t.device()->name();
|
||||
d << " states: ";
|
||||
QtDebugUtils::formatQFlags(d, t.touchPointStates());
|
||||
d << ", " << t.touchPoints().size() << " points: " << t.touchPoints() << ')';
|
||||
|
@ -801,7 +801,7 @@ public:
|
||||
TouchPoint(const TouchPoint &other);
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
TouchPoint(TouchPoint &&other) Q_DECL_NOEXCEPT
|
||||
: d(0)
|
||||
: d(Q_NULLPTR)
|
||||
{ qSwap(d, other.d); }
|
||||
TouchPoint &operator=(TouchPoint &&other) Q_DECL_NOEXCEPT
|
||||
{ qSwap(d, other.d); return *this; }
|
||||
|
@ -53,6 +53,7 @@
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/qmargins.h>
|
||||
#include <QtCore/qmath.h>
|
||||
#include <QtCore/qrect.h>
|
||||
#include <QtCore/qvector.h>
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
@ -389,6 +390,24 @@ inline QRegion fromNativeLocalRegion(const QRegion &pixelRegion, const QWindow *
|
||||
return pointRegion;
|
||||
}
|
||||
|
||||
// When mapping expose events to Qt rects: round top/left towards the origin and
|
||||
// bottom/right away from the origin, making sure that we cover the whole window.
|
||||
inline QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QWindow *window)
|
||||
{
|
||||
if (!QHighDpiScaling::isActive())
|
||||
return pixelRegion;
|
||||
|
||||
const qreal scaleFactor = QHighDpiScaling::factor(window);
|
||||
QRegion pointRegion;
|
||||
foreach (const QRect &rect, pixelRegion.rects()) {
|
||||
const QPointF topLeftP = QPointF(rect.topLeft()) / scaleFactor;
|
||||
const QPointF bottomRightP = QPointF(rect.bottomRight()) / scaleFactor;
|
||||
pointRegion += QRect(QPoint(qFloor(topLeftP.x()), qFloor(topLeftP.y())),
|
||||
QPoint(qCeil(bottomRightP.x()), qCeil(bottomRightP.y())));
|
||||
}
|
||||
return pointRegion;
|
||||
}
|
||||
|
||||
inline QRegion toNativeLocalRegion(const QRegion &pointRegion, const QWindow *window)
|
||||
{
|
||||
if (!QHighDpiScaling::isActive())
|
||||
@ -454,6 +473,7 @@ QVector<T> fromNativePixels(const QVector<T> &pixelValues, const QWindow *window
|
||||
return pixelValues;
|
||||
|
||||
QVector<T> pointValues;
|
||||
pointValues.reserve(pixelValues.size());
|
||||
for (const T &pixelValue : pixelValues)
|
||||
pointValues.append(pixelValue / QHighDpiScaling::factor(window));
|
||||
return pointValues;
|
||||
@ -467,6 +487,7 @@ QVector<T> toNativePixels(const QVector<T> &pointValues, const QWindow *window)
|
||||
return pointValues;
|
||||
|
||||
QVector<T> pixelValues;
|
||||
pixelValues.reserve(pointValues.size());
|
||||
for (const T &pointValue : pointValues)
|
||||
pixelValues.append(pointValue * QHighDpiScaling::factor(window));
|
||||
return pixelValues;
|
||||
@ -506,6 +527,8 @@ namespace QHighDpi {
|
||||
template <typename T> inline
|
||||
T fromNativeLocalRegion(const T &value, ...) { return value; }
|
||||
template <typename T> inline
|
||||
T fromNativeLocalExposedRegion(const T &value, ...) { return value; }
|
||||
template <typename T> inline
|
||||
T toNativeLocalRegion(const T &value, ...) { return value; }
|
||||
|
||||
template <typename T> inline
|
||||
|
@ -60,7 +60,7 @@
|
||||
#include <QtGui/qopengl.h>
|
||||
#include <QtGui/qopenglversionfunctions.h>
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 5)
|
||||
#if QT_DEPRECATED_SINCE(5, 6)
|
||||
#include <QtCore/qhash.h>
|
||||
#endif
|
||||
#include <QtCore/qhashfunctions.h>
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "qplatformdialoghelper.h"
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QSharedData>
|
||||
#include <QtCore/QSettings>
|
||||
@ -257,7 +258,7 @@ void QColorDialogStaticData::readSettings()
|
||||
#ifndef QT_NO_SETTINGS
|
||||
const QSettings settings(QSettings::UserScope, QStringLiteral("QtProject"));
|
||||
for (int i = 0; i < int(CustomColorCount); ++i) {
|
||||
const QVariant v = settings.value(QStringLiteral("Qt/customColors/") + QString::number(i));
|
||||
const QVariant v = settings.value(QLatin1String("Qt/customColors/") + QString::number(i));
|
||||
if (v.isValid())
|
||||
customRgb[i] = v.toUInt();
|
||||
}
|
||||
@ -270,7 +271,7 @@ void QColorDialogStaticData::writeSettings() const
|
||||
if (!customSet) {
|
||||
QSettings settings(QSettings::UserScope, QStringLiteral("QtProject"));
|
||||
for (int i = 0; i < int(CustomColorCount); ++i)
|
||||
settings.setValue(QStringLiteral("Qt/customColors/") + QString::number(i), customRgb[i]);
|
||||
settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), customRgb[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -411,7 +412,8 @@ public:
|
||||
viewMode(QFileDialogOptions::Detail),
|
||||
fileMode(QFileDialogOptions::AnyFile),
|
||||
acceptMode(QFileDialogOptions::AcceptOpen),
|
||||
filters(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs)
|
||||
filters(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs),
|
||||
useDefaultNameFilters(true)
|
||||
{}
|
||||
|
||||
QFileDialogOptions::FileDialogOptions options;
|
||||
@ -423,6 +425,7 @@ public:
|
||||
QString labels[QFileDialogOptions::DialogLabelCount];
|
||||
QDir::Filters filters;
|
||||
QList<QUrl> sidebarUrls;
|
||||
bool useDefaultNameFilters;
|
||||
QStringList nameFilters;
|
||||
QStringList mimeTypeFilters;
|
||||
QString defaultSuffix;
|
||||
@ -534,14 +537,48 @@ QList<QUrl> QFileDialogOptions::sidebarUrls() const
|
||||
return d->sidebarUrls;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.7
|
||||
\internal
|
||||
The bool property useDefaultNameFilters indicates that no name filters have been
|
||||
set or that they are equivalent to \gui{All Files (*)}. If it is true, the
|
||||
platform can choose to hide the filter combo box.
|
||||
|
||||
\sa defaultNameFilterString().
|
||||
*/
|
||||
bool QFileDialogOptions::useDefaultNameFilters() const
|
||||
{
|
||||
return d->useDefaultNameFilters;
|
||||
}
|
||||
|
||||
void QFileDialogOptions::setUseDefaultNameFilters(bool dnf)
|
||||
{
|
||||
d->useDefaultNameFilters = dnf;
|
||||
}
|
||||
|
||||
void QFileDialogOptions::setNameFilters(const QStringList &filters)
|
||||
{
|
||||
d->useDefaultNameFilters = filters.size() == 1
|
||||
&& filters.first() == QFileDialogOptions::defaultNameFilterString();
|
||||
d->nameFilters = filters;
|
||||
}
|
||||
|
||||
QStringList QFileDialogOptions::nameFilters() const
|
||||
{
|
||||
return d->nameFilters;
|
||||
return d->useDefaultNameFilters ?
|
||||
QStringList(QFileDialogOptions::defaultNameFilterString()) : d->nameFilters;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.6
|
||||
\internal
|
||||
\return The translated default name filter string (\gui{All Files (*)}).
|
||||
\sa defaultNameFilters(), nameFilters()
|
||||
*/
|
||||
|
||||
QString QFileDialogOptions::defaultNameFilterString()
|
||||
{
|
||||
return QCoreApplication::translate("QFileDialog", "All Files (*)");
|
||||
}
|
||||
|
||||
void QFileDialogOptions::setMimeTypeFilters(const QStringList &filters)
|
||||
|
@ -349,6 +349,9 @@ public:
|
||||
void setSidebarUrls(const QList<QUrl> &urls);
|
||||
QList<QUrl> sidebarUrls() const;
|
||||
|
||||
bool useDefaultNameFilters() const;
|
||||
void setUseDefaultNameFilters(bool d);
|
||||
|
||||
void setNameFilters(const QStringList &filters);
|
||||
QStringList nameFilters() const;
|
||||
|
||||
@ -377,6 +380,8 @@ public:
|
||||
void setSupportedSchemes(const QStringList &schemes);
|
||||
QStringList supportedSchemes() const;
|
||||
|
||||
static QString defaultNameFilterString();
|
||||
|
||||
private:
|
||||
QSharedDataPointer<QFileDialogOptionsPrivate> d;
|
||||
};
|
||||
|
@ -490,8 +490,10 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co
|
||||
{
|
||||
QPlatformScreen *currentScreen = screen();
|
||||
QPlatformScreen *fallback = currentScreen;
|
||||
//QRect::center can return a value outside the rectangle if it's empty
|
||||
const QPoint center = newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center();
|
||||
// QRect::center can return a value outside the rectangle if it's empty.
|
||||
// Apply mapToGlobal() in case it is a foreign/embedded window.
|
||||
const QPoint center =
|
||||
mapToGlobal(newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center());
|
||||
|
||||
if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) {
|
||||
const auto screens = currentScreen->virtualSiblings();
|
||||
@ -550,8 +552,8 @@ static inline const QScreen *effectiveScreen(const QWindow *window)
|
||||
const QScreen *screen = window->screen();
|
||||
if (!screen)
|
||||
return QGuiApplication::primaryScreen();
|
||||
const QList<QScreen *> siblings = screen->virtualSiblings();
|
||||
#ifndef QT_NO_CURSOR
|
||||
const QList<QScreen *> siblings = screen->virtualSiblings();
|
||||
if (siblings.size() > 1) {
|
||||
const QPoint referencePoint = window->transientParent() ? window->transientParent()->geometry().center() : QCursor::pos();
|
||||
for (const QScreen *sibling : siblings) {
|
||||
|
@ -94,7 +94,8 @@ static QWindow* topLevelAt(const QPoint &pos)
|
||||
QBasicDrag::QBasicDrag() :
|
||||
m_restoreCursor(false), m_eventLoop(0),
|
||||
m_executed_drop_action(Qt::IgnoreAction), m_can_drop(false),
|
||||
m_drag(0), m_drag_icon_window(0), m_useCompositing(true)
|
||||
m_drag(0), m_drag_icon_window(0), m_useCompositing(true),
|
||||
m_screen(Q_NULLPTR)
|
||||
{
|
||||
}
|
||||
|
||||
@ -225,7 +226,7 @@ void QBasicDrag::startDrag()
|
||||
pos = QPoint();
|
||||
}
|
||||
#endif
|
||||
recreateShapedPixmapWindow(Q_NULLPTR, pos);
|
||||
recreateShapedPixmapWindow(m_screen, pos);
|
||||
enableEventFilter();
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,8 @@ protected:
|
||||
bool useCompositing() const { return m_useCompositing; }
|
||||
void setUseCompositing(bool on) { m_useCompositing = on; }
|
||||
|
||||
void setScreen(QScreen *screen) { m_screen = screen; }
|
||||
|
||||
Qt::DropAction executedDropAction() const { return m_executed_drop_action; }
|
||||
void setExecutedDropAction(Qt::DropAction da) { m_executed_drop_action = da; }
|
||||
|
||||
@ -115,6 +117,7 @@ private:
|
||||
QDrag *m_drag;
|
||||
QShapedPixmapWindow *m_drag_icon_window;
|
||||
bool m_useCompositing;
|
||||
QScreen *m_screen;
|
||||
};
|
||||
|
||||
class Q_GUI_EXPORT QSimpleDrag : public QBasicDrag
|
||||
|
@ -375,7 +375,7 @@ void QWindowPrivate::setTopLevelScreen(QScreen *newScreen, bool recreate)
|
||||
{
|
||||
Q_Q(QWindow);
|
||||
if (parentWindow) {
|
||||
qWarning() << this << '(' << newScreen << "): Attempt to set a screen on a child window.";
|
||||
qWarning() << q << '(' << newScreen << "): Attempt to set a screen on a child window.";
|
||||
return;
|
||||
}
|
||||
if (newScreen != topLevelScreen) {
|
||||
|
@ -588,7 +588,8 @@ void QWindowSystemInterface::handleThemeChange(QWindow *tlw)
|
||||
|
||||
void QWindowSystemInterface::handleExposeEvent(QWindow *tlw, const QRegion ®ion)
|
||||
{
|
||||
QWindowSystemInterfacePrivate::ExposeEvent *e = new QWindowSystemInterfacePrivate::ExposeEvent(tlw, QHighDpi::fromNativeLocalRegion(region, tlw));
|
||||
QWindowSystemInterfacePrivate::ExposeEvent *e =
|
||||
new QWindowSystemInterfacePrivate::ExposeEvent(tlw, QHighDpi::fromNativeLocalExposedRegion(region, tlw));
|
||||
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
|
||||
}
|
||||
|
||||
@ -874,7 +875,7 @@ Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::Keybo
|
||||
QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous);
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT bool qt_handleShortcutEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1)
|
||||
Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1)
|
||||
{
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
|
||||
@ -927,7 +928,7 @@ static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoi
|
||||
static QList<struct QWindowSystemInterface::TouchPoint> touchPointList(const QList<QTouchEvent::TouchPoint>& pointList)
|
||||
{
|
||||
QList<struct QWindowSystemInterface::TouchPoint> newList;
|
||||
|
||||
newList.reserve(pointList.size());
|
||||
for (const QTouchEvent::TouchPoint &p : pointList)
|
||||
newList.append(touchPoint(p));
|
||||
|
||||
|
@ -85,7 +85,7 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
|
||||
if (!glGetStringi)
|
||||
return;
|
||||
|
||||
GLint numExtensions;
|
||||
GLint numExtensions = 0;
|
||||
funcs->glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
|
||||
|
||||
for (int i = 0; i < numExtensions; ++i) {
|
||||
|
@ -410,7 +410,7 @@ public:
|
||||
void glVertexBindingDivisor(GLuint bindingindex, GLuint divisor);
|
||||
|
||||
private:
|
||||
static bool isInitialized(const QOpenGLExtraFunctionsPrivate *d) { return d != 0; }
|
||||
static bool isInitialized(const QOpenGLExtraFunctionsPrivate *d) { return d != Q_NULLPTR; }
|
||||
};
|
||||
|
||||
class QOpenGLExtraFunctionsPrivate : public QOpenGLFunctionsPrivate
|
||||
|
@ -3390,7 +3390,7 @@ QVector<float> QOpenGLShaderProgram::defaultInnerTessellationLevels() const
|
||||
#if defined(QT_OPENGL_4)
|
||||
Q_D(const QOpenGLShaderProgram);
|
||||
if (d->tessellationFuncs)
|
||||
d->tessellationFuncs->glGetFloatv(GL_PATCH_DEFAULT_OUTER_LEVEL, tessLevels.data());
|
||||
d->tessellationFuncs->glGetFloatv(GL_PATCH_DEFAULT_INNER_LEVEL, tessLevels.data());
|
||||
#endif
|
||||
return tessLevels;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 5)
|
||||
#if QT_DEPRECATED_SINCE(5, 6)
|
||||
#include <QtCore/qhash.h>
|
||||
#endif
|
||||
#include <QtCore/qhashfunctions.h>
|
||||
|
@ -112,7 +112,8 @@ void QBackingStore::flush(const QRegion ®ion, QWindow *win, const QPoint &off
|
||||
}
|
||||
#endif
|
||||
|
||||
d_ptr->platformBackingStore->flush(win, QHighDpi::toNativeLocalRegion(region, d_ptr->window), offset);
|
||||
d_ptr->platformBackingStore->flush(win, QHighDpi::toNativeLocalRegion(region, win),
|
||||
QHighDpi::toNativeLocalPosition(offset, win));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -3426,13 +3426,13 @@ static SourceFetchProc64 sourceFetch64[NBlendTypes][QImage::NImageFormats] = {
|
||||
static uint qt_gradient_pixel_fixed(const QGradientData *data, int fixed_pos)
|
||||
{
|
||||
int ipos = (fixed_pos + (FIXPT_SIZE / 2)) >> FIXPT_BITS;
|
||||
return data->colorTable[qt_gradient_clamp(data, ipos)].toArgb32();
|
||||
return data->colorTable32[qt_gradient_clamp(data, ipos)];
|
||||
}
|
||||
|
||||
static const QRgba64& qt_gradient_pixel64_fixed(const QGradientData *data, int fixed_pos)
|
||||
{
|
||||
int ipos = (fixed_pos + (FIXPT_SIZE / 2)) >> FIXPT_BITS;
|
||||
return data->colorTable[qt_gradient_clamp(data, ipos)];
|
||||
return data->colorTable64[qt_gradient_clamp(data, ipos)];
|
||||
}
|
||||
|
||||
static void QT_FASTCALL getLinearGradientValues(LinearGradientValues *v, const QSpanData *data)
|
||||
|
@ -274,7 +274,8 @@ struct QGradientData
|
||||
#define GRADIENT_STOPTABLE_SIZE 1024
|
||||
#define GRADIENT_STOPTABLE_SIZE_SHIFT 10
|
||||
|
||||
QRgba64* colorTable; //[GRADIENT_STOPTABLE_SIZE];
|
||||
const QRgba64 *colorTable64; //[GRADIENT_STOPTABLE_SIZE];
|
||||
const QRgb *colorTable32; //[GRADIENT_STOPTABLE_SIZE];
|
||||
|
||||
uint alphaColor : 1;
|
||||
};
|
||||
@ -382,13 +383,13 @@ static inline uint qt_gradient_clamp(const QGradientData *data, int ipos)
|
||||
static inline uint qt_gradient_pixel(const QGradientData *data, qreal pos)
|
||||
{
|
||||
int ipos = int(pos * (GRADIENT_STOPTABLE_SIZE - 1) + qreal(0.5));
|
||||
return data->colorTable[qt_gradient_clamp(data, ipos)].toArgb32();
|
||||
return data->colorTable32[qt_gradient_clamp(data, ipos)];
|
||||
}
|
||||
|
||||
static inline const QRgba64& qt_gradient_pixel64(const QGradientData *data, qreal pos)
|
||||
{
|
||||
int ipos = int(pos * (GRADIENT_STOPTABLE_SIZE - 1) + qreal(0.5));
|
||||
return data->colorTable[qt_gradient_clamp(data, ipos)];
|
||||
return data->colorTable64[qt_gradient_clamp(data, ipos)];
|
||||
}
|
||||
|
||||
static inline qreal qRadialDeterminant(qreal a, qreal b, qreal c)
|
||||
@ -556,7 +557,7 @@ public:
|
||||
delta_det4_vec.v = Simd::v_add(delta_det4_vec.v, v_delta_delta_det16); \
|
||||
b_vec.v = Simd::v_add(b_vec.v, v_delta_b4); \
|
||||
for (int i = 0; i < 4; ++i) \
|
||||
*buffer++ = (extended_mask | v_buffer_mask.i[i]) & data->gradient.colorTable[index_vec.i[i]].toArgb32(); \
|
||||
*buffer++ = (extended_mask | v_buffer_mask.i[i]) & data->gradient.colorTable32[index_vec.i[i]]; \
|
||||
}
|
||||
|
||||
#define FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP) \
|
||||
|
@ -689,6 +689,7 @@ void QRasterPaintEngine::penChanged()
|
||||
qDebug() << "QRasterPaintEngine::penChanged():" << state()->pen;
|
||||
#endif
|
||||
QRasterPaintEngineState *s = state();
|
||||
Q_ASSERT(s);
|
||||
s->strokeFlags |= DirtyPen;
|
||||
s->dirty |= DirtyPen;
|
||||
}
|
||||
@ -2200,6 +2201,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
|
||||
|
||||
Q_D(QRasterPaintEngine);
|
||||
QRasterPaintEngineState *s = state();
|
||||
Q_ASSERT(s);
|
||||
int sr_l = qFloor(sr.left());
|
||||
int sr_r = qCeil(sr.right()) - 1;
|
||||
int sr_t = qFloor(sr.top());
|
||||
@ -2437,6 +2439,7 @@ void QRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap,
|
||||
#endif
|
||||
Q_D(QRasterPaintEngine);
|
||||
QRasterPaintEngineState *s = state();
|
||||
Q_ASSERT(s);
|
||||
|
||||
QImage image;
|
||||
|
||||
@ -3616,7 +3619,7 @@ QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color)
|
||||
{
|
||||
Q_ASSERT(image.depth() == 1);
|
||||
|
||||
QImage sourceImage = image.convertToFormat(QImage::Format_MonoLSB);
|
||||
const QImage sourceImage = image.convertToFormat(QImage::Format_MonoLSB);
|
||||
QImage dest = QImage(sourceImage.size(), QImage::Format_ARGB32_Premultiplied);
|
||||
|
||||
QRgb fg = qPremultiply(color.rgba());
|
||||
@ -3625,7 +3628,7 @@ QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color)
|
||||
int height = sourceImage.height();
|
||||
int width = sourceImage.width();
|
||||
for (int y=0; y<height; ++y) {
|
||||
uchar *source = sourceImage.scanLine(y);
|
||||
const uchar *source = sourceImage.constScanLine(y);
|
||||
QRgb *target = reinterpret_cast<QRgb *>(dest.scanLine(y));
|
||||
if (!source || !target)
|
||||
QT_THROW(std::bad_alloc()); // we must have run out of memory
|
||||
@ -4144,7 +4147,8 @@ class QGradientCache
|
||||
{
|
||||
inline CacheInfo(QGradientStops s, int op, QGradient::InterpolationMode mode) :
|
||||
stops(qMove(s)), opacity(op), interpolationMode(mode) {}
|
||||
QRgba64 buffer[GRADIENT_STOPTABLE_SIZE];
|
||||
QRgba64 buffer64[GRADIENT_STOPTABLE_SIZE];
|
||||
QRgb buffer32[GRADIENT_STOPTABLE_SIZE];
|
||||
QGradientStops stops;
|
||||
int opacity;
|
||||
QGradient::InterpolationMode interpolationMode;
|
||||
@ -4153,7 +4157,9 @@ class QGradientCache
|
||||
typedef QMultiHash<quint64, CacheInfo> QGradientColorTableHash;
|
||||
|
||||
public:
|
||||
inline const QRgba64 *getBuffer(const QGradient &gradient, int opacity) {
|
||||
typedef QPair<const QRgb *, const QRgba64 *> ColorBufferPair;
|
||||
|
||||
inline ColorBufferPair getBuffer(const QGradient &gradient, int opacity) {
|
||||
quint64 hash_val = 0;
|
||||
|
||||
const QGradientStops stops = gradient.stops();
|
||||
@ -4169,7 +4175,8 @@ public:
|
||||
do {
|
||||
const CacheInfo &cache_info = it.value();
|
||||
if (cache_info.stops == stops && cache_info.opacity == opacity && cache_info.interpolationMode == gradient.interpolationMode())
|
||||
return cache_info.buffer;
|
||||
return qMakePair(reinterpret_cast<const QRgb *>(cache_info.buffer32),
|
||||
reinterpret_cast<const QRgba64 *>(cache_info.buffer64));
|
||||
++it;
|
||||
} while (it != cache.constEnd() && it.key() == hash_val);
|
||||
// an exact match for these stops and opacity was not found, create new cache
|
||||
@ -4183,14 +4190,18 @@ protected:
|
||||
inline void generateGradientColorTable(const QGradient& g,
|
||||
QRgba64 *colorTable,
|
||||
int size, int opacity) const;
|
||||
QRgba64 *addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) {
|
||||
ColorBufferPair addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) {
|
||||
if (cache.size() == maxCacheSize()) {
|
||||
// may remove more than 1, but OK
|
||||
cache.erase(cache.begin() + (qrand() % maxCacheSize()));
|
||||
}
|
||||
CacheInfo cache_entry(gradient.stops(), opacity, gradient.interpolationMode());
|
||||
generateGradientColorTable(gradient, cache_entry.buffer, paletteSize(), opacity);
|
||||
return cache.insert(hash_val, cache_entry).value().buffer;
|
||||
generateGradientColorTable(gradient, cache_entry.buffer64, paletteSize(), opacity);
|
||||
for (int i = 0; i < GRADIENT_STOPTABLE_SIZE; ++i)
|
||||
cache_entry.buffer32[i] = cache_entry.buffer64[i].toArgb32();
|
||||
CacheInfo &cache_value = cache.insert(hash_val, cache_entry).value();
|
||||
return qMakePair(reinterpret_cast<const QRgb *>(cache_value.buffer32),
|
||||
reinterpret_cast<const QRgba64 *>(cache_value.buffer64));
|
||||
}
|
||||
|
||||
QGradientColorTableHash cache;
|
||||
@ -4424,7 +4435,11 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
|
||||
type = LinearGradient;
|
||||
const QLinearGradient *g = static_cast<const QLinearGradient *>(brush.gradient());
|
||||
gradient.alphaColor = !brush.isOpaque() || alpha != 256;
|
||||
gradient.colorTable = const_cast<QRgba64*>(qt_gradient_cache()->getBuffer(*g, alpha));
|
||||
|
||||
QGradientCache::ColorBufferPair colorBuffers = qt_gradient_cache()->getBuffer(*g, alpha);
|
||||
gradient.colorTable64 = colorBuffers.second;
|
||||
gradient.colorTable32 = colorBuffers.first;
|
||||
|
||||
gradient.spread = g->spread();
|
||||
|
||||
QLinearGradientData &linearData = gradient.linear;
|
||||
@ -4441,7 +4456,11 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
|
||||
type = RadialGradient;
|
||||
const QRadialGradient *g = static_cast<const QRadialGradient *>(brush.gradient());
|
||||
gradient.alphaColor = !brush.isOpaque() || alpha != 256;
|
||||
gradient.colorTable = const_cast<QRgba64*>(qt_gradient_cache()->getBuffer(*g, alpha));
|
||||
|
||||
QGradientCache::ColorBufferPair colorBuffers = qt_gradient_cache()->getBuffer(*g, alpha);
|
||||
gradient.colorTable64 = colorBuffers.second;
|
||||
gradient.colorTable32 = colorBuffers.first;
|
||||
|
||||
gradient.spread = g->spread();
|
||||
|
||||
QRadialGradientData &radialData = gradient.radial;
|
||||
@ -4462,7 +4481,11 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
|
||||
type = ConicalGradient;
|
||||
const QConicalGradient *g = static_cast<const QConicalGradient *>(brush.gradient());
|
||||
gradient.alphaColor = !brush.isOpaque() || alpha != 256;
|
||||
gradient.colorTable = const_cast<QRgba64*>(qt_gradient_cache()->getBuffer(*g, alpha));
|
||||
|
||||
QGradientCache::ColorBufferPair colorBuffers = qt_gradient_cache()->getBuffer(*g, alpha);
|
||||
gradient.colorTable64 = colorBuffers.second;
|
||||
gradient.colorTable32 = colorBuffers.first;
|
||||
|
||||
gradient.spread = QGradient::RepeatSpread;
|
||||
|
||||
QConicalGradientData &conicalData = gradient.conical;
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
QPen &operator=(const QPen &pen) Q_DECL_NOTHROW;
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
QPen(QPen &&other) Q_DECL_NOTHROW
|
||||
: d(other.d) { other.d = 0; }
|
||||
: d(other.d) { other.d = Q_NULLPTR; }
|
||||
QPen &operator=(QPen &&other) Q_DECL_NOTHROW
|
||||
{ qSwap(d, other.d); return *this; }
|
||||
#endif
|
||||
|
@ -269,12 +269,14 @@ static inline QRect toBottomLeftRect(const QRect &topLeftRect, int windowHeight)
|
||||
static void blitTextureForWidget(const QPlatformTextureList *textures, int idx, QWindow *window, const QRect &deviceWindowRect,
|
||||
QOpenGLTextureBlitter *blitter, const QPoint &offset)
|
||||
{
|
||||
const QRect clipRect = textures->clipRect(idx);
|
||||
if (clipRect.isEmpty())
|
||||
return;
|
||||
|
||||
QRect rectInWindow = textures->geometry(idx);
|
||||
// relative to the TLW, not necessarily our window (if the flush is for a native child widget), have to adjust
|
||||
rectInWindow.translate(-offset);
|
||||
QRect clipRect = textures->clipRect(idx);
|
||||
if (clipRect.isEmpty())
|
||||
clipRect = QRect(QPoint(0, 0), rectInWindow.size());
|
||||
|
||||
const QRect clippedRectInWindow = rectInWindow & clipRect.translated(rectInWindow.topLeft());
|
||||
const QRect srcRect = toBottomLeftRect(clipRect, rectInWindow.height());
|
||||
|
||||
@ -520,7 +522,23 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textu
|
||||
if (needsConversion)
|
||||
image = image.convertToFormat(QImage::Format_RGBA8888);
|
||||
|
||||
// The image provided by the backingstore may have a stride larger than width * 4, for
|
||||
// instance on platforms that manually implement client-side decorations.
|
||||
static const int bytesPerPixel = 4;
|
||||
const int strideInPixels = image.bytesPerLine() / bytesPerPixel;
|
||||
const bool hasUnpackRowLength = !ctx->isOpenGLES() || ctx->format().majorVersion() >= 3;
|
||||
|
||||
QOpenGLFunctions *funcs = ctx->functions();
|
||||
|
||||
if (hasUnpackRowLength) {
|
||||
funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, strideInPixels);
|
||||
} else if (strideInPixels != image.width()) {
|
||||
// No UNPACK_ROW_LENGTH on ES 2.0 and yet we would need it. This case is typically
|
||||
// hit with QtWayland which is rarely used in combination with a ES2.0-only GL
|
||||
// implementation. Therefore, accept the performance hit and do a copy.
|
||||
image = image.copy();
|
||||
}
|
||||
|
||||
if (resized) {
|
||||
if (d_ptr->textureId)
|
||||
funcs->glDeleteTextures(1, &d_ptr->textureId);
|
||||
@ -542,11 +560,9 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textu
|
||||
QRect imageRect = image.rect();
|
||||
QRect rect = dirtyRegion.boundingRect() & imageRect;
|
||||
|
||||
if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
|
||||
funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, image.width());
|
||||
if (hasUnpackRowLength) {
|
||||
funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, pixelType,
|
||||
image.constScanLine(rect.y()) + rect.x() * 4);
|
||||
funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
image.constScanLine(rect.y()) + rect.x() * bytesPerPixel);
|
||||
} else {
|
||||
// if the rect is wide enough it's cheaper to just
|
||||
// extend it instead of doing an image copy
|
||||
@ -568,6 +584,9 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textu
|
||||
}
|
||||
}
|
||||
|
||||
if (hasUnpackRowLength)
|
||||
funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
|
||||
return d_ptr->textureId;
|
||||
}
|
||||
#endif // QT_NO_OPENGL
|
||||
|
@ -3751,7 +3751,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
|
||||
|
||||
QRegionPrivate *qt_bitmapToRegion(const QBitmap& bitmap)
|
||||
{
|
||||
QImage image = bitmap.toImage();
|
||||
const QImage image = bitmap.toImage();
|
||||
|
||||
QRegionPrivate *region = new QRegionPrivate;
|
||||
|
||||
@ -3769,7 +3769,7 @@ QRegionPrivate *qt_bitmapToRegion(const QBitmap& bitmap)
|
||||
int x,
|
||||
y;
|
||||
for (y = 0; y < image.height(); ++y) {
|
||||
uchar *line = image.scanLine(y);
|
||||
const uchar *line = image.constScanLine(y);
|
||||
int w = image.width();
|
||||
uchar all = zero;
|
||||
int prev1 = -1;
|
||||
|
@ -345,7 +345,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP
|
||||
uchar *dest = d + (c.y + y) *dbpl + c.x/8;
|
||||
|
||||
if (y < mh) {
|
||||
uchar *src = mask.scanLine(y);
|
||||
const uchar *src = mask.constScanLine(y);
|
||||
for (int x = 0; x < c.w/8; ++x) {
|
||||
if (x < (mw+7)/8)
|
||||
dest[x] = src[x];
|
||||
@ -367,7 +367,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP
|
||||
for (int y = 0; y < c.h; ++y) {
|
||||
uchar *dest = d + (c.y + y) *dbpl + c.x;
|
||||
if (y < mh) {
|
||||
uchar *src = (uchar *) mask.scanLine(y);
|
||||
const uchar *src = mask.constScanLine(y);
|
||||
for (int x = 0; x < c.w; ++x) {
|
||||
if (x < mw)
|
||||
dest[x] = (src[x >> 3] & (1 << (7 - (x & 7)))) > 0 ? 255 : 0;
|
||||
@ -378,7 +378,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP
|
||||
for (int y = 0; y < c.h; ++y) {
|
||||
uchar *dest = d + (c.y + y) *dbpl + c.x;
|
||||
if (y < mh) {
|
||||
uchar *src = (uchar *) mask.scanLine(y);
|
||||
const uchar *src = mask.constScanLine(y);
|
||||
for (int x = 0; x < c.w; ++x) {
|
||||
if (x < mw)
|
||||
dest[x] = src[x];
|
||||
|
@ -829,7 +829,7 @@ void QFontEngine::addBitmapFontToPath(qreal x, qreal y, const QGlyphLayout &glyp
|
||||
}
|
||||
}
|
||||
}
|
||||
const uchar *bitmap_data = bitmap.bits();
|
||||
const uchar *bitmap_data = bitmap.constBits();
|
||||
QFixedPoint offset = glyphs.offsets[i];
|
||||
advanceX += offset.x;
|
||||
advanceY += offset.y;
|
||||
@ -886,12 +886,12 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, con
|
||||
|
||||
QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/, const QTransform &t)
|
||||
{
|
||||
QImage alphaMask = alphaMapForGlyph(glyph, t);
|
||||
const QImage alphaMask = alphaMapForGlyph(glyph, t);
|
||||
QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32);
|
||||
|
||||
for (int y=0; y<alphaMask.height(); ++y) {
|
||||
uint *dst = (uint *) rgbMask.scanLine(y);
|
||||
uchar *src = (uchar *) alphaMask.scanLine(y);
|
||||
const uchar *src = alphaMask.constScanLine(y);
|
||||
for (int x=0; x<alphaMask.width(); ++x) {
|
||||
int val = src[x];
|
||||
dst[x] = qRgb(val, val, val);
|
||||
@ -979,7 +979,7 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph)
|
||||
|
||||
for (int y=0; y<im.height(); ++y) {
|
||||
uchar *dst = (uchar *) alphaMap.scanLine(y);
|
||||
uint *src = (uint *) im.scanLine(y);
|
||||
const uint *src = reinterpret_cast<const uint *>(im.constScanLine(y));
|
||||
for (int x=0; x<im.width(); ++x)
|
||||
dst[x] = qAlpha(src[x]);
|
||||
}
|
||||
|
@ -1261,7 +1261,7 @@ QFixed QFontEngineFT::xHeight() const
|
||||
TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
|
||||
if (os2 && os2->sxHeight) {
|
||||
lockFace();
|
||||
QFixed answer = QFixed(os2->sxHeight*freetype->face->size->metrics.y_ppem)/freetype->face->units_per_EM;
|
||||
QFixed answer = QFixed(os2->sxHeight * freetype->face->size->metrics.y_ppem) / emSquareSize();
|
||||
unlockFace();
|
||||
return answer;
|
||||
}
|
||||
@ -1273,7 +1273,7 @@ QFixed QFontEngineFT::averageCharWidth() const
|
||||
TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
|
||||
if (os2 && os2->xAvgCharWidth) {
|
||||
lockFace();
|
||||
QFixed answer = QFixed(os2->xAvgCharWidth*freetype->face->size->metrics.x_ppem)/freetype->face->units_per_EM;
|
||||
QFixed answer = QFixed(os2->xAvgCharWidth * freetype->face->size->metrics.x_ppem) / emSquareSize();
|
||||
unlockFace();
|
||||
return answer;
|
||||
}
|
||||
@ -1301,7 +1301,7 @@ void QFontEngineFT::doKerning(QGlyphLayout *g, QFontEngine::ShaperFlags flags) c
|
||||
kerning_pairs_loaded = true;
|
||||
lockFace();
|
||||
if (freetype->face->size->metrics.x_ppem != 0) {
|
||||
QFixed scalingFactor(freetype->face->units_per_EM/freetype->face->size->metrics.x_ppem);
|
||||
QFixed scalingFactor = emSquareSize() / QFixed(freetype->face->size->metrics.x_ppem);
|
||||
unlockFace();
|
||||
const_cast<QFontEngineFT *>(this)->loadKerningPairs(scalingFactor);
|
||||
} else {
|
||||
@ -1725,8 +1725,8 @@ static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEng
|
||||
if (glyph == Q_NULLPTR)
|
||||
return QImage();
|
||||
|
||||
QImage::Format format;
|
||||
int bytesPerLine;
|
||||
QImage::Format format = QImage::Format_Invalid;
|
||||
int bytesPerLine = -1;
|
||||
switch (glyphFormat) {
|
||||
case QFontEngine::Format_Mono:
|
||||
format = QImage::Format_Mono;
|
||||
|
@ -795,7 +795,7 @@ QRect QFontMetrics::boundingRect(const QRect &rect, int flags, const QString &te
|
||||
\li Qt::TextSingleLine ignores newline characters.
|
||||
\li Qt::TextExpandTabs expands tabs (see below)
|
||||
\li Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined.
|
||||
\li Qt::TextWordBreak breaks the text to fit the rectangle.
|
||||
\li Qt::TextWordWrap breaks the text to fit the rectangle.
|
||||
\endlist
|
||||
|
||||
If Qt::TextExpandTabs is set in \a flags, then: if \a tabArray is
|
||||
@ -1579,7 +1579,7 @@ QRectF QFontMetricsF::boundingRect(const QRectF &rect, int flags, const QString&
|
||||
\li Qt::TextSingleLine ignores newline characters.
|
||||
\li Qt::TextExpandTabs expands tabs (see below)
|
||||
\li Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined.
|
||||
\li Qt::TextWordBreak breaks the text to fit the rectangle.
|
||||
\li Qt::TextWordWrap breaks the text to fit the rectangle.
|
||||
\endlist
|
||||
|
||||
These flags are defined in the \l{Qt::TextFlag} enum.
|
||||
|
@ -624,6 +624,7 @@ static QTtfTable generateName(const QVector<QTtfNameRecord> &name);
|
||||
static QTtfTable generateName(const qttf_name_table &name)
|
||||
{
|
||||
QVector<QTtfNameRecord> list;
|
||||
list.reserve(5);
|
||||
QTtfNameRecord rec;
|
||||
rec.nameId = 0;
|
||||
rec.value = name.copyright;
|
||||
@ -1061,6 +1062,7 @@ static QVector<QTtfTable> generateGlyphTables(qttf_font_tables &tables, const QV
|
||||
Q_ASSERT(hmtx.data.size() == hs.offset());
|
||||
|
||||
QVector<QTtfTable> list;
|
||||
list.reserve(3);
|
||||
list.append(glyf);
|
||||
list.append(loca);
|
||||
list.append(hmtx);
|
||||
|
@ -1078,8 +1078,8 @@ QTextCursor::QTextCursor(const QTextBlock &block)
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
QTextCursor::QTextCursor(QTextDocumentPrivate &p, int pos)
|
||||
: d(new QTextCursorPrivate(&p))
|
||||
QTextCursor::QTextCursor(QTextDocumentPrivate *p, int pos)
|
||||
: d(new QTextCursorPrivate(p))
|
||||
{
|
||||
d->adjusted_anchor = d->anchor = d->position = pos;
|
||||
|
||||
|
@ -67,6 +67,8 @@ class Q_GUI_EXPORT QTextCursor
|
||||
public:
|
||||
QTextCursor();
|
||||
explicit QTextCursor(QTextDocument *document);
|
||||
QTextCursor(QTextDocumentPrivate *p, int pos);
|
||||
explicit QTextCursor(QTextCursorPrivate *d);
|
||||
explicit QTextCursor(QTextFrame *frame);
|
||||
explicit QTextCursor(const QTextBlock &block);
|
||||
QTextCursor(const QTextCursor &cursor);
|
||||
@ -225,9 +227,6 @@ public:
|
||||
QTextDocument *document() const;
|
||||
|
||||
private:
|
||||
QTextCursor(QTextDocumentPrivate &p, int pos);
|
||||
explicit QTextCursor(QTextCursorPrivate *d);
|
||||
|
||||
QSharedDataPointer<QTextCursorPrivate> d;
|
||||
friend class QTextCursorPrivate;
|
||||
friend class QTextDocumentPrivate;
|
||||
|
@ -107,7 +107,7 @@ public:
|
||||
void aboutToRemoveCell(int from, int to);
|
||||
|
||||
static QTextCursor fromPosition(QTextDocumentPrivate *d, int pos)
|
||||
{ return QTextCursor(*d, pos); }
|
||||
{ return QTextCursor(d, pos); }
|
||||
|
||||
QTextDocumentPrivate *priv;
|
||||
qreal x;
|
||||
|
@ -1710,7 +1710,7 @@ bool QTextDocumentPrivate::ensureMaximumBlockCount()
|
||||
beginEditBlock();
|
||||
|
||||
const int blocksToRemove = blocks.numNodes() - maximumBlockCount;
|
||||
QTextCursor cursor(*this, 0);
|
||||
QTextCursor cursor(this, 0);
|
||||
cursor.movePosition(QTextCursor::NextBlock, QTextCursor::KeepAnchor, blocksToRemove);
|
||||
|
||||
unreachableCharacterCount += cursor.selectionEnd() - cursor.selectionStart();
|
||||
|
@ -1065,7 +1065,7 @@ void QTextEngine::shapeText(int item) const
|
||||
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
if (Q_LIKELY(qt_useHarfbuzzNG()))
|
||||
si.num_glyphs = shapeTextWithHarfbuzzNG(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled);
|
||||
si.num_glyphs = shapeTextWithHarfbuzzNG(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled, letterSpacing != 0);
|
||||
else
|
||||
#endif
|
||||
si.num_glyphs = shapeTextWithHarfbuzz(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled);
|
||||
@ -1127,7 +1127,13 @@ QT_BEGIN_INCLUDE_NAMESPACE
|
||||
|
||||
QT_END_INCLUDE_NAMESPACE
|
||||
|
||||
int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *string, int itemLength, QFontEngine *fontEngine, const QVector<uint> &itemBoundaries, bool kerningEnabled) const
|
||||
int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
|
||||
const ushort *string,
|
||||
int itemLength,
|
||||
QFontEngine *fontEngine,
|
||||
const QVector<uint> &itemBoundaries,
|
||||
bool kerningEnabled,
|
||||
bool hasLetterSpacing) const
|
||||
{
|
||||
uint glyphs_shaped = 0;
|
||||
|
||||
@ -1141,7 +1147,8 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
|
||||
|
||||
hb_segment_properties_t props = HB_SEGMENT_PROPERTIES_DEFAULT;
|
||||
props.direction = si.analysis.bidiLevel % 2 ? HB_DIRECTION_RTL : HB_DIRECTION_LTR;
|
||||
props.script = hb_qt_script_to_script(QChar::Script(si.analysis.script));
|
||||
QChar::Script script = QChar::Script(si.analysis.script);
|
||||
props.script = hb_qt_script_to_script(script);
|
||||
// ### props.language = hb_language_get_default_for_script(props.script);
|
||||
|
||||
for (int k = 0; k < itemBoundaries.size(); k += 3) {
|
||||
@ -1174,10 +1181,19 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
|
||||
Q_ASSERT(hb_font);
|
||||
hb_qt_font_set_use_design_metrics(hb_font, option.useDesignMetrics() ? uint(QFontEngine::DesignMetrics) : 0); // ###
|
||||
|
||||
const hb_feature_t features[1] = {
|
||||
{ HB_TAG('k','e','r','n'), !!kerningEnabled, 0, uint(-1) }
|
||||
};
|
||||
const int num_features = 1;
|
||||
// Ligatures are incompatible with custom letter spacing, so when a letter spacing is set,
|
||||
// we disable them for writing systems where they are purely cosmetic.
|
||||
bool scriptRequiresOpenType = ((script >= QChar::Script_Syriac && script <= QChar::Script_Sinhala)
|
||||
|| script == QChar::Script_Khmer || script == QChar::Script_Nko);
|
||||
|
||||
bool dontLigate = hasLetterSpacing && !scriptRequiresOpenType;
|
||||
const hb_feature_t features[5] = {
|
||||
{ HB_TAG('k','e','r','n'), !!kerningEnabled, 0, uint(-1) },
|
||||
{ HB_TAG('l','i','g','a'), !dontLigate, 0, uint(-1) },
|
||||
{ HB_TAG('c','l','i','g'), !dontLigate, 0, uint(-1) },
|
||||
{ HB_TAG('d','l','i','g'), !dontLigate, 0, uint(-1) },
|
||||
{ HB_TAG('h','l','i','g'), !dontLigate, 0, uint(-1) } };
|
||||
const int num_features = dontLigate ? 5 : 1;
|
||||
|
||||
const char *const *shaper_list = Q_NULLPTR;
|
||||
#if defined(Q_OS_DARWIN)
|
||||
|
@ -649,7 +649,13 @@ private:
|
||||
void addRequiredBoundaries() const;
|
||||
void shapeText(int item) const;
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
int shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *string, int itemLength, QFontEngine *fontEngine, const QVector<uint> &itemBoundaries, bool kerningEnabled) const;
|
||||
int shapeTextWithHarfbuzzNG(const QScriptItem &si,
|
||||
const ushort *string,
|
||||
int itemLength,
|
||||
QFontEngine *fontEngine,
|
||||
const QVector<uint> &itemBoundaries,
|
||||
bool kerningEnabled,
|
||||
bool hasLetterSpacing) const;
|
||||
#endif
|
||||
int shapeTextWithHarfbuzz(const QScriptItem &si, const ushort *string, int itemLength, QFontEngine *fontEngine, const QVector<uint> &itemBoundaries, bool kerningEnabled) const;
|
||||
|
||||
|
@ -1064,12 +1064,15 @@ QList<QGlyphRun> QTextLayout::glyphRuns(int from, int length) const
|
||||
|
||||
QVector<quint32> indexes = oldGlyphRun.glyphIndexes();
|
||||
QVector<QPointF> positions = oldGlyphRun.positions();
|
||||
QRectF boundingRect = oldGlyphRun.boundingRect();
|
||||
|
||||
indexes += glyphRun.glyphIndexes();
|
||||
positions += glyphRun.positions();
|
||||
boundingRect = boundingRect.united(glyphRun.boundingRect());
|
||||
|
||||
oldGlyphRun.setGlyphIndexes(indexes);
|
||||
oldGlyphRun.setPositions(positions);
|
||||
oldGlyphRun.setBoundingRect(boundingRect);
|
||||
} else {
|
||||
glyphRunHash[key] = glyphRun;
|
||||
}
|
||||
@ -2144,6 +2147,7 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine,
|
||||
QGlyphRunPrivate *d = QGlyphRunPrivate::get(glyphRun);
|
||||
|
||||
int rangeStart = textPosition;
|
||||
logClusters += textPosition;
|
||||
while (*logClusters != glyphsStart && rangeStart < textPosition + textLength) {
|
||||
++logClusters;
|
||||
++rangeStart;
|
||||
@ -2328,16 +2332,16 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
|
||||
|
||||
if (mainFontEngine->type() == QFontEngine::Multi) {
|
||||
QFontEngineMulti *multiFontEngine = static_cast<QFontEngineMulti *>(mainFontEngine);
|
||||
int end = rtl ? glyphLayout.numGlyphs : 0;
|
||||
int start = rtl ? end : 0;
|
||||
int which = glyphLayout.glyphs[rtl ? start - 1 : end] >> 24;
|
||||
for (; (rtl && start > 0) || (!rtl && end < glyphLayout.numGlyphs);
|
||||
int start = rtl ? glyphLayout.numGlyphs : 0;
|
||||
int end = start - 1;
|
||||
int which = glyphLayout.glyphs[rtl ? start - 1 : end + 1] >> 24;
|
||||
for (; (rtl && start > 0) || (!rtl && end < glyphLayout.numGlyphs - 1);
|
||||
rtl ? --start : ++end) {
|
||||
const int e = glyphLayout.glyphs[rtl ? start - 1 : end] >> 24;
|
||||
const int e = glyphLayout.glyphs[rtl ? start - 1 : end + 1] >> 24;
|
||||
if (e == which)
|
||||
continue;
|
||||
|
||||
QGlyphLayout subLayout = glyphLayout.mid(start, end - start);
|
||||
QGlyphLayout subLayout = glyphLayout.mid(start, end - start + 1);
|
||||
multiFontEngine->ensureEngineAt(which);
|
||||
|
||||
QGlyphRun::GlyphRunFlags subFlags = flags;
|
||||
@ -2361,13 +2365,13 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
|
||||
}
|
||||
|
||||
if (rtl)
|
||||
end = start;
|
||||
end = start - 1;
|
||||
else
|
||||
start = end;
|
||||
start = end + 1;
|
||||
which = e;
|
||||
}
|
||||
|
||||
QGlyphLayout subLayout = glyphLayout.mid(start, end - start);
|
||||
QGlyphLayout subLayout = glyphLayout.mid(start, end - start + 1);
|
||||
multiFontEngine->ensureEngineAt(which);
|
||||
|
||||
QGlyphRun::GlyphRunFlags subFlags = flags;
|
||||
|
@ -1066,7 +1066,7 @@ void QRegularExpressionValidatorPrivate::setRegularExpression(const QRegularExpr
|
||||
|
||||
if (origRe != re) {
|
||||
usedRe = origRe = re; // copies also the pattern options
|
||||
usedRe.setPattern(QStringLiteral("\\A(?:") + re.pattern() + QStringLiteral(")\\z"));
|
||||
usedRe.setPattern(QLatin1String("\\A(?:") + re.pattern() + QLatin1String(")\\z"));
|
||||
emit q->regularExpressionChanged(re);
|
||||
emit q->changed();
|
||||
}
|
||||
|
@ -40,8 +40,6 @@
|
||||
#include "qhttpnetworkreply_p.h"
|
||||
#include "qhttpnetworkconnection_p.h"
|
||||
|
||||
#include <qbytearraymatcher.h>
|
||||
|
||||
#ifndef QT_NO_HTTP
|
||||
|
||||
#ifndef QT_NO_SSL
|
||||
@ -611,11 +609,9 @@ void QHttpNetworkReplyPrivate::parseHeader(const QByteArray &header)
|
||||
{
|
||||
// see rfc2616, sec 4 for information about HTTP/1.1 headers.
|
||||
// allows relaxed parsing here, accepts both CRLF & LF line endings
|
||||
const QByteArrayMatcher lf("\n");
|
||||
const QByteArrayMatcher colon(":");
|
||||
int i = 0;
|
||||
while (i < header.count()) {
|
||||
int j = colon.indexIn(header, i); // field-name
|
||||
int j = header.indexOf(':', i); // field-name
|
||||
if (j == -1)
|
||||
break;
|
||||
const QByteArray field = header.mid(i, j - i).trimmed();
|
||||
@ -623,7 +619,7 @@ void QHttpNetworkReplyPrivate::parseHeader(const QByteArray &header)
|
||||
// any number of LWS is allowed before and after the value
|
||||
QByteArray value;
|
||||
do {
|
||||
i = lf.indexIn(header, j);
|
||||
i = header.indexOf('\n', j);
|
||||
if (i == -1)
|
||||
break;
|
||||
if (!value.isEmpty())
|
||||
|
@ -300,19 +300,6 @@ static inline QAbstractSocket::SocketType qt_socket_getType(qintptr socketDescri
|
||||
return QAbstractSocket::UnknownSocketType;
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
|
||||
*/
|
||||
static inline int qt_socket_getMaxMsgSize(qintptr socketDescriptor)
|
||||
{
|
||||
int value = 0;
|
||||
QT_SOCKLEN_T valueSize = sizeof(value);
|
||||
if (::getsockopt(socketDescriptor, SOL_SOCKET, SO_MAX_MSG_SIZE, (char *) &value, &valueSize) != 0) {
|
||||
WS_ERROR_DEBUG(WSAGetLastError());
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
// MS Transport Provider IOCTL to control
|
||||
// reporting PORT_UNREACHABLE messages
|
||||
// on UDP sockets via recv/WSARecv/etc.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user