diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 6 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo.h | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 26 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.h | 8 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 55 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.h | 12 | ||||
-rw-r--r-- | src/corelib/tools/qeasingcurve.cpp | 69 | ||||
-rw-r--r-- | src/corelib/tools/qeasingcurve.h | 11 |
8 files changed, 178 insertions, 12 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index d5041c9..9490225 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -266,6 +266,11 @@ QLibraryInfo::location(LibraryLocation loc) path = QT_CONFIGURE_PLUGINS_PATH; break; #endif +#ifdef QT_CONFIGURE_IMPORTS_PATH + case ImportsPath: + path = QT_CONFIGURE_IMPORTS_PATH; + break; +#endif #ifdef QT_CONFIGURE_DATA_PATH case DataPath: path = QT_CONFIGURE_DATA_PATH; @@ -470,6 +475,7 @@ QLibraryInfo::location(LibraryLocation loc) \value LibrariesPath The location of installed librarires. \value BinariesPath The location of installed Qt binaries (tools and applications). \value PluginsPath The location of installed Qt plugins. + \value ImportsPath The location of installed QML extensions to import. \value DataPath The location of general Qt data. \value TranslationsPath The location of translation information for Qt strings. \value SettingsPath The location for Qt settings. diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index e64b760..4a7ba06 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -76,7 +76,8 @@ public: TranslationsPath, SettingsPath, DemosPath, - ExamplesPath + ExamplesPath, + ImportsPath }; static QString location(LibraryLocation); // ### Qt 5: consider renaming it to path() diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 870baab..9e187d4 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -48,6 +48,7 @@ #include "qstringlist.h" #include "qvector.h" #include "qlocale.h" +#include "qeasingcurve.h" #ifdef QT_BOOTSTRAPPED # ifndef QT_NO_GEOM_VARIANT @@ -176,6 +177,7 @@ QT_BEGIN_NAMESPACE \value QVector3D QVector3D \value QVector4D QVector4D \value QQuaternion QQuaternion + \value QEasingCurve QEasingCurve \value User Base value for user types @@ -256,6 +258,7 @@ static const struct { const char * typeName; int type; } types[] = { {"QPointF", QMetaType::QPointF}, {"QRegExp", QMetaType::QRegExp}, {"QVariantHash", QMetaType::QVariantHash}, + {"QEasingCurve", QMetaType::QEasingCurve}, /* All GUI types */ {"QColorGroup", 63}, @@ -666,6 +669,11 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data) stream << *static_cast<const NS(QRegExp)*>(data); break; #endif +#ifndef QT_BOOTSTRAPPED + case QMetaType::QEasingCurve: + stream << *static_cast<const NS(QEasingCurve)*>(data); + break; +#endif #ifdef QT3_SUPPORT case QMetaType::QColorGroup: #endif @@ -863,6 +871,11 @@ bool QMetaType::load(QDataStream &stream, int type, void *data) stream >> *static_cast< NS(QRegExp)*>(data); break; #endif +#ifndef QT_BOOTSTRAPPED + case QMetaType::QEasingCurve: + stream >> *static_cast< NS(QEasingCurve)*>(data); + break; +#endif #ifdef QT3_SUPPORT case QMetaType::QColorGroup: #endif @@ -1007,6 +1020,10 @@ void *QMetaType::construct(int type, const void *copy) case QMetaType::QRegExp: return new NS(QRegExp)(*static_cast<const NS(QRegExp)*>(copy)); #endif +#ifndef QT_BOOTSTRAPPED + case QMetaType::QEasingCurve: + return new NS(QEasingCurve)(*static_cast<const NS(QEasingCurve)*>(copy)); +#endif case QMetaType::Void: return 0; default: @@ -1098,6 +1115,10 @@ void *QMetaType::construct(int type, const void *copy) case QMetaType::QRegExp: return new NS(QRegExp); #endif +#ifndef QT_BOOTSTRAPPED + case QMetaType::QEasingCurve: + return new NS(QEasingCurve); +#endif case QMetaType::Void: return 0; default: @@ -1253,6 +1274,11 @@ void QMetaType::destroy(int type, void *data) delete static_cast< NS(QRegExp)* >(data); break; #endif +#ifndef QT_BOOTSTRAPPED + case QMetaType::QEasingCurve: + delete static_cast< NS(QEasingCurve)* >(data); + break; +#endif case QMetaType::Void: break; default: { diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index c23caed..33126e8 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -69,7 +69,7 @@ public: QBitArray = 13, QDate = 14, QTime = 15, QDateTime = 16, QUrl = 17, QLocale = 18, QRect = 19, QRectF = 20, QSize = 21, QSizeF = 22, QLine = 23, QLineF = 24, QPoint = 25, QPointF = 26, QRegExp = 27, - QVariantHash = 28, LastCoreType = 28 /* QVariantHash */, + QVariantHash = 28, QEasingCurve = 29, LastCoreType = QEasingCurve, FirstGuiType = 63 /* QColorGroup */, #ifdef QT3_SUPPORT @@ -81,12 +81,12 @@ public: QTextLength = 78, QTextFormat = 79, QMatrix = 80, QTransform = 81, QMatrix4x4 = 82, QVector2D = 83, QVector3D = 84, QVector4D = 85, QQuaternion = 86, - LastGuiType = 86 /* QQuaternion */, + LastGuiType = QQuaternion, FirstCoreExtType = 128 /* VoidStar */, VoidStar = 128, Long = 129, Short = 130, Char = 131, ULong = 132, UShort = 133, UChar = 134, Float = 135, QObjectStar = 136, QWidgetStar = 137, - LastCoreExtType = 137 /* QWidgetStar */, + LastCoreExtType = QWidgetStar, // This logic must match the one in qglobal.h #if defined(QT_COORD_TYPE) @@ -290,6 +290,7 @@ class QPointF; #ifndef QT_NO_REGEXP class QRegExp; #endif +class QEasingCurve; class QWidget; class QObject; @@ -359,6 +360,7 @@ Q_DECLARE_BUILTIN_METATYPE(QPointF, QPointF) #ifndef QT_NO_REGEXP Q_DECLARE_BUILTIN_METATYPE(QRegExp, QRegExp) #endif +Q_DECLARE_BUILTIN_METATYPE(QEasingCurve, QEasingCurve) #ifdef QT3_SUPPORT Q_DECLARE_BUILTIN_METATYPE(QColorGroup, QColorGroup) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index e1b5825..384a3cd 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -46,6 +46,7 @@ #include "qdebug.h" #include "qmap.h" #include "qdatetime.h" +#include "qeasingcurve.h" #include "qlist.h" #include "qstring.h" #include "qstringlist.h" @@ -146,6 +147,11 @@ static void construct(QVariant::Private *x, const void *copy) v_construct<QRegExp>(x, copy); break; #endif +#ifndef QT_BOOTSTRAPPED + case QVariant::EasingCurve: + v_construct<QEasingCurve>(x, copy); + break; +#endif case QVariant::Int: x->data.i = copy ? *static_cast<const int *>(copy) : 0; break; @@ -259,6 +265,11 @@ static void clear(QVariant::Private *d) v_clear<QRegExp>(d); break; #endif +#ifndef QT_BOOTSTRAPPED + case QVariant::EasingCurve: + v_clear<QEasingCurve>(d); + break; +#endif case QVariant::LongLong: case QVariant::ULongLong: case QVariant::Double: @@ -317,6 +328,9 @@ static bool isNull(const QVariant::Private *d) case QVariant::PointF: return v_cast<QPointF>(d)->isNull(); #endif +#ifndef QT_BOOTSTRAPPED + case QVariant::EasingCurve: +#endif case QVariant::Url: case QVariant::Locale: case QVariant::RegExp: @@ -435,6 +449,10 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) return *v_cast<QTime>(a) == *v_cast<QTime>(b); case QVariant::DateTime: return *v_cast<QDateTime>(a) == *v_cast<QDateTime>(b); +#ifndef QT_BOOTSTRAPPED + case QVariant::EasingCurve: + return *v_cast<QEasingCurve>(a) == *v_cast<QEasingCurve>(b); +#endif case QVariant::ByteArray: return *v_cast<QByteArray>(a) == *v_cast<QByteArray>(b); case QVariant::BitArray: @@ -1097,6 +1115,11 @@ static void streamDebug(QDebug dbg, const QVariant &v) case QVariant::DateTime: dbg.nospace() << v.toDateTime(); break; +#ifndef QT_BOOTSTRAPPED + case QVariant::EasingCurve: + dbg.nospace() << v.toEasingCurve(); + break; +#endif case QVariant::ByteArray: dbg.nospace() << v.toByteArray(); break; @@ -1265,6 +1288,7 @@ const QVariant::Handler *QVariant::handler = &qt_kernel_variant_handler; \value Date a QDate \value DateTime a QDateTime \value Double a double + \value EasingCurve a QEasingCurve \value Font a QFont \value Hash a QVariantHash \value Icon a QIcon @@ -1483,6 +1507,12 @@ QVariant::QVariant(const char *val) */ /*! + \fn QVariant::QVariant(const QEasingCurve &val) + + Constructs a new variant with an easing curve value, \a val. +*/ + +/*! \fn QVariant::QVariant(const QByteArray &val) Constructs a new variant with a bytearray value, \a val. @@ -1681,6 +1711,10 @@ QVariant::QVariant(const QTime &val) { d.is_null = false; d.type = Time; v_construct<QTime>(&d, val); } QVariant::QVariant(const QDateTime &val) { d.is_null = false; d.type = DateTime; v_construct<QDateTime>(&d, val); } +#ifndef QT_BOOTSTRAPPED +QVariant::QVariant(const QEasingCurve &val) +{ d.is_null = false; d.type = EasingCurve; v_construct<QEasingCurve>(&d, val); } +#endif QVariant::QVariant(const QList<QVariant> &list) { d.is_null = false; d.type = List; v_construct<QVariantList>(&d, list); } QVariant::QVariant(const QMap<QString, QVariant> &map) @@ -1870,7 +1904,7 @@ QVariant::Type QVariant::nameToType(const char *name) } #ifndef QT_NO_DATASTREAM -enum { MapFromThreeCount = 35 }; +enum { MapFromThreeCount = 36 }; static const ushort map_from_three[MapFromThreeCount] = { QVariant::Invalid, @@ -1902,6 +1936,7 @@ static const ushort map_from_three[MapFromThreeCount] = QVariant::Date, QVariant::Time, QVariant::DateTime, + QVariant::EasingCurve, QVariant::ByteArray, QVariant::BitArray, QVariant::KeySequence, @@ -2165,6 +2200,21 @@ QDateTime QVariant::toDateTime() const } /*! + \fn QEasingCurve QVariant::toEasingCurve() const + + Returns the variant as a QEasingCurve if the variant has type() \l + EasingCurve; otherwise returns a default easing curve. + + \sa canConvert(), convert() +*/ +#ifndef QT_BOOTSTRAPPED +QEasingCurve QVariant::toEasingCurve() const +{ + return qVariantToHelper<QEasingCurve>(d, EasingCurve, handler); +} +#endif + +/*! \fn QByteArray QVariant::toByteArray() const Returns the variant as a QByteArray if the variant has type() \l @@ -2605,8 +2655,9 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] = /*QRegExp*/ 0, -/*QHash*/ 0 +/*QHash*/ 0, +/*QEasingCurve*/ 0 }; /*! diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 1a9e43a..9628dbf 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -60,6 +60,7 @@ class QBitArray; class QDataStream; class QDate; class QDateTime; +class QEasingCurve; class QLine; class QLineF; class QLocale; @@ -128,9 +129,10 @@ class Q_CORE_EXPORT QVariant LineF = 24, Point = 25, PointF = 26, - RegExp = 27, + RegExp = 27, Hash = 28, - LastCoreType = Hash, + EasingCurve = 29, + LastCoreType = EasingCurve, // value 62 is internally reserved #ifdef QT3_SUPPORT @@ -219,6 +221,9 @@ class Q_CORE_EXPORT QVariant #ifndef QT_NO_REGEXP QVariant(const QRegExp ®Exp); #endif +#ifndef QT_BOOTSTRAPPED + QVariant(const QEasingCurve &easing); +#endif QVariant(Qt::GlobalColor color); QVariant& operator=(const QVariant &other); @@ -280,6 +285,9 @@ class Q_CORE_EXPORT QVariant #ifndef QT_NO_REGEXP QRegExp toRegExp() const; #endif +#ifndef QT_BOOTSTRAPPED + QEasingCurve toEasingCurve() const; +#endif #ifdef QT3_SUPPORT inline QT3_SUPPORT int &asInt(); diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index b6a2df4..89edb2d 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -600,11 +600,11 @@ QEasingCurve::QEasingCurve(Type type) Construct a copy of \a other. */ QEasingCurve::QEasingCurve(const QEasingCurve &other) -: d_ptr(new QEasingCurvePrivate) + : d_ptr(new QEasingCurvePrivate) { // ### non-atomic, requires malloc on shallow copy *d_ptr = *other.d_ptr; - if(other.d_ptr->config) + if (other.d_ptr->config) d_ptr->config = other.d_ptr->config->copy(); } @@ -629,7 +629,7 @@ QEasingCurve &QEasingCurve::operator=(const QEasingCurve &other) } *d_ptr = *other.d_ptr; - if(other.d_ptr->config) + if (other.d_ptr->config) d_ptr->config = other.d_ptr->config->copy(); return *this; @@ -845,6 +845,67 @@ QDebug operator<<(QDebug debug, const QEasingCurve &item) } return debug; } -#endif +#endif // QT_NO_DEBUG_STREAM + +#ifndef QT_NO_DATASTREAM +/*! + \fn QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing) + \relates QEasingCurve + + Writes the given \a easing curve to the given \a stream and returns a + reference to the stream. + + \sa {Format of the QDataStream Operators} +*/ + +QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing) +{ + stream << easing.d_ptr->type; + stream << quint64(intptr_t(easing.d_ptr->func)); + + bool hasConfig = easing.d_ptr->config; + stream << hasConfig; + if (hasConfig) { + stream << easing.d_ptr->config->_p; + stream << easing.d_ptr->config->_a; + stream << easing.d_ptr->config->_o; + } + return stream; +} + +/*! + \fn QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) + \relates QQuaternion + + Reads an easing curve from the given \a stream into the given \a quaternion + and returns a reference to the stream. + + \sa {Format of the QDataStream Operators} +*/ + +QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) +{ + QEasingCurve::Type type; + int int_type; + stream >> int_type; + type = static_cast<QEasingCurve::Type>(int_type); + easing.setType(type); + + quint64 ptr_func; + stream >> ptr_func; + easing.d_ptr->func = QEasingCurve::EasingFunction(intptr_t(ptr_func)); + + bool hasConfig; + stream >> hasConfig; + if (hasConfig) { + QEasingCurveFunction *config = curveToFunctionObject(type); + stream >> config->_p; + stream >> config->_a; + stream >> config->_o; + easing.d_ptr->config = config; + } + return stream; +} +#endif // QT_NO_DATASTREAM QT_END_NAMESPACE diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h index ae8822e..173fba4 100644 --- a/src/corelib/tools/qeasingcurve.h +++ b/src/corelib/tools/qeasingcurve.h @@ -100,13 +100,24 @@ public: qreal valueForProgress(qreal progress) const; private: QEasingCurvePrivate *d_ptr; +#ifndef QT_NO_DEBUG_STREAM friend Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item); +#endif +#ifndef QT_NO_DATASTREAM + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve&); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &); +#endif }; #ifndef QT_NO_DEBUG_STREAM Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item); #endif +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve&); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &); +#endif + QT_END_NAMESPACE QT_END_HEADER |