Merge "Merge remote branch 'gerrit/master' into refactor" into refactor
This commit is contained in:
commit
2770415f92
22
dist/changes-4.8.0
vendored
22
dist/changes-4.8.0
vendored
@ -63,6 +63,15 @@ QtGui
|
|||||||
- Deprecate qGenericMatrixFromMatrix4x4 and qGenericMatrixToMatrix4x4
|
- Deprecate qGenericMatrixFromMatrix4x4 and qGenericMatrixToMatrix4x4
|
||||||
- QListView diverses optimisations [QTBUG-11438]
|
- QListView diverses optimisations [QTBUG-11438]
|
||||||
- QTreeWidget/QListWidget: use localeAwareCompare for string comparisons [QTBUG-10839]
|
- QTreeWidget/QListWidget: use localeAwareCompare for string comparisons [QTBUG-10839]
|
||||||
|
- PNG image I/O: Much improved support for text annotations, including iTXt fields.
|
||||||
|
- QRawFont and QGlyphRun are introduced for low-level text rendering. [QTBUG-18252]
|
||||||
|
- QFont: hintingPreference() is introduced to control hinting in font rendering and
|
||||||
|
subpixel positioning of glyphs for Windows, Mac OS X and X11/raster. [QTBUG-10615]
|
||||||
|
- Subpixel positioned text layout is supported in raster and OpenGL paint engines.
|
||||||
|
- QFont: styleName() is added to allow selecting fonts with irregular style names
|
||||||
|
like UltraLight. [QTBUG-19366]
|
||||||
|
- Visual text cursor movement behavior is added to QTextEdit and QLineEdit controls,
|
||||||
|
which can be used as an optional mode for bi-directional text editing. [QTBUG-13859]
|
||||||
|
|
||||||
QtNetwork
|
QtNetwork
|
||||||
---------
|
---------
|
||||||
@ -103,15 +112,22 @@ QtScript
|
|||||||
|
|
||||||
Qt for Linux/X11
|
Qt for Linux/X11
|
||||||
----------------
|
----------------
|
||||||
|
- Now takes font hinting settings from GConf by default if running in
|
||||||
|
GNOME desktop.
|
||||||
|
- Various fixes to FontConfig font matching code to make it consistent
|
||||||
|
with other X11 programs. [QTBUG-2148, QTBUG-19947, QTBUG-14269]
|
||||||
|
|
||||||
Qt for Windows
|
Qt for Windows
|
||||||
--------------
|
--------------
|
||||||
|
- DirectWrite experimental text shaping engine is added with subpixel
|
||||||
|
positioning support. [QTBUG-12678]
|
||||||
|
|
||||||
Qt for Mac OS X
|
Qt for Mac OS X
|
||||||
---------------
|
---------------
|
||||||
|
- raster graphics system is now made as the default paint engine for
|
||||||
|
Mac OS X. [QTBUG-12615]
|
||||||
|
- HarfBuzz can now be used as an optional text layout engine on Mac OS X.
|
||||||
|
[QTBUG-17728]
|
||||||
|
|
||||||
Qt for Embedded Linux
|
Qt for Embedded Linux
|
||||||
---------------------
|
---------------------
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
\example painting/affine
|
\example painting/affine
|
||||||
\title Affine Transformations
|
\title Affine Transformations
|
||||||
|
|
||||||
In this demo we show Qt's ability to perform affine transformations
|
In this example we show Qt's ability to perform affine transformations
|
||||||
on painting operations.
|
on painting operations.
|
||||||
|
|
||||||
\image affine-demo.png
|
\image affine-demo.png
|
@ -27,9 +27,9 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\example sql/books
|
\example sql/books
|
||||||
\title Books Demonstration
|
\title Books
|
||||||
|
|
||||||
The Books demonstration shows how Qt's SQL classes can be used with the model/view
|
The Books example shows how Qt's SQL classes can be used with the model/view
|
||||||
framework to create rich user interfaces for information stored in a database.
|
framework to create rich user interfaces for information stored in a database.
|
||||||
|
|
||||||
\image books-demo.png
|
\image books-demo.png
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\example embedded/styledemo
|
\example embedded/styleexample
|
||||||
\title Embedded Styles
|
\title Embedded Styles
|
||||||
|
|
||||||
\image styledemo-demo.png
|
\image styledemo-demo.png
|
@ -777,7 +777,7 @@
|
|||||||
|
|
||||||
\section2 4.2 Qt Documentation
|
\section2 4.2 Qt Documentation
|
||||||
|
|
||||||
Qt 4.7 comes with 17 examples and 2 Demonstrations for model/view.
|
Qt 5.0 comes with 19 examples for model/view.
|
||||||
The examples can be found on the \l{Item Views Examples} page.
|
The examples can be found on the \l{Item Views Examples} page.
|
||||||
|
|
||||||
\table
|
\table
|
||||||
@ -841,6 +841,11 @@
|
|||||||
\o QTableView
|
\o QTableView
|
||||||
\o QStandardItemModel
|
\o QStandardItemModel
|
||||||
\o
|
\o
|
||||||
|
\row
|
||||||
|
\o Interview
|
||||||
|
\o Multiple
|
||||||
|
\o Custom item model
|
||||||
|
\o Multiple views
|
||||||
\row
|
\row
|
||||||
\o Pixelator
|
\o Pixelator
|
||||||
\o QTableView
|
\o QTableView
|
||||||
@ -871,24 +876,16 @@
|
|||||||
\o QTableView
|
\o QTableView
|
||||||
\o QStandardItemModel
|
\o QStandardItemModel
|
||||||
\o Custom delegate that uses a spin box as a cell editor
|
\o Custom delegate that uses a spin box as a cell editor
|
||||||
|
\row
|
||||||
|
\o Spreadsheet
|
||||||
|
\o {2, 1} QTableView
|
||||||
|
\o Custom delegates
|
||||||
\row
|
\row
|
||||||
\o Star Delegate
|
\o Star Delegate
|
||||||
\o {2, 1} QTableWidget
|
\o {2, 1} QTableWidget
|
||||||
\o Comprehensive custom delegate example.
|
\o Comprehensive custom delegate example.
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
\l{Qt Demonstrations}{Demonstrations} are similar to examples except that no
|
|
||||||
walkthrough is provided for the code. Demonstrations are typically more
|
|
||||||
feature rich than examples.
|
|
||||||
|
|
||||||
\list
|
|
||||||
\o The \bold Interview demonstration shows the same model and
|
|
||||||
selection being shared between three different views.
|
|
||||||
\o The \bold Spreadsheet demonstration illustrates the use of a
|
|
||||||
table view as a spreadsheet, using custom delegates to render
|
|
||||||
each item according to the type of data it contains.
|
|
||||||
\endlist
|
|
||||||
|
|
||||||
A \l{Model/View Programming}{reference document} for model/view technology
|
A \l{Model/View Programming}{reference document} for model/view technology
|
||||||
is also available.
|
is also available.
|
||||||
*/
|
*/
|
||||||
|
@ -1,39 +1,8 @@
|
|||||||
Qt is supplied with a number of example applications and demonstrations that
|
Qt is supplied with a number of example applications that have been
|
||||||
have been written to provide developers with examples of the Qt API in use,
|
written to provide developers with examples of the Qt API in use,
|
||||||
highlight good programming practice, and showcase features found in each of
|
highlight good programming practice, and showcase features found in each of
|
||||||
Qt's core technologies.
|
Qt's core technologies.
|
||||||
|
|
||||||
The example and demo launcher can be used to explore the different categories
|
|
||||||
available. It provides an overview of each example, lets you view the
|
|
||||||
documentation in Qt Assistant, and is able to launch examples and demos.
|
|
||||||
|
|
||||||
Documentation for examples can be found in the Tutorials and Examples section
|
Documentation for examples can be found in the Examples section
|
||||||
of the Qt documentation.
|
of the Qt documentation.
|
||||||
|
|
||||||
|
|
||||||
Finding the Qt Examples and Demos launcher
|
|
||||||
==========================================
|
|
||||||
|
|
||||||
On Windows:
|
|
||||||
|
|
||||||
The launcher can be accessed via the Windows Start menu. Select the menu
|
|
||||||
entry entitled "Qt Examples and Demos" entry in the submenu containing
|
|
||||||
the Qt tools.
|
|
||||||
|
|
||||||
On Mac OS X:
|
|
||||||
|
|
||||||
For the binary distribution, the qtdemo executable is installed in the
|
|
||||||
/Developer/Applications/Qt directory. For the source distribution, it is
|
|
||||||
installed alongside the other Qt tools on the path specified when Qt is
|
|
||||||
configured.
|
|
||||||
|
|
||||||
On Unix/Linux:
|
|
||||||
|
|
||||||
The qtdemo executable is installed alongside the other Qt tools on the path
|
|
||||||
specified when Qt is configured.
|
|
||||||
|
|
||||||
On all platforms:
|
|
||||||
|
|
||||||
The source code for the launcher can be found in the demos/qtdemo directory
|
|
||||||
in the Qt package. This example is built at the same time as the Qt libraries,
|
|
||||||
tools, examples, and demonstrations.
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
SUBDIRS = styledemo raycasting flickable digiflip
|
SUBDIRS = styleexample raycasting flickable digiflip
|
||||||
|
|
||||||
SUBDIRS += lightmaps
|
SUBDIRS += lightmaps
|
||||||
SUBDIRS += flightinfo
|
SUBDIRS += flightinfo
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 164 KiB After Width: | Height: | Size: 164 KiB |
Before Width: | Height: | Size: 865 B After Width: | Height: | Size: 865 B |
@ -45,7 +45,7 @@
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
Q_INIT_RESOURCE(styledemo);
|
Q_INIT_RESOURCE(styleexample);
|
||||||
|
|
||||||
app.setApplicationName("style");
|
app.setApplicationName("style");
|
||||||
app.setOrganizationName("Nokia");
|
app.setOrganizationName("Nokia");
|
@ -4,15 +4,15 @@ TEMPLATE = app
|
|||||||
HEADERS += stylewidget.h
|
HEADERS += stylewidget.h
|
||||||
FORMS += stylewidget.ui
|
FORMS += stylewidget.ui
|
||||||
SOURCES += main.cpp stylewidget.cpp
|
SOURCES += main.cpp stylewidget.cpp
|
||||||
RESOURCES += styledemo.qrc
|
RESOURCES += styleexample.qrc
|
||||||
|
|
||||||
target.path = $$[QT_INSTALL_DEMOS]/qtbase/embedded/styledemo
|
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/embedded/styleexample
|
||||||
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.html
|
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.html
|
||||||
sources.path = $$[QT_INSTALL_DEMOS]/qtbase/embedded/styledemo
|
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/embedded/styleexample
|
||||||
INSTALLS += target sources
|
INSTALLS += target sources
|
||||||
|
|
||||||
symbian {
|
symbian {
|
||||||
TARGET.UID3 = 0xA000A63F
|
TARGET.UID3 = 0xA000A63F
|
||||||
CONFIG += qt_demo
|
CONFIG += qt_example
|
||||||
}
|
}
|
||||||
QT += widgets widgets
|
QT += widgets widgets
|
@ -314,7 +314,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="StyleDemo.qrc"/>
|
<include location="styleexample.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
@ -78,7 +78,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
layout->addWidget(vSplitter);
|
layout->addWidget(vSplitter);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
setWindowTitle(tr("Chip Demo"));
|
setWindowTitle(tr("Chip Example"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::populateScene()
|
void MainWindow::populateScene()
|
||||||
|
@ -78,6 +78,6 @@ int main(int argc, char *argv[])
|
|||||||
view.setBackgroundBrush(QPixmap(":/No-Ones-Laughing-3.jpg"));
|
view.setBackgroundBrush(QPixmap(":/No-Ones-Laughing-3.jpg"));
|
||||||
view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
|
view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
|
||||||
view.show();
|
view.show();
|
||||||
view.setWindowTitle("Embedded Dialogs Demo");
|
view.setWindowTitle("Embedded Dialogs Example");
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
|
|
||||||
static const char * const message =
|
static const char * const message =
|
||||||
"<p><b>Qt Main Window Demo</b></p>"
|
"<p><b>Qt Main Window Example</b></p>"
|
||||||
|
|
||||||
"<p>This is a demonstration of the QMainWindow, QToolBar and "
|
"<p>This is a demonstration of the QMainWindow, QToolBar and "
|
||||||
"QDockWidget classes.</p>"
|
"QDockWidget classes.</p>"
|
||||||
@ -88,7 +88,7 @@ MainWindow::MainWindow(const QMap<QString, QSize> &customSizeHints,
|
|||||||
: QMainWindow(parent, flags)
|
: QMainWindow(parent, flags)
|
||||||
{
|
{
|
||||||
setObjectName("MainWindow");
|
setObjectName("MainWindow");
|
||||||
setWindowTitle("Qt Main Window Demo");
|
setWindowTitle("Qt Main Window Example");
|
||||||
|
|
||||||
center = new QTextEdit(this);
|
center = new QTextEdit(this);
|
||||||
center->setReadOnly(true);
|
center->setReadOnly(true);
|
||||||
|
@ -895,7 +895,7 @@ XFormWidget::XFormWidget(QWidget *parent)
|
|||||||
// defaults
|
// defaults
|
||||||
view->reset();
|
view->reset();
|
||||||
vectorType->setChecked(true);
|
vectorType->setChecked(true);
|
||||||
textEditor->setText("Qt Affine Transformation Demo");
|
textEditor->setText("Qt Affine Transformation Example");
|
||||||
textEditor->setEnabled(false);
|
textEditor->setEnabled(false);
|
||||||
|
|
||||||
animateButton->animateClick();
|
animateButton->animateClick();
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<html>
|
<html>
|
||||||
|
|
||||||
<h1>Demo for composition modes</h1>
|
<h1>Example for composition modes</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
This demo shows some of the more advanced composition modes supported by Qt.
|
This example shows some of the more advanced composition modes supported by Qt.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<html><head><meta name="qrichtext" content="1" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>QTextEdit Demonstration</title><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>QTextEdit Example</title><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
|
</style></head><body style=" font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||||
<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:20pt; font-weight:600;">QTextEdit</span></p>
|
<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:20pt; font-weight:600;">QTextEdit</span></p>
|
||||||
<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">The QTextEdit widget is an advanced editor that supports formatted rich text. It can be used to display HTML and other rich document formats. Internally, QTextEdit uses the QTextDocument class to describe both the high-level structure of each document and the low-level formatting of paragraphs.</span></p>
|
<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">The QTextEdit widget is an advanced editor that supports formatted rich text. It can be used to display HTML and other rich document formats. Internally, QTextEdit uses the QTextDocument class to describe both the high-level structure of each document and the low-level formatting of paragraphs.</span></p>
|
||||||
<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;">If you are viewing this document in the <span style=" font-style:italic;">textedit</span> demo, you can edit this document to explore Qt's rich text editing features. We have included some comments in each of the following sections to encourage you to experiment. </p>
|
<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;">If you are viewing this document in the <span style=" font-style:italic;">textedit</span> example, you can edit this document to explore Qt's rich text editing features. We have included some comments in each of the following sections to encourage you to experiment. </p>
|
||||||
<p style=" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:18pt; font-weight:600;"><span style=" font-size:16pt;">Font and Paragraph Styles</span></p>
|
<p style=" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:18pt; font-weight:600;"><span style=" font-size:16pt;">Font and Paragraph Styles</span></p>
|
||||||
<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">QTextEdit supports </span><span style=" font-size:11pt; font-weight:600;">bold</span><span style=" font-size:11pt;">, </span><span style=" font-size:11pt; font-style:italic;">italic</span><span style=" font-size:11pt;">, and </span><span style=" font-size:11pt; text-decoration: underline;">underlined</span><span style=" font-size:11pt;"> font styles, and can display </span><span style=" font-size:11pt; font-weight:600; color:#00007f;">multicolored</span><span style=" font-size:11pt;"> </span><span style=" font-size:11pt; font-weight:600; color:#aa0000;">text</span><span style=" font-size:11pt;">. Font families such as </span><span style=" font-family:'Times'; font-size:11pt; font-weight:600;">Times New Roman</span><span style=" font-size:11pt;"> and </span><span style=" font-family:'Courier'; font-size:11pt; font-weight:600;">Courier</span><span style=" font-size:11pt;"> can also be used directly. </span><span style=" font-size:11pt; font-style:italic;">If you place the cursor in a region of styled text, the controls in the tool bars will change to reflect the current style.</span></p>
|
<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">QTextEdit supports </span><span style=" font-size:11pt; font-weight:600;">bold</span><span style=" font-size:11pt;">, </span><span style=" font-size:11pt; font-style:italic;">italic</span><span style=" font-size:11pt;">, and </span><span style=" font-size:11pt; text-decoration: underline;">underlined</span><span style=" font-size:11pt;"> font styles, and can display </span><span style=" font-size:11pt; font-weight:600; color:#00007f;">multicolored</span><span style=" font-size:11pt;"> </span><span style=" font-size:11pt; font-weight:600; color:#aa0000;">text</span><span style=" font-size:11pt;">. Font families such as </span><span style=" font-family:'Times'; font-size:11pt; font-weight:600;">Times New Roman</span><span style=" font-size:11pt;"> and </span><span style=" font-family:'Courier'; font-size:11pt; font-weight:600;">Courier</span><span style=" font-size:11pt;"> can also be used directly. </span><span style=" font-size:11pt; font-style:italic;">If you place the cursor in a region of styled text, the controls in the tool bars will change to reflect the current style.</span></p>
|
||||||
<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;">Paragraphs can be formatted so that the text is left-aligned, right-aligned, centered, or fully justified.</p>
|
<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;">Paragraphs can be formatted so that the text is left-aligned, right-aligned, centered, or fully justified.</p>
|
||||||
|
@ -130,7 +130,7 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) {
|
|||||||
QMAKE_LIBDIR += $$QMAKE_LIBDIR_QT
|
QMAKE_LIBDIR += $$QMAKE_LIBDIR_QT
|
||||||
|
|
||||||
# Topological ordering of modules based on their QT.<module>.depends variable
|
# Topological ordering of modules based on their QT.<module>.depends variable
|
||||||
QT = $$resolve_depends($$QT, "QT.")
|
QT = $$sort_depends(QT, "QT.")
|
||||||
|
|
||||||
QT_DEPENDS=
|
QT_DEPENDS=
|
||||||
|
|
||||||
|
@ -219,7 +219,6 @@ public:
|
|||||||
DataPath,
|
DataPath,
|
||||||
TranslationsPath,
|
TranslationsPath,
|
||||||
SettingsPath,
|
SettingsPath,
|
||||||
DemosPath,
|
|
||||||
ExamplesPath,
|
ExamplesPath,
|
||||||
ImportsPath
|
ImportsPath
|
||||||
};
|
};
|
||||||
|
@ -81,7 +81,7 @@ enum ExpandFunc { E_MEMBER=1, E_FIRST, E_LAST, E_CAT, E_FROMFILE, E_EVAL, E_LIST
|
|||||||
E_SPRINTF, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION,
|
E_SPRINTF, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION,
|
||||||
E_FIND, E_SYSTEM, E_UNIQUE, E_QUOTE, E_ESCAPE_EXPAND,
|
E_FIND, E_SYSTEM, E_UNIQUE, E_QUOTE, E_ESCAPE_EXPAND,
|
||||||
E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_REPLACE,
|
E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_REPLACE,
|
||||||
E_SIZE, E_GENERATE_UID, E_RESOLVE_DEPENDS };
|
E_SIZE, E_GENERATE_UID, E_SORT_DEPENDS, E_RESOLVE_DEPENDS };
|
||||||
QMap<QString, ExpandFunc> qmake_expandFunctions()
|
QMap<QString, ExpandFunc> qmake_expandFunctions()
|
||||||
{
|
{
|
||||||
static QMap<QString, ExpandFunc> *qmake_expand_functions = 0;
|
static QMap<QString, ExpandFunc> *qmake_expand_functions = 0;
|
||||||
@ -114,6 +114,7 @@ QMap<QString, ExpandFunc> qmake_expandFunctions()
|
|||||||
qmake_expand_functions->insert("replace", E_REPLACE);
|
qmake_expand_functions->insert("replace", E_REPLACE);
|
||||||
qmake_expand_functions->insert("size", E_SIZE);
|
qmake_expand_functions->insert("size", E_SIZE);
|
||||||
qmake_expand_functions->insert("generate_uid", E_GENERATE_UID);
|
qmake_expand_functions->insert("generate_uid", E_GENERATE_UID);
|
||||||
|
qmake_expand_functions->insert("sort_depends", E_SORT_DEPENDS);
|
||||||
qmake_expand_functions->insert("resolve_depends", E_RESOLVE_DEPENDS);
|
qmake_expand_functions->insert("resolve_depends", E_RESOLVE_DEPENDS);
|
||||||
}
|
}
|
||||||
return *qmake_expand_functions;
|
return *qmake_expand_functions;
|
||||||
@ -1801,37 +1802,25 @@ QMakeProject::doProjectExpand(QString func, QStringList args,
|
|||||||
// defined in symbian generator
|
// defined in symbian generator
|
||||||
extern QString generate_test_uid(const QString& target);
|
extern QString generate_test_uid(const QString& target);
|
||||||
|
|
||||||
|
static void
|
||||||
void calculateDeps(QStringList &sortedList, const QString &item, const QString &prefix,
|
populateDeps(const QStringList &deps, const QString &prefix,
|
||||||
QStringList &org, QMap<QString, QStringList> &place)
|
QHash<QString, QSet<QString> > &dependencies, QHash<QString, QStringList> &dependees,
|
||||||
|
QStringList &rootSet, QMap<QString, QStringList> &place)
|
||||||
{
|
{
|
||||||
if (sortedList.contains(item))
|
foreach (const QString &item, deps)
|
||||||
return;
|
if (!dependencies.contains(item)) {
|
||||||
|
QSet<QString> &dset = dependencies[item]; // Always create entry
|
||||||
foreach(QString dep, place.value(prefix + item + ".depends")) {
|
QStringList depends = place.value(prefix + item + ".depends");
|
||||||
calculateDeps(sortedList, dep, prefix, org, place);
|
if (depends.isEmpty()) {
|
||||||
if (org.isEmpty())
|
rootSet << item;
|
||||||
break;
|
} else {
|
||||||
}
|
foreach (const QString &dep, depends) {
|
||||||
|
dset.insert(dep);
|
||||||
if (org.contains(item)) {
|
dependees[dep] << item;
|
||||||
sortedList += item;
|
}
|
||||||
org.removeAll(item);
|
populateDeps(depends, prefix, dependencies, dependees, rootSet, place);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList
|
|
||||||
QMakeProject::resolveDepends(const QStringList &deps, const QString &prefix,
|
|
||||||
QMap<QString, QStringList> &place)
|
|
||||||
{
|
|
||||||
QStringList sortedList;
|
|
||||||
QStringList org = deps;
|
|
||||||
foreach(QString item, deps) {
|
|
||||||
calculateDeps(sortedList, item, prefix, org, place);
|
|
||||||
if (org.isEmpty())
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return sortedList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList
|
QStringList
|
||||||
@ -2280,14 +2269,31 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
|
|||||||
ret += generate_test_uid(args.first());
|
ret += generate_test_uid(args.first());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case E_SORT_DEPENDS:
|
||||||
case E_RESOLVE_DEPENDS: {
|
case E_RESOLVE_DEPENDS: {
|
||||||
if(args.count() < 1 || args.count() > 2) {
|
if(args.count() < 1 || args.count() > 2) {
|
||||||
fprintf(stderr, "%s:%d: resolve_depends(var, prefix) requires one or two arguments.\n",
|
fprintf(stderr, "%s:%d: %s(var, prefix) requires one or two arguments.\n",
|
||||||
parser.file.toLatin1().constData(), parser.line_no);
|
parser.file.toLatin1().constData(), parser.line_no, func.toLatin1().constData());
|
||||||
} else {
|
} else {
|
||||||
ret += resolveDepends(args[0].split(QString(Option::field_sep)),
|
QHash<QString, QSet<QString> > dependencies;
|
||||||
(args.count() != 2 ? QString() : args[1]),
|
QHash<QString, QStringList> dependees;
|
||||||
place);
|
QStringList rootSet;
|
||||||
|
|
||||||
|
QStringList orgList = values(args[0], place);
|
||||||
|
populateDeps(orgList, (args.count() != 2 ? QString() : args[1]),
|
||||||
|
dependencies, dependees, rootSet, place);
|
||||||
|
|
||||||
|
for (int i = 0; i < rootSet.size(); ++i) {
|
||||||
|
const QString &item = rootSet.at(i);
|
||||||
|
if ((func_t == E_RESOLVE_DEPENDS) || orgList.contains(item))
|
||||||
|
ret.prepend(item);
|
||||||
|
foreach (const QString &dep, dependees[item]) {
|
||||||
|
QSet<QString> &dset = dependencies[dep];
|
||||||
|
dset.remove(item);
|
||||||
|
if (dset.isEmpty())
|
||||||
|
rootSet << dep;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break; }
|
break; }
|
||||||
default: {
|
default: {
|
||||||
|
@ -107,7 +107,6 @@ class QMakeProject
|
|||||||
QStringList doVariableReplaceExpand(const QString &str, QMap<QString, QStringList> &place, bool *ok=0);
|
QStringList doVariableReplaceExpand(const QString &str, QMap<QString, QStringList> &place, bool *ok=0);
|
||||||
void init(QMakeProperty *, const QMap<QString, QStringList> *);
|
void init(QMakeProperty *, const QMap<QString, QStringList> *);
|
||||||
QStringList &values(const QString &v, QMap<QString, QStringList> &place);
|
QStringList &values(const QString &v, QMap<QString, QStringList> &place);
|
||||||
QStringList resolveDepends(const QStringList &deps, const QString &prefix, QMap<QString, QStringList> &place);
|
|
||||||
void validateModes();
|
void validateModes();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -104,7 +104,7 @@ QMakeProperty::value(QString v, bool just_check)
|
|||||||
else if(v == "QT_INSTALL_EXAMPLES")
|
else if(v == "QT_INSTALL_EXAMPLES")
|
||||||
return QLibraryInfo::location(QLibraryInfo::ExamplesPath);
|
return QLibraryInfo::location(QLibraryInfo::ExamplesPath);
|
||||||
else if(v == "QT_INSTALL_DEMOS")
|
else if(v == "QT_INSTALL_DEMOS")
|
||||||
return QLibraryInfo::location(QLibraryInfo::DemosPath);
|
return QLibraryInfo::location(QLibraryInfo::ExamplesPath);
|
||||||
else if(v == "QMAKE_MKSPECS")
|
else if(v == "QMAKE_MKSPECS")
|
||||||
return qmake_mkspec_paths().join(Option::dirlist_sep);
|
return qmake_mkspec_paths().join(Option::dirlist_sep);
|
||||||
else if(v == "QMAKE_VERSION")
|
else if(v == "QMAKE_VERSION")
|
||||||
|
@ -68,6 +68,7 @@ bootstrap { #Qt code
|
|||||||
qlist.cpp \
|
qlist.cpp \
|
||||||
qlinkedlist.cpp \
|
qlinkedlist.cpp \
|
||||||
qlocale.cpp \
|
qlocale.cpp \
|
||||||
|
qlocale_tools.cpp \
|
||||||
qmalloc.cpp \
|
qmalloc.cpp \
|
||||||
qmap.cpp \
|
qmap.cpp \
|
||||||
qmetatype.cpp \
|
qmetatype.cpp \
|
||||||
@ -111,6 +112,7 @@ bootstrap { #Qt code
|
|||||||
qlist.h \
|
qlist.h \
|
||||||
qlinkedlist.h \
|
qlinkedlist.h \
|
||||||
qlocale.h \
|
qlocale.h \
|
||||||
|
qlocale_tools_p.h \
|
||||||
qmalloc.h \
|
qmalloc.h \
|
||||||
qmap.h \
|
qmap.h \
|
||||||
qmetatype.h \
|
qmetatype.h \
|
||||||
|
@ -25,6 +25,7 @@ INCLUDEPATH += . \
|
|||||||
generators/win32 \
|
generators/win32 \
|
||||||
generators/mac \
|
generators/mac \
|
||||||
generators/symbian \
|
generators/symbian \
|
||||||
|
generators/integrity \
|
||||||
$$QT_SOURCE_TREE/include \
|
$$QT_SOURCE_TREE/include \
|
||||||
$$QT_SOURCE_TREE/include/QtCore \
|
$$QT_SOURCE_TREE/include/QtCore \
|
||||||
$$QT_SOURCE_TREE/include/QtCore/$$QT_VERSION \
|
$$QT_SOURCE_TREE/include/QtCore/$$QT_VERSION \
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qtconcurrentexception.h"
|
#include "qtconcurrentexception.h"
|
||||||
|
#include "QtCore/qshareddata.h"
|
||||||
|
|
||||||
#ifndef QT_NO_QFUTURE
|
#ifndef QT_NO_QFUTURE
|
||||||
#ifndef QT_NO_EXCEPTIONS
|
#ifndef QT_NO_EXCEPTIONS
|
||||||
@ -141,15 +142,14 @@ Exception *UnhandledException::clone() const
|
|||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
class Base
|
class Base : public QSharedData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Base(Exception *exception)
|
Base(Exception *exception)
|
||||||
: exception(exception), refCount(1), hasThrown(false) { }
|
: exception(exception), hasThrown(false) { }
|
||||||
~Base() { delete exception; }
|
~Base() { delete exception; }
|
||||||
|
|
||||||
Exception *exception;
|
Exception *exception;
|
||||||
QAtomicInt refCount;
|
|
||||||
bool hasThrown;
|
bool hasThrown;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -158,27 +158,15 @@ ExceptionHolder::ExceptionHolder(Exception *exception)
|
|||||||
|
|
||||||
ExceptionHolder::ExceptionHolder(const ExceptionHolder &other)
|
ExceptionHolder::ExceptionHolder(const ExceptionHolder &other)
|
||||||
: base(other.base)
|
: base(other.base)
|
||||||
{
|
{}
|
||||||
base->refCount.ref();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ExceptionHolder::operator=(const ExceptionHolder &other)
|
void ExceptionHolder::operator=(const ExceptionHolder &other)
|
||||||
{
|
{
|
||||||
if (base == other.base)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (base->refCount.deref() == false)
|
|
||||||
delete base;
|
|
||||||
|
|
||||||
base = other.base;
|
base = other.base;
|
||||||
base->refCount.ref();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExceptionHolder::~ExceptionHolder()
|
ExceptionHolder::~ExceptionHolder()
|
||||||
{
|
{}
|
||||||
if (base->refCount.deref() == 0)
|
|
||||||
delete base;
|
|
||||||
}
|
|
||||||
|
|
||||||
Exception *ExceptionHolder::exception() const
|
Exception *ExceptionHolder::exception() const
|
||||||
{
|
{
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#ifndef QT_NO_QFUTURE
|
#ifndef QT_NO_QFUTURE
|
||||||
|
|
||||||
#include <QtCore/qatomic.h>
|
#include <QtCore/qatomic.h>
|
||||||
|
#include <QtCore/qshareddata.h>
|
||||||
|
|
||||||
#ifndef QT_NO_EXCEPTIONS
|
#ifndef QT_NO_EXCEPTIONS
|
||||||
# include <exception>
|
# include <exception>
|
||||||
@ -87,7 +88,7 @@ public:
|
|||||||
void operator=(const ExceptionHolder &other);
|
void operator=(const ExceptionHolder &other);
|
||||||
~ExceptionHolder();
|
~ExceptionHolder();
|
||||||
Exception *exception() const;
|
Exception *exception() const;
|
||||||
Base *base;
|
QExplicitlySharedDataPointer<Base> base;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Q_CORE_EXPORT ExceptionStore
|
class Q_CORE_EXPORT ExceptionStore
|
||||||
|
@ -1642,6 +1642,21 @@ bool qSharedBuild()
|
|||||||
\sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_QWS
|
\sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_QWS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\macro QT_DISABLE_DEPRECATED_BEFORE
|
||||||
|
\relates <QtGlobal>
|
||||||
|
|
||||||
|
This macro can be defined in the project file to disable functions deprecated in
|
||||||
|
a specified version of Qt or any earlier version. The default version number is 5.0,
|
||||||
|
meaning that functions deprecated in or before Qt 5.0 will not be included.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
When using a future release of Qt 5, set QT_DISABLE_DEPRECATED_BEFORE=0x050100 to
|
||||||
|
disable functions deprecated in Qt 5.1 and earlier. In any release, set
|
||||||
|
QT_DISABLE_DEPRECATED_BEFORE=0x000000 to enable any functions, including the ones
|
||||||
|
deprecated in Qt 5.0
|
||||||
|
*/
|
||||||
|
|
||||||
#if defined(QT_BUILD_QMAKE)
|
#if defined(QT_BUILD_QMAKE)
|
||||||
// needed to bootstrap qmake
|
// needed to bootstrap qmake
|
||||||
static const unsigned int qt_one = 1;
|
static const unsigned int qt_one = 1;
|
||||||
|
@ -54,6 +54,23 @@
|
|||||||
*/
|
*/
|
||||||
#define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
|
#define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
|
||||||
|
|
||||||
|
#ifndef QT_DISABLE_DEPRECATED_BEFORE
|
||||||
|
#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(5, 0, 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
QT_DEPRECATED_SINCE(major, minor) evaluates as true if the Qt version is greater than
|
||||||
|
the deprecation point specified.
|
||||||
|
|
||||||
|
Use it to specify from which version of Qt a function or class has been deprecated
|
||||||
|
|
||||||
|
Example:
|
||||||
|
#if QT_DEPRECATED_SINCE(5,1)
|
||||||
|
QT_DEPRECATED void deprecatedFunction(); //function deprecated sine Qt 5.1
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
#define QT_DEPRECATED_SINCE(major, minor) (QT_VERSION_CHECK(major, minor, 0) > QT_DISABLE_DEPRECATED_BEFORE)
|
||||||
|
|
||||||
#define QT_PACKAGEDATE_STR "YYYY-MM-DD"
|
#define QT_PACKAGEDATE_STR "YYYY-MM-DD"
|
||||||
|
|
||||||
#define QT_PACKAGE_TAG ""
|
#define QT_PACKAGE_TAG ""
|
||||||
@ -516,6 +533,7 @@ namespace QT_NAMESPACE {}
|
|||||||
# endif
|
# endif
|
||||||
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
|
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
|
||||||
/* C++0x features supported in GCC 4.4: */
|
/* C++0x features supported in GCC 4.4: */
|
||||||
|
# define Q_COMPILER_UNICODE_STRINGS
|
||||||
# define Q_COMPILER_VARIADIC_TEMPLATES
|
# define Q_COMPILER_VARIADIC_TEMPLATES
|
||||||
# define Q_COMPILER_AUTO_TYPE
|
# define Q_COMPILER_AUTO_TYPE
|
||||||
# define Q_COMPILER_EXTERN_TEMPLATES
|
# define Q_COMPILER_EXTERN_TEMPLATES
|
||||||
@ -526,8 +544,12 @@ namespace QT_NAMESPACE {}
|
|||||||
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
|
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
|
||||||
/* C++0x features supported in GCC 4.5: */
|
/* C++0x features supported in GCC 4.5: */
|
||||||
# define Q_COMPILER_LAMBDA
|
# define Q_COMPILER_LAMBDA
|
||||||
# define Q_COMPILER_UNICODE_STRINGS
|
|
||||||
# endif
|
# endif
|
||||||
|
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
|
||||||
|
/* C++0x features supported in GCC 4.6: */
|
||||||
|
# define Q_COMPILER_CONSTEXPR
|
||||||
|
# endif
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* IBM compiler versions are a bit messy. There are actually two products:
|
/* IBM compiler versions are a bit messy. There are actually two products:
|
||||||
@ -961,6 +983,7 @@ QT_END_INCLUDE_NAMESPACE
|
|||||||
#error "Compiler doesn't support the bool type"
|
#error "Compiler doesn't support the bool type"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Constant bool values
|
Constant bool values
|
||||||
*/
|
*/
|
||||||
@ -1091,6 +1114,12 @@ redefine to built-in booleans to make autotests work properly */
|
|||||||
# define QT_FASTCALL
|
# define QT_FASTCALL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_COMPILER_CONSTEXPR
|
||||||
|
# define Q_DECL_CONSTEXPR constexpr
|
||||||
|
#else
|
||||||
|
# define Q_DECL_CONSTEXPR
|
||||||
|
#endif
|
||||||
|
|
||||||
//defines the type for the WNDPROC on windows
|
//defines the type for the WNDPROC on windows
|
||||||
//the alignment needs to be forced for sse2 to not crash with mingw
|
//the alignment needs to be forced for sse2 to not crash with mingw
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
@ -1104,10 +1133,6 @@ redefine to built-in booleans to make autotests work properly */
|
|||||||
|
|
||||||
typedef int QNoImplicitBoolCast;
|
typedef int QNoImplicitBoolCast;
|
||||||
|
|
||||||
#if defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6) || defined(QT_ARCH_AVR32) || (defined(QT_ARCH_MIPS) && (defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_WINCE))) || defined(QT_ARCH_SH) || defined(QT_ARCH_SH4A)
|
|
||||||
#define QT_NO_FPU
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// This logic must match the one in qmetatype.h
|
// This logic must match the one in qmetatype.h
|
||||||
#if defined(QT_COORD_TYPE)
|
#if defined(QT_COORD_TYPE)
|
||||||
typedef QT_COORD_TYPE qreal;
|
typedef QT_COORD_TYPE qreal;
|
||||||
@ -1122,25 +1147,25 @@ typedef double qreal;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
|
Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
|
||||||
|
|
||||||
inline int qRound(qreal d)
|
Q_DECL_CONSTEXPR inline int qRound(qreal d)
|
||||||
{ return d >= qreal(0.0) ? int(d + qreal(0.5)) : int(d - int(d-1) + qreal(0.5)) + int(d-1); }
|
{ return d >= qreal(0.0) ? int(d + qreal(0.5)) : int(d - int(d-1) + qreal(0.5)) + int(d-1); }
|
||||||
|
|
||||||
#if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN)
|
#if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN)
|
||||||
inline qint64 qRound64(double d)
|
Q_DECL_CONSTEXPR inline qint64 qRound64(double d)
|
||||||
{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); }
|
{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); }
|
||||||
#else
|
#else
|
||||||
inline qint64 qRound64(qreal d)
|
Q_DECL_CONSTEXPR inline qint64 qRound64(qreal d)
|
||||||
{ return d >= qreal(0.0) ? qint64(d + qreal(0.5)) : qint64(d - qreal(qint64(d-1)) + qreal(0.5)) + qint64(d-1); }
|
{ return d >= qreal(0.0) ? qint64(d + qreal(0.5)) : qint64(d - qreal(qint64(d-1)) + qreal(0.5)) + qint64(d-1); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline const T &qMin(const T &a, const T &b) { if (a < b) return a; return b; }
|
Q_DECL_CONSTEXPR inline const T &qMin(const T &a, const T &b) { return (a < b) ? a : b; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline const T &qMax(const T &a, const T &b) { if (a < b) return b; return a; }
|
Q_DECL_CONSTEXPR inline const T &qMax(const T &a, const T &b) { return (a < b) ? b : a; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline const T &qBound(const T &min, const T &val, const T &max)
|
Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max)
|
||||||
{ return qMax(min, qMin(max, val)); }
|
{ return qMax(min, qMin(max, val)); }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1914,12 +1939,12 @@ inline bool operator!=(QBool b1, bool b2) { return !b1 != !b2; }
|
|||||||
inline bool operator!=(bool b1, QBool b2) { return !b1 != !b2; }
|
inline bool operator!=(bool b1, QBool b2) { return !b1 != !b2; }
|
||||||
inline bool operator!=(QBool b1, QBool b2) { return !b1 != !b2; }
|
inline bool operator!=(QBool b1, QBool b2) { return !b1 != !b2; }
|
||||||
|
|
||||||
static inline bool qFuzzyCompare(double p1, double p2)
|
Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2)
|
||||||
{
|
{
|
||||||
return (qAbs(p1 - p2) <= 0.000000000001 * qMin(qAbs(p1), qAbs(p2)));
|
return (qAbs(p1 - p2) <= 0.000000000001 * qMin(qAbs(p1), qAbs(p2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool qFuzzyCompare(float p1, float p2)
|
Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
|
||||||
{
|
{
|
||||||
return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2)));
|
return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2)));
|
||||||
}
|
}
|
||||||
@ -1927,7 +1952,7 @@ static inline bool qFuzzyCompare(float p1, float p2)
|
|||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
static inline bool qFuzzyIsNull(double d)
|
Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d)
|
||||||
{
|
{
|
||||||
return qAbs(d) <= 0.000000000001;
|
return qAbs(d) <= 0.000000000001;
|
||||||
}
|
}
|
||||||
@ -1935,7 +1960,7 @@ static inline bool qFuzzyIsNull(double d)
|
|||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
static inline bool qFuzzyIsNull(float f)
|
Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f)
|
||||||
{
|
{
|
||||||
return qAbs(f) <= 0.00001f;
|
return qAbs(f) <= 0.00001f;
|
||||||
}
|
}
|
||||||
@ -2203,9 +2228,9 @@ class QFlags
|
|||||||
int i;
|
int i;
|
||||||
public:
|
public:
|
||||||
typedef Enum enum_type;
|
typedef Enum enum_type;
|
||||||
inline QFlags(const QFlags &f) : i(f.i) {}
|
Q_DECL_CONSTEXPR inline QFlags(const QFlags &f) : i(f.i) {}
|
||||||
inline QFlags(Enum f) : i(f) {}
|
Q_DECL_CONSTEXPR inline QFlags(Enum f) : i(f) {}
|
||||||
inline QFlags(Zero = 0) : i(0) {}
|
Q_DECL_CONSTEXPR inline QFlags(Zero = 0) : i(0) {}
|
||||||
inline QFlags(QFlag f) : i(f) {}
|
inline QFlags(QFlag f) : i(f) {}
|
||||||
|
|
||||||
inline QFlags &operator=(const QFlags &f) { i = f.i; return *this; }
|
inline QFlags &operator=(const QFlags &f) { i = f.i; return *this; }
|
||||||
@ -2216,18 +2241,18 @@ public:
|
|||||||
inline QFlags &operator^=(QFlags f) { i ^= f.i; return *this; }
|
inline QFlags &operator^=(QFlags f) { i ^= f.i; return *this; }
|
||||||
inline QFlags &operator^=(Enum f) { i ^= f; return *this; }
|
inline QFlags &operator^=(Enum f) { i ^= f; return *this; }
|
||||||
|
|
||||||
inline operator int() const { return i; }
|
Q_DECL_CONSTEXPR inline operator int() const { return i; }
|
||||||
|
|
||||||
inline QFlags operator|(QFlags f) const { QFlags g; g.i = i | f.i; return g; }
|
Q_DECL_CONSTEXPR inline QFlags operator|(QFlags f) const { return QFlags(Enum(i | f.i)); }
|
||||||
inline QFlags operator|(Enum f) const { QFlags g; g.i = i | f; return g; }
|
Q_DECL_CONSTEXPR inline QFlags operator|(Enum f) const { return QFlags(Enum(i | f)); }
|
||||||
inline QFlags operator^(QFlags f) const { QFlags g; g.i = i ^ f.i; return g; }
|
Q_DECL_CONSTEXPR inline QFlags operator^(QFlags f) const { return QFlags(Enum(i ^ f.i)); }
|
||||||
inline QFlags operator^(Enum f) const { QFlags g; g.i = i ^ f; return g; }
|
Q_DECL_CONSTEXPR inline QFlags operator^(Enum f) const { return QFlags(Enum(i ^ f)); }
|
||||||
inline QFlags operator&(int mask) const { QFlags g; g.i = i & mask; return g; }
|
Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const { return QFlags(Enum(i & mask)); }
|
||||||
inline QFlags operator&(uint mask) const { QFlags g; g.i = i & mask; return g; }
|
Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const { return QFlags(Enum(i & mask)); }
|
||||||
inline QFlags operator&(Enum f) const { QFlags g; g.i = i & f; return g; }
|
Q_DECL_CONSTEXPR inline QFlags operator&(Enum f) const { return QFlags(Enum(i & f)); }
|
||||||
inline QFlags operator~() const { QFlags g; g.i = ~i; return g; }
|
Q_DECL_CONSTEXPR inline QFlags operator~() const { return QFlags(Enum(~i)); }
|
||||||
|
|
||||||
inline bool operator!() const { return !i; }
|
Q_DECL_CONSTEXPR inline bool operator!() const { return !i; }
|
||||||
|
|
||||||
inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == int(f) ); }
|
inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == int(f) ); }
|
||||||
};
|
};
|
||||||
@ -2240,9 +2265,9 @@ inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) \
|
|||||||
{ return QIncompatibleFlag(int(f1) | f2); }
|
{ return QIncompatibleFlag(int(f1) | f2); }
|
||||||
|
|
||||||
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \
|
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \
|
||||||
inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \
|
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \
|
||||||
{ return QFlags<Flags::enum_type>(f1) | f2; } \
|
{ return QFlags<Flags::enum_type>(f1) | f2; } \
|
||||||
inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \
|
Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \
|
||||||
{ return f2 | f1; } Q_DECLARE_INCOMPATIBLE_FLAGS(Flags)
|
{ return f2 | f1; } Q_DECLARE_INCOMPATIBLE_FLAGS(Flags)
|
||||||
|
|
||||||
|
|
||||||
|
@ -296,11 +296,6 @@ QLibraryInfo::location(LibraryLocation loc)
|
|||||||
case ExamplesPath:
|
case ExamplesPath:
|
||||||
path = QT_CONFIGURE_EXAMPLES_PATH;
|
path = QT_CONFIGURE_EXAMPLES_PATH;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef QT_CONFIGURE_DEMOS_PATH
|
|
||||||
case DemosPath:
|
|
||||||
path = QT_CONFIGURE_DEMOS_PATH;
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -352,9 +347,6 @@ QLibraryInfo::location(LibraryLocation loc)
|
|||||||
case ExamplesPath:
|
case ExamplesPath:
|
||||||
key = QLatin1String("Examples");
|
key = QLatin1String("Examples");
|
||||||
break;
|
break;
|
||||||
case DemosPath:
|
|
||||||
key = QLatin1String("Demos");
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -500,7 +492,6 @@ QLibraryInfo::location(LibraryLocation loc)
|
|||||||
\value TranslationsPath The location of translation information for Qt strings.
|
\value TranslationsPath The location of translation information for Qt strings.
|
||||||
\value SettingsPath The location for Qt settings.
|
\value SettingsPath The location for Qt settings.
|
||||||
\value ExamplesPath The location for examples upon install.
|
\value ExamplesPath The location for examples upon install.
|
||||||
\value DemosPath The location for demos upon install.
|
|
||||||
|
|
||||||
\sa location()
|
\sa location()
|
||||||
*/
|
*/
|
||||||
|
@ -75,7 +75,6 @@ public:
|
|||||||
DataPath,
|
DataPath,
|
||||||
TranslationsPath,
|
TranslationsPath,
|
||||||
SettingsPath,
|
SettingsPath,
|
||||||
DemosPath,
|
|
||||||
ExamplesPath,
|
ExamplesPath,
|
||||||
ImportsPath
|
ImportsPath
|
||||||
};
|
};
|
||||||
|
@ -7,29 +7,29 @@
|
|||||||
** This file is part of the QtCore module of the Qt Toolkit.
|
** This file is part of the QtCore module of the Qt Toolkit.
|
||||||
**
|
**
|
||||||
** $QT_BEGIN_LICENSE:LGPL$
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
** No Commercial Usage
|
|
||||||
** This file contains pre-release code and may not be distributed.
|
|
||||||
** You may use this file in accordance with the terms and conditions
|
|
||||||
** contained in the Technology Preview License Agreement accompanying
|
|
||||||
** this package.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
** General Public License version 2.1 as published by the Free Software
|
** License version 2.1 as published by the Free Software Foundation and
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||||
** packaging of this file. Please review the following information to
|
** file. Please review the following information to ensure the GNU Lesser
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
** General Public License version 2.1 requirements will be met:
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
**
|
**
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
**
|
**
|
||||||
** If you have questions regarding the use of this file, please contact
|
** GNU General Public License Usage
|
||||||
** Nokia at qt-info@nokia.com.
|
** Alternatively, this file may be used under the terms of the GNU General
|
||||||
**
|
** Public License version 3.0 as published by the Free Software Foundation
|
||||||
**
|
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||||
|
** file. Please review the following information to ensure the GNU General
|
||||||
|
** Public License version 3.0 requirements will be met:
|
||||||
|
** http://www.gnu.org/copyleft/gpl.html.
|
||||||
**
|
**
|
||||||
|
** Other Usage
|
||||||
|
** Alternatively, this file may be used in accordance with the terms and
|
||||||
|
** conditions contained in a signed written agreement between you and Nokia.
|
||||||
**
|
**
|
||||||
**
|
**
|
||||||
**
|
**
|
||||||
|
@ -7,29 +7,29 @@
|
|||||||
** This file is part of the QtCore module of the Qt Toolkit.
|
** This file is part of the QtCore module of the Qt Toolkit.
|
||||||
**
|
**
|
||||||
** $QT_BEGIN_LICENSE:LGPL$
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
** No Commercial Usage
|
|
||||||
** This file contains pre-release code and may not be distributed.
|
|
||||||
** You may use this file in accordance with the terms and conditions
|
|
||||||
** contained in the Technology Preview License Agreement accompanying
|
|
||||||
** this package.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
** General Public License version 2.1 as published by the Free Software
|
** License version 2.1 as published by the Free Software Foundation and
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||||
** packaging of this file. Please review the following information to
|
** file. Please review the following information to ensure the GNU Lesser
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
** General Public License version 2.1 requirements will be met:
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
**
|
**
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
**
|
**
|
||||||
** If you have questions regarding the use of this file, please contact
|
** GNU General Public License Usage
|
||||||
** Nokia at qt-info@nokia.com.
|
** Alternatively, this file may be used under the terms of the GNU General
|
||||||
**
|
** Public License version 3.0 as published by the Free Software Foundation
|
||||||
**
|
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||||
|
** file. Please review the following information to ensure the GNU General
|
||||||
|
** Public License version 3.0 requirements will be met:
|
||||||
|
** http://www.gnu.org/copyleft/gpl.html.
|
||||||
**
|
**
|
||||||
|
** Other Usage
|
||||||
|
** Alternatively, this file may be used in accordance with the terms and
|
||||||
|
** conditions contained in a signed written agreement between you and Nokia.
|
||||||
**
|
**
|
||||||
**
|
**
|
||||||
**
|
**
|
||||||
|
@ -805,7 +805,16 @@ bool QCoreApplication::notifyInternal(QObject *receiver, QEvent *event)
|
|||||||
// call overhead.
|
// call overhead.
|
||||||
QObjectPrivate *d = receiver->d_func();
|
QObjectPrivate *d = receiver->d_func();
|
||||||
QThreadData *threadData = d->threadData;
|
QThreadData *threadData = d->threadData;
|
||||||
++threadData->loopLevel;
|
|
||||||
|
// Exception-safety without try/catch
|
||||||
|
struct Incrementer {
|
||||||
|
int &variable;
|
||||||
|
inline Incrementer(int &variable) : variable(variable)
|
||||||
|
{ ++variable; }
|
||||||
|
inline ~Incrementer()
|
||||||
|
{ --variable; }
|
||||||
|
};
|
||||||
|
Incrementer inc(threadData->loopLevel);
|
||||||
|
|
||||||
#ifdef QT_JAMBI_BUILD
|
#ifdef QT_JAMBI_BUILD
|
||||||
int deleteWatch = 0;
|
int deleteWatch = 0;
|
||||||
@ -816,12 +825,7 @@ bool QCoreApplication::notifyInternal(QObject *receiver, QEvent *event)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool returnValue;
|
bool returnValue;
|
||||||
QT_TRY {
|
returnValue = notify(receiver, event);
|
||||||
returnValue = notify(receiver, event);
|
|
||||||
} QT_CATCH (...) {
|
|
||||||
--threadData->loopLevel;
|
|
||||||
QT_RETHROW;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef QT_JAMBI_BUILD
|
#ifdef QT_JAMBI_BUILD
|
||||||
// Restore the previous state if the object was not deleted..
|
// Restore the previous state if the object was not deleted..
|
||||||
@ -830,7 +834,6 @@ bool QCoreApplication::notifyInternal(QObject *receiver, QEvent *event)
|
|||||||
}
|
}
|
||||||
QObjectPrivate::resetDeleteWatch(d, oldDeleteWatch, deleteWatch);
|
QObjectPrivate::resetDeleteWatch(d, oldDeleteWatch, deleteWatch);
|
||||||
#endif
|
#endif
|
||||||
--threadData->loopLevel;
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1373,6 +1376,40 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
|
|||||||
int &i = (!event_type && !receiver) ? data->postEventList.startOffset : startOffset;
|
int &i = (!event_type && !receiver) ? data->postEventList.startOffset : startOffset;
|
||||||
data->postEventList.insertionOffset = data->postEventList.size();
|
data->postEventList.insertionOffset = data->postEventList.size();
|
||||||
|
|
||||||
|
// Exception-safe cleaning up without the need for a try/catch block
|
||||||
|
struct CleanUp {
|
||||||
|
QObject *receiver;
|
||||||
|
int event_type;
|
||||||
|
QThreadData *data;
|
||||||
|
bool exceptionCaught;
|
||||||
|
|
||||||
|
inline CleanUp(QObject *receiver, int event_type, QThreadData *data) :
|
||||||
|
receiver(receiver), event_type(event_type), data(data), exceptionCaught(true)
|
||||||
|
{}
|
||||||
|
inline ~CleanUp()
|
||||||
|
{
|
||||||
|
if (exceptionCaught) {
|
||||||
|
// since we were interrupted, we need another pass to make sure we clean everything up
|
||||||
|
data->canWait = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
--data->postEventList.recursion;
|
||||||
|
if (!data->postEventList.recursion && !data->canWait && data->eventDispatcher)
|
||||||
|
data->eventDispatcher->wakeUp();
|
||||||
|
|
||||||
|
// clear the global list, i.e. remove everything that was
|
||||||
|
// delivered.
|
||||||
|
if (!event_type && !receiver && data->postEventList.startOffset >= 0) {
|
||||||
|
const QPostEventList::iterator it = data->postEventList.begin();
|
||||||
|
data->postEventList.erase(it, it + data->postEventList.startOffset);
|
||||||
|
data->postEventList.insertionOffset -= data->postEventList.startOffset;
|
||||||
|
Q_ASSERT(data->postEventList.insertionOffset >= 0);
|
||||||
|
data->postEventList.startOffset = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
CleanUp cleanup(receiver, event_type, data);
|
||||||
|
|
||||||
while (i < data->postEventList.size()) {
|
while (i < data->postEventList.size()) {
|
||||||
// avoid live-lock
|
// avoid live-lock
|
||||||
if (i >= data->postEventList.insertionOffset)
|
if (i >= data->postEventList.insertionOffset)
|
||||||
@ -1411,7 +1448,7 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
|
|||||||
// first, we diddle the event so that we can deliver
|
// first, we diddle the event so that we can deliver
|
||||||
// it, and that no one will try to touch it later.
|
// it, and that no one will try to touch it later.
|
||||||
pe.event->posted = false;
|
pe.event->posted = false;
|
||||||
QEvent * e = pe.event;
|
QScopedPointer<QEvent> e(pe.event);
|
||||||
QObject * r = pe.receiver;
|
QObject * r = pe.receiver;
|
||||||
|
|
||||||
--r->d_func()->postedEvents;
|
--r->d_func()->postedEvents;
|
||||||
@ -1421,49 +1458,23 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
|
|||||||
// for the next event.
|
// for the next event.
|
||||||
const_cast<QPostEvent &>(pe).event = 0;
|
const_cast<QPostEvent &>(pe).event = 0;
|
||||||
|
|
||||||
locker.unlock();
|
struct MutexUnlocker
|
||||||
|
{
|
||||||
|
QMutexLocker &m;
|
||||||
|
MutexUnlocker(QMutexLocker &m) : m(m) { m.unlock(); }
|
||||||
|
~MutexUnlocker() { m.relock(); }
|
||||||
|
};
|
||||||
|
MutexUnlocker unlocker(locker);
|
||||||
|
|
||||||
// after all that work, it's time to deliver the event.
|
// after all that work, it's time to deliver the event.
|
||||||
#ifdef QT_NO_EXCEPTIONS
|
QCoreApplication::sendEvent(r, e.data());
|
||||||
QCoreApplication::sendEvent(r, e);
|
|
||||||
#else
|
|
||||||
try {
|
|
||||||
QCoreApplication::sendEvent(r, e);
|
|
||||||
} catch (...) {
|
|
||||||
delete e;
|
|
||||||
locker.relock();
|
|
||||||
|
|
||||||
// since we were interrupted, we need another pass to make sure we clean everything up
|
|
||||||
data->canWait = false;
|
|
||||||
|
|
||||||
// uglehack: copied from below
|
|
||||||
--data->postEventList.recursion;
|
|
||||||
if (!data->postEventList.recursion && !data->canWait && data->eventDispatcher)
|
|
||||||
data->eventDispatcher->wakeUp();
|
|
||||||
throw; // rethrow
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
delete e;
|
|
||||||
locker.relock();
|
|
||||||
|
|
||||||
// careful when adding anything below this point - the
|
// careful when adding anything below this point - the
|
||||||
// sendEvent() call might invalidate any invariants this
|
// sendEvent() call might invalidate any invariants this
|
||||||
// function depends on.
|
// function depends on.
|
||||||
}
|
}
|
||||||
|
|
||||||
--data->postEventList.recursion;
|
cleanup.exceptionCaught = false;
|
||||||
if (!data->postEventList.recursion && !data->canWait && data->eventDispatcher)
|
|
||||||
data->eventDispatcher->wakeUp();
|
|
||||||
|
|
||||||
// clear the global list, i.e. remove everything that was
|
|
||||||
// delivered.
|
|
||||||
if (!event_type && !receiver && data->postEventList.startOffset >= 0) {
|
|
||||||
const QPostEventList::iterator it = data->postEventList.begin();
|
|
||||||
data->postEventList.erase(it, it + data->postEventList.startOffset);
|
|
||||||
data->postEventList.insertionOffset -= data->postEventList.startOffset;
|
|
||||||
Q_ASSERT(data->postEventList.insertionOffset >= 0);
|
|
||||||
data->postEventList.startOffset = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -184,49 +184,47 @@ int QEventLoop::exec(ProcessEventsFlags flags)
|
|||||||
qWarning("QEventLoop::exec: instance %p has already called exec()", this);
|
qWarning("QEventLoop::exec: instance %p has already called exec()", this);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
d->inExec = true;
|
|
||||||
d->exit = false;
|
struct LoopReference {
|
||||||
++d->threadData->loopLevel;
|
QEventLoopPrivate *d;
|
||||||
d->threadData->eventLoops.push(this);
|
QMutexLocker &locker;
|
||||||
locker.unlock();
|
|
||||||
|
bool exceptionCaught;
|
||||||
|
LoopReference(QEventLoopPrivate *d, QMutexLocker &locker) : d(d), locker(locker), exceptionCaught(true)
|
||||||
|
{
|
||||||
|
d->inExec = true;
|
||||||
|
d->exit = false;
|
||||||
|
++d->threadData->loopLevel;
|
||||||
|
d->threadData->eventLoops.push(d->q_func());
|
||||||
|
locker.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
~LoopReference()
|
||||||
|
{
|
||||||
|
if (exceptionCaught) {
|
||||||
|
qWarning("Qt has caught an exception thrown from an event handler. Throwing\n"
|
||||||
|
"exceptions from an event handler is not supported in Qt. You must\n"
|
||||||
|
"reimplement QApplication::notify() and catch all exceptions there.\n");
|
||||||
|
}
|
||||||
|
locker.relock();
|
||||||
|
QEventLoop *eventLoop = d->threadData->eventLoops.pop();
|
||||||
|
Q_ASSERT_X(eventLoop == d->q_func(), "QEventLoop::exec()", "internal error");
|
||||||
|
Q_UNUSED(eventLoop); // --release warning
|
||||||
|
d->inExec = false;
|
||||||
|
--d->threadData->loopLevel;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
LoopReference ref(d, locker);
|
||||||
|
|
||||||
// remove posted quit events when entering a new event loop
|
// remove posted quit events when entering a new event loop
|
||||||
QCoreApplication *app = QCoreApplication::instance();
|
QCoreApplication *app = QCoreApplication::instance();
|
||||||
if (app && app->thread() == thread())
|
if (app && app->thread() == thread())
|
||||||
QCoreApplication::removePostedEvents(app, QEvent::Quit);
|
QCoreApplication::removePostedEvents(app, QEvent::Quit);
|
||||||
|
|
||||||
#if defined(QT_NO_EXCEPTIONS)
|
|
||||||
while (!d->exit)
|
while (!d->exit)
|
||||||
processEvents(flags | WaitForMoreEvents | EventLoopExec);
|
processEvents(flags | WaitForMoreEvents | EventLoopExec);
|
||||||
#else
|
|
||||||
try {
|
|
||||||
while (!d->exit)
|
|
||||||
processEvents(flags | WaitForMoreEvents | EventLoopExec);
|
|
||||||
} catch (...) {
|
|
||||||
qWarning("Qt has caught an exception thrown from an event handler. Throwing\n"
|
|
||||||
"exceptions from an event handler is not supported in Qt. You must\n"
|
|
||||||
"reimplement QApplication::notify() and catch all exceptions there.\n");
|
|
||||||
|
|
||||||
// copied from below
|
|
||||||
locker.relock();
|
|
||||||
QEventLoop *eventLoop = d->threadData->eventLoops.pop();
|
|
||||||
Q_ASSERT_X(eventLoop == this, "QEventLoop::exec()", "internal error");
|
|
||||||
Q_UNUSED(eventLoop); // --release warning
|
|
||||||
d->inExec = false;
|
|
||||||
--d->threadData->loopLevel;
|
|
||||||
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// copied above
|
|
||||||
locker.relock();
|
|
||||||
QEventLoop *eventLoop = d->threadData->eventLoops.pop();
|
|
||||||
Q_ASSERT_X(eventLoop == this, "QEventLoop::exec()", "internal error");
|
|
||||||
Q_UNUSED(eventLoop); // --release warning
|
|
||||||
d->inExec = false;
|
|
||||||
--d->threadData->loopLevel;
|
|
||||||
|
|
||||||
|
ref.exceptionCaught = false;
|
||||||
return d->returnCode;
|
return d->returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,6 +125,39 @@ extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct QConnectionSenderSwitcher {
|
||||||
|
QObject *receiver;
|
||||||
|
QObjectPrivate::Sender *previousSender;
|
||||||
|
QObjectPrivate::Sender currentSender;
|
||||||
|
bool switched;
|
||||||
|
|
||||||
|
inline QConnectionSenderSwitcher() : switched(false) {}
|
||||||
|
|
||||||
|
inline QConnectionSenderSwitcher(QObject *receiver, QObject *sender, int signal_absolute_id)
|
||||||
|
{
|
||||||
|
switchSender(receiver, sender, signal_absolute_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void switchSender(QObject *receiver, QObject *sender, int signal_absolute_id)
|
||||||
|
{
|
||||||
|
this->receiver = receiver;
|
||||||
|
currentSender.sender = sender;
|
||||||
|
currentSender.signal = signal_absolute_id;
|
||||||
|
currentSender.ref = 1;
|
||||||
|
previousSender = QObjectPrivate::setCurrentSender(receiver, ¤tSender);
|
||||||
|
switched = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ~QConnectionSenderSwitcher()
|
||||||
|
{
|
||||||
|
if (switched)
|
||||||
|
QObjectPrivate::resetCurrentSender(receiver, ¤tSender, previousSender);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(QConnectionSenderSwitcher)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = 0;
|
void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = 0;
|
||||||
void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = 0;
|
void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = 0;
|
||||||
void (*QAbstractDeclarativeData::objectNameChanged)(QAbstractDeclarativeData *, QObject *) = 0;
|
void (*QAbstractDeclarativeData::objectNameChanged)(QAbstractDeclarativeData *, QObject *) = 0;
|
||||||
@ -1084,23 +1117,10 @@ bool QObject::event(QEvent *e)
|
|||||||
d_func()->inEventHandler = false;
|
d_func()->inEventHandler = false;
|
||||||
#endif
|
#endif
|
||||||
QMetaCallEvent *mce = static_cast<QMetaCallEvent*>(e);
|
QMetaCallEvent *mce = static_cast<QMetaCallEvent*>(e);
|
||||||
QObjectPrivate::Sender currentSender;
|
|
||||||
currentSender.sender = const_cast<QObject*>(mce->sender());
|
QConnectionSenderSwitcher sw(this, const_cast<QObject*>(mce->sender()), mce->signalId());
|
||||||
currentSender.signal = mce->signalId();
|
|
||||||
currentSender.ref = 1;
|
|
||||||
QObjectPrivate::Sender * const previousSender =
|
|
||||||
QObjectPrivate::setCurrentSender(this, ¤tSender);
|
|
||||||
#if defined(QT_NO_EXCEPTIONS)
|
|
||||||
mce->placeMetaCall(this);
|
mce->placeMetaCall(this);
|
||||||
#else
|
|
||||||
QT_TRY {
|
|
||||||
mce->placeMetaCall(this);
|
|
||||||
} QT_CATCH(...) {
|
|
||||||
QObjectPrivate::resetCurrentSender(this, ¤tSender, previousSender);
|
|
||||||
QT_RETHROW;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
QObjectPrivate::resetCurrentSender(this, ¤tSender, previousSender);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2977,7 +2997,7 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index,
|
|||||||
type &= Qt::UniqueConnection - 1;
|
type &= Qt::UniqueConnection - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QObjectPrivate::Connection *c = new QObjectPrivate::Connection;
|
QScopedPointer<QObjectPrivate::Connection> c(new QObjectPrivate::Connection);
|
||||||
c->sender = s;
|
c->sender = s;
|
||||||
c->receiver = r;
|
c->receiver = r;
|
||||||
c->method_relative = method_index;
|
c->method_relative = method_index;
|
||||||
@ -2987,16 +3007,11 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index,
|
|||||||
c->nextConnectionList = 0;
|
c->nextConnectionList = 0;
|
||||||
c->callFunction = callFunction;
|
c->callFunction = callFunction;
|
||||||
|
|
||||||
QT_TRY {
|
QObjectPrivate::get(s)->addConnection(signal_index, c.data());
|
||||||
QObjectPrivate::get(s)->addConnection(signal_index, c);
|
|
||||||
} QT_CATCH(...) {
|
|
||||||
delete c;
|
|
||||||
QT_RETHROW;
|
|
||||||
}
|
|
||||||
|
|
||||||
c->prev = &(QObjectPrivate::get(r)->senders);
|
c->prev = &(QObjectPrivate::get(r)->senders);
|
||||||
c->next = *c->prev;
|
c->next = *c->prev;
|
||||||
*c->prev = c;
|
*c->prev = c.data();
|
||||||
if (c->next)
|
if (c->next)
|
||||||
c->next->prev = &c->next;
|
c->next->prev = &c->next;
|
||||||
|
|
||||||
@ -3007,6 +3022,7 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index,
|
|||||||
sender_d->connectedSignals[signal_index >> 5] |= (1 << (signal_index & 0x1f));
|
sender_d->connectedSignals[signal_index >> 5] |= (1 << (signal_index & 0x1f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.take(); // stop tracking
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3265,16 +3281,37 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
|||||||
|
|
||||||
Qt::HANDLE currentThreadId = QThread::currentThreadId();
|
Qt::HANDLE currentThreadId = QThread::currentThreadId();
|
||||||
|
|
||||||
|
{
|
||||||
QMutexLocker locker(signalSlotLock(sender));
|
QMutexLocker locker(signalSlotLock(sender));
|
||||||
QObjectConnectionListVector *connectionLists = sender->d_func()->connectionLists;
|
struct ConnectionListsRef {
|
||||||
if (!connectionLists) {
|
QObjectConnectionListVector *connectionLists;
|
||||||
|
ConnectionListsRef(QObjectConnectionListVector *connectionLists) : connectionLists(connectionLists)
|
||||||
|
{
|
||||||
|
if (connectionLists)
|
||||||
|
++connectionLists->inUse;
|
||||||
|
}
|
||||||
|
~ConnectionListsRef()
|
||||||
|
{
|
||||||
|
if (!connectionLists)
|
||||||
|
return;
|
||||||
|
|
||||||
|
--connectionLists->inUse;
|
||||||
|
Q_ASSERT(connectionLists->inUse >= 0);
|
||||||
|
if (connectionLists->orphaned) {
|
||||||
|
if (!connectionLists->inUse)
|
||||||
|
delete connectionLists;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QObjectConnectionListVector *operator->() const { return connectionLists; }
|
||||||
|
};
|
||||||
|
ConnectionListsRef connectionLists = sender->d_func()->connectionLists;
|
||||||
|
if (!connectionLists.connectionLists) {
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
if (qt_signal_spy_callback_set.signal_end_callback != 0)
|
if (qt_signal_spy_callback_set.signal_end_callback != 0)
|
||||||
qt_signal_spy_callback_set.signal_end_callback(sender, signal_absolute_index);
|
qt_signal_spy_callback_set.signal_end_callback(sender, signal_absolute_index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
++connectionLists->inUse;
|
|
||||||
|
|
||||||
|
|
||||||
const QObjectPrivate::ConnectionList *list;
|
const QObjectPrivate::ConnectionList *list;
|
||||||
if (signal_index < connectionLists->count())
|
if (signal_index < connectionLists->count())
|
||||||
@ -3324,13 +3361,10 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QObjectPrivate::Sender currentSender;
|
QConnectionSenderSwitcher sw;
|
||||||
QObjectPrivate::Sender *previousSender = 0;
|
|
||||||
if (receiverInSameThread) {
|
if (receiverInSameThread) {
|
||||||
currentSender.sender = sender;
|
sw.switchSender(receiver, sender, signal_absolute_index);
|
||||||
currentSender.signal = signal_absolute_index;
|
|
||||||
currentSender.ref = 1;
|
|
||||||
previousSender = QObjectPrivate::setCurrentSender(receiver, ¤tSender);
|
|
||||||
}
|
}
|
||||||
const QObjectPrivate::StaticMetaCallFunction callFunction = c->callFunction;
|
const QObjectPrivate::StaticMetaCallFunction callFunction = c->callFunction;
|
||||||
const int method_relative = c->method_relative;
|
const int method_relative = c->method_relative;
|
||||||
@ -3355,23 +3389,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
|||||||
argv ? argv : empty_argv);
|
argv ? argv : empty_argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(QT_NO_EXCEPTIONS)
|
|
||||||
metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv);
|
metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv);
|
||||||
#else
|
|
||||||
QT_TRY {
|
|
||||||
metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv);
|
|
||||||
} QT_CATCH(...) {
|
|
||||||
locker.relock();
|
|
||||||
if (receiverInSameThread)
|
|
||||||
QObjectPrivate::resetCurrentSender(receiver, ¤tSender, previousSender);
|
|
||||||
|
|
||||||
--connectionLists->inUse;
|
|
||||||
Q_ASSERT(connectionLists->inUse >= 0);
|
|
||||||
if (connectionLists->orphaned && !connectionLists->inUse)
|
|
||||||
delete connectionLists;
|
|
||||||
QT_RETHROW;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (qt_signal_spy_callback_set.slot_end_callback != 0)
|
if (qt_signal_spy_callback_set.slot_end_callback != 0)
|
||||||
qt_signal_spy_callback_set.slot_end_callback(receiver, method);
|
qt_signal_spy_callback_set.slot_end_callback(receiver, method);
|
||||||
@ -3379,9 +3397,6 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
|||||||
locker.relock();
|
locker.relock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (receiverInSameThread)
|
|
||||||
QObjectPrivate::resetCurrentSender(receiver, ¤tSender, previousSender);
|
|
||||||
|
|
||||||
if (connectionLists->orphaned)
|
if (connectionLists->orphaned)
|
||||||
break;
|
break;
|
||||||
} while (c != last && (c = c->nextConnectionList) != 0);
|
} while (c != last && (c = c->nextConnectionList) != 0);
|
||||||
@ -3392,17 +3407,8 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
|||||||
//start over for all signals;
|
//start over for all signals;
|
||||||
((list = &connectionLists->allsignals), true));
|
((list = &connectionLists->allsignals), true));
|
||||||
|
|
||||||
--connectionLists->inUse;
|
|
||||||
Q_ASSERT(connectionLists->inUse >= 0);
|
|
||||||
if (connectionLists->orphaned) {
|
|
||||||
if (!connectionLists->inUse)
|
|
||||||
delete connectionLists;
|
|
||||||
} else if (connectionLists->dirty) {
|
|
||||||
sender->d_func()->cleanConnectionLists();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
locker.unlock();
|
|
||||||
|
|
||||||
if (qt_signal_spy_callback_set.signal_end_callback != 0)
|
if (qt_signal_spy_callback_set.signal_end_callback != 0)
|
||||||
qt_signal_spy_callback_set.signal_end_callback(sender, signal_absolute_index);
|
qt_signal_spy_callback_set.signal_end_callback(sender, signal_absolute_index);
|
||||||
|
|
||||||
|
@ -172,15 +172,9 @@ public:
|
|||||||
inline bool isSharedWith(const QByteArray &other) const { return d == other.d; }
|
inline bool isSharedWith(const QByteArray &other) const { return d == other.d; }
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
const char at(int i) const;
|
|
||||||
const char operator[](int i) const;
|
|
||||||
const char operator[](uint i) const;
|
|
||||||
#else
|
|
||||||
char at(int i) const;
|
char at(int i) const;
|
||||||
char operator[](int i) const;
|
char operator[](int i) const;
|
||||||
char operator[](uint i) const;
|
char operator[](uint i) const;
|
||||||
#endif
|
|
||||||
QByteRef operator[](int i);
|
QByteRef operator[](int i);
|
||||||
QByteRef operator[](uint i);
|
QByteRef operator[](uint i);
|
||||||
|
|
||||||
@ -359,21 +353,12 @@ inline QByteArray::~QByteArray() { if (!d->ref.deref()) qFree(d); }
|
|||||||
inline int QByteArray::size() const
|
inline int QByteArray::size() const
|
||||||
{ return d->size; }
|
{ return d->size; }
|
||||||
|
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
inline const char QByteArray::at(int i) const
|
|
||||||
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
|
|
||||||
inline const char QByteArray::operator[](int i) const
|
|
||||||
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
|
|
||||||
inline const char QByteArray::operator[](uint i) const
|
|
||||||
{ Q_ASSERT(i < uint(size())); return d->data[i]; }
|
|
||||||
#else
|
|
||||||
inline char QByteArray::at(int i) const
|
inline char QByteArray::at(int i) const
|
||||||
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
|
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
|
||||||
inline char QByteArray::operator[](int i) const
|
inline char QByteArray::operator[](int i) const
|
||||||
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
|
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
|
||||||
inline char QByteArray::operator[](uint i) const
|
inline char QByteArray::operator[](uint i) const
|
||||||
{ Q_ASSERT(i < uint(size())); return d->data[i]; }
|
{ Q_ASSERT(i < uint(size())); return d->data[i]; }
|
||||||
#endif
|
|
||||||
|
|
||||||
inline bool QByteArray::isEmpty() const
|
inline bool QByteArray::isEmpty() const
|
||||||
{ return d->size == 0; }
|
{ return d->size == 0; }
|
||||||
@ -412,13 +397,8 @@ class Q_CORE_EXPORT QByteRef {
|
|||||||
: a(array),i(idx) {}
|
: a(array),i(idx) {}
|
||||||
friend class QByteArray;
|
friend class QByteArray;
|
||||||
public:
|
public:
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
inline operator const char() const
|
|
||||||
{ return i < a.d->size ? a.d->data[i] : char(0); }
|
|
||||||
#else
|
|
||||||
inline operator char() const
|
inline operator char() const
|
||||||
{ return i < a.d->size ? a.d->data[i] : char(0); }
|
{ return i < a.d->size ? a.d->data[i] : char(0); }
|
||||||
#endif
|
|
||||||
inline QByteRef &operator=(char c)
|
inline QByteRef &operator=(char c)
|
||||||
{ if (i >= a.d->size) a.expand(i); else a.detach();
|
{ if (i >= a.d->size) a.expand(i); else a.detach();
|
||||||
a.d->data[i] = c; return *this; }
|
a.d->data[i] = c; return *this; }
|
||||||
|
@ -1295,11 +1295,7 @@ ushort QChar::toCaseFolded(ushort ucs2)
|
|||||||
|
|
||||||
\sa toLatin1(), unicode(), QTextCodec::codecForCStrings()
|
\sa toLatin1(), unicode(), QTextCodec::codecForCStrings()
|
||||||
*/
|
*/
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
const char QChar::toAscii() const
|
|
||||||
#else
|
|
||||||
char QChar::toAscii() const
|
char QChar::toAscii() const
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_CODEC_FOR_C_STRINGS
|
#ifndef QT_NO_CODEC_FOR_C_STRINGS
|
||||||
if (QTextCodec::codecForCStrings())
|
if (QTextCodec::codecForCStrings())
|
||||||
|
@ -56,13 +56,8 @@ struct QLatin1Char
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline explicit QLatin1Char(char c) : ch(c) {}
|
inline explicit QLatin1Char(char c) : ch(c) {}
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
inline const char toLatin1() const { return ch; }
|
|
||||||
inline const ushort unicode() const { return ushort(uchar(ch)); }
|
|
||||||
#else
|
|
||||||
inline char toLatin1() const { return ch; }
|
inline char toLatin1() const { return ch; }
|
||||||
inline ushort unicode() const { return ushort(uchar(ch)); }
|
inline ushort unicode() const { return ushort(uchar(ch)); }
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char ch;
|
char ch;
|
||||||
@ -230,20 +225,10 @@ public:
|
|||||||
|
|
||||||
UnicodeVersion unicodeVersion() const;
|
UnicodeVersion unicodeVersion() const;
|
||||||
|
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
const char toAscii() const;
|
|
||||||
inline const char toLatin1() const;
|
|
||||||
inline const ushort unicode() const { return ucs; }
|
|
||||||
#else
|
|
||||||
char toAscii() const;
|
char toAscii() const;
|
||||||
inline char toLatin1() const;
|
inline char toLatin1() const;
|
||||||
inline ushort unicode() const { return ucs; }
|
inline ushort unicode() const { return ucs; }
|
||||||
#endif
|
|
||||||
#ifdef Q_NO_PACKED_REFERENCE
|
|
||||||
inline ushort &unicode() { return const_cast<ushort&>(ucs); }
|
|
||||||
#else
|
|
||||||
inline ushort &unicode() { return ucs; }
|
inline ushort &unicode() { return ucs; }
|
||||||
#endif
|
|
||||||
|
|
||||||
static QChar fromAscii(char c);
|
static QChar fromAscii(char c);
|
||||||
static QChar fromLatin1(char c);
|
static QChar fromLatin1(char c);
|
||||||
@ -339,11 +324,7 @@ Q_DECLARE_TYPEINFO(QChar, Q_MOVABLE_TYPE);
|
|||||||
|
|
||||||
inline QChar::QChar() : ucs(0) {}
|
inline QChar::QChar() : ucs(0) {}
|
||||||
|
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
inline const char QChar::toLatin1() const { return ucs > 0xff ? '\0' : char(ucs); }
|
|
||||||
#else
|
|
||||||
inline char QChar::toLatin1() const { return ucs > 0xff ? '\0' : char(ucs); }
|
inline char QChar::toLatin1() const { return ucs > 0xff ? '\0' : char(ucs); }
|
||||||
#endif
|
|
||||||
inline QChar QChar::fromLatin1(char c) { return QChar(ushort(uchar(c))); }
|
inline QChar QChar::fromLatin1(char c) { return QChar(ushort(uchar(c))); }
|
||||||
|
|
||||||
inline QChar::QChar(uchar c, uchar r) : ucs(ushort((r << 8) | c)){}
|
inline QChar::QChar(uchar c, uchar r) : ucs(ushort((r << 8) | c)){}
|
||||||
|
@ -164,7 +164,7 @@ void **QListData::append(int n)
|
|||||||
if (b - n >= 2 * d->alloc / 3) {
|
if (b - n >= 2 * d->alloc / 3) {
|
||||||
// we have enough space. Just not at the end -> move it.
|
// we have enough space. Just not at the end -> move it.
|
||||||
e -= b;
|
e -= b;
|
||||||
::memcpy(d->array, d->array + b, e * sizeof(void *));
|
::memmove(d->array, d->array + b, e * sizeof(void *));
|
||||||
d->begin = 0;
|
d->begin = 0;
|
||||||
} else {
|
} else {
|
||||||
realloc(grow(d->alloc + n));
|
realloc(grow(d->alloc + n));
|
||||||
|
51
src/corelib/tools/qrefcount.cpp
Normal file
51
src/corelib/tools/qrefcount.cpp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** All rights reserved.
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** This file is part of the QtCore module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
|
** License version 2.1 as published by the Free Software Foundation and
|
||||||
|
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||||
|
** file. Please review the following information to ensure the GNU Lesser
|
||||||
|
** General Public License version 2.1 requirements will be met:
|
||||||
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU General
|
||||||
|
** Public License version 3.0 as published by the Free Software Foundation
|
||||||
|
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||||
|
** file. Please review the following information to ensure the GNU General
|
||||||
|
** Public License version 3.0 requirements will be met:
|
||||||
|
** http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
** Other Usage
|
||||||
|
** Alternatively, this file may be used in accordance with the terms and
|
||||||
|
** conditions contained in a signed written agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
**
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class QtPrivate::RefCount
|
||||||
|
\internal
|
||||||
|
|
||||||
|
QRefCount implements atomic ref counting for Qt's shared classes. It behaves very similar
|
||||||
|
to QAtomicInt, but ignores negative ref counts.
|
||||||
|
|
||||||
|
This can be used to allow to implement e.g. const read-only QStringData objects. QString::shared_null and
|
||||||
|
the qs(...) macro make use of this feature.
|
||||||
|
*/
|
92
src/corelib/tools/qrefcount.h
Normal file
92
src/corelib/tools/qrefcount.h
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** All rights reserved.
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** This file is part of the QtCore module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
|
** License version 2.1 as published by the Free Software Foundation and
|
||||||
|
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||||
|
** file. Please review the following information to ensure the GNU Lesser
|
||||||
|
** General Public License version 2.1 requirements will be met:
|
||||||
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU General
|
||||||
|
** Public License version 3.0 as published by the Free Software Foundation
|
||||||
|
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||||
|
** file. Please review the following information to ensure the GNU General
|
||||||
|
** Public License version 3.0 requirements will be met:
|
||||||
|
** http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
** Other Usage
|
||||||
|
** Alternatively, this file may be used in accordance with the terms and
|
||||||
|
** conditions contained in a signed written agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
**
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QREFCOUNT_H
|
||||||
|
#define QREFCOUNT_H
|
||||||
|
|
||||||
|
#include <QtCore/qatomic.h>
|
||||||
|
|
||||||
|
QT_BEGIN_HEADER
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
QT_MODULE(Core)
|
||||||
|
|
||||||
|
namespace QtPrivate
|
||||||
|
{
|
||||||
|
|
||||||
|
class RefCount
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline void ref() {
|
||||||
|
if (atomic >= 0)
|
||||||
|
atomic.ref();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool deref() {
|
||||||
|
if (atomic < 0)
|
||||||
|
return true;
|
||||||
|
return atomic.deref();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator==(int value) const
|
||||||
|
{ return atomic.operator ==(value); }
|
||||||
|
inline bool operator!=(int value) const
|
||||||
|
{ return atomic.operator !=(value); }
|
||||||
|
inline bool operator!() const
|
||||||
|
{ return atomic.operator !(); }
|
||||||
|
inline operator int() const
|
||||||
|
{ return atomic.operator int(); }
|
||||||
|
inline RefCount &operator=(int value)
|
||||||
|
{ atomic = value; return *this; }
|
||||||
|
|
||||||
|
QBasicAtomicInt atomic;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define Q_REFCOUNT_INITIALIZER(a) { Q_BASIC_ATOMIC_INITIALIZER(a) }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
QT_END_HEADER
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
#include <QtCore/qchar.h>
|
#include <QtCore/qchar.h>
|
||||||
#include <QtCore/qbytearray.h>
|
#include <QtCore/qbytearray.h>
|
||||||
#include <QtCore/qatomic.h>
|
#include <QtCore/qrefcount.h>
|
||||||
#include <QtCore/qnamespace.h>
|
#include <QtCore/qnamespace.h>
|
||||||
|
|
||||||
#ifndef QT_NO_STL
|
#ifndef QT_NO_STL
|
||||||
@ -77,9 +77,86 @@ class QLatin1String;
|
|||||||
class QStringRef;
|
class QStringRef;
|
||||||
template <typename T> class QVector;
|
template <typename T> class QVector;
|
||||||
|
|
||||||
|
struct QStringData {
|
||||||
|
QtPrivate::RefCount ref;
|
||||||
|
int size;
|
||||||
|
uint alloc : 31;
|
||||||
|
uint capacityReserved : 1;
|
||||||
|
union {
|
||||||
|
qptrdiff offset; // will always work as we add/subtract from a ushort ptr
|
||||||
|
ushort d[sizeof(qptrdiff)/sizeof(ushort)];
|
||||||
|
};
|
||||||
|
inline ushort *data() { return d + sizeof(qptrdiff)/sizeof(ushort) + offset; }
|
||||||
|
inline const ushort *data() const { return d + sizeof(qptrdiff)/sizeof(ushort) + offset; }
|
||||||
|
};
|
||||||
|
|
||||||
|
template<int N> struct QConstStringData;
|
||||||
|
template<int N> struct QConstStringDataPtr
|
||||||
|
{
|
||||||
|
const QConstStringData<N> *ptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined(Q_COMPILER_UNICODE_STRINGS)
|
||||||
|
template<int n> struct QConstStringData
|
||||||
|
{
|
||||||
|
const QStringData str;
|
||||||
|
const char16_t data[n];
|
||||||
|
};
|
||||||
|
#define QT_QSTRING_UNICODE_MARKER u""
|
||||||
|
|
||||||
|
#elif defined(Q_OS_WIN) || (defined(__SIZEOF_WCHAR_T__) && __SIZEOF_WCHAR_T__ == 2) || defined(WCHAR_MAX) && (WCHAR_MAX - 0 < 65536)
|
||||||
|
// wchar_t is 2 bytes
|
||||||
|
template<int n> struct QConstStringData
|
||||||
|
{
|
||||||
|
const QStringData str;
|
||||||
|
const wchar_t data[n];
|
||||||
|
};
|
||||||
|
#define QT_QSTRING_UNICODE_MARKER L""
|
||||||
|
|
||||||
|
#else
|
||||||
|
template<int n> struct QConstStringData
|
||||||
|
{
|
||||||
|
const QStringData str;
|
||||||
|
const ushort data[n];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(QT_QSTRING_UNICODE_MARKER)
|
||||||
|
# if defined(Q_COMPILER_LAMBDA)
|
||||||
|
# define QStringLiteral(str) ([]() { \
|
||||||
|
enum { Size = sizeof(QT_QSTRING_UNICODE_MARKER str)/2 }; \
|
||||||
|
static const QConstStringData<Size> qstring_literal = \
|
||||||
|
{ { Q_REFCOUNT_INITIALIZER(-1), Size -1, 0, 0, { 0 } }, QT_QSTRING_UNICODE_MARKER str }; \
|
||||||
|
QConstStringDataPtr<Size> holder = { &qstring_literal }; \
|
||||||
|
return holder; }())
|
||||||
|
|
||||||
|
# elif defined(Q_CC_GNU)
|
||||||
|
// We need to create a QStringData in the .rodata section of memory
|
||||||
|
// and the only way to do that is to create a "static const" variable.
|
||||||
|
// To do that, we need the __extension__ {( )} trick which only GCC supports
|
||||||
|
|
||||||
|
# define QStringLiteral(str) \
|
||||||
|
__extension__ ({ \
|
||||||
|
enum { Size = sizeof(QT_QSTRING_UNICODE_MARKER str)/2 }; \
|
||||||
|
static const QConstStringData<Size> qstring_literal = \
|
||||||
|
{ { Q_REFCOUNT_INITIALIZER(-1), Size -1, 0, 0, { 0 } }, QT_QSTRING_UNICODE_MARKER str }; \
|
||||||
|
QConstStringDataPtr<Size> holder = { &qstring_literal }; \
|
||||||
|
holder; })
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef QStringLiteral
|
||||||
|
// no lambdas, not GCC, or GCC in C++98 mode with 4-byte wchar_t
|
||||||
|
// fallback, uses QLatin1String as next best options
|
||||||
|
|
||||||
|
# define QStringLiteral(str) QLatin1String(str)
|
||||||
|
#endif
|
||||||
|
|
||||||
class Q_CORE_EXPORT QString
|
class Q_CORE_EXPORT QString
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
typedef QStringData Data;
|
||||||
|
|
||||||
inline QString();
|
inline QString();
|
||||||
QString(const QChar *unicode, int size); // Qt5: don't cap size < 0
|
QString(const QChar *unicode, int size); // Qt5: don't cap size < 0
|
||||||
explicit QString(const QChar *unicode); // Qt5: merge with the above
|
explicit QString(const QChar *unicode); // Qt5: merge with the above
|
||||||
@ -108,7 +185,7 @@ public:
|
|||||||
|
|
||||||
int capacity() const;
|
int capacity() const;
|
||||||
inline void reserve(int size);
|
inline void reserve(int size);
|
||||||
inline void squeeze() { if (d->size < d->alloc || d->ref != 1) realloc(); d->capacity = 0;}
|
inline void squeeze() { if (d->size < d->alloc || d->ref != 1) realloc(); d->capacityReserved = false;}
|
||||||
|
|
||||||
inline const QChar *unicode() const;
|
inline const QChar *unicode() const;
|
||||||
inline QChar *data();
|
inline QChar *data();
|
||||||
@ -262,8 +339,8 @@ public:
|
|||||||
inline QString &operator+=(QChar c) {
|
inline QString &operator+=(QChar c) {
|
||||||
if (d->ref != 1 || d->size + 1 > d->alloc)
|
if (d->ref != 1 || d->size + 1 > d->alloc)
|
||||||
realloc(grow(d->size + 1));
|
realloc(grow(d->size + 1));
|
||||||
d->data[d->size++] = c.unicode();
|
d->data()[d->size++] = c.unicode();
|
||||||
d->data[d->size] = '\0';
|
d->data()[d->size] = '\0';
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,15 +568,19 @@ public:
|
|||||||
// compatibility
|
// compatibility
|
||||||
struct Null { };
|
struct Null { };
|
||||||
static const Null null;
|
static const Null null;
|
||||||
inline QString(const Null &): d(&shared_null) { d->ref.ref(); }
|
inline QString(const Null &): d(const_cast<Data *>(&shared_null.str)) {}
|
||||||
inline QString &operator=(const Null &) { *this = QString(); return *this; }
|
inline QString &operator=(const Null &) { *this = QString(); return *this; }
|
||||||
inline bool isNull() const { return d == &shared_null; }
|
inline bool isNull() const { return d == &shared_null.str; }
|
||||||
|
|
||||||
|
|
||||||
bool isSimpleText() const { if (!d->clean) updateProperties(); return d->simpletext; }
|
bool isSimpleText() const;
|
||||||
bool isRightToLeft() const;
|
bool isRightToLeft() const;
|
||||||
|
|
||||||
QString(int size, Qt::Initialization);
|
QString(int size, Qt::Initialization);
|
||||||
|
template <int n>
|
||||||
|
inline QString(const QConstStringData<n> &dd) : d(const_cast<QStringData *>(&dd.str)) {}
|
||||||
|
template <int N>
|
||||||
|
Q_DECL_CONSTEXPR inline QString(QConstStringDataPtr<N> dd) : d(const_cast<QStringData *>(&dd.ptr->str)) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if defined(QT_NO_CAST_FROM_ASCII) && !defined(Q_NO_DECLARED_NOT_DEFINED)
|
#if defined(QT_NO_CAST_FROM_ASCII) && !defined(Q_NO_DECLARED_NOT_DEFINED)
|
||||||
@ -511,22 +592,11 @@ private:
|
|||||||
QString &operator=(const QByteArray &a);
|
QString &operator=(const QByteArray &a);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct Data {
|
static const QConstStringData<1> shared_null;
|
||||||
QBasicAtomicInt ref;
|
static const QConstStringData<1> shared_empty;
|
||||||
int alloc, size;
|
|
||||||
ushort *data; // QT5: put that after the bit field to fill alignment gap; don't use sizeof any more then
|
|
||||||
ushort clean : 1;
|
|
||||||
ushort simpletext : 1;
|
|
||||||
ushort righttoleft : 1;
|
|
||||||
ushort capacity : 1;
|
|
||||||
ushort reserved : 11;
|
|
||||||
// ### Qt5: try to ensure that "array" is aligned to 16 bytes on both 32- and 64-bit
|
|
||||||
ushort array[1];
|
|
||||||
};
|
|
||||||
static Data shared_null;
|
|
||||||
static Data shared_empty;
|
|
||||||
Data *d;
|
Data *d;
|
||||||
QString(Data *dd, int /*dummy*/) : d(dd) {}
|
inline QString(Data *dd, int /*dummy*/) : d(dd) {}
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#ifndef QT_NO_TEXTCODEC
|
||||||
static QTextCodec *codecForCStrings;
|
static QTextCodec *codecForCStrings;
|
||||||
#endif
|
#endif
|
||||||
@ -563,11 +633,11 @@ public:
|
|||||||
class Q_CORE_EXPORT QLatin1String
|
class Q_CORE_EXPORT QLatin1String
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline explicit QLatin1String(const char *s) : chars(s) {}
|
inline explicit QLatin1String(const char *s) : m_size(s ? strlen(s) : 0), m_data(s) {}
|
||||||
inline QLatin1String &operator=(const QLatin1String &other)
|
|
||||||
{ chars = other.chars; return *this; }
|
|
||||||
|
|
||||||
inline const char *latin1() const { return chars; }
|
inline const char *latin1() const { return m_data; }
|
||||||
|
inline int size() const { return m_size; }
|
||||||
|
inline const char *data() const { return m_data; }
|
||||||
|
|
||||||
inline bool operator==(const QString &s) const
|
inline bool operator==(const QString &s) const
|
||||||
{ return s == *this; }
|
{ return s == *this; }
|
||||||
@ -595,9 +665,12 @@ public:
|
|||||||
inline QT_ASCII_CAST_WARN bool operator>=(const char *s) const
|
inline QT_ASCII_CAST_WARN bool operator>=(const char *s) const
|
||||||
{ return QString::fromAscii(s) <= *this; }
|
{ return QString::fromAscii(s) <= *this; }
|
||||||
private:
|
private:
|
||||||
const char *chars;
|
int m_size;
|
||||||
|
const char *m_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Qt 4.x compatibility
|
||||||
|
typedef QLatin1String QLatin1Literal;
|
||||||
|
|
||||||
|
|
||||||
inline QString::QString(const QLatin1String &aLatin1) : d(fromLatin1_helper(aLatin1.latin1()))
|
inline QString::QString(const QLatin1String &aLatin1) : d(fromLatin1_helper(aLatin1.latin1()))
|
||||||
@ -605,23 +678,23 @@ inline QString::QString(const QLatin1String &aLatin1) : d(fromLatin1_helper(aLat
|
|||||||
inline int QString::length() const
|
inline int QString::length() const
|
||||||
{ return d->size; }
|
{ return d->size; }
|
||||||
inline const QChar QString::at(int i) const
|
inline const QChar QString::at(int i) const
|
||||||
{ Q_ASSERT(uint(i) < uint(size())); return d->data[i]; }
|
{ Q_ASSERT(uint(i) < uint(size())); return d->data()[i]; }
|
||||||
inline const QChar QString::operator[](int i) const
|
inline const QChar QString::operator[](int i) const
|
||||||
{ Q_ASSERT(uint(i) < uint(size())); return d->data[i]; }
|
{ Q_ASSERT(uint(i) < uint(size())); return d->data()[i]; }
|
||||||
inline const QChar QString::operator[](uint i) const
|
inline const QChar QString::operator[](uint i) const
|
||||||
{ Q_ASSERT(i < uint(size())); return d->data[i]; }
|
{ Q_ASSERT(i < uint(size())); return d->data()[i]; }
|
||||||
inline bool QString::isEmpty() const
|
inline bool QString::isEmpty() const
|
||||||
{ return d->size == 0; }
|
{ return d->size == 0; }
|
||||||
inline const QChar *QString::unicode() const
|
inline const QChar *QString::unicode() const
|
||||||
{ return reinterpret_cast<const QChar*>(d->data); }
|
{ return reinterpret_cast<const QChar*>(d->data()); }
|
||||||
inline const QChar *QString::data() const
|
inline const QChar *QString::data() const
|
||||||
{ return reinterpret_cast<const QChar*>(d->data); }
|
{ return reinterpret_cast<const QChar*>(d->data()); }
|
||||||
inline QChar *QString::data()
|
inline QChar *QString::data()
|
||||||
{ detach(); return reinterpret_cast<QChar*>(d->data); }
|
{ detach(); return reinterpret_cast<QChar*>(d->data()); }
|
||||||
inline const QChar *QString::constData() const
|
inline const QChar *QString::constData() const
|
||||||
{ return reinterpret_cast<const QChar*>(d->data); }
|
{ return reinterpret_cast<const QChar*>(d->data()); }
|
||||||
inline void QString::detach()
|
inline void QString::detach()
|
||||||
{ if (d->ref != 1 || d->data != d->array) realloc(); }
|
{ if (d->ref != 1 || d->offset) realloc(); }
|
||||||
inline bool QString::isDetached() const
|
inline bool QString::isDetached() const
|
||||||
{ return d->ref == 1; }
|
{ return d->ref == 1; }
|
||||||
inline QString &QString::operator=(const QLatin1String &s)
|
inline QString &QString::operator=(const QLatin1String &s)
|
||||||
@ -703,10 +776,10 @@ public:
|
|||||||
|
|
||||||
// all this is not documented: We just say "like QChar" and let it be.
|
// all this is not documented: We just say "like QChar" and let it be.
|
||||||
inline operator QChar() const
|
inline operator QChar() const
|
||||||
{ return i < s.d->size ? s.d->data[i] : 0; }
|
{ return i < s.d->size ? s.d->data()[i] : 0; }
|
||||||
inline QCharRef &operator=(const QChar &c)
|
inline QCharRef &operator=(const QChar &c)
|
||||||
{ if (i >= s.d->size) s.expand(i); else s.detach();
|
{ if (i >= s.d->size) s.expand(i); else s.detach();
|
||||||
s.d->data[i] = c.unicode(); return *this; }
|
s.d->data()[i] = c.unicode(); return *this; }
|
||||||
|
|
||||||
// An operator= for each QChar cast constructors
|
// An operator= for each QChar cast constructors
|
||||||
#ifndef QT_NO_CAST_FROM_ASCII
|
#ifndef QT_NO_CAST_FROM_ASCII
|
||||||
@ -756,15 +829,9 @@ public:
|
|||||||
inline void setCell(uchar cell);
|
inline void setCell(uchar cell);
|
||||||
inline void setRow(uchar row);
|
inline void setRow(uchar row);
|
||||||
|
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
const char toAscii() const { return QChar(*this).toAscii(); }
|
|
||||||
const char toLatin1() const { return QChar(*this).toLatin1(); }
|
|
||||||
const ushort unicode() const { return QChar(*this).unicode(); }
|
|
||||||
#else
|
|
||||||
char toAscii() const { return QChar(*this).toAscii(); }
|
char toAscii() const { return QChar(*this).toAscii(); }
|
||||||
char toLatin1() const { return QChar(*this).toLatin1(); }
|
char toLatin1() const { return QChar(*this).toLatin1(); }
|
||||||
ushort unicode() const { return QChar(*this).unicode(); }
|
ushort unicode() const { return QChar(*this).unicode(); }
|
||||||
#endif
|
|
||||||
ushort& unicode() { return s.data()[i].unicode(); }
|
ushort& unicode() { return s.data()[i].unicode(); }
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -773,9 +840,9 @@ inline void QCharRef::setRow(uchar arow) { QChar(*this).setRow(arow); }
|
|||||||
inline void QCharRef::setCell(uchar acell) { QChar(*this).setCell(acell); }
|
inline void QCharRef::setCell(uchar acell) { QChar(*this).setCell(acell); }
|
||||||
|
|
||||||
|
|
||||||
inline QString::QString() : d(&shared_null) { d->ref.ref(); }
|
inline QString::QString() : d(const_cast<Data *>(&shared_null.str)) {}
|
||||||
inline QString::~QString() { if (!d->ref.deref()) free(d); }
|
inline QString::~QString() { if (!d->ref.deref()) free(d); }
|
||||||
inline void QString::reserve(int asize) { if (d->ref != 1 || asize > d->alloc) realloc(asize); d->capacity = 1;}
|
inline void QString::reserve(int asize) { if (d->ref != 1 || asize > d->alloc) realloc(asize); d->capacityReserved = true;}
|
||||||
inline QString &QString::setUtf16(const ushort *autf16, int asize)
|
inline QString &QString::setUtf16(const ushort *autf16, int asize)
|
||||||
{ return setUnicode(reinterpret_cast<const QChar *>(autf16), asize); }
|
{ return setUnicode(reinterpret_cast<const QChar *>(autf16), asize); }
|
||||||
inline QCharRef QString::operator[](int i)
|
inline QCharRef QString::operator[](int i)
|
||||||
@ -783,17 +850,17 @@ inline QCharRef QString::operator[](int i)
|
|||||||
inline QCharRef QString::operator[](uint i)
|
inline QCharRef QString::operator[](uint i)
|
||||||
{ return QCharRef(*this, i); }
|
{ return QCharRef(*this, i); }
|
||||||
inline QString::iterator QString::begin()
|
inline QString::iterator QString::begin()
|
||||||
{ detach(); return reinterpret_cast<QChar*>(d->data); }
|
{ detach(); return reinterpret_cast<QChar*>(d->data()); }
|
||||||
inline QString::const_iterator QString::begin() const
|
inline QString::const_iterator QString::begin() const
|
||||||
{ return reinterpret_cast<const QChar*>(d->data); }
|
{ return reinterpret_cast<const QChar*>(d->data()); }
|
||||||
inline QString::const_iterator QString::constBegin() const
|
inline QString::const_iterator QString::constBegin() const
|
||||||
{ return reinterpret_cast<const QChar*>(d->data); }
|
{ return reinterpret_cast<const QChar*>(d->data()); }
|
||||||
inline QString::iterator QString::end()
|
inline QString::iterator QString::end()
|
||||||
{ detach(); return reinterpret_cast<QChar*>(d->data + d->size); }
|
{ detach(); return reinterpret_cast<QChar*>(d->data() + d->size); }
|
||||||
inline QString::const_iterator QString::end() const
|
inline QString::const_iterator QString::end() const
|
||||||
{ return reinterpret_cast<const QChar*>(d->data + d->size); }
|
{ return reinterpret_cast<const QChar*>(d->data() + d->size); }
|
||||||
inline QString::const_iterator QString::constEnd() const
|
inline QString::const_iterator QString::constEnd() const
|
||||||
{ return reinterpret_cast<const QChar*>(d->data + d->size); }
|
{ return reinterpret_cast<const QChar*>(d->data() + d->size); }
|
||||||
inline QBool QString::contains(const QString &s, Qt::CaseSensitivity cs) const
|
inline QBool QString::contains(const QString &s, Qt::CaseSensitivity cs) const
|
||||||
{ return QBool(indexOf(s, 0, cs) != -1); }
|
{ return QBool(indexOf(s, 0, cs) != -1); }
|
||||||
inline QBool QString::contains(const QStringRef &s, Qt::CaseSensitivity cs) const
|
inline QBool QString::contains(const QStringRef &s, Qt::CaseSensitivity cs) const
|
||||||
@ -1024,7 +1091,7 @@ public:
|
|||||||
|
|
||||||
inline const QChar *unicode() const {
|
inline const QChar *unicode() const {
|
||||||
if (!m_string)
|
if (!m_string)
|
||||||
return reinterpret_cast<const QChar *>(QString::shared_null.data);
|
return reinterpret_cast<const QChar *>(QString::shared_null.str.data());
|
||||||
return m_string->unicode() + m_position;
|
return m_string->unicode() + m_position;
|
||||||
}
|
}
|
||||||
inline const QChar *data() const { return unicode(); }
|
inline const QChar *data() const { return unicode(); }
|
||||||
@ -1154,7 +1221,6 @@ inline QBool QStringRef::contains(const QStringRef &s, Qt::CaseSensitivity cs) c
|
|||||||
{ return QBool(indexOf(s, 0, cs) != -1); }
|
{ return QBool(indexOf(s, 0, cs) != -1); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
QT_END_HEADER
|
QT_END_HEADER
|
||||||
|
@ -44,47 +44,6 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
/*!
|
|
||||||
\class QLatin1Literal
|
|
||||||
\internal
|
|
||||||
\reentrant
|
|
||||||
\since 4.6
|
|
||||||
|
|
||||||
\brief The QLatin1Literal class provides a thin wrapper around string
|
|
||||||
literals used in source code.
|
|
||||||
|
|
||||||
\ingroup tools
|
|
||||||
\ingroup shared
|
|
||||||
\ingroup string-processing
|
|
||||||
|
|
||||||
|
|
||||||
Unlike \c QLatin1String, a \c QLatin1Literal can retrieve its size
|
|
||||||
without iterating over the literal.
|
|
||||||
|
|
||||||
The main use of \c QLatin1Literal is in conjunction with \c QStringBuilder
|
|
||||||
to reduce the number of reallocations needed to build up a string from
|
|
||||||
smaller chunks.
|
|
||||||
|
|
||||||
\sa QStringBuilder, QLatin1String, QString, QStringRef
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*! \fn int QLatin1Literal::size() const
|
|
||||||
|
|
||||||
Returns the number of characters in the literal \e{excluding} the trailing
|
|
||||||
NULL char.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*! \fn QLatin1Literal::QLatin1Literal(const char str)
|
|
||||||
|
|
||||||
Constructs a new literal from the string \a str.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*! \fn const char *QLatin1Literal::data() const
|
|
||||||
|
|
||||||
Returns a pointer to the first character of the string literal.
|
|
||||||
The string literal is terminated by a NUL character.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QStringBuilder
|
\class QStringBuilder
|
||||||
\internal
|
\internal
|
||||||
@ -110,7 +69,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
The QStringBuilder class is not to be used explicitly in user
|
The QStringBuilder class is not to be used explicitly in user
|
||||||
code. Instances of the class are created as return values of the
|
code. Instances of the class are created as return values of the
|
||||||
operator%() function, acting on objects of type QString,
|
operator%() function, acting on objects of type QString,
|
||||||
QLatin1String, QLatin1Literal, QStringRef, QChar, QCharRef,
|
QLatin1String, QStringRef, QChar, QCharRef,
|
||||||
QLatin1Char, and \c char.
|
QLatin1Char, and \c char.
|
||||||
|
|
||||||
Concatenating strings with operator%() generally yields better
|
Concatenating strings with operator%() generally yields better
|
||||||
@ -118,7 +77,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
if there are three or more of them, and performs equally well in other
|
if there are three or more of them, and performs equally well in other
|
||||||
cases.
|
cases.
|
||||||
|
|
||||||
\sa QLatin1Literal, QString
|
\sa QLatin1String, QString
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \fn QStringBuilder::QStringBuilder(const A &a, const B &b)
|
/*! \fn QStringBuilder::QStringBuilder(const A &a, const B &b)
|
||||||
@ -132,7 +91,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
takes a QString parameter.
|
takes a QString parameter.
|
||||||
|
|
||||||
This function is usable with arguments of type \c QString,
|
This function is usable with arguments of type \c QString,
|
||||||
\c QLatin1String, \c QLatin1Literal, \c QStringRef,
|
\c QLatin1String, \c QStringRef,
|
||||||
\c QChar, \c QCharRef, \c QLatin1Char, and \c char.
|
\c QChar, \c QCharRef, \c QLatin1Char, and \c char.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -145,7 +104,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
/*!
|
/*!
|
||||||
\fn operator QStringBuilder::QString() const
|
\fn operator QStringBuilder::QString() const
|
||||||
|
|
||||||
Converts the \c QLatin1Literal into a \c QString object.
|
Converts the \c QLatin1String into a \c QString object.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \internal
|
/*! \internal
|
||||||
|
@ -59,22 +59,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
QT_MODULE(Core)
|
QT_MODULE(Core)
|
||||||
|
|
||||||
// ### Qt 5: merge with QLatin1String
|
|
||||||
class QLatin1Literal
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
int size() const { return m_size; }
|
|
||||||
const char *data() const { return m_data; }
|
|
||||||
|
|
||||||
template <int N>
|
|
||||||
QLatin1Literal(const char (&str)[N])
|
|
||||||
: m_size(N - 1), m_data(str) {}
|
|
||||||
|
|
||||||
private:
|
|
||||||
const int m_size;
|
|
||||||
const char * const m_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Q_CORE_EXPORT QAbstractConcatenable
|
struct Q_CORE_EXPORT QAbstractConcatenable
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@ -234,31 +218,13 @@ template <> struct QConcatenable<QLatin1String>
|
|||||||
typedef QLatin1String type;
|
typedef QLatin1String type;
|
||||||
typedef QString ConvertTo;
|
typedef QString ConvertTo;
|
||||||
enum { ExactSize = true };
|
enum { ExactSize = true };
|
||||||
static int size(const QLatin1String &a) { return qstrlen(a.latin1()); }
|
static int size(const QLatin1String &a) { return a.size(); }
|
||||||
static inline void appendTo(const QLatin1String &a, QChar *&out)
|
static inline void appendTo(const QLatin1String &a, QChar *&out)
|
||||||
{
|
|
||||||
for (const char *s = a.latin1(); *s; )
|
|
||||||
*out++ = QLatin1Char(*s++);
|
|
||||||
}
|
|
||||||
static inline void appendTo(const QLatin1String &a, char *&out)
|
|
||||||
{
|
|
||||||
for (const char *s = a.latin1(); *s; )
|
|
||||||
*out++ = *s++;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct QConcatenable<QLatin1Literal>
|
|
||||||
{
|
|
||||||
typedef QLatin1Literal type;
|
|
||||||
typedef QString ConvertTo;
|
|
||||||
enum { ExactSize = true };
|
|
||||||
static int size(const QLatin1Literal &a) { return a.size(); }
|
|
||||||
static inline void appendTo(const QLatin1Literal &a, QChar *&out)
|
|
||||||
{
|
{
|
||||||
for (const char *s = a.data(); *s; )
|
for (const char *s = a.data(); *s; )
|
||||||
*out++ = QLatin1Char(*s++);
|
*out++ = QLatin1Char(*s++);
|
||||||
}
|
}
|
||||||
static inline void appendTo(const QLatin1Literal &a, char *&out)
|
static inline void appendTo(const QLatin1String &a, char *&out)
|
||||||
{
|
{
|
||||||
for (const char *s = a.data(); *s; )
|
for (const char *s = a.data(); *s; )
|
||||||
*out++ = *s++;
|
*out++ = *s++;
|
||||||
@ -283,6 +249,23 @@ template <> struct QConcatenable<QString> : private QAbstractConcatenable
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <int N> struct QConcatenable<QConstStringDataPtr<N> > : private QAbstractConcatenable
|
||||||
|
{
|
||||||
|
typedef QConstStringDataPtr<N> type;
|
||||||
|
typedef QString ConvertTo;
|
||||||
|
enum { ExactSize = true };
|
||||||
|
static int size(const type &) { return N; }
|
||||||
|
static inline void appendTo(const type &a, QChar *&out)
|
||||||
|
{
|
||||||
|
memcpy(out, reinterpret_cast<const char*>(a.ptr->data), sizeof(QChar) * N);
|
||||||
|
out += N;
|
||||||
|
}
|
||||||
|
#ifndef QT_NO_CAST_TO_ASCII
|
||||||
|
static inline QT_ASCII_CAST_WARN void appendTo(const type &a, char *&out)
|
||||||
|
{ convertToAscii(a.ptr->data, N, out); }
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
template <> struct QConcatenable<QStringRef> : private QAbstractConcatenable
|
template <> struct QConcatenable<QStringRef> : private QAbstractConcatenable
|
||||||
{
|
{
|
||||||
typedef QStringRef type;
|
typedef QStringRef type;
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
inline QStringList(const QStringList &l) : QList<QString>(l) { }
|
inline QStringList(const QStringList &l) : QList<QString>(l) { }
|
||||||
inline QStringList(const QList<QString> &l) : QList<QString>(l) { }
|
inline QStringList(const QList<QString> &l) : QList<QString>(l) { }
|
||||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||||
inline QStringList(std::initializer_list<QString> args) : QList(args) { }
|
inline QStringList(std::initializer_list<QString> args) : QList<QString>(args) { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline void sort();
|
inline void sort();
|
||||||
|
@ -30,6 +30,7 @@ HEADERS += \
|
|||||||
tools/qrect.h \
|
tools/qrect.h \
|
||||||
tools/qregexp.h \
|
tools/qregexp.h \
|
||||||
tools/qringbuffer_p.h \
|
tools/qringbuffer_p.h \
|
||||||
|
tools/qrefcount.h \
|
||||||
tools/qscopedpointer.h \
|
tools/qscopedpointer.h \
|
||||||
tools/qscopedpointer_p.h \
|
tools/qscopedpointer_p.h \
|
||||||
tools/qscopedvaluerollback.h \
|
tools/qscopedvaluerollback.h \
|
||||||
@ -72,6 +73,7 @@ SOURCES += \
|
|||||||
tools/qcontiguouscache.cpp \
|
tools/qcontiguouscache.cpp \
|
||||||
tools/qrect.cpp \
|
tools/qrect.cpp \
|
||||||
tools/qregexp.cpp \
|
tools/qregexp.cpp \
|
||||||
|
tools/qrefcount.cpp \
|
||||||
tools/qshareddata.cpp \
|
tools/qshareddata.cpp \
|
||||||
tools/qsharedpointer.cpp \
|
tools/qsharedpointer.cpp \
|
||||||
tools/qsimd.cpp \
|
tools/qsimd.cpp \
|
||||||
|
@ -62,6 +62,12 @@ void qdbus_unloadLibDBus()
|
|||||||
|
|
||||||
bool qdbus_loadLibDBus()
|
bool qdbus_loadLibDBus()
|
||||||
{
|
{
|
||||||
|
#ifdef QT_BUILD_INTERNAL
|
||||||
|
// this is to simulate a library load failure for our autotest suite.
|
||||||
|
if (!qgetenv("QT_SIMULATE_DBUS_LIBFAIL").isEmpty())
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
static volatile bool triedToLoadLibrary = false;
|
static volatile bool triedToLoadLibrary = false;
|
||||||
#ifndef QT_NO_THREAD
|
#ifndef QT_NO_THREAD
|
||||||
QMutexLocker locker(QMutexPool::globalInstanceGet((void *)&qdbus_resolve_me));
|
QMutexLocker locker(QMutexPool::globalInstanceGet((void *)&qdbus_resolve_me));
|
||||||
|
@ -1061,7 +1061,7 @@ public:
|
|||||||
if (!instance) {
|
if (!instance) {
|
||||||
qWarning("QDBusConnection: %s D-Bus connection created before QCoreApplication. Application may misbehave.",
|
qWarning("QDBusConnection: %s D-Bus connection created before QCoreApplication. Application may misbehave.",
|
||||||
type == SessionBus ? "session" : type == SystemBus ? "system" : "generic");
|
type == SessionBus ? "session" : type == SystemBus ? "system" : "generic");
|
||||||
} else {
|
} else if (QDBusConnectionPrivate::d(*this)) {
|
||||||
QDBusConnectionPrivate::d(*this)->moveToThread(instance->thread());
|
QDBusConnectionPrivate::d(*this)->moveToThread(instance->thread());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,29 +7,29 @@
|
|||||||
** This file is part of the QtGui module of the Qt Toolkit.
|
** This file is part of the QtGui module of the Qt Toolkit.
|
||||||
**
|
**
|
||||||
** $QT_BEGIN_LICENSE:LGPL$
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
** No Commercial Usage
|
|
||||||
** This file contains pre-release code and may not be distributed.
|
|
||||||
** You may use this file in accordance with the terms and conditions
|
|
||||||
** contained in the Technology Preview License Agreement accompanying
|
|
||||||
** this package.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
** General Public License version 2.1 as published by the Free Software
|
** License version 2.1 as published by the Free Software Foundation and
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||||
** packaging of this file. Please review the following information to
|
** file. Please review the following information to ensure the GNU Lesser
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
** General Public License version 2.1 requirements will be met:
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
**
|
**
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
**
|
**
|
||||||
** If you have questions regarding the use of this file, please contact
|
** GNU General Public License Usage
|
||||||
** Nokia at qt-info@nokia.com.
|
** Alternatively, this file may be used under the terms of the GNU General
|
||||||
**
|
** Public License version 3.0 as published by the Free Software Foundation
|
||||||
**
|
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||||
|
** file. Please review the following information to ensure the GNU General
|
||||||
|
** Public License version 3.0 requirements will be met:
|
||||||
|
** http://www.gnu.org/copyleft/gpl.html.
|
||||||
**
|
**
|
||||||
|
** Other Usage
|
||||||
|
** Alternatively, this file may be used in accordance with the terms and
|
||||||
|
** conditions contained in a signed written agreement between you and Nokia.
|
||||||
**
|
**
|
||||||
**
|
**
|
||||||
**
|
**
|
||||||
|
@ -7,29 +7,29 @@
|
|||||||
** This file is part of the QtGui module of the Qt Toolkit.
|
** This file is part of the QtGui module of the Qt Toolkit.
|
||||||
**
|
**
|
||||||
** $QT_BEGIN_LICENSE:LGPL$
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
** No Commercial Usage
|
|
||||||
** This file contains pre-release code and may not be distributed.
|
|
||||||
** You may use this file in accordance with the terms and conditions
|
|
||||||
** contained in the Technology Preview License Agreement accompanying
|
|
||||||
** this package.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
** GNU Lesser General Public License Usage
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
** General Public License version 2.1 as published by the Free Software
|
** License version 2.1 as published by the Free Software Foundation and
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||||
** packaging of this file. Please review the following information to
|
** file. Please review the following information to ensure the GNU Lesser
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
** General Public License version 2.1 requirements will be met:
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
**
|
**
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
**
|
**
|
||||||
** If you have questions regarding the use of this file, please contact
|
** GNU General Public License Usage
|
||||||
** Nokia at qt-info@nokia.com.
|
** Alternatively, this file may be used under the terms of the GNU General
|
||||||
**
|
** Public License version 3.0 as published by the Free Software Foundation
|
||||||
**
|
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||||
|
** file. Please review the following information to ensure the GNU General
|
||||||
|
** Public License version 3.0 requirements will be met:
|
||||||
|
** http://www.gnu.org/copyleft/gpl.html.
|
||||||
**
|
**
|
||||||
|
** Other Usage
|
||||||
|
** Alternatively, this file may be used in accordance with the terms and
|
||||||
|
** conditions contained in a signed written agreement between you and Nokia.
|
||||||
**
|
**
|
||||||
**
|
**
|
||||||
**
|
**
|
||||||
|
@ -1291,7 +1291,7 @@ void QPainterPrivate::updateState(QPainterState *newState)
|
|||||||
\o \inlineimage qpainter-compositiondemo.png
|
\o \inlineimage qpainter-compositiondemo.png
|
||||||
|
|
||||||
\o
|
\o
|
||||||
\bold {Composition Modes Demo}
|
\bold {Composition Modes Example}
|
||||||
|
|
||||||
The \l {painting/composition}{Composition Modes} example, available in
|
The \l {painting/composition}{Composition Modes} example, available in
|
||||||
Qt's examples directory, allows you to experiment with the various
|
Qt's examples directory, allows you to experiment with the various
|
||||||
@ -6503,6 +6503,10 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti)
|
|||||||
qreal x = p.x();
|
qreal x = p.x();
|
||||||
qreal y = p.y();
|
qreal y = p.y();
|
||||||
|
|
||||||
|
bool rtl = ti.flags & QTextItem::RightToLeft;
|
||||||
|
if (rtl)
|
||||||
|
x += ti.width.toReal();
|
||||||
|
|
||||||
int start = 0;
|
int start = 0;
|
||||||
int end, i;
|
int end, i;
|
||||||
for (end = 0; end < ti.glyphs.numGlyphs; ++end) {
|
for (end = 0; end < ti.glyphs.numGlyphs; ++end) {
|
||||||
@ -6519,14 +6523,19 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti)
|
|||||||
ti2.width += ti.glyphs.effectiveAdvance(i);
|
ti2.width += ti.glyphs.effectiveAdvance(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rtl)
|
||||||
|
x -= ti2.width.toReal();
|
||||||
|
|
||||||
d->engine->drawTextItem(QPointF(x, y), ti2);
|
d->engine->drawTextItem(QPointF(x, y), ti2);
|
||||||
|
|
||||||
|
if (!rtl)
|
||||||
|
x += ti2.width.toReal();
|
||||||
|
|
||||||
// reset the high byte for all glyphs and advance to the next sub-string
|
// reset the high byte for all glyphs and advance to the next sub-string
|
||||||
const int hi = which << 24;
|
const int hi = which << 24;
|
||||||
for (i = start; i < end; ++i) {
|
for (i = start; i < end; ++i) {
|
||||||
glyphs.glyphs[i] = hi | glyphs.glyphs[i];
|
glyphs.glyphs[i] = hi | glyphs.glyphs[i];
|
||||||
}
|
}
|
||||||
x += ti2.width.toReal();
|
|
||||||
|
|
||||||
// change engine
|
// change engine
|
||||||
start = end;
|
start = end;
|
||||||
@ -6541,6 +6550,9 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti)
|
|||||||
ti2.width += ti.glyphs.effectiveAdvance(i);
|
ti2.width += ti.glyphs.effectiveAdvance(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rtl)
|
||||||
|
x -= ti2.width.toReal();
|
||||||
|
|
||||||
if (d->extended)
|
if (d->extended)
|
||||||
d->extended->drawTextItem(QPointF(x, y), ti2);
|
d->extended->drawTextItem(QPointF(x, y), ti2);
|
||||||
else
|
else
|
||||||
|
@ -218,17 +218,14 @@ struct QtFontStyle
|
|||||||
Key(const QString &styleString);
|
Key(const QString &styleString);
|
||||||
Key() : style(QFont::StyleNormal),
|
Key() : style(QFont::StyleNormal),
|
||||||
weight(QFont::Normal), stretch(0) { }
|
weight(QFont::Normal), stretch(0) { }
|
||||||
Key(const Key &o) : styleName(o.styleName), style(o.style),
|
Key(const Key &o) : style(o.style), weight(o.weight), stretch(o.stretch) { }
|
||||||
weight(o.weight), stretch(o.stretch) { }
|
|
||||||
QString styleName;
|
|
||||||
uint style : 2;
|
uint style : 2;
|
||||||
signed int weight : 8;
|
signed int weight : 8;
|
||||||
signed int stretch : 12;
|
signed int stretch : 12;
|
||||||
|
|
||||||
bool operator==(const Key & other) {
|
bool operator==(const Key & other) {
|
||||||
return styleName == other.styleName && style == other.style &&
|
return (style == other.style && weight == other.weight &&
|
||||||
weight == other.weight &&
|
(stretch == 0 || other.stretch == 0 || stretch == other.stretch));
|
||||||
(stretch == 0 || other.stretch == 0 || stretch == other.stretch);
|
|
||||||
}
|
}
|
||||||
bool operator!=(const Key &other) {
|
bool operator!=(const Key &other) {
|
||||||
return !operator==(other);
|
return !operator==(other);
|
||||||
@ -280,6 +277,7 @@ struct QtFontStyle
|
|||||||
bool smoothScalable : 1;
|
bool smoothScalable : 1;
|
||||||
signed int count : 30;
|
signed int count : 30;
|
||||||
QtFontSize *pixelSizes;
|
QtFontSize *pixelSizes;
|
||||||
|
QString styleName;
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
const char *weightName;
|
const char *weightName;
|
||||||
@ -293,7 +291,7 @@ struct QtFontStyle
|
|||||||
};
|
};
|
||||||
|
|
||||||
QtFontStyle::Key::Key(const QString &styleString)
|
QtFontStyle::Key::Key(const QString &styleString)
|
||||||
: styleName(styleString), style(QFont::StyleNormal), weight(QFont::Normal), stretch(0)
|
: style(QFont::StyleNormal), weight(QFont::Normal), stretch(0)
|
||||||
{
|
{
|
||||||
weight = getFontWeight(styleString);
|
weight = getFontWeight(styleString);
|
||||||
|
|
||||||
@ -354,13 +352,20 @@ struct QtFontFoundry
|
|||||||
|
|
||||||
int count;
|
int count;
|
||||||
QtFontStyle **styles;
|
QtFontStyle **styles;
|
||||||
QtFontStyle *style(const QtFontStyle::Key &, bool = false);
|
QtFontStyle *style(const QtFontStyle::Key &, const QString & = QString(), bool = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, bool create)
|
QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, const QString &styleName, bool create)
|
||||||
{
|
{
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
if (count) {
|
if (count) {
|
||||||
|
// if styleName for searching first if possible
|
||||||
|
if (!styleName.isEmpty()) {
|
||||||
|
for (; pos < count; pos++) {
|
||||||
|
if (styles[pos]->styleName == styleName)
|
||||||
|
return styles[pos];
|
||||||
|
}
|
||||||
|
}
|
||||||
int low = 0;
|
int low = 0;
|
||||||
int high = count;
|
int high = count;
|
||||||
pos = count / 2;
|
pos = count / 2;
|
||||||
@ -387,6 +392,7 @@ QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, bool create)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtFontStyle *style = new QtFontStyle(key);
|
QtFontStyle *style = new QtFontStyle(key);
|
||||||
|
style->styleName = styleName;
|
||||||
memmove(styles + pos + 1, styles + pos, (count-pos)*sizeof(QtFontStyle *));
|
memmove(styles + pos + 1, styles + pos, (count-pos)*sizeof(QtFontStyle *));
|
||||||
styles[pos] = style;
|
styles[pos] = style;
|
||||||
count++;
|
count++;
|
||||||
@ -815,7 +821,7 @@ void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundr
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtFontFoundry *foundry = f->foundry(QString::fromLatin1(foundryname), true);
|
QtFontFoundry *foundry = f->foundry(QString::fromLatin1(foundryname), true);
|
||||||
QtFontStyle *style = foundry->style(styleKey, true);
|
QtFontStyle *style = foundry->style(styleKey, QString(), true);
|
||||||
style->smoothScalable = (pixelSize == 0);
|
style->smoothScalable = (pixelSize == 0);
|
||||||
style->antialiased = antialiased;
|
style->antialiased = antialiased;
|
||||||
QtFontSize *size = style->pixelSize(pixelSize?pixelSize:SMOOTH_SCALABLE, true);
|
QtFontSize *size = style->pixelSize(pixelSize?pixelSize:SMOOTH_SCALABLE, true);
|
||||||
@ -1132,7 +1138,8 @@ QString QFontDatabase::resolveFontFamilyAlias(const QString &family)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey)
|
static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey,
|
||||||
|
const QString &styleName = QString())
|
||||||
{
|
{
|
||||||
int best = 0;
|
int best = 0;
|
||||||
int dist = 0xffff;
|
int dist = 0xffff;
|
||||||
@ -1140,7 +1147,7 @@ static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &st
|
|||||||
for ( int i = 0; i < foundry->count; i++ ) {
|
for ( int i = 0; i < foundry->count; i++ ) {
|
||||||
QtFontStyle *style = foundry->styles[i];
|
QtFontStyle *style = foundry->styles[i];
|
||||||
|
|
||||||
if (!styleKey.styleName.isEmpty() && styleKey.styleName == style->key.styleName) {
|
if (!styleName.isEmpty() && styleName == style->styleName) {
|
||||||
dist = 0;
|
dist = 0;
|
||||||
best = i;
|
best = i;
|
||||||
break;
|
break;
|
||||||
@ -1797,16 +1804,16 @@ QStringList QFontDatabase::styles(const QString &family) const
|
|||||||
for (int k = 0; k < foundry->count; k++) {
|
for (int k = 0; k < foundry->count; k++) {
|
||||||
QtFontStyle::Key ke(foundry->styles[k]->key);
|
QtFontStyle::Key ke(foundry->styles[k]->key);
|
||||||
ke.stretch = 0;
|
ke.stretch = 0;
|
||||||
allStyles.style(ke, true);
|
allStyles.style(ke, foundry->styles[k]->styleName, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < allStyles.count; i++) {
|
for (int i = 0; i < allStyles.count; i++) {
|
||||||
l.append(allStyles.styles[i]->key.styleName.isEmpty() ?
|
l.append(allStyles.styles[i]->styleName.isEmpty() ?
|
||||||
styleStringHelper(allStyles.styles[i]->key.weight,
|
styleStringHelper(allStyles.styles[i]->key.weight,
|
||||||
(QFont::Style)allStyles.styles[i]->key.style) :
|
(QFont::Style)allStyles.styles[i]->key.style) :
|
||||||
allStyles.styles[i]->key.styleName);
|
allStyles.styles[i]->styleName);
|
||||||
}
|
}
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
@ -1865,7 +1872,9 @@ bool QFontDatabase::isBitmapScalable(const QString &family,
|
|||||||
QtFontFoundry *foundry = f->foundries[j];
|
QtFontFoundry *foundry = f->foundries[j];
|
||||||
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
||||||
for (int k = 0; k < foundry->count; k++)
|
for (int k = 0; k < foundry->count; k++)
|
||||||
if ((style.isEmpty() || foundry->styles[k]->key == styleKey)
|
if ((style.isEmpty() ||
|
||||||
|
foundry->styles[k]->styleName == style ||
|
||||||
|
foundry->styles[k]->key == styleKey)
|
||||||
&& foundry->styles[k]->bitmapScalable && !foundry->styles[k]->smoothScalable) {
|
&& foundry->styles[k]->bitmapScalable && !foundry->styles[k]->smoothScalable) {
|
||||||
bitmapScalable = true;
|
bitmapScalable = true;
|
||||||
goto end;
|
goto end;
|
||||||
@ -1904,7 +1913,9 @@ bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &sty
|
|||||||
QtFontFoundry *foundry = f->foundries[j];
|
QtFontFoundry *foundry = f->foundries[j];
|
||||||
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
||||||
for (int k = 0; k < foundry->count; k++)
|
for (int k = 0; k < foundry->count; k++)
|
||||||
if ((style.isEmpty() || foundry->styles[k]->key == styleKey) && foundry->styles[k]->smoothScalable) {
|
if ((style.isEmpty() ||
|
||||||
|
foundry->styles[k]->styleName == style ||
|
||||||
|
foundry->styles[k]->key == styleKey) && foundry->styles[k]->smoothScalable) {
|
||||||
smoothScalable = true;
|
smoothScalable = true;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -1937,12 +1948,12 @@ bool QFontDatabase::isScalable(const QString &family,
|
|||||||
\sa smoothSizes(), standardSizes()
|
\sa smoothSizes(), standardSizes()
|
||||||
*/
|
*/
|
||||||
QList<int> QFontDatabase::pointSizes(const QString &family,
|
QList<int> QFontDatabase::pointSizes(const QString &family,
|
||||||
const QString &style)
|
const QString &styleName)
|
||||||
{
|
{
|
||||||
#if defined(Q_WS_WIN)
|
#if defined(Q_WS_WIN)
|
||||||
// windows and macosx are always smoothly scalable
|
// windows and macosx are always smoothly scalable
|
||||||
Q_UNUSED(family);
|
Q_UNUSED(family);
|
||||||
Q_UNUSED(style);
|
Q_UNUSED(styleName);
|
||||||
return standardSizes();
|
return standardSizes();
|
||||||
#else
|
#else
|
||||||
bool smoothScalable = false;
|
bool smoothScalable = false;
|
||||||
@ -1953,7 +1964,7 @@ QList<int> QFontDatabase::pointSizes(const QString &family,
|
|||||||
|
|
||||||
QT_PREPEND_NAMESPACE(load)(familyName);
|
QT_PREPEND_NAMESPACE(load)(familyName);
|
||||||
|
|
||||||
QtFontStyle::Key styleKey(style);
|
QtFontStyle::Key styleKey(styleName);
|
||||||
|
|
||||||
QList<int> sizes;
|
QList<int> sizes;
|
||||||
|
|
||||||
@ -1970,7 +1981,7 @@ QList<int> QFontDatabase::pointSizes(const QString &family,
|
|||||||
for (int j = 0; j < fam->count; j++) {
|
for (int j = 0; j < fam->count; j++) {
|
||||||
QtFontFoundry *foundry = fam->foundries[j];
|
QtFontFoundry *foundry = fam->foundries[j];
|
||||||
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
||||||
QtFontStyle *style = foundry->style(styleKey);
|
QtFontStyle *style = foundry->style(styleKey, styleName);
|
||||||
if (!style) continue;
|
if (!style) continue;
|
||||||
|
|
||||||
if (style->smoothScalable) {
|
if (style->smoothScalable) {
|
||||||
@ -2021,25 +2032,21 @@ QFont QFontDatabase::font(const QString &family, const QString &style,
|
|||||||
QtFontFoundry *foundry = f->foundries[j];
|
QtFontFoundry *foundry = f->foundries[j];
|
||||||
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
||||||
for (int k = 0; k < foundry->count; k++)
|
for (int k = 0; k < foundry->count; k++)
|
||||||
allStyles.style(foundry->styles[k]->key, true);
|
allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtFontStyle::Key styleKey(style);
|
QtFontStyle::Key styleKey(style);
|
||||||
QtFontStyle *s = bestStyle(&allStyles, styleKey);
|
QtFontStyle *s = bestStyle(&allStyles, styleKey, style);
|
||||||
|
|
||||||
if (!s) // no styles found?
|
if (!s) // no styles found?
|
||||||
return QGuiApplication::font();
|
return QGuiApplication::font();
|
||||||
if (s->key.styleName.isEmpty()) {
|
|
||||||
QFont fnt(family, pointSize, s->key.weight);
|
QFont fnt(family, pointSize, s->key.weight);
|
||||||
fnt.setStyle((QFont::Style)s->key.style);
|
fnt.setStyle((QFont::Style)s->key.style);
|
||||||
return fnt;
|
if (!s->styleName.isEmpty())
|
||||||
} else {
|
fnt.setStyleName(s->styleName);
|
||||||
// found a perfect match
|
return fnt;
|
||||||
QFont fnt(family, pointSize);
|
|
||||||
fnt.setStyleName(s->key.styleName);
|
|
||||||
return fnt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2052,11 +2059,11 @@ QFont QFontDatabase::font(const QString &family, const QString &style,
|
|||||||
\sa pointSizes(), standardSizes()
|
\sa pointSizes(), standardSizes()
|
||||||
*/
|
*/
|
||||||
QList<int> QFontDatabase::smoothSizes(const QString &family,
|
QList<int> QFontDatabase::smoothSizes(const QString &family,
|
||||||
const QString &style)
|
const QString &styleName)
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
Q_UNUSED(family);
|
Q_UNUSED(family);
|
||||||
Q_UNUSED(style);
|
Q_UNUSED(styleName);
|
||||||
return QFontDatabase::standardSizes();
|
return QFontDatabase::standardSizes();
|
||||||
#else
|
#else
|
||||||
bool smoothScalable = false;
|
bool smoothScalable = false;
|
||||||
@ -2067,7 +2074,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family,
|
|||||||
|
|
||||||
QT_PREPEND_NAMESPACE(load)(familyName);
|
QT_PREPEND_NAMESPACE(load)(familyName);
|
||||||
|
|
||||||
QtFontStyle::Key styleKey(style);
|
QtFontStyle::Key styleKey(styleName);
|
||||||
|
|
||||||
QList<int> sizes;
|
QList<int> sizes;
|
||||||
|
|
||||||
@ -2084,7 +2091,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family,
|
|||||||
for (int j = 0; j < fam->count; j++) {
|
for (int j = 0; j < fam->count; j++) {
|
||||||
QtFontFoundry *foundry = fam->foundries[j];
|
QtFontFoundry *foundry = fam->foundries[j];
|
||||||
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
||||||
QtFontStyle *style = foundry->style(styleKey);
|
QtFontStyle *style = foundry->style(styleKey, styleName);
|
||||||
if (!style) continue;
|
if (!style) continue;
|
||||||
|
|
||||||
if (style->smoothScalable) {
|
if (style->smoothScalable) {
|
||||||
@ -2151,12 +2158,12 @@ bool QFontDatabase::italic(const QString &family, const QString &style) const
|
|||||||
QtFontFoundry *foundry = f->foundries[j];
|
QtFontFoundry *foundry = f->foundries[j];
|
||||||
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
||||||
for (int k = 0; k < foundry->count; k++)
|
for (int k = 0; k < foundry->count; k++)
|
||||||
allStyles.style(foundry->styles[k]->key, true);
|
allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtFontStyle::Key styleKey(style);
|
QtFontStyle::Key styleKey(style);
|
||||||
QtFontStyle *s = allStyles.style(styleKey);
|
QtFontStyle *s = allStyles.style(styleKey, style);
|
||||||
return s && s->key.style == QFont::StyleItalic;
|
return s && s->key.style == QFont::StyleItalic;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2186,12 +2193,12 @@ bool QFontDatabase::bold(const QString &family,
|
|||||||
if (foundryName.isEmpty() ||
|
if (foundryName.isEmpty() ||
|
||||||
foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
||||||
for (int k = 0; k < foundry->count; k++)
|
for (int k = 0; k < foundry->count; k++)
|
||||||
allStyles.style(foundry->styles[k]->key, true);
|
allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtFontStyle::Key styleKey(style);
|
QtFontStyle::Key styleKey(style);
|
||||||
QtFontStyle *s = allStyles.style(styleKey);
|
QtFontStyle *s = allStyles.style(styleKey, style);
|
||||||
return s && s->key.weight >= QFont::Bold;
|
return s && s->key.weight >= QFont::Bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2222,12 +2229,12 @@ int QFontDatabase::weight(const QString &family,
|
|||||||
if (foundryName.isEmpty() ||
|
if (foundryName.isEmpty() ||
|
||||||
foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) {
|
||||||
for (int k = 0; k < foundry->count; k++)
|
for (int k = 0; k < foundry->count; k++)
|
||||||
allStyles.style(foundry->styles[k]->key, true);
|
allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtFontStyle::Key styleKey(style);
|
QtFontStyle::Key styleKey(style);
|
||||||
QtFontStyle *s = allStyles.style(styleKey);
|
QtFontStyle *s = allStyles.style(styleKey, style);
|
||||||
return s ? s->key.weight : -1;
|
return s ? s->key.weight : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ Q_GUI_EXPORT void qt_registerFont(const QString &familyName, const QString &fou
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtFontFoundry *foundry = f->foundry(foundryname, true);
|
QtFontFoundry *foundry = f->foundry(foundryname, true);
|
||||||
QtFontStyle *fontStyle = foundry->style(styleKey, true);
|
QtFontStyle *fontStyle = foundry->style(styleKey, QString(), true);
|
||||||
fontStyle->smoothScalable = scalable;
|
fontStyle->smoothScalable = scalable;
|
||||||
fontStyle->antialiased = antialiased;
|
fontStyle->antialiased = antialiased;
|
||||||
QtFontSize *size = fontStyle->pixelSize(pixelSize?pixelSize:SMOOTH_SCALABLE, true);
|
QtFontSize *size = fontStyle->pixelSize(pixelSize?pixelSize:SMOOTH_SCALABLE, true);
|
||||||
|
@ -2711,7 +2711,7 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
|
|||||||
|
|
||||||
html += QLatin1Char('>');
|
html += QLatin1Char('>');
|
||||||
if (block.begin().atEnd())
|
if (block.begin().atEnd())
|
||||||
html += "<br />";
|
html += QLatin1String("<br />");
|
||||||
|
|
||||||
QTextBlock::Iterator it = block.begin();
|
QTextBlock::Iterator it = block.begin();
|
||||||
if (fragmentMarkers && !it.atEnd() && block == doc->begin())
|
if (fragmentMarkers && !it.atEnd() && block == doc->begin())
|
||||||
|
@ -163,8 +163,6 @@ public:
|
|||||||
bool isSocketWaiting() const;
|
bool isSocketWaiting() const;
|
||||||
bool isSocketReading() const;
|
bool isSocketReading() const;
|
||||||
|
|
||||||
friend class QNetworkAccessHttpBackend;
|
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void _q_receiveReply();
|
void _q_receiveReply();
|
||||||
void _q_bytesWritten(qint64 bytes); // proceed sending
|
void _q_bytesWritten(qint64 bytes); // proceed sending
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,169 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
** All rights reserved.
|
|
||||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
** This file is part of the QtNetwork module of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:LGPL$
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
|
||||||
** License version 2.1 as published by the Free Software Foundation and
|
|
||||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
|
||||||
** file. Please review the following information to ensure the GNU Lesser
|
|
||||||
** General Public License version 2.1 requirements will be met:
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
|
||||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
** Public License version 3.0 as published by the Free Software Foundation
|
|
||||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
||||||
** file. Please review the following information to ensure the GNU General
|
|
||||||
** Public License version 3.0 requirements will be met:
|
|
||||||
** http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
**
|
|
||||||
** Other Usage
|
|
||||||
** Alternatively, this file may be used in accordance with the terms and
|
|
||||||
** conditions contained in a signed written agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QNETWORKACCESSHTTPBACKEND_P_H
|
|
||||||
#define QNETWORKACCESSHTTPBACKEND_P_H
|
|
||||||
|
|
||||||
//
|
|
||||||
// W A R N I N G
|
|
||||||
// -------------
|
|
||||||
//
|
|
||||||
// This file is not part of the Qt API. It exists for the convenience
|
|
||||||
// of the Network Access API. This header file may change from
|
|
||||||
// version to version without notice, or even be removed.
|
|
||||||
//
|
|
||||||
// We mean it.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "qhttpnetworkconnection_p.h"
|
|
||||||
#include "qnetworkaccessbackend_p.h"
|
|
||||||
#include "qnetworkrequest.h"
|
|
||||||
#include "qnetworkreply.h"
|
|
||||||
#include "qabstractsocket.h"
|
|
||||||
|
|
||||||
#include "QtCore/qpointer.h"
|
|
||||||
#include "QtCore/qdatetime.h"
|
|
||||||
#include "QtCore/qsharedpointer.h"
|
|
||||||
#include "qatomic.h"
|
|
||||||
|
|
||||||
#ifndef QT_NO_HTTP
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
|
|
||||||
class QNetworkAccessCachedHttpConnection;
|
|
||||||
|
|
||||||
class QNetworkAccessHttpBackendIODevice;
|
|
||||||
|
|
||||||
class QNetworkAccessHttpBackend: public QNetworkAccessBackend
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
QNetworkAccessHttpBackend();
|
|
||||||
virtual ~QNetworkAccessHttpBackend();
|
|
||||||
|
|
||||||
virtual void open();
|
|
||||||
virtual void closeDownstreamChannel();
|
|
||||||
|
|
||||||
virtual void downstreamReadyWrite();
|
|
||||||
virtual void setDownstreamLimited(bool b);
|
|
||||||
|
|
||||||
virtual void copyFinished(QIODevice *);
|
|
||||||
#ifndef QT_NO_OPENSSL
|
|
||||||
virtual void ignoreSslErrors();
|
|
||||||
virtual void ignoreSslErrors(const QList<QSslError> &errors);
|
|
||||||
|
|
||||||
virtual void fetchSslConfiguration(QSslConfiguration &configuration) const;
|
|
||||||
virtual void setSslConfiguration(const QSslConfiguration &configuration);
|
|
||||||
#endif
|
|
||||||
QNetworkCacheMetaData fetchCacheMetaData(const QNetworkCacheMetaData &metaData) const;
|
|
||||||
|
|
||||||
// we return true since HTTP needs to send PUT/POST data again after having authenticated
|
|
||||||
bool needsResetableUploadData() { return true; }
|
|
||||||
|
|
||||||
bool canResume() const;
|
|
||||||
void setResumeOffset(quint64 offset);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
// To HTTP thread:
|
|
||||||
void startHttpRequest();
|
|
||||||
void abortHttpRequest();
|
|
||||||
|
|
||||||
void startHttpRequestSynchronously();
|
|
||||||
|
|
||||||
void haveUploadData(QByteArray dataArray, bool dataAtEnd, qint64 dataSize);
|
|
||||||
private slots:
|
|
||||||
// From HTTP thread:
|
|
||||||
void replyDownloadData(QByteArray);
|
|
||||||
void replyFinished();
|
|
||||||
void replyDownloadMetaData(QList<QPair<QByteArray,QByteArray> >,int,QString,bool,QSharedPointer<char>,qint64);
|
|
||||||
void replyDownloadProgressSlot(qint64,qint64);
|
|
||||||
void httpAuthenticationRequired(const QHttpNetworkRequest &request, QAuthenticator *auth);
|
|
||||||
void httpError(QNetworkReply::NetworkError error, const QString &errorString);
|
|
||||||
#ifndef QT_NO_OPENSSL
|
|
||||||
void replySslErrors(const QList<QSslError> &, bool *, QList<QSslError> *);
|
|
||||||
void replySslConfigurationChanged(const QSslConfiguration&);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// From QNonContiguousByteDeviceThreadForwardImpl in HTTP thread:
|
|
||||||
void resetUploadDataSlot(bool *r);
|
|
||||||
void wantUploadDataSlot(qint64);
|
|
||||||
void sentUploadDataSlot(qint64);
|
|
||||||
|
|
||||||
bool sendCacheContents(const QNetworkCacheMetaData &metaData);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QHttpNetworkRequest httpRequest; // There is also a copy in the HTTP thread
|
|
||||||
int statusCode;
|
|
||||||
QString reasonPhrase;
|
|
||||||
// Will be increased by HTTP thread:
|
|
||||||
QSharedPointer<QAtomicInt> pendingDownloadDataEmissions;
|
|
||||||
QSharedPointer<QAtomicInt> pendingDownloadProgressEmissions;
|
|
||||||
bool loadingFromCache;
|
|
||||||
QByteDataBuffer pendingDownloadData;
|
|
||||||
bool usingZerocopyDownloadBuffer;
|
|
||||||
|
|
||||||
#ifndef QT_NO_OPENSSL
|
|
||||||
QSslConfiguration *pendingSslConfiguration;
|
|
||||||
bool pendingIgnoreAllSslErrors;
|
|
||||||
QList<QSslError> pendingIgnoreSslErrorsList;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
quint64 resumeOffset;
|
|
||||||
|
|
||||||
bool loadFromCacheIfAllowed(QHttpNetworkRequest &httpRequest);
|
|
||||||
void invalidateCache();
|
|
||||||
void postRequest();
|
|
||||||
void readFromHttp();
|
|
||||||
void checkForRedirect(const int statusCode);
|
|
||||||
};
|
|
||||||
|
|
||||||
class QNetworkAccessHttpBackendFactory : public QNetworkAccessBackendFactory
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual QNetworkAccessBackend *create(QNetworkAccessManager::Operation op,
|
|
||||||
const QNetworkRequest &request) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
#endif // QT_NO_HTTP
|
|
||||||
|
|
||||||
#endif
|
|
@ -50,7 +50,6 @@
|
|||||||
#include "QtNetwork/qnetworksession.h"
|
#include "QtNetwork/qnetworksession.h"
|
||||||
#include "QtNetwork/private/qsharednetworksession_p.h"
|
#include "QtNetwork/private/qsharednetworksession_p.h"
|
||||||
|
|
||||||
#include "qnetworkaccesshttpbackend_p.h"
|
|
||||||
#include "qnetworkaccessftpbackend_p.h"
|
#include "qnetworkaccessftpbackend_p.h"
|
||||||
#include "qnetworkaccessfilebackend_p.h"
|
#include "qnetworkaccessfilebackend_p.h"
|
||||||
#include "qnetworkaccessdebugpipebackend_p.h"
|
#include "qnetworkaccessdebugpipebackend_p.h"
|
||||||
|
@ -159,7 +159,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend class QNetworkReplyImplPrivate;
|
friend class QNetworkReplyImplPrivate;
|
||||||
friend class QNetworkAccessHttpBackend;
|
|
||||||
friend class QNetworkReplyHttpImpl;
|
friend class QNetworkReplyHttpImpl;
|
||||||
|
|
||||||
Q_DECLARE_PRIVATE(QNetworkAccessManager)
|
Q_DECLARE_PRIVATE(QNetworkAccessManager)
|
||||||
|
@ -105,6 +105,10 @@ QT_BEGIN_NAMESPACE
|
|||||||
header and contains a QList<QNetworkCookie> representing the
|
header and contains a QList<QNetworkCookie> representing the
|
||||||
cookies sent by the server to be stored locally.
|
cookies sent by the server to be stored locally.
|
||||||
|
|
||||||
|
\value UserAgentHeader The User-Agent header sent by HTTP clients.
|
||||||
|
|
||||||
|
\value ServerHeader The Server header received by HTTP clients.
|
||||||
|
|
||||||
\sa header(), setHeader(), rawHeader(), setRawHeader()
|
\sa header(), setHeader(), rawHeader(), setRawHeader()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -650,6 +654,12 @@ static QByteArray headerName(QNetworkRequest::KnownHeaders header)
|
|||||||
case QNetworkRequest::ContentDispositionHeader:
|
case QNetworkRequest::ContentDispositionHeader:
|
||||||
return "Content-Disposition";
|
return "Content-Disposition";
|
||||||
|
|
||||||
|
case QNetworkRequest::UserAgentHeader:
|
||||||
|
return "User-Agent";
|
||||||
|
|
||||||
|
case QNetworkRequest::ServerHeader:
|
||||||
|
return "Server";
|
||||||
|
|
||||||
// no default:
|
// no default:
|
||||||
// if new values are added, this will generate a compiler warning
|
// if new values are added, this will generate a compiler warning
|
||||||
}
|
}
|
||||||
@ -663,6 +673,8 @@ static QByteArray headerValue(QNetworkRequest::KnownHeaders header, const QVaria
|
|||||||
case QNetworkRequest::ContentTypeHeader:
|
case QNetworkRequest::ContentTypeHeader:
|
||||||
case QNetworkRequest::ContentLengthHeader:
|
case QNetworkRequest::ContentLengthHeader:
|
||||||
case QNetworkRequest::ContentDispositionHeader:
|
case QNetworkRequest::ContentDispositionHeader:
|
||||||
|
case QNetworkRequest::UserAgentHeader:
|
||||||
|
case QNetworkRequest::ServerHeader:
|
||||||
return value.toByteArray();
|
return value.toByteArray();
|
||||||
|
|
||||||
case QNetworkRequest::LocationHeader:
|
case QNetworkRequest::LocationHeader:
|
||||||
@ -745,6 +757,13 @@ static QNetworkRequest::KnownHeaders parseHeaderName(const QByteArray &headerNam
|
|||||||
case 's':
|
case 's':
|
||||||
if (qstricmp(headerName.constData(), "set-cookie") == 0)
|
if (qstricmp(headerName.constData(), "set-cookie") == 0)
|
||||||
return QNetworkRequest::SetCookieHeader;
|
return QNetworkRequest::SetCookieHeader;
|
||||||
|
else if (qstricmp(headerName.constData(), "server") == 0)
|
||||||
|
return QNetworkRequest::ServerHeader;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'u':
|
||||||
|
if (qstricmp(headerName.constData(), "user-agent") == 0)
|
||||||
|
return QNetworkRequest::UserAgentHeader;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -778,6 +797,8 @@ static QVariant parseHeaderValue(QNetworkRequest::KnownHeaders header, const QBy
|
|||||||
{
|
{
|
||||||
// header is always a valid value
|
// header is always a valid value
|
||||||
switch (header) {
|
switch (header) {
|
||||||
|
case QNetworkRequest::UserAgentHeader:
|
||||||
|
case QNetworkRequest::ServerHeader:
|
||||||
case QNetworkRequest::ContentTypeHeader:
|
case QNetworkRequest::ContentTypeHeader:
|
||||||
// copy exactly, convert to QString
|
// copy exactly, convert to QString
|
||||||
return QString::fromLatin1(value);
|
return QString::fromLatin1(value);
|
||||||
|
@ -66,7 +66,9 @@ public:
|
|||||||
LastModifiedHeader,
|
LastModifiedHeader,
|
||||||
CookieHeader,
|
CookieHeader,
|
||||||
SetCookieHeader,
|
SetCookieHeader,
|
||||||
ContentDispositionHeader // added for QMultipartMessage
|
ContentDispositionHeader, // added for QMultipartMessage
|
||||||
|
UserAgentHeader,
|
||||||
|
ServerHeader
|
||||||
};
|
};
|
||||||
enum Attribute {
|
enum Attribute {
|
||||||
HttpStatusCodeAttribute,
|
HttpStatusCodeAttribute,
|
||||||
|
@ -527,6 +527,7 @@ void QHostInfoRunnable::run()
|
|||||||
iterator.remove();
|
iterator.remove();
|
||||||
hostInfo.setLookupId(postponed->id);
|
hostInfo.setLookupId(postponed->id);
|
||||||
postponed->resultEmitter.emitResultsReady(hostInfo);
|
postponed->resultEmitter.emitResultsReady(hostInfo);
|
||||||
|
delete postponed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
// forward declaration
|
// forward declaration
|
||||||
static QMap<QString, QString> _q_mapFromX509Name(X509_NAME *name);
|
static QMap<QByteArray, QString> _q_mapFromX509Name(X509_NAME *name);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Constructs a QSslCertificate by reading \a format encoded data
|
Constructs a QSslCertificate by reading \a format encoded data
|
||||||
@ -297,19 +297,19 @@ QByteArray QSslCertificate::digest(QCryptographicHash::Algorithm algorithm) cons
|
|||||||
return QCryptographicHash::hash(toDer(), algorithm);
|
return QCryptographicHash::hash(toDer(), algorithm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString _q_SubjectInfoToString(QSslCertificate::SubjectInfo info)
|
static QByteArray _q_SubjectInfoToString(QSslCertificate::SubjectInfo info)
|
||||||
{
|
{
|
||||||
QString str;
|
QByteArray str;
|
||||||
switch (info) {
|
switch (info) {
|
||||||
case QSslCertificate::Organization: str = QLatin1String("O"); break;
|
case QSslCertificate::Organization: str = QByteArray("O"); break;
|
||||||
case QSslCertificate::CommonName: str = QLatin1String("CN"); break;
|
case QSslCertificate::CommonName: str = QByteArray("CN"); break;
|
||||||
case QSslCertificate::LocalityName: str = QLatin1String("L"); break;
|
case QSslCertificate::LocalityName: str = QByteArray("L"); break;
|
||||||
case QSslCertificate::OrganizationalUnitName: str = QLatin1String("OU"); break;
|
case QSslCertificate::OrganizationalUnitName: str = QByteArray("OU"); break;
|
||||||
case QSslCertificate::CountryName: str = QLatin1String("C"); break;
|
case QSslCertificate::CountryName: str = QByteArray("C"); break;
|
||||||
case QSslCertificate::StateOrProvinceName: str = QLatin1String("ST"); break;
|
case QSslCertificate::StateOrProvinceName: str = QByteArray("ST"); break;
|
||||||
case QSslCertificate::DistinguishedNameQualifier: str = QLatin1String("dnQualifier"); break;
|
case QSslCertificate::DistinguishedNameQualifier: str = QByteArray("dnQualifier"); break;
|
||||||
case QSslCertificate::SerialNumber: str = QLatin1String("serialNumber"); break;
|
case QSslCertificate::SerialNumber: str = QByteArray("serialNumber"); break;
|
||||||
case QSslCertificate::EmailAddress: str = QLatin1String("emailAddress"); break;
|
case QSslCertificate::EmailAddress: str = QByteArray("emailAddress"); break;
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@ -334,20 +334,20 @@ QStringList QSslCertificate::issuerInfo(SubjectInfo info) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the issuer information for \a tag from the certificate,
|
Returns the issuer information for \a attribute from the certificate,
|
||||||
or an empty string if there is no information for \a tag in the
|
or an empty string if there is no information for \a attribute in the
|
||||||
certificate.
|
certificate.
|
||||||
|
|
||||||
\sa subjectInfo()
|
\sa subjectInfo()
|
||||||
*/
|
*/
|
||||||
QStringList QSslCertificate::issuerInfo(const QByteArray &tag) const
|
QStringList QSslCertificate::issuerInfo(const QByteArray &attribute) const
|
||||||
{
|
{
|
||||||
// lazy init
|
// lazy init
|
||||||
if (d->issuerInfo.isEmpty() && d->x509)
|
if (d->issuerInfo.isEmpty() && d->x509)
|
||||||
d->issuerInfo =
|
d->issuerInfo =
|
||||||
_q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
|
_q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
|
||||||
|
|
||||||
return d->issuerInfo.values(QString::fromLatin1(tag));
|
return d->issuerInfo.values(attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -370,19 +370,57 @@ QStringList QSslCertificate::subjectInfo(SubjectInfo info) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the subject information for \a tag, or an empty string if
|
Returns the subject information for \a attribute, or an empty string if
|
||||||
there is no information for \a tag in the certificate.
|
there is no information for \a attribute in the certificate.
|
||||||
|
|
||||||
\sa issuerInfo()
|
\sa issuerInfo()
|
||||||
*/
|
*/
|
||||||
QStringList QSslCertificate::subjectInfo(const QByteArray &tag) const
|
QStringList QSslCertificate::subjectInfo(const QByteArray &attribute) const
|
||||||
{
|
{
|
||||||
// lazy init
|
// lazy init
|
||||||
if (d->subjectInfo.isEmpty() && d->x509)
|
if (d->subjectInfo.isEmpty() && d->x509)
|
||||||
d->subjectInfo =
|
d->subjectInfo =
|
||||||
_q_mapFromX509Name(q_X509_get_subject_name(d->x509));
|
_q_mapFromX509Name(q_X509_get_subject_name(d->x509));
|
||||||
|
|
||||||
return d->subjectInfo.values(QString::fromLatin1(tag));
|
return d->subjectInfo.values(attribute);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns a list of the attributes that have values in the subject
|
||||||
|
information of this certificate. The information associated
|
||||||
|
with a given attribute can be accessed using the subjectInfo()
|
||||||
|
method. Note that this list may include the OIDs for any
|
||||||
|
elements that are not known by the SSL backend.
|
||||||
|
|
||||||
|
\sa subjectInfo()
|
||||||
|
*/
|
||||||
|
QList<QByteArray> QSslCertificate::subjectInfoAttributes() const
|
||||||
|
{
|
||||||
|
// lazy init
|
||||||
|
if (d->subjectInfo.isEmpty() && d->x509)
|
||||||
|
d->subjectInfo =
|
||||||
|
_q_mapFromX509Name(q_X509_get_subject_name(d->x509));
|
||||||
|
|
||||||
|
return d->subjectInfo.uniqueKeys();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns a list of the attributes that have values in the issuer
|
||||||
|
information of this certificate. The information associated
|
||||||
|
with a given attribute can be accessed using the issuerInfo()
|
||||||
|
method. Note that this list may include the OIDs for any
|
||||||
|
elements that are not known by the SSL backend.
|
||||||
|
|
||||||
|
\sa subjectInfo()
|
||||||
|
*/
|
||||||
|
QList<QByteArray> QSslCertificate::issuerInfoAttributes() const
|
||||||
|
{
|
||||||
|
// lazy init
|
||||||
|
if (d->issuerInfo.isEmpty() && d->x509)
|
||||||
|
d->issuerInfo =
|
||||||
|
_q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
|
||||||
|
|
||||||
|
return d->issuerInfo.uniqueKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -706,17 +744,32 @@ QByteArray QSslCertificatePrivate::text_from_X509(X509 *x509)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QMap<QString, QString> _q_mapFromX509Name(X509_NAME *name)
|
QByteArray QSslCertificatePrivate::asn1ObjectName(ASN1_OBJECT *object)
|
||||||
{
|
{
|
||||||
QMap<QString, QString> info;
|
int nid = q_OBJ_obj2nid(object);
|
||||||
|
if (nid != NID_undef)
|
||||||
|
return QByteArray(q_OBJ_nid2sn(nid));
|
||||||
|
|
||||||
|
// This is used for unknown info so we get the OID as text
|
||||||
|
char buf[80];
|
||||||
|
q_i2t_ASN1_OBJECT(buf, sizeof(buf), object);
|
||||||
|
|
||||||
|
return QByteArray(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static QMap<QByteArray, QString> _q_mapFromX509Name(X509_NAME *name)
|
||||||
|
{
|
||||||
|
QMap<QByteArray, QString> info;
|
||||||
for (int i = 0; i < q_X509_NAME_entry_count(name); ++i) {
|
for (int i = 0; i < q_X509_NAME_entry_count(name); ++i) {
|
||||||
X509_NAME_ENTRY *e = q_X509_NAME_get_entry(name, i);
|
X509_NAME_ENTRY *e = q_X509_NAME_get_entry(name, i);
|
||||||
const char *obj = q_OBJ_nid2sn(q_OBJ_obj2nid(q_X509_NAME_ENTRY_get_object(e)));
|
|
||||||
|
QByteArray name = QSslCertificatePrivate::asn1ObjectName(q_X509_NAME_ENTRY_get_object(e));
|
||||||
unsigned char *data = 0;
|
unsigned char *data = 0;
|
||||||
int size = q_ASN1_STRING_to_UTF8(&data, q_X509_NAME_ENTRY_get_data(e));
|
int size = q_ASN1_STRING_to_UTF8(&data, q_X509_NAME_ENTRY_get_data(e));
|
||||||
info.insertMulti(QString::fromUtf8(obj), QString::fromUtf8((char*)data, size));
|
info.insertMulti(name, QString::fromUtf8((char*)data, size));
|
||||||
q_CRYPTO_free(data);
|
q_CRYPTO_free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,9 +100,11 @@ public:
|
|||||||
QByteArray serialNumber() const;
|
QByteArray serialNumber() const;
|
||||||
QByteArray digest(QCryptographicHash::Algorithm algorithm = QCryptographicHash::Md5) const;
|
QByteArray digest(QCryptographicHash::Algorithm algorithm = QCryptographicHash::Md5) const;
|
||||||
QStringList issuerInfo(SubjectInfo info) const;
|
QStringList issuerInfo(SubjectInfo info) const;
|
||||||
QStringList issuerInfo(const QByteArray &tag) const;
|
QStringList issuerInfo(const QByteArray &attribute) const;
|
||||||
QStringList subjectInfo(SubjectInfo info) const;
|
QStringList subjectInfo(SubjectInfo info) const;
|
||||||
QStringList subjectInfo(const QByteArray &tag) const;
|
QStringList subjectInfo(const QByteArray &attribute) const;
|
||||||
|
QList<QByteArray> subjectInfoAttributes() const;
|
||||||
|
QList<QByteArray> issuerInfoAttributes() const;
|
||||||
QMultiMap<QSsl::AlternateNameEntryType, QString> alternateSubjectNames() const;
|
QMultiMap<QSsl::AlternateNameEntryType, QString> alternateSubjectNames() const;
|
||||||
QDateTime effectiveDate() const;
|
QDateTime effectiveDate() const;
|
||||||
QDateTime expiryDate() const;
|
QDateTime expiryDate() const;
|
||||||
|
@ -83,8 +83,8 @@ public:
|
|||||||
QByteArray versionString;
|
QByteArray versionString;
|
||||||
QByteArray serialNumberString;
|
QByteArray serialNumberString;
|
||||||
|
|
||||||
QMap<QString, QString> issuerInfo;
|
QMap<QByteArray, QString> issuerInfo;
|
||||||
QMap<QString, QString> subjectInfo;
|
QMap<QByteArray, QString> subjectInfo;
|
||||||
QDateTime notValidAfter;
|
QDateTime notValidAfter;
|
||||||
QDateTime notValidBefore;
|
QDateTime notValidBefore;
|
||||||
|
|
||||||
@ -92,6 +92,7 @@ public:
|
|||||||
|
|
||||||
void init(const QByteArray &data, QSsl::EncodingFormat format);
|
void init(const QByteArray &data, QSsl::EncodingFormat format);
|
||||||
|
|
||||||
|
static QByteArray asn1ObjectName(ASN1_OBJECT *object);
|
||||||
static QByteArray QByteArray_from_X509(X509 *x509, QSsl::EncodingFormat format);
|
static QByteArray QByteArray_from_X509(X509 *x509, QSsl::EncodingFormat format);
|
||||||
static QByteArray text_from_X509(X509 *x509);
|
static QByteArray text_from_X509(X509 *x509);
|
||||||
static QSslCertificate QSslCertificate_from_X509(X509 *x509);
|
static QSslCertificate QSslCertificate_from_X509(X509 *x509);
|
||||||
|
@ -1598,6 +1598,27 @@ bool QSslSocket::supportsSsl()
|
|||||||
return QSslSocketPrivate::supportsSsl();
|
return QSslSocketPrivate::supportsSsl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the version number of the SSL library in use. Note that
|
||||||
|
this is the version of the library in use at run-time not compile
|
||||||
|
time. If no SSL support is available then this will return an
|
||||||
|
undefined value.
|
||||||
|
*/
|
||||||
|
long QSslSocket::sslLibraryVersionNumber()
|
||||||
|
{
|
||||||
|
return QSslSocketPrivate::sslLibraryVersionNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the version string of the SSL library in use. Note that
|
||||||
|
this is the version of the library in use at run-time not compile
|
||||||
|
time. If no SSL support is available then this will return an empty value.
|
||||||
|
*/
|
||||||
|
QString QSslSocket::sslLibraryVersionString()
|
||||||
|
{
|
||||||
|
return QSslSocketPrivate::sslLibraryVersionString();
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Starts a delayed SSL handshake for a client connection. This
|
Starts a delayed SSL handshake for a client connection. This
|
||||||
function can be called when the socket is in the \l ConnectedState
|
function can be called when the socket is in the \l ConnectedState
|
||||||
|
@ -176,6 +176,9 @@ public:
|
|||||||
QList<QSslError> sslErrors() const;
|
QList<QSslError> sslErrors() const;
|
||||||
|
|
||||||
static bool supportsSsl();
|
static bool supportsSsl();
|
||||||
|
static long sslLibraryVersionNumber();
|
||||||
|
static QString sslLibraryVersionString();
|
||||||
|
|
||||||
void ignoreSslErrors(const QList<QSslError> &errors);
|
void ignoreSslErrors(const QList<QSslError> &errors);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
@ -602,6 +602,23 @@ void QSslSocketPrivate::ensureInitialized()
|
|||||||
ensureCiphersAndCertsLoaded();
|
ensureCiphersAndCertsLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long QSslSocketPrivate::sslLibraryVersionNumber()
|
||||||
|
{
|
||||||
|
return q_SSLeay();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QSslSocketPrivate::sslLibraryVersionString()
|
||||||
|
{
|
||||||
|
if (!supportsSsl())
|
||||||
|
return QString();
|
||||||
|
|
||||||
|
const char *versionString = q_SSLeay_version(SSLEAY_VERSION);
|
||||||
|
if (!versionString)
|
||||||
|
return QString();
|
||||||
|
|
||||||
|
return QString::fromLatin1(versionString);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
|
|
||||||
|
@ -133,6 +133,10 @@ DEFINEFUNC(EVP_PKEY *, EVP_PKEY_new, DUMMYARG, DUMMYARG, return 0, return)
|
|||||||
DEFINEFUNC(int, EVP_PKEY_type, int a, a, return NID_undef, return)
|
DEFINEFUNC(int, EVP_PKEY_type, int a, a, return NID_undef, return)
|
||||||
DEFINEFUNC2(int, i2d_X509, X509 *a, a, unsigned char **b, b, return -1, return)
|
DEFINEFUNC2(int, i2d_X509, X509 *a, a, unsigned char **b, b, return -1, return)
|
||||||
DEFINEFUNC(const char *, OBJ_nid2sn, int a, a, return 0, return)
|
DEFINEFUNC(const char *, OBJ_nid2sn, int a, a, return 0, return)
|
||||||
|
DEFINEFUNC(const char *, OBJ_nid2ln, int a, a, return 0, return)
|
||||||
|
DEFINEFUNC3(int, i2t_ASN1_OBJECT, char *a, a, int b, b, ASN1_OBJECT *c, c, return -1, return)
|
||||||
|
|
||||||
|
|
||||||
DEFINEFUNC(int, OBJ_obj2nid, const ASN1_OBJECT *a, a, return NID_undef, return)
|
DEFINEFUNC(int, OBJ_obj2nid, const ASN1_OBJECT *a, a, return NID_undef, return)
|
||||||
#ifdef SSLEAY_MACROS
|
#ifdef SSLEAY_MACROS
|
||||||
DEFINEFUNC6(void *, PEM_ASN1_read_bio, d2i_of_void *a, a, const char *b, b, BIO *c, c, void **d, d, pem_password_cb *e, e, void *f, f, return 0, return)
|
DEFINEFUNC6(void *, PEM_ASN1_read_bio, d2i_of_void *a, a, const char *b, b, BIO *c, c, void **d, d, pem_password_cb *e, e, void *f, f, return 0, return)
|
||||||
@ -276,6 +280,7 @@ DEFINEFUNC(void, OPENSSL_add_all_algorithms_noconf, void, DUMMYARG, return, DUMM
|
|||||||
DEFINEFUNC(void, OPENSSL_add_all_algorithms_conf, void, DUMMYARG, return, DUMMYARG)
|
DEFINEFUNC(void, OPENSSL_add_all_algorithms_conf, void, DUMMYARG, return, DUMMYARG)
|
||||||
DEFINEFUNC3(int, SSL_CTX_load_verify_locations, SSL_CTX *ctx, ctx, const char *CAfile, CAfile, const char *CApath, CApath, return 0, return)
|
DEFINEFUNC3(int, SSL_CTX_load_verify_locations, SSL_CTX *ctx, ctx, const char *CAfile, CAfile, const char *CApath, CApath, return 0, return)
|
||||||
DEFINEFUNC(long, SSLeay, void, DUMMYARG, return 0, return)
|
DEFINEFUNC(long, SSLeay, void, DUMMYARG, return 0, return)
|
||||||
|
DEFINEFUNC(const char *, SSLeay_version, int a, a, return 0, return)
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
#ifdef Q_OS_SYMBIAN
|
||||||
#define RESOLVEFUNC(func, ordinal, lib) \
|
#define RESOLVEFUNC(func, ordinal, lib) \
|
||||||
@ -687,6 +692,8 @@ bool q_resolveOpenSslSymbols()
|
|||||||
RESOLVEFUNC(EVP_PKEY_new)
|
RESOLVEFUNC(EVP_PKEY_new)
|
||||||
RESOLVEFUNC(EVP_PKEY_type)
|
RESOLVEFUNC(EVP_PKEY_type)
|
||||||
RESOLVEFUNC(OBJ_nid2sn)
|
RESOLVEFUNC(OBJ_nid2sn)
|
||||||
|
RESOLVEFUNC(OBJ_nid2ln)
|
||||||
|
RESOLVEFUNC(i2t_ASN1_OBJECT)
|
||||||
RESOLVEFUNC(OBJ_obj2nid)
|
RESOLVEFUNC(OBJ_obj2nid)
|
||||||
#ifdef SSLEAY_MACROS // ### verify
|
#ifdef SSLEAY_MACROS // ### verify
|
||||||
RESOLVEFUNC(PEM_ASN1_read_bio)
|
RESOLVEFUNC(PEM_ASN1_read_bio)
|
||||||
@ -788,6 +795,7 @@ bool q_resolveOpenSslSymbols()
|
|||||||
RESOLVEFUNC(OPENSSL_add_all_algorithms_conf)
|
RESOLVEFUNC(OPENSSL_add_all_algorithms_conf)
|
||||||
RESOLVEFUNC(SSL_CTX_load_verify_locations)
|
RESOLVEFUNC(SSL_CTX_load_verify_locations)
|
||||||
RESOLVEFUNC(SSLeay)
|
RESOLVEFUNC(SSLeay)
|
||||||
|
RESOLVEFUNC(SSLeay_version)
|
||||||
#endif // Q_OS_SYMBIAN
|
#endif // Q_OS_SYMBIAN
|
||||||
symbolsResolved = true;
|
symbolsResolved = true;
|
||||||
delete libs.first;
|
delete libs.first;
|
||||||
|
@ -237,6 +237,8 @@ int q_EVP_PKEY_type(int a);
|
|||||||
EVP_PKEY *q_EVP_PKEY_new();
|
EVP_PKEY *q_EVP_PKEY_new();
|
||||||
int q_i2d_X509(X509 *a, unsigned char **b);
|
int q_i2d_X509(X509 *a, unsigned char **b);
|
||||||
const char *q_OBJ_nid2sn(int a);
|
const char *q_OBJ_nid2sn(int a);
|
||||||
|
const char *q_OBJ_nid2ln(int a);
|
||||||
|
int q_i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *obj);
|
||||||
int q_OBJ_obj2nid(const ASN1_OBJECT *a);
|
int q_OBJ_obj2nid(const ASN1_OBJECT *a);
|
||||||
#ifdef SSLEAY_MACROS
|
#ifdef SSLEAY_MACROS
|
||||||
// ### verify
|
// ### verify
|
||||||
@ -426,6 +428,7 @@ void q_OPENSSL_add_all_algorithms_noconf();
|
|||||||
void q_OPENSSL_add_all_algorithms_conf();
|
void q_OPENSSL_add_all_algorithms_conf();
|
||||||
int q_SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, const char *CApath);
|
int q_SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, const char *CApath);
|
||||||
long q_SSLeay();
|
long q_SSLeay();
|
||||||
|
const char *q_SSLeay_version(int type);
|
||||||
|
|
||||||
// Helper function
|
// Helper function
|
||||||
class QDateTime;
|
class QDateTime;
|
||||||
|
@ -116,6 +116,8 @@ public:
|
|||||||
bool allowRootCertOnDemandLoading;
|
bool allowRootCertOnDemandLoading;
|
||||||
|
|
||||||
static bool supportsSsl();
|
static bool supportsSsl();
|
||||||
|
static long sslLibraryVersionNumber();
|
||||||
|
static QString sslLibraryVersionString();
|
||||||
static void ensureInitialized();
|
static void ensureInitialized();
|
||||||
static void deinitialize();
|
static void deinitialize();
|
||||||
static QList<QSslCipher> defaultCiphers();
|
static QList<QSslCipher> defaultCiphers();
|
||||||
|
@ -57,8 +57,6 @@
|
|||||||
#ifndef QT_NO_DBUS
|
#ifndef QT_NO_DBUS
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
static QDBusConnection dbusConnection = QDBusConnection::systemBus();
|
|
||||||
|
|
||||||
|
|
||||||
QOfonoManagerInterface::QOfonoManagerInterface( QObject *parent)
|
QOfonoManagerInterface::QOfonoManagerInterface( QObject *parent)
|
||||||
: QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
|
: QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
|
||||||
@ -106,7 +104,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
|
|||||||
QOfonoDBusHelper *helper;
|
QOfonoDBusHelper *helper;
|
||||||
helper = new QOfonoDBusHelper(this);
|
helper = new QOfonoDBusHelper(this);
|
||||||
|
|
||||||
dbusConnection.connect(QLatin1String(OFONO_SERVICE),
|
QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
|
||||||
QLatin1String(OFONO_MANAGER_PATH),
|
QLatin1String(OFONO_MANAGER_PATH),
|
||||||
QLatin1String(OFONO_MANAGER_INTERFACE),
|
QLatin1String(OFONO_MANAGER_INTERFACE),
|
||||||
QLatin1String("PropertyChanged"),
|
QLatin1String("PropertyChanged"),
|
||||||
@ -256,7 +254,7 @@ void QOfonoModemInterface::connectNotify(const char *signal)
|
|||||||
QOfonoDBusHelper *helper;
|
QOfonoDBusHelper *helper;
|
||||||
helper = new QOfonoDBusHelper(this);
|
helper = new QOfonoDBusHelper(this);
|
||||||
|
|
||||||
dbusConnection.connect(QLatin1String(OFONO_SERVICE),
|
QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
|
||||||
this->path(),
|
this->path(),
|
||||||
QLatin1String(OFONO_MODEM_INTERFACE),
|
QLatin1String(OFONO_MODEM_INTERFACE),
|
||||||
QLatin1String("PropertyChanged"),
|
QLatin1String("PropertyChanged"),
|
||||||
@ -379,7 +377,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
|
|||||||
QOfonoDBusHelper *helper;
|
QOfonoDBusHelper *helper;
|
||||||
helper = new QOfonoDBusHelper(this);
|
helper = new QOfonoDBusHelper(this);
|
||||||
|
|
||||||
dbusConnection.connect(QLatin1String(OFONO_SERVICE),
|
QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
|
||||||
this->path(),
|
this->path(),
|
||||||
QLatin1String(OFONO_NETWORK_REGISTRATION_INTERFACE),
|
QLatin1String(OFONO_NETWORK_REGISTRATION_INTERFACE),
|
||||||
QLatin1String("PropertyChanged"),
|
QLatin1String("PropertyChanged"),
|
||||||
@ -477,7 +475,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
|
|||||||
QOfonoDBusHelper *helper;
|
QOfonoDBusHelper *helper;
|
||||||
helper = new QOfonoDBusHelper(this);
|
helper = new QOfonoDBusHelper(this);
|
||||||
|
|
||||||
dbusConnection.connect(QLatin1String(OFONO_SERVICE),
|
QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
|
||||||
this->path(),
|
this->path(),
|
||||||
QLatin1String(OFONO_NETWORK_OPERATOR_INTERFACE),
|
QLatin1String(OFONO_NETWORK_OPERATOR_INTERFACE),
|
||||||
QLatin1String("PropertyChanged"),
|
QLatin1String("PropertyChanged"),
|
||||||
@ -580,7 +578,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
|
|||||||
QOfonoDBusHelper *helper;
|
QOfonoDBusHelper *helper;
|
||||||
helper = new QOfonoDBusHelper(this);
|
helper = new QOfonoDBusHelper(this);
|
||||||
|
|
||||||
dbusConnection.connect(QLatin1String(OFONO_SERVICE),
|
QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
|
||||||
this->path(),
|
this->path(),
|
||||||
QLatin1String(OFONO_SIM_MANAGER_INTERFACE),
|
QLatin1String(OFONO_SIM_MANAGER_INTERFACE),
|
||||||
QLatin1String("PropertyChanged"),
|
QLatin1String("PropertyChanged"),
|
||||||
@ -669,7 +667,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
|
|||||||
QOfonoDBusHelper *helper;
|
QOfonoDBusHelper *helper;
|
||||||
helper = new QOfonoDBusHelper(this);
|
helper = new QOfonoDBusHelper(this);
|
||||||
|
|
||||||
dbusConnection.connect(QLatin1String(OFONO_SERVICE),
|
QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
|
||||||
this->path(),
|
this->path(),
|
||||||
QLatin1String(OFONO_DATA_CONNECTION_MANAGER_INTERFACE),
|
QLatin1String(OFONO_DATA_CONNECTION_MANAGER_INTERFACE),
|
||||||
QLatin1String("PropertyChanged"),
|
QLatin1String("PropertyChanged"),
|
||||||
@ -788,7 +786,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
|
|||||||
QOfonoDBusHelper *helper;
|
QOfonoDBusHelper *helper;
|
||||||
helper = new QOfonoDBusHelper(this);
|
helper = new QOfonoDBusHelper(this);
|
||||||
|
|
||||||
dbusConnection.connect(QLatin1String(OFONO_SERVICE),
|
QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
|
||||||
this->path(),
|
this->path(),
|
||||||
QLatin1String(OFONO_DATA_CONTEXT_INTERFACE),
|
QLatin1String(OFONO_DATA_CONTEXT_INTERFACE),
|
||||||
QLatin1String("PropertyChanged"),
|
QLatin1String("PropertyChanged"),
|
||||||
@ -870,7 +868,7 @@ void QOfonoSmsInterface::connectNotify(const char *signal)
|
|||||||
QOfonoDBusHelper *helper;
|
QOfonoDBusHelper *helper;
|
||||||
helper = new QOfonoDBusHelper(this);
|
helper = new QOfonoDBusHelper(this);
|
||||||
|
|
||||||
dbusConnection.connect(QLatin1String(OFONO_SERVICE),
|
QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
|
||||||
this->path(),
|
this->path(),
|
||||||
QLatin1String(OFONO_SMS_MANAGER_INTERFACE),
|
QLatin1String(OFONO_SMS_MANAGER_INTERFACE),
|
||||||
QLatin1String("PropertyChanged"),
|
QLatin1String("PropertyChanged"),
|
||||||
|
@ -18,11 +18,11 @@ After configuring and building Qt you need to also build src/plugins/platforms/u
|
|||||||
|
|
||||||
Simulator:
|
Simulator:
|
||||||
----------
|
----------
|
||||||
configure -qpa -xplatform qws/macx-iphonesimulator-g++ -arch i386 -developer-build -opengl es1 -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations
|
configure -qpa -xplatform qws/macx-iphonesimulator-g++ -arch i386 -developer-build -opengl es1 -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -static -nomake tools -nomake docs -nomake examples -nomake translations
|
||||||
|
|
||||||
Device:
|
Device:
|
||||||
-------
|
-------
|
||||||
configure -qpa -xplatform qws/macx-iphonedevice-g++ -arch armv7 -developer-build -release -opengl es1 -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations
|
configure -qpa -xplatform qws/macx-iphonedevice-g++ -arch armv7 -developer-build -release -opengl es1 -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -static -nomake tools -nomake docs -nomake examples -nomake translations
|
||||||
|
|
||||||
2) XCode setup:
|
2) XCode setup:
|
||||||
- there are examples in the examples subdirectory of the platform plugin
|
- there are examples in the examples subdirectory of the platform plugin
|
||||||
|
@ -48,6 +48,8 @@
|
|||||||
#include "wayland-xcomposite-client-protocol.h"
|
#include "wayland-xcomposite-client-protocol.h"
|
||||||
|
|
||||||
#include <X11/extensions/Xcomposite.h>
|
#include <X11/extensions/Xcomposite.h>
|
||||||
|
#include "qwaylandxcompositeeglintegration.h"
|
||||||
|
#include "windowmanager_integration/qwaylandwindowmanagerintegration.h"
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
@ -147,3 +149,12 @@ void QWaylandXCompositeEGLWindow::sync_function(void *data)
|
|||||||
QWaylandXCompositeEGLWindow *that = static_cast<QWaylandXCompositeEGLWindow *>(data);
|
QWaylandXCompositeEGLWindow *that = static_cast<QWaylandXCompositeEGLWindow *>(data);
|
||||||
that->m_waitingForSync = false;
|
that->m_waitingForSync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QWaylandXCompositeEGLWindow::requestActivateWindow()
|
||||||
|
{
|
||||||
|
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
|
||||||
|
mDisplay->windowManagerIntegration()->authenticateWithToken();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QWaylandWindow::requestActivateWindow();
|
||||||
|
}
|
||||||
|
@ -55,6 +55,7 @@ public:
|
|||||||
WindowType windowType() const;
|
WindowType windowType() const;
|
||||||
|
|
||||||
void setGeometry(const QRect &rect);
|
void setGeometry(const QRect &rect);
|
||||||
|
void requestActivateWindow();
|
||||||
|
|
||||||
EGLSurface eglSurface() const;
|
EGLSurface eglSurface() const;
|
||||||
|
|
||||||
|
@ -99,19 +99,18 @@ void QWaylandWindowManagerIntegration::authenticateWithToken(const QByteArray &t
|
|||||||
QByteArray authToken = token;
|
QByteArray authToken = token;
|
||||||
if (authToken.isEmpty())
|
if (authToken.isEmpty())
|
||||||
authToken = qgetenv("WL_AUTHENTICATION_TOKEN");
|
authToken = qgetenv("WL_AUTHENTICATION_TOKEN");
|
||||||
if (mWaylandWindowManager)
|
|
||||||
|
if (mWaylandWindowManager && !authToken.isEmpty()) {
|
||||||
wl_windowmanager_authenticate_with_token(mWaylandWindowManager, authToken.constData());
|
wl_windowmanager_authenticate_with_token(mWaylandWindowManager, authToken.constData());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandWindowManagerIntegration::wlHandleOnScreenVisibilityChange(void *data, struct wl_windowmanager *wl_windowmanager, int visible)
|
void QWaylandWindowManagerIntegration::wlHandleOnScreenVisibilityChange(void *data, struct wl_windowmanager *wl_windowmanager, int visible)
|
||||||
{
|
{
|
||||||
Q_UNUSED(data);
|
Q_UNUSED(data);
|
||||||
Q_UNUSED(wl_windowmanager);
|
Q_UNUSED(wl_windowmanager);
|
||||||
QEvent evt(visible != 0 ? QEvent::ApplicationActivated : QEvent::ApplicationDeactivated);
|
QEvent evt(visible != 0 ? QEvent::ApplicationActivate : QEvent::ApplicationDeactivate);
|
||||||
|
|
||||||
QCoreApplication::sendEvent(QCoreApplication::instance(), &evt);
|
QCoreApplication::sendEvent(QCoreApplication::instance(), &evt);
|
||||||
|
|
||||||
qDebug() << "OnScreenVisibility" << (visible != 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandWindowManagerIntegration::wlHandleScreenOrientationChange(void *data, struct wl_windowmanager *wl_windowmanager, int screenOrientation)
|
void QWaylandWindowManagerIntegration::wlHandleScreenOrientationChange(void *data, struct wl_windowmanager *wl_windowmanager, int screenOrientation)
|
||||||
|
@ -56,10 +56,6 @@ namespace QSql
|
|||||||
{
|
{
|
||||||
BeforeFirstRow = -1,
|
BeforeFirstRow = -1,
|
||||||
AfterLastRow = -2
|
AfterLastRow = -2
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
, BeforeFirst = BeforeFirstRow,
|
|
||||||
AfterLast = AfterLastRow
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ParamTypeFlag
|
enum ParamTypeFlag
|
||||||
@ -87,21 +83,6 @@ namespace QSql
|
|||||||
|
|
||||||
HighPrecision = 0
|
HighPrecision = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
enum Op {
|
|
||||||
None = -1,
|
|
||||||
Insert = 0,
|
|
||||||
Update = 1,
|
|
||||||
Delete = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Confirm {
|
|
||||||
Cancel = -1,
|
|
||||||
No = 0,
|
|
||||||
Yes = 1
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QSql::ParamType)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(QSql::ParamType)
|
||||||
|
@ -1434,26 +1434,6 @@ bool QSqlDatabase::isValid() const
|
|||||||
return d->driver && d->driver != d->shared_null()->driver;
|
return d->driver && d->driver != d->shared_null()->driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
/*!
|
|
||||||
Use query.record() instead.
|
|
||||||
*/
|
|
||||||
QSqlRecord QSqlDatabase::record(const QSqlQuery& query) const
|
|
||||||
{ return query.record(); }
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Use query.record() instead.
|
|
||||||
*/
|
|
||||||
QSqlRecord QSqlDatabase::recordInfo(const QSqlQuery& query) const
|
|
||||||
{ return query.record(); }
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn QSqlRecord QSqlDatabase::recordInfo(const QString& tablename) const
|
|
||||||
|
|
||||||
Use record() instead.
|
|
||||||
*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Clones the database connection \a other and and stores it as \a
|
Clones the database connection \a other and and stores it as \a
|
||||||
connectionName. All the settings from the original database, e.g.
|
connectionName. All the settings from the original database, e.g.
|
||||||
|
@ -44,9 +44,6 @@
|
|||||||
|
|
||||||
#include <QtCore/qstring.h>
|
#include <QtCore/qstring.h>
|
||||||
#include <QtSql/qsql.h>
|
#include <QtSql/qsql.h>
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
#include <QtSql/qsqlrecord.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QT_BEGIN_HEADER
|
QT_BEGIN_HEADER
|
||||||
|
|
||||||
@ -92,12 +89,6 @@ public:
|
|||||||
QStringList tables(QSql::TableType type = QSql::Tables) const;
|
QStringList tables(QSql::TableType type = QSql::Tables) const;
|
||||||
QSqlIndex primaryIndex(const QString& tablename) const;
|
QSqlIndex primaryIndex(const QString& tablename) const;
|
||||||
QSqlRecord record(const QString& tablename) const;
|
QSqlRecord record(const QString& tablename) const;
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
QT3_SUPPORT QSqlRecord record(const QSqlQuery& query) const;
|
|
||||||
inline QT3_SUPPORT QSqlRecord recordInfo(const QString& tablename) const
|
|
||||||
{ return record(tablename); }
|
|
||||||
QT3_SUPPORT QSqlRecord recordInfo(const QSqlQuery& query) const;
|
|
||||||
#endif
|
|
||||||
QSqlQuery exec(const QString& query = QString()) const;
|
QSqlQuery exec(const QString& query = QString()) const;
|
||||||
QSqlError lastError() const;
|
QSqlError lastError() const;
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
@ -46,9 +46,6 @@
|
|||||||
#include <QtCore/qstring.h>
|
#include <QtCore/qstring.h>
|
||||||
#include <QtCore/qstringlist.h>
|
#include <QtCore/qstringlist.h>
|
||||||
#include <QtSql/qsql.h>
|
#include <QtSql/qsql.h>
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
#include <QtSql/qsqlquery.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QT_BEGIN_HEADER
|
QT_BEGIN_HEADER
|
||||||
|
|
||||||
@ -93,17 +90,6 @@ public:
|
|||||||
virtual QStringList tables(QSql::TableType tableType) const;
|
virtual QStringList tables(QSql::TableType tableType) const;
|
||||||
virtual QSqlIndex primaryIndex(const QString &tableName) const;
|
virtual QSqlIndex primaryIndex(const QString &tableName) const;
|
||||||
virtual QSqlRecord record(const QString &tableName) const;
|
virtual QSqlRecord record(const QString &tableName) const;
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
inline QT3_SUPPORT QSqlRecord record(const QSqlQuery& query) const
|
|
||||||
{ return query.record(); }
|
|
||||||
inline QT3_SUPPORT QSqlRecord recordInfo(const QString& tablename) const
|
|
||||||
{ return record(tablename); }
|
|
||||||
inline QT3_SUPPORT QSqlRecord recordInfo(const QSqlQuery& query) const
|
|
||||||
{ return query.record(); }
|
|
||||||
inline QT3_SUPPORT QString nullText() const { return QLatin1String("NULL"); }
|
|
||||||
inline QT3_SUPPORT QString formatValue(const QSqlField *field, bool trimStrings = false) const
|
|
||||||
{ return field ? formatValue(*field, trimStrings) : QString(); }
|
|
||||||
#endif
|
|
||||||
virtual QString formatValue(const QSqlField& field, bool trimStrings = false) const;
|
virtual QString formatValue(const QSqlField& field, bool trimStrings = false) const;
|
||||||
|
|
||||||
virtual QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
|
virtual QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
|
||||||
|
@ -59,13 +59,6 @@ public:
|
|||||||
StatementError,
|
StatementError,
|
||||||
TransactionError,
|
TransactionError,
|
||||||
UnknownError
|
UnknownError
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
, None = NoError,
|
|
||||||
Connection = ConnectionError,
|
|
||||||
Statement = StatementError,
|
|
||||||
Transaction = TransactionError,
|
|
||||||
Unknown = UnknownError
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
QSqlError( const QString& driverText = QString(),
|
QSqlError( const QString& driverText = QString(),
|
||||||
const QString& databaseText = QString(),
|
const QString& databaseText = QString(),
|
||||||
|
@ -98,10 +98,6 @@ public:
|
|||||||
bool isGenerated() const;
|
bool isGenerated() const;
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
inline QT3_SUPPORT void setNull() { clear(); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void detach();
|
void detach();
|
||||||
QVariant val;
|
QVariant val;
|
||||||
|
@ -164,60 +164,6 @@ void QSqlIndex::setDescending(int i, bool desc)
|
|||||||
sorts[i] = desc;
|
sorts[i] = desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a comma-separated list of all the index's field names as a
|
|
||||||
string. This string is suitable, for example, for generating a
|
|
||||||
SQL SELECT statement. Only generated fields are included in the
|
|
||||||
list (see \l{isGenerated()}). If a \a prefix is specified, e.g. a
|
|
||||||
table name, it is prepended before all field names in the form:
|
|
||||||
|
|
||||||
"\a{prefix}.<fieldname>"
|
|
||||||
|
|
||||||
If \a sep is specified, each field is separated by \a sep. If \a
|
|
||||||
verbose is true (the default), each field contains a suffix
|
|
||||||
indicating an ASCending or DESCending sort order.
|
|
||||||
*/
|
|
||||||
|
|
||||||
QString QSqlIndex::toString(const QString& prefix, const QString& sep, bool verbose) const
|
|
||||||
{
|
|
||||||
QString s;
|
|
||||||
bool comma = false;
|
|
||||||
for (int i = 0; i < count(); ++i) {
|
|
||||||
if(comma)
|
|
||||||
s += sep + QLatin1Char(' ');
|
|
||||||
s += createField(i, prefix, verbose);
|
|
||||||
comma = true;
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a list of all the index's field names. Only generated
|
|
||||||
fields are included in the list (see \l{isGenerated()}). If a \a
|
|
||||||
prefix is specified, e.g. a table name, all fields are prefixed in
|
|
||||||
the form:
|
|
||||||
|
|
||||||
"\a{prefix}.<fieldname>"
|
|
||||||
|
|
||||||
If \a verbose is true (the default), each field contains a suffix
|
|
||||||
indicating an ASCending or DESCending sort order.
|
|
||||||
|
|
||||||
Note that if you want to iterate over the list, you should iterate
|
|
||||||
over a copy, e.g.
|
|
||||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqlindex.cpp 0
|
|
||||||
|
|
||||||
*/
|
|
||||||
QStringList QSqlIndex::toStringList(const QString& prefix, bool verbose) const
|
|
||||||
{
|
|
||||||
QStringList s;
|
|
||||||
for (int i = 0; i < count(); ++i)
|
|
||||||
s += createField(i, prefix, verbose);
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*! \internal
|
/*! \internal
|
||||||
|
|
||||||
Creates a string representing the field number \a i using prefix \a
|
Creates a string representing the field number \a i using prefix \a
|
||||||
|
@ -70,14 +70,6 @@ public:
|
|||||||
bool isDescending(int i) const;
|
bool isDescending(int i) const;
|
||||||
void setDescending(int i, bool desc);
|
void setDescending(int i, bool desc);
|
||||||
|
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
QT3_SUPPORT QString toString(const QString &prefix = QString(),
|
|
||||||
const QString &sep = QLatin1String(","),
|
|
||||||
bool verbose = true) const;
|
|
||||||
QT3_SUPPORT QStringList toStringList(const QString& prefix = QString(),
|
|
||||||
bool verbose = true) const;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString createField(int i, const QString& prefix, bool verbose) const;
|
QString createField(int i, const QString& prefix, bool verbose) const;
|
||||||
QString cursor;
|
QString cursor;
|
||||||
|
@ -94,9 +94,6 @@ public:
|
|||||||
bool seek(int i, bool relative = false);
|
bool seek(int i, bool relative = false);
|
||||||
bool next();
|
bool next();
|
||||||
bool previous();
|
bool previous();
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
inline QT3_SUPPORT bool prev() { return previous(); }
|
|
||||||
#endif
|
|
||||||
bool first();
|
bool first();
|
||||||
bool last();
|
bool last();
|
||||||
|
|
||||||
|
@ -244,34 +244,6 @@ int QSqlRecord::indexOf(const QString& name) const
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
/*!
|
|
||||||
\obsolete
|
|
||||||
Use field() instead
|
|
||||||
*/
|
|
||||||
const QSqlField* QSqlRecord::fieldPtr(int index) const
|
|
||||||
{
|
|
||||||
if (!d->contains(index))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return &d->fields.at(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\obsolete
|
|
||||||
Use field() instead
|
|
||||||
*/
|
|
||||||
|
|
||||||
const QSqlField* QSqlRecord::fieldPtr(const QString& name) const
|
|
||||||
{
|
|
||||||
int i = indexOf(name);
|
|
||||||
if (!d->contains(i))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return &d->fields.at(i);
|
|
||||||
}
|
|
||||||
#endif //QT3_SUPPORT
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the field at position \a index. If the position is out of
|
Returns the field at position \a index. If the position is out of
|
||||||
range, an empty field is returned.
|
range, an empty field is returned.
|
||||||
@ -496,49 +468,6 @@ bool QSqlRecord::isGenerated(int index) const
|
|||||||
return d->fields.value(index).isGenerated();
|
return d->fields.value(index).isGenerated();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
/*!
|
|
||||||
Returns a list of all the record's field names as a string
|
|
||||||
separated by \a sep.
|
|
||||||
|
|
||||||
In the unlikely event that you used this function in Qt 3, you
|
|
||||||
can simulate it using the rest of the QSqlRecord public API.
|
|
||||||
*/
|
|
||||||
|
|
||||||
QString QSqlRecord::toString(const QString& prefix, const QString& sep) const
|
|
||||||
{
|
|
||||||
QString pflist;
|
|
||||||
bool comma = false;
|
|
||||||
for (int i = 0; i < count(); ++i) {
|
|
||||||
if (!d->fields.value(i).isGenerated()) {
|
|
||||||
if (comma)
|
|
||||||
pflist += sep + QLatin1Char(' ');
|
|
||||||
pflist += d->createField(i, prefix);
|
|
||||||
comma = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return pflist;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a list of all the record's field names, each having the
|
|
||||||
prefix \a prefix.
|
|
||||||
|
|
||||||
In the unlikely event that you used this function in Qt 3, you
|
|
||||||
can simulate it using the rest of the QSqlRecord public API.
|
|
||||||
*/
|
|
||||||
|
|
||||||
QStringList QSqlRecord::toStringList(const QString& prefix) const
|
|
||||||
{
|
|
||||||
QStringList s;
|
|
||||||
for (int i = 0; i < count(); ++i) {
|
|
||||||
if (!d->fields.value(i).isGenerated())
|
|
||||||
s += d->createField(i, prefix);
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
#endif // QT3_SUPPORT
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the number of fields in the record.
|
Returns the number of fields in the record.
|
||||||
|
|
||||||
|
@ -87,15 +87,6 @@ public:
|
|||||||
void setGenerated(const QString& name, bool generated);
|
void setGenerated(const QString& name, bool generated);
|
||||||
void setGenerated(int i, bool generated);
|
void setGenerated(int i, bool generated);
|
||||||
|
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
QT3_SUPPORT const QSqlField* fieldPtr(int i) const;
|
|
||||||
QT3_SUPPORT const QSqlField* fieldPtr(const QString& name) const;
|
|
||||||
inline QT3_SUPPORT int position(const QString& name) const { return indexOf(name); }
|
|
||||||
QT3_SUPPORT QString toString(const QString& prefix = QString(),
|
|
||||||
const QString& sep = QLatin1String(",")) const;
|
|
||||||
QT3_SUPPORT QStringList toStringList(const QString& prefix = QString()) const;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void append(const QSqlField& field);
|
void append(const QSqlField& field);
|
||||||
void replace(int pos, const QSqlField& field);
|
void replace(int pos, const QSqlField& field);
|
||||||
void insert(int pos, const QSqlField& field);
|
void insert(int pos, const QSqlField& field);
|
||||||
|
@ -74,10 +74,6 @@ protected:
|
|||||||
enum BindingSyntax {
|
enum BindingSyntax {
|
||||||
PositionalBinding,
|
PositionalBinding,
|
||||||
NamedBinding
|
NamedBinding
|
||||||
#ifdef QT3_SUPPORT
|
|
||||||
, BindByPosition = PositionalBinding,
|
|
||||||
BindByName = NamedBinding
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit QSqlResult(const QSqlDriver * db);
|
explicit QSqlResult(const QSqlDriver * db);
|
||||||
|
@ -113,7 +113,7 @@ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
|
|||||||
QtFontFoundry *foundry = family->foundry(foundry_name, true);
|
QtFontFoundry *foundry = family->foundry(foundry_name, true);
|
||||||
|
|
||||||
QtFontStyle::Key styleKey;
|
QtFontStyle::Key styleKey;
|
||||||
styleKey.styleName = style_name;
|
QString styleName = style_name;
|
||||||
if(QCFType<CFDictionaryRef> styles = (CFDictionaryRef)CTFontDescriptorCopyAttribute(font, kCTFontTraitsAttribute)) {
|
if(QCFType<CFDictionaryRef> styles = (CFDictionaryRef)CTFontDescriptorCopyAttribute(font, kCTFontTraitsAttribute)) {
|
||||||
if(CFNumberRef weight = (CFNumberRef)CFDictionaryGetValue(styles, kCTFontWeightTrait)) {
|
if(CFNumberRef weight = (CFNumberRef)CFDictionaryGetValue(styles, kCTFontWeightTrait)) {
|
||||||
Q_ASSERT(CFNumberIsFloatType(weight));
|
Q_ASSERT(CFNumberIsFloatType(weight));
|
||||||
@ -134,7 +134,7 @@ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtFontStyle *style = foundry->style(styleKey, true);
|
QtFontStyle *style = foundry->style(styleKey, styleName, true);
|
||||||
style->smoothScalable = true;
|
style->smoothScalable = true;
|
||||||
if(QCFType<CFNumberRef> size = (CFNumberRef)CTFontDescriptorCopyAttribute(font, kCTFontSizeAttribute)) {
|
if(QCFType<CFNumberRef> size = (CFNumberRef)CTFontDescriptorCopyAttribute(font, kCTFontSizeAttribute)) {
|
||||||
//qDebug() << "WHEE";
|
//qDebug() << "WHEE";
|
||||||
@ -207,7 +207,7 @@ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
|
|||||||
|
|
||||||
QtFontFamily *family = db->family(familyName, true);
|
QtFontFamily *family = db->family(familyName, true);
|
||||||
QtFontFoundry *foundry = family->foundry(QString(), true);
|
QtFontFoundry *foundry = family->foundry(QString(), true);
|
||||||
QtFontStyle *style = foundry->style(styleKey, true);
|
QtFontStyle *style = foundry->style(styleKey, QString(), true);
|
||||||
style->pixelSize(0, true);
|
style->pixelSize(0, true);
|
||||||
style->smoothScalable = true;
|
style->smoothScalable = true;
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user