diff options
-rw-r--r-- | qtinterface/tqmovie.cpp | 34 | ||||
-rw-r--r-- | qtinterface/tqmovie.h | 17 | ||||
-rw-r--r-- | qtinterface/tqt.h | 15 | ||||
-rw-r--r-- | qtinterface/tqvariant.cpp | 106 | ||||
-rw-r--r-- | qtinterface/tqvariant.h | 2 |
5 files changed, 170 insertions, 4 deletions
diff --git a/qtinterface/tqmovie.cpp b/qtinterface/tqmovie.cpp index 866a8cc..20367dd 100644 --- a/qtinterface/tqmovie.cpp +++ b/qtinterface/tqmovie.cpp @@ -21,3 +21,37 @@ Boston, MA 02110-1301, USA. #include <tqt.h> #include <tqmovie.h> + +#ifdef USE_QT4 + +// TQMovie::TQMovie(QObject *parent) : QMovie(parent) {} +// TQMovie::TQMovie(QIODevice *device, const QByteArray &format, QObject *parent) : QMovie(device, format, parent) {} +// TQMovie::TQMovie(const QString &fileName, const QByteArray &format, QObject *parent) : QMovie(fileName, format, parent) {} + +TQMovie::TQMovie(QObject *parent) { + d = new QMovie(parent); +} + +TQMovie::TQMovie(QIODevice *device, const QByteArray &format, QObject *parent) { + d = new QMovie(device, format, parent); +} + +TQMovie::TQMovie(const QString &fileName, const QByteArray &format, QObject *parent) { + d = new QMovie(fileName, format, parent); +} + +TQMovie::operator QMovie *() const { + return d; +} + +/*! + Makes this movie use the same data as movie \a movie. QMovies use + explicit sharing. +*/ +TQMovie& TQMovie::operator=(const TQMovie& movie) +{ + d = movie.d; + return *this; +} + +#endif // USE_QT4
\ No newline at end of file diff --git a/qtinterface/tqmovie.h b/qtinterface/tqmovie.h index a5f22b2..b4b21fd 100644 --- a/qtinterface/tqmovie.h +++ b/qtinterface/tqmovie.h @@ -38,7 +38,22 @@ Boston, MA 02110-1301, USA. // Reimplement the QMovie class // For Qt4, some changes are needed -#include <Qt/qmovie.h> +#include <tqt4/Qt/qmovie.h> + +class TQMovie { +public: + TQMovie(QObject *parent = 0); + explicit TQMovie(QIODevice *device, const QByteArray &format = QByteArray(), QObject *parent = 0); + explicit TQMovie(const QString &fileName, const QByteArray &format = QByteArray(), QObject *parent = 0); + ~TQMovie(); + + operator QMovie *() const; + + TQMovie& operator=(const TQMovie&); + +private: + QMovie *d; +}; #endif // USE_QT4 diff --git a/qtinterface/tqt.h b/qtinterface/tqt.h index 1a73049..f4c50bf 100644 --- a/qtinterface/tqt.h +++ b/qtinterface/tqt.h @@ -24,6 +24,9 @@ Boston, MA 02110-1301, USA. #define USE_QTX +// DEBUG ONLY REMOVE ME TEST +#define USE_QT4 + #ifdef USE_QT4 #define QT3_SUPPORT #endif @@ -45,6 +48,9 @@ Boston, MA 02110-1301, USA. #endif // __cplusplus #ifdef USE_QT3 +#define qint64 long +#define quint64 unsigned long + #define tqchildren children #define tqaccess access #define tqcolorTable colorTable @@ -599,6 +605,7 @@ class QUObject; #include <tqt4/Qt/qiodevice.h> #undef QT_NO_QOBJECT #include <tqt4/Qt/qdatastream.h> +#include <tqt4/Qt/qvariant.h> #include <tqt4/Qt/qmetaobject.h> #include <tqeventloop.h> #include <tqt4/Qt/qpaintdevice.h> @@ -620,11 +627,14 @@ class QUObject; #include <tqt4/Qt/qmenudata.h> #include <tqt4/Qt/qdir.h> #include <tqt4/Qt/qtooltip.h> +#include <tqt4/Qt/qmovie.h> + #include <Qt/q3strlist.h> #include <Qt/qx11info_x11.h> #include <Qt/q3combobox.h> +#include <Qt/q3groupbox.h> #include <Qt/q3popupmenu.h> #include <Qt/q3progressbar.h> #include <Qt/q3textstream.h> @@ -785,7 +795,8 @@ class QUObject; #define WState Qt::WidgetAttribute #define WState_Polished Qt::WA_WState_Polished -#define WState_ForceHide Qt::WA_WState_ForceHide +//#define WState_ForceHide Qt::WA_WState_ForceHide +#define WState_ForceHide Qt::WA_WState_Hidden #define WStyle_Customize Qt::WStyle_Customize #define WType_Popup Qt::WType_Popup @@ -1078,7 +1089,7 @@ class QUObject; #define TQMacMime QMacMime #define TQMotifPlusStyle QMotifPlusStyle #define TQMotifStyle QMotifStyle -#define TQMovie QMovie +//#define TQMovie QMovie #define TQMultiLineEdit Q3MultiLineEdit #define TQMutex QMutex #define TQMutexLocker QMutexLocker diff --git a/qtinterface/tqvariant.cpp b/qtinterface/tqvariant.cpp index 3672da7..981922e 100644 --- a/qtinterface/tqvariant.cpp +++ b/qtinterface/tqvariant.cpp @@ -21,3 +21,109 @@ Boston, MA 02110-1301, USA. #include <tqt.h> #include <tqvariant.h> + +#include <Qt/qbitmap.h> + +#ifdef USE_QT4 + +// This is taken straight from <private/qvariant_p.h> +#ifdef Q_CC_SUN // Sun CC picks the wrong overload, so introduce awful hack + +template <typename T> +inline T *v_cast(const QVariant::Private *nd, T * = 0) +{ + QVariant::Private *d = const_cast<QVariant::Private *>(nd); + return ((sizeof(T) > sizeof(QVariant::Private::Data)) + ? static_cast<T *>(d->data.shared->ptr) + : static_cast<T *>(static_cast<void *>(&d->data.c))); +} + +#else // every other compiler in this world + +template <typename T> +inline const T *v_cast(const QVariant::Private *d, T * = 0) +{ + return ((sizeof(T) > sizeof(QVariant::Private::Data)) + ? static_cast<const T *>(d->data.shared->ptr) + : static_cast<const T *>(static_cast<const void *>(&d->data.c))); +} + +template <typename T> +inline T *v_cast(QVariant::Private *d, T * = 0) +{ + return ((sizeof(T) > sizeof(QVariant::Private::Data)) + ? static_cast<T *>(d->data.shared->ptr) + : static_cast<T *>(static_cast<void *>(&d->data.c))); +} + +#endif + +template <typename T> +inline T qVariantToHelper(const QVariant::Private &d, QVariant::Type t, + const QVariant::Handler *handler, T * = 0) +{ + if (d.type == t) + return *v_cast<T>(&d); + + T ret; + handler->convert(&d, t, &ret, 0); + return ret; +} + +QFont QVariant::toFont() const { + return qVariantToHelper<QFont>(d, Font, handler); +} + +QColor QVariant::toColor() const { + return qVariantToHelper<QColor>(d, Color, handler); +} + +QCursor QVariant::toCursor() const { + return qVariantToHelper<QCursor>(d, Cursor, handler); +} + +QBitmap QVariant::toBitmap() const { + return qVariantToHelper<QBitmap>(d, Bitmap, handler); +} + +Q3PointArray QVariant::toPointArray() const { + return qVariantToHelper<Q3PointArray>(d, PointArray, handler); +} + +QRegion QVariant::toRegion() const { + return qVariantToHelper<QRegion>(d, Region, handler); +} + +QPixmap QVariant::toPixmap() const { + return qVariantToHelper<QPixmap>(d, Pixmap, handler); +} + +QImage QVariant::toImage() const { + return qVariantToHelper<QImage>(d, Image, handler); +} + +QBrush QVariant::toBrush() const { + return qVariantToHelper<QBrush>(d, Brush, handler); +} + +QPalette QVariant::toPalette() const { + return qVariantToHelper<QPalette>(d, Palette, handler); +} + +QColorGroup QVariant::toColorGroup() const { + return qVariantToHelper<QColorGroup>(d, ColorGroup, handler); +} + +QIconSet QVariant::toIconSet() const { + return qVariantToHelper<QIconSet>(d, IconSet, handler); +} + +QFont QVariant::asFont() { + return toFont(); +} + +QColor QVariant::asColor() { + return toColor(); +} + +#endif // USE_QT4
\ No newline at end of file diff --git a/qtinterface/tqvariant.h b/qtinterface/tqvariant.h index 2f632aa..0f5559b 100644 --- a/qtinterface/tqvariant.h +++ b/qtinterface/tqvariant.h @@ -39,7 +39,7 @@ Boston, MA 02110-1301, USA. // Reimplement the QVariant class // For Qt4, some changes are needed -#include <Qt/qvariant.h> +#include <tqt4/Qt/qvariant.h> #endif // USE_QT4 |